Commit 8f4153dd by 翁国栋

回滚为使用多个appid

parent 32d7c5e9
...@@ -55,14 +55,6 @@ public class CallBackContorll { ...@@ -55,14 +55,6 @@ public class CallBackContorll {
@Value("${insure.batchToPayUrl}") @Value("${insure.batchToPayUrl}")
private String 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}") @Value("${pay_page}")
...@@ -120,7 +112,7 @@ public class CallBackContorll { ...@@ -120,7 +112,7 @@ public class CallBackContorll {
InsurePolicy insurePolicy = InsurePolicy.builder().id(insureUserList.get(0).getPolicyId()).build().selectById(); 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())); 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)) { if (!value.equals(sign)) {
throw new CustomException("增员核保回调验签失败"); throw new CustomException("增员核保回调验签失败");
} }
...@@ -209,7 +201,7 @@ public class CallBackContorll { ...@@ -209,7 +201,7 @@ public class CallBackContorll {
} }
InsurePolicy insurePolicy = InsurePolicy.builder().build().selectOne(new QueryWrapper<InsurePolicy>().lambda().eq(InsurePolicy::getPolicyNo, list.get(0).getPolicyNo())); 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())); 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)) { if (!value.equals(sign)) {
throw new CustomException("保全增员申请回调验签失败"); throw new CustomException("保全增员申请回调验签失败");
} }
...@@ -320,7 +312,7 @@ public class CallBackContorll { ...@@ -320,7 +312,7 @@ public class CallBackContorll {
InsurePay insurePay = InsurePay.builder().build().selectOne(new QueryWrapper<InsurePay>().lambda().eq(InsurePay::getSerialNumber, callBack.getSerial_number())); 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())); 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())); 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)) { if (!value.equals(sign)) {
throw new CustomException("投保支付收银台回调验签失败"); throw new CustomException("投保支付收银台回调验签失败");
} }
...@@ -339,7 +331,7 @@ public class CallBackContorll { ...@@ -339,7 +331,7 @@ public class CallBackContorll {
paramsMap.put("sign", sign); paramsMap.put("sign", sign);
Map bodyMap = Maps.newHashMap(); Map bodyMap = Maps.newHashMap();
bodyMap.put("quotation_id", callBack.getSerial_number()); 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); Map dataMap = JSONObject.parseObject(data, Map.class);
if (dataMap.size() > 0) { if (dataMap.size() > 0) {
if (dataMap.get("errcode").toString().equals("suc") || dataMap.get("errcode").toString().equals("e25")) { if (dataMap.get("errcode").toString().equals("suc") || dataMap.get("errcode").toString().equals("e25")) {
...@@ -348,7 +340,7 @@ public class CallBackContorll { ...@@ -348,7 +340,7 @@ public class CallBackContorll {
insurePolicy.setUpdateTime(new Date()); insurePolicy.setUpdateTime(new Date());
insurePolicy.updateById(); 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) .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(); .returnCode(dataMap.get("errcode").toString()).policyId(insurePay.getPolicyId()).returnMsg(dataMap.get("errmsg").toString()).build().insert();
} }
...@@ -377,9 +369,9 @@ public class CallBackContorll { ...@@ -377,9 +369,9 @@ public class CallBackContorll {
PolicyCallBack callBack = JSONObject.parseObject(sb.toString(), PolicyCallBack.class); PolicyCallBack callBack = JSONObject.parseObject(sb.toString(), PolicyCallBack.class);
// InsurePay insurePay = InsurePay.builder().build().selectOne(new QueryWrapper<InsurePay>().lambda().eq(InsurePay::getSerialNumber, callBack.getSerial_number())); // 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())); 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())); 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)) { if (!value.equals(sign)) {
throw new CustomException("保单出单回调验签失败"); throw new CustomException("保单出单回调验签失败");
} }
...@@ -437,7 +429,7 @@ public class CallBackContorll { ...@@ -437,7 +429,7 @@ public class CallBackContorll {
InsurePay insurePay = InsurePay.builder().build().selectOne(new QueryWrapper<InsurePay>().lambda().eq(InsurePay::getSerialNumber, callBack.getOrder_import_uuid())); 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())); 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())); 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)) { if (!value.equals(sign)) {
throw new CustomException("增员支付回调验签失败"); throw new CustomException("增员支付回调验签失败");
} }
......
...@@ -116,15 +116,6 @@ public class InsureContorll { ...@@ -116,15 +116,6 @@ public class InsureContorll {
@Value("${insure.order_import_set}") @Value("${insure.order_import_set}")
private String orderImportSet; 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 @Autowired
private OSSService ossService; private OSSService ossService;
...@@ -188,16 +179,16 @@ public class InsureContorll { ...@@ -188,16 +179,16 @@ public class InsureContorll {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Result<Object> insured_add(@RequestBody InsureDto insureDto) { public Result<Object> insured_add(@RequestBody InsureDto insureDto) {
try { try {
InsureProduct insureProduct = InsureProduct.builder().id(Integer.parseInt(insureDto.getProductId())).build().selectById(); InsureProduct insureProduct = InsureProduct.builder().id(Integer.parseInt(insureDto.getProductId())).build().selectById();
List<InsureProductPlan> priceList = InsureProductPlan.builder().build().selectList(new QueryWrapper<InsureProductPlan>().lambda() List<InsureProductPlan> priceList = InsureProductPlan.builder().build().selectList(new QueryWrapper<InsureProductPlan>().lambda()
.eq(InsureProductPlan::getProductId, insureProduct.getId()).eq(InsureProductPlan::getDeleteFlag, 0)); .eq(InsureProductPlan::getProductId, insureProduct.getId()).eq(InsureProductPlan::getDeleteFlag, 0));
if (insureProduct == null) { if (insureProduct == null) {
return ResultUtil.error("产品不存在"); return ResultUtil.error("产品不存在");
} }
QyzxEntInfoM qyzxEntInfoM = QyzxEntInfoM.builder().id(Integer.parseInt(insureDto.getOrgCode())).build().selectById(); // 企业信息 QyzxEntInfoM qyzxEntInfoM = QyzxEntInfoM.builder().id(Integer.parseInt(insureDto.getOrgCode())).build().selectById(); // 企业信息
if (qyzxEntInfoM == null) { if (qyzxEntInfoM == null) {
return ResultUtil.error("企业不存在"); return ResultUtil.error("企业不存在");
} }
DateTimeFormatter dtf2 = DateTimeFormatter.ofPattern("yyyyMMddHHmmss"); DateTimeFormatter dtf2 = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
DateTimeFormatter ym = DateTimeFormatter.ofPattern("yyyy-MM"); DateTimeFormatter ym = DateTimeFormatter.ofPattern("yyyy-MM");
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
...@@ -276,7 +267,7 @@ public class InsureContorll { ...@@ -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)) { if (!StringUtil.isNotBlank(url)) {
return ResultUtil.error("文件错误"); return ResultUtil.error("文件错误");
} }
...@@ -285,7 +276,7 @@ public class InsureContorll { ...@@ -285,7 +276,7 @@ public class InsureContorll {
Map basicMap = Maps.newHashMap(); 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("plan_code_id", insureProduct.getPlanCodeId());/*计划代码,选项值:61b85207b73d2ab09fb2959 (生产环境) 61b85207b73d2ab09fb2959 (沙箱环境)*/
basicMap.put("product_code_id", insureProduct.getProductCodeId());/*产品代码,选项值:61b85207a9f87da19fb5986 (生产环境) 61b85207a9f87da19fb5986 (沙箱环境)*/ basicMap.put("product_code_id", insureProduct.getProductCodeId());/*产品代码,选项值:61b85207a9f87da19fb5986 (生产环境) 61b85207a9f87da19fb5986 (沙箱环境)*/
basicMap.put("policy_date_start", insureDto.getPolicyDateStart()); basicMap.put("policy_date_start", insureDto.getPolicyDateStart());
...@@ -344,7 +335,7 @@ public class InsureContorll { ...@@ -344,7 +335,7 @@ public class InsureContorll {
quotationsArry.add(quotations); quotationsArry.add(quotations);
bodyMap.put("quotations", quotationsArry); bodyMap.put("quotations", quotationsArry);
log.info(JSONObject.toJSONString(bodyMap)); 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); Map dataMap = JSONObject.parseObject(data, Map.class);
if (dataMap != null) { if (dataMap != null) {
/*e25这个是预付款出单中状态*/ /*e25这个是预付款出单中状态*/
...@@ -369,13 +360,13 @@ public class InsureContorll { ...@@ -369,13 +360,13 @@ public class InsureContorll {
insurePolicy.setStatus("1"); insurePolicy.setStatus("1");
} else if(insureProduct.getPayType()==2) { } else if(insureProduct.getPayType()==2) {
//这里是预付款逻辑 //这里是预付款逻辑
List<Map> quotationsMap = JSONObject.parseObject(JSONObject.toJSONString(map.get("quotations")), List.class); List<Map> quotationsMap = JSONObject.parseObject(JSONObject.toJSONString(map.get("quotations")), List.class);
String serialNumber=quotationsMap.get(0).get("serial_number").toString(); String serialNumber=quotationsMap.get(0).get("serial_number").toString();
insurePolicy.setSerialNumber(serialNumber); insurePolicy.setSerialNumber(serialNumber);
Map rbodyMap = Maps.newHashMap(); Map rbodyMap = Maps.newHashMap();
rbodyMap.put("quotation_id", serialNumber); 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); Map<String, Object> rdataMap = JSONObject.parseObject(responData);
if ((rdataMap.get("errcode").toString().equals("suc"))|| (dataMap.get("errcode").toString().equals("e25"))) { if ((rdataMap.get("errcode").toString().equals("suc"))|| (dataMap.get("errcode").toString().equals("e25"))) {
insurePolicy.setStatus(rdataMap.get("status").toString()); insurePolicy.setStatus(rdataMap.get("status").toString());
insurePolicy.setPolicyFile(rdataMap.get("policy_file").toString()); insurePolicy.setPolicyFile(rdataMap.get("policy_file").toString());
...@@ -394,7 +385,7 @@ public class InsureContorll { ...@@ -394,7 +385,7 @@ public class InsureContorll {
insurePolicy.setTotalPremium(String.valueOf(insureDto.getTotalPrice())); insurePolicy.setTotalPremium(String.valueOf(insureDto.getTotalPrice()));
insurePolicy.setProductId(insureProduct.getId()); insurePolicy.setProductId(insureProduct.getId());
insurePolicy.insert(); 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) .requestData(JSONObject.toJSONString(bodyMap)).createTime(new Date()).requestType(1).returnBody(JSONObject.toJSONString(dataMap)).requestPath(insuredUrl)
.returnCode(dataMap.get("errcode").toString()) .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(); .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 { ...@@ -450,7 +441,7 @@ public class InsureContorll {
List<Map> quotationsMap = JSONObject.parseObject(JSONObject.toJSONString(map.get("quotations")), List.class); 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) { 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("serial_number", quotationsMap.get(0).get("serial_number").toString());
toPayParamsMap.put("jump_url", base_api_url + "/callBack/policy/payStatus?policyId=" + insurePolicy.getId()); toPayParamsMap.put("jump_url", base_api_url + "/callBack/policy/payStatus?policyId=" + insurePolicy.getId());
toPayParamsMap.put("pay_type", "1"); toPayParamsMap.put("pay_type", "1");
...@@ -498,7 +489,7 @@ public class InsureContorll { ...@@ -498,7 +489,7 @@ public class InsureContorll {
} }
try { try {
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
String url = creaXSSFWorkbook1(insureDto, priceList); String url = creaXSSFWorkbook1(insureApplicant.getAppidq(), insureApplicant.getSecretq(),insureDto, priceList);
log.info("保全增员文件地址", url); log.info("保全增员文件地址", url);
DateTimeFormatter dtf2 = DateTimeFormatter.ofPattern("yyyyMMddHHmmss"); DateTimeFormatter dtf2 = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
Map bodyMap = Maps.newHashMap(); Map bodyMap = Maps.newHashMap();
...@@ -546,34 +537,34 @@ public class InsureContorll { ...@@ -546,34 +537,34 @@ public class InsureContorll {
y.setIsInsure(1);/*废弃*/ y.setIsInsure(1);/*废弃*/
y.insertOrUpdate(); 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); Map<String, Object> dataMap = JSONObject.parseObject(responData);
if (dataMap.get("errcode").toString().equals("suc")) { if (dataMap.get("errcode").toString().equals("suc")) {
Map<String, Object> data = JSONObject.parseObject(JSONObject.toJSONString(dataMap.get("data"))); Map<String, Object> data = JSONObject.parseObject(JSONObject.toJSONString(dataMap.get("data")));
Map<String, Object> orderImportInfo = JSONObject.parseObject(JSONObject.toJSONString(data.get("order_import_info"))); Map<String, Object> orderImportInfo = JSONObject.parseObject(JSONObject.toJSONString(data.get("order_import_info")));
String status = orderImportInfo.get("status").toString(); String status = orderImportInfo.get("status").toString();
if (status.equals("5") || status.equals("6") || status.equals("7")) { 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) .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(); .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("信息填写错误,请查看日志"); // return ResultUtil.error("信息填写错误,请查看日志");
throw new CustomException("信息填写错误,请查看日志"); throw new CustomException("信息填写错误,请查看日志");
} else { } 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) .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(); .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();
//提交核保申请 //提交核保申请
String importUuid=data.get("import_uuid").toString(); String importUuid=data.get("import_uuid").toString();
Map rbodyMap = Maps.newHashMap(); Map rbodyMap = Maps.newHashMap();
rbodyMap.put("set_status", "1"); rbodyMap.put("set_status", "1");
rbodyMap.put("import_uuid", importUuid); 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); Map<String, Object> rdataMap = JSONObject.parseObject(responData);
return ResultUtil.success("核保中,等待系统更新"); 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) .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(); .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()); return ResultUtil.error(dataMap.get("errmsg").toString());
...@@ -660,7 +651,7 @@ public class InsureContorll { ...@@ -660,7 +651,7 @@ public class InsureContorll {
} }
Double price = insureProductPlan.getPrice(); Double price = insureProductPlan.getPrice();
LocalDateTime now = LocalDateTime.now(); 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); log.info("保全替换文件地址", url);
DateTimeFormatter dtf2 = DateTimeFormatter.ofPattern("yyyyMMddHHmmss"); DateTimeFormatter dtf2 = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
Map bodyMap = Maps.newHashMap(); Map bodyMap = Maps.newHashMap();
...@@ -672,9 +663,9 @@ public class InsureContorll { ...@@ -672,9 +663,9 @@ public class InsureContorll {
bodyMap.put("import_review_callback", ""); bodyMap.put("import_review_callback", "");
bodyMap.put("import_callback", base_api_url + "/callBack/policy/CallBack"); bodyMap.put("import_callback", base_api_url + "/callBack/policy/CallBack");
bodyMap.put("third_uuid", "RP_" + insurePolicy.getOrgCode() + "_" + dtf2.format(now)); 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); 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) .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(); .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")) { if (dataMap.get("errcode").toString().equals("suc")) {
...@@ -682,7 +673,7 @@ public class InsureContorll { ...@@ -682,7 +673,7 @@ public class InsureContorll {
Map<String, Object> orderImportInfo = JSONObject.parseObject(JSONObject.toJSONString(data.get("order_import_info"))); Map<String, Object> orderImportInfo = JSONObject.parseObject(JSONObject.toJSONString(data.get("order_import_info")));
String status = orderImportInfo.get("status").toString(); String status = orderImportInfo.get("status").toString();
if (status.equals("5") || status.equals("6") || status.equals("7")) { 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) .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(); .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 写入日志 //TODO 写入日志
...@@ -810,10 +801,10 @@ public class InsureContorll { ...@@ -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)); 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); Map bodyMap = JSONObject.parseObject(insureLog.getRequestData(), Map.class);
InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode, i.getOrgCode())); 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); log.info("校验结果:{}", data);
Map dataMap = JSONObject.parseObject(data, Map.class); 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) .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(); .returnCode(dataMap.get("errcode").toString()).returnMsg(dataMap.get("errmsg").toString()).policyId(i.getId()).build().insert();
if (dataMap != null) { if (dataMap != null) {
...@@ -1281,9 +1272,9 @@ public class InsureContorll { ...@@ -1281,9 +1272,9 @@ public class InsureContorll {
//TODO 验证保单的状态 //TODO 验证保单的状态
long timestamp = System.currentTimeMillis() / 1000; long timestamp = System.currentTimeMillis() / 1000;
Map map = Maps.newHashMap(); Map map = Maps.newHashMap();
map.put("pid", appid); map.put("pid", insureApplicant.getAppid());
map.put("policy_no", policy.getPolicyNo()); 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)); map.put("timestamp", String.valueOf(timestamp));
String data = HttpUtils.sendGet(policyDetailUrl, map); String data = HttpUtils.sendGet(policyDetailUrl, map);
Map returnMap = JSONObject.parseObject(data, Map.class); Map returnMap = JSONObject.parseObject(data, Map.class);
...@@ -1540,7 +1531,7 @@ public class InsureContorll { ...@@ -1540,7 +1531,7 @@ public class InsureContorll {
/*判断是投保还是保全,投保支付前是没有保单号的*/ /*判断是投保还是保全,投保支付前是没有保单号的*/
if (StringUtils.isNullOrEmpty(insurePolicy.getPolicyNo())) { 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("serial_number", insurePay.getSerialNumber());
toPayParamsMap.put("jump_url", base_api_url + "/callBack/policy/payStatus?policyId=" + insurePay.getPolicyId()); toPayParamsMap.put("jump_url", base_api_url + "/callBack/policy/payStatus?policyId=" + insurePay.getPolicyId());
toPayParamsMap.put("pay_type", "1"); toPayParamsMap.put("pay_type", "1");
...@@ -1564,7 +1555,7 @@ public class InsureContorll { ...@@ -1564,7 +1555,7 @@ public class InsureContorll {
} else { } else {
/*保全支付*/ /*保全支付*/
toPayParamsMap.put("order_import_uuid", insurePay.getSerialNumber()); 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> payDataMap = JSONObject.parseObject(returnPay);
Map<String, Object> payData = JSONObject.parseObject(JSONObject.toJSONString(payDataMap.get("data"))); Map<String, Object> payData = JSONObject.parseObject(JSONObject.toJSONString(payDataMap.get("data")));
Map<String, Object> importPayInfo = JSONObject.parseObject(JSONObject.toJSONString(payData.get("import_pay_info"))); Map<String, Object> importPayInfo = JSONObject.parseObject(JSONObject.toJSONString(payData.get("import_pay_info")));
...@@ -1575,8 +1566,8 @@ public class InsureContorll { ...@@ -1575,8 +1566,8 @@ public class InsureContorll {
.returnMsg("请求保全支付").policyId(insurePolicy.getId()).build().insert(); .returnMsg("请求保全支付").policyId(insurePolicy.getId()).build().insert();
/*设置验签参数*/ /*设置验签参数*/
long timestamp = System.currentTimeMillis() / 1000; long timestamp = System.currentTimeMillis() / 1000;
String sign = DigestUtils.md5Hex(appidq + secretq + 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=" + appidq + "&sign=" + sign + "&timestamp=" + 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) { } catch (Exception e) {
log.error("重新发起支付异常:", e); log.error("重新发起支付异常:", e);
...@@ -1606,10 +1597,10 @@ public class InsureContorll { ...@@ -1606,10 +1597,10 @@ public class InsureContorll {
//TODO 验证保单的状态 //TODO 验证保单的状态
long timestamp = System.currentTimeMillis() / 1000; long timestamp = System.currentTimeMillis() / 1000;
Map map = Maps.newHashMap(); Map map = Maps.newHashMap();
map.put("pid", appidq); map.put("pid", insureApplicant.getAppidq());
// map.put("sign", DigestUtils.md5Hex(appid + secret + timestamp)); // map.put("sign", DigestUtils.md5Hex(appid + secret + timestamp));
// map.put("timestamp", String.valueOf(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("timestamp", String.valueOf(timestamp));
map.put("set_status", "2"); map.put("set_status", "2");
map.put("import_uuid", insurePay.getSerialNumber()); map.put("import_uuid", insurePay.getSerialNumber());
...@@ -1618,7 +1609,7 @@ public class InsureContorll { ...@@ -1618,7 +1609,7 @@ public class InsureContorll {
return ResultUtil.error("取消失败,请重新再来"); return ResultUtil.error("取消失败,请重新再来");
} }
Map returnMap = JSONObject.parseObject(data, Map.class); 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) .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(); .returnCode(returnMap.get("errcode").toString()).returnMsg(returnMap.get("errmsg").toString()).build().insert();
if (returnMap.get("errcode").equals("suc")) { if (returnMap.get("errcode").equals("suc")) {
...@@ -1652,7 +1643,7 @@ public class InsureContorll { ...@@ -1652,7 +1643,7 @@ public class InsureContorll {
* *
* @return * @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) { if (plansList.size() <= 0) {
return "error"; return "error";
...@@ -1708,7 +1699,7 @@ public class InsureContorll { ...@@ -1708,7 +1699,7 @@ public class InsureContorll {
* @param ids * @param ids
* @return * @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) { if (insureDto.getUserIds().length <= 0) {
return "error"; return "error";
} }
...@@ -1756,7 +1747,7 @@ public class InsureContorll { ...@@ -1756,7 +1747,7 @@ public class InsureContorll {
* @param ids * @param ids
* @return * @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) { if (ids.length <= 0 || oldIds.length <= 0) {
return "error"; return "error";
} }
...@@ -2021,7 +2012,7 @@ public class InsureContorll { ...@@ -2021,7 +2012,7 @@ public class InsureContorll {
Map bodyMap = Maps.newHashMap(); Map bodyMap = Maps.newHashMap();
bodyMap.put("media", fileBase64); bodyMap.put("media", fileBase64);
/*end*/ /*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); Map<String, Object> dataMap = JSONObject.parseObject(data);
if (dataMap.get("errcode").toString().equals("suc")) { if (dataMap.get("errcode").toString().equals("suc")) {
...@@ -2032,7 +2023,7 @@ public class InsureContorll { ...@@ -2032,7 +2023,7 @@ public class InsureContorll {
throw new CustomException("上传文件路径异常"); 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) .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(); .returnCode(dataMap.get("errcode").toString()).returnMsg(dataMap.get("errmsg").toString()).fileUrl(url).build().insert();
...@@ -2047,9 +2038,9 @@ public class InsureContorll { ...@@ -2047,9 +2038,9 @@ public class InsureContorll {
bodyMap.put("import_review_callback", ""); bodyMap.put("import_review_callback", "");
bodyMap.put("import_callback", base_api_url + "/callBack/policy/CallBack"); bodyMap.put("import_callback", base_api_url + "/callBack/policy/CallBack");
bodyMap.put("third_uuid", "RP_" + insurePolicy.getOrgCode() + "_" + dtf2.format(now)); 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); 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) .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(); .returnCode(batchDataMap.get("errcode").toString()).returnMsg(batchDataMap.get("errmsg").toString()).policyId(insurePolicy.getId()).fileUrl(url).build().insert();
if (batchDataMap.get("errcode").toString().equals("suc")) { if (batchDataMap.get("errcode").toString().equals("suc")) {
...@@ -2057,7 +2048,7 @@ public class InsureContorll { ...@@ -2057,7 +2048,7 @@ public class InsureContorll {
Map<String, Object> orderImportInfo = JSONObject.parseObject(JSONObject.toJSONString(batchData.get("order_import_info"))); Map<String, Object> orderImportInfo = JSONObject.parseObject(JSONObject.toJSONString(batchData.get("order_import_info")));
String status = orderImportInfo.get("status").toString(); String status = orderImportInfo.get("status").toString();
if (status.equals("5") || status.equals("6") || status.equals("7")) { 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) .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(); .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 写入日志 //TODO 写入日志
...@@ -2178,34 +2169,34 @@ public class InsureContorll { ...@@ -2178,34 +2169,34 @@ public class InsureContorll {
// 创建当前要填充数据的行对象 // 创建当前要填充数据的行对象
for (int j = 0; j < ygglMainEmpList.size(); j++) { for (int j = 0; j < ygglMainEmpList.size(); j++) {
XSSFRow currentRow = sheet.createRow(i + 3); XSSFRow currentRow = sheet.createRow(i + 3);
//第i+1行 第一列 //第i+1行 第一列
cell = currentRow.createCell(0, CellType.NUMERIC); cell = currentRow.createCell(0, CellType.NUMERIC);
cell.setCellValue(i+1); cell.setCellValue(i+1);
cell = currentRow.createCell(1); cell = currentRow.createCell(1);
cell.setCellValue(i+1); cell.setCellValue(i+1);
} }
OutputStream os = null; OutputStream os = null;
try {
resp.setContentType("application/octet-stream");
resp.setHeader("content-disposition", "attachment; filename=" + URLEncoder.encode(list.size()+"名人员清单.xlsx", "UTF-8"));
resp.setCharacterEncoding("UTF-8");
os = resp.getOutputStream();
workbook.write(os);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}finally {
try { try {
os.close(); resp.setContentType("application/octet-stream");
resp.setHeader("content-disposition", "attachment; filename=" + URLEncoder.encode(list.size()+"名人员清单.xlsx", "UTF-8"));
resp.setCharacterEncoding("UTF-8");
os = resp.getOutputStream();
workbook.write(os);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
}finally {
try {
os.close();
} catch (IOException e) {
e.printStackTrace();
}
} }
} }
}
return ResultUtil.error("导出成功"); return ResultUtil.error("导出成功");
} }
} }
...@@ -261,10 +261,6 @@ wxgzh: ...@@ -261,10 +261,6 @@ wxgzh:
encodingAesKey: 'chAbt69dLAtk8HH0oGMuZwHzK2SuhnxZI5Jbzc4nNzX' encodingAesKey: 'chAbt69dLAtk8HH0oGMuZwHzK2SuhnxZI5Jbzc4nNzX'
insure: insure:
#投保 appid
appid: '1002209110212305335'
#投保 secret
secret: '1ef7b79471be7f6b5489832c65109f81'
#投保上传文件 #投保上传文件
uploadUrl: 'https://portal.unistar-ins.com/service/Home/Index/fileUpload' uploadUrl: 'https://portal.unistar-ins.com/service/Home/Index/fileUpload'
#投保立即出单 #投保立即出单
...@@ -282,10 +278,6 @@ insure: ...@@ -282,10 +278,6 @@ insure:
#预付款出单接口 #预付款出单接口
issue: 'https://portal.unistar-ins.com/cps/Labor/Policy/issue' 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' 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