Commit e6edd17c by 翁国栋

解决导入保单时用户名为空

parent d669820f
package cn.timer.api.controller.insure; package cn.timer.api.controller.insure;
import cn.timer.api.bean.insure.*; import cn.timer.api.bean.insure.*;
import cn.timer.api.bean.kqmk.KqglAssoLeaveEmployeeBalance;
import cn.timer.api.bean.kqmk.KqglAssoLeaveRules; import cn.timer.api.bean.kqmk.KqglAssoLeaveRules;
import cn.timer.api.bean.qyzx.QyzxEntInfoM; import cn.timer.api.bean.qyzx.QyzxEntInfoM;
import cn.timer.api.bean.yggl.YgglMainEmp; import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.config.annotation.CurrentUser; import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean; import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.controller.insure.enums.InsuranceEnum; import cn.timer.api.controller.insure.enums.PlanEnum;
import cn.timer.api.dao.insure.InsureLogMapper; import cn.timer.api.dao.insure.InsureLogMapper;
import cn.timer.api.dao.insure.InsurePolicyMapper; import cn.timer.api.dao.insure.InsurePolicyMapper;
import cn.timer.api.dao.insure.InsureUserMapper; import cn.timer.api.dao.insure.InsureUserMapper;
...@@ -331,7 +330,7 @@ public class InsureContorll { ...@@ -331,7 +330,7 @@ public class InsureContorll {
plansList.forEach(p -> { plansList.forEach(p -> {
List<YgglMainEmp> ygglMainEmpList = ygglMainEmpMapper.selectListByIds(p.getUserIds()); List<YgglMainEmp> ygglMainEmpList = ygglMainEmpMapper.selectListByIds(p.getUserIds());
for (YgglMainEmp y : ygglMainEmpList) { for (YgglMainEmp y : ygglMainEmpList) {
String[] arr = new String[]{String.valueOf(y.getId()), y.getName(), "身份证", y.getZjNum(), InsuranceEnum.getEnum(p.getBenefitBasicPlan(), p.getBenefitOccupationCategory()).getName(), createDate, "深圳名邦人力资源管理有限公司", StringUtils.isNullOrEmpty(p.getTricycleFrameNumber()) ? "无" : p.getTricycleFrameNumber(), InsuranceEnum.getEnum(p.getBenefitBasicPlan(), p.getBenefitOccupationCategory()).getType()}; String[] arr = new String[]{String.valueOf(y.getId()), y.getName(), "身份证", y.getZjNum(), PlanEnum.getEnum(p.getBenefitBasicPlan(), p.getBenefitOccupationCategory()).getName(), createDate, "深圳名邦人力资源管理有限公司", StringUtils.isNullOrEmpty(p.getTricycleFrameNumber()) ? "无" : p.getTricycleFrameNumber(), PlanEnum.getEnum(p.getBenefitBasicPlan(), p.getBenefitOccupationCategory()).getType()};
list.add(arr); list.add(arr);
} }
}); });
...@@ -447,8 +446,8 @@ public class InsureContorll { ...@@ -447,8 +446,8 @@ public class InsureContorll {
InsureUser.builder() InsureUser.builder()
.transId("IS_" + insurePolicy.getOrgCode() + "_" + dtf2.format(now)) .transId("IS_" + insurePolicy.getOrgCode() + "_" + dtf2.format(now))
.insuredName(qyzxEntInfoM.getName()) .insuredName(qyzxEntInfoM.getName())
.price(String.valueOf(InsuranceEnum.getEnum(insureDto.getBenefitBasicPlan(), insureDto.getBenefitOccupationCategory()).getPrice()))/*前端获取的保费*/ .price(String.valueOf(PlanEnum.getEnum(insureDto.getBenefitBasicPlan(), insureDto.getBenefitOccupationCategory()).getPrice()))/*前端获取的保费*/
.premium(String.valueOf(InsuranceEnum.getEnum(insureDto.getBenefitBasicPlan(), insureDto.getBenefitOccupationCategory()).getPrice() * insureDto.getUserIds().length)) .premium(String.valueOf(PlanEnum.getEnum(insureDto.getBenefitBasicPlan(), insureDto.getBenefitOccupationCategory()).getPrice() * insureDto.getUserIds().length))
.batchNo(data.get("import_uuid").toString()) .batchNo(data.get("import_uuid").toString())
.benefitBasicPlan(insureDto.getBenefitBasicPlan()) .benefitBasicPlan(insureDto.getBenefitBasicPlan())
.policyNo(orderImportInfo.get("contract_no").toString()) .policyNo(orderImportInfo.get("contract_no").toString())
...@@ -496,7 +495,7 @@ public class InsureContorll { ...@@ -496,7 +495,7 @@ public class InsureContorll {
List<YgglMainEmp> ygglMainEmpList = ygglMainEmpMapper.selectListByIds(insureDto.getUserIds()); List<YgglMainEmp> ygglMainEmpList = ygglMainEmpMapper.selectListByIds(insureDto.getUserIds());
List list = Lists.newArrayList(); List list = Lists.newArrayList();
for (YgglMainEmp y : ygglMainEmpList) { for (YgglMainEmp y : ygglMainEmpList) {
String[] arr = new String[]{String.valueOf(y.getId()), y.getName(), "身份证", y.getZjNum(), InsuranceEnum.getEnum(insureDto.getBenefitBasicPlan(), insureDto.getBenefitOccupationCategory()).getName(), insureDto.getPolicyDateStart(), "深圳名邦人力资源管理有限公司", StringUtils.isNullOrEmpty(insureDto.getTricycleFrameNumber()) ? "无" : insureDto.getTricycleFrameNumber(), InsuranceEnum.getEnum(insureDto.getBenefitBasicPlan(), insureDto.getBenefitOccupationCategory()).getType()}; String[] arr = new String[]{String.valueOf(y.getId()), y.getName(), "身份证", y.getZjNum(), PlanEnum.getEnum(insureDto.getBenefitBasicPlan(), insureDto.getBenefitOccupationCategory()).getName(), insureDto.getPolicyDateStart(), "深圳名邦人力资源管理有限公司", StringUtils.isNullOrEmpty(insureDto.getTricycleFrameNumber()) ? "无" : insureDto.getTricycleFrameNumber(), PlanEnum.getEnum(insureDto.getBenefitBasicPlan(), insureDto.getBenefitOccupationCategory()).getType()};
list.add(arr); list.add(arr);
} }
String[] rowName = new String[]{"ID", "name", "ID_type", "ID_number", "Scheme_name", "Date_start", "Branch", "Tricycle_frame_number", "benefit_occupation_category"}; String[] rowName = new String[]{"ID", "name", "ID_type", "ID_number", "Scheme_name", "Date_start", "Branch", "Tricycle_frame_number", "benefit_occupation_category"};
...@@ -754,41 +753,41 @@ public class InsureContorll { ...@@ -754,41 +753,41 @@ public class InsureContorll {
switch (plan) { switch (plan) {
case "36968": case "36968":
if (type.equals("63119")) { if (type.equals("63119")) {
return InsuranceEnum.A_30.getPrice(); return PlanEnum.A_30.getPrice();
} else if (type.equals("63120")) { } else if (type.equals("63120")) {
return InsuranceEnum.B_30.getPrice(); return PlanEnum.B_30.getPrice();
} }
break; break;
case "36969": case "36969":
if (type.equals("63119")) { if (type.equals("63119")) {
return InsuranceEnum.A_30.getPrice(); return PlanEnum.A_30.getPrice();
} else if (type.equals("63120")) { } else if (type.equals("63120")) {
return InsuranceEnum.B_50.getPrice(); return PlanEnum.B_50.getPrice();
} else if (type.equals("63121")) { } else if (type.equals("63121")) {
return InsuranceEnum.C_50.getPrice(); return PlanEnum.C_50.getPrice();
} }
break; break;
case "36970": case "36970":
if (type.equals("63119")) { if (type.equals("63119")) {
return InsuranceEnum.A_80.getPrice(); return PlanEnum.A_80.getPrice();
} else if (type.equals("63120")) { } else if (type.equals("63120")) {
return InsuranceEnum.B_80.getPrice(); return PlanEnum.B_80.getPrice();
} else if (type.equals("63121")) { } else if (type.equals("63121")) {
return InsuranceEnum.C_80.getPrice(); return PlanEnum.C_80.getPrice();
} }
break; break;
case "36971": case "36971":
if (type.equals("63119")) { if (type.equals("63119")) {
return InsuranceEnum.A_80_20.getPrice(); return PlanEnum.A_80_20.getPrice();
} else if (type.equals("63120")) { } else if (type.equals("63120")) {
return InsuranceEnum.B_80_20.getPrice(); return PlanEnum.B_80_20.getPrice();
} }
break; break;
case "36972": case "36972":
if (type.equals("63119")) { if (type.equals("63119")) {
return InsuranceEnum.A_100.getPrice(); return PlanEnum.A_100.getPrice();
} else if (type.equals("63120")) { } else if (type.equals("63120")) {
return InsuranceEnum.B_100.getPrice(); return PlanEnum.B_100.getPrice();
} }
break; break;
} }
...@@ -1010,8 +1009,11 @@ public class InsureContorll { ...@@ -1010,8 +1009,11 @@ public class InsureContorll {
} }
break; break;
case "方案名称": case "方案名称":
PlanEnum plan = PlanEnum.getEnumOfName(ExcelUtils.getString(cell).trim());
user.setBenefitBasicPlan(plan.getType());
user.setBenefitOccupationCategory(plan.getCategory());
break; break;
case "有效时间": case "有效期起":
Date start = null; Date start = null;
try { try {
start = dtf3.parse(ExcelUtils.getString(cell)); start = dtf3.parse(ExcelUtils.getString(cell));
...@@ -1028,8 +1030,8 @@ public class InsureContorll { ...@@ -1028,8 +1030,8 @@ public class InsureContorll {
} catch (ParseException e) { } catch (ParseException e) {
e.printStackTrace(); e.printStackTrace();
} }
user.setPolicyDateStart(end); user.setPolicyDateEnd(end);
policy.setPolicyDateStart(end); policy.setPolicyDateEnd(end);
break; break;
case "被保险人姓名": case "被保险人姓名":
user.setInsuredEContact(ExcelUtils.getString(cell)); user.setInsuredEContact(ExcelUtils.getString(cell));
...@@ -1060,9 +1062,10 @@ public class InsureContorll { ...@@ -1060,9 +1062,10 @@ public class InsureContorll {
return ResultUtil.error("企业不存在"); return ResultUtil.error("企业不存在");
} }
user.setOrgCode(company.getId()); user.setOrgCode(company.getId());
policy.setOrgCode(company.getId());
break; break;
case "总保费": case "总保费":
user.setPrice(ExcelUtils.getString(cell)); user.setPrice(Integer.parseInt(ExcelUtils.getString(cell))+"");
break; break;
} }
} }
...@@ -1070,6 +1073,7 @@ public class InsureContorll { ...@@ -1070,6 +1073,7 @@ public class InsureContorll {
} }
InsurePolicy oldPolicy = InsurePolicy.builder().build().selectOne(new QueryWrapper<InsurePolicy>().lambda().eq(InsurePolicy::getPolicyNo, policy.getPolicyNo())); InsurePolicy oldPolicy = InsurePolicy.builder().build().selectOne(new QueryWrapper<InsurePolicy>().lambda().eq(InsurePolicy::getPolicyNo, policy.getPolicyNo()));
if (oldPolicy == null) { if (oldPolicy == null) {
policy.setSchemeName(InsureProduct.builder().id(1).build().selectById().getName());
policy.insert(); policy.insert();
} else { } else {
policy = oldPolicy; policy = oldPolicy;
...@@ -1087,12 +1091,13 @@ public class InsureContorll { ...@@ -1087,12 +1091,13 @@ public class InsureContorll {
ygglMainEmp.setIsInsure(1); ygglMainEmp.setIsInsure(1);
} else { } else {
/*如果不存在员工就创建一名员工*/ /*如果不存在员工就创建一名员工*/
ygglMainEmp.builder().build(); ygglMainEmp=new YgglMainEmp();
ygglMainEmp.setName(insureUser.getInsuredEContact()); ygglMainEmp.setName(insureUser.getInsuredEContact());
ygglMainEmp.setZjType(0); ygglMainEmp.setZjType(0);
ygglMainEmp.setZjNum(insureUser.getInsuredNo()); ygglMainEmp.setZjNum(insureUser.getInsuredNo());
ygglMainEmp.setOrgCode(insureUser.getOrgCode()); ygglMainEmp.setOrgCode(insureUser.getOrgCode());
} }
insureUser.setPolicyId(policy.getId()); insureUser.setPolicyId(policy.getId());
ygglMainEmp.insertOrUpdate(); ygglMainEmp.insertOrUpdate();
insureUser.insert(); insureUser.insert();
......
package cn.timer.api.controller.insure.enums; package cn.timer.api.controller.insure.enums;
import io.swagger.models.auth.In; import cn.timer.api.utils.ExcelUtils;
import lombok.Data;
/** /**
* @Description TODO * @Description TODO
* @Author wgd * @Author wgd
* @Date 2022/3/24 17:20 * @Date 2022/3/24 17:20
*/ */
public enum InsuranceEnum { public enum PlanEnum {
A_30(12,"30万意外/3万医疗/扩展24小时(A类)","A类","36968","63119"), A_30(12,"30万意外/3万医疗/扩展24小时(A类)","A类","36968","63119"),
A_50(15,"50万意外/5万医疗/扩展24小时(A类)","A类","36969","63119"), A_50(15,"50万意外/5万医疗/扩展24小时(A类)","A类","36969","63119"),
A_80(18,"80万意外/10万医疗/扩展24小时(A类)","A类","36970","63119"), A_80(18,"80万意外/10万医疗/扩展24小时(A类)","A类","36970","63119"),
...@@ -27,7 +26,7 @@ public enum InsuranceEnum { ...@@ -27,7 +26,7 @@ public enum InsuranceEnum {
private String plan; private String plan;
private String category; private String category;
InsuranceEnum(Integer price, String name,String type,String plan,String category) { PlanEnum(Integer price, String name, String type, String plan, String category) {
this.price = price; this.price = price;
this.name = name; this.name = name;
this.type=type; this.type=type;
...@@ -75,11 +74,14 @@ public enum InsuranceEnum { ...@@ -75,11 +74,14 @@ public enum InsuranceEnum {
this.category = category; this.category = category;
} }
public static InsuranceEnum getEnum(String plan,String category) { public static PlanEnum getEnum(String plan, String category) {
for(InsuranceEnum v : values()) for(PlanEnum v : values())
if(v.getPlan().equals(plan)&&v.getCategory().equals(category)) return v; if(v.getPlan().equals(plan)&&v.getCategory().equals(category)) return v;
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
public static PlanEnum getEnumOfName(String name){
for(PlanEnum v : values())
if(v.getName().equals(name)) return v;
throw new IllegalArgumentException();
}
} }
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