From 29a75d02fda0862387a2bd3dfaa13c0510b342a9 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Thu, 21 Sep 2023 16:21:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/BsTradeOrderController.java | 6 +-- .../com/cweb/controller/PayController.java | 2 + .../com/cweb/controller/TestController.java | 7 ++- .../com/cweb/notify/TianQueController.java | 44 ++++++++++++++----- .../com/hfkj/channel/saas/SaasMerService.java | 44 +++++++++++++++++++ .../tianque/service/TianQueMerService.java | 37 +++++++++++++++- .../tianque/service/TianQueTradeService.java | 3 +- 7 files changed, 123 insertions(+), 20 deletions(-) diff --git a/cweb/src/main/java/com/cweb/controller/BsTradeOrderController.java b/cweb/src/main/java/com/cweb/controller/BsTradeOrderController.java index 027e97b..8243525 100644 --- a/cweb/src/main/java/com/cweb/controller/BsTradeOrderController.java +++ b/cweb/src/main/java/com/cweb/controller/BsTradeOrderController.java @@ -454,9 +454,9 @@ public class BsTradeOrderController { param.put("resMsg","处理成功"); Map respData = new HashMap<>(); - respData.put("openld", unionInfo.getString("data")); - respData.put("subOpenld", unionInfo.getString("data")); - respData.put("userld", unionInfo.getString("data")); + respData.put("openId", unionInfo.getString("data")); + respData.put("subOpenId", unionInfo.getString("data")); + respData.put("userId", unionInfo.getString("data")); param.put("respData", respData); return ResponseMsgUtil.success(param); diff --git a/cweb/src/main/java/com/cweb/controller/PayController.java b/cweb/src/main/java/com/cweb/controller/PayController.java index 7097c14..779d283 100644 --- a/cweb/src/main/java/com/cweb/controller/PayController.java +++ b/cweb/src/main/java/com/cweb/controller/PayController.java @@ -118,6 +118,7 @@ public class PayController { if (merPlatform.getPlatformType().equals(PlatformTypeEnum.type1.getNumber())) { try { Map order = laKaLaTradeService.preorder(body.getString("outTradeNo")); + System.out.println("返回参数:" + JSONObject.toJSONString(order)); if (StringUtils.isNotBlank(MapUtils.getString(order, "order"))) { return ResponseMsgUtil.success(order); } @@ -128,6 +129,7 @@ public class PayController { } else if (merPlatform.getPlatformType().equals(PlatformTypeEnum.type5.getNumber())) { try { Map order = tianQueTradeService.preorder(body.getString("outTradeNo")); + System.out.println("返回参数:" + JSONObject.toJSONString(order)); if (StringUtils.isNotBlank(MapUtils.getString(order, "order"))) { return ResponseMsgUtil.success(order); } diff --git a/cweb/src/main/java/com/cweb/controller/TestController.java b/cweb/src/main/java/com/cweb/controller/TestController.java index 7387f3e..6df09c8 100644 --- a/cweb/src/main/java/com/cweb/controller/TestController.java +++ b/cweb/src/main/java/com/cweb/controller/TestController.java @@ -262,13 +262,16 @@ public class TestController { public ResponseData tianQueTest(@RequestParam(value = "code", required = true) String code) { try { // tianQueMerService.addMer(Long.parseLong(code)); - return ResponseMsgUtil.success(tianQueMerService.queryMerchantInfo(code)); + // return ResponseMsgUtil.success(tianQueMerService.queryMerchantInfo(code)); // return ResponseMsgUtil.success(tianQueTradeService.preorder(code)); // return ResponseMsgUtil.success(tianQueTradeService.queryTrade(code)); // return ResponseMsgUtil.success(tianQueTradeService.poundageQuery("399200427027644",code)); // return ResponseMsgUtil.success(tianQueTradeService.refund(code, new BigDecimal("0.01"))); // return ResponseMsgUtil.success(tianQueTradeService.refundQuery(code)); - // return ResponseMsgUtil.success(""); + //tianQueMerService.weChatPayConf("399230921077727", "597456493", "03", "", "", "https://pay.dctpay.com/scanPay/"); + + //return ResponseMsgUtil.success(tianQueMerService.weChatPayConf("399230921077727", "597456493", "01", "wxa075e8509802f826", "00", "")); + return ResponseMsgUtil.success(tianQueMerService.queryConf("399230921077727", "597456493")); // 1200 // return ResponseMsgUtil.success(saasCommon.fileUpload(new HashMap<>())); /* AlipaySystemOauthTokenRequest request = new AlipaySystemOauthTokenRequest(); diff --git a/cweb/src/main/java/com/cweb/notify/TianQueController.java b/cweb/src/main/java/com/cweb/notify/TianQueController.java index a09cdce..db43bb5 100644 --- a/cweb/src/main/java/com/cweb/notify/TianQueController.java +++ b/cweb/src/main/java/com/cweb/notify/TianQueController.java @@ -5,7 +5,9 @@ import com.alibaba.fastjson.JSONObject; import com.hfkj.channel.lakala.LaKaLaLedgerService; import com.hfkj.channel.lakala.LaKaLaWalletService; import com.hfkj.channel.tianque.service.TianQueMerElecSignService; +import com.hfkj.channel.tianque.service.TianQueMerService; import com.hfkj.common.utils.DateUtil; +import com.hfkj.common.utils.ResponseMsgUtil; import com.hfkj.config.CommonSysConst; import com.hfkj.entity.*; import com.hfkj.service.*; @@ -58,6 +60,8 @@ public class TianQueController { private BsMerContractRecordMsgService merContractRecordMsgService; @Resource private TianQueMerElecSignService tianQueMerElecSignService; + @Resource + private TianQueMerService tianQueMerService; @RequestMapping(value="/microPay",method = RequestMethod.POST) @ResponseBody @@ -171,22 +175,38 @@ public class TianQueController { merPlatformNo.setStatus(MerPlatformNoStatusEnum.status1.getNumber()); merPlatformNoService.editMerPlatformNo(merPlatformNo); } - JSONArray repoInfoArray = respData.getJSONArray("repoInfo"); - for (Object obj : repoInfoArray) { - JSONObject repoInfo = (JSONObject) obj; - BsMerPlatformTerm merPlatformTerm = new BsMerPlatformTerm(); - merPlatformTerm.setMerPlatformNoId(merPlatformNo.getId()); - merPlatformTerm.setMerId(merPlatformNo.getMerId()); - merPlatformTerm.setBusiTypeCode(repoInfo.getString("childNoType")); - merPlatformTerm.setBusiTypeName(repoInfo.getString("childNoType")); - merPlatformTerm.setShopId(repoInfo.getString("channelId")); - merPlatformTerm.setTermNo(repoInfo.getString("childNo")); - merPlatformTermService.editMerPlatformTerm(merPlatformTerm); - } // 签署协议 tianQueMerElecSignService.openElecSignature(respData.getString("mno")); + new Thread(() -> { + try { + Thread.sleep(1000 * 120); // 暂停120秒 + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + JSONObject merchantInfo = tianQueMerService.queryMerchantInfo(respData.getString("applicationId")); + if (merchantInfo != null) { + JSONArray repoInfoArray = merchantInfo.getJSONArray("repoInfo"); + for (Object obj : repoInfoArray) { + JSONObject repoInfo = (JSONObject) obj; + BsMerPlatformTerm merPlatformTerm = new BsMerPlatformTerm(); + merPlatformTerm.setMerPlatformNoId(merPlatformNo.getId()); + merPlatformTerm.setMerId(merPlatformNo.getMerId()); + merPlatformTerm.setBusiTypeCode(repoInfo.getString("childNoType")); + merPlatformTerm.setBusiTypeName(repoInfo.getString("childNoType")); + merPlatformTerm.setShopId(repoInfo.getString("channelId")); + merPlatformTerm.setTermNo(repoInfo.getString("childNo")); + merPlatformTermService.editMerPlatformTerm(merPlatformTerm); + + if (repoInfo.getString("childNoType").equals("WX")) { + // 微信配置平台支付参数 + tianQueMerService.weChatPayConf(merPlatformNo.getPlatformNo(), repoInfo.getString("childNo"), "01", "wxa075e8509802f826", "00", ""); + tianQueMerService.weChatPayConf(merPlatformNo.getPlatformNo(), repoInfo.getString("childNo"), "03", "", "", "https://pay.dctpay.com/scanPay/"); + } + } + } + }); } else { if (mer.getMerStatus().intValue() != MerStatusEnum.status1.getNumber().intValue()) { mer.setMerStatus(MerStatusEnum.status4.getNumber()); diff --git a/service/src/main/java/com/hfkj/channel/saas/SaasMerService.java b/service/src/main/java/com/hfkj/channel/saas/SaasMerService.java index 411f1d1..60767e1 100644 --- a/service/src/main/java/com/hfkj/channel/saas/SaasMerService.java +++ b/service/src/main/java/com/hfkj/channel/saas/SaasMerService.java @@ -582,6 +582,50 @@ public class SaasMerService { return responseObj; } + /** + * 修改费率 + * @param merId 申请id + * @return + */ + public JSONObject updateMer(Long merId) { + // 平台商户 + BsMerPlatformNo merPlatformNo = merPlatformNoService.getPlatformNo(merId, PlatformTypeEnum.type1); + if (merPlatformNo == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "未找到平台商户号"); + } + Map param = new HashMap<>(); + param.put("productCode", "PAPER_CODE"); + param.put("settlementType", "AUTOMATIC"); + // 商户费率 + List> feesMapList = new ArrayList<>(); + Map feesMap; + List rateList = merRateService.getRateListByMerId(merId); + for (BsMerRate rate : rateList) { + feesMap = new HashMap<>(); + feesMap.put("fee", rate.getRatePct()); + feesMap.put("feeType", rate.getRateSaasTypeCode()); + if (StringUtils.isNotBlank(rate.getExt1())) { + feesMap.put("topFee", rate.getExt1()); + } + feesMapList.add(feesMap); + } + param.put("fees", feesMapList); + + Map header = new HashMap<>(); + header.put("Authorization", "bearer " + saasCommon.getUpdateToken()); + + JSONObject responseObj = HttpsUtils.doPost(SaasConfig.requestMerUrl + "channel/customer/update/info/" + merPlatformNo.getPlatformNo(), param, header); + System.out.println("商户号:" + merPlatformNo.getPlatformNo() + " " + merPlatformNo.getCupNo()); + System.out.println("body:" + JSONObject.toJSONString(param)); + System.out.println("response:" + responseObj.toJSONString()); + if (responseObj == null || !responseObj.getString("message").equals("SUCCESS")) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, responseObj.getString("message")); + } + merPlatformNo.setExt1(responseObj.getString("reviewRelatedId")); + merPlatformNoService.editMerPlatformNo(merPlatformNo); + return responseObj; + } + /** * 查询费率 * @param merId 申请id diff --git a/service/src/main/java/com/hfkj/channel/tianque/service/TianQueMerService.java b/service/src/main/java/com/hfkj/channel/tianque/service/TianQueMerService.java index e4269e9..4fe30a8 100644 --- a/service/src/main/java/com/hfkj/channel/tianque/service/TianQueMerService.java +++ b/service/src/main/java/com/hfkj/channel/tianque/service/TianQueMerService.java @@ -181,7 +181,7 @@ public class TianQueMerService { param.put("identityNo", basisModel.getLarIdCard()); param.put("legalPersonLicStt", basisModel.getLarIdCardPeriodStart().replace(".", "").replace("年","").replace("月","").replace("日","")); if (basisModel.getLarIdCardPeriodType().equals(2)) { - param.put("businessLicStt", "29991231"); + param.put("legalPersonLicEnt", "29991231"); } else { param.put("legalPersonLicEnt", basisModel.getLarIdCardPeriodEnd().replace(".", "").replace("年","").replace("月","").replace("日","")); } @@ -423,7 +423,7 @@ public class TianQueMerService { param.put("identityNo", basisModel.getLarIdCard()); param.put("legalPersonLicStt", basisModel.getLarIdCardPeriodStart().replace(".", "").replace("年","").replace("月","").replace("日","")); if (basisModel.getLarIdCardPeriodType().equals(2)) { - param.put("businessLicStt", "29991231"); + param.put("legalPersonLicEnt", "29991231"); } else { param.put("legalPersonLicEnt", basisModel.getLarIdCardPeriodEnd().replace(".", "").replace("年","").replace("月","").replace("日","")); } @@ -558,5 +558,38 @@ public class TianQueMerService { return RequestUtil.request(TianQueConfig.requestUrl + "/merchant/queryMerchantInfo", param); } + /** + * 微信配置 + * @param mno 商户编号 + * @param subMchId 微信子商户号 + * @param type 配置类型 取值范围:01 支付Appid=,03 jsapi授权目录 + * @param subAppid 微信subAppid type=="01"时必传 + * @param accountType 支付Appid类型,枚举值 取值范围: 00 公众号 01 小程序 type="01"时必传 + * @param jsapiPath jsapi授权目录 type="03"时必传 + * @return + */ + public JSONObject weChatPayConf(String mno,String subMchId,String type,String subAppid,String accountType,String jsapiPath) { + Map param = new HashMap<>(); + param.put("mno", mno); + param.put("subMchId", subMchId); + param.put("type", type); + param.put("subAppid", subAppid); + param.put("accountType", accountType); + param.put("jsapiPath", jsapiPath); + return RequestUtil.request(TianQueConfig.requestUrl + "/merchant/weChatPaySet/addConf", param); + } + + /** + * 查询配置 + * @param mno 商户编号 + * @param subMchId 微信子商户号 + * @return + */ + public JSONObject queryConf(String mno,String subMchId) { + Map param = new HashMap<>(); + param.put("mno", mno); + param.put("subMchId", subMchId); + return RequestUtil.request(TianQueConfig.requestUrl + "/merchant/weChatPaySet/queryConf", param); + } } diff --git a/service/src/main/java/com/hfkj/channel/tianque/service/TianQueTradeService.java b/service/src/main/java/com/hfkj/channel/tianque/service/TianQueTradeService.java index ac54225..78dc2f1 100644 --- a/service/src/main/java/com/hfkj/channel/tianque/service/TianQueTradeService.java +++ b/service/src/main/java/com/hfkj/channel/tianque/service/TianQueTradeService.java @@ -71,7 +71,8 @@ public class TianQueTradeService { param.put("mno", platformNo.getPlatformNo()); param.put("ordNo", order.getOutTradeNo()); param.put("amt", order.getTradeActualAmount()); - param.put("payType", order.getPayMode()); + param.put("payType", order.getPayMode().equals("UQRCODEPAY")?"UNIONPAY":order.getPayMode()); + param.put("customerIp", order.getPayMode().equals("UQRCODEPAY")?order.getRequestIp():"140.210.192.36"); param.put("payWay", "02"); if (StringUtils.isNotBlank(order.getSubject())) { param.put("subject", order.getSubject());