From 2b2c0276979759d003477b5ad6faf5b1e8c457d9 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Mon, 29 May 2023 17:01:44 +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 --- .../com/cweb/controller/TestController.java | 25 +--- .../api/controller/v1/LedgerController.java | 1 + .../com/api/controller/v1/MerController.java | 64 ++++++++++ .../channel/lakala/LaKaLaConfigService.java | 115 ++++++++++++++++++ 4 files changed, 186 insertions(+), 19 deletions(-) create mode 100644 open-api/src/main/java/com/api/controller/v1/MerController.java create mode 100644 service/src/main/java/com/hfkj/channel/lakala/LaKaLaConfigService.java diff --git a/cweb/src/main/java/com/cweb/controller/TestController.java b/cweb/src/main/java/com/cweb/controller/TestController.java index 6287114..3121e63 100644 --- a/cweb/src/main/java/com/cweb/controller/TestController.java +++ b/cweb/src/main/java/com/cweb/controller/TestController.java @@ -82,27 +82,9 @@ public class TestController { @Resource private SaasMerService saasMerService; - - @Resource - private LaKaLaTradeService laKaLaTradeService; - - @Resource - private LaKaLaTradeSeparateService laKaLaTradeSeparateService; - - @Resource - private CommonService commonService; - - @Resource - private BsLklMccService lklMccService; - @Resource - private LaKaLaLedgerService laKaLaLedgerService; - @Resource - private LaKaLaMerService laKaLaMerService; @Resource private BsTradeOrderService tradeOrderService; @Resource - private BsTradeOrderProfitSharingService tradeOrderProfitSharingService; - @Resource private BsMerService merService; @Resource @@ -121,6 +103,9 @@ public class TestController { @Resource private BsBankActivityRosterRateService bankActivityRosterRateService; + @Resource + private LaKaLaLedgerService laKaLaLedgerService; + @RequestMapping(value="/refreshMerStatus",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "refreshMerStatus") @@ -252,7 +237,9 @@ public class TestController { // tradeOrderProfitSharingService.createProfitSharing(tradeOrderService.getOrderByOutTradeNo("ZF1130202304261734049211335408")); // return ResponseMsgUtil.success(saasCommon.getUpdateToken()); /* return ResponseMsgUtil.success(saasMerService.reconsiderSubmit("123364703"));*/ - return ResponseMsgUtil.success(saasMerService.merchantInfo("123364703")); + //return ResponseMsgUtil.success(saasMerService.merchantInfo("123364703")); + // return ResponseMsgUtil.success(saasCommon.getCategory(null)); + return ResponseMsgUtil.success(laKaLaLedgerService.queryLedgerMer(code)); // return ResponseMsgUtil.success(""); // 1200 // return ResponseMsgUtil.success(saasCommon.fileUpload(new HashMap<>())); diff --git a/open-api/src/main/java/com/api/controller/v1/LedgerController.java b/open-api/src/main/java/com/api/controller/v1/LedgerController.java index 0053ab9..2c251c7 100644 --- a/open-api/src/main/java/com/api/controller/v1/LedgerController.java +++ b/open-api/src/main/java/com/api/controller/v1/LedgerController.java @@ -111,6 +111,7 @@ public class LedgerController { } + log.info("返回参数:" + JSONObject.toJSONString(null)); return ResponseMsgUtil.success(null); diff --git a/open-api/src/main/java/com/api/controller/v1/MerController.java b/open-api/src/main/java/com/api/controller/v1/MerController.java new file mode 100644 index 0000000..997b64b --- /dev/null +++ b/open-api/src/main/java/com/api/controller/v1/MerController.java @@ -0,0 +1,64 @@ +package com.api.controller.v1; + +import com.hfkj.channel.lakala.LaKaLaConfigService; +import com.hfkj.common.utils.ResponseMsgUtil; +import com.hfkj.model.ResponseData; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.annotation.Resource; + +/** + * @className: MerController + * @author: HuRui + * @date: 2023/5/23 + **/ +@Controller +@Api(value = "公共") +@RequestMapping(value = "/v1/mer") +public class MerController { + + private static Logger log = LoggerFactory.getLogger(MerController.class); + + @Resource + private LaKaLaConfigService laKaLaConfigService; + + @RequestMapping(value="/wechatParamConf",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "wechatParamConf") + public ResponseData wechatParamConf(@RequestParam(value = "merCupNo" , required = true) String merCupNo, + @RequestParam(value = "subMchId" , required = true) String subMchId, + @RequestParam(value = "subAppid" , required = true) String subAppid, + @RequestParam(value = "jsapiPath" , required = true) String jsapiPath) { + try { + // return ResponseMsgUtil.success(laKaLaConfigService.wechatParamConf("822690053111ERC", "569999133","wxf30043187dc90829", "http://api2.ctpark.cn/")); + return ResponseMsgUtil.success(laKaLaConfigService.wechatParamConf(merCupNo, subMchId,subAppid, jsapiPath)); + + } catch (Exception e) { + log.error(e.getMessage(), e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/querySubMerInfo",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "querySubMerInfo") + public ResponseData querySubMerInfo(@RequestParam(value = "merCupNo" , required = true) String merCupNo) { + try { + + return ResponseMsgUtil.success(laKaLaConfigService.querySubMerInfo(merCupNo)); + + } catch (Exception e) { + log.error(e.getMessage(), e); + return ResponseMsgUtil.exception(e); + } + } + +} diff --git a/service/src/main/java/com/hfkj/channel/lakala/LaKaLaConfigService.java b/service/src/main/java/com/hfkj/channel/lakala/LaKaLaConfigService.java new file mode 100644 index 0000000..e7a47ab --- /dev/null +++ b/service/src/main/java/com/hfkj/channel/lakala/LaKaLaConfigService.java @@ -0,0 +1,115 @@ +package com.hfkj.channel.lakala; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.hfkj.channel.lakala.config.LaKaLaConfig; +import com.hfkj.channel.saas.utils.SaasCommon; +import com.hfkj.common.exception.ErrorCode; +import com.hfkj.common.exception.ErrorHelp; +import com.hfkj.common.exception.SysCode; +import com.hfkj.common.utils.DateUtil; +import com.hfkj.common.utils.GenerateUtil; +import com.hfkj.common.utils.HttpsUtils; +import com.hfkj.config.CommonSysConst; +import com.hfkj.entity.*; +import com.hfkj.model.MerBasisModel; +import com.hfkj.service.*; +import com.hfkj.sysenum.MerAttachType; +import com.hfkj.sysenum.PlatformTypeEnum; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.io.File; +import java.util.*; + +/** + * 拉卡拉配置 服务 + * @author hurui + */ +@Service("laKaLaConfigService") +public class LaKaLaConfigService { + + /** + * 微信参数配置 + * @param merCupNo 银联商户号 + * @param subMchId 微信子商户号 + * @param subAppid 关联APPID 绑定特约商户或渠道公众号、小程序、APP支付等对应的APPID + * @param jsapiPath 授权目录 + * @return + */ + public JSONObject wechatParamConf(String merCupNo,String subMchId,String subAppid,String jsapiPath) { + // 请求参数 + Map param = new HashMap<>(); + param.put("timestamp", new Date().getTime()); + param.put("rnd", GenerateUtil.generateRandomString(18)); + param.put("ver", "1.0.0"); + param.put("reqId", new Date().getTime()); + + Map map = new HashMap<>(); + map.put("merCupNo", merCupNo); + map.put("channlId", "24006513"); // 微信渠道号 (仅支持拉卡拉渠道配置) + // map.put("channlId", "167048649"); // 微信渠道号 (仅支持拉卡拉渠道配置) + map.put("subMchId", subMchId); + map.put("subAppid", subAppid); + map.put("jsapiPath", jsapiPath); + map.put("confType", "SUB_APPID"); + param.put("reqData", map); + + // 生成签名 + Map reqParam = LaKaLaConfig.generateSignParamsV2(JSONObject.parseObject(JSONObject.toJSONString(param))); + + // 头部参数 + Map heard = new HashMap<>(); + heard.put("Authorization", reqParam.get("Authorization")); + + JSONObject responseBody = HttpsUtils.doPost(CommonSysConst.getSysConfig().getLkl_request_url() + "/api/v2/mms/openApi/wechatParamConf", param, heard); + System.out.println("Authorization" + JSONObject.toJSONString(reqParam.get("Authorization"))); + System.out.println("request:" + JSONObject.toJSONString(param)); + System.out.println("response:" + responseBody.toJSONString()); + if (!responseBody.getString("retCode").equals("000000")) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, responseBody.getString("retMsg")); + } + + return responseBody; + } + + /** + * 商户报备结果查询 + * @param merCupNo + * @return + */ + public JSONObject querySubMerInfo(String merCupNo) { + // 请求参数 + Map param = new HashMap<>(); + param.put("timestamp", new Date().getTime()); + param.put("rnd", GenerateUtil.generateRandomString(18)); + param.put("ver", "1.0.0"); + param.put("reqId", new Date().getTime()); + + Map map = new HashMap<>(); + map.put("version", "1.0"); + map.put("orderNo", new Date().getTime()); + map.put("orgCode", CommonSysConst.getSysConfig().getLkl_org_code()); + map.put("merCupNo", merCupNo); + map.put("registerStatus", "SUCCESS"); + param.put("reqData", map); + + // 生成签名 + Map reqParam = LaKaLaConfig.generateSignParamsV2(JSONObject.parseObject(JSONObject.toJSONString(param))); + + // 头部参数 + Map heard = new HashMap<>(); + heard.put("Authorization", reqParam.get("Authorization")); + + JSONObject responseBody = HttpsUtils.doPost(CommonSysConst.getSysConfig().getLkl_request_url() + "/api/v2/mms/openApi/querySubMerInfo", param, heard); + System.out.println("Authorization" + JSONObject.toJSONString(reqParam.get("Authorization"))); + System.out.println("request:" + JSONObject.toJSONString(param)); + System.out.println("response:" + responseBody.toJSONString()); + if (!responseBody.getString("retCode").equals("000000")) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, responseBody.getString("retMsg")); + } + return responseBody.getJSONObject("respData"); + } + +}