Commit 6b77f156 by 翁国栋

投保

parent 476ab1ad
......@@ -37,3 +37,10 @@ CREATE TABLE ` yggl_main_importLog ` (
ALTER TABLE `timer_test`.`insure_user`
MODIFY COLUMN `apply_type` int(11) NULL DEFAULT NULL COMMENT '申请类型:1新增 2投保 3批改' AFTER `replace_trans_id`;
ALTER TABLE `timer_test`.`insure_applicant`
ADD COLUMN `appid` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL AFTER `applicantephone`,
ADD COLUMN `secret` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL AFTER `appid`,
ADD COLUMN `appidq` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL AFTER `secret`,
ADD COLUMN `secretq` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL AFTER `appidq`;
......@@ -134,6 +134,14 @@ public class InsureApplicant extends Model<InsureApplicant> {
private Integer orgCode;
@ApiModelProperty(value = "银行账号")
private String applicantCorporateBankAccount;
@ApiModelProperty(value = "投保appid")
private String appid;
@ApiModelProperty(value = "投保secret")
private String secret;
@ApiModelProperty(value = "投保全appid")
private String appidq;
@ApiModelProperty(value = "保全secret")
private String secretq;
/**
* 设置:id
......
......@@ -126,5 +126,7 @@ public class InsurePolicy extends Model<InsurePolicy> {
*/
private Integer payId;
private String serialNumber;
}
......@@ -43,15 +43,7 @@ import java.util.Random;
@RequestMapping(value = "/callBack/policy", produces = {"application/json"})
public class CallBackContorll {
private static final Logger log = LoggerFactory.getLogger(CallBackContorll.class);
@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("${insure.getPolicyUrl}")
private String getPolicyUrl;
......@@ -76,9 +68,6 @@ public class CallBackContorll {
if (StringUtils.isNullOrEmpty(pid) || StringUtils.isNullOrEmpty(sign) && StringUtils.isNullOrEmpty(timestamp)) {
return map;
}
if (!pid.equals(appidq)) {
return map;
}
InputStream is = null;
is = request.getInputStream();
StringBuilder sb = new StringBuilder();
......@@ -86,11 +75,11 @@ public class CallBackContorll {
for (int n; (n = is.read(b)) != -1; ) {
sb.append(new String(b, 0, n));
}
String value = DigestUtils.md5Hex(appidq + secretq + timestamp + sb.toString());
if (!value.equals(sign)) {
return map;
}
CallBack callBack = JSONObject.parseObject(sb.toString(), CallBack.class);
// String value = DigestUtils.md5Hex(appidq + secretq + timestamp + sb.toString());
// if (!value.equals(sign)) {
// return map;
// }
Map trueMap = Maps.newHashMap();
trueMap.put("status", "1");
return trueMap;
......@@ -107,9 +96,6 @@ public class CallBackContorll {
if (StringUtils.isNullOrEmpty(pid) || StringUtils.isNullOrEmpty(sign) && StringUtils.isNullOrEmpty(timestamp)) {
return map;
}
if (!pid.equals(appidq)) {
return map;
}
try {
InputStream is = null;
is = request.getInputStream();
......@@ -118,16 +104,18 @@ public class CallBackContorll {
for (int n; (n = is.read(b)) != -1; ) {
sb.append(new String(b, 0, n));
}
String value = DigestUtils.md5Hex(pid + secretq + timestamp + sb.toString());
if (!value.equals(sign)) {
throw new CustomException("增员核保回调验签失败");
}
CallBack callBack = JSONObject.parseObject(sb.toString(), CallBack.class);
log.info("增员核保回调参数:- {}",JSON.toJSONString(callBack));
if (callBack.getCallback_type().equals("1")) {
List<InsureUser> insureUserList = InsureUser.builder().build().selectList(new QueryWrapper<InsureUser>().lambda().eq(InsureUser::getTransId, callBack.getOrder_import_info().getThird_uuid()));
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());
if (!value.equals(sign)) {
throw new CustomException("增员核保回调验签失败");
}
if (callBack.getStatus().equals("1")) {
if (insureUserList.size() > 0) {
insurePolicy.setStatus("4");/*设置为支付状态*/
......@@ -192,9 +180,6 @@ public class CallBackContorll {
if (StringUtils.isNullOrEmpty(pid) || StringUtils.isNullOrEmpty(sign) && StringUtils.isNullOrEmpty(timestamp)) {
return map;
}
if (!pid.equals(appidq)) {
return map;
}
try {
InputStream is = null;
is = request.getInputStream();
......@@ -203,10 +188,7 @@ public class CallBackContorll {
for (int n; (n = is.read(b)) != -1; ) {
sb.append(new String(b, 0, n));
}
String value = DigestUtils.md5Hex(pid + secretq + timestamp + sb.toString());
if (!value.equals(sign)) {
throw new CustomException("保全增员申请回调验签失败");
}
Map paramsMap = Maps.newHashMap();
paramsMap.put("pid", pid);
paramsMap.put("timestamp", timestamp);
......@@ -218,6 +200,11 @@ public class CallBackContorll {
list = InsureUser.builder().build().selectList(new QueryWrapper<InsureUser>().lambda().eq(InsureUser::getBatchNo, callBack.getOrder_import_info().getUuid()));
}
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());
if (!value.equals(sign)) {
throw new CustomException("保全增员申请回调验签失败");
}
if (callBack.getStatus().equals("1")) {
list.forEach(i -> {
i.setInsureStatus(1);
......@@ -320,12 +307,15 @@ public class CallBackContorll {
for (int n; (n = is.read(b)) != -1; ) {
sb.append(new String(b, 0, n));
}
String value = DigestUtils.md5Hex(pid + secret + timestamp + sb.toString());
PayCallBack callBack = JSONObject.parseObject(sb.toString(), PayCallBack.class);
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());
if (!value.equals(sign)) {
throw new CustomException("投保支付收银台回调验签失败");
}
PayCallBack callBack = JSONObject.parseObject(sb.toString(), PayCallBack.class);
InsurePay insurePay = InsurePay.builder().build().selectOne(new QueryWrapper<InsurePay>().lambda().eq(InsurePay::getSerialNumber, callBack.getSerial_number()));
insurePay.setAmount(Double.valueOf(callBack.getAmount()));
insurePay.setPayStatus(Integer.parseInt(callBack.getPay_status()));
insurePay.setPaySerialNo(callBack.getPay_serial_no());
......@@ -341,17 +331,16 @@ 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")) {
//TODO 如果是E25则将保单设为出单中,更新交由保单出单回调做,设为出单状态是因为之后可以手动校验
InsurePolicy insurePolicy = InsurePolicy.builder().id(insurePay.getPolicyId()).build().selectById();
insurePolicy.setStatus("2");
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();
}
......@@ -377,17 +366,19 @@ public class CallBackContorll {
for (int n; (n = is.read(b)) != -1; ) {
sb.append(new String(b, 0, n));
}
String value = DigestUtils.md5Hex(pid + secret + timestamp + sb.toString());
PolicyCallBack callBack = JSONObject.parseObject(sb.toString(), PolicyCallBack.class);
// 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());
if (!value.equals(sign)) {
throw new CustomException("保单出单回调验签失败");
}
PolicyCallBack callBack = JSONObject.parseObject(sb.toString(), PolicyCallBack.class);
InsurePay insurePay = InsurePay.builder().build().selectOne(new QueryWrapper<InsurePay>().lambda().eq(InsurePay::getSerialNumber, callBack.getSerial_number()));
InsurePolicy insurePolicy = InsurePolicy.builder().id(insurePay.getPolicyId()).build().selectById();
List<InsureUser> userList = InsureUser.builder().build().selectList(new QueryWrapper<InsureUser>().lambda().eq(InsureUser::getPolicyId, insurePolicy.getId()));
insurePolicy.setUpdateTime(new Date());
if (callBack.getStatus().equals("1")) {
insurePay.setPayStatus(2);
// insurePay.setPayStatus(2);
insurePolicy.setPolicyNo(callBack.getPolicy_no());
insurePolicy.setTotalPremium(callBack.getTotal_premium());
insurePolicy.setPolicyFile(callBack.getPolicy_file());
......@@ -399,7 +390,7 @@ public class CallBackContorll {
u.updateById();
});
} else {
insurePay.setPayStatus(3);
// insurePay.setPayStatus(3);
insurePolicy.setStatus("3");
userList.forEach(u -> {
u.setStatus("2");
......@@ -408,9 +399,9 @@ public class CallBackContorll {
});
}
insurePolicy.updateById();
insurePay.updateById();
// insurePay.updateById();
InsureLog.builder().type(7).createTime(new Date()).requestType(1).returnBody(sb.toString()).requestPath(getPolicyUrl)
.returnCode(callBack.getStatus()).policyId(insurePay.getPolicyId()).returnMsg(callBack.getErr_msg()).build().insert();
.returnCode(callBack.getStatus()).policyId(insurePolicy.getId()).returnMsg(callBack.getErr_msg()).build().insert();
} catch (Exception e) {
log.error("保单出单回调:",e);
throw new CustomException("保单出单回调");
......@@ -434,12 +425,14 @@ public class CallBackContorll {
for (int n; (n = is.read(b)) != -1; ) {
sb.append(new String(b, 0, n));
}
String value = DigestUtils.md5Hex(pid + secretq + timestamp + sb.toString());
BatchPayCallBack callBack = JSONObject.parseObject(sb.toString(), BatchPayCallBack.class);
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());
if (!value.equals(sign)) {
throw new CustomException("增员支付回调验签失败");
}
BatchPayCallBack callBack = JSONObject.parseObject(sb.toString(), BatchPayCallBack.class);
InsurePay insurePay = InsurePay.builder().build().selectOne(new QueryWrapper<InsurePay>().lambda().eq(InsurePay::getSerialNumber, callBack.getOrder_import_uuid()));
if (insurePay != null) {
insurePay.setPayStatus(Integer.parseInt(callBack.getPay_status()));
insurePay.setAmount(Double.parseDouble(callBack.getPay_money()));
......
......@@ -83,14 +83,6 @@ public class InsureContorll {
private String base_api_url;
private static final Logger log = LoggerFactory.getLogger(InsureContorll.class);
@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("${insure.uploadUrl}")
private String uploadUrl;
......@@ -120,6 +112,8 @@ public class InsureContorll {
private String cancelPayment;
@Value(value = "${config-8timer.init-password}")
private String pwd;
@Value("${insure.issue}")
private String issue;
@Autowired
private OSSService ossService;
......@@ -218,7 +212,7 @@ public class InsureContorll {
return ResultUtil.error("请选择计划和职业类别");
}
insureDto.getPlans().forEach(i -> {
i.setPrice(priceList.stream().filter(v -> v.getId() == i.getBenefitBasicPlan()).collect(Collectors.toList()).get(0).getPrice());
i.setPrice(priceList.stream().filter(v -> v.getId().equals(i.getBenefitBasicPlan())).collect(Collectors.toList()).get(0).getPrice());
insureDto.setTotalPrice(i.getPrice() * i.getUserIds().length + (insureDto.getTotalPrice() == null ? 0 : insureDto.getTotalPrice()));
});
quotations.put("trans_id", "MB_" + dtf2.format(now));/*报价请求流水号*/
......@@ -227,17 +221,22 @@ public class InsureContorll {
quotations.put("currency", "5");/*币种:5人民币*/
quotations.put("source_type", "");//*币种:5人民币*//*
quotations.put("cps_email", "");//*币种:5人民币*//*
quotations.put("cps_tel", "");//*币种:5人民币*//*
quotations.put("is_message", "");//*出单成功信息推送:0为否 1为是 默认为否*//*
quotations.put("cps_email", "");//*邮箱:邮件接收承保通知,is_message为1时,填写即发送*//*
quotations.put("cps_tel", "");//*电话:短信接收承保通知,is_message为1时,填写即发送*//*
quotations.put("last_serial_number", "");//*币种:5人民币*//*
quotations.put("from_source", "");//*币种:5人民币*//*
quotations.put("operator_name", "");//*币种:5人民币
if (insureProduct.getPayType() == 1) {
quotations.put("required_pay", 1);
quotations.put("required_pay", 1);/*是否需要获取投保单号:0否,1是 。如有走支付的业务此参数请传1*/
}else{
quotations.put("required_pay", 0);
}
if(insureProduct.getPayType() == 1||insureProduct.getPayType()==2) {
quotations.put("callback_policy", base_api_url + "/callBack/policy/issueCallback");
}
/*企业信息*/
InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode, qyzxEntInfoM.getId()));
if (insureApplicant == null) {
......@@ -267,7 +266,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("文件错误");
}
......@@ -276,7 +275,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());
......@@ -298,7 +297,7 @@ public class InsureContorll {
/*被保人员 填被保企业信息*/
ArrayList<Map> insuredArray = new ArrayList<>();
insureDto.getPlans().forEach(p -> {
InsureProductPlan plan = priceList.stream().filter(v -> v.getId() == p.getBenefitBasicPlan()).collect(Collectors.toList()).get(0);
InsureProductPlan plan = priceList.stream().filter(v -> v.getId().equals(p.getBenefitBasicPlan())).collect(Collectors.toList()).get(0);
List<InsurePlan> insurePlansList = insurePlanMapper.findPlanByIds(JSON.parseArray(plan.getPlanJson(), String.class));
Map insured = Maps.newHashMap();
insured.put("trans_id", "PI_" + qyzxEntInfoM.getId() + "_" + dtf2.format(now) + "_" + UUID.randomUUID().toString().replace("-", ""));
......@@ -335,7 +334,7 @@ public class InsureContorll {
quotationsArry.add(quotations);
bodyMap.put("quotations", quotationsArry);
log.info(JSONObject.toJSONString(bodyMap));
String data = HttpUtils.sendPost(insureProduct.getPayType() == 1 ? 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这个是预付款出单中状态*/
......@@ -347,17 +346,32 @@ public class InsureContorll {
insurePolicy.setPolicyDateEnd(dtf3.parse(insureDto.getPolicyDateEnd()));
insurePolicy.setType(2);/*年单或者月单*/
insurePolicy.setCurrency("5");
// insurePolicy.setSerialNumber(dataMap.get(""));
if (dataMap.get("errcode").toString().equals("suc")) {
if (insureProduct.getPayType() != 1) {
Object o = dataMap.get("data");
Map<String, Object> map = JSONObject.parseObject(JSONObject.toJSONString(o));
if (insureProduct.getPayType() != 1&&insureProduct.getPayType() != 2) {
policyMap = JSONObject.parseObject(JSONObject.toJSONString(map.get("policy")), Map.class);
batchMap = JSONObject.parseObject(JSONObject.toJSONString(policyMap.get("batch")), List.class);
insurePolicy.setPolicyNo(policyMap.get("policy_no").toString());
insurePolicy.setPolicyFile(policyMap.get("policy_file").toString());
insurePolicy.setKitUrl(policyMap.get("kit_url").toString());
insurePolicy.setStatus("1");
} else {
} else if(insureProduct.getPayType()==2) {
//这里是预付款逻辑
List<Map> quotationsMap = JSONObject.parseObject(JSONObject.toJSONString(map.get("quotations")), List.class);
String serialNumber=quotationsMap.get(0).get("serial_number").toString();
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);
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());
insurePolicy.setPolicyFile(rdataMap.get("policy_file").toString());
insurePolicy.setPolicyNo(rdataMap.get("policy_no").toString());
}
}else{
insurePolicy.setStatus("4");
}
} else {
......@@ -370,7 +384,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();
......@@ -385,8 +399,8 @@ public class InsureContorll {
insureUser.setTransId("P_" + qyzxEntInfoM.getId() + "_" + dtf2.format(now));
insureUser.setPremium(insureDto.getTotalPrice());
if (dataMap.get("errcode").toString().equals("suc")) {
if (insureProduct.getPayType() != 1) {
insureUser.setBatchNo(batchMap.get(0).get("batch_no").toString());
if (insureProduct.getPayType() != 1&&insureProduct.getPayType() != 2) {
insureUser.setBatchNo(batchMap. get(0).get("batch_no").toString());
insureUser.setPolicyNo(policyMap.get("policy_no").toString());
insureUser.setInsureStatus(1);
insureUser.setStatus("1");
......@@ -426,7 +440,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");
......@@ -468,12 +482,13 @@ public class InsureContorll {
InsureProduct insureProduct = InsureProduct.builder().id(insurePolicy.getProductId()).build().selectById();
List<InsureProductPlan> priceList = InsureProductPlan.builder().build().selectList(new QueryWrapper<InsureProductPlan>().lambda()
.eq(InsureProductPlan::getProductId, insureProduct.getId()).eq(InsureProductPlan::getDeleteFlag, 0));
InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode, insurePolicy.getOrgCode()));
if (insurePolicy == null) {
return ResultUtil.error("保单不存在");
}
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();
......@@ -495,8 +510,8 @@ public class InsureContorll {
InsureUser.builder()
.transId(bodyMap.get("third_uuid").toString())
.insuredName(qyzxEntInfoM.getName())
.price(priceList.stream().filter(v -> v.getId() == insureDto.getBenefitBasicPlan()).collect(Collectors.toList()).get(0).getPrice())/*前端获取的保费*/
.premium(priceList.stream().filter(v -> v.getId() == insureDto.getBenefitBasicPlan()).collect(Collectors.toList()).get(0).getPrice() * insureDto.getUserIds().length)
.price(priceList.stream().filter(v -> v.getId().equals(insureDto.getBenefitBasicPlan())).collect(Collectors.toList()).get(0).getPrice())/*前端获取的保费*/
.premium(priceList.stream().filter(v -> v.getId().equals(insureDto.getBenefitBasicPlan())).collect(Collectors.toList()).get(0).getPrice() * insureDto.getUserIds().length)
// .batchNo(data.get("import_uuid").toString())
// .benefitBasicPlan(insureDto.getBenefitBasicPlan())
.productPlanId(insureDto.getBenefitBasicPlan())
......@@ -521,27 +536,27 @@ 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), appid, secret))).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), appid, secret))).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();
return ResultUtil.success("核保中,等待系统更新");
}
}
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appid, secret))).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());
......@@ -597,6 +612,7 @@ public class InsureContorll {
public Result<Object> replaceUser(@RequestBody InsureDto insureDto) {
InsurePolicy insurePolicy = InsurePolicy.builder().id(Integer.parseInt(insureDto.getId())).build().selectById();
InsureProductPlan insureProductPlan = InsureProductPlan.builder().id(insureDto.getBenefitBasicPlan()).build().selectById();
InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode, insurePolicy.getOrgCode()));
if (insurePolicy == null) {
return ResultUtil.error("保单不存在");
}
......@@ -627,7 +643,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();
......@@ -639,9 +655,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")) {
......@@ -649,7 +665,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 写入日志
......@@ -776,10 +792,11 @@ public class InsureContorll {
insurePolicies.forEach(i -> {
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);
String data = HttpUtils.sendPost(insuredUrl, setParams(JSONObject.toJSONString(bodyMap), appid, secret), bodyMap);
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);
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) {
......@@ -1105,6 +1122,12 @@ public class InsureContorll {
}
/**
* 导入企业必须在同一个企业下
* @param file
* @param productId
* @return
*/
@PostMapping(value = "/importPolicy")
@ApiOperation(value = "14.导入保单--运营后台", httpMethod = "POST", notes = "导入用户")
@Transactional(rollbackFor = Exception.class)
......@@ -1127,7 +1150,7 @@ public class InsureContorll {
//默认第一行为标题行,i = 0
XSSFRow titleRow = sheetAt.getRow(0);
InsurePolicy policy = InsurePolicy.builder().build();
QyzxEntInfoM company = null;
QyzxEntInfoM company = new QyzxEntInfoM();
InsureUser user;
List<InsureUser> userList = Lists.newArrayList();
// 循环获取每一行数据
......@@ -1215,10 +1238,12 @@ public class InsureContorll {
}
break;
case "企业全称":
if(company.getId()==null) {
company = QyzxEntInfoM.builder().build().selectOne(new QueryWrapper<QyzxEntInfoM>().lambda().eq(QyzxEntInfoM::getAttestName, ExcelUtils.getString(cell)));
if (company == null) {
return ResultUtil.error("企业不存在");
}
}
user.setOrgCode(company.getId());
policy.setOrgCode(company.getId());
break;
......@@ -1234,12 +1259,14 @@ public class InsureContorll {
}
userList.add(user);
}
InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode, company.getId()));
//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);
......@@ -1490,11 +1517,13 @@ public class InsureContorll {
}
try {
InsurePolicy insurePolicy = InsurePolicy.builder().id(insurePay.getPolicyId()).build().selectById();
InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode, insurePolicy.getOrgCode()));
Map<String, String> toPayParamsMap = Maps.newHashMap();
/*判断是投保还是保全,投保支付前是没有保单号的*/
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");
......@@ -1518,7 +1547,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")));
......@@ -1529,8 +1558,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);
......@@ -1556,13 +1585,14 @@ public class InsureContorll {
try {
InsurePolicy insurePolicy = InsurePolicy.builder().id(insurePay.getPolicyId()).build().selectById();
InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode, insurePolicy.getOrgCode()));
//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());
......@@ -1571,7 +1601,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")) {
......@@ -1605,7 +1635,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";
......@@ -1616,7 +1646,7 @@ public class InsureContorll {
plansList.forEach(p -> {
List<YgglMainEmp> ygglMainEmpList = ygglMainEmpMapper.selectListByIds(p.getUserIds());
for (YgglMainEmp y : ygglMainEmpList) {
String[] arr = new String[]{String.valueOf(y.getId()), y.getName(), "身份证", y.getZjNum(), priceList.stream().filter(v -> v.getId() == p.getBenefitBasicPlan()).collect(Collectors.toList()).get(0).getName(), createDate, "", StringUtils.isNullOrEmpty(p.getTricycleFrameNumber()) ? "无" : p.getTricycleFrameNumber(), getPlanType(p.getBenefitOccupationCategory())};
String[] arr = new String[]{String.valueOf(y.getId()), y.getName(), "身份证", y.getZjNum(), priceList.stream().filter(v -> v.getId().equals(p.getBenefitBasicPlan())).collect(Collectors.toList()).get(0).getName(), createDate, "", StringUtils.isNullOrEmpty(p.getTricycleFrameNumber()) ? "无" : p.getTricycleFrameNumber(), getPlanType(p.getBenefitOccupationCategory())};
list.add(arr);
}
});
......@@ -1661,7 +1691,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";
}
......@@ -1669,7 +1699,7 @@ public class InsureContorll {
List<YgglMainEmp> ygglMainEmpList = ygglMainEmpMapper.selectListByIds(insureDto.getUserIds());
List list = Lists.newArrayList();
for (YgglMainEmp y : ygglMainEmpList) {
String[] arr = new String[]{String.valueOf(y.getId()), y.getName(), "身份证", y.getZjNum(), priceList.stream().filter(v -> v.getId() == insureDto.getBenefitBasicPlan()).collect(Collectors.toList()).get(0).getName(), insureDto.getPolicyDateStart(), "", StringUtils.isNullOrEmpty(insureDto.getTricycleFrameNumber()) ? "无" : insureDto.getTricycleFrameNumber(), getPlanType(insureDto.getBenefitOccupationCategory())};
String[] arr = new String[]{String.valueOf(y.getId()), y.getName(), "身份证", y.getZjNum(), priceList.stream().filter(v -> v.getId().equals(insureDto.getBenefitBasicPlan())).collect(Collectors.toList()).get(0).getName(), insureDto.getPolicyDateStart(), "", StringUtils.isNullOrEmpty(insureDto.getTricycleFrameNumber()) ? "无" : insureDto.getTricycleFrameNumber(), getPlanType(insureDto.getBenefitOccupationCategory())};
list.add(arr);
}
String[] rowName = new String[]{"ID", "name", "ID_type", "ID_number", "Scheme_name", "Date_start", "Branch", "Tricycle_frame_number", "benefit_occupation_category"};
......@@ -1709,7 +1739,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";
}
......@@ -1831,6 +1861,7 @@ public class InsureContorll {
@Transactional(rollbackFor = Exception.class)
public Result<Object> replaceUserPolicy(@RequestParam("file") MultipartFile file, @RequestParam("policyId") Integer policyId) {
InsurePolicy insurePolicy = InsurePolicy.builder().id(policyId).build().selectById();
InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode, insurePolicy.getOrgCode()));
InsureProduct insureProduct = InsureProduct.builder().id(insurePolicy.getProductId()).build().selectById();
List<InsureProductPlan> priceList = InsureProductPlan.builder().build().selectList(new QueryWrapper<InsureProductPlan>().lambda()
.eq(InsureProductPlan::getProductId, insureProduct.getId()).eq(InsureProductPlan::getDeleteFlag, 0));
......@@ -1973,7 +2004,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")) {
......@@ -1984,7 +2015,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();
......@@ -1999,9 +2030,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), appid, secret))).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")) {
......@@ -2009,7 +2040,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), appid, secret))).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 写入日志
......@@ -2017,7 +2048,7 @@ public class InsureContorll {
} else {
QyzxEntInfoM qyzxEntInfoM = QyzxEntInfoM.builder().id(insurePolicy.getOrgCode()).build().selectById();
replaceList.forEach(y -> {
Double price = priceList.stream().filter(v -> v.getId() == y.getProductPlanId()).collect(Collectors.toList()).get(0).getPrice();
Double price = priceList.stream().filter(v -> v.getId().equals(y.getProductPlanId())).collect(Collectors.toList()).get(0).getPrice();
InsureUser.builder()
.transId("RP_" + insurePolicy.getOrgCode() + "_" + dtf2.format(now))
.insuredName(qyzxEntInfoM.getName())
......
......@@ -31,17 +31,6 @@ public class InsurePayController{
@Autowired
private InsureUserMapper insureUserMapper;
@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("${insure.toPayUrl}")
private String toPayUrl;
@GetMapping(value = "/cancelPayment")
@ApiOperation(value = "取消支付", httpMethod = "GET", notes = "取消支付")
......
......@@ -65,6 +65,13 @@ public class InsurePlanController {
}
return ResultUtil.error("保存失败");
}
;
@PostMapping(value = "/deletePlan")
@ApiOperation(value = "删除产品方案", httpMethod = "POST", notes = "删除产品方案")
public Result<Object> deletePlan(@RequestBody InsureProductPlan insureProductPlan) {
insureProductPlan.setDeleteFlag(1);
if (insureProductPlan.updateById()) {
return ResultUtil.data("删除产品方案成功");
}
return ResultUtil.error("添加产品失败");
}
}
......@@ -52,5 +52,4 @@ public class InsureProductController {
return ResultUtil.error("添加产品失败");
}
;
}
......@@ -283,9 +283,9 @@ h5:
url: 'http://javays.com'
insure:
#投保 appid
appid: '1002303100602312445'
#投保 secret
secret: 'acb329868c31d5b3ba03de40dac13dd9'
# appid: '1002305000010094276'
# #投保 secret
# secret: '51e405c74bd9514e1955a92520786286'
#投保上传文件
uploadUrl: 'http://sandbox.portal.unistar-ins.com/service/Home/Index/fileUpload'
#投保立即出单
......@@ -300,11 +300,13 @@ insure:
toPayUrl: 'http://sandbox.portal.unistar-ins.com/mall/Home/Pay/toPay'
#保全支付
batchToPayUrl: 'http://sandbox.portal.unistar-ins.com/fuli/Home/ImportPay/set_import_pay'
#预付款出单接口
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'
#保全申请
......@@ -313,7 +315,7 @@ insure:
cancelPayment: 'http://sandbox.portal.unistar-ins.com/fuli/Home/OrderImport/order_import_set'
# base_api_url
BASE_API_URL: 'http://o49t563035.qicp.vip'
BASE_API_URL: 'https://u495v63035.oicp.vip'
#支付回调
pay_page: 'http://localhost:9527'
......
......@@ -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'
#投保立即出单
......@@ -272,11 +272,13 @@ insure:
toPayUrl: 'http://sandbox.portal.unistar-ins.com/mall/Home/Pay/toPay'
#保全支付
batchToPayUrl: 'http://sandbox.portal.unistar-ins.com/fuli/Home/ImportPay/set_import_pay'
#预付款出单接口
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'
#保全申请
......
......@@ -24,6 +24,10 @@
<result property="currency" column="currency"/>
<result property="applicantInvoicedAmount" column="applicant_invoiced_amount"/>
<result property="applicantCorporateBankAccount" column="applicant_corporate_bank_account"/>
<result property="appid" column="appid"/>
<result property="secret" column="secret"/>
<result property="appidq" column="appidq"/>
<result property="secretq" column="secretq"/>
</resultMap>
<select id="queryObject" resultType="cn.timer.api.bean.insure.InsureApplicant">
......@@ -147,7 +151,11 @@
`trans_id`,
`currency`,
`applicant_invoiced_amount`,
`applicant_corporate_bank_account`)
`applicant_corporate_bank_account`,
`appid`,
`secret`,
`appidq`,
`secretq`)
values (#{applicantEName},
#{applicantEAddress},
#{applicantEmployeeList},
......@@ -164,7 +172,11 @@
#{applicantType},
#{transId},
#{currency},
#{applicantCorporateBankAccount})
#{applicantCorporateBankAccount},
#{appid},
#{secret},
#{appidq},
#{secretq})
</insert>
<insert id="saveSelective" parameterType="cn.timer.api.bean.insure.InsureApplicant" useGeneratedKeys="true"
......@@ -189,6 +201,10 @@
<if test="currency != null">,`currency`</if>
<if test="applicantInvoicedAmount != null">,`applicant_invoiced_amount`</if>
<if test="applicantCorporateBankAccount != null">,`applicant_corporate_bank_account`</if>
<if test="appid != null">,`appid`</if>
<if test="secret != null">,`secret`</if>
<if test="appidq != null">,`appidq`</if>
<if test="secretq != null">,`secretq`</if>
)
values
(
......@@ -209,6 +225,10 @@
<if test="transId != null">,#{transId}</if>
<if test="currency != null">,#{currency}</if>
<if test="applicantCorporateBankAccount != null">,#{applicantCorporateBankAccount}</if>
<if test="appid != null">,#{appid}</if>
<if test="secret != null">,#{secret}</if>
<if test="appidq != null">,#{appidq}</if>
<if test="secretq != null">,#{secretq}</if>
)
</insert>
......@@ -233,7 +253,11 @@
`applicant_type`,
`trans_id`,
`currency`,
`applicant_invoiced_amount`
`applicant_invoiced_amount`,
`appid`,
`secret`,
`appidq`,
`secretq`
)
values
<foreach collection="list" item="item" index="index" separator=",">
......@@ -254,7 +278,11 @@
#{item.applicantType},
#{item.transId},
#{item.currency},
#{item.applicantInvoicedAmount}
#{item.applicantInvoicedAmount},
#{item.appid},
#{item.secret},
#{item.appidq},
#{item.secretq}
)
</foreach>
</insert>
......
......@@ -25,6 +25,7 @@
<result property="updateTime" column="update_time"/>
<result property="policyPayType" column="policy_pay_type"/>
<result property="payId" column="pa_id"/>
<result property="serialNumber" column="serial_number"/>
</resultMap>
<select id="queryObject" resultType="cn.timer.api.bean.insure.InsurePolicy">
......@@ -56,6 +57,7 @@
<if test="orgCode != null and orgCode != ''">AND `org_code` = #{orgCode}</if>
<if test="createTime != null and createTime != ''">AND `create_time` = #{createTime}</if>
<if test="updateTime != null and updateTime != ''">AND `update_time` = #{updateTime}</if>
<if test="serialNumber != null and serialNumber != ''">AND `serial_number` = #{serialNumber}</if>
</where>
<choose>
<when test="sidx != null and sidx.trim() != ''">
......@@ -93,6 +95,7 @@
<if test="orgCode != null and orgCode != ''">AND `org_code` = #{orgCode}</if>
<if test="createTime != null and createTime != ''">AND `create_time` = #{createTime}</if>
<if test="updateTime != null and updateTime != ''">AND `update_time` = #{updateTime}</if>
<if test="serialNumber != null and serialNumber != ''">AND `serial_number` = #{serialNumber}</if>
</where>
</select>
......@@ -114,7 +117,8 @@
`insure_applicant_id`,
`org_code`,
`create_time`,
`update_time`)
`update_time`,
`serial_number`)
values (#{schemeName},
#{policyDateStart},
#{policyDateEnd},
......@@ -131,7 +135,8 @@
#{insureApplicantId},
#{orgCode},
#{createTime},
#{updateTime})
#{updateTime},
#{serialNumber})
</insert>
<insert id="saveSelective" parameterType="cn.timer.api.bean.insure.InsurePolicy" useGeneratedKeys="true"
......@@ -155,6 +160,7 @@
<if test="orgCode != null">,`org_code`</if>
<if test="createTime != null">,`create_time`</if>
<if test="updateTime != null">,`update_time`</if>
<if test="serialNumber != null">,`serial_number`</if>
)
values
(
......@@ -175,6 +181,7 @@
<if test="orgCode != null">,#{orgCode}</if>
<if test="createTime != null">,#{createTime}</if>
<if test="updateTime != null">,#{update_time}</if>
<if test="serialNumber != null">,#{serialNumber}</if>
)
</insert>
......@@ -199,7 +206,8 @@
`insure_applicant_id`,
`org_code`,
`create_time`,
`update_time`
`update_time`,
`serial_number`
)
values
<foreach collection="list" item="item" index="index" separator=",">
......@@ -220,7 +228,8 @@
#{item.insureApplicantId},
#{item.orgCode},
#{item.createTime},
#{item.updateTime}
#{item.updateTime},
#{item.serialNumber}
)
</foreach>
</insert>
......@@ -247,7 +256,9 @@
ip.update_time AS updateTime,
ip.`status` as `status`,
ip.org_code as orgCode,
ip.pay_id as payId
ip.pay_id as payId,
ip.serial_number as serialNumber,
ip.policy_file as policyFile
FROM
insure_policy ip
LEFT JOIN insure_user iu ON iu.policy_id = ip.id
......
......@@ -22,7 +22,7 @@
ipp.create_time as createTime
from insure_product_plan ipp
LEFT JOIN insure_product ip on ip.id = ipp.product_id
WHERE ip.id = #{productId}
WHERE ip.id = #{productId} and delete_flag=0
</select>
</mapper>
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