Commit 363ec83e by 翁国栋

运营后台--

更改投保业务逻辑
parent 04a38a75
......@@ -43,9 +43,31 @@ public class CallBackContorll {
@PostMapping(value = "/insuredCallBack")
@ApiOperation(value = "6.投保申请回调", httpMethod = "Post", notes = "投保申请回调")
@ApiOperationSupport(order = 2)
private String insuredCallBack(@RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp, @RequestBody CallBack callBack){
log.info(String.valueOf(callBack));
return "1";
private Map insuredCallBack(HttpServletRequest request, @RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) throws IOException {
Map map = Maps.newHashMap();
map.put("status","error");
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();
byte[] b = new byte[4096];
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);
Map trueMap = Maps.newHashMap();
trueMap.put("status","1");
return trueMap;
}
@PostMapping(value = "/CallBack")
......@@ -85,6 +107,7 @@ public class CallBackContorll {
if(oldlist!=null||oldlist.size()>0) {
oldlist.forEach(i -> {
i.setInsureStatus(4);
i.setStatus("2");
i.updateById();
YgglMainEmp.builder().isInsure(3).build().update(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getId, i.getUserId()));
});
......
......@@ -149,12 +149,12 @@ public class InsureContorll {
quotations.put("quotation_type", 3);/*报价类型:3-投保申请*/
quotations.put("currency", "5");/*币种:5人民币*/
/* quotations.put("source_type", "");*//*币种:5人民币*//*
quotations.put("cps_email", "");*//*币种:5人民币*//*
quotations.put("cps_tel", "");*//*币种:5人民币*//*
quotations.put("last_serial_number", "");*//*币种:5人民币*//*
quotations.put("from_source", "");*//*币种:5人民币*//*
quotations.put("operator_name", "");*//*币种:5人民币*/
quotations.put("source_type", "");//*币种:5人民币*//*
quotations.put("cps_email", "");//*币种:5人民币*//*
quotations.put("cps_tel", "");//*币种:5人民币*//*
quotations.put("last_serial_number", "");//*币种:5人民币*//*
quotations.put("from_source", "");//*币种:5人民币*//*
quotations.put("operator_name", "");//*币种:5人民币
/*企业信息*/
InsureApplicant insureApplicant = InsureApplicant.builder().id(1).build().selectById();
......@@ -171,7 +171,7 @@ public class InsureContorll {
companyApplicantMap.put("applicant_e_mail", insureApplicant.getApplicantEMail());/*企业邮箱*/
companyApplicantMap.put("applicant_province_city", "21024");/*省市区*/
/*人员清单填被保人员*/
String url = creaXSSFWorkbook(insureDto.getUserIds(),price);
String url = creaXSSFWorkbook(insureDto.getUserIds(),price,insureDto.getPolicyDateStart(),insureDto.getTricycleFrameNumber());
if (!StringUtil.isNotBlank(url)) {
return ResultUtil.error("文件错误");
}
......@@ -185,14 +185,14 @@ public class InsureContorll {
basicMap.put("product_code_id", insureProduct.getProductCodeId());/*产品代码,选项值:61b85207a9f87da19fb5986 (生产环境) 61b85207a9f87da19fb5986 (沙箱环境)*/
basicMap.put("policy_date_start",insureDto.getPolicyDateStart());
basicMap.put("policy_date_end", insureDto.getPolicyDateEnd());
/* basicMap.put("channel", "");
basicMap.put("channel", "");
basicMap.put("fee", "");
basicMap.put("partner_user_rate", "");
basicMap.put("promotion_fee", "");
basicMap.put("agent_id", "");
basicMap.put("policy_insure_notify", "");*/
basicMap.put("policy_insure_notify", "");
basicMap.put("promotion_id", 0);
/*basicMap.put("policy_number_last_year", "")*/;
basicMap.put("policy_number_last_year", "");
quotations.put("basic", basicMap);
quotations.put("individual_applicant", Maps.newHashMap());
......@@ -234,7 +234,6 @@ public class InsureContorll {
batchMap = JSONObject.parseObject(JSONObject.toJSONString(policyMap.get("batch")), List.class);
}
List<YgglMainEmp> ygglMainEmpList = ygglMainEmpMapper.selectListByIds(insureDto.getUserIds());
InsureUser insureUser;
insurePolicy = InsurePolicy.builder().build();
insurePolicy.setPolicyDateStart(dtf3.parse(insureDto.getPolicyDateStart()));
insurePolicy.setPolicyDateEnd(dtf3.parse(insureDto.getPolicyDateEnd()));
......@@ -260,6 +259,7 @@ public class InsureContorll {
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appid, secret))).type(1)
.requestData(JSONObject.toJSONString(bodyMap)).createTime(new Date()).requestType(1).returnBody(JSONObject.toJSONString(dataMap)).requestPath(insuredUrl)
.returnCode(dataMap.get("errcode").toString()).returnMsg(dataMap.get("errmsg").toString()).policyId(insurePolicy.getId()).fileUrl(url).build().insert();
InsureUser insureUser;
for (YgglMainEmp y : ygglMainEmpList) {
insureUser = InsureUser.builder().build();
insureUser.setUserId(y.getId());
......@@ -295,9 +295,9 @@ public class InsureContorll {
if(dataMap.get("errcode").toString().equals("suc")) {
y.setIsInsure(1);
y.insertOrUpdate();
return ResultUtil.error("投保成功");
}
}
return ResultUtil.error("投保成功");
}
return ResultUtil.error(dataMap.get("errmsg").toString());
......@@ -310,7 +310,7 @@ public class InsureContorll {
if (dataMap.get("errcode").toString().equals("suc")) {
return dataMap;
} else {
if (dataMap.get("errcode").toString().equals("e1") && (dataMap.get("errmsg").toString().equals("出单中"))) {
if (dataMap.get("errcode").toString().equals("e25") && (dataMap.get("errmsg").toString().equals("出单中"))) {
try {
Thread.sleep(30000);
return requestAgent(bodyMap);
......@@ -330,7 +330,7 @@ public class InsureContorll {
* @param ids
* @return
*/
public String creaXSSFWorkbook(String[] ids,Integer price) {
public String creaXSSFWorkbook(String[] ids,Integer price,String createDate,String tricycleFrameNumber ) {
if (ids.length <= 0) {
return "error";
}
......@@ -339,7 +339,7 @@ public class InsureContorll {
List<YgglMainEmp> ygglMainEmpList = ygglMainEmpMapper.selectListByIds(ids);
List list = Lists.newArrayList();
for (YgglMainEmp y : ygglMainEmpList) {
String[] arr = new String[]{String.valueOf(y.getId()), y.getName(), "身份证", y.getZjNum(), InsuranceEnum.getEnum(price).getName(), "", "深圳名邦人力资源管理有限公司", "无", InsuranceEnum.getEnum(price).getType()};
String[] arr = new String[]{String.valueOf(y.getId()), y.getName(), "身份证", y.getZjNum(), InsuranceEnum.getEnum(price).getName(), createDate.substring(0,10), "深圳名邦人力资源管理有限公司", StringUtils.isNullOrEmpty(tricycleFrameNumber)?"无":tricycleFrameNumber, InsuranceEnum.getEnum(price).getType()};
list.add(arr);
}
String[] rowName = new String[]{"ID", "name", "ID_type", "ID_number", "Scheme_name", "Date_start", "Branch", "Tricycle_frame_number", "benefit_occupation_category"};
......@@ -462,6 +462,7 @@ public class InsureContorll {
.benefitOccupationCategory(insureDto.getBenefitOccupationCategory())
.insuredNo(y.getZjNum())
.insuredEContact(y.getName())
.applyType(1)
.applicantEmployeeList(data.get("file_url").toString())
.policyDateStart(dtf3.parse(insureDto.getPolicyDateStart()))
.policyDateEnd(dtf3.parse(insureDto.getPolicyDateEnd()))
......
......@@ -36,5 +36,5 @@ public class PolicyDto {
private String policyFile;
private String benefitOccupationCategory;
private Integer userId;
private Integer insureStatus;
}
......@@ -277,7 +277,7 @@
</delete>
<select id="selectPolicyList" resultType="cn.timer.api.dto.insure.PolicyDto">
select iu.id,yme.`name`,yme.zj_type,yme.zj_num,iu.policy_no,iu.`status`,ip.scheme_name,iu.policy_date_start,
select iu.id,yme.`name`,yme.zj_type,yme.zj_num,iu.policy_no,iu.`status`,ip.scheme_name,iu.policy_date_start,iu.insure_status,
iu.policy_date_end,ip.create_time,iu.insured_name,iu.benefit_basic_plan AS benefitBasicPlan,iu.price AS price,
iu.user_id as userId
from insure_user iu
......
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