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/BsBankActivityController.java b/cweb/src/main/java/com/cweb/controller/BsBankActivityController.java index 9c5ec58..f02d07a 100644 --- a/cweb/src/main/java/com/cweb/controller/BsBankActivityController.java +++ b/cweb/src/main/java/com/cweb/controller/BsBankActivityController.java @@ -134,11 +134,14 @@ public class BsBankActivityController { @ApiOperation(value = "报名活动") public ResponseData enrollActivity(@RequestBody JSONObject body) { try { - if (body == null || body.getLong("bankActivityId") == null || body.getLong("merId") == null) { + if (body == null + || body.getLong("bankActivityId") == null + || body.getLong("merId") == null + || StringUtils.isBlank(body.getString("branchBankNo"))) { throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } - bsBankActivityRosterService.enrollActivity(body.getLong("bankActivityId"),body.getLong("merId")); + bsBankActivityRosterService.enrollActivity(body.getLong("bankActivityId"), body.getLong("merId"), body.getString("branchBankNo")); return ResponseMsgUtil.success("操作成功"); diff --git a/cweb/src/main/java/com/cweb/controller/TestController.java b/cweb/src/main/java/com/cweb/controller/TestController.java index 7add3ea..65c82ed 100644 --- a/cweb/src/main/java/com/cweb/controller/TestController.java +++ b/cweb/src/main/java/com/cweb/controller/TestController.java @@ -463,21 +463,45 @@ public class TestController { @ApiOperation(value = "saasActivity") public ResponseData saasActivity(@RequestParam(value = "code", required = false) String code) { try { - return ResponseMsgUtil.success(saasActivityService.queryAgentActivityStatus("73")); + // return ResponseMsgUtil.success(saasActivityService.queryAgentActivityStatus("73")); // return ResponseMsgUtil.success(saasActivityService.agentRegisterActivity("73")); // return ResponseMsgUtil.success(saasActivityService.queryAgentActivityList()); // return ResponseMsgUtil.success(saasActivityService.queryCustomerActivityStatus("73", "8226900445800HB")); -/* *//*********** 活动报名 *************//* + /*********** 活动报名 *************/ List externalCustomerNos = new ArrayList<>(); - externalCustomerNos.add("8226900723007E8"); - return ResponseMsgUtil.success(saasActivityService.customerRegisterActivity("73", null, externalCustomerNos)); - *//******* 配置活动费率 *******/ -/* String activityId = "73"; + 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) { @@ -487,8 +511,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 0529a39..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,9 +146,10 @@ 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("externalCustomerNos", externalCustomerNos); @@ -170,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/BsBankActivityRosterService.java b/service/src/main/java/com/hfkj/service/BsBankActivityRosterService.java index 996a24a..adb75a3 100644 --- a/service/src/main/java/com/hfkj/service/BsBankActivityRosterService.java +++ b/service/src/main/java/com/hfkj/service/BsBankActivityRosterService.java @@ -24,7 +24,7 @@ public interface BsBankActivityRosterService { * @param bankActivityId * @param merId */ - void enrollActivity(Long bankActivityId, Long merId) throws Exception; + void enrollActivity(Long bankActivityId, Long merId, String branchBankNo) throws Exception; /** * 配置费率 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 45fd6ce..9f7fc8a 100644 --- a/service/src/main/java/com/hfkj/service/impl/BsBankActivityRosterServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/impl/BsBankActivityRosterServiceImpl.java @@ -54,7 +54,7 @@ public class BsBankActivityRosterServiceImpl implements BsBankActivityRosterServ @Override @Transactional(propagation= Propagation.REQUIRES_NEW) - public void enrollActivity(Long bankActivityId, Long merId) throws Exception { + public void enrollActivity(Long bankActivityId, Long merId, String branchBankNo) throws Exception { // 查询报名 BsBankActivityRoster roster = getActivityRoster(bankActivityId, merId); if (roster != null) { @@ -71,7 +71,7 @@ public class BsBankActivityRosterServiceImpl implements BsBankActivityRosterServ throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的商户"); } // 渠道报名 - saasActivityService.customerRegisterActivity(activity.getActivityNo().toString(), null, Arrays.asList(merPlatform.getCupNo())); + saasActivityService.customerRegisterActivity(activity.getActivityNo().toString(), branchBankNo, "110287", Arrays.asList(merPlatform.getCupNo())); BsBankActivityRoster bankActivityRoster = new BsBankActivityRoster(); bankActivityRoster.setBankActivityId(bankActivityId);