diff --git a/newadmin/admin/src/main/java/com/chaozhanggui/admin/system/controller/NotifyController.java b/newadmin/admin/src/main/java/com/chaozhanggui/admin/system/controller/NotifyController.java index bec9b88..b42275e 100644 --- a/newadmin/admin/src/main/java/com/chaozhanggui/admin/system/controller/NotifyController.java +++ b/newadmin/admin/src/main/java/com/chaozhanggui/admin/system/controller/NotifyController.java @@ -1,6 +1,7 @@ package com.chaozhanggui.admin.system.controller; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; import com.chaozhanggui.merchant.service.HfMerService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -35,6 +36,26 @@ public class NotifyController { return "SUCCESS"; } + + @PostMapping("testFeedCallBack") + public String feedCallBack(@RequestBody JSONObject object){ + log.info(object.toJSONString()); + String type = object.getString("type"); + //验签请参data + String data = object.getString("data"); + //验签请参sign + String sign = object.getString("sign"); + hfMerService.callBack(type.substring(1,type.length()-1),data.substring(1,data.length()-1),sign.substring(1,sign.length()-1)); + return "SUCCESS"; + } + + + @PostMapping("authUser") + public String authUser(@RequestParam("requestId") String requestId){ + hfMerService.authInfo(requestId); + return "SUCCESS"; + } + @PostMapping("merchantResident") public String merchantResident(@RequestParam("userId") String userId){ hfMerService.merchantResident(userId,null); diff --git a/newadmin/admin/src/main/java/com/chaozhanggui/admin/system/interceptor/LoginInterceptor.java b/newadmin/admin/src/main/java/com/chaozhanggui/admin/system/interceptor/LoginInterceptor.java index dd4aa4c..6938d6a 100644 --- a/newadmin/admin/src/main/java/com/chaozhanggui/admin/system/interceptor/LoginInterceptor.java +++ b/newadmin/admin/src/main/java/com/chaozhanggui/admin/system/interceptor/LoginInterceptor.java @@ -39,7 +39,10 @@ public class LoginInterceptor implements HandlerInterceptor { // 获取进过拦截器的路径 String requestURI = request.getRequestURI(); - if("/admin/notifyCallback/feedCallBack".equals(requestURI)||"/admin/notifyCallback/merchantResident".equals(requestURI)){ + if("/admin/notifyCallback/feedCallBack".equals(requestURI)||"/admin/notifyCallback/merchantResident".equals(requestURI) + ||"/admin/notifyCallback/testFeedCallBack".equals(requestURI) + ||"/admin/notifyCallback/authUser".equals(requestURI) + ){ return true; } diff --git a/newadmin/admin/src/main/resources/application-dev.yml b/newadmin/admin/src/main/resources/application-dev.yml index a608bf1..e4549e8 100644 --- a/newadmin/admin/src/main/resources/application-dev.yml +++ b/newadmin/admin/src/main/resources/application-dev.yml @@ -10,9 +10,9 @@ spring: maxWait: 60000 redis: # redis数据库索引(默认为0),我们使用索引为3的数据库,避免和其他数据库冲突 - database: 1 + database: 0 # redis服务器地址(默认为localhost) - host: 127.0.0.1 + host: 101.37.12.135 # redis端口(默认为6379) port: 6379 # redis访问密码(默认为空) diff --git a/newadmin/admin/src/main/resources/application-test.yml b/newadmin/admin/src/main/resources/application-test.yml index 97daa60..4d7cb81 100644 --- a/newadmin/admin/src/main/resources/application-test.yml +++ b/newadmin/admin/src/main/resources/application-test.yml @@ -1,6 +1,6 @@ spring: datasource: - url: jdbc:mysql://127.0.0.1:3306/ysk_test?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useJDBCCompliantTimezoneShift=true&serverTimezone=CTT&useSSL=false + url: jdbc:mysql://101.37.12.135:3306/ysk_test?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useJDBCCompliantTimezoneShift=true&serverTimezone=CTT&useSSL=false username: ysk_test password: mysqlroot@123 driver-class-name: com.mysql.cj.jdbc.Driver @@ -12,7 +12,7 @@ spring: # redis数据库索引(默认为0),我们使用索引为3的数据库,避免和其他数据库冲突 database: 0 # redis服务器地址(默认为localhost) - host: 127.0.0.1 + host: 101.37.12.135 # redis端口(默认为6379) port: 6379 # redis访问密码(默认为空) @@ -33,9 +33,9 @@ spring: max-request-size: 30MB hf: account: - backUrl: http://newadminapi.sxczgkj.cn/admin/notifyCallback/feedCallBack + backUrl: https://p40312246f.goho.co/admin/notifyCallback/feedCallBack wxLite: appId: wxfc7bd92a462eb191 wxPub: appId: wxfc7bd92a462eb191 - path: https://ky.sxczgkj.cn/wap/api/trans/pay \ No newline at end of file + path: http://admintestapi.sxczgkj.cn/wap/api/trans/pay \ No newline at end of file diff --git a/newadmin/admin/src/main/resources/application.yml b/newadmin/admin/src/main/resources/application.yml index aa19ac9..568cd2a 100644 --- a/newadmin/admin/src/main/resources/application.yml +++ b/newadmin/admin/src/main/resources/application.yml @@ -1,6 +1,6 @@ spring: profiles: - active: dev + active: test server: port: 18071 servlet: diff --git a/newadmin/common-api/src/main/java/com/chaozhanggui/common/system/config/RespBody.java b/newadmin/common-api/src/main/java/com/chaozhanggui/common/system/config/RespBody.java index d5eb1e8..0558eb0 100644 --- a/newadmin/common-api/src/main/java/com/chaozhanggui/common/system/config/RespBody.java +++ b/newadmin/common-api/src/main/java/com/chaozhanggui/common/system/config/RespBody.java @@ -1,9 +1,11 @@ package com.chaozhanggui.common.system.config; +import com.alibaba.fastjson.JSONObject; import com.chaozhanggui.common.system.util.ExceptionUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.util.List; import java.util.Objects; //命名区别于ResponseBody注解 @@ -20,6 +22,8 @@ public class RespBody { setMessage(ExceptionUtil.map.get(code)); } + + public RespBody(Exception e) { if(e.getMessage().substring(0,1).equals("!")){ setMessage(e.getMessage(),"-60009"); @@ -40,25 +44,21 @@ public class RespBody { } public RespBody(String code,Object data){ - this.code=code; - this.data=data; + this.code = code; + this.data = data; setMessage(ExceptionUtil.map.get(code)); } - public RespBody(String code,String message){ - this.code=code; - this.message=message; + this.code = code; + this.message = message; } - public RespBody(String code){ this.code=code; setMessage(ExceptionUtil.map.get(code)); } - public String getCode() { return code; } - public void setCode(String code) { this.code = code; setMessage(ExceptionUtil.map.get(code)); @@ -75,7 +75,7 @@ public class RespBody { public void setMessage(String message,String code) { this.message = message; - this.code=code; + this.code = code; } public Object getData() { @@ -85,4 +85,5 @@ public class RespBody { public void setData(Object data) { this.data = data; } + } diff --git a/newadmin/common-api/src/main/java/com/chaozhanggui/common/system/util/StringUtil.java b/newadmin/common-api/src/main/java/com/chaozhanggui/common/system/util/StringUtil.java index f81aaae..5b4a8fb 100644 --- a/newadmin/common-api/src/main/java/com/chaozhanggui/common/system/util/StringUtil.java +++ b/newadmin/common-api/src/main/java/com/chaozhanggui/common/system/util/StringUtil.java @@ -102,7 +102,6 @@ public class StringUtil extends StringUtils { */ public static synchronized String getBillno() { StringBuilder billno = new StringBuilder(); - // 日期(格式:20080524) SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmssSSS"); billno.append(format.format(new Date())); diff --git a/newadmin/dao-api/src/main/java/com/chaozhanggui/dao/system/dao/TbPlussMerchantHfInfoMapper.java b/newadmin/dao-api/src/main/java/com/chaozhanggui/dao/system/dao/TbPlussMerchantHfInfoMapper.java index eb960f7..18f8a9f 100644 --- a/newadmin/dao-api/src/main/java/com/chaozhanggui/dao/system/dao/TbPlussMerchantHfInfoMapper.java +++ b/newadmin/dao-api/src/main/java/com/chaozhanggui/dao/system/dao/TbPlussMerchantHfInfoMapper.java @@ -20,7 +20,7 @@ public interface TbPlussMerchantHfInfoMapper { int updateByPrimaryKey(TbPlussMerchantHfInfo record); - TbPlussMerchantHfInfo selectByMerchantCodeAndSubApiKey(@Param("merchantCode") String merchantCode,@Param("liveApiKey") String liveApiKey); + TbPlussMerchantHfInfo selectByMerchantCodeAndSubApiKey(@Param("merchantCode") String merchantCode, @Param("liveApiKey") String liveApiKey); TbPlussMerchantHfInfo selectByMerchantCode(String merchantCode); diff --git a/newadmin/dao-api/src/main/java/com/chaozhanggui/dao/system/entity/TbPlussMerchantHfInfo.java b/newadmin/dao-api/src/main/java/com/chaozhanggui/dao/system/entity/TbPlussMerchantHfInfo.java index 9d8db5d..3f48a0d 100644 --- a/newadmin/dao-api/src/main/java/com/chaozhanggui/dao/system/entity/TbPlussMerchantHfInfo.java +++ b/newadmin/dao-api/src/main/java/com/chaozhanggui/dao/system/entity/TbPlussMerchantHfInfo.java @@ -20,6 +20,10 @@ public class TbPlussMerchantHfInfo implements Serializable { private String appName; + private String pucKey; + + private String privKey; + private String loginPwd; private Date createTime; @@ -92,6 +96,22 @@ public class TbPlussMerchantHfInfo implements Serializable { this.appName = appName == null ? null : appName.trim(); } + public String getPucKey() { + return pucKey; + } + + public void setPucKey(String pucKey) { + this.pucKey = pucKey == null ? null : pucKey.trim(); + } + + public String getPrivKey() { + return privKey; + } + + public void setPrivKey(String privKey) { + this.privKey = privKey == null ? null : privKey.trim(); + } + public String getLoginPwd() { return loginPwd; } diff --git a/newadmin/dao-api/src/main/resources/generator-mapper/generatorConfig.xml b/newadmin/dao-api/src/main/resources/generator-mapper/generatorConfig.xml index a36747d..05ba109 100644 --- a/newadmin/dao-api/src/main/resources/generator-mapper/generatorConfig.xml +++ b/newadmin/dao-api/src/main/resources/generator-mapper/generatorConfig.xml @@ -53,7 +53,7 @@ -
diff --git a/newadmin/dao-api/src/main/resources/mapper/TbPlussMerchantHfInfoMapper.xml b/newadmin/dao-api/src/main/resources/mapper/TbPlussMerchantHfInfoMapper.xml index 0892fb1..be2ff1e 100644 --- a/newadmin/dao-api/src/main/resources/mapper/TbPlussMerchantHfInfoMapper.xml +++ b/newadmin/dao-api/src/main/resources/mapper/TbPlussMerchantHfInfoMapper.xml @@ -10,13 +10,15 @@ + + id, merchant_code, status, test_api_key, live_api_key, app_id_list, app_id, app_name, - login_pwd, create_time, update_time + puc_key, priv_key, login_pwd, create_time, update_time + + + + + + + + + delete from tb_pluss_merchant_hf_info where id = #{id,jdbcType=INTEGER} @@ -31,12 +46,14 @@ insert into tb_pluss_merchant_hf_info (id, merchant_code, status, test_api_key, live_api_key, app_id_list, - app_id, app_name, login_pwd, - create_time, update_time) + app_id, app_name, puc_key, + priv_key, login_pwd, create_time, + update_time) values (#{id,jdbcType=INTEGER}, #{merchantCode,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{testApiKey,jdbcType=VARCHAR}, #{liveApiKey,jdbcType=VARCHAR}, #{appIdList,jdbcType=VARCHAR}, - #{appId,jdbcType=VARCHAR}, #{appName,jdbcType=VARCHAR}, #{loginPwd,jdbcType=VARCHAR}, - #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}) + #{appId,jdbcType=VARCHAR}, #{appName,jdbcType=VARCHAR}, #{pucKey,jdbcType=VARCHAR}, + #{privKey,jdbcType=VARCHAR}, #{loginPwd,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, + #{updateTime,jdbcType=TIMESTAMP}) insert into tb_pluss_merchant_hf_info @@ -65,6 +82,12 @@ app_name, + + puc_key, + + + priv_key, + login_pwd, @@ -100,6 +123,12 @@ #{appName,jdbcType=VARCHAR}, + + #{pucKey,jdbcType=VARCHAR}, + + + #{privKey,jdbcType=VARCHAR}, + #{loginPwd,jdbcType=VARCHAR}, @@ -135,6 +164,12 @@ app_name = #{appName,jdbcType=VARCHAR}, + + puc_key = #{pucKey,jdbcType=VARCHAR}, + + + priv_key = #{privKey,jdbcType=VARCHAR}, + login_pwd = #{loginPwd,jdbcType=VARCHAR}, @@ -156,17 +191,11 @@ app_id_list = #{appIdList,jdbcType=VARCHAR}, app_id = #{appId,jdbcType=VARCHAR}, app_name = #{appName,jdbcType=VARCHAR}, + puc_key = #{pucKey,jdbcType=VARCHAR}, + priv_key = #{privKey,jdbcType=VARCHAR}, login_pwd = #{loginPwd,jdbcType=VARCHAR}, create_time = #{createTime,jdbcType=TIMESTAMP}, update_time = #{updateTime,jdbcType=TIMESTAMP} where id = #{id,jdbcType=INTEGER} - - - - \ No newline at end of file diff --git a/newadmin/merchant-service-api/src/main/java/com/chaozhanggui/merchant/service/HfMerService.java b/newadmin/merchant-service-api/src/main/java/com/chaozhanggui/merchant/service/HfMerService.java index 7a10a27..5009c06 100644 --- a/newadmin/merchant-service-api/src/main/java/com/chaozhanggui/merchant/service/HfMerService.java +++ b/newadmin/merchant-service-api/src/main/java/com/chaozhanggui/merchant/service/HfMerService.java @@ -2049,6 +2049,16 @@ public class HfMerService { tbPlussMerchantChannelStatusMapper.updateByPrimaryKeySelective(channelStatus); } + + TbPlussMerchantHfInfo hfInfo=new TbPlussMerchantHfInfo(); + + hfInfo.setMerchantCode(baseInfo.getMerchantcode()); + hfInfo.setStatus("0"); + hfInfo.setPrivKey(privateKey); + hfInfo.setPucKey(publicKey); + hfInfo.setCreateTime(new Date()); + tbPlussMerchantHfInfoMapper.insert(hfInfo); + TbPlussMerchantAuditRecord merchantAuditRecord = new TbPlussMerchantAuditRecord(); merchantAuditRecord.setStatus("1"); merchantAuditRecord.setMerchantcode(baseInfo.getMerchantcode()); @@ -2072,20 +2082,22 @@ public class HfMerService { String publicKey= AdapayCore.PUBLIC_KEY; try { + Map map=(Map) JSON.parse(data); +// Map map=(Map) JSON.parseArray(data).get(0); + String requestId=map.get("request_id").toString(); if(AdapaySign.verifySign(data,sign,publicKey)){ +// if(true){ switch (type){ case "userEntry.succeeded": TbPlussMerchantAuditRecord record= tbPlussMerchantAuditRecordMapper.selectByApplicationid(requestId); if(ObjectUtil.isNotEmpty(record)){ TbPlussMerchantChannelStatus channelStatus= tbPlussMerchantChannelStatusMapper.selectByMerchantCode(record.getMerchantcode(),7); - TbPlussMerchantHfInfo tbPlussMerchantHfInfo=tbPlussMerchantHfInfoMapper.selectByMerchantCodeAndSubApiKey(channelStatus.getMerchantcode(),map.get("live_api_key").toString()); + TbPlussMerchantHfInfo tbPlussMerchantHfInfo=tbPlussMerchantHfInfoMapper.selectByMerchantCode(channelStatus.getMerchantcode()); if(ObjectUtil.isNotEmpty(channelStatus)){ - if(ObjectUtil.isEmpty(tbPlussMerchantHfInfo)){ - tbPlussMerchantHfInfo=new TbPlussMerchantHfInfo(); - tbPlussMerchantHfInfo.setMerchantCode(record.getMerchantcode()); + if(ObjectUtil.isNotEmpty(tbPlussMerchantHfInfo)){ tbPlussMerchantHfInfo.setTestApiKey(map.get("test_api_key").toString()); tbPlussMerchantHfInfo.setLiveApiKey(map.get("live_api_key").toString()); List app_id_list = (List) map.get("app_id_list"); @@ -2094,9 +2106,9 @@ public class HfMerService { tbPlussMerchantHfInfo.setAppId(app.get("app_id").toString()); tbPlussMerchantHfInfo.setAppName(app.get("app_name").toString()); tbPlussMerchantHfInfo.setStatus("1"); //开户成功 - tbPlussMerchantHfInfo.setLoginPwd(MD5Util.md5("hf".concat(map.get("login_pwd").toString()))); + tbPlussMerchantHfInfo.setLoginPwd((map.get("login_pwd").toString())); tbPlussMerchantHfInfo.setCreateTime(new Date()); - tbPlussMerchantHfInfoMapper.insert(tbPlussMerchantHfInfo); + tbPlussMerchantHfInfoMapper.updateByPrimaryKeySelective(tbPlussMerchantHfInfo); channelStatus.setMerchantid(map.get("live_api_key").toString()); channelStatus.setApplicationid(requestId); @@ -2109,14 +2121,6 @@ public class HfMerService { merchantResident(baseInfo,tbPlussMerchantHfInfo.getLiveApiKey(),tbPlussMerchantHfInfo.getAppId(),tbPlussMerchantHfInfo); } } - - - - - record.setStatus("9"); - record.setUpdatetime(new Date()); - - } } break; @@ -2133,122 +2137,7 @@ public class HfMerService { } break; case "resident.succeeded": - record= tbPlussMerchantAuditRecordMapper.selectByApplicationid(requestId); - if(ObjectUtil.isNotEmpty(record)&&!"5".equals(record.getThirdstatus())){ - TbPlussMerchantHfInfo hfInfo= tbPlussMerchantHfInfoMapper.selectByMerchantCodeAndSubApiKey(record.getMerchantcode(),record.getMerchantid()); - - hfInfo.setStatus("3"); //入驻成功 - hfInfo.setUpdateTime(new Date()); - tbPlussMerchantHfInfoMapper.updateByPrimaryKey(hfInfo); - - - - record.setThirdstatus("5"); - record.setUpdatetime(new Date()); - tbPlussMerchantAuditRecordMapper.updateByPrimaryKeySelective(record); - - - - //上传证照 - TbPlussMerchantBaseInfo baseInfo= tbPlussMerchantBaseInfoMapper.selectByMerchantcode(record.getMerchantcode()); - if(ObjectUtil.isNotEmpty(baseInfo)){ - map=new HashMap<>(); - TbPlussAccount account= tbPlussAccountMapper.selectByUser(baseInfo.getUserid(),"D1"); - MsgException.checkNull(account,"结算信息未提交"); - - TbPlussBankCard bankCard= tbPlussBankCardMapper.selectByPrimaryKey(Integer.valueOf(account.getBankcardid())); - MsgException.checkNull(bankCard, "结算卡信息未提交"); - - TbPlussIdCard idCard=tbPlussIdCardMapper.selectCertByUserId(baseInfo.getUserid(),baseInfo.getMerchanttype().equals("3")?"03":"01"); - MsgException.checkNull(idCard, "商户基本信息不完整"); - - - Map f=HfMerService.fileUpload(idCard.getImgpositive(),"03",record.getMerchantid()); - - if(ObjectUtil.isNotEmpty(f)&&"succeeded".equals(f.get("status"))){ - map.put("legalCertIdBackId",f.get("pic_id")); - } - - - Map z=HfMerService.fileUpload(idCard.getImgnegative(),"02",record.getMerchantid()); - - if(ObjectUtil.isNotEmpty(z)&&"succeeded".equals(z.get("status"))){ - map.put("legalCertIdFrontId",z.get("pic_id")); - } - - Map cz=null; - - Map yyzz=null; - - if(baseInfo.getMerchanttype().equals("3")){ - - TbPlussMerchantImage image= tbPlussMerchantImageMapper.selectByMerchantCodeType(baseInfo.getMerchantcode(),"03"); - MsgException.checkNull(image, "营业执照不存在"); - - yyzz= HfMerService.fileUpload(idCard.getImgpositive(),"02",record.getMerchantid()); - - if(ObjectUtil.isNotEmpty(yyzz)&&"succeeded".equals(yyzz.get("status"))){ - map.put("socialCreditCodeId",yyzz.get("pic_id")); - } - - cz=HfMerService.fileUpload(bankCard.getLicenseurl(),"05",record.getMerchantid()); - yyzz=HfMerService.fileUpload(image.getPicUrl1(),"01",record.getMerchantid()); - }else { - cz=HfMerService.fileUpload(bankCard.getImgurl(),"05",record.getMerchantid()); - StringBuffer sb=new StringBuffer(); - TbPlussMerchantImage image =tbPlussMerchantImageMapper.selectByMerchantCodeType(baseInfo.getMerchantcode(),"06"); - MsgException.checkNull(image, "门头照片不存在"); - Map mtz=HfMerService.fileUpload(image.getPicurl(),"04",record.getMerchantid()); - if(ObjectUtil.isNotEmpty(mtz)&&"succeeded".equals(mtz.get("status"))){ - sb.append(mtz.get("pic_id")); - } - image =tbPlussMerchantImageMapper.selectByMerchantCodeType(baseInfo.getMerchantcode(),"09"); - MsgException.checkNull(image, "商铺内部照片不存在"); - Map mtzz=HfMerService.fileUpload(image.getPicurl(),"04",record.getMerchantid()); - if(ObjectUtil.isNotEmpty(mtzz)&&"succeeded".equals(mtzz.get("status"))){ - sb.append("|"); - sb.append(mtzz.get("pic_id")); - } - - image =tbPlussMerchantImageMapper.selectByMerchantCodeType(baseInfo.getMerchantcode(),"08"); - MsgException.checkNull(image, "收银台照片不存在"); - Map mtzzzz=HfMerService.fileUpload(image.getPicurl(),"04",record.getMerchantid()); - if(ObjectUtil.isNotEmpty(mtzzzz)&&"succeeded".equals(mtzzzz.get("status"))){ - sb.append("|"); - sb.append(mtzzzz.get("pic_id")); - } - if(ObjectUtil.isNotEmpty(sb)){ - map.put("storeId",sb.toString()); - } - } - - if(ObjectUtil.isNotEmpty(cz)&&"succeeded".equals(cz.get("status"))){ - map.put("accountOpeningPermitId",cz.get("pic_id")); - } - - if(ObjectUtil.isNotEmpty(yyzz)&&"succeeded".equals(yyzz.get("status"))){ - map.put("socialCreditCodeId",yyzz.get("pic_id")); - - } - - log.info("request:{}",JSON.toJSONString(map)); - Map response= commitUpload(map,record.getMerchantid()); - if(ObjectUtil.isNotEmpty(response)&&(response.get("audit_status").equals("I")&&"p".equals(response.get("audit_status")))){ - - hfInfo.setStatus("4"); //商户证照一提交 - hfInfo.setUpdateTime(new Date()); - tbPlussMerchantHfInfoMapper.updateByPrimaryKey(hfInfo); - - record.setThirdstatus("5"); - record.setUpdatetime(new Date()); - tbPlussMerchantAuditRecordMapper.updateByPrimaryKeySelective(record); - -// if(response.get("audit_status").equals("P")){ -// //提交实名 -// } - } - } - } + authInfo(requestId); break; case "resident.failed": record= tbPlussMerchantAuditRecordMapper.selectByApplicationid(requestId); @@ -2280,6 +2169,129 @@ public class HfMerService { } + public void authInfo(String requestId){ + TbPlussMerchantAuditRecord record= tbPlussMerchantAuditRecordMapper.selectByApplicationid(requestId); + if(ObjectUtil.isNotEmpty(record)){ + TbPlussMerchantChannelStatus channelStatus= tbPlussMerchantChannelStatusMapper.selectByMerchantCode(record.getMerchantcode(),7); + + TbPlussMerchantHfInfo hfInfo= tbPlussMerchantHfInfoMapper.selectByMerchantCodeAndSubApiKey(record.getMerchantcode(),record.getMerchantid()); + + hfInfo.setStatus("3"); //入驻成功 + hfInfo.setUpdateTime(new Date()); + tbPlussMerchantHfInfoMapper.updateByPrimaryKey(hfInfo); + + + + record.setThirdstatus("5"); + record.setUpdatetime(new Date()); + tbPlussMerchantAuditRecordMapper.updateByPrimaryKeySelective(record); + + channelStatus.setStatus("3"); + channelStatus.setStatus("00"); + channelStatus.setMercname(null); + + tbPlussMerchantChannelStatusMapper.updateByPrimaryKeySelective(channelStatus); + Map map=null; + //上传证照 + TbPlussMerchantBaseInfo baseInfo= tbPlussMerchantBaseInfoMapper.selectByMerchantcode(record.getMerchantcode()); + if(ObjectUtil.isNotEmpty(baseInfo)){ + map=new HashMap<>(); + TbPlussAccount account= tbPlussAccountMapper.selectByUser(baseInfo.getUserid(),"D1"); + MsgException.checkNull(account,"结算信息未提交"); + + TbPlussBankCard bankCard= tbPlussBankCardMapper.selectByPrimaryKey(Integer.valueOf(account.getBankcardid())); + MsgException.checkNull(bankCard, "结算卡信息未提交"); + + TbPlussIdCard idCard=tbPlussIdCardMapper.selectCertByUserId(baseInfo.getUserid(),baseInfo.getMerchanttype().equals("3")?"03":"01"); + MsgException.checkNull(idCard, "商户基本信息不完整"); + + + Map f=HfMerService.fileUpload(idCard.getImgpositive(),"03",record.getMerchantid()); + + if(ObjectUtil.isNotEmpty(f)&&"succeeded".equals(f.get("status"))){ + map.put("legalCertIdBackId",f.get("pic_id")); + } + + + Map z=HfMerService.fileUpload(idCard.getImgnegative(),"02",record.getMerchantid()); + + if(ObjectUtil.isNotEmpty(z)&&"succeeded".equals(z.get("status"))){ + map.put("legalCertIdFrontId",z.get("pic_id")); + } + + Map cz=null; + + Map yyzz=null; + + if(baseInfo.getMerchanttype().equals("3")){ + + TbPlussMerchantImage image= tbPlussMerchantImageMapper.selectByMerchantCodeType(baseInfo.getMerchantcode(),"03"); + MsgException.checkNull(image, "营业执照不存在"); + + yyzz= HfMerService.fileUpload(idCard.getImgpositive(),"02",record.getMerchantid()); + + if(ObjectUtil.isNotEmpty(yyzz)&&"succeeded".equals(yyzz.get("status"))){ + map.put("socialCreditCodeId",yyzz.get("pic_id")); + } + + cz=HfMerService.fileUpload(bankCard.getLicenseurl(),"05",record.getMerchantid()); + yyzz=HfMerService.fileUpload(image.getPicUrl1(),"01",record.getMerchantid()); + }else { + cz=HfMerService.fileUpload(bankCard.getImgurl(),"05",record.getMerchantid()); + StringBuffer sb=new StringBuffer(); + TbPlussMerchantImage image =tbPlussMerchantImageMapper.selectByMerchantCodeType(baseInfo.getMerchantcode(),"06"); + MsgException.checkNull(image, "门头照片不存在"); + Map mtz=HfMerService.fileUpload(image.getPicurl(),"04",record.getMerchantid()); + if(ObjectUtil.isNotEmpty(mtz)&&"succeeded".equals(mtz.get("status"))){ + sb.append(mtz.get("pic_id")); + } + image =tbPlussMerchantImageMapper.selectByMerchantCodeType(baseInfo.getMerchantcode(),"09"); + MsgException.checkNull(image, "商铺内部照片不存在"); + Map mtzz=HfMerService.fileUpload(image.getPicurl(),"04",record.getMerchantid()); + if(ObjectUtil.isNotEmpty(mtzz)&&"succeeded".equals(mtzz.get("status"))){ + sb.append("|"); + sb.append(mtzz.get("pic_id")); + } + + image =tbPlussMerchantImageMapper.selectByMerchantCodeType(baseInfo.getMerchantcode(),"08"); + MsgException.checkNull(image, "收银台照片不存在"); + Map mtzzzz=HfMerService.fileUpload(image.getPicurl(),"04",record.getMerchantid()); + if(ObjectUtil.isNotEmpty(mtzzzz)&&"succeeded".equals(mtzzzz.get("status"))){ + sb.append("|"); + sb.append(mtzzzz.get("pic_id")); + } + if(ObjectUtil.isNotEmpty(sb)){ + map.put("storeId",sb.toString()); + } + } + + if(ObjectUtil.isNotEmpty(cz)&&"succeeded".equals(cz.get("status"))){ + map.put("accountOpeningPermitId",cz.get("pic_id")); + } + + if(ObjectUtil.isNotEmpty(yyzz)&&"succeeded".equals(yyzz.get("status"))){ + map.put("socialCreditCodeId",yyzz.get("pic_id")); + + } + + log.info("request:{}",JSON.toJSONString(map)); + Map response= commitUpload(map,record.getMerchantid()); + if(ObjectUtil.isNotEmpty(response)&&(response.get("audit_status").equals("I")&&"p".equals(response.get("audit_status")))){ + + hfInfo.setStatus("4"); //商户证照一提交 + hfInfo.setUpdateTime(new Date()); + tbPlussMerchantHfInfoMapper.updateByPrimaryKey(hfInfo); + + record.setThirdstatus("5"); + record.setUpdatetime(new Date()); + tbPlussMerchantAuditRecordMapper.updateByPrimaryKeySelective(record); + + } + } + } + + } + // public void authUser(){ diff --git a/newadmin/merchant-service-api/src/main/java/com/chaozhanggui/merchant/util/RSAUtils.java b/newadmin/merchant-service-api/src/main/java/com/chaozhanggui/merchant/util/RSAUtils.java index 4315783..36e9f94 100644 --- a/newadmin/merchant-service-api/src/main/java/com/chaozhanggui/merchant/util/RSAUtils.java +++ b/newadmin/merchant-service-api/src/main/java/com/chaozhanggui/merchant/util/RSAUtils.java @@ -90,6 +90,9 @@ public class RSAUtils { return outStr; } + + + public static void main(String[] args) throws Exception { long temp = System.currentTimeMillis(); //生成公钥和私钥