From d1b45d4fc8da8d2f874dc02f44ebf6007b89bfb5 Mon Sep 17 00:00:00 2001 From: 19991905653 Date: Thu, 29 Feb 2024 13:40:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B6=E9=93=B6=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/TbPlussMerchantCashPlaceMapper.xml | 149 +------------- .../merchant/service/HfMerService.java | 181 +++++++++--------- 2 files changed, 88 insertions(+), 242 deletions(-) diff --git a/newadmin/dao-api/src/main/resources/mapper/TbPlussMerchantCashPlaceMapper.xml b/newadmin/dao-api/src/main/resources/mapper/TbPlussMerchantCashPlaceMapper.xml index ffd1680..7475cf4 100644 --- a/newadmin/dao-api/src/main/resources/mapper/TbPlussMerchantCashPlaceMapper.xml +++ b/newadmin/dao-api/src/main/resources/mapper/TbPlussMerchantCashPlaceMapper.xml @@ -196,152 +196,5 @@ pay_passage_name = #{payPassageName,jdbcType=VARCHAR} where id = #{id,jdbcType=INTEGER} - - - - - - - - - - - - - - id, logo, userId, bindingCode, name, code, address, remark, createTime, updateTime - - - - delete from tb_pluss_merchant_cash_place - where id = #{id,jdbcType=INTEGER} - - - insert into tb_pluss_merchant_cash_place (id, logo, userId, - bindingCode, name, code, - address, remark, createTime, - updateTime) - values (#{id,jdbcType=INTEGER}, #{logo,jdbcType=VARCHAR}, #{userid,jdbcType=INTEGER}, - #{bindingcode,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{code,jdbcType=VARCHAR}, - #{address,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{createtime,jdbcType=TIMESTAMP}, - #{updatetime,jdbcType=TIMESTAMP}) - - - insert into tb_pluss_merchant_cash_place - - - id, - - - logo, - - - userId, - - - bindingCode, - - - name, - - - code, - - - address, - - - remark, - - - createTime, - - - updateTime, - - - - - #{id,jdbcType=INTEGER}, - - - #{logo,jdbcType=VARCHAR}, - - - #{userid,jdbcType=INTEGER}, - - - #{bindingcode,jdbcType=VARCHAR}, - - - #{name,jdbcType=VARCHAR}, - - - #{code,jdbcType=VARCHAR}, - - - #{address,jdbcType=VARCHAR}, - - - #{remark,jdbcType=VARCHAR}, - - - #{createtime,jdbcType=TIMESTAMP}, - - - #{updatetime,jdbcType=TIMESTAMP}, - - - - - update tb_pluss_merchant_cash_place - - - logo = #{logo,jdbcType=VARCHAR}, - - - userId = #{userid,jdbcType=INTEGER}, - - - bindingCode = #{bindingcode,jdbcType=VARCHAR}, - - - name = #{name,jdbcType=VARCHAR}, - - - code = #{code,jdbcType=VARCHAR}, - - - address = #{address,jdbcType=VARCHAR}, - - - remark = #{remark,jdbcType=VARCHAR}, - - - createTime = #{createtime,jdbcType=TIMESTAMP}, - - - updateTime = #{updatetime,jdbcType=TIMESTAMP}, - - - where id = #{id,jdbcType=INTEGER} - - - update tb_pluss_merchant_cash_place - set logo = #{logo,jdbcType=VARCHAR}, - userId = #{userid,jdbcType=INTEGER}, - bindingCode = #{bindingcode,jdbcType=VARCHAR}, - name = #{name,jdbcType=VARCHAR}, - code = #{code,jdbcType=VARCHAR}, - address = #{address,jdbcType=VARCHAR}, - remark = #{remark,jdbcType=VARCHAR}, - createTime = #{createtime,jdbcType=TIMESTAMP}, - updateTime = #{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 9cae465..7b79709 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 @@ -1768,6 +1768,7 @@ public class HfMerService { } + @Autowired TbPlussMerchantCashPlaceMapper merchantCashPlaceMapper; @Autowired @@ -1890,7 +1891,6 @@ public class HfMerService { request.put("accountOpeningPermitId", map.get("accountOpeningPermitId"));//开户许可证图片 - Map merchantResident = null; try { merchantResident = MerchantResident.auditProfileInfo(request); @@ -2199,7 +2199,7 @@ public class HfMerService { System.out.println(JSON.toJSONString(response)); } - public void feed(TbPlussMerchantBaseInfo baseInfo, TbPlussMerchantChannelStatus channelStatus,String wxLiteAppId,String wxPubAppId,String wxPubPath) { + public void feed(TbPlussMerchantBaseInfo baseInfo, TbPlussMerchantChannelStatus channelStatus, String wxLiteAppId, String wxPubAppId, String wxPubPath) { TbPlussAccount account = tbPlussAccountMapper.selectByUser(baseInfo.getUserid(), "D1"); @@ -2386,34 +2386,34 @@ public class HfMerService { } - TbPlussMerchantHfInfo hfInfo= tbPlussMerchantHfInfoMapper.selectByMerchantCode(baseInfo.getMerchantcode()); - if(ObjectUtil.isEmpty(hfInfo)||hfInfo==null){ + TbPlussMerchantHfInfo hfInfo = tbPlussMerchantHfInfoMapper.selectByMerchantCode(baseInfo.getMerchantcode()); + if (ObjectUtil.isEmpty(hfInfo) || hfInfo == null) { hfInfo = new TbPlussMerchantHfInfo(); - JSONObject object=new JSONObject(); - if(ObjectUtil.isNotNull(wxLiteAppId)&&ObjectUtil.isNotEmpty(wxLiteAppId)){ - JSONObject wxlite=new JSONObject(); - wxlite.put("appid",wxLiteAppId); - object.put("wx_lite",wxlite); + JSONObject object = new JSONObject(); + if (ObjectUtil.isNotNull(wxLiteAppId) && ObjectUtil.isNotEmpty(wxLiteAppId)) { + JSONObject wxlite = new JSONObject(); + wxlite.put("appid", wxLiteAppId); + object.put("wx_lite", wxlite); } - if(ObjectUtil.isNotNull(wxPubAppId)&&ObjectUtil.isNotEmpty(wxPubAppId) - &&ObjectUtil.isNotNull(wxPubPath)&&ObjectUtil.isNotEmpty(wxPubPath) - ){ - JSONObject wxpub=new JSONObject(); - wxpub.put("appid",wxPubAppId); - wxpub.put("path",wxPubPath); - object.put("wx_pub",wxpub); + if (ObjectUtil.isNotNull(wxPubAppId) && ObjectUtil.isNotEmpty(wxPubAppId) + && ObjectUtil.isNotNull(wxPubPath) && ObjectUtil.isNotEmpty(wxPubPath) + ) { + JSONObject wxpub = new JSONObject(); + wxpub.put("appid", wxPubAppId); + wxpub.put("path", wxPubPath); + object.put("wx_pub", wxpub); } hfInfo.setMerchantCode(baseInfo.getMerchantcode()); hfInfo.setStatus("0"); hfInfo.setPrivKey(privateKey); hfInfo.setPucKey(publicKey); - hfInfo.setWxInfo(ObjectUtil.isEmpty(object)?null:object.toJSONString()); + hfInfo.setWxInfo(ObjectUtil.isEmpty(object) ? null : object.toJSONString()); hfInfo.setCreateTime(new Date()); tbPlussMerchantHfInfoMapper.insert(hfInfo); - }else { + } else { hfInfo.setStatus("0"); hfInfo.setPrivKey(privateKey); hfInfo.setPucKey(publicKey); @@ -2481,9 +2481,9 @@ public class HfMerService { merchantResident(baseInfo, tbPlussMerchantHfInfo.getLiveApiKey(), tbPlussMerchantHfInfo.getAppId(), tbPlussMerchantHfInfo); } try { - addCash(channelStatus,7); - }catch (Exception e){ - log.info("addCash Fail:"+e.getMessage()); + addCash(channelStatus, 7); + } catch (Exception e) { + log.info("addCash Fail:" + e.getMessage()); } } } @@ -2537,43 +2537,49 @@ public class HfMerService { } private void addCash(TbPlussMerchantChannelStatus mcs, int channl) { - int num = tbPlussMerchantChannelStatusMapper.selectAllCount("3",mcs.getMerchantcode()); + int num = tbPlussMerchantChannelStatusMapper.selectAllCount("3", mcs.getMerchantcode()); if (num < 2) { - List list = merchantBaseInfoMapper.selectListByCode( mcs.getMerchantcode()); + List list = merchantBaseInfoMapper.selectListByCode(mcs.getMerchantcode()); if (list.size() > 0) { TbPlussMerchantBaseInfo merchantBaseInfo = list.iterator().next(); - TbPlussMerchantCashPlace merchantCashPlace = new TbPlussMerchantCashPlace(); - merchantCashPlace.setAddress(merchantBaseInfo.getAddress()); - merchantCashPlace.setUserid(merchantBaseInfo.getUserid()); - merchantCashPlace.setName("收银点一"); - merchantCashPlace.setPayPassageId(channl); - TbPlussMerchantChannel merchantChannel = plussMerchantChannelMapper.selectByPrimaryKey(channl); - if (Objects.nonNull(merchantChannel)){ - merchantCashPlace.setPayPassageName(merchantChannel.getChannelname()); - } - merchantCashPlace.setCreatetime(new Date()); - merchantCashPlace.setName(merchantBaseInfo.getAlias()); - merchantCashPlace.setRootAccountId(merchantBaseInfo.getUserid()); - merchantCashPlace.setCode(getCode()); - merchantCashPlaceMapper.insert(merchantCashPlace); TbPlussUserInfo userInfo = tbPlussUserInfoMapper.selectByPrimaryKey(Long.valueOf(merchantBaseInfo.getUserid())); - TbPlussUserCashPlace childUserCashPlace = new TbPlussUserCashPlace(); - childUserCashPlace.setChasplaceId(merchantCashPlace.getId()); - childUserCashPlace.setCreatetime(new Date()); - childUserCashPlace.setIsRootAccount("true"); - childUserCashPlace.setOrgCode(userInfo.getLoginname()); - childUserCashPlace.setRootAccountId(userInfo.getId().intValue()); - childUserCashPlace.setUserId(userInfo.getId().intValue()); - userCashPlaceMapper.insert(childUserCashPlace); + if (Objects.nonNull(userInfo) && !userInfo.getLoginname().contains("-")) { + TbPlussMerchantCashPlace merchantCashPlace = new TbPlussMerchantCashPlace(); + merchantCashPlace.setAddress(merchantBaseInfo.getAddress()); + merchantCashPlace.setUserid(merchantBaseInfo.getUserid()); + merchantCashPlace.setName("收银点一"); + merchantCashPlace.setPayPassageId(channl); + TbPlussMerchantChannel merchantChannel = plussMerchantChannelMapper.selectByPrimaryKey(channl); + if (Objects.nonNull(merchantChannel)) { + merchantCashPlace.setPayPassageName(merchantChannel.getChannelname()); + } + merchantCashPlace.setCreatetime(new Date()); + merchantCashPlace.setName(merchantBaseInfo.getAlias()); + merchantCashPlace.setRootAccountId(merchantBaseInfo.getUserid()); + merchantCashPlace.setCode(getCode()); + merchantCashPlaceMapper.insert(merchantCashPlace); +// TbPlussUserInfo userInfo = tbPlussUserInfoMapper.selectByPrimaryKey(Long.valueOf(merchantBaseInfo.getUserid())); + TbPlussUserCashPlace childUserCashPlace = new TbPlussUserCashPlace(); + childUserCashPlace.setChasplaceId(merchantCashPlace.getId()); + childUserCashPlace.setCreatetime(new Date()); + childUserCashPlace.setIsRootAccount("true"); + childUserCashPlace.setOrgCode(userInfo.getLoginname()); + childUserCashPlace.setRootAccountId(userInfo.getId().intValue()); + childUserCashPlace.setUserId(userInfo.getId().intValue()); + userCashPlaceMapper.insert(childUserCashPlace); + } + } } } - public String getCode(){ + + public String getCode() { String randomDigits = generateRandomDigits(2); String randomLetters = generateRandomLetters(6); String randomString = randomDigits + randomLetters; return randomString; } + // 生成n位随机数字 private static String generateRandomDigits(int n) { Random random = new Random(); @@ -2598,6 +2604,7 @@ public class HfMerService { return sb.toString(); } + public void authInfo(String requestId) { TbPlussMerchantAuditRecord record = tbPlussMerchantAuditRecordMapper.selectByApplicationid(requestId); if (ObjectUtil.isNotEmpty(record)) { @@ -2618,9 +2625,6 @@ public class HfMerService { tbPlussMerchantChannelStatusMapper.updateByPrimaryKeySelective(channelStatus); - - - Map map = null; //上传证照 TbPlussMerchantBaseInfo baseInfo = tbPlussMerchantBaseInfoMapper.selectByMerchantcode(record.getMerchantcode()); @@ -2667,12 +2671,11 @@ public class HfMerService { cz = HfMerService.fileUpload(bankCard.getLicenseurl(), "05", record.getMerchantid()); yyzz = HfMerService.fileUpload(image.getPicurl(), "01", record.getMerchantid()); - }else { + } else { cz = HfMerService.fileUpload(bankCard.getImgurl(), "05", record.getMerchantid()); } - // cz = HfMerService.fileUpload(bankCard.getImgurl(), "05", record.getMerchantid()); StringBuffer sb = new StringBuffer(); TbPlussMerchantImage image = tbPlussMerchantImageMapper.selectByMerchantCodeType(baseInfo.getMerchantcode(), "06"); @@ -2834,36 +2837,36 @@ public class HfMerService { TbPlussCitysHf district_code = tbPlussCitysHfMapper.selectByCodeAndParentCode(baseInfo.getDistrict(), city.getCityCode()); merchantEntryParams.put("district_code", district_code.getCityCode());//区县编码 黄埔310101 - String wxappId=null; - String wxpubappId=null; - String wxpubPath=null; - JSONObject object=JSONObject.parseObject(tbPlussMerchantHfInfo.getWxInfo()) ; - if(object!=null){ - if(object.containsKey("wx_lite")){ - JSONObject wxliteObj= object.getJSONObject("wx_lite"); - if(ObjectUtil.isNotEmpty(wxliteObj)&&wxliteObj.containsKey("appid")){ - wxappId=wxliteObj.getString("appid"); - } - } + String wxappId = null; + String wxpubappId = null; + String wxpubPath = null; + JSONObject object = JSONObject.parseObject(tbPlussMerchantHfInfo.getWxInfo()); + if (object != null) { + if (object.containsKey("wx_lite")) { + JSONObject wxliteObj = object.getJSONObject("wx_lite"); + if (ObjectUtil.isNotEmpty(wxliteObj) && wxliteObj.containsKey("appid")) { + wxappId = wxliteObj.getString("appid"); + } + } - if(object.containsKey("wx_pub")){ - JSONObject wxpubObj=object.getJSONObject("wx_pub"); - wxpubappId=wxpubObj.getString("appid"); - wxpubPath=wxpubObj.getString("path"); - } + if (object.containsKey("wx_pub")) { + JSONObject wxpubObj = object.getJSONObject("wx_pub"); + wxpubappId = wxpubObj.getString("appid"); + wxpubPath = wxpubObj.getString("path"); + } - } + } - if(ObjectUtil.isNull(wxappId)){ - wxappId=wxLiteAppId; - } + if (ObjectUtil.isNull(wxappId)) { + wxappId = wxLiteAppId; + } - if(ObjectUtil.isNull(wxpubappId)){ - wxpubappId=wxPubAppId; - } + if (ObjectUtil.isNull(wxpubappId)) { + wxpubappId = wxPubAppId; + } - if(ObjectUtil.isNull(wxpubPath)){ - wxpubPath=wxPubPath; + if (ObjectUtil.isNull(wxpubPath)) { + wxpubPath = wxPubPath; } merchantEntryParams.put("add_value_list", " {\"wx_lite\":{\"appid\":\"" + wxappId + "\"},\"wx_pub\":{\"appid\":\"" + wxpubappId + "\",\"path\":\"" + wxpubPath + "\"},\"wx_scan\":\"\", \"alipay\":\"\",\"alipay_wap\":\"\",\"alipay_lite\":\"\",\"alipay_qr\":\"\",\"alipay_scan\":\"\"}"); @@ -2885,7 +2888,6 @@ public class HfMerService { tbPlussMerchantAuditRecordMapper.insert(merchantAuditRecord); - tbPlussMerchantHfInfo.setStatus("2"); //商户入驻待审核 tbPlussMerchantHfInfo.setUpdateTime(new Date()); tbPlussMerchantHfInfoMapper.updateByPrimaryKey(tbPlussMerchantHfInfo); @@ -2899,12 +2901,7 @@ public class HfMerService { } - - - - - - public void modifySettle(String userId){ + public void modifySettle(String userId) { TbPlussMerchantBaseInfo baseInfo = tbPlussMerchantBaseInfoMapper.selectByUserId(userId); @@ -2919,7 +2916,6 @@ public class HfMerService { MsgException.checkNull(account, "结算信息未提交"); - TbPlussBankCard bankCard = tbPlussBankCardMapper.selectByPrimaryKey(Integer.valueOf(account.getBankcardid())); MsgException.checkNull(bankCard, "结算卡信息未提交"); @@ -2927,11 +2923,11 @@ public class HfMerService { String requestId = "msettle_" + SnowFlakeUtil.nextId(); Map merchantEntryParams = new HashMap<>(10); merchantEntryParams.put("adapay_func_code", "merchant.modify");//测试时每次请求需修改流水 - merchantEntryParams.put("order_no",requestId); + merchantEntryParams.put("order_no", requestId); merchantEntryParams.put("sub_Api_Key", hfInfo.getLiveApiKey());//商户进件后返回的生产或者测试API Key - Map settle=new HashMap<>(); + Map settle = new HashMap<>(); - settle.put("card_id",bankCard.getBankcardno()); + settle.put("card_id", bankCard.getBankcardno()); TbBlussBankBranchHf blussBankBranchHf = tbBlussBankBranchHfMapper.selectByName(bankCard.getBankname()); MsgException.checkNull(blussBankBranchHf, "对应的银行信息不存在"); @@ -2949,24 +2945,21 @@ public class HfMerService { merchantEntryParams.put("settle_card_info", settle);//费率01-标准费率线上,02-标准费率线下 - merchantEntryParams.put("notify_url",backUrl); + merchantEntryParams.put("notify_url", backUrl); try { init(); - log.info("merchantmodifyrequest:{}",JSONUtil.toJsonStr(merchantEntryParams)); - Map merchantmodify= AdapayCommon.requestAdapay(merchantEntryParams); + log.info("merchantmodifyrequest:{}", JSONUtil.toJsonStr(merchantEntryParams)); + Map merchantmodify = AdapayCommon.requestAdapay(merchantEntryParams); log.info("merchantmodify:{}", JSONUtil.toJsonStr(merchantmodify)); } catch (BaseAdaPayException e) { - e.printStackTrace(); + e.printStackTrace(); } } - - - @Scheduled(initialDelay = 1000, fixedDelay = 10000) public void queryMerchantResident() { List records = tbPlussMerchantAuditRecordMapper.selectByStatus();