diff --git a/src/main/java/cn/timer/api/controller/insure/CallBackContorll.java b/src/main/java/cn/timer/api/controller/insure/CallBackContorll.java index 9f991a6..13add75 100644 --- a/src/main/java/cn/timer/api/controller/insure/CallBackContorll.java +++ b/src/main/java/cn/timer/api/controller/insure/CallBackContorll.java @@ -55,6 +55,14 @@ public class CallBackContorll { @Value("${insure.batchToPayUrl}") private String batchToPayUrl; + @Value("${insure.appid}") + private String appid; + @Value("${insure.secret}") + private String secret; + @Value("${insure.appidq}") + private String appidq; + @Value("${insure.secretq}") + private String secretq; /*支付回调*/ @Value("${pay_page}") @@ -112,7 +120,7 @@ public class CallBackContorll { InsurePolicy insurePolicy = InsurePolicy.builder().id(insureUserList.get(0).getPolicyId()).build().selectById(); InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode, insurePolicy.getOrgCode())); - String value = DigestUtils.md5Hex(pid + insureApplicant.getSecretq() + timestamp + sb.toString()); + String value = DigestUtils.md5Hex(pid + secretq + timestamp + sb.toString()); if (!value.equals(sign)) { throw new CustomException("增员核保回调验签失败"); } @@ -201,7 +209,7 @@ public class CallBackContorll { } InsurePolicy insurePolicy = InsurePolicy.builder().build().selectOne(new QueryWrapper<InsurePolicy>().lambda().eq(InsurePolicy::getPolicyNo, list.get(0).getPolicyNo())); InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode, insurePolicy.getOrgCode())); - String value = DigestUtils.md5Hex(pid + insureApplicant.getSecretq() + timestamp + sb.toString()); + String value = DigestUtils.md5Hex(pid + secretq + timestamp + sb.toString()); if (!value.equals(sign)) { throw new CustomException("保全增员申请回调验签失败"); } @@ -312,7 +320,7 @@ public class CallBackContorll { InsurePay insurePay = InsurePay.builder().build().selectOne(new QueryWrapper<InsurePay>().lambda().eq(InsurePay::getSerialNumber, callBack.getSerial_number())); InsurePolicy insurePolicy = InsurePolicy.builder().build().selectOne(new QueryWrapper<InsurePolicy>().lambda().eq(InsurePolicy::getId, insurePay.getPolicyId())); InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode, insurePolicy.getOrgCode())); - String value = DigestUtils.md5Hex(pid + insureApplicant.getSecret() + timestamp + sb.toString()); + String value = DigestUtils.md5Hex(pid + secret + timestamp + sb.toString()); if (!value.equals(sign)) { throw new CustomException("投保支付收银台回调验签失败"); } @@ -331,7 +339,7 @@ public class CallBackContorll { paramsMap.put("sign", sign); Map bodyMap = Maps.newHashMap(); bodyMap.put("quotation_id", callBack.getSerial_number()); - String data = HttpUtils.sendPost(getPolicyUrl, InsureContorll.setParams(JSONObject.toJSONString(bodyMap), insureApplicant.getAppid(), insureApplicant.getSecret()), bodyMap); + String data = HttpUtils.sendPost(getPolicyUrl, InsureContorll.setParams(JSONObject.toJSONString(bodyMap), appid, secret), bodyMap); Map dataMap = JSONObject.parseObject(data, Map.class); if (dataMap.size() > 0) { if (dataMap.get("errcode").toString().equals("suc") || dataMap.get("errcode").toString().equals("e25")) { @@ -340,7 +348,7 @@ public class CallBackContorll { insurePolicy.setUpdateTime(new Date()); insurePolicy.updateById(); } - InsureLog.builder().requestParam(JSONObject.toJSONString(InsureContorll.setParams(JSONObject.toJSONString(bodyMap), insureApplicant.getAppid(), insureApplicant.getSecret()))).type(7) + InsureLog.builder().requestParam(JSONObject.toJSONString(InsureContorll.setParams(JSONObject.toJSONString(bodyMap), appid, secret))).type(7) .requestData(JSONObject.toJSONString(bodyMap)).createTime(new Date()).requestType(1).returnBody(data).requestPath(getPolicyUrl) .returnCode(dataMap.get("errcode").toString()).policyId(insurePay.getPolicyId()).returnMsg(dataMap.get("errmsg").toString()).build().insert(); } @@ -371,7 +379,7 @@ public class CallBackContorll { // InsurePay insurePay = InsurePay.builder().build().selectOne(new QueryWrapper<InsurePay>().lambda().eq(InsurePay::getSerialNumber, callBack.getSerial_number())); InsurePolicy insurePolicy = InsurePolicy.builder().build().selectOne(new QueryWrapper<InsurePolicy>().lambda().eq(InsurePolicy::getSerialNumber,callBack.getSerial_number())); InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode, insurePolicy.getOrgCode())); - String value = DigestUtils.md5Hex(pid + insureApplicant.getSecret() + timestamp + sb.toString()); + String value = DigestUtils.md5Hex(pid + secret + timestamp + sb.toString()); if (!value.equals(sign)) { throw new CustomException("保单出单回调验签失败"); } @@ -429,7 +437,7 @@ public class CallBackContorll { InsurePay insurePay = InsurePay.builder().build().selectOne(new QueryWrapper<InsurePay>().lambda().eq(InsurePay::getSerialNumber, callBack.getOrder_import_uuid())); InsurePolicy insurePolicy = InsurePolicy.builder().build().selectOne(new QueryWrapper<InsurePolicy>().lambda().eq(InsurePolicy::getId, insurePay.getPolicyId())); InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode, insurePolicy.getOrgCode())); - String value = DigestUtils.md5Hex(pid + insureApplicant.getAppidq() + timestamp + sb.toString()); + String value = DigestUtils.md5Hex(pid + appidq + timestamp + sb.toString()); if (!value.equals(sign)) { throw new CustomException("增员支付回调验签失败"); } diff --git a/src/main/java/cn/timer/api/controller/insure/InsureContorll.java b/src/main/java/cn/timer/api/controller/insure/InsureContorll.java index 962fcc6..f4b7a62 100644 --- a/src/main/java/cn/timer/api/controller/insure/InsureContorll.java +++ b/src/main/java/cn/timer/api/controller/insure/InsureContorll.java @@ -116,6 +116,15 @@ public class InsureContorll { @Value("${insure.order_import_set}") private String orderImportSet; + @Value("${insure.appid}") + private String appid; + @Value("${insure.secret}") + private String secret; + @Value("${insure.appidq}") + private String appidq; + @Value("${insure.secretq}") + private String secretq; + @Autowired private OSSService ossService; @@ -267,7 +276,7 @@ public class InsureContorll { /*人员清单填被保人员*/ - String url = creaXSSFWorkbook(insureApplicant.getAppid(), insureApplicant.getSecret(),insureDto.getPlans(), insureDto.getPolicyDateStart(), priceList); + String url = creaXSSFWorkbook(insureDto.getPlans(), insureDto.getPolicyDateStart(), priceList); if (!StringUtil.isNotBlank(url)) { return ResultUtil.error("文件错误"); } @@ -276,7 +285,7 @@ public class InsureContorll { Map basicMap = Maps.newHashMap(); - basicMap.put("partner_pid", insureApplicant.getAppid());/*分销商pid*/ + basicMap.put("partner_pid", appid);/*分销商pid*/ basicMap.put("plan_code_id", insureProduct.getPlanCodeId());/*计划代码,选项值:61b85207b73d2ab09fb2959 (生产环境) 61b85207b73d2ab09fb2959 (沙箱环境)*/ basicMap.put("product_code_id", insureProduct.getProductCodeId());/*产品代码,选项值:61b85207a9f87da19fb5986 (生产环境) 61b85207a9f87da19fb5986 (沙箱环境)*/ basicMap.put("policy_date_start", insureDto.getPolicyDateStart()); @@ -335,7 +344,7 @@ public class InsureContorll { quotationsArry.add(quotations); bodyMap.put("quotations", quotationsArry); log.info(JSONObject.toJSONString(bodyMap)); - String data = HttpUtils.sendPost(insureProduct.getPayType() == 1||insureProduct.getPayType() == 2 ? createQuote : insuredUrl, setParams(JSONObject.toJSONString(bodyMap), insureApplicant.getAppid(), insureApplicant.getSecret()), bodyMap); + String data = HttpUtils.sendPost(insureProduct.getPayType() == 1||insureProduct.getPayType() == 2 ? createQuote : insuredUrl, setParams(JSONObject.toJSONString(bodyMap), appid, secret), bodyMap); Map dataMap = JSONObject.parseObject(data, Map.class); if (dataMap != null) { /*e25这个是预付款出单中状态*/ @@ -365,7 +374,7 @@ public class InsureContorll { insurePolicy.setSerialNumber(serialNumber); Map rbodyMap = Maps.newHashMap(); rbodyMap.put("quotation_id", serialNumber); - String responData = HttpUtils.sendPost(issue, setParams(JSONObject.toJSONString(rbodyMap), insureApplicant.getAppid(), insureApplicant.getSecret()), rbodyMap); + String responData = HttpUtils.sendPost(issue, setParams(JSONObject.toJSONString(rbodyMap), appid, secret), rbodyMap); Map<String, Object> rdataMap = JSONObject.parseObject(responData); if ((rdataMap.get("errcode").toString().equals("suc"))|| (dataMap.get("errcode").toString().equals("e25"))) { insurePolicy.setStatus(rdataMap.get("status").toString()); @@ -385,7 +394,7 @@ public class InsureContorll { insurePolicy.setTotalPremium(String.valueOf(insureDto.getTotalPrice())); insurePolicy.setProductId(insureProduct.getId()); insurePolicy.insert(); - InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), insureApplicant.getAppid(), insureApplicant.getSecret()))).type(1) + InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appid, secret))).type(1) .requestData(JSONObject.toJSONString(bodyMap)).createTime(new Date()).requestType(1).returnBody(JSONObject.toJSONString(dataMap)).requestPath(insuredUrl) .returnCode(dataMap.get("errcode").toString()) .returnMsg(dataMap.get("errmsg").toString()).userType(insureDto.getMethod()).userName(insureDto.getOperatorName()).companyName(insureDto.getOperatorCompanyName()).policyId(insurePolicy.getId()).fileUrl(url).build().insert(); @@ -441,7 +450,7 @@ public class InsureContorll { List<Map> quotationsMap = JSONObject.parseObject(JSONObject.toJSONString(map.get("quotations")), List.class); if ((Integer) quotationsMap.get(0).get("quotations_status") == 10 || (Integer) quotationsMap.get(0).get("quotations_status") == 15) { /*请求收银台*/ - Map<String, String> toPayParamsMap = setParams(null, insureApplicant.getAppid(), insureApplicant.getSecret()); + Map<String, String> toPayParamsMap = setParams(null, appid, secret); toPayParamsMap.put("serial_number", quotationsMap.get(0).get("serial_number").toString()); toPayParamsMap.put("jump_url", base_api_url + "/callBack/policy/payStatus?policyId=" + insurePolicy.getId()); toPayParamsMap.put("pay_type", "1"); @@ -489,7 +498,7 @@ public class InsureContorll { } try { LocalDateTime now = LocalDateTime.now(); - String url = creaXSSFWorkbook1(insureApplicant.getAppidq(), insureApplicant.getSecretq(),insureDto, priceList); + String url = creaXSSFWorkbook1(insureDto, priceList); log.info("保全增员文件地址", url); DateTimeFormatter dtf2 = DateTimeFormatter.ofPattern("yyyyMMddHHmmss"); Map bodyMap = Maps.newHashMap(); @@ -537,21 +546,21 @@ public class InsureContorll { y.setIsInsure(1);/*废弃*/ y.insertOrUpdate(); }); - String responData = HttpUtils.sendPost(batchUrl, setParams(JSONObject.toJSONString(bodyMap), insureApplicant.getAppidq(), insureApplicant.getSecretq()), bodyMap); + String responData = HttpUtils.sendPost(batchUrl, setParams(JSONObject.toJSONString(bodyMap), appidq, secretq), bodyMap); Map<String, Object> dataMap = JSONObject.parseObject(responData); if (dataMap.get("errcode").toString().equals("suc")) { Map<String, Object> data = JSONObject.parseObject(JSONObject.toJSONString(dataMap.get("data"))); Map<String, Object> orderImportInfo = JSONObject.parseObject(JSONObject.toJSONString(data.get("order_import_info"))); String status = orderImportInfo.get("status").toString(); if (status.equals("5") || status.equals("6") || status.equals("7")) { - InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), insureApplicant.getAppidq(), insureApplicant.getSecretq()))).type(2) + InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appidq, secretq))).type(2) .requestData(JSONObject.toJSONString(bodyMap)).createTime(new Date()).requestType(1).returnBody(responData).requestPath(batchUrl) .returnCode(dataMap.get("errcode").toString()).userType(insureDto.getMethod()).userName(insureDto.getOperatorName()).companyName(insureDto.getOperatorCompanyName()).returnMsg(dataMap.get("errmsg").toString()).policyId(insurePolicy.getId()).transId("IS_" + insurePolicy.getOrgCode() + "_" + dtf2.format(now)).fileUrl(data.get("file_url").toString()).build().insert(); // return ResultUtil.error("信息填写错误,请查看日志"); throw new CustomException("信息填写错误,请查看日志"); } else { - InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), insureApplicant.getAppidq(), insureApplicant.getSecretq()))).type(2) + InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appidq, secretq))).type(2) .requestData(JSONObject.toJSONString(bodyMap)).createTime(new Date()).requestType(1).returnBody(responData).requestPath(batchUrl) .returnCode(dataMap.get("errcode").toString()).userType(insureDto.getMethod()).userName(insureDto.getOperatorName()).companyName(insureDto.getOperatorCompanyName()).returnMsg(dataMap.get("errmsg").toString()).policyId(insurePolicy.getId()).fileUrl(url).build().insert(); //提交核保申请 @@ -559,12 +568,12 @@ public class InsureContorll { Map rbodyMap = Maps.newHashMap(); rbodyMap.put("set_status", "1"); rbodyMap.put("import_uuid", importUuid); - String importData = HttpUtils.sendPost(orderImportSet, setParams(JSONObject.toJSONString(rbodyMap), insureApplicant.getAppidq(), insureApplicant.getSecretq()), rbodyMap); + String importData = HttpUtils.sendPost(orderImportSet, setParams(JSONObject.toJSONString(rbodyMap), appidq, secretq), rbodyMap); Map<String, Object> rdataMap = JSONObject.parseObject(responData); return ResultUtil.success("核保中,等待系统更新"); } } - InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), insureApplicant.getAppidq(), insureApplicant.getSecretq()))).type(2) + InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appidq, secretq))).type(2) .requestData(JSONObject.toJSONString(bodyMap)).createTime(new Date()).requestType(1).returnBody(responData).requestPath(batchUrl) .returnCode(dataMap.get("errcode").toString()).userType(insureDto.getMethod()).userName(insureDto.getOperatorName()).companyName(insureDto.getOperatorCompanyName()).returnMsg(dataMap.get("errmsg").toString()).policyId(insurePolicy.getId()).build().insert(); return ResultUtil.error(dataMap.get("errmsg").toString()); @@ -651,7 +660,7 @@ public class InsureContorll { } Double price = insureProductPlan.getPrice(); LocalDateTime now = LocalDateTime.now(); - String url = creaXSSFWorkbook2(insureApplicant.getAppidq(), insureApplicant.getSecretq(),insureDto.getUserIds(), insureDto.getPolicyDateStart(), oldUser, insureDto.getBenefitOccupationCategory(), insureDto.getTricycleFrameNumber()); + String url = creaXSSFWorkbook2(insureDto.getUserIds(), insureDto.getPolicyDateStart(), oldUser, insureDto.getBenefitOccupationCategory(), insureDto.getTricycleFrameNumber()); log.info("保全替换文件地址", url); DateTimeFormatter dtf2 = DateTimeFormatter.ofPattern("yyyyMMddHHmmss"); Map bodyMap = Maps.newHashMap(); @@ -663,9 +672,9 @@ public class InsureContorll { bodyMap.put("import_review_callback", ""); bodyMap.put("import_callback", base_api_url + "/callBack/policy/CallBack"); bodyMap.put("third_uuid", "RP_" + insurePolicy.getOrgCode() + "_" + dtf2.format(now)); - String responData = HttpUtils.sendPost(batchUrl, setParams(JSONObject.toJSONString(bodyMap), insureApplicant.getAppidq(), insureApplicant.getSecretq()), bodyMap); + String responData = HttpUtils.sendPost(batchUrl, setParams(JSONObject.toJSONString(bodyMap), appidq, secretq), bodyMap); Map<String, Object> dataMap = JSONObject.parseObject(responData); - InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), insureApplicant.getAppidq(), insureApplicant.getSecretq()))).type(3) + InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appidq, secretq))).type(3) .requestData(JSONObject.toJSONString(bodyMap)).createTime(new Date()).requestType(1).returnBody(responData).requestPath(batchUrl) .returnCode(dataMap.get("errcode").toString()).userType(insureDto.getMethod()).userName(insureDto.getOperatorName()).companyName(insureDto.getOperatorCompanyName()).returnMsg(dataMap.get("errmsg").toString()).policyId(insurePolicy.getId()).fileUrl(url).build().insert(); if (dataMap.get("errcode").toString().equals("suc")) { @@ -673,7 +682,7 @@ public class InsureContorll { Map<String, Object> orderImportInfo = JSONObject.parseObject(JSONObject.toJSONString(data.get("order_import_info"))); String status = orderImportInfo.get("status").toString(); if (status.equals("5") || status.equals("6") || status.equals("7")) { - InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), insureApplicant.getAppidq(), insureApplicant.getSecretq()))).type(2) + InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appidq, secretq))).type(2) .requestData(JSONObject.toJSONString(bodyMap)).createTime(new Date()).requestType(1).returnBody(responData).requestPath(batchUrl) .returnCode(dataMap.get("errcode").toString()).userType(insureDto.getMethod()).userName(insureDto.getOperatorName()).companyName(insureDto.getOperatorCompanyName()).returnMsg(dataMap.get("errmsg").toString()).policyId(insurePolicy.getId()).transId("RP_" + insurePolicy.getOrgCode() + "_" + dtf2.format(now)).fileUrl(data.get("file_url").toString()).build().insert(); //TODO 写入日志 @@ -801,10 +810,10 @@ public class InsureContorll { InsureLog insureLog = InsureLog.builder().build().selectOne(new QueryWrapper<InsureLog>().lambda().eq(InsureLog::getPolicyId, i.getId()).eq(InsureLog::getType, 1)); Map bodyMap = JSONObject.parseObject(insureLog.getRequestData(), Map.class); InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode, i.getOrgCode())); - String data = HttpUtils.sendPost(insuredUrl, setParams(JSONObject.toJSONString(bodyMap), insureApplicant.getAppid(), insureApplicant.getSecret()), bodyMap); + String data = HttpUtils.sendPost(insuredUrl, setParams(JSONObject.toJSONString(bodyMap), appid, secret), bodyMap); log.info("校验结果:{}", data); Map dataMap = JSONObject.parseObject(data, Map.class); - InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), insureApplicant.getAppid(), insureApplicant.getSecret()))).type(9) + InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appid, secret))).type(9) .requestData(JSONObject.toJSONString(bodyMap)).createTime(new Date()).requestType(1).returnBody(JSONObject.toJSONString(dataMap)).requestPath(insuredUrl) .returnCode(dataMap.get("errcode").toString()).returnMsg(dataMap.get("errmsg").toString()).policyId(i.getId()).build().insert(); if (dataMap != null) { @@ -1272,9 +1281,9 @@ public class InsureContorll { //TODO 验证保单的状态 long timestamp = System.currentTimeMillis() / 1000; Map map = Maps.newHashMap(); - map.put("pid", insureApplicant.getAppid()); + map.put("pid", appid); map.put("policy_no", policy.getPolicyNo()); - map.put("sign", DigestUtils.md5Hex(insureApplicant.getAppid() + insureApplicant.getSecret() + timestamp)); + map.put("sign", DigestUtils.md5Hex(appid + secret + timestamp)); map.put("timestamp", String.valueOf(timestamp)); String data = HttpUtils.sendGet(policyDetailUrl, map); Map returnMap = JSONObject.parseObject(data, Map.class); @@ -1531,7 +1540,7 @@ public class InsureContorll { /*判断是投保还是保全,投保支付前是没有保单号的*/ if (StringUtils.isNullOrEmpty(insurePolicy.getPolicyNo())) { /*投保支付*/ - toPayParamsMap = setParams(null, insureApplicant.getAppid(), insureApplicant.getSecret()); + toPayParamsMap = setParams(null, appid, secret); toPayParamsMap.put("serial_number", insurePay.getSerialNumber()); toPayParamsMap.put("jump_url", base_api_url + "/callBack/policy/payStatus?policyId=" + insurePay.getPolicyId()); toPayParamsMap.put("pay_type", "1"); @@ -1555,7 +1564,7 @@ public class InsureContorll { } else { /*保全支付*/ toPayParamsMap.put("order_import_uuid", insurePay.getSerialNumber()); - String returnPay = HttpUtils.sendPost(batchToPayUrl, setParams(JSONObject.toJSONString(toPayParamsMap), insureApplicant.getAppidq(), insureApplicant.getSecretq()), toPayParamsMap); + String returnPay = HttpUtils.sendPost(batchToPayUrl, setParams(JSONObject.toJSONString(toPayParamsMap), appidq, secretq), toPayParamsMap); Map<String, Object> payDataMap = JSONObject.parseObject(returnPay); Map<String, Object> payData = JSONObject.parseObject(JSONObject.toJSONString(payDataMap.get("data"))); Map<String, Object> importPayInfo = JSONObject.parseObject(JSONObject.toJSONString(payData.get("import_pay_info"))); @@ -1566,8 +1575,8 @@ public class InsureContorll { .returnMsg("请求保全支付").policyId(insurePolicy.getId()).build().insert(); /*设置验签参数*/ long timestamp = System.currentTimeMillis() / 1000; - String sign = DigestUtils.md5Hex(insureApplicant.getAppidq() + insureApplicant.getSecretq() + timestamp); - return ResultUtil.data(importPayInfo.get("pay_url").toString() + "&jump_url=" + base_api_url + "/callBack/policy/payStatus?policyId=" + insurePolicy.getId() + "¬ify_url=" + base_api_url + "/callBack/policy/batchPayCallback&pid=" + insureApplicant.getAppidq() + "&sign=" + sign + "×tamp=" + timestamp); + String sign = DigestUtils.md5Hex(appidq + secretq + timestamp); + return ResultUtil.data(importPayInfo.get("pay_url").toString() + "&jump_url=" + base_api_url + "/callBack/policy/payStatus?policyId=" + insurePolicy.getId() + "¬ify_url=" + base_api_url + "/callBack/policy/batchPayCallback&pid=" + appidq + "&sign=" + sign + "×tamp=" + timestamp); } } catch (Exception e) { log.error("重新发起支付异常:", e); @@ -1597,10 +1606,10 @@ public class InsureContorll { //TODO 验证保单的状态 long timestamp = System.currentTimeMillis() / 1000; Map map = Maps.newHashMap(); - map.put("pid", insureApplicant.getAppidq()); + map.put("pid", appidq); // map.put("sign", DigestUtils.md5Hex(appid + secret + timestamp)); // map.put("timestamp", String.valueOf(timestamp)); - map.put("sign", DigestUtils.md5Hex(insureApplicant.getAppidq() + insureApplicant.getSecretq() + timestamp)); + map.put("sign", DigestUtils.md5Hex(appidq + secretq + timestamp)); map.put("timestamp", String.valueOf(timestamp)); map.put("set_status", "2"); map.put("import_uuid", insurePay.getSerialNumber()); @@ -1609,7 +1618,7 @@ public class InsureContorll { return ResultUtil.error("取消失败,请重新再来"); } Map returnMap = JSONObject.parseObject(data, Map.class); - InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(map), insureApplicant.getAppid(), insureApplicant.getSecret()))).type(7) + InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(map), appid, secret))).type(7) .requestData(JSONObject.toJSONString(map)).createTime(new Date()).requestType(2).returnBody(data).requestPath(uploadUrl) .returnCode(returnMap.get("errcode").toString()).returnMsg(returnMap.get("errmsg").toString()).build().insert(); if (returnMap.get("errcode").equals("suc")) { @@ -1643,7 +1652,7 @@ public class InsureContorll { * * @return */ - public String creaXSSFWorkbook(String appid,String secret, List<PlansDto> plansList, String createDate, List<InsureProductPlan> priceList) throws Exception { + public String creaXSSFWorkbook(List<PlansDto> plansList, String createDate, List<InsureProductPlan> priceList) throws Exception { if (plansList.size() <= 0) { return "error"; @@ -1699,7 +1708,7 @@ public class InsureContorll { * @param ids * @return */ - public String creaXSSFWorkbook1(String appidq,String secretq,InsureDto insureDto, List<InsureProductPlan> priceList) throws Exception { + public String creaXSSFWorkbook1(InsureDto insureDto, List<InsureProductPlan> priceList) throws Exception { if (insureDto.getUserIds().length <= 0) { return "error"; } @@ -1747,7 +1756,7 @@ public class InsureContorll { * @param ids * @return */ - public String creaXSSFWorkbook2(String appidq,String secretq,String[] ids, String date, String[] oldIds, String type, String tricycleFrameNumber) throws Exception { + public String creaXSSFWorkbook2(String[] ids, String date, String[] oldIds, String type, String tricycleFrameNumber) throws Exception { if (ids.length <= 0 || oldIds.length <= 0) { return "error"; } @@ -2012,7 +2021,7 @@ public class InsureContorll { Map bodyMap = Maps.newHashMap(); bodyMap.put("media", fileBase64); /*end*/ - String data = HttpUtils.sendPost(uploadUrl2, setParams(JSONObject.toJSONString(bodyMap), insureApplicant.getAppidq(),insureApplicant.getSecretq()), bodyMap); + String data = HttpUtils.sendPost(uploadUrl2, setParams(JSONObject.toJSONString(bodyMap), appidq,secretq), bodyMap); Map<String, Object> dataMap = JSONObject.parseObject(data); if (dataMap.get("errcode").toString().equals("suc")) { @@ -2023,7 +2032,7 @@ public class InsureContorll { throw new CustomException("上传文件路径异常"); } } - InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), insureApplicant.getAppidq(),insureApplicant.getSecretq()))).type(6) + InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appidq,secretq))).type(6) .requestData(JSONObject.toJSONString(bodyMap)).createTime(new Date()).requestType(1).returnBody(data).requestPath(uploadUrl2) .returnCode(dataMap.get("errcode").toString()).returnMsg(dataMap.get("errmsg").toString()).fileUrl(url).build().insert(); @@ -2038,9 +2047,9 @@ public class InsureContorll { bodyMap.put("import_review_callback", ""); bodyMap.put("import_callback", base_api_url + "/callBack/policy/CallBack"); bodyMap.put("third_uuid", "RP_" + insurePolicy.getOrgCode() + "_" + dtf2.format(now)); - String responData = HttpUtils.sendPost(batchUrl, setParams(JSONObject.toJSONString(bodyMap), insureApplicant.getAppidq(),insureApplicant.getSecretq()), bodyMap); + String responData = HttpUtils.sendPost(batchUrl, setParams(JSONObject.toJSONString(bodyMap), appidq,secretq), bodyMap); Map<String, Object> batchDataMap = JSONObject.parseObject(responData); - InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), insureApplicant.getAppidq(),insureApplicant.getSecretq()))).type(3) + InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appidq,secretq))).type(3) .requestData(JSONObject.toJSONString(bodyMap)).createTime(new Date()).requestType(1).returnBody(responData).requestPath(batchUrl) .returnCode(batchDataMap.get("errcode").toString()).returnMsg(batchDataMap.get("errmsg").toString()).policyId(insurePolicy.getId()).fileUrl(url).build().insert(); if (batchDataMap.get("errcode").toString().equals("suc")) { @@ -2048,7 +2057,7 @@ public class InsureContorll { Map<String, Object> orderImportInfo = JSONObject.parseObject(JSONObject.toJSONString(batchData.get("order_import_info"))); String status = orderImportInfo.get("status").toString(); if (status.equals("5") || status.equals("6") || status.equals("7")) { - InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), insureApplicant.getAppidq(),insureApplicant.getSecretq()))).type(2) + InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appidq,secretq))).type(2) .requestData(JSONObject.toJSONString(bodyMap)).createTime(new Date()).requestType(1).returnBody(responData).requestPath(batchUrl) .returnCode(batchDataMap.get("errcode").toString()).returnMsg(batchDataMap.get("errmsg").toString()).policyId(insurePolicy.getId()).transId("RP_" + insurePolicy.getOrgCode() + "_" + dtf2.format(now)).fileUrl(batchData.get("file_url").toString()).build().insert(); //TODO 写入日志 diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index c27e599..b52cd1b 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -283,9 +283,9 @@ h5: url: 'http://javays.com' insure: #投保 appid -# appid: '1002305000010094276' -# #投保 secret -# secret: '51e405c74bd9514e1955a92520786286' + appid: '1002305000010094276' + #投保 secret + secret: '51e405c74bd9514e1955a92520786286' #投保上传文件 uploadUrl: 'http://sandbox.portal.unistar-ins.com/service/Home/Index/fileUpload' #投保立即出单 @@ -304,9 +304,9 @@ insure: issue: 'http://sandbox.portal.unistar-ins.com/cps/Labor/Policy/issue' #保全appid -# appidq: '1000115041006006938' -# #保全 secret -# secretq: '6ba1bf4aa0bd14368c95ff0b9934a17b' + appidq: '1000115041006006938' + #保全 secret + secretq: '6ba1bf4aa0bd14368c95ff0b9934a17b' #保全上传文件 uploadUrlq: 'http://sandbox.portal.unistar-ins.com/fuli/Home/Index/file_upload' #保全申请 diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml index ce4b425..f7ecf88 100644 --- a/src/main/resources/application-test.yml +++ b/src/main/resources/application-test.yml @@ -254,10 +254,10 @@ wxgzh: encodingAesKey: 'chAbt69dLAtk8HH0oGMuZwHzK2SuhnxZI5Jbzc4nNzX' insure: -# #投保 appid -# appid: '1002303100602312445' -# #投保 secret -# secret: 'acb329868c31d5b3ba03de40dac13dd9' + #投保 appid + appid: '1002303100602312445' + #投保 secret + secret: 'acb329868c31d5b3ba03de40dac13dd9' #投保上传文件 uploadUrl: 'http://sandbox.portal.unistar-ins.com/service/Home/Index/fileUpload' #投保立即出单 @@ -275,10 +275,10 @@ insure: #预付款出单接口 issue: 'http://sandbox.portal.unistar-ins.com/cps/Labor/Policy/issue' -# #保全appid -# appidq: '1000115041006006938' -# #保全 secret -# secretq: '6ba1bf4aa0bd14368c95ff0b9934a17b' + #保全appid + appidq: '1000115041006006938' + #保全 secret + secretq: '6ba1bf4aa0bd14368c95ff0b9934a17b' #保全上传文件 uploadUrlq: 'http://sandbox.portal.unistar-ins.com/fuli/Home/Index/file_upload' #保全申请