Commit e6edd17c by 翁国栋

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

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