Commit 13796aaa authored by huyuchen's avatar huyuchen

huych-商险自动化逻辑调整

parent 744ee557
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TEmployeeInsurancePre;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsurancePreDetail;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
......@@ -129,6 +130,10 @@ public class EmployeeRegistrationPre extends BaseEntity {
@TableField(exist = false)
private TEmployeeContractPre employeeContractPre;
@Schema(description = "商险流程中信息集合")
@TableField(exist = false)
private List<TInsurancePreDetail> exitInsuranceInfoList;
@Schema(description = "附件集合")
@TableField(exist = false)
private List<TAttaInfo> attaList;
......
......@@ -2,6 +2,7 @@ package com.yifu.cloud.plus.v1.yifu.archives.vo;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsurancePreDetail;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.TEmployeeInsurancePreVo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
......@@ -125,10 +126,17 @@ public class EmployeeRegistrationPreVo implements Serializable {
@Schema(description = "商险待派单信息集合")
private List<TEmployeeInsurancePreVo> employeeInsurancePreVos;
@Schema(description = "商险流程中信息集合")
private List<TInsurancePreDetail> exitInsuranceInfoList;
@Schema(description = "合同待派单信息")
private TEmployeeContractPreVo employeeContractPreVos;
@Schema(description = "附件集合")
private List<TAttaInfoSaveVo> attaList;
@TableField(exist = false)
@Schema(description = "修改类型:1新增;2修改;3删除;4状态346为不可编辑")
private String modelType;
}
......@@ -336,15 +336,6 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
Map<String, TEmployeeInsurancePre> oldMap = new HashMap<>();
if (Common.isNotNull(preExit)) {
if (Common.isNotNull(preVo.getServerItem()) && preVo.getServerItem().contains("商险")) {
List<TEmployeeInsurancePreVo> newList = preVo.getEmployeeInsurancePreVos();
String newKey;
Map<String,String> map = new HashMap<>();
if (null != newList && !newList.isEmpty()) {
for (TEmployeeInsurancePreVo preVo1 : newList) {
newKey = this.getPreFiveKey(preVo1);
map.put(newKey,"1");
}
}
// 查原商险,来对比
R<EmployeePreLogListVo> sdr = HttpDaprUtil.invokeMethodPost(daprInsurancesProperties.getAppUrl(), daprInsurancesProperties.getAppId()
, "/temployeeinsurancepre/inner/getListByEmpPreId", preExit.getId(), EmployeePreLogListVo.class, SecurityConstants.FROM_IN);
......@@ -352,11 +343,39 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
if (sdr != null && sdr.getData() != null && sdr.getData().getPreList() != null && !sdr.getData().getPreList().isEmpty()) {
oldList = sdr.getData().getPreList();
}
if (null != oldList && !oldList.isEmpty()) {
for (TEmployeeInsurancePre oldInsurance : oldList) {
// 1:判断是否变更 商险待办 的项目
if (null != map.get(this.getPreOldFiveKey(oldInsurance))) {
oldMap.put(oldInsurance.getId(), oldInsurance);
//商险是否购买为否时增加校验
if (Common.isNotNull(preVo.getInsuranceIsBuy())
&& preVo.getInsuranceIsBuy().equals(CommonConstants.ZERO_STRING)
&& !preVo.getExitInsuranceInfoList().isEmpty()) {
List<TEmployeeInsurancePre> newList = new ArrayList<>();
if (oldList != null && !oldList.isEmpty()) {
//如果状态为0待确认,1待派单,2派单失败,5投保退回则清空数据,记录日志
for (TEmployeeInsurancePre insurancePre : oldList) {
if (CommonConstants.insuranceAutoProcessStatus.contains(insurancePre.getProcessStatus())) {
insurancePre.setModelType(CommonConstants.THREE_STRING);
newList.add(insurancePre);
}
}
pre.setInsurancePreList(newList);
}
} else {
List<TEmployeeInsurancePreVo> newList = preVo.getEmployeeInsurancePreVos();
String newKey;
Map<String, String> map = new HashMap<>();
if (null != newList && !newList.isEmpty()) {
for (TEmployeeInsurancePreVo preVo1 : newList) {
newKey = this.getPreFiveKey(preVo1);
map.put(newKey, "1");
}
}
if (null != oldList && !oldList.isEmpty()) {
for (TEmployeeInsurancePre oldInsurance : oldList) {
// 1:判断是否变更 商险待办 的项目
if (null != map.get(this.getPreOldFiveKey(oldInsurance))) {
oldInsurance.setModelType(CommonConstants.ONE_STRING);
oldMap.put(oldInsurance.getId(), oldInsurance);
}
}
}
}
......@@ -551,116 +570,139 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
// 1:存在商险,判断合规性+日期+五个不同等:
if (Common.isNotNull(employeeRegistrationPre.getServerItem()) && employeeRegistrationPre.getServerItem().contains("商险")) {
if (employeeRegistrationPre.getInsurancePreList() == null
|| employeeRegistrationPre.getInsurancePreList().isEmpty()) {
return R.failed("含商险服务,商险配置不可为空");
}
List<TEmployeeInsurancePre> newList = employeeRegistrationPre.getInsurancePreList();
// 1:合规性:查找信息是否允许:
List<TEmployeeInsuranceExitCheckVo> errorList = new ArrayList<>();
TEmployeeInsuranceExitCheckVo checkVo;
Map<String, TEmployeeInsurancePre> newMap = new HashMap<>();
// 新的KeyMap,存项目
Map<String, String> newKeyDeptNoMap = new HashMap<>();
// 判断重复性MAP
Map<String, Integer> keyMap = new HashMap<>();
String key;
String newDeptNo;
TEmployeeInsurancePreVo preVo;
for (TEmployeeInsurancePre insurancePreVo : newList) {
if (Common.isNotNull(insurancePreVo.getId())) {
newMap.put(insurancePreVo.getId(), insurancePreVo);
}
// 初始化信息
initInsurancePreInfo(employeeRegistrationPre, insurancePreVo, user, id);
// 1:重复性判断
key = this.getFiveKey(insurancePreVo);
newDeptNo = insurancePreVo.getDeptNo();
if (Common.isEmpty(newDeptNo)) {
return R.failed("请传项目编码");
//商险是否购买为否时增加校验
if (Common.isNotNull(employeeRegistrationPre.getInsuranceIsBuy())
&& employeeRegistrationPre.getInsuranceIsBuy().equals(CommonConstants.ZERO_STRING)
&& !employeeRegistrationPre.getExitInsuranceInfoList().isEmpty()) {
//判断带出的流程中或者已完结的商险数据是否准确
//商险是否存在判断
boolean isTrue = checkInsuranceIsProcess(employeeRegistrationPre);
if (isTrue) {
return R.failed("带出的商险已购买数据状态或条数发生变更,请重新确认!");
}
newKeyDeptNoMap.put(key, insurancePreVo.getDeptNo());
if (keyMap.get(key) == null) {
if (Common.isEmpty(insurancePreVo.getModelType()) || !insurancePreVo.getModelType().equals(CommonConstants.THREE_STRING)) {
keyMap.put(key, CommonConstants.ONE_INT);
List<TEmployeeInsurancePre> newList = new ArrayList<>();
if (oldList != null && !oldList.isEmpty()) {
//如果状态为0待确认,1待派单,2派单失败,5投保退回则清空数据,记录日志
for (TEmployeeInsurancePre insurancePre : oldList) {
if (CommonConstants.insuranceAutoProcessStatus.contains(insurancePre.getProcessStatus())) {
insurancePre.setModelType(CommonConstants.THREE_STRING);
newList.add(insurancePre);
}
}
} else if (Common.isEmpty(insurancePreVo.getModelType()) || !insurancePreVo.getModelType().equals(CommonConstants.THREE_STRING)) {
return R.failed("保险公司、险种、购买标准、保单起、止日期不可同时重复!");
employeeRegistrationPre.setInsurancePreList(newList);
}
} else {
if (employeeRegistrationPre.getInsurancePreList() == null
|| employeeRegistrationPre.getInsurancePreList().isEmpty()) {
return R.failed("含商险服务,商险配置不可为空");
}
List<TEmployeeInsurancePre> newList = employeeRegistrationPre.getInsurancePreList();
// 1:合规性:查找信息是否允许:
List<TEmployeeInsuranceExitCheckVo> errorList = new ArrayList<>();
TEmployeeInsuranceExitCheckVo checkVo;
Map<String, TEmployeeInsurancePre> newMap = new HashMap<>();
// 新的KeyMap,存项目
Map<String, String> newKeyDeptNoMap = new HashMap<>();
// 判断重复性MAP
Map<String, Integer> keyMap = new HashMap<>();
String key;
String newDeptNo;
TEmployeeInsurancePreVo preVo;
for (TEmployeeInsurancePre insurancePreVo : newList) {
if (Common.isNotNull(insurancePreVo.getId())) {
newMap.put(insurancePreVo.getId(), insurancePreVo);
}
// 初始化信息
initInsurancePreInfo(employeeRegistrationPre, insurancePreVo, user, id);
// 1:重复性判断
key = this.getFiveKey(insurancePreVo);
newDeptNo = insurancePreVo.getDeptNo();
if (Common.isEmpty(newDeptNo)) {
return R.failed("请传项目编码");
}
newKeyDeptNoMap.put(key, insurancePreVo.getDeptNo());
if (keyMap.get(key) == null) {
if (Common.isEmpty(insurancePreVo.getModelType()) || !insurancePreVo.getModelType().equals(CommonConstants.THREE_STRING)) {
keyMap.put(key, CommonConstants.ONE_INT);
}
} else if (Common.isEmpty(insurancePreVo.getModelType()) || !insurancePreVo.getModelType().equals(CommonConstants.THREE_STRING)) {
return R.failed("保险公司、险种、购买标准、保单起、止日期不可同时重复!");
}
insurancePreVo.setEmpIdcard(employeeRegistrationPre.getEmpIdcard());
insurancePreVo.setDeptNo(employeeRegistrationPre.getDeptNo());
//商险是否存在判断
preVo = new TEmployeeInsurancePreVo();
preVo.setEmployeeName(employeeRegistrationPre.getEmployeeName());
preVo.setEmpIdcard(employeeRegistrationPre.getEmpIdcard());
preVo.setBuyStandard(insurancePreVo.getBuyStandard());
preVo.setBuyType(insurancePreVo.getBuyType());
preVo.setDeptNo(insurancePreVo.getDeptNo());
preVo.setInsuranceTypeName(insurancePreVo.getInsuranceTypeName());
preVo.setInsuranceCompanyName(insurancePreVo.getInsuranceCompanyName());
preVo.setPolicyStart(insurancePreVo.getPolicyStart());
preVo.setPolicyEnd(insurancePreVo.getPolicyEnd());
if (Common.isEmpty(insurancePreVo.getModelType())
|| !CommonConstants.FOUR_STRING.equals(insurancePreVo.getModelType())) {
checkVo = checkInsuranceExit(preVo);
if (null != checkVo) {
errorList.add(checkVo);
} else {
if (Common.isNotNull(preVo.getProcessStatus())) {
insurancePreVo.setProcessStatus(preVo.getProcessStatus());
insurancePreVo.setEmpIdcard(employeeRegistrationPre.getEmpIdcard());
insurancePreVo.setDeptNo(employeeRegistrationPre.getDeptNo());
//商险是否存在判断
preVo = new TEmployeeInsurancePreVo();
preVo.setEmployeeName(employeeRegistrationPre.getEmployeeName());
preVo.setEmpIdcard(employeeRegistrationPre.getEmpIdcard());
preVo.setBuyStandard(insurancePreVo.getBuyStandard());
preVo.setBuyType(insurancePreVo.getBuyType());
preVo.setDeptNo(insurancePreVo.getDeptNo());
preVo.setInsuranceTypeName(insurancePreVo.getInsuranceTypeName());
preVo.setInsuranceCompanyName(insurancePreVo.getInsuranceCompanyName());
preVo.setPolicyStart(insurancePreVo.getPolicyStart());
preVo.setPolicyEnd(insurancePreVo.getPolicyEnd());
if (Common.isEmpty(insurancePreVo.getModelType())
|| !CommonConstants.FOUR_STRING.equals(insurancePreVo.getModelType())) {
checkVo = checkInsuranceExit(preVo);
if (null != checkVo) {
errorList.add(checkVo);
} else {
insurancePreVo.setProcessStatus(CommonConstants.ZERO_STRING);
}
if (Common.isNotNull(preVo.getIsAddress())) {
insurancePreVo.setIsAddress(preVo.getIsAddress());
}
if (Common.isNotNull(preVo.getInsurancesId())) {
insurancePreVo.setInsurancesId(preVo.getInsurancesId());
if (Common.isNotNull(preVo.getProcessStatus())) {
insurancePreVo.setProcessStatus(preVo.getProcessStatus());
} else {
insurancePreVo.setProcessStatus(CommonConstants.ZERO_STRING);
}
if (Common.isNotNull(preVo.getIsAddress())) {
insurancePreVo.setIsAddress(preVo.getIsAddress());
}
if (Common.isNotNull(preVo.getInsurancesId())) {
insurancePreVo.setInsurancesId(preVo.getInsurancesId());
}
}
}
}
}
if (!errorList.isEmpty()) {
return R.other(CommonConstants.TWO_INT,null,errorList);
}
if (!errorList.isEmpty()) {
return R.other(CommonConstants.TWO_INT, null, errorList);
}
// 2:商险待办 的判断:
if (oldList != null && !oldList.isEmpty()) {
TEmployeeInsurancePre newPre;
String oldKey;
for (TEmployeeInsurancePre oldInsurance: oldList) {
// 1:判断是否变更 商险待办 的项目
oldKey = this.getFiveKey(oldInsurance);
newDeptNo = newKeyDeptNoMap.get(oldKey);
// 不同项目,在途(待确认、待派单、派单失败),要拦截
if (Common.isNotNull(newDeptNo) && !newDeptNo.equals(oldInsurance.getDeptNo())
&& !Common.isNotNull(oldInsurance.getProcessStatus())
&& (CommonConstants.ZERO_STRING.equals(oldInsurance.getProcessStatus())
|| CommonConstants.ONE_STRING.equals(oldInsurance.getProcessStatus())
|| CommonConstants.TWO_STRING.equals(oldInsurance.getProcessStatus()))) {
return R.failed("不可变更项目,请检查商险配置!");
}
oldMap.put(oldInsurance.getId(), oldInsurance);
newPre = newMap.get(oldInsurance.getId());
// 是否为不可修改的状态
if (Common.isNotNull(oldInsurance.getProcessStatus())
&& (CommonConstants.THREE_STRING.equals(oldInsurance.getProcessStatus())
|| CommonConstants.FOUR_STRING.equals(oldInsurance.getProcessStatus())
|| CommonConstants.SIX_STRING.equals(oldInsurance.getProcessStatus()) )) {
if (newPre == null) {
return R.failed("含有不可删除的商险,请刷新后再修改!");
} else if (Common.isNotNull(newPre.getModelType()) && !CommonConstants.FOUR_STRING.equals(newPre.getModelType())) {
return R.failed("含有不可更改的商险,请刷新后再修改!");
// 2:商险待办 的判断:
if (oldList != null && !oldList.isEmpty()) {
TEmployeeInsurancePre newPre;
String oldKey;
for (TEmployeeInsurancePre oldInsurance : oldList) {
// 1:判断是否变更 商险待办 的项目
oldKey = this.getFiveKey(oldInsurance);
newDeptNo = newKeyDeptNoMap.get(oldKey);
// 不同项目,在途(待确认、待派单、派单失败),要拦截
if (Common.isNotNull(newDeptNo) && !newDeptNo.equals(oldInsurance.getDeptNo())
&& !Common.isNotNull(oldInsurance.getProcessStatus())
&& (CommonConstants.ZERO_STRING.equals(oldInsurance.getProcessStatus())
|| CommonConstants.ONE_STRING.equals(oldInsurance.getProcessStatus())
|| CommonConstants.TWO_STRING.equals(oldInsurance.getProcessStatus()))) {
return R.failed("不可变更项目,请检查商险配置!");
}
} else {
if (newPre == null) {
oldInsurance.setModelType(CommonConstants.THREE_STRING);
newList.add(oldInsurance);
oldMap.put(oldInsurance.getId(), oldInsurance);
newPre = newMap.get(oldInsurance.getId());
// 是否为不可修改的状态
if (Common.isNotNull(oldInsurance.getProcessStatus())
&& (CommonConstants.THREE_STRING.equals(oldInsurance.getProcessStatus())
|| CommonConstants.FOUR_STRING.equals(oldInsurance.getProcessStatus())
|| CommonConstants.SIX_STRING.equals(oldInsurance.getProcessStatus()))) {
if (newPre == null) {
return R.failed("含有不可删除的商险,请刷新后再修改!");
} else if (Common.isNotNull(newPre.getModelType()) && !CommonConstants.FOUR_STRING.equals(newPre.getModelType())) {
return R.failed("含有不可更改的商险,请刷新后再修改!");
}
} else {
if (newPre == null) {
oldInsurance.setModelType(CommonConstants.THREE_STRING);
newList.add(oldInsurance);
}
}
}
employeeRegistrationPre.setInsurancePreList(newList);
}
employeeRegistrationPre.setInsurancePreList(newList);
}
} else {
// 2:保存时不存在商险类型,判断是否有不可删除的数据,有则拒绝:
......@@ -824,6 +866,15 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
return R.ok();
}
//商险状态是否正常判断
private boolean checkInsuranceIsProcess(EmployeeRegistrationPre pre) {
EmployeeRegistrationPreVo preVo = new EmployeeRegistrationPreVo();
BeanUtils.copyProperties(pre,preVo);
R<Boolean> flag = insuranceDaprUtil.checkExitInsuanceIsProcess(preVo);
//是否已签署为是需要判断合同是否在用或者流程中
return Common.isEmpty(flag) || Boolean.TRUE.equals(!flag.getData());
}
private void initInsurancePreInfo(EmployeeRegistrationPre registration, TEmployeeInsurancePre preVo,
YifuUser user, String id) {
preVo.setRegisterId(id);
......
......@@ -225,6 +225,7 @@ public class TEmployeePreLogServiceImpl extends ServiceImpl<TEmployeePreLogMappe
&& !"attaIdList".equals(differenceKey) && !"employeeContractPre".equals(differenceKey)) {
differenceKey = differenceKey.replace("insurancePreList","");
differenceKey = differenceKey.replace("employeeContractPre","");
differenceKey = differenceKey.replace("exitInsuranceInfoList","");
diffTitle = "档案信息";
detailEmpLog = new TEmployeePreLogDetail();
detailEmpLog.setModelType(CommonConstants.TWO_STRING);
......@@ -418,6 +419,7 @@ public class TEmployeePreLogServiceImpl extends ServiceImpl<TEmployeePreLogMappe
&& !"attaIdList".equals(differenceKey) && !"employeeContractPre".equals(differenceKey)) {
differenceKey = differenceKey.replace("insurancePreList","");
differenceKey = differenceKey.replace("employeeContractPre","");
differenceKey = differenceKey.replace("exitInsuranceInfoList","");
diffTitle = "档案信息二次确认";
detailEmpLog = new TEmployeePreLogDetail();
detailEmpLog.setModelType(CommonConstants.TWO_STRING);
......@@ -433,6 +435,16 @@ public class TEmployeePreLogServiceImpl extends ServiceImpl<TEmployeePreLogMappe
TEmployeePreLogDetail detailInsuranceLog;
for (TEmployeeInsurancePre newInsurance : newList) {
differenceInsuranceKey = null;
if (CommonConstants.THREE_STRING.equals(newInsurance.getModelType())) {
// 3:删除
detailInsuranceLog = new TEmployeePreLogDetail();
detailInsuranceLog.setModelType(newInsurance.getModelType());
detailInsuranceLog.setType(CommonConstants.TWO_STRING);
this.setPreLogBaseInfo(empPreId, newInsurance, null, userId, nickName, differenceInsuranceKey, logId, detailInsuranceLog);
isModifyInsurance = true;
detailList.add(detailInsuranceLog);
continue;
}
// 2:修改有老ID
if (Common.isNotNull(newInsurance.getId())) {
oldInsurance = oldMap.get(newInsurance.getId());
......
......@@ -638,7 +638,7 @@ public interface CommonConstants {
List<String> processStatus = Stream.of("0","1").collect(Collectors.toList());
List<String> processStatusEnd = Stream.of("3","4").collect(Collectors.toList());
List<String> insuranceAutoProcessStatus = Stream.of("0","1","2","5").collect(Collectors.toList());
List<String> processPreStatus = Stream.of("1").collect(Collectors.toList());
......
......@@ -85,4 +85,9 @@ public class InsuranceDaprUtil {
, daprInsurancesProperties.getAppId(),"/temployeeinsurancepre/inner/updateInsurancePreCustomerName" , updateVo
, Object.class, SecurityConstants.FROM_IN);
}
public R<Boolean> checkExitInsuanceIsProcess(EmployeeRegistrationPreVo preVo) {
return HttpDaprUtil.invokeMethodPost(daprInsurancesProperties.getAppUrl(),daprInsurancesProperties.getAppId(),
"/temployeeinsurancepre/inner/checkExitInsuanceIsProcess", JSON.toJSONString(preVo), Boolean.class, SecurityConstants.FROM_IN);
}
}
......@@ -569,7 +569,9 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
!CommonConstants.ONE_STRING.equals(registration.getProcessStatus()))) {
return R.failed(CommonConstants.NO_DATA_TO_HANDLE);
}
if (preVo.getServerItem().contains("商险") && !preVo.getEmployeeInsurancePreVos().isEmpty()) {
if (preVo.getServerItem().contains("商险") && !preVo.getEmployeeInsurancePreVos().isEmpty()
&& Common.isNotNull(preVo.getInsuranceIsBuy())
&& preVo.getInsuranceIsBuy().equals(CommonConstants.ONE_STRING)) {
List<TEmployeeAutoRegistCheckVo> errorList = new ArrayList<>();
TEmployeeAutoRegistCheckVo checkVo;
String key;
......@@ -619,6 +621,17 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
}
}
if (preVo.getServerItem().contains("商险") && Common.isNotNull(preVo.getInsuranceIsBuy())
&& preVo.getInsuranceIsBuy().equals(CommonConstants.ZERO_STRING)
&& !preVo.getExitInsuranceInfoList().isEmpty()) {
//判断带出的流程中或者已完结的商险数据是否准确
//商险是否存在判断
boolean isTrue = checkInsuranceIsProcess(preVo);
if (isTrue) {
return R.other(CommonConstants.TWO_INT,null,"带出的商险已购买数据状态或条数发生变更,请重新确认接收!");
}
}
//点击“接收确认”的时候,监测到该人员该项目下已有在项的档案时,再次提醒:该人员已在项,
//状态将更新成“已处理”;处理记录中,针对此情况,记录真实的进项时间,备注:先于登记入项
EmpProjectStatusVo vo = new EmpProjectStatusVo();
......@@ -645,7 +658,14 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
initRegistPreInfo(registration, preVo, user, CommonConstants.ZERO_STRING);
R<String> domainR = archivesDaprUtil.saveRegistPreInfo(preVo);
if (Common.isNotNull(domainR) && Common.isNotNull(domainR.getData())) {
if (preVo.getServerItem().contains("商险") && !preVo.getEmployeeInsurancePreVos().isEmpty()) {
//是否存在商险为是时生成入职确认信息商险明细数据
if (preVo.getServerItem().contains("商险") && Common.isNotNull(preVo.getInsuranceIsBuy())
&& preVo.getInsuranceIsBuy().equals(CommonConstants.ZERO_STRING)
&& !preVo.getExitInsuranceInfoList().isEmpty()) {
preVo.getExitInsuranceInfoList().forEach(insurancePreVo -> insurancePreVo.setRegisterId(domainR.getData()));
//生成入职确认信息商险明细数据
insuranceDaprUtil.saveInsurancePreInfo(preVo);
} else if (preVo.getServerItem().contains("商险") && !preVo.getEmployeeInsurancePreVos().isEmpty()) {
//生成商险待购买的数据
for (TEmployeeInsurancePreVo insurancePreVo : preVo.getEmployeeInsurancePreVos()) {
initInsruancePreInfo(registration, insurancePreVo, user, domainR.getData());
......@@ -1097,7 +1117,14 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
initRegistPreInfo(registrationNow, preVo, user, CommonConstants.FOUR_STRING);
R<String> domainR = archivesDaprUtil.saveRegistPreInfo(preVo);
if (Common.isNotNull(domainR) && Common.isNotNull(domainR.getData())){
if (preVo.getServerItem().contains("商险") && !preVo.getEmployeeInsurancePreVos().isEmpty()) {
//是否存在商险为是时生成入职确认信息商险明细数据
if (preVo.getServerItem().contains("商险") && Common.isNotNull(preVo.getInsuranceIsBuy())
&& preVo.getInsuranceIsBuy().equals(CommonConstants.ZERO_STRING)
&& !preVo.getExitInsuranceInfoList().isEmpty()) {
preVo.getExitInsuranceInfoList().forEach(insurancePreVo -> insurancePreVo.setRegisterId(domainR.getData()));
//生成入职确认信息商险明细数据
insuranceDaprUtil.saveInsurancePreInfo(preVo);
} else if (preVo.getServerItem().contains("商险") && !preVo.getEmployeeInsurancePreVos().isEmpty()) {
//生成商险待购买的数据
for (TEmployeeInsurancePreVo insurancePreVo : preVo.getEmployeeInsurancePreVos()) {
initInsruancePreInfo(registrationNow, insurancePreVo, user, domainR.getData());
......@@ -1602,6 +1629,13 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
preVo.getExpectedCollectionTime(), DateUtil.ISO_EXPANDED_DATE_FORMAT) + " 15:20", DateUtil.DATETIME_PATTERN_MINUTE));
}
//商险状态是否正常判断
private boolean checkInsuranceIsProcess(EmployeeRegistrationPreVo preVo) {
R<Boolean> flag = insuranceDaprUtil.checkExitInsuanceIsProcess(preVo);
//是否已签署为是需要判断合同是否在用或者流程中
return Common.isEmpty(flag) || Boolean.TRUE.equals(!flag.getData());
}
//商险是否存在判断
private TEmployeeAutoRegistCheckVo checkInsuranceExit(TEmployeeInsurancePreVo preVo,EmployeeRegistration registration) {
//查询入职确认信息数据
......
......@@ -112,11 +112,11 @@ public class TInsurancePreDetail extends BaseEntity {
@Schema(description = "保单生效日期")
private Date policyEffect;
/**
* 购买类型, 1新增、3批增、4替换
* 投保类型, 1新增、3批增、4替换
*/
@ExcelAttribute(name = "购买类型, 1新增、3批增、4替换")
@ExcelProperty("购买类型, 1新增、3批增、4替换")
@Schema(description = "购买类型, 1新增、3批增、4替换")
@ExcelProperty("投保类型, 1新增、3批增、4替换")
@Schema(description = "投保类型, 1新增、3批增、4替换")
private Integer buyType;
/**
* 投保办理状态 1待投保 2投保中 3已投保 4投保退回 5 已减员
......
......@@ -2,6 +2,7 @@ package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsurancePreDetail;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
......@@ -222,5 +223,5 @@ public class InsuranceAddParam implements Serializable {
@Schema(description = "是否已有参保明细标识")
private String isExit;
private List<InsuredListVo> inProgressList;
private List<TInsurancePreDetail> inProgressList;
}
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsurancePreDetail;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
......@@ -164,5 +165,5 @@ public class InsuranceAutoParam implements Serializable {
@Schema(description = "是否已有参保明细标识")
private String isExit;
private List<InsuredListVo> inProgressList;
private List<TInsurancePreDetail> inProgressList;
}
......@@ -2,6 +2,7 @@ package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsurancePreDetail;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
......@@ -229,5 +230,5 @@ public class InsuranceBatchParam implements Serializable {
@Schema(description = "是否已有参保明细标识")
private String isExit;
private List<InsuredListVo> inProgressList;
private List<TInsurancePreDetail> inProgressList;
}
......@@ -3,6 +3,7 @@ package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsurancePreDetail;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
......@@ -164,6 +165,6 @@ public class InsuranceReplaceParam implements Serializable {
@Schema(description = "是否已有参保明细标识")
private String isExit;
private List<InsuredListVo> inProgressList;
private List<TInsurancePreDetail> inProgressList;
}
......@@ -190,6 +190,18 @@ public class TEmployeeInsurancePreController {
return tEmployeeInsurancePreService.saveInsurancePreInfo(preVo);
}
/**
* 商险状态是否正常判断
* @author huych
* @date 2025-08-05 16:26:38
**/
@Operation(description = "商险状态是否正常判断")
@Inner
@PostMapping("/inner/checkExitInsuanceIsProcess")
public Boolean checkExitInsuanceIsProcess(@RequestBody EmployeeRegistrationPreVo preVo) {
return tEmployeeInsurancePreService.checkExitInsuanceIsProcess(preVo);
}
/**
* 更新商险待购买的前端客服姓名
* @author huych
......
......@@ -14,6 +14,7 @@ import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.insurances.constants.InsurancesConstants;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceOperate;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsurancePreDetail;
import com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.TInsuranceDetailService;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.*;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount;
......@@ -881,7 +882,7 @@ public class TInsuranceDetailController {
*/
@Operation(description = "查询在用或者在途的商险数据")
@GetMapping("/getOnProcessInsurancesInfo")
public R<List<InsuredListVo>> getInProcessInsurancesInfo(@RequestParam String empIdcard) {
public R<List<TInsurancePreDetail>> getInProcessInsurancesInfo(@RequestParam String empIdcard) {
return R.ok(tInsuranceDetailService.getOnProcessInsurancesInfo(empIdcard));
}
......
......@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainSelectVo;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsurancePreDetail;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -337,6 +338,6 @@ public interface TInsuranceDetailMapper extends BaseMapper<TInsuranceDetail> {
/**
* 派单前系统已有在途/在保数据的人员明细
*/
List<InsuredListVo> getOnProcessInsuredList(@Param("empIdCard") String empIdCard);
List<TInsurancePreDetail> getOnProcessInsuredList(@Param("empIdCard") String empIdCard);
}
......@@ -71,6 +71,8 @@ public interface TEmployeeInsurancePreService extends IService<TEmployeeInsuranc
*/
Boolean saveInsurancePreInfo(EmployeeRegistrationPreVo preVo);
Boolean checkExitInsuanceIsProcess(EmployeeRegistrationPreVo preVo);
TEmployeeInsuranceSelectVo selectInsurancePreInfoList(TEmployeeInsurancePreVo preVo);
void updateInsurancePreCustomerName(EmployeeRegistrationCustomerUserUpdateVo updateVo);
......
......@@ -9,6 +9,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceOperate;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsurancePreDetail;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.*;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount;
import com.yifu.cloud.plus.v1.yifu.salary.vo.SalaryRiskListVo;
......@@ -575,7 +576,7 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> {
*/
IPage<InsuredListVo> policyPageToAutoSelect(Page<InsuredListVo> page, InsuredParam param, String mId);
List<InsuredListVo> getOnProcessInsurancesInfo(String empIdCard);
List<TInsurancePreDetail> getOnProcessInsurancesInfo(String empIdCard);
}
......@@ -25,10 +25,12 @@ import com.yifu.cloud.plus.v1.yifu.common.dapr.util.UpmsDaprUtils;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.insurances.config.WxConfig;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TEmployeeInsurancePre;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsurancePreDetail;
import com.yifu.cloud.plus.v1.yifu.insurances.mapper.insurances.TEmployeeInsurancePreMapper;
import com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.ScheduleService;
import com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.TEmployeeInsurancePreService;
import com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.TInsuranceDetailService;
import com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.TInsurancePreDetailService;
import com.yifu.cloud.plus.v1.yifu.insurances.util.LocalDateUtil;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.*;
import lombok.RequiredArgsConstructor;
......@@ -64,10 +66,10 @@ public class TEmployeeInsurancePreServiceImpl extends ServiceImpl<TEmployeeInsur
@Autowired
@Lazy
private TInsuranceDetailService detailService;
@Autowired
@Lazy
private ScheduleService scheduleService;
//
// @Autowired
// @Lazy
// private ScheduleService scheduleService;
@Autowired
private WxConfig wxConfig;
......@@ -75,6 +77,9 @@ public class TEmployeeInsurancePreServiceImpl extends ServiceImpl<TEmployeeInsur
@Autowired
private UpmsDaprUtils upmsDaprUtils;
@Autowired
private TInsurancePreDetailService preDetailService;
/**
* 商险待办任务表简单分页查询
*
......@@ -327,33 +332,48 @@ public class TEmployeeInsurancePreServiceImpl extends ServiceImpl<TEmployeeInsur
@Override
@Transactional
public Boolean saveInsurancePreInfo(EmployeeRegistrationPreVo registrationPreVo) {
List<TEmployeeInsurancePreVo> employeeInsurancePreVos = registrationPreVo.getEmployeeInsurancePreVos();
TEmployeeInsurancePre preExit;
if (null != employeeInsurancePreVos && !employeeInsurancePreVos.isEmpty()) {
try {
for (TEmployeeInsurancePreVo preVo : employeeInsurancePreVos) {
//判断是否存在商险待购买信息
preExit = baseMapper.selectOne(Wrappers.<TEmployeeInsurancePre>query().lambda()
.eq(TEmployeeInsurancePre::getRegisterId, preVo.getRegisterId())
.eq(TEmployeeInsurancePre::getEmpIdcard, preVo.getEmpIdcard())
.eq(TEmployeeInsurancePre::getBuyStandard, preVo.getBuyStandard())
.eq(TEmployeeInsurancePre::getInsuranceTypeName, preVo.getInsuranceTypeName())
.eq(TEmployeeInsurancePre::getInsuranceCompanyName, preVo.getInsuranceCompanyName())
.eq(TEmployeeInsurancePre::getPolicyStart, DateUtil.parseDate(DateUtil.dateToString(preVo.getPolicyStart()), DateUtil.ISO_EXPANDED_DATE_FORMAT))
.eq(TEmployeeInsurancePre::getPolicyEnd, DateUtil.parseDate(DateUtil.dateToString(preVo.getPolicyEnd()), DateUtil.ISO_EXPANDED_DATE_FORMAT))
.last(CommonConstants.LAST_ONE_SQL));
TEmployeeInsurancePre pre = new TEmployeeInsurancePre();
BeanUtils.copyProperties(preVo, pre);
if (Common.isNotNull(preVo.getExpectedCollectionTime())) {
pre.setExpectedCollectionTime(LocalDateTimeUtils.dateToLocalDateTime(preVo.getExpectedCollectionTime()));
}
if (Common.isNotNull(preExit)) {
pre.setId(preExit.getId());
baseMapper.deleteById(preExit);
baseMapper.insert(pre);
} else {
baseMapper.insert(pre);
//暂时不需要,先注释,后续可能会需要
if (Common.isNotNull(registrationPreVo.getInsuranceIsBuy())
&& registrationPreVo.getInsuranceIsBuy().equals(CommonConstants.ZERO_STRING)
&& !registrationPreVo.getExitInsuranceInfoList().isEmpty()) {
//删除已存在的入职确认信息对应的商险明细
preDetailService.remove(Wrappers.<TInsurancePreDetail>lambdaQuery()
.eq(TInsurancePreDetail::getRegisterId, registrationPreVo.getExitInsuranceInfoList()
.get(0).getRegisterId()));
//批量新增
preDetailService.saveBatch(registrationPreVo.getExitInsuranceInfoList());
//批量删除商险待购买列表中的待确认、待派单、派单失败、投保退回的数据
baseMapper.delete(Wrappers.<TEmployeeInsurancePre>query().lambda().in(
TEmployeeInsurancePre::getProcessStatus,CommonConstants.insuranceAutoProcessStatus)
.eq(TEmployeeInsurancePre::getRegisterId,registrationPreVo.getExitInsuranceInfoList()
.get(0).getRegisterId()));
} else {
List<TEmployeeInsurancePreVo> employeeInsurancePreVos = registrationPreVo.getEmployeeInsurancePreVos();
TEmployeeInsurancePre preExit;
if (null != employeeInsurancePreVos && !employeeInsurancePreVos.isEmpty()) {
try {
for (TEmployeeInsurancePreVo preVo : employeeInsurancePreVos) {
//判断是否存在商险待购买信息
preExit = baseMapper.selectOne(Wrappers.<TEmployeeInsurancePre>query().lambda()
.eq(TEmployeeInsurancePre::getRegisterId, preVo.getRegisterId())
.eq(TEmployeeInsurancePre::getEmpIdcard, preVo.getEmpIdcard())
.eq(TEmployeeInsurancePre::getBuyStandard, preVo.getBuyStandard())
.eq(TEmployeeInsurancePre::getInsuranceTypeName, preVo.getInsuranceTypeName())
.eq(TEmployeeInsurancePre::getInsuranceCompanyName, preVo.getInsuranceCompanyName())
.eq(TEmployeeInsurancePre::getPolicyStart, DateUtil.parseDate(DateUtil.dateToString(preVo.getPolicyStart()), DateUtil.ISO_EXPANDED_DATE_FORMAT))
.eq(TEmployeeInsurancePre::getPolicyEnd, DateUtil.parseDate(DateUtil.dateToString(preVo.getPolicyEnd()), DateUtil.ISO_EXPANDED_DATE_FORMAT))
.last(CommonConstants.LAST_ONE_SQL));
TEmployeeInsurancePre pre = new TEmployeeInsurancePre();
BeanUtils.copyProperties(preVo, pre);
if (Common.isNotNull(preVo.getExpectedCollectionTime())) {
pre.setExpectedCollectionTime(LocalDateTimeUtils.dateToLocalDateTime(preVo.getExpectedCollectionTime()));
}
if (Common.isNotNull(preExit)) {
pre.setId(preExit.getId());
baseMapper.deleteById(preExit);
baseMapper.insert(pre);
} else {
baseMapper.insert(pre);
//暂时不需要,先注释,后续可能会需要
// if (Common.isNotNull(pre.getExpectedCollectionTime())) {
// // 事务提交后触发调度
// TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
......@@ -368,16 +388,43 @@ public class TEmployeeInsurancePreServiceImpl extends ServiceImpl<TEmployeeInsur
// }
// });
// }
}
}
} catch (Exception e) {
log.error("执行异常", e);
return null;
}
}catch (Exception e){
log.error("执行异常" ,e);
return null;
}
}
return true;
}
@Override
public Boolean checkExitInsuanceIsProcess(EmployeeRegistrationPreVo preVo) {
//如果状态有变动就会拦截
if (Common.isNotNull(preVo) && Common.isNotNull(preVo.getExitInsuranceInfoList())
&& !preVo.getExitInsuranceInfoList().isEmpty()) {
for (TInsurancePreDetail preDetail: preVo.getExitInsuranceInfoList()) {
TInsuranceDetail insuranceDetail = detailService.getById(preDetail.getId());
if (Common.isEmpty(insuranceDetail) || !insuranceDetail.getBuyHandleStatus().equals(preDetail.getBuyHandleStatus())) {
return false;
}
}
//如果有数据新增也要拦截
long count = detailService.count(Wrappers.<TInsuranceDetail>query().lambda()
.eq(TInsuranceDetail::getEmpIdcardNo, preVo.getEmpIdcard())
.eq(TInsuranceDetail::getDeleteFlag, CommonConstants.ZERO_INT)
//流程中或者已完结
.and(
wrapper -> wrapper.eq(TInsuranceDetail::getIsEffect, CommonConstants.ZERO_INT)
.eq(TInsuranceDetail::getIsOverdue, CommonConstants.ZERO_INT)
.eq(TInsuranceDetail::getBuyHandleStatus, CommonConstants.THREE_INT)
.or().eq(TInsuranceDetail::getBuyHandleStatus, CommonConstants.TWO_INT)));
return count == preVo.getExitInsuranceInfoList().size();
}
return false;
}
@Override
public TEmployeeInsuranceSelectVo selectInsurancePreInfoList(TEmployeeInsurancePreVo preVo) {
TEmployeeInsuranceSelectVo selectVo = new TEmployeeInsuranceSelectVo();
......
......@@ -3071,7 +3071,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
//本次派单人员系统已有参保明细 如果是二次派单则无需校验
if (Common.isEmpty(param.getIsExit())) {
List<InsuredListVo> listInsured = baseMapper.getOnProcessInsuredList(param.getEmpIdcardNo());
List<TInsurancePreDetail> listInsured = baseMapper.getOnProcessInsuredList(param.getEmpIdcardNo());
if (Common.isNotNull(listInsured) && !listInsured.isEmpty()) {
param.setIsExit(CommonConstants.ONE_STRING);
param.setErrorMessage(InsurancesConstants.DIS_PERSON_DATA_IS_EXIST);
......@@ -3478,7 +3478,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
//本次派单人员系统已有参保明细 如果是二次派单则无需校验
if (Common.isEmpty(param.getIsExit())) {
List<InsuredListVo> listInsured = baseMapper.getOnProcessInsuredList(param.getEmpIdcardNo());
List<TInsurancePreDetail> listInsured = baseMapper.getOnProcessInsuredList(param.getEmpIdcardNo());
if (Common.isNotNull(listInsured) && !listInsured.isEmpty()) {
param.setIsExit(CommonConstants.ONE_STRING);
param.setErrorMessage(InsurancesConstants.DIS_PERSON_DATA_IS_EXIST);
......@@ -3877,7 +3877,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
//本次派单人员系统已有参保明细 如果是二次派单则无需校验
if (Common.isEmpty(param.getIsExit())) {
List<InsuredListVo> listInsured = baseMapper.getOnProcessInsuredList(param.getEmpIdcardNo());
List<TInsurancePreDetail> listInsured = baseMapper.getOnProcessInsuredList(param.getEmpIdcardNo());
if (Common.isNotNull(listInsured) && !listInsured.isEmpty()) {
param.setIsExit(CommonConstants.ONE_STRING);
param.setErrorMessage(InsurancesConstants.DIS_PERSON_DATA_IS_EXIST);
......@@ -8534,7 +8534,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
@Override
public List<InsuredListVo> getOnProcessInsurancesInfo(String empIdCard) {
public List<TInsurancePreDetail> getOnProcessInsurancesInfo(String empIdCard) {
return baseMapper.getOnProcessInsuredList(empIdCard);
}
......
......@@ -594,14 +594,14 @@
</update>
<!-- 派单人员系统已有参保明细查询-->
<select id="getOnProcessInsuredList" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuredListVo">
<select id="getOnProcessInsuredList" resultType="com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsurancePreDetail">
select
a.id as id,
a.EMP_NAME as empName,
a.EMP_IDCARD_NO as empIdcardNo,
a.BUY_TYPE as buyType,
a.DEPT_NO as deptNo,
a.DEPT_NAME as projectName,
a.DEPT_NAME as deptName,
a.POST as post,
a.POLICY_START as policyStart,
a.POLICY_END as policyEnd,
......
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