Commit b2476458 authored by huyuchen's avatar huyuchen

huych-电子档案批量导入提交

parent fb3da26e
package com.yifu.cloud.plus.v1.yifu.archives.entity;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TDispatchInfoPreVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TFundPreDetailVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSocialPreDetailVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
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;
......@@ -109,7 +107,7 @@ public class EmployeeRegistrationPre extends BaseEntity {
@Schema(description = "商险是否已购买 0 是 1 否")
private String insuranceIsBuy;
@Schema(description = "商险是否已购买 0 是 1 否")
@Schema(description = "社保是否已购买 0 是 1 否")
private String socialIsBuy;
@Schema(description = "公积金是否已参保 0 是 1 否")
......@@ -177,4 +175,18 @@ public class EmployeeRegistrationPre extends BaseEntity {
@Schema(description = "公积金是否可修改")
@TableField(exist = false)
private Boolean fundUpdateFlag;
/**
* 社保是否可修改 可修改 true 不可修改 false
*/
@Schema(description = "社保是否可修改")
@TableField(exist = false)
private Boolean socialUpdateFlag;
/**
* 合同是否可修改 可修改 true 不可修改 false
*/
@Schema(description = "合同是否可修改")
@TableField(exist = false)
private Boolean contractUpdateFlag;
}
......@@ -31,7 +31,6 @@ import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
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.vo.*;
import com.yifu.cloud.plus.v1.yifu.social.vo.SysBaseSetInfoVo;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.BeanUtils;
......@@ -571,6 +570,7 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
oldList = sdr.getData().getPreList();
}
StringBuilder errorTemp = new StringBuilder();
// 1:存在商险,判断合规性+日期+五个不同等:
if (Common.isNotNull(employeeRegistrationPre.getServerItem()) && employeeRegistrationPre.getServerItem().contains("商险")) {
//商险是否购买为是时增加校验
......@@ -582,7 +582,8 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
employeeRegistrationPre.getExitInsuranceInfoList().forEach(e -> e.setCreateTime(null));
boolean isTrue = checkInsuranceIsProcess(employeeRegistrationPre);
if (isTrue) {
return R.failed("带出的商险已购买数据状态或条数发生变更,请重新确认!");
errorTemp.append("带出的商险已购买数据状态或条数发生变更,请重新确认;");
// return R.failed("带出的商险已购买数据状态或条数发生变更,请重新确认!");
}
List<TEmployeeInsurancePre> newList = new ArrayList<>();
if (oldList != null && !oldList.isEmpty()) {
......@@ -598,11 +599,12 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
} else if (employeeRegistrationPre.getInsuranceIsBuy().equals(CommonConstants.ONE_STRING)) {
if (employeeRegistrationPre.getInsurancePreList() == null
|| employeeRegistrationPre.getInsurancePreList().isEmpty()) {
return R.failed("含商险服务,商险配置不可为空");
errorTemp.append("含商险服务,商险配置不可为空;");
// return R.failed("含商险服务,商险配置不可为空");
}
List<TEmployeeInsurancePre> newList = employeeRegistrationPre.getInsurancePreList();
// 1:合规性:查找信息是否允许:
List<TEmployeeInsuranceExitCheckVo> errorList = new ArrayList<>();
// List<TEmployeeInsuranceExitCheckVo> errorList = new ArrayList<>();
TEmployeeInsuranceExitCheckVo checkVo;
Map<String, TEmployeeInsurancePre> newMap = new HashMap<>();
// 新的KeyMap,存项目
......@@ -622,7 +624,8 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
key = this.getFiveKey(insurancePreVo);
newDeptNo = insurancePreVo.getDeptNo();
if (Common.isEmpty(newDeptNo)) {
return R.failed("请传项目编码");
errorTemp.append("项目编码不可为空;");
// return R.failed("请传项目编码");
}
newKeyDeptNoMap.put(key, insurancePreVo.getDeptNo());
if (keyMap.get(key) == null) {
......@@ -630,7 +633,8 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
keyMap.put(key, CommonConstants.ONE_INT);
}
} else if (Common.isEmpty(insurancePreVo.getModelType()) || !insurancePreVo.getModelType().equals(CommonConstants.THREE_STRING)) {
return R.failed("保险公司、险种、购买标准、保单起、止日期不可同时重复!");
errorTemp.append("保险公司、险种、购买标准、保单起、止日期不可同时重复;");
// return R.failed("保险公司、险种、购买标准、保单起、止日期不可同时重复!");
}
insurancePreVo.setEmpIdcard(employeeRegistrationPre.getEmpIdcard());
......@@ -650,7 +654,9 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
|| !CommonConstants.FOUR_STRING.equals(insurancePreVo.getModelType())) {
checkVo = checkInsuranceExit(preVo);
if (null != checkVo) {
errorList.add(checkVo);
errorTemp.append("保单开始日期:" + insurancePreVo.getPolicyStart().toString()
+ ",保单结束日期:" + insurancePreVo.getPolicyEnd().toString() + "这条数据存在流程中/已完结的商险数据;");
// errorList.add(checkVo);
} else {
if (Common.isNotNull(preVo.getProcessStatus())) {
insurancePreVo.setProcessStatus(preVo.getProcessStatus());
......@@ -666,9 +672,9 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
}
}
}
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()) {
......@@ -684,7 +690,8 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
&& (CommonConstants.ZERO_STRING.equals(oldInsurance.getProcessStatus())
|| CommonConstants.ONE_STRING.equals(oldInsurance.getProcessStatus())
|| CommonConstants.TWO_STRING.equals(oldInsurance.getProcessStatus()))) {
return R.failed("不可变更项目,请检查商险配置!");
errorTemp.append("不可变更项目,请检查商险配置;");
// return R.failed("不可变更项目,请检查商险配置!");
}
oldMap.put(oldInsurance.getId(), oldInsurance);
newPre = newMap.get(oldInsurance.getId());
......@@ -694,9 +701,11 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
|| CommonConstants.FOUR_STRING.equals(oldInsurance.getProcessStatus())
|| CommonConstants.SIX_STRING.equals(oldInsurance.getProcessStatus()))) {
if (newPre == null) {
return R.failed("含有不可删除的商险,请刷新后再修改!");
errorTemp.append("含有不可删除的商险,请刷新后再修改;");
// return R.failed("含有不可删除的商险,请刷新后再修改!");
} else if (Common.isNotNull(newPre.getModelType()) && !CommonConstants.FOUR_STRING.equals(newPre.getModelType())) {
return R.failed("含有不可更改的商险,请刷新后再修改!");
errorTemp.append("含有不可更改的商险,请刷新后再修改;");
// return R.failed("含有不可更改的商险,请刷新后再修改!");
}
} else {
if (newPre == null) {
......@@ -717,16 +726,15 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
&& (CommonConstants.THREE_STRING.equals(oldInsurance.getProcessStatus())
|| CommonConstants.FOUR_STRING.equals(oldInsurance.getProcessStatus())
|| CommonConstants.SIX_STRING.equals(oldInsurance.getProcessStatus()))) {
return R.failed("含有不可删除的商险,请刷新后再修改!");
errorTemp.append("含有不可删除的商险,请刷新后再修改;");
// return R.failed("含有不可删除的商险,请刷新后再修改!");
}
}
}
}
//查询老的合同明细
TEmployeeContractPre contractOld = contractPreMapper.selectOne(Wrappers.<TEmployeeContractPre>query().lambda()
.eq(TEmployeeContractPre::getRegisterId, employeeRegistrationPre.getId())
.last(CommonConstants.LAST_ONE_SQL));
TEmployeeContractPre contractOld =null;
//1.9.12合同自动化校验逻辑
//根据身份证号码和项目编号查询合同
boolean flag = contractInfoMapper.selectCount(Wrappers.<TEmployeeContractInfo>query().lambda()
......@@ -739,10 +747,20 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
)
.eq(TEmployeeContractInfo::getDeleteFlag, CommonConstants.ZERO_INT)
.last(CommonConstants.LAST_ONE_SQL)) > 0;
if (employeeRegistrationPre.getServerItem().contains("合同") && Common.isEmpty(employeeRegistrationPre.getEmployeeContractPre()) && !flag) {
return R.failed("未找到流程中或者在用的合同!");
if (employeeRegistrationPre.getServerItem().contains("合同")
&& Common.isNotNull(employeeRegistrationPre.getContractUpdateFlag())
&& employeeRegistrationPre.getContractUpdateFlag()) {
//查询老的合同明细
contractOld = contractPreMapper.selectOne(Wrappers.<TEmployeeContractPre>query().lambda()
.eq(TEmployeeContractPre::getRegisterId, employeeRegistrationPre.getId())
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isEmpty(employeeRegistrationPre.getEmployeeContractPre()) && !flag) {
errorTemp.append("未找到流程中或者在用的合同;");
// return R.failed("未找到流程中或者在用的合同!");
}
if (employeeRegistrationPre.getServerItem().contains("合同") && null != employeeRegistrationPre.getEmployeeContractPre()) {
if (null != employeeRegistrationPre.getEmployeeContractPre()) {
TEmployeeContractPre employeeContractPreVo = employeeRegistrationPre.getEmployeeContractPre();
if (Common.isNotNull(employeeContractPreVo.getId())) {
TEmployeeContractPre contractStatus = contractPreMapper.selectById(employeeContractPreVo.getId());
......@@ -753,12 +771,14 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
|| CommonConstants.FOUR_STRING.equals(contractStatus.getProcessStatus())
|| CommonConstants.EIGHT_STRING.equals(contractStatus.getProcessStatus()))
) {
return R.failed("流程中的合同待签订数据不可修改!");
errorTemp.append("流程中的合同待签订数据不可修改;");
// return R.failed("流程中的合同待签订数据不可修改!");
}
}
//是否已签署为否需要判断是否在用或者流程中的合同
if ((CommonConstants.ONE_STRING.equals(employeeContractPreVo.getContractFlag()) || Common.isEmpty(employeeContractPreVo.getContractFlag())) && flag) {
return R.failed("该人员已存在审核中或已签署的合同,请勿重复发起签署!");
errorTemp.append("该人员已存在审核中或已签署的合同,请勿重复发起签署;");
// return R.failed("该人员已存在审核中或已签署的合同,请勿重复发起签署!");
}
if (CommonConstants.ONE_STRING.equals(employeeContractPreVo.getContractFlag()) || Common.isEmpty(employeeContractPreVo.getContractFlag())) {
initContractPreInfo(employeeRegistrationPre, employeeContractPreVo, user, id);
......@@ -767,9 +787,12 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
employeeRegistrationPre.setEmployeeContractPre(null);
}
}
}
//1.9.16社保自动化校验逻辑
if (employeeRegistrationPre.getServerItem().contains("社保")) {
if (employeeRegistrationPre.getServerItem().contains("社保")
&& Common.isNotNull(employeeRegistrationPre.getSocialUpdateFlag())
&& employeeRegistrationPre.getSocialUpdateFlag()) {
//根据身份证号码和项目编号查询合同
TEmployeeAutoRegistCheckVo cardVo = new TEmployeeAutoRegistCheckVo();
cardVo.setEmpIdcard(employeeRegistrationPre.getEmpIdcard());
......@@ -777,14 +800,16 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
//是否已签署为是需要判断合同是否在用或者流程中
if (CommonConstants.ZERO_STRING.equals(employeeRegistrationPre.getSocialIsBuy()) &&
(Common.isEmpty(socialFlag) || Boolean.TRUE.equals(!socialFlag.getData()))) {
return R.other(CommonConstants.TWO_INT, null, "未找到流程中或者在用的社保信息!");
errorTemp.append("未找到流程中或者在用的社保信息;");
// return R.other(CommonConstants.TWO_INT, null, "未找到流程中或者在用的社保信息!");
}
//是否已签署为否需要判断是否在用或者流程中的合同
if (CommonConstants.ONE_STRING.equals(employeeRegistrationPre.getSocialIsBuy()) &&
Common.isNotNull(socialFlag) && Boolean.TRUE.equals(socialFlag.getData()) &&
null != employeeRegistrationPre.getDispatchInfoPreVo() &&
Common.isEmpty(employeeRegistrationPre.getDispatchInfoPreVo().getId())) {
return R.other(CommonConstants.TWO_INT, null, "该人员存在在途/有效的社保数据,请将“是否已参保”调整为“是”");
errorTemp.append("该人员存在在途/有效的社保数据,请将【是否已参保】调整为【是】;");
// return R.other(CommonConstants.TWO_INT, null, "该人员存在在途/有效的社保数据,请将“是否已参保”调整为“是”");
}
//流程中的社保数据不能修改
//查已购买社保明细
......@@ -798,7 +823,8 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
socialSdr.getData().getDispatchInfoPreVo().getProcessStatus().equals(CommonConstants.SIX_STRING) ||
socialSdr.getData().getDispatchInfoPreVo().getProcessStatus().equals(CommonConstants.SEVEN_STRING) ||
socialSdr.getData().getDispatchInfoPreVo().getProcessStatus().equals(CommonConstants.NINE_STRING))) {
return R.failed("流程中的社保待购买数据不可修改!");
errorTemp.append("流程中的社保待购买数据不可修改;");
// return R.failed("流程中的社保待购买数据不可修改!");
}
}
//更新合同签署状态
......@@ -808,25 +834,28 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
}
//1.9.17公积金自动化校验逻辑
if (employeeRegistrationPre.getServerItem().contains("公积金")) {
if (employeeRegistrationPre.getServerItem().contains("公积金")
&& Common.isNotNull(employeeRegistrationPre.getFundUpdateFlag())
&& employeeRegistrationPre.getFundUpdateFlag()) {
//根据身份证号码和项目编号查询公积金
TEmployeeAutoRegistCheckVo cardVo = new TEmployeeAutoRegistCheckVo();
cardVo.setEmpIdcard(employeeRegistrationPre.getEmpIdcard());
R<Boolean> fundFlag = socialDaprUtils.selectExitEmpFund(cardVo);
if (null != employeeRegistrationPre.getFundUpdateFlag()
&& employeeRegistrationPre.getFundUpdateFlag().booleanValue()){
//是否已购买为是需要判断公积金是否在用或者流程中
if (CommonConstants.ZERO_STRING.equals(employeeRegistrationPre.getFundIsBuy()) &&
(Common.isEmpty(fundFlag) || Boolean.TRUE.equals(!fundFlag.getData()))) {
return R.other(CommonConstants.TWO_INT, null, "未找到流程中或者在用的公积金信息!");
errorTemp.append("未找到流程中或者在用的公积金信息;");
// return R.other(CommonConstants.TWO_INT, null, "未找到流程中或者在用的公积金信息!");
}
//是否已购买为否需要判断是否在用或者流程中的公积金
if (CommonConstants.ONE_STRING.equals(employeeRegistrationPre.getFundIsBuy()) &&
Common.isNotNull(fundFlag) && Boolean.TRUE.equals(fundFlag.getData()) &&
null != employeeRegistrationPre.getDispatchInfoFundPreVo()) {
return R.other(CommonConstants.TWO_INT, null, "该人员存在在途/有效的公积金数据,请将“是否已参保”调整为“是”");
}
errorTemp.append("该人员存在在途/有效的公积金数据,请将【是否已参保】调整为【是】;");
// return R.other(CommonConstants.TWO_INT, null, "该人员存在在途/有效的公积金数据,请将“是否已参保”调整为“是”");
}
//判断公积金基数 是否小于 公积金户配置的最低基数
/*if (Common.isNotNull(employeeRegistrationPre)
&& Common.isNotNull(employeeRegistrationPre.getDispatchInfoFundPreVo())
......@@ -846,14 +875,13 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
//(公积金待办为在途在保)流程中的公积金数据不能修改
//查已购买公积金明细
if (null != employeeRegistrationPre.getDispatchInfoFundPreVo()
&& !Common.isEmpty(employeeRegistrationPre.getDispatchInfoFundPreVo().getId())
&& null != employeeRegistrationPre.getFundUpdateFlag()
&& employeeRegistrationPre.getFundUpdateFlag().booleanValue()) {
&& !Common.isEmpty(employeeRegistrationPre.getDispatchInfoFundPreVo().getId())) {
R<Boolean> fundSdr = socialDaprUtils.getFundPreStatus(employeeRegistrationPre.getDispatchInfoFundPreVo().getId());
//公积金购买状态,0待确认,1待派单,2派单失败,3待审核,4审核不通过,5待办理,7办理成功,8办理失败
if (fundSdr != null && null != fundSdr.getData()
&& fundSdr.getData().booleanValue()) {
return R.failed("流程中的公积金待购买数据不可修改!");
errorTemp.append("流程中的公积金待购买数据不可修改;");
// return R.failed("流程中的公积金待购买数据不可修改!");
}
}
//更新合同签署状态
......@@ -862,6 +890,11 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
}
}
//错误信息全量返回
if (errorTemp.length() > 0) {
return R.other(CommonConstants.TWO_INT,null,errorTemp.toString());
}
//操作记录中字典值的转化
String natureItemBefore = null;
String natureItemAfter = null;
......
......@@ -174,6 +174,8 @@ public class TEmployeePreLogServiceImpl extends ServiceImpl<TEmployeePreLogMappe
IGNORE_FIELD.add("updateBy");
IGNORE_FIELD.add("isAddress");
IGNORE_FIELD.add("fundUpdateFlag");
IGNORE_FIELD.add("socialUpdateFlag");
IGNORE_FIELD.add("contractUpdateFlag");
}
private static final List<String> PRE_IGNORE_FIELD = new ArrayList<>();
......@@ -185,6 +187,8 @@ public class TEmployeePreLogServiceImpl extends ServiceImpl<TEmployeePreLogMappe
PRE_IGNORE_FIELD.add("createName");
PRE_IGNORE_FIELD.add("updateBy");
PRE_IGNORE_FIELD.add("fundUpdateFlag");
PRE_IGNORE_FIELD.add("socialUpdateFlag");
PRE_IGNORE_FIELD.add("contractUpdateFlag");
}
private static final List<String> CONTRACT_IGNORE_FIELD = new ArrayList<>();
......@@ -464,7 +468,8 @@ public class TEmployeePreLogServiceImpl extends ServiceImpl<TEmployeePreLogMappe
}
String differenceSocialKey;
if (newInfo.getServerItem().contains("社保") && (Common.isEmpty(isSocailBuyOld) ||
if (newInfo.getServerItem().contains("社保") && null != newInfo.getSocialUpdateFlag()
&& newInfo.getSocialUpdateFlag() && (Common.isEmpty(isSocailBuyOld) ||
(Common.isNotNull(isSocailBuyOld) && !isSocailBuyOld.equals(isSocailBuyNew)))) {
//单独记录是否已购买社保的变更记录
differenceSocialKey = "socialIsBuy";
......@@ -511,7 +516,8 @@ public class TEmployeePreLogServiceImpl extends ServiceImpl<TEmployeePreLogMappe
}
}
if (newInfo.getServerItem().contains("社保") && dispatchInfoPreOldVo != null && dispatchInfoPreVo != null) {
if (newInfo.getServerItem().contains("社保")&& null != newInfo.getSocialUpdateFlag()
&& newInfo.getSocialUpdateFlag() && dispatchInfoPreOldVo != null && dispatchInfoPreVo != null) {
differenceSocialKey = HrEquator.comparisonValueIgnoreField(dispatchInfoPreOldVo
, dispatchInfoPreVo, SOCIAL_IGNORE_FIELD);
if (differenceSocialKey.length() > 0) {
......@@ -531,7 +537,8 @@ public class TEmployeePreLogServiceImpl extends ServiceImpl<TEmployeePreLogMappe
// 公积金处理逻辑
String differenceFundKey;
if (newInfo.getServerItem().contains("公积金") && (Common.isEmpty(isFundBuyOld) ||
if (newInfo.getServerItem().contains("公积金") && null != newInfo.getFundUpdateFlag()
&& newInfo.getFundUpdateFlag() && (Common.isEmpty(isFundBuyOld) ||
(Common.isNotNull(isFundBuyOld) && !isFundBuyOld.equals(isFundBuyNew)))) {
//单独记录是否已购买公积金的变更记录
differenceFundKey = "fundIsBuy";
......@@ -578,18 +585,15 @@ public class TEmployeePreLogServiceImpl extends ServiceImpl<TEmployeePreLogMappe
}
}
if (newInfo.getServerItem().contains("公积金") && dispatchInfoFundPreOldVo != null && dispatchInfoFundPreVo != null) {
if (newInfo.getServerItem().contains("公积金") && null != newInfo.getFundUpdateFlag()
&& newInfo.getFundUpdateFlag() && dispatchInfoFundPreOldVo != null
&& dispatchInfoFundPreVo != null) {
Date expectedCollectionTime = dispatchInfoFundPreVo.getExpectedCollectionTime();
Date expectedConfirmTime = dispatchInfoFundPreVo.getExpectedConfirmTime();
//如果自动触发派增为是,计算派单发起时间和派单确认时间
initFundTime(dispatchInfoFundPreVo);
differenceFundKey = HrEquator.comparisonValueIgnoreField(dispatchInfoFundPreOldVo
, dispatchInfoFundPreVo, SOCIAL_IGNORE_FIELD);
//如果为不修改直接清空差异
if (null != newInfo.getFundUpdateFlag()
&& !newInfo.getFundUpdateFlag().booleanValue()){
differenceFundKey ="";
}
if (differenceFundKey.length() > 0) {
if (Common.isNotNull(diffTitle)) {
diffTitle += "、公积金信息";
......@@ -636,7 +640,8 @@ public class TEmployeePreLogServiceImpl extends ServiceImpl<TEmployeePreLogMappe
contractPreService.saveContractPreInfo(preVo);
}
//社保待购买数据处理
if (newInfo.getServerItem().contains("社保")) {
if (newInfo.getServerItem().contains("社保") && null != newInfo.getSocialUpdateFlag()
&& newInfo.getSocialUpdateFlag()) {
EmployeeRegistrationPreVo preVo = new EmployeeRegistrationPreVo();
BeanUtils.copyProperties(newInfo,preVo);
if (null != preVo.getExitSocialInfoList() && !preVo.getExitSocialInfoList().isEmpty()) {
......@@ -647,7 +652,8 @@ public class TEmployeePreLogServiceImpl extends ServiceImpl<TEmployeePreLogMappe
socialDaprUtils.saveSocialPreInfo(preVo);
}
//公积金待购买数据处理
if (newInfo.getServerItem().contains("公积金")) {
if (newInfo.getServerItem().contains("公积金") && null != newInfo.getFundUpdateFlag()
&& newInfo.getFundUpdateFlag() ) {
EmployeeRegistrationPreVo preVo = new EmployeeRegistrationPreVo();
BeanUtils.copyProperties(newInfo,preVo);
if (null != preVo.getExitFundInfoList() && !preVo.getExitFundInfoList().isEmpty()) {
......
......@@ -9,6 +9,9 @@ import com.yifu.cloud.plus.v1.batch.vo.ArchiveBatchDownloadRequestVO;
import com.yifu.cloud.plus.v1.batch.vo.ArchiveSelectedExportRequestVO;
import com.yifu.cloud.plus.v1.batch.vo.TElectronicArchiveDetailSearchVo;
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.common.dapr.util.MenuUtil;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
......@@ -32,6 +35,8 @@ public class TElectronicArchiveDetailController {
private final TElectronicArchiveDetailService tElectronicArchiveDetailService;
private final MenuUtil menuUtil;
/**
* 简单分页查询
*
......@@ -43,6 +48,8 @@ public class TElectronicArchiveDetailController {
@GetMapping("/page")
public R<IPage<TElectronicArchiveDetail>> getTElectronicArchiveDetailPage(Page<TElectronicArchiveDetail> page
, TElectronicArchiveDetailSearchVo tElectronicArchiveDetail) {
YifuUser user = SecurityUtils.getUser();
menuUtil.setAuthSql(user, tElectronicArchiveDetail);
return new R<>(tElectronicArchiveDetailService.getTElectronicArchiveDetailPage(page, tElectronicArchiveDetail));
}
......
......@@ -19,6 +19,7 @@ import com.yifu.cloud.plus.v1.batch.vo.ArchiveFeedbackVO;
import com.yifu.cloud.plus.v1.batch.vo.ArchiveImportVO;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.IdNameNoVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainListVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainSelectVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
......@@ -26,6 +27,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.ArchivesDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.insurances.constants.InsurancesConstants;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.cache.Cache;
......@@ -157,8 +159,22 @@ public class ElectronicArchiveImportServiceImpl implements ElectronicArchiveImpo
TSettleDomainSelectVo settleResult;
R<TEmployeeInfo> empResult;
Map<String,String> map = new HashMap<>();
List<String> deptNoList = new ArrayList<>();
if (Common.isNotNull(user) && !CommonConstants.ZERO_STRING.equals(user.getSystemFlag())) {
deptNoList = getDeptNoList(user.getId());
}
for (ArchiveImportVO data : dataList) {
try {
//超管和档案管理员无需校验项目权限
if (Common.isNotNull(user) && !CommonConstants.ZERO_STRING.equals(user.getSystemFlag())) {
if (Common.isEmpty(deptNoList)) {
ErrorMessage<ArchiveImportVO> errorMessage = new ErrorMessage<>(data.getRowIndex()
,InsurancesConstants.DEPT_NO_NOT_IN_USER_DEPT_LIST,data);
errorMessageList.add(errorMessage);
continue;
}
}
// 1. 校验表格中一个姓名、身份证只能有一条
String uniqueKey = data.getEmpIdcard() + "_" + data.getEmpName() + "_" + data.getDeptNo();
if (null != map.get(uniqueKey)) {
......@@ -244,6 +260,29 @@ public class ElectronicArchiveImportServiceImpl implements ElectronicArchiveImpo
}
}
/**
* 获取项目权限
*
* @author huych
* @param userId
* @return {@link List< String>}
*/
public List<String> getDeptNoList(String userId){
List<String> deptList = new ArrayList<>(16);
try{
R<TSettleDomainListVo> settleDomainList = archivesDaprUtil.getSettleDomainIdsByUserId(userId);
if(Common.isNotNull(settleDomainList) && settleDomainList.getCode() == CommonConstants.SUCCESS){
TSettleDomainListVo data = settleDomainList.getData();
if (Optional.ofNullable(data).isPresent()){
deptList = data.getDeptNos();
}
}
}catch (Exception e){
log.error("查询项目信息出错:"+e);
}
return deptList;
}
/**
* 建立任务和档案详情的关联关系
*/
......@@ -619,6 +658,17 @@ public class ElectronicArchiveImportServiceImpl implements ElectronicArchiveImpo
if (subFile.isDirectory()) {
// 是资料类型目录
String materialType = subFile.getName();
//存量、新签、续签、离职
if(materialType.contains("存量")) {
materialType = "存量";
} else if(materialType.contains("新签")) {
materialType = "新签";
} else if(materialType.contains("续签")) {
materialType = "续签";
} else if(materialType.contains("离职")) {
materialType = "离职";
}
if (!isValidMaterialType(materialType)) {
// 不是有效的资料类型,跳过
continue;
......@@ -672,8 +722,6 @@ public class ElectronicArchiveImportServiceImpl implements ElectronicArchiveImpo
String fileName = file.getName();
long fileSize = file.length();
log.info("处理文件:{},大小:{},电子档案详情ID:{}", fileName, fileSize, detail.getId());
// 1. 校验文件大小
if (fileSize > ArchiveConstants.SINGLE_FILE_MAX_SIZE) {
ArchiveFeedbackVO feedback = createFeedbackVO(detail, materialType,
......@@ -723,7 +771,6 @@ public class ElectronicArchiveImportServiceImpl implements ElectronicArchiveImpo
// 上传成功,记录附件信息
TAttaInfo attaInfo = uploadResult.getData();
log.info("文件上传成功:{},附件ID:{},domainId:{}", fileName, attaInfo.getId(), attaInfo.getDomainId());
// 记录该人员的资料类型
materialTypes.add(materialType);
......
......@@ -19,11 +19,15 @@ import com.yifu.cloud.plus.v1.batch.service.TElectronicArchiveDetailService;
import com.yifu.cloud.plus.v1.batch.service.TElectronicArchiveTaskService;
import com.yifu.cloud.plus.v1.batch.service.TTaskArchiveRelationService;
import com.yifu.cloud.plus.v1.batch.vo.*;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ClientNameConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.OSSUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.util.bean.OSSObjectBean;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.ArchivesDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -54,6 +58,7 @@ public class TElectronicArchiveDetailServiceImpl extends ServiceImpl<TElectronic
private final TAttaInfoService attaInfoService;
private final TTaskArchiveRelationService relationService;
private final TElectronicArchiveTaskService taskService;
private final ArchivesDaprUtil archivesDaprUtil;
@Autowired
private OSSUtil ossUtil;
......@@ -65,6 +70,8 @@ public class TElectronicArchiveDetailServiceImpl extends ServiceImpl<TElectronic
*/
@Override
public IPage<TElectronicArchiveDetail> getTElectronicArchiveDetailPage(Page<TElectronicArchiveDetail> page, TElectronicArchiveDetailSearchVo tElectronicArchiveDetail){
//权限赋值
initSearchVo(tElectronicArchiveDetail);
return baseMapper.getTElectronicArchiveDetailPage(page,tElectronicArchiveDetail);
}
......@@ -1011,4 +1018,24 @@ public class TElectronicArchiveDetailServiceImpl extends ServiceImpl<TElectronic
}
}
}
public void initSearchVo(TElectronicArchiveDetailSearchVo searchVo) {
YifuUser user = SecurityUtils.getUser();
long roleId = 1839501715787390978L;
boolean isSsc = this.haveRole(user, roleId);
if (isSsc || CommonConstants.ZERO_STRING.equals(user.getSystemFlag())) {
searchVo.setAuthSql(null);
return;
}
}
public boolean haveRole(YifuUser user, long roleId) {
List<Long> roleList = user.getClientRoleMap().get(ClientNameConstants.CLIENT_MVP);
for (Long role : roleList) {
if (role == roleId) {
return true;
}
}
return false;
}
}
......@@ -88,6 +88,9 @@
<if test="tElectronicArchiveDetail.createBy != null and tElectronicArchiveDetail.createBy.trim() != ''">
AND a.CREATE_BY = #{tElectronicArchiveDetail.createBy}
</if>
<if test="tElectronicArchiveDetail.authSql != null and tElectronicArchiveDetail.authSql.trim() != ''">
${tElectronicArchiveDetail.authSql}
</if>
</if>
</sql>
<!--tElectronicArchiveDetail简单分页查询-->
......
......@@ -580,10 +580,12 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
!CommonConstants.ONE_STRING.equals(registration.getProcessStatus()))) {
return R.failed(CommonConstants.NO_DATA_TO_HANDLE);
}
//错误信息
StringBuilder errorTemp = new StringBuilder();
if (preVo.getServerItem().contains("商险") && !preVo.getEmployeeInsurancePreVos().isEmpty()
&& Common.isNotNull(preVo.getInsuranceIsBuy())
&& preVo.getInsuranceIsBuy().equals(CommonConstants.ONE_STRING)) {
List<TEmployeeAutoRegistCheckVo> errorList = new ArrayList<>();
// List<TEmployeeAutoRegistCheckVo> errorList = new ArrayList<>();
TEmployeeAutoRegistCheckVo checkVo;
String key;
// 判断重复性MAP
......@@ -594,23 +596,26 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
if (keyMap.get(key) == null) {
keyMap.put(key, CommonConstants.ONE_INT);
} else {
return R.other(CommonConstants.TWO_INT,null,"保险公司、险种、购买标准、保单起/止日期不可同时重复!");
errorTemp.append("保险公司、险种、购买标准、保单起/止日期不可同时重复;");
// return R.other(CommonConstants.TWO_INT,null,"保险公司、险种、购买标准、保单起/止日期不可同时重复!");
}
insurancePreVo.setEmpIdcard(registration.getEmpIdcard());
insurancePreVo.setDeptNo(registration.getDeptNo());
//商险是否存在判断
checkVo = checkInsuranceExit(insurancePreVo,registration);
if (null != checkVo) {
errorList.add(checkVo);
errorTemp.append("保单开始日期:" + insurancePreVo.getPolicyStart().toString()
+ ",保单结束日期:" + insurancePreVo.getPolicyEnd().toString() + "这条数据存在流程中/已完结的商险数据;");
// errorList.add(checkVo);
} else {
if (Common.isEmpty(insurancePreVo.getProcessStatus())) {
insurancePreVo.setProcessStatus(CommonConstants.ZERO_STRING);
}
}
}
if (!errorList.isEmpty()) {
return R.other(CommonConstants.TWO_INT,null,errorList);
}
// if (!errorList.isEmpty()) {
// return R.other(CommonConstants.TWO_INT,null,errorList);
// }
}
//1.9.12合同自动化校验逻辑
TEmployeeAutoRegistCheckVo cardVo = new TEmployeeAutoRegistCheckVo();
......@@ -623,12 +628,14 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
//是否已签署为是需要判断合同是否在用或者流程中
if (CommonConstants.ZERO_STRING.equals(employeeContractPreVo.getContractFlag()) &&
(Common.isEmpty(flag) || Boolean.TRUE.equals(!flag.getData()))) {
return R.other(CommonConstants.TWO_INT,null,"未找到流程中或者在用的合同!");
errorTemp.append("未找到流程中或者在用的合同;");
// return R.other(CommonConstants.TWO_INT,null,"未找到流程中或者在用的合同!");
}
//是否已签署为否需要判断是否在用或者流程中的合同
if (CommonConstants.ONE_STRING.equals(employeeContractPreVo.getContractFlag()) &&
Common.isNotNull(flag) && Boolean.TRUE.equals(flag.getData())) {
return R.other(CommonConstants.TWO_INT,null,"该项目下存在在途/有效的合同数据,请“是否已签署合同”是否调整为“是”");
errorTemp.append("该项目下存在在途/有效的合同数据,请【是否已签署合同】是否调整为【是】;");
// return R.other(CommonConstants.TWO_INT,null,"该项目下存在在途/有效的合同数据,请“是否已签署合同”是否调整为“是”");
}
}
......@@ -641,7 +648,8 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
preVo.getExitInsuranceInfoList().forEach(e -> e.setCreateTime(null));
boolean isTrue = checkInsuranceIsProcess(preVo);
if (isTrue) {
return R.other(CommonConstants.TWO_INT,null,"带出的商险已购买数据状态或条数发生变更,请重新确认接收!");
errorTemp.append("带出的商险已购买数据状态或条数发生变更,请重新确认;");
// return R.other(CommonConstants.TWO_INT,null,"带出的商险已购买数据状态或条数发生变更,请重新确认接收!");
}
}
......@@ -660,12 +668,14 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
//是否已签署为是需要判断合同是否在用或者流程中
if (CommonConstants.ZERO_STRING.equals(preVo.getSocialIsBuy()) &&
(Common.isEmpty(socialFlag) || Boolean.TRUE.equals(!socialFlag.getData()))) {
return R.other(CommonConstants.TWO_INT,null,"未找到流程中或者在用的社保信息!");
errorTemp.append("未找到流程中或者在用的社保信息;");
// return R.other(CommonConstants.TWO_INT,null,"未找到流程中或者在用的社保信息!");
}
//是否已签署为否需要判断是否在用或者流程中的合同
if (CommonConstants.ONE_STRING.equals(preVo.getSocialIsBuy()) &&
Common.isNotNull(socialFlag) && Boolean.TRUE.equals(socialFlag.getData())) {
return R.other(CommonConstants.TWO_INT,null,"该人员存在在途/有效的社保数据,请将“是否已参保”调整为“是”");
errorTemp.append("该人员存在在途/有效的社保数据,请将【是否已参保】调整为【是】;");
// return R.other(CommonConstants.TWO_INT,null,"该人员存在在途/有效的社保数据,请将“是否已参保”调整为“是”");
}
}
......@@ -676,12 +686,14 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
//是否已签署为是需要判断是否在用或者流程中的公积金
if (CommonConstants.ZERO_STRING.equals(preVo.getFundIsBuy()) &&
(Common.isEmpty(flag) || Boolean.TRUE.equals(!flag.getData()))) {
return R.other(CommonConstants.THREE_INT,null,"未找到流程中或者在用的公积金信息!");
errorTemp.append("未找到流程中或者在用的公积金信息;");
// return R.other(CommonConstants.THREE_INT,null,"未找到流程中或者在用的公积金信息!");
}
// 是否已签署为否需要判断是否在用或者流程中的公积金
if (CommonConstants.ONE_STRING.equals(preVo.getFundIsBuy()) &&
Common.isNotNull(flag) && Boolean.TRUE.equals(flag.getData())) {
return R.other(CommonConstants.THREE_INT,null,"该人员存在在途/有效的公积金数据,请将'是否已参保'调整为'是'");
errorTemp.append("该人员存在在途/有效的公积金数据,请将【是否已参保】调整为【是】;");
// return R.other(CommonConstants.THREE_INT,null,"该人员存在在途/有效的公积金数据,请将'是否已参保'调整为'是'");
}
//判断公积金基数 是否小于 公积金户配置的最低基数
/*if (Common.isNotNull(preVo.getDispatchInfoFundPreVo().getConfigHouseId())
......@@ -699,6 +711,10 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
}*/
}
//错误信息全量返回
if (errorTemp.length() > 0) {
return R.other(CommonConstants.TWO_INT,null,errorTemp.toString());
}
//点击“接收确认”的时候,监测到该人员该项目下已有在项的档案时,再次提醒:该人员已在项,
//状态将更新成“已处理”;处理记录中,针对此情况,记录真实的进项时间,备注:先于登记入项
EmpProjectStatusVo vo = new EmpProjectStatusVo();
......
......@@ -96,7 +96,7 @@ public class TBusinessOperateServiceImpl extends ServiceImpl<TBusinessOperateMap
}
List<TBusinessOperate> backList = new ArrayList<>();
if (!list.isEmpty()) {
backList = list.stream().sorted(Comparator.comparing(TBusinessOperate::getCreateTime)).collect(Collectors.toList());
backList = list.stream().sorted(Comparator.comparing(TBusinessOperate::getCreateTime).reversed()).collect(Collectors.toList());
}
return backList;
}
......
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