From 69aa5287913eb5cbe0204f346a77668a659d68ba Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Wed, 14 Jun 2023 15:18:14 +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/api/controller/v1/MerController.java | 17 ++++++++- .../channel/lakala/LaKaLaConfigService.java | 36 +++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) 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 index 6d6719d..b81bd93 100644 --- a/open-api/src/main/java/com/api/controller/v1/MerController.java +++ b/open-api/src/main/java/com/api/controller/v1/MerController.java @@ -32,7 +32,7 @@ public class MerController { @RequestMapping(value="/wechatParamConf",method = RequestMethod.GET) @ResponseBody - @ApiOperation(value = "wechatParamConf") + @ApiOperation(value = "微信参数配置") public ResponseData wechatParamConf(@RequestParam(value = "merCupNo" , required = true) String merCupNo, @RequestParam(value = "channlId" , required = true) String channlId, @RequestParam(value = "subMchId" , required = true) String subMchId, @@ -64,4 +64,19 @@ public class MerController { } } + + @RequestMapping(value="/queryWechatConfig",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "微信服务商子商户开发配置查询") + public ResponseData queryWechatConfig(@RequestParam(value = "subMchId" , required = true) String subMchId, + @RequestParam(value = "merCupNo" , required = true) String merCupNo) { + try { + + return ResponseMsgUtil.success(laKaLaConfigService.queryWechatConfig(subMchId,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 index 7b666d2..5a84e98 100644 --- a/service/src/main/java/com/hfkj/channel/lakala/LaKaLaConfigService.java +++ b/service/src/main/java/com/hfkj/channel/lakala/LaKaLaConfigService.java @@ -102,4 +102,40 @@ public class LaKaLaConfigService { return responseBody.getJSONObject("respData"); } + /** + * 商户报备结果查询 + * @param merCupNo + * @return + */ + public JSONObject queryWechatConfig(String subMerchantId,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("subMerchantId", subMerchantId); + map.put("merchantNo", merCupNo); + 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/sme/queryWechatConfig", 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"); + } + }