From ee8742fe0e48b7716a5417ceadc8e51ed0eabbcb Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Mon, 5 Jun 2023 09:32:45 +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/bweb/controller/TestController.java | 11 ++++-- .../com/cweb/controller/TestController.java | 39 ++++++++++++++----- .../channel/saas/SaasActivityService.java | 34 +++++++++++++++- .../impl/BsBankActivityRosterServiceImpl.java | 2 +- 4 files changed, 70 insertions(+), 16 deletions(-) diff --git a/bweb/src/main/java/com/bweb/controller/TestController.java b/bweb/src/main/java/com/bweb/controller/TestController.java index 0a0cb2c..f9b4835 100644 --- a/bweb/src/main/java/com/bweb/controller/TestController.java +++ b/bweb/src/main/java/com/bweb/controller/TestController.java @@ -131,13 +131,16 @@ public class TestController { } } - @RequestMapping(value="/saas",method = RequestMethod.GET) + @RequestMapping(value="/getSaasToken",method = RequestMethod.GET) @ResponseBody - @ApiOperation(value = "saas") - public ResponseData saas(@RequestParam(value = "code", required = true) String code) { + @ApiOperation(value = "getSaasToken") + public ResponseData getSaasToken(@RequestParam(value = "code", required = true) String code) { try { - return ResponseMsgUtil.success(saasCommon.getToken()); + Map param = new HashMap<>(); + param.put("SAAS_TOKEN", saasCommon.getToken()); + param.put("SAAS_UPDATE_TOKEN", saasCommon.getUpdateToken()); + return ResponseMsgUtil.success(param); } catch (Exception e) { log.error(e.getMessage(), e); diff --git a/cweb/src/main/java/com/cweb/controller/TestController.java b/cweb/src/main/java/com/cweb/controller/TestController.java index 37e8665..c7dd36b 100644 --- a/cweb/src/main/java/com/cweb/controller/TestController.java +++ b/cweb/src/main/java/com/cweb/controller/TestController.java @@ -462,17 +462,39 @@ public class TestController { // return ResponseMsgUtil.success(saasActivityService.queryCustomerActivityStatus("73", "8226900445800HB")); /*********** 活动报名 *************/ - /* List externalCustomerNos = new ArrayList<>(); - externalCustomerNos.add("8226900549903LG"); - externalCustomerNos.add("8226900445800HQ"); - return ResponseMsgUtil.success(saasActivityService.customerRegisterActivity("73", null, externalCustomerNos)); -*/ + List externalCustomerNos = new ArrayList<>(); + externalCustomerNos.add(code); + // externalCustomerNos.add("8226900566100K0"); + // externalCustomerNos.add("82269005714051G"); + // externalCustomerNos.add("8226900899900CW"); + // externalCustomerNos.add("822690058121BAY"); + // externalCustomerNos.add("8226900899900CY"); + // externalCustomerNos.add("822690058121BDR"); + // externalCustomerNos.add("8226900729808JR"); + // externalCustomerNos.add("8226900566100JV"); + // externalCustomerNos.add("8226900566100JY"); + // externalCustomerNos.add("8226900899900DF"); + + // 冉家坝支行 + /* externalCustomerNos.add("8226900445800HS"); + externalCustomerNos.add("82269005072004T"); + externalCustomerNos.add("8226900421500NJ"); + externalCustomerNos.add("822690053310F23");*/ + + // 合川支行 + // externalCustomerNos.add("82269005399025K"); + // externalCustomerNos.add("822690058121C65"); + // externalCustomerNos.add("8226900899900DB"); + // externalCustomerNos.add("822690053310F6C"); + + // return ResponseMsgUtil.success(saasActivityService.customerRegisterActivity("73", "315653022016", "110274",externalCustomerNos)); + // return ResponseMsgUtil.success(saasActivityService.referee("8226900445800HS")); /******* 配置活动费率 *******/ String activityId = "73"; String externalCustomerNo = code; JSONArray jsonArray = saasActivityService.queryCustomerRates(activityId, externalCustomerNo); - return ResponseMsgUtil.success(jsonArray); - /* Map rate; + return ResponseMsgUtil.success(jsonArray); + /*Map rate; List> rates = new ArrayList<>(); for (Object obj : jsonArray) { @@ -482,8 +504,7 @@ public class TestController { rate.put("discountedRates", "0.0025"); rates.add(rate); } - return ResponseMsgUtil.success(saasActivityService.customerRatesUpdate(activityId,externalCustomerNo, rates)); -*/ + return ResponseMsgUtil.success(saasActivityService.customerRatesUpdate(activityId,externalCustomerNo, rates));*/ } catch (Exception e) { log.error(e.getMessage(), e); return ResponseMsgUtil.exception(e); diff --git a/service/src/main/java/com/hfkj/channel/saas/SaasActivityService.java b/service/src/main/java/com/hfkj/channel/saas/SaasActivityService.java index 3ab3119..80f1aaa 100644 --- a/service/src/main/java/com/hfkj/channel/saas/SaasActivityService.java +++ b/service/src/main/java/com/hfkj/channel/saas/SaasActivityService.java @@ -146,11 +146,11 @@ public class SaasActivityService { * 商户报名活动 * @return */ - public JSONObject customerRegisterActivity(String activityId, String branchBankNo, List externalCustomerNos) throws Exception { + public JSONObject customerRegisterActivity(String activityId, String branchBankNo, String refereeId, List externalCustomerNos) throws Exception { Map param = new HashMap<>(); param.put("activityId", activityId); + param.put("refereeId", refereeId); param.put("branchBankNo", branchBankNo); - param.put("refereeId", 0); param.put("externalCustomerNos", externalCustomerNos); Map header = new HashMap<>(); @@ -171,6 +171,36 @@ public class SaasActivityService { } + /** + * 商户报名活动 + * @return + */ + public JSONArray referee(String externalCustomerNo) throws Exception { + Map param = new HashMap<>(); + param.put("externalCustomerNo", externalCustomerNo); + param.put("nameOrJobNumber", 0); + param.put("page", 3); + + Map header = new HashMap<>(); + header.put("Authorization", "Bearer " + saasCommon.getToken()); + + JSONObject obj = new JSONObject(); + obj.put("data", Base64.encodeBase64String(RSAUtil.encryptByPrivateKey(JSONObject.toJSONString(param).getBytes(), Base64.decodeBase64(RSAUtil.PRIVATE_KEY)))); + + JSONObject responseObj = HttpsUtils.doPost(SaasConfig.requestUrl + "htkmarketing/open/welfare/referee", obj, header); + System.out.println("参数:" + JSONObject.toJSONString(param)); + System.out.println("加密:" + obj.getString("data")); + System.out.println("request:" + obj.toJSONString()); + System.out.println("response:" + responseObj.toJSONString()); + if (responseObj == null || !responseObj.getString("code").equals("000000")) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, responseObj.getString("message")); + } + JSONObject responseData = JSONObject.parseObject(new String(RSAUtil.decryptByPublicKey(Base64.decodeBase64(responseObj.getString("data")), Base64.decodeBase64(RSAUtil.PUBLIC_KEY)))); + System.out.println("responseData:" + responseData); + return responseData.getJSONArray("referees"); + } + + /** * 商户费率修改 * @param activityId diff --git a/service/src/main/java/com/hfkj/service/impl/BsBankActivityRosterServiceImpl.java b/service/src/main/java/com/hfkj/service/impl/BsBankActivityRosterServiceImpl.java index 9572ba5..9f7fc8a 100644 --- a/service/src/main/java/com/hfkj/service/impl/BsBankActivityRosterServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/impl/BsBankActivityRosterServiceImpl.java @@ -71,7 +71,7 @@ public class BsBankActivityRosterServiceImpl implements BsBankActivityRosterServ throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的商户"); } // 渠道报名 - saasActivityService.customerRegisterActivity(activity.getActivityNo().toString(), branchBankNo, Arrays.asList(merPlatform.getCupNo())); + saasActivityService.customerRegisterActivity(activity.getActivityNo().toString(), branchBankNo, "110287", Arrays.asList(merPlatform.getCupNo())); BsBankActivityRoster bankActivityRoster = new BsBankActivityRoster(); bankActivityRoster.setBankActivityId(bankActivityId);