Commit 1769b9c9 by 翁国栋

运营后台--

增加可投多个方案
parent f43f6e95
...@@ -224,7 +224,7 @@ public class YgglMainEmp extends Model<YgglMainEmp> { ...@@ -224,7 +224,7 @@ public class YgglMainEmp extends Model<YgglMainEmp> {
@ApiModelProperty(value="员工登陆账号(手机号)",example="员工登陆账号(手机号)") @ApiModelProperty(value="员工登陆账号(手机号)",example="员工登陆账号(手机号)")
private String empLoginPhone; private String empLoginPhone;
@ApiModelProperty(value="是否已投保:0否 1是",example="") @ApiModelProperty(value="是否已投保:0否 1是 ",example="")
private int isInsure; private int isInsure;
} }
package cn.timer.api.controller.insure; package cn.timer.api.controller.insure;
import cn.timer.api.bean.insure.CallBack; import cn.timer.api.bean.insure.CallBack;
import cn.timer.api.bean.insure.InsureLog;
import cn.timer.api.bean.insure.InsurePolicy; import cn.timer.api.bean.insure.InsurePolicy;
import cn.timer.api.bean.insure.InsureUser; import cn.timer.api.bean.insure.InsureUser;
import cn.timer.api.bean.yggl.YgglMainEmp; import cn.timer.api.bean.yggl.YgglMainEmp;
...@@ -14,6 +15,7 @@ import io.swagger.annotations.ApiOperation; ...@@ -14,6 +15,7 @@ import io.swagger.annotations.ApiOperation;
import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.codec.digest.DigestUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -36,9 +38,13 @@ import java.util.Map; ...@@ -36,9 +38,13 @@ import java.util.Map;
public class CallBackContorll { public class CallBackContorll {
private static final Logger log = LoggerFactory.getLogger(CallBackContorll.class); private static final Logger log = LoggerFactory.getLogger(CallBackContorll.class);
/*保全测试用*/ /*保全测试用*/
private static String appidq = "1000115041006006938"; @Value("${insure.appidq}")
/*保全测试用*/ private String appidq;
private static String secretq = "6ba1bf4aa0bd14368c95ff0b9934a17b"; @Value("${insure.secretq}")
private String secretq;
@Value("${BASE_API_URL}")
private String base_api_url;
@PostMapping(value = "/insuredCallBack") @PostMapping(value = "/insuredCallBack")
@ApiOperation(value = "6.投保申请回调", httpMethod = "Post", notes = "投保申请回调") @ApiOperation(value = "6.投保申请回调", httpMethod = "Post", notes = "投保申请回调")
...@@ -76,6 +82,8 @@ public class CallBackContorll { ...@@ -76,6 +82,8 @@ public class CallBackContorll {
private Map callBack(HttpServletRequest request, @RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) throws IOException { private Map callBack(HttpServletRequest request, @RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) throws IOException {
Map map = Maps.newHashMap(); Map map = Maps.newHashMap();
map.put("status","error"); map.put("status","error");
int type = 7;
Integer policyId = null;
if(StringUtils.isNullOrEmpty(pid)||StringUtils.isNullOrEmpty(sign)&&StringUtils.isNullOrEmpty(timestamp)){ if(StringUtils.isNullOrEmpty(pid)||StringUtils.isNullOrEmpty(sign)&&StringUtils.isNullOrEmpty(timestamp)){
return map; return map;
} }
...@@ -94,25 +102,31 @@ public class CallBackContorll { ...@@ -94,25 +102,31 @@ public class CallBackContorll {
if(!value.equals(sign)){ if(!value.equals(sign)){
return map; return map;
} }
Map paramsMap = Maps.newHashMap();
paramsMap.put("pid",pid);
paramsMap.put("timestamp",timestamp);
paramsMap.put("sign",sign);
CallBack callBack=JSONObject.parseObject(sb.toString(), CallBack.class); CallBack callBack=JSONObject.parseObject(sb.toString(), CallBack.class);
if(callBack.getStatus().equals("1")) { if(callBack.getStatus().equals("1")) {
log.info("callBack" + JSONObject.toJSONString(callBack)); log.info("callBack" + JSONObject.toJSONString(callBack));
List<InsureUser> list = InsureUser.builder().build().selectList(new QueryWrapper<InsureUser>().lambda().eq(InsureUser::getBatchNo, callBack.getOrder_import_info().getUuid())); List<InsureUser> list = InsureUser.builder().build().selectList(new QueryWrapper<InsureUser>().lambda().eq(InsureUser::getBatchNo, callBack.getOrder_import_info().getUuid()).eq(InsureUser::getInsureStatus,3));
list.forEach(i -> { list.forEach(i -> {
i.setInsureStatus(1); i.setInsureStatus(1);
i.updateById(); i.updateById();
YgglMainEmp.builder().isInsure(1).build().update(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getId, i.getUserId())); YgglMainEmp.builder().isInsure(1).build().update(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getId, i.getUserId()));
}); });
List<InsureUser> oldlist = InsureUser.builder().build().selectList(new QueryWrapper<InsureUser>().lambda().eq(InsureUser::getReplaceTransId, callBack.getOrder_import_info().getUuid())); List<InsureUser> oldlist = InsureUser.builder().build().selectList(new QueryWrapper<InsureUser>().lambda().eq(InsureUser::getReplaceTransId, callBack.getOrder_import_info().getUuid()));
if(oldlist!=null||oldlist.size()>0) { if(oldlist!=null&&oldlist.size()>0) {
oldlist.forEach(i -> { oldlist.forEach(i -> {
i.setInsureStatus(4); i.setInsureStatus(4);
i.setStatus("2"); i.setStatus("2");
i.updateById(); i.updateById();
YgglMainEmp.builder().isInsure(3).build().update(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getId, i.getUserId())); YgglMainEmp.builder().isInsure(0).build().update(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getId, i.getUserId()));
}); });
type=8;
} }
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()));
policyId=insurePolicy.getId();
if(oldlist==null||oldlist.size()==0) { if(oldlist==null||oldlist.size()==0) {
insurePolicy.setTotalPremium(String.valueOf(Double.valueOf(insurePolicy.getTotalPremium()) + Double.valueOf(callBack.getOrder_import_info().getTotal_money()))); insurePolicy.setTotalPremium(String.valueOf(Double.valueOf(insurePolicy.getTotalPremium()) + Double.valueOf(callBack.getOrder_import_info().getTotal_money())));
} }
...@@ -121,9 +135,13 @@ public class CallBackContorll { ...@@ -121,9 +135,13 @@ public class CallBackContorll {
insurePolicy.updateById(); insurePolicy.updateById();
}else{ }else{
//TODO 写入日志 //TODO 写入日志
} }
Map trueMap = Maps.newHashMap(); Map trueMap = Maps.newHashMap();
trueMap.put("status","1"); trueMap.put("status","1");
InsureLog.builder().requestParam(JSONObject.toJSONString(paramsMap)).type(type)
.requestData(sb.toString()).createTime(new Date()).requestType(1).returnBody(JSONObject.toJSONString(callBack)).requestPath(base_api_url+"/callBack/policy/CallBack")
.returnCode(callBack.getStatus()).returnMsg(callBack.getOrder_import_info().getErr_msg()).policyId(policyId).build().insert();
return trueMap; return trueMap;
} }
} }
...@@ -12,6 +12,7 @@ import cn.timer.api.dao.insure.InsurePolicyMapper; ...@@ -12,6 +12,7 @@ import cn.timer.api.dao.insure.InsurePolicyMapper;
import cn.timer.api.dao.insure.InsureUserMapper; import cn.timer.api.dao.insure.InsureUserMapper;
import cn.timer.api.dao.yggl.YgglMainEmpMapper; import cn.timer.api.dao.yggl.YgglMainEmpMapper;
import cn.timer.api.dto.insure.InsureDto; import cn.timer.api.dto.insure.InsureDto;
import cn.timer.api.dto.insure.PlansDto;
import cn.timer.api.dto.insure.PolicyDto; import cn.timer.api.dto.insure.PolicyDto;
import cn.timer.api.utils.*; import cn.timer.api.utils.*;
import com.alibaba.druid.util.Base64; import com.alibaba.druid.util.Base64;
...@@ -128,10 +129,6 @@ public class InsureContorll { ...@@ -128,10 +129,6 @@ public class InsureContorll {
@PostMapping(value = "/insured_add") @PostMapping(value = "/insured_add")
@ApiOperation(value = "1.投保申请", httpMethod = "Post", notes = "投保申请") @ApiOperation(value = "1.投保申请", httpMethod = "Post", notes = "投保申请")
public Result<Object> insured_add(@RequestBody InsureDto insureDto) throws ParseException { public Result<Object> insured_add(@RequestBody InsureDto insureDto) throws ParseException {
InsurePolicy insurePolicy = InsurePolicy.builder().build().selectOne(new QueryWrapper<InsurePolicy>().lambda().eq(InsurePolicy::getOrgCode,insureDto.getOrgCode()).eq(InsurePolicy::getStatus,1));
if(insurePolicy!=null){
return ResultUtil.error("企业已存在");
}
InsureProduct insureProduct = InsureProduct.builder().id(Integer.parseInt(insureDto.getProductId())).build().selectById(); InsureProduct insureProduct = InsureProduct.builder().id(Integer.parseInt(insureDto.getProductId())).build().selectById();
if(insureProduct==null){ if(insureProduct==null){
return ResultUtil.error("产品不存在"); return ResultUtil.error("产品不存在");
...@@ -144,10 +141,10 @@ public class InsureContorll { ...@@ -144,10 +141,10 @@ public class InsureContorll {
ArrayList<Map> quotationsArry = new ArrayList<Map>(); ArrayList<Map> quotationsArry = new ArrayList<Map>();
bodyMap.put("is_ss", 0); bodyMap.put("is_ss", 0);
Map quotations = Maps.newHashMap(); Map quotations = Maps.newHashMap();
Integer price = getPrice(insureDto.getBenefitBasicPlan(),insureDto.getBenefitOccupationCategory()); insureDto.getPlans().forEach(i->{
if(price==0){ i.setPrice(getPrice(i.getBenefitBasicPlan(),i.getBenefitOccupationCategory()));
return ResultUtil.error("报价不存在"); insureDto.setTotalPrice(i.getPrice()*i.getUserIds().length+(insureDto.getTotalPrice()==null?0:insureDto.getTotalPrice()));
} });
quotations.put("trans_id", "MB_" + dtf2.format(now));/*报价请求流水号*/ quotations.put("trans_id", "MB_" + dtf2.format(now));/*报价请求流水号*/
quotations.put("applicant_type", "2");/*投保人类型:2-企业*/ quotations.put("applicant_type", "2");/*投保人类型:2-企业*/
quotations.put("quotation_type", 3);/*报价类型:3-投保申请*/ quotations.put("quotation_type", 3);/*报价类型:3-投保申请*/
...@@ -175,7 +172,7 @@ public class InsureContorll { ...@@ -175,7 +172,7 @@ public class InsureContorll {
companyApplicantMap.put("applicant_e_mail", insureApplicant.getApplicantEMail());/*企业邮箱*/ companyApplicantMap.put("applicant_e_mail", insureApplicant.getApplicantEMail());/*企业邮箱*/
companyApplicantMap.put("applicant_province_city", "21024");/*省市区*/ companyApplicantMap.put("applicant_province_city", "21024");/*省市区*/
/*人员清单填被保人员*/ /*人员清单填被保人员*/
String url = creaXSSFWorkbook(insureDto.getUserIds(),price,insureDto.getPolicyDateStart(),insureDto.getTricycleFrameNumber()); String url = creaXSSFWorkbook(insureDto.getPlans(),insureDto.getPolicyDateStart());
if (!StringUtil.isNotBlank(url)) { if (!StringUtil.isNotBlank(url)) {
return ResultUtil.error("文件错误"); return ResultUtil.error("文件错误");
} }
...@@ -205,9 +202,10 @@ public class InsureContorll { ...@@ -205,9 +202,10 @@ public class InsureContorll {
/*被保人员 填被保企业信息*/ /*被保人员 填被保企业信息*/
ArrayList<Map> insuredArray = new ArrayList<>(); ArrayList<Map> insuredArray = new ArrayList<>();
insureDto.getPlans().forEach(p->{
Map insured = Maps.newHashMap(); Map insured = Maps.newHashMap();
insured.put("trans_id", "PI_" + qyzxEntInfoM.getId() + "_" + dtf2.format(now)); insured.put("trans_id", "PI_" + qyzxEntInfoM.getId() + "_" + dtf2.format(now)+"_"+UUID.randomUUID().toString().replace("-",""));
insured.put("price", insureDto.getUserIds().length * price);/*根据基础计划生成*/ insured.put("price", p.getUserIds().length*p.getPrice());/*根据基础计划生成*/
insured.put("insured_applicant_relations", "36960"); insured.put("insured_applicant_relations", "36960");
insured.put("insured_mobile", insureApplicant.getApplicantEPhone()); insured.put("insured_mobile", insureApplicant.getApplicantEPhone());
insured.put("insured_e_contact", insureApplicant.getApplicantEContacts()); insured.put("insured_e_contact", insureApplicant.getApplicantEContacts());
...@@ -215,15 +213,15 @@ public class InsureContorll { ...@@ -215,15 +213,15 @@ public class InsureContorll {
insured.put("insured_no_type", "3306"); insured.put("insured_no_type", "3306");
insured.put("insured_no", qyzxEntInfoM.getCreditCode()); insured.put("insured_no", qyzxEntInfoM.getCreditCode());
insured.put("insured_zm_openid", ""); insured.put("insured_zm_openid", "");
insured.put("benefit_basic_plan", insureDto.getBenefitBasicPlan());/*基础计划写死*/ insured.put("benefit_basic_plan", p.getBenefitBasicPlan());/*基础计划写死*/
insured.put("benefit_occupation_category", insureDto.getBenefitOccupationCategory()); insured.put("benefit_occupation_category", p.getBenefitOccupationCategory());
insured.put("benefit_EL_employee_number_t", insureDto.getUserIds().length); insured.put("benefit_EL_employee_number_t", p.getUserIds().length);
insuredArray.add(insured); insuredArray.add(insured);
});
quotations.put("insured", insuredArray); quotations.put("insured", insuredArray);
quotations.put("file", Lists.newArrayList()); quotations.put("file", Lists.newArrayList());
quotations.put("specifically_agreed_file", Lists.newArrayList()); quotations.put("specifically_agreed_file", Lists.newArrayList());
quotations.put("policy_no", ""); quotations.put("policy_no", "");
quotations.put("insured", insuredArray);
quotationsArry.add(quotations); quotationsArry.add(quotations);
bodyMap.put("quotations", quotationsArry); bodyMap.put("quotations", quotationsArry);
log.info(JSONObject.toJSONString(bodyMap)); log.info(JSONObject.toJSONString(bodyMap));
...@@ -239,8 +237,7 @@ public class InsureContorll { ...@@ -239,8 +237,7 @@ public class InsureContorll {
policyMap = JSONObject.parseObject(JSONObject.toJSONString(map.get("policy")), Map.class); policyMap = JSONObject.parseObject(JSONObject.toJSONString(map.get("policy")), Map.class);
batchMap = JSONObject.parseObject(JSONObject.toJSONString(policyMap.get("batch")), List.class); batchMap = JSONObject.parseObject(JSONObject.toJSONString(policyMap.get("batch")), List.class);
} }
List<YgglMainEmp> ygglMainEmpList = ygglMainEmpMapper.selectListByIds(insureDto.getUserIds()); InsurePolicy insurePolicy = InsurePolicy.builder().build();
insurePolicy = InsurePolicy.builder().build();
insurePolicy.setPolicyDateStart(dtf3.parse(insureDto.getPolicyDateStart())); insurePolicy.setPolicyDateStart(dtf3.parse(insureDto.getPolicyDateStart()));
insurePolicy.setPolicyDateEnd(dtf3.parse(insureDto.getPolicyDateEnd())); insurePolicy.setPolicyDateEnd(dtf3.parse(insureDto.getPolicyDateEnd()));
if (dataMap.get("errcode").toString().equals("suc")) { if (dataMap.get("errcode").toString().equals("suc")) {
...@@ -259,33 +256,35 @@ public class InsureContorll { ...@@ -259,33 +256,35 @@ public class InsureContorll {
insurePolicy.setCreateTime(date); insurePolicy.setCreateTime(date);
insurePolicy.setUpdateTime(date); insurePolicy.setUpdateTime(date);
insurePolicy.setSchemeName(insureProduct.getName());/*先写死*/ insurePolicy.setSchemeName(insureProduct.getName());/*先写死*/
insurePolicy.setTotalPremium(String.valueOf(insureDto.getUserIds().length * price)); 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), appid, secret))).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()).returnMsg(dataMap.get("errmsg").toString()).policyId(insurePolicy.getId()).fileUrl(url).build().insert(); .returnCode(dataMap.get("errcode").toString()).returnMsg(dataMap.get("errmsg").toString()).policyId(insurePolicy.getId()).fileUrl(url).build().insert();
for (PlansDto p:insureDto.getPlans()) {
List<YgglMainEmp> ygglMainEmpList = ygglMainEmpMapper.selectListByIds(p.getUserIds());
InsureUser insureUser; InsureUser insureUser;
for (YgglMainEmp y : ygglMainEmpList) { for (YgglMainEmp y : ygglMainEmpList) {
insureUser = InsureUser.builder().build(); insureUser = InsureUser.builder().build();
insureUser.setUserId(y.getId()); insureUser.setUserId(y.getId());
insureUser.setInsuredName(qyzxEntInfoM.getName()); insureUser.setInsuredName(qyzxEntInfoM.getName());
insureUser.setPrice(price.toString());/*前端获取的保费*/ insureUser.setPrice(String.valueOf(p.getPrice()*p.getUserIds().length));/*前端获取的保费*/
insureUser.setTransId("P_" + qyzxEntInfoM.getId() + "_" + dtf2.format(now)); insureUser.setTransId("P_" + qyzxEntInfoM.getId() + "_" + dtf2.format(now));
insureUser.setPremium(String.valueOf(ygglMainEmpList.size() * price)); insureUser.setPremium(String.valueOf(insureDto.getTotalPrice()));
if (dataMap.get("errcode").toString().equals("suc")) { if (dataMap.get("errcode").toString().equals("suc")) {
insureUser.setBatchNo(batchMap.get(0).get("batch_no").toString()); insureUser.setBatchNo(batchMap.get(0).get("batch_no").toString());
insureUser.setPolicyNo(policyMap.get("policy_no").toString()); insureUser.setPolicyNo(policyMap.get("policy_no").toString());
} }
insureUser.setBenefitBasicPlan(insureDto.getBenefitBasicPlan()); insureUser.setBenefitBasicPlan(p.getBenefitBasicPlan());
insureUser.setUserId(y.getId()); insureUser.setUserId(y.getId());
insureUser.setOrgCode(y.getOrgCode()); insureUser.setOrgCode(y.getOrgCode());
insureUser.setBenefitOccupationCategory(insureDto.getBenefitOccupationCategory()); insureUser.setBenefitOccupationCategory(p.getBenefitOccupationCategory());
insureUser.setInsuredMobile(y.getPhone()); insureUser.setInsuredMobile(y.getPhone());
insureUser.setInsuredNo(y.getZjNum()); insureUser.setInsuredNo(y.getZjNum());
insureUser.setInsuredEContact(y.getName()); insureUser.setInsuredEContact(y.getName());
insureUser.setApplicantEmployeeList(url); insureUser.setApplicantEmployeeList(url);
insureUser.setTricycleFrameNumber(insureDto.getTricycleFrameNumber()); insureUser.setTricycleFrameNumber(p.getTricycleFrameNumber());
if (dataMap.get("errcode").toString().equals("suc")) { if (dataMap.get("errcode").toString().equals("suc")) {
insureUser.setInsureStatus(1); insureUser.setInsureStatus(1);
insureUser.setStatus("1"); insureUser.setStatus("1");
...@@ -304,6 +303,7 @@ public class InsureContorll { ...@@ -304,6 +303,7 @@ public class InsureContorll {
y.insertOrUpdate(); y.insertOrUpdate();
} }
} }
}
return ResultUtil.success(dataMap.get("errmsg").toString()); return ResultUtil.success(dataMap.get("errmsg").toString());
} }
return ResultUtil.error(dataMap.get("errmsg").toString()); return ResultUtil.error(dataMap.get("errmsg").toString());
...@@ -313,25 +313,26 @@ public class InsureContorll { ...@@ -313,25 +313,26 @@ public class InsureContorll {
} }
/** /**
* 生成投保文件 * 生成投保文件
* *
* @param ids * @param ids
* @return * @return
*/ */
public String creaXSSFWorkbook(String[] ids,Integer price,String createDate,String tricycleFrameNumber ) { public String creaXSSFWorkbook(List<PlansDto> plansList, String createDate) {
if (ids.length <= 0) { if (plansList.size() <= 0) {
return "error"; return "error";
} }
LocalDate localDate = LocalDate.now(); LocalDate localDate = LocalDate.now();
Date date = new Date(); Date date = new Date();
List<YgglMainEmp> ygglMainEmpList = ygglMainEmpMapper.selectListByIds(ids);
List list = Lists.newArrayList(); List list = Lists.newArrayList();
plansList.forEach(p->{
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(price).getName(), createDate.substring(0,10), "深圳名邦人力资源管理有限公司", StringUtils.isNullOrEmpty(tricycleFrameNumber)?"无":tricycleFrameNumber, InsuranceEnum.getEnum(price).getType()}; 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()};
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"};
XSSFWorkbook xssfWorkbook = ExcelUtils.exportExcel(localDate + "_投保" + list.size() + "名人员清单.xlsx", rowName, list); XSSFWorkbook xssfWorkbook = ExcelUtils.exportExcel(localDate + "_投保" + list.size() + "名人员清单.xlsx", rowName, list);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
...@@ -389,10 +390,18 @@ public class InsureContorll { ...@@ -389,10 +390,18 @@ public class InsureContorll {
@GetMapping(value = "/policyDetail") @GetMapping(value = "/policyDetail")
@ApiOperation(value = "5.保单信息", httpMethod = "Get", notes = "保单信息") @ApiOperation(value = "5.保单信息", httpMethod = "Get", notes = "保单信息")
public Result<Object> policyDetail(@RequestParam("policyId") Integer policyId) { public Result<Object> policyDetail(@RequestParam("policyId") Integer policyId) {
// Map map = Maps.newHashMap();
PolicyDto policyDto = insurePolicyMapper.getPolicyDetail(policyId); PolicyDto policyDto = insurePolicyMapper.getPolicyDetail(policyId);
/*获取可选计划*/
// List<InsureUser> plansList = InsureUser.builder().build().selectList(new QueryWrapper<InsureUser>().lambda().eq(InsureUser::getApplyType,2).eq(InsureUser::getPolicyId,policyId).groupBy(InsureUser::getBenefitBasicPlan));
/*获取可选类型*/
// List<InsureUser> categoryList = InsureUser.builder().build().selectList(new QueryWrapper<InsureUser>().lambda().eq(InsureUser::getApplyType,2).eq(InsureUser::getPolicyId,policyId).groupBy(InsureUser::getBenefitOccupationCategory));
if (policyDto == null) { if (policyDto == null) {
return ResultUtil.error("保单不存在"); return ResultUtil.error("保单不存在");
} }
// map.put("policy",policyDto);
// map.put("plans",plansList.stream().map(InsureUser::getBenefitBasicPlan).toArray());
// map.put("category",categoryList.stream().map(InsureUser::getBenefitOccupationCategory).toArray());
return ResultUtil.data(policyDto); return ResultUtil.data(policyDto);
} }
...@@ -406,7 +415,7 @@ public class InsureContorll { ...@@ -406,7 +415,7 @@ public class InsureContorll {
} }
Integer price = getPrice(insureDto.getBenefitBasicPlan(),insureDto.getBenefitOccupationCategory()); Integer price = getPrice(insureDto.getBenefitBasicPlan(),insureDto.getBenefitOccupationCategory());
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
String url = creaXSSFWorkbook1(insureDto.getUserIds(), insureDto.getPolicyDateStart(),price,insureDto.getTricycleFrameNumber()); String url = creaXSSFWorkbook1(insureDto);
log.info("保全增员文件地址", url); log.info("保全增员文件地址", url);
DateTimeFormatter dtf2 = DateTimeFormatter.ofPattern("yyyyMMddHHmmss"); DateTimeFormatter dtf2 = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
Map bodyMap = Maps.newHashMap(); Map bodyMap = Maps.newHashMap();
...@@ -420,15 +429,14 @@ public class InsureContorll { ...@@ -420,15 +429,14 @@ public class InsureContorll {
bodyMap.put("third_uuid", "IS_" + insurePolicy.getOrgCode() + "_" + dtf2.format(now)); bodyMap.put("third_uuid", "IS_" + 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), appidq, secretq), bodyMap);
Map<String, Object> dataMap = JSONObject.parseObject(responData); Map<String, Object> dataMap = JSONObject.parseObject(responData);
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appid, secret))).type(2)
.requestData(JSONObject.toJSONString(bodyMap)).createTime(new Date()).requestType(1).returnBody(responData).requestPath(batchUrl)
.returnCode(dataMap.get("errcode").toString()).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")) {
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")) {
//TODO 写入日志 InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appid, secret))).type(2)
.requestData(JSONObject.toJSONString(bodyMap)).createTime(new Date()).requestType(1).returnBody(responData).requestPath(batchUrl)
.returnCode(dataMap.get("errcode").toString()).returnMsg(dataMap.get("errmsg").toString()).policyId(insurePolicy.getId()).fileUrl(data.get("file_url").toString()).build().insert();
return ResultUtil.error("信息填写错误,请查看日志"); return ResultUtil.error("信息填写错误,请查看日志");
} else { } else {
List<YgglMainEmp> ygglMainEmpList = ygglMainEmpMapper.selectListByIds(insureDto.getUserIds()); List<YgglMainEmp> ygglMainEmpList = ygglMainEmpMapper.selectListByIds(insureDto.getUserIds());
...@@ -438,14 +446,13 @@ public class InsureContorll { ...@@ -438,14 +446,13 @@ 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(price.toString())/*前端获取的保费*/ .price(String.valueOf(InsuranceEnum.getEnum(insureDto.getBenefitBasicPlan(),insureDto.getBenefitOccupationCategory()).getPrice()*insureDto.getUserIds().length))/*前端获取的保费*/
.premium(String.valueOf(price * ygglMainEmpList.size())) .premium(String.valueOf(insureDto.getTotalPrice()))
.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())
.userId(y.getId()) .userId(y.getId())
.orgCode(y.getOrgCode()) .orgCode(y.getOrgCode())
.benefitOccupationCategory(insureDto.getBenefitOccupationCategory())
.insuredMobile(y.getPhone()) .insuredMobile(y.getPhone())
.benefitOccupationCategory(insureDto.getBenefitOccupationCategory()) .benefitOccupationCategory(insureDto.getBenefitOccupationCategory())
.insuredNo(y.getZjNum()) .insuredNo(y.getZjNum())
...@@ -455,17 +462,23 @@ public class InsureContorll { ...@@ -455,17 +462,23 @@ public class InsureContorll {
.applicantEmployeeList(data.get("file_url").toString()) .applicantEmployeeList(data.get("file_url").toString())
.policyDateStart(dtf3.parse(insureDto.getPolicyDateStart())) .policyDateStart(dtf3.parse(insureDto.getPolicyDateStart()))
.policyDateEnd(dtf3.parse(insureDto.getPolicyDateEnd())) .policyDateEnd(dtf3.parse(insureDto.getPolicyDateEnd()))
.status("1").insureStatus(3).policyId(insurePolicy.getId()).build().insert(); .insureStatus(3).policyId(insurePolicy.getId()).build().insert();
} catch (ParseException e) { } catch (ParseException e) {
e.printStackTrace(); e.printStackTrace();
} }
y.setIsInsure(2); y.setIsInsure(1);
y.insertOrUpdate(); y.insertOrUpdate();
}); });
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appid, secret))).type(2)
.requestData(JSONObject.toJSONString(bodyMap)).createTime(new Date()).requestType(1).returnBody(responData).requestPath(batchUrl)
.returnCode(dataMap.get("errcode").toString()).returnMsg(dataMap.get("errmsg").toString()).policyId(insurePolicy.getId()).fileUrl(url).build().insert();
return ResultUtil.data("核保成功,等待系统更新"); return ResultUtil.data("核保成功,等待系统更新");
} }
} }
return ResultUtil.error(dataMap.get("请求异常")); InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appid, secret))).type(2)
.requestData(JSONObject.toJSONString(bodyMap)).createTime(new Date()).requestType(1).returnBody(responData).requestPath(batchUrl)
.returnCode(dataMap.get("errcode").toString()).returnMsg(dataMap.get("errmsg").toString()).policyId(insurePolicy.getId()).build().insert();
return ResultUtil.error(dataMap.get("errmsg").toString());
} }
/** /**
...@@ -474,15 +487,15 @@ public class InsureContorll { ...@@ -474,15 +487,15 @@ public class InsureContorll {
* @param ids * @param ids
* @return * @return
*/ */
public String creaXSSFWorkbook1(String[] ids, String date,Integer price,String tricycleFrameNumber) { public String creaXSSFWorkbook1(InsureDto insureDto) {
if (ids.length <= 0) { if (insureDto.getUserIds().length <= 0) {
return "error"; return "error";
} }
LocalDate localDate = LocalDate.now(); LocalDate localDate = LocalDate.now();
List<YgglMainEmp> ygglMainEmpList = ygglMainEmpMapper.selectListByIds(ids); 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(price).getName(), date, "深圳名邦人力资源管理有限公司", StringUtils.isNullOrEmpty(tricycleFrameNumber)?"无":tricycleFrameNumber, InsuranceEnum.getEnum(price).getType()}; 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()};
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"};
...@@ -634,7 +647,7 @@ public class InsureContorll { ...@@ -634,7 +647,7 @@ public class InsureContorll {
} catch (ParseException e) { } catch (ParseException e) {
e.printStackTrace(); e.printStackTrace();
} }
y.setIsInsure(2); y.setIsInsure(1);
y.insertOrUpdate(); y.insertOrUpdate();
}); });
oldInsureUserList.forEach(o->{ oldInsureUserList.forEach(o->{
...@@ -735,41 +748,41 @@ public class InsureContorll { ...@@ -735,41 +748,41 @@ public class InsureContorll {
switch (plan){ switch (plan){
case "36968": case "36968":
if(type.equals("63119")){ if(type.equals("63119")){
return 12; return InsuranceEnum.A_30.getPrice();
}else if(type.equals("63120")){ }else if(type.equals("63120")){
return 18; return InsuranceEnum.B_30.getPrice();
} }
break; break;
case"36969": case"36969":
if(type.equals("63119")){ if(type.equals("63119")){
return 15; return InsuranceEnum.A_30.getPrice();
}else if(type.equals("63120")){ }else if(type.equals("63120")){
return 20; return InsuranceEnum.B_50.getPrice();
}else if(type.equals("63121")){ }else if(type.equals("63121")){
return 60; return InsuranceEnum.C_50.getPrice();
} }
break; break;
case "36970": case "36970":
if(type.equals("63119")){ if(type.equals("63119")){
return 18; return InsuranceEnum.A_80.getPrice();
}else if(type.equals("63120")){ }else if(type.equals("63120")){
return 35; return InsuranceEnum.B_80.getPrice();
}else if(type.equals("63121")){ }else if(type.equals("63121")){
return 75; return InsuranceEnum.C_80.getPrice();
} }
break; break;
case "36971": case "36971":
if(type.equals("63119")){ if(type.equals("63119")){
return 25; return InsuranceEnum.A_80_20.getPrice();
}else if(type.equals("63120")){ }else if(type.equals("63120")){
return 38; return InsuranceEnum.B_80_20.getPrice();
} }
break; break;
case "36972": case "36972":
if(type.equals("63119")){ if(type.equals("63119")){
return 28; return InsuranceEnum.A_100.getPrice();
}else if(type.equals("63120")){ }else if(type.equals("63120")){
return 40; return InsuranceEnum.B_100.getPrice();
} }
break; break;
} }
...@@ -795,6 +808,7 @@ public class InsureContorll { ...@@ -795,6 +808,7 @@ public class InsureContorll {
@GetMapping(value = "/verification") @GetMapping(value = "/verification")
@ApiOperation(value = "一键校验", httpMethod = "Post", notes = "一键校验") @ApiOperation(value = "一键校验", httpMethod = "Post", notes = "一键校验")
public Result<Object> verification() { public Result<Object> verification() {
/*校验投保*/
List<InsurePolicy> insurePolicies = InsurePolicy.builder().build().selectList(new QueryWrapper<InsurePolicy>().lambda().eq(InsurePolicy::getStatus,2)); List<InsurePolicy> insurePolicies = InsurePolicy.builder().build().selectList(new QueryWrapper<InsurePolicy>().lambda().eq(InsurePolicy::getStatus,2));
insurePolicies.forEach(i->{ insurePolicies.forEach(i->{
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));
...@@ -802,6 +816,9 @@ public class InsureContorll { ...@@ -802,6 +816,9 @@ public class InsureContorll {
String data = HttpUtils.sendPost(insuredUrl, setParams(JSONObject.toJSONString(bodyMap), appid, secret),bodyMap ); String data = HttpUtils.sendPost(insuredUrl, setParams(JSONObject.toJSONString(bodyMap), appid, secret),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)
.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) { if (dataMap != null) {
if ((dataMap.get("errcode").toString().equals("suc"))) { if ((dataMap.get("errcode").toString().equals("suc"))) {
Map<String, Object> map = JSONObject.parseObject(JSONObject.toJSONString(dataMap.get("data"))); Map<String, Object> map = JSONObject.parseObject(JSONObject.toJSONString(dataMap.get("data")));
...@@ -823,15 +840,12 @@ public class InsureContorll { ...@@ -823,15 +840,12 @@ public class InsureContorll {
user.updateById(); user.updateById();
YgglMainEmp.builder().isInsure(1).build().update(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getId, user.getUserId())); YgglMainEmp.builder().isInsure(1).build().update(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getId, user.getUserId()));
}); });
List<Map> quotationsMap = JSONObject.parseObject(JSONObject.toJSONString(bodyMap.get("quotations")), List.class);
Map companyApplicantMap = JSONObject.parseObject(JSONObject.toJSONString(quotationsMap.get(0).get("company_applicant")), Map.class);
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(i.getId()).fileUrl(companyApplicantMap.get("applicant_employee_list").toString()).build().insert();
} }
} }
}); });
/*校验人员*/
return ResultUtil.success(); return ResultUtil.success();
}; };
} }
...@@ -3,12 +3,15 @@ package cn.timer.api.controller.insure; ...@@ -3,12 +3,15 @@ package cn.timer.api.controller.insure;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Collectors;
import cn.timer.api.bean.insure.InsurePolicy; import cn.timer.api.bean.insure.InsurePolicy;
import cn.timer.api.bean.insure.InsureUser; import cn.timer.api.bean.insure.InsureUser;
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.dao.insure.InsureUserMapper; import cn.timer.api.dao.insure.InsureUserMapper;
import cn.timer.api.dto.insure.InsureDto;
import cn.timer.api.dto.insure.InsureUserDto;
import cn.timer.api.dto.insure.PolicyDto; import cn.timer.api.dto.insure.PolicyDto;
import cn.timer.api.utils.Page; import cn.timer.api.utils.Page;
import cn.timer.api.utils.Result; import cn.timer.api.utils.Result;
...@@ -69,5 +72,23 @@ public class InsureUserController{ ...@@ -69,5 +72,23 @@ public class InsureUserController{
map.put("total", insureUserMapper.totalUser(policyDto)); map.put("total", insureUserMapper.totalUser(policyDto));
return ResultUtil.data(map); return ResultUtil.data(map);
} }
@PostMapping(value = "/getPolicyUserList")
@ApiOperation(value = "获取选中用户方案信息", httpMethod = "Post", notes = "获取选中用户方案信息")
public Result<Object> getPolicyUserList(@RequestBody InsureDto dto){
List<InsureUserDto> userList= insureUserMapper.selectPlansListByIds(dto.getOldIds());
if(userList.size()<=0){
return ResultUtil.error("用户方案错误");
}
return ResultUtil.data(userList);
}
@GetMapping(value = "/getPolicyPlansList")
@ApiOperation(value = "获取方案列表", httpMethod = "Get", notes = "获取选中用户方案信息")
public Result<Object> getPolicyUserList(@RequestParam("policyId") String policyId){
List<InsureUserDto> userList= insureUserMapper.selectPlansListById(policyId);
if(userList.size()<=0){
return ResultUtil.error("用户方案错误");
}
return ResultUtil.data(userList);
}
} }
...@@ -9,26 +9,30 @@ import lombok.Data; ...@@ -9,26 +9,30 @@ import lombok.Data;
* @Date 2022/3/24 17:20 * @Date 2022/3/24 17:20
*/ */
public enum InsuranceEnum { public enum InsuranceEnum {
A_30(12,"30万意外/3万医疗/扩展24小时(A类)","A类"), A_30(12,"30万意外/3万医疗/扩展24小时(A类)","A类","36968","63119"),
A_50(15,"50万意外/5万医疗/扩展24小时(A类)","A类"), A_50(15,"50万意外/5万医疗/扩展24小时(A类)","A类","36969","63119"),
A_80(18,"80万意外/10万医疗/扩展24小时(A类)","A类"), A_80(18,"80万意外/10万医疗/扩展24小时(A类)","A类","36970","63119"),
A_80_20(25,"80万意外/20万医疗/扩展24小时(A类)","A类"), A_80_20(25,"80万意外/20万医疗/扩展24小时(A类)","A类","36971","63119"),
A_100(28,"100万意外/10万医疗/扩展24小时(A类)","A类"), A_100(28,"100万意外/10万医疗/扩展24小时(A类)","A类","36972","63119"),
B_30(18,"30万意外/3万医疗/扩展24小时(B类)","B类"), B_30(18,"30万意外/3万医疗/扩展24小时(B类)","B类","36968","63120"),
B_50(20,"50万意外/5万医疗/扩展24小时(B类)","B类"), B_50(20,"50万意外/5万医疗/扩展24小时(B类)","B类","36969","63120"),
B_80(35,"80万意外/10万医疗/扩展24小时(B类)","B类"), B_80(35,"80万意外/10万医疗/扩展24小时(B类)","B类","36970","63120"),
B_80_20(38,"80万意外/20万医疗/扩展24小时(B类)","B类"), B_80_20(38,"80万意外/20万医疗/扩展24小时(B类)","B类","36971","63120"),
B_100(40,"100万意外/10万医疗/扩展24小时(B类)","B类"), B_100(40,"100万意外/10万医疗/扩展24小时(B类)","B类","36972","63120"),
C_50(60,"50万意外/5万医疗/扩展24小时(C类)","C类"), C_50(60,"50万意外/5万医疗/扩展24小时(C类)","C类","36969","63121"),
C_80(75,"80万意外/10万医疗/扩展24小时(C类)","C类"); C_80(75,"80万意外/10万医疗/扩展24小时(C类)","C类","36970","63121");
private Integer price; private Integer price;
private String name; private String name;
private String type; private String type;
private String plan;
private String category;
InsuranceEnum(Integer price, String name,String type) { InsuranceEnum(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;
this.plan=plan;
this.category=category;
} }
public Integer getPrice() { public Integer getPrice() {
...@@ -55,10 +59,27 @@ public enum InsuranceEnum { ...@@ -55,10 +59,27 @@ public enum InsuranceEnum {
this.type = type; this.type = type;
} }
public static InsuranceEnum getEnum(Integer value) { public String getPlan() {
return plan;
}
public void setPlan(String plan) {
this.plan = plan;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public static InsuranceEnum getEnum(String plan,String category) {
for(InsuranceEnum v : values()) for(InsuranceEnum v : values())
if(v.price==value) return v; if(v.getPlan().equals(plan)&&v.getCategory().equals(category)) return v;
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
} }
...@@ -2,6 +2,7 @@ package cn.timer.api.dao.insure; ...@@ -2,6 +2,7 @@ package cn.timer.api.dao.insure;
import cn.timer.api.bean.insure.InsureUser; import cn.timer.api.bean.insure.InsureUser;
import cn.timer.api.bean.yggl.YgglMainEmp; import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.dto.insure.InsureUserDto;
import cn.timer.api.dto.insure.PolicyDto; import cn.timer.api.dto.insure.PolicyDto;
import cn.timer.api.utils.Page; import cn.timer.api.utils.Page;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
...@@ -22,5 +23,8 @@ public interface InsureUserMapper extends BaseMapper<InsureUser> { ...@@ -22,5 +23,8 @@ public interface InsureUserMapper extends BaseMapper<InsureUser> {
List<PolicyDto> selectPolicyList(@Param("policyDto") PolicyDto policyDto ); List<PolicyDto> selectPolicyList(@Param("policyDto") PolicyDto policyDto );
Integer totalUser(@Param("policyDto") PolicyDto policyDto); Integer totalUser(@Param("policyDto") PolicyDto policyDto);
List<InsureUser> selectListByIds(@Param("array")String[] ids); List<InsureUser> selectListByIds(@Param("array")String[] ids);
List<InsureUserDto> selectPlansListByIds(@Param("array")String[] ids);
List<InsureUserDto> selectPlansListById(@Param("policyId")String id);
} }
...@@ -5,6 +5,8 @@ import lombok.Builder; ...@@ -5,6 +5,8 @@ import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.util.List;
/** /**
* @Description TODO * @Description TODO
...@@ -19,14 +21,17 @@ public class InsureDto { ...@@ -19,14 +21,17 @@ public class InsureDto {
private String id; private String id;
private String orgCode;/*劳动合同*/ private String orgCode;/*劳动合同*/
private String companyName;/*用工单位实际工作单位*/ private String companyName;/*用工单位实际工作单位*/
private String[] userIds;
private String policyDateStart; private String policyDateStart;
private String policyDateEnd; private String policyDateEnd;
private Integer type;/*类型 1是新增 3是替换*/
private String productId;
private List<PlansDto> plans;
private String benefitBasicPlan;/*方案名称*/ private String benefitBasicPlan;/*方案名称*/
private String benefitOccupationCategory; private String benefitOccupationCategory;
private String tricycleFrameNumber; private String tricycleFrameNumber;
private Integer type;/*类型 1是新增 3是替换*/
private String[] oldIds; private String[] oldIds;
private String productId; private String[] userIds;
private Double totalPrice;
// private String // private String
} }
package cn.timer.api.dto.insure;
import lombok.Data;
/**
* @Description TODO
* @Author wgd
* @Date 2022/4/7 17:13
*/
@Data
public class InsureUserDto {
private Integer policyId;
private String benefitBasicPlan;
private String benefitOccupationCategory;
private Integer totalUser;
private String[] oldIds;
}
package cn.timer.api.dto.insure;
import lombok.Data;
/**
* @Description TODO
* @Author wgd
* @Date 2022/4/6 9:14
*/
@Data
public class PlansDto{
private int index;
private String[] userIds;
private String benefitBasicPlan;/*方案名称*/
private String benefitOccupationCategory;
private String tricycleFrameNumber;
private Integer price;
}
...@@ -37,4 +37,7 @@ public class PolicyDto { ...@@ -37,4 +37,7 @@ public class PolicyDto {
private String benefitOccupationCategory; private String benefitOccupationCategory;
private Integer userId; private Integer userId;
private Integer insureStatus; private Integer insureStatus;
private String planId;
private String categoryId;
} }
...@@ -172,7 +172,7 @@ ...@@ -172,7 +172,7 @@
</delete> </delete>
<select id="selectListById" resultType="cn.timer.api.bean.insure.InsureLog"> <select id="selectListById" resultType="cn.timer.api.bean.insure.InsureLog">
select id,return_msg,`type`,create_time from insure_log select id,return_msg,`type`,create_time,file_url from insure_log
where policy_id = #{policyId} where policy_id = #{policyId}
ORDER BY create_time DESC ORDER BY create_time DESC
</select> </select>
......
...@@ -323,4 +323,5 @@ ...@@ -323,4 +323,5 @@
GROUP BY GROUP BY
ip.id ip.id
</select> </select>
</mapper> </mapper>
...@@ -279,12 +279,14 @@ ...@@ -279,12 +279,14 @@
<select id="selectPolicyList" resultType="cn.timer.api.dto.insure.PolicyDto"> <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,iu.insure_status, 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.policy_date_end,ip.create_time,iu.insured_name,iu.benefit_basic_plan AS benefitBasicPlan,iu.price AS price,
iu.user_id as userId iu.user_id as userId,iu.batch_no as batchNo,iu.benefit_occupation_category as benefitOccupationCategory
from insure_user iu from insure_user iu
LEFT JOIN yggl_main_emp yme on yme.id=iu.user_id LEFT JOIN yggl_main_emp yme on yme.id=iu.user_id
LEFT JOIN insure_policy ip on ip.id=iu.policy_id LEFT JOIN insure_policy ip on ip.id=iu.policy_id
<where> <where>
ip.id=#{policyDto.id} ip.id=#{policyDto.id}
and iu.benefit_basic_plan = #{policyDto.planId}
and iu.benefit_occupation_category = #{policyDto.categoryId}
<if test="policyDto.name !=null and policyDto.name !=''"> <if test="policyDto.name !=null and policyDto.name !=''">
and iu.insured_e_contact like CONCAT('%',#{policyDto.name},'%') and iu.insured_e_contact like CONCAT('%',#{policyDto.name},'%')
</if> </if>
...@@ -314,6 +316,8 @@ ...@@ -314,6 +316,8 @@
<if test="policyDto.policyDateStart !=null and policyDto.policyDateStart !=''"> <if test="policyDto.policyDateStart !=null and policyDto.policyDateStart !=''">
and iu.policy_date_start <![CDATA[>=]]> #{policyDto.policyDateStart} and iu.policy_date_start <![CDATA[>=]]> #{policyDto.policyDateStart}
</if> </if>
and iu.benefit_basic_plan = #{policyDto.planId}
and iu.benefit_occupation_category = #{policyDto.categoryId}
</where> </where>
</select> </select>
...@@ -328,4 +332,29 @@ ...@@ -328,4 +332,29 @@
</foreach> </foreach>
</select> </select>
<!--根据id数组查询员工-->
<select id="selectPlansListByIds" resultType="cn.timer.api.dto.insure.InsureUserDto">
SELECT
policy_id as policyId,
benefit_basic_plan as benefitBasicPlan,
benefit_occupation_category as benefitOccupationCategory,
count(id) as totalUser
FROM insure_user
WHERE id IN
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
group by benefit_basic_plan,benefit_occupation_category
</select>
<select id="selectPlansListById" resultType="cn.timer.api.dto.insure.InsureUserDto">
SELECT
policy_id as policyId,
benefit_basic_plan as benefitBasicPlan,
benefit_occupation_category as benefitOccupationCategory,
count(id) as totalUser
FROM insure_user
WHERE policy_id = #{policyId}
group by benefit_basic_plan,benefit_occupation_category
</select>
</mapper> </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