Commit 8f4153dd by 翁国栋

回滚为使用多个appid

parent 32d7c5e9
......@@ -55,14 +55,6 @@ 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}")
......@@ -120,7 +112,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 + secretq + timestamp + sb.toString());
String value = DigestUtils.md5Hex(pid + insureApplicant.getSecretq() + timestamp + sb.toString());
if (!value.equals(sign)) {
throw new CustomException("增员核保回调验签失败");
}
......@@ -209,7 +201,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 + secretq + timestamp + sb.toString());
String value = DigestUtils.md5Hex(pid + insureApplicant.getSecretq() + timestamp + sb.toString());
if (!value.equals(sign)) {
throw new CustomException("保全增员申请回调验签失败");
}
......@@ -320,7 +312,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 + secret + timestamp + sb.toString());
String value = DigestUtils.md5Hex(pid + insureApplicant.getSecret() + timestamp + sb.toString());
if (!value.equals(sign)) {
throw new CustomException("投保支付收银台回调验签失败");
}
......@@ -339,7 +331,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), appid, secret), bodyMap);
String data = HttpUtils.sendPost(getPolicyUrl, InsureContorll.setParams(JSONObject.toJSONString(bodyMap), insureApplicant.getAppid(), insureApplicant.getSecret()), 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")) {
......@@ -348,7 +340,7 @@ public class CallBackContorll {
insurePolicy.setUpdateTime(new Date());
insurePolicy.updateById();
}
InsureLog.builder().requestParam(JSONObject.toJSONString(InsureContorll.setParams(JSONObject.toJSONString(bodyMap), appid, secret))).type(7)
InsureLog.builder().requestParam(JSONObject.toJSONString(InsureContorll.setParams(JSONObject.toJSONString(bodyMap), insureApplicant.getAppid(), insureApplicant.getSecret()))).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();
}
......@@ -379,7 +371,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 + secret + timestamp + sb.toString());
String value = DigestUtils.md5Hex(pid + insureApplicant.getSecret() + timestamp + sb.toString());
if (!value.equals(sign)) {
throw new CustomException("保单出单回调验签失败");
}
......@@ -437,7 +429,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 + appidq + timestamp + sb.toString());
String value = DigestUtils.md5Hex(pid + insureApplicant.getAppidq() + timestamp + sb.toString());
if (!value.equals(sign)) {
throw new CustomException("增员支付回调验签失败");
}
......
......@@ -116,15 +116,6 @@ 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;
......@@ -276,7 +267,7 @@ public class InsureContorll {
/*人员清单填被保人员*/
String url = creaXSSFWorkbook(insureDto.getPlans(), insureDto.getPolicyDateStart(), priceList);
String url = creaXSSFWorkbook(insureApplicant.getAppid(), insureApplicant.getSecret(),insureDto.getPlans(), insureDto.getPolicyDateStart(), priceList);
if (!StringUtil.isNotBlank(url)) {
return ResultUtil.error("文件错误");
}
......@@ -285,7 +276,7 @@ public class InsureContorll {
Map basicMap = Maps.newHashMap();
basicMap.put("partner_pid", appid);/*分销商pid*/
basicMap.put("partner_pid", insureApplicant.getAppid());/*分销商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());
......@@ -344,7 +335,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), appid, secret), bodyMap);
String data = HttpUtils.sendPost(insureProduct.getPayType() == 1||insureProduct.getPayType() == 2 ? createQuote : insuredUrl, setParams(JSONObject.toJSONString(bodyMap), insureApplicant.getAppid(), insureApplicant.getSecret()), bodyMap);
Map dataMap = JSONObject.parseObject(data, Map.class);
if (dataMap != null) {
/*e25这个是预付款出单中状态*/
......@@ -374,7 +365,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), appid, secret), rbodyMap);
String responData = HttpUtils.sendPost(issue, setParams(JSONObject.toJSONString(rbodyMap), insureApplicant.getAppid(), insureApplicant.getSecret()), 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());
......@@ -394,7 +385,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), appid, secret))).type(1)
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), insureApplicant.getAppid(), insureApplicant.getSecret()))).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();
......@@ -450,7 +441,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, appid, secret);
Map<String, String> toPayParamsMap = setParams(null, insureApplicant.getAppid(), insureApplicant.getSecret());
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");
......@@ -498,7 +489,7 @@ public class InsureContorll {
}
try {
LocalDateTime now = LocalDateTime.now();
String url = creaXSSFWorkbook1(insureDto, priceList);
String url = creaXSSFWorkbook1(insureApplicant.getAppidq(), insureApplicant.getSecretq(),insureDto, priceList);
log.info("保全增员文件地址", url);
DateTimeFormatter dtf2 = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
Map bodyMap = Maps.newHashMap();
......@@ -546,21 +537,21 @@ public class InsureContorll {
y.setIsInsure(1);/*废弃*/
y.insertOrUpdate();
});
String responData = HttpUtils.sendPost(batchUrl, setParams(JSONObject.toJSONString(bodyMap), appidq, secretq), bodyMap);
String responData = HttpUtils.sendPost(batchUrl, setParams(JSONObject.toJSONString(bodyMap), insureApplicant.getAppidq(), insureApplicant.getSecretq()), 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), appidq, secretq))).type(2)
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), insureApplicant.getAppidq(), insureApplicant.getSecretq()))).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), appidq, secretq))).type(2)
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), insureApplicant.getAppidq(), insureApplicant.getSecretq()))).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();
//提交核保申请
......@@ -568,12 +559,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), appidq, secretq), rbodyMap);
String importData = HttpUtils.sendPost(orderImportSet, setParams(JSONObject.toJSONString(rbodyMap), insureApplicant.getAppidq(), insureApplicant.getSecretq()), rbodyMap);
Map<String, Object> rdataMap = JSONObject.parseObject(responData);
return ResultUtil.success("核保中,等待系统更新");
}
}
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appidq, secretq))).type(2)
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), insureApplicant.getAppidq(), insureApplicant.getSecretq()))).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());
......@@ -660,7 +651,7 @@ public class InsureContorll {
}
Double price = insureProductPlan.getPrice();
LocalDateTime now = LocalDateTime.now();
String url = creaXSSFWorkbook2(insureDto.getUserIds(), insureDto.getPolicyDateStart(), oldUser, insureDto.getBenefitOccupationCategory(), insureDto.getTricycleFrameNumber());
String url = creaXSSFWorkbook2(insureApplicant.getAppidq(), insureApplicant.getSecretq(),insureDto.getUserIds(), insureDto.getPolicyDateStart(), oldUser, insureDto.getBenefitOccupationCategory(), insureDto.getTricycleFrameNumber());
log.info("保全替换文件地址", url);
DateTimeFormatter dtf2 = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
Map bodyMap = Maps.newHashMap();
......@@ -672,9 +663,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), appidq, secretq), bodyMap);
String responData = HttpUtils.sendPost(batchUrl, setParams(JSONObject.toJSONString(bodyMap), insureApplicant.getAppidq(), insureApplicant.getSecretq()), bodyMap);
Map<String, Object> dataMap = JSONObject.parseObject(responData);
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appidq, secretq))).type(3)
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), insureApplicant.getAppidq(), insureApplicant.getSecretq()))).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")) {
......@@ -682,7 +673,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), appidq, secretq))).type(2)
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), insureApplicant.getAppidq(), insureApplicant.getSecretq()))).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 写入日志
......@@ -810,10 +801,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), appid, secret), bodyMap);
String data = HttpUtils.sendPost(insuredUrl, setParams(JSONObject.toJSONString(bodyMap), insureApplicant.getAppid(), insureApplicant.getSecret()), bodyMap);
log.info("校验结果:{}", data);
Map dataMap = JSONObject.parseObject(data, Map.class);
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appid, secret))).type(9)
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), insureApplicant.getAppid(), insureApplicant.getSecret()))).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) {
......@@ -1281,9 +1272,9 @@ public class InsureContorll {
//TODO 验证保单的状态
long timestamp = System.currentTimeMillis() / 1000;
Map map = Maps.newHashMap();
map.put("pid", appid);
map.put("pid", insureApplicant.getAppid());
map.put("policy_no", policy.getPolicyNo());
map.put("sign", DigestUtils.md5Hex(appid + secret + timestamp));
map.put("sign", DigestUtils.md5Hex(insureApplicant.getAppid() + insureApplicant.getSecret() + timestamp));
map.put("timestamp", String.valueOf(timestamp));
String data = HttpUtils.sendGet(policyDetailUrl, map);
Map returnMap = JSONObject.parseObject(data, Map.class);
......@@ -1540,7 +1531,7 @@ public class InsureContorll {
/*判断是投保还是保全,投保支付前是没有保单号的*/
if (StringUtils.isNullOrEmpty(insurePolicy.getPolicyNo())) {
/*投保支付*/
toPayParamsMap = setParams(null, appid, secret);
toPayParamsMap = setParams(null, insureApplicant.getAppid(), insureApplicant.getSecret());
toPayParamsMap.put("serial_number", insurePay.getSerialNumber());
toPayParamsMap.put("jump_url", base_api_url + "/callBack/policy/payStatus?policyId=" + insurePay.getPolicyId());
toPayParamsMap.put("pay_type", "1");
......@@ -1564,7 +1555,7 @@ public class InsureContorll {
} else {
/*保全支付*/
toPayParamsMap.put("order_import_uuid", insurePay.getSerialNumber());
String returnPay = HttpUtils.sendPost(batchToPayUrl, setParams(JSONObject.toJSONString(toPayParamsMap), appidq, secretq), toPayParamsMap);
String returnPay = HttpUtils.sendPost(batchToPayUrl, setParams(JSONObject.toJSONString(toPayParamsMap), insureApplicant.getAppidq(), insureApplicant.getSecretq()), 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")));
......@@ -1575,8 +1566,8 @@ public class InsureContorll {
.returnMsg("请求保全支付").policyId(insurePolicy.getId()).build().insert();
/*设置验签参数*/
long timestamp = System.currentTimeMillis() / 1000;
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() + "&notify_url=" + base_api_url + "/callBack/policy/batchPayCallback&pid=" + appidq + "&sign=" + sign + "&timestamp=" + timestamp);
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() + "&notify_url=" + base_api_url + "/callBack/policy/batchPayCallback&pid=" + insureApplicant.getAppidq() + "&sign=" + sign + "&timestamp=" + timestamp);
}
} catch (Exception e) {
log.error("重新发起支付异常:", e);
......@@ -1606,10 +1597,10 @@ public class InsureContorll {
//TODO 验证保单的状态
long timestamp = System.currentTimeMillis() / 1000;
Map map = Maps.newHashMap();
map.put("pid", appidq);
map.put("pid", insureApplicant.getAppidq());
// map.put("sign", DigestUtils.md5Hex(appid + secret + timestamp));
// map.put("timestamp", String.valueOf(timestamp));
map.put("sign", DigestUtils.md5Hex(appidq + secretq + timestamp));
map.put("sign", DigestUtils.md5Hex(insureApplicant.getAppidq() + insureApplicant.getSecretq() + timestamp));
map.put("timestamp", String.valueOf(timestamp));
map.put("set_status", "2");
map.put("import_uuid", insurePay.getSerialNumber());
......@@ -1618,7 +1609,7 @@ public class InsureContorll {
return ResultUtil.error("取消失败,请重新再来");
}
Map returnMap = JSONObject.parseObject(data, Map.class);
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(map), appid, secret))).type(7)
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(map), insureApplicant.getAppid(), insureApplicant.getSecret()))).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")) {
......@@ -1652,7 +1643,7 @@ public class InsureContorll {
*
* @return
*/
public String creaXSSFWorkbook(List<PlansDto> plansList, String createDate, List<InsureProductPlan> priceList) throws Exception {
public String creaXSSFWorkbook(String appid,String secret, List<PlansDto> plansList, String createDate, List<InsureProductPlan> priceList) throws Exception {
if (plansList.size() <= 0) {
return "error";
......@@ -1708,7 +1699,7 @@ public class InsureContorll {
* @param ids
* @return
*/
public String creaXSSFWorkbook1(InsureDto insureDto, List<InsureProductPlan> priceList) throws Exception {
public String creaXSSFWorkbook1(String appidq,String secretq,InsureDto insureDto, List<InsureProductPlan> priceList) throws Exception {
if (insureDto.getUserIds().length <= 0) {
return "error";
}
......@@ -1756,7 +1747,7 @@ public class InsureContorll {
* @param ids
* @return
*/
public String creaXSSFWorkbook2(String[] ids, String date, String[] oldIds, String type, String tricycleFrameNumber) throws Exception {
public String creaXSSFWorkbook2(String appidq,String secretq,String[] ids, String date, String[] oldIds, String type, String tricycleFrameNumber) throws Exception {
if (ids.length <= 0 || oldIds.length <= 0) {
return "error";
}
......@@ -2021,7 +2012,7 @@ public class InsureContorll {
Map bodyMap = Maps.newHashMap();
bodyMap.put("media", fileBase64);
/*end*/
String data = HttpUtils.sendPost(uploadUrl2, setParams(JSONObject.toJSONString(bodyMap), appidq,secretq), bodyMap);
String data = HttpUtils.sendPost(uploadUrl2, setParams(JSONObject.toJSONString(bodyMap), insureApplicant.getAppidq(),insureApplicant.getSecretq()), bodyMap);
Map<String, Object> dataMap = JSONObject.parseObject(data);
if (dataMap.get("errcode").toString().equals("suc")) {
......@@ -2032,7 +2023,7 @@ public class InsureContorll {
throw new CustomException("上传文件路径异常");
}
}
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appidq,secretq))).type(6)
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), insureApplicant.getAppidq(),insureApplicant.getSecretq()))).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();
......@@ -2047,9 +2038,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), appidq,secretq), bodyMap);
String responData = HttpUtils.sendPost(batchUrl, setParams(JSONObject.toJSONString(bodyMap), insureApplicant.getAppidq(),insureApplicant.getSecretq()), bodyMap);
Map<String, Object> batchDataMap = JSONObject.parseObject(responData);
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appidq,secretq))).type(3)
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), insureApplicant.getAppidq(),insureApplicant.getSecretq()))).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")) {
......@@ -2057,7 +2048,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), appidq,secretq))).type(2)
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), insureApplicant.getAppidq(),insureApplicant.getSecretq()))).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 写入日志
......@@ -2206,6 +2197,6 @@ public class InsureContorll {
}
}
return ResultUtil.error("导出成功");
}
}
}
......@@ -261,10 +261,6 @@ wxgzh:
encodingAesKey: 'chAbt69dLAtk8HH0oGMuZwHzK2SuhnxZI5Jbzc4nNzX'
insure:
#投保 appid
appid: '1002209110212305335'
#投保 secret
secret: '1ef7b79471be7f6b5489832c65109f81'
#投保上传文件
uploadUrl: 'https://portal.unistar-ins.com/service/Home/Index/fileUpload'
#投保立即出单
......@@ -282,10 +278,6 @@ insure:
#预付款出单接口
issue: 'https://portal.unistar-ins.com/cps/Labor/Policy/issue'
#保全appid
appidq: '1000706050307154062'
#保全 secret
secretq: 'c1e2e8dcf231c0d0dfc883c09cd42c5b'
#保全上传文件
uploadUrlq: 'https://portal.unistar-ins.com/fuli/Home/Index/file_upload'
#保全申请
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment