Commit 34592556 authored by huyuchen's avatar huyuchen

优化修改

parent bc75a10c
......@@ -478,8 +478,6 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
//初始化审核类型 审核类型:0派增-社保派单、1派增-无社保新签、2派增-续签、3派减-作废、4派减-终止
initType(tEmployeeContractInfo);
// 标准合同、劳动派遣合同、其他。————社保公积金都派减,自动审核通过
this.judgeAuditStatus(tEmployeeContractInfo, user);
if (Common.isEmpty(tEmployeeContractInfo.getId())) {
// 针对编码再做一次重复性校验
String isCur = baseMapper.getContractByApplyNo(tEmployeeContractInfo.getApplyNo());
......@@ -488,21 +486,30 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
tEmployeeContractInfo.setApplyNo(code);
}
baseMapper.insert(tEmployeeContractInfo);
// 标准合同、劳动派遣合同、其他。————社保公积金都派减,自动审核通过
this.judgeAuditStatus(tEmployeeContractInfo, user);
//如果是否同步终止合同、减项、减档为是则生成同步任务处理清单
//增加任务处理情况查询表数据
if (Common.isNotNull(tEmployeeContractInfo.getChangeContractAndEmployee())
&& CommonConstants.ZERO_STRING.equals(tEmployeeContractInfo.getChangeContractAndEmployee())) {
TWorkHandlerInfo handlerInfo = new TWorkHandlerInfo();
handlerInfo.setEmpIdcard(tEmployeeContractInfo.getEmpIdcard());
handlerInfo.setEmpName(tEmployeeContractInfo.getEmpName());
handlerInfo.setDepartName(tEmployeeContractInfo.getSubjectDepart());
handlerInfo.setDepartNo(tEmployeeContractInfo.getDeptNo());
handlerInfo.setInfoFrom("合同终止");
handlerInfo.setOperUser(user.getNickname());
handlerInfo.setOperTime(LocalDateTime.now());
handlerInfo.setDetailId(tEmployeeContractInfo.getId());
handlerInfo.setOperResult(CommonConstants.ZERO_STRING);
workHandlerInfoService.save(handlerInfo);
TWorkHandlerInfo handlerInfo1 = workHandlerInfoService.getOne(Wrappers.<TWorkHandlerInfo>query()
.lambda().eq(TWorkHandlerInfo::getDetailId, tEmployeeContractInfo.getId())
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isEmpty(handlerInfo1)) {
TWorkHandlerInfo handlerInfo = new TWorkHandlerInfo();
handlerInfo.setEmpIdcard(tEmployeeContractInfo.getEmpIdcard());
handlerInfo.setEmpName(tEmployeeContractInfo.getEmpName());
handlerInfo.setDepartName(tEmployeeContractInfo.getSubjectDepart());
handlerInfo.setDepartNo(tEmployeeContractInfo.getDeptNo());
handlerInfo.setInfoFrom("合同终止");
handlerInfo.setOperUser(user.getNickname());
handlerInfo.setOperTime(LocalDateTime.now());
handlerInfo.setDetailId(tEmployeeContractInfo.getId());
handlerInfo.setOperResult(CommonConstants.ZERO_STRING);
workHandlerInfoService.save(handlerInfo);
}
}
if (Common.isNotNull(tEmployeeContractInfo.getAttaList()) && Common.isNotNull(tEmployeeContractInfo.getId())) {
this.updateFileMainId(tEmployeeContractInfo);
......@@ -743,115 +750,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
if (EmployeeConstants.SITUATION_SEVEN.equals(contractInfo.getSituation())
&& Common.isNotNull(contractInfo.getChangeContractAndEmployee())
&& CommonConstants.ZERO_STRING.equals(contractInfo.getChangeContractAndEmployee())) {
//同步任务处理清单执行详情
StringBuilder workInfo = new StringBuilder();
StringBuilder failueInfo = new StringBuilder();
workInfo.append("合同终止成功,");
//该项目下其他在用的合同统一更新成不在用
List<TEmployeeContractInfo> contractInfoList = baseMapper.selectList(Wrappers.<TEmployeeContractInfo>query()
.lambda().eq(TEmployeeContractInfo::getEmpId, contractInfo.getEmpId())
.eq(TEmployeeContractInfo::getSettleDomain, contractInfo.getSettleDomain())
.eq(TEmployeeContractInfo::getInUse, CommonConstants.ZERO_STRING)
.eq(TEmployeeContractInfo::getDeleteFlag, CommonConstants.ZERO_INT)
.ne(TEmployeeContractInfo::getId, tEmployeeContractInfo.getId()));
if (Common.isNotNull(contractInfoList)) {
for (TEmployeeContractInfo contractInfo1:contractInfoList) {
contractInfo1.setInUse(CommonConstants.ONE_STRING);
contractInfo1.setAuditUserName(user.getNickname());
baseMapper.updateById(contractInfo1);
//增加审核记录
this.setAuditInfoNew(contractInfo1);
}
}
//在途的合同更新为审核不通过
List<TEmployeeContractInfo> contractInfoListZt = baseMapper.selectList(Wrappers.<TEmployeeContractInfo>query()
.lambda().eq(TEmployeeContractInfo::getEmpId, contractInfo.getEmpId())
.eq(TEmployeeContractInfo::getSettleDomain, contractInfo.getSettleDomain())
.and(obj -> obj.eq(TEmployeeContractInfo::getAuditStatus, CommonConstants.ONE_INT)
.or().eq(TEmployeeContractInfo::getAuditStatus, CommonConstants.ZERO_INT))
.ne(TEmployeeContractInfo::getId, contractInfo.getId())
.eq(TEmployeeContractInfo::getDeleteFlag, CommonConstants.ZERO_INT));
if (Common.isNotNull(contractInfoListZt)) {
for (TEmployeeContractInfo contractInfo1:contractInfoListZt) {
contractInfo1.setAuditStatus(CommonConstants.THREE_INT);
contractInfo1.setAuditUserName(user.getNickname());
baseMapper.updateById(contractInfo1);
//增加审核记录
this.setAuditInfoNew(contractInfo1);
}
}
//项目档案处理
TEmployeeProject tEmployeeProject = tEmployeeProjectService.getOne(Wrappers.<TEmployeeProject>query()
.lambda().eq(TEmployeeProject::getEmpId, contractInfo.getEmpId())
.eq(TEmployeeProject::getDeptId, contractInfo.getSettleDomain())
.eq(TEmployeeProject::getProjectStatus, CommonConstants.ZERO_INT)
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.last(CommonConstants.LAST_ONE_SQL));
if (tEmployeeProject != null) {
TEmployeeProject tEmployeeProjectOld = tEmployeeProjectService.getById(tEmployeeProject.getId());
tEmployeeProject.setContractStatus(CommonConstants.TWO_INT);
//如果该项目仍有社保、公积金的数据不同步减项,如正常减项,记录项目档案操作记录
if ((tEmployeeProject.getSocialStatus() == CommonConstants.ZERO_INT
|| tEmployeeProject.getSocialStatus() == CommonConstants.FOUR_INT)
&& (tEmployeeProject.getFundStatus() == CommonConstants.ZERO_INT
|| tEmployeeProject.getFundStatus() == CommonConstants.FOUR_INT)) {
tEmployeeProject.setProjectStatus(CommonConstants.ONE_INT);
tEmployeeProject.setLeaveRemark("终止合同联动减项");
tEmployeeProject.setLeaveTime(LocalDateTime.now());
workInfo.append("减项成功,");
} else {
failueInfo.append("存在社保/公积金,无法减项");
}
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1], "",
tEmployeeProject.getId(), tEmployeeProjectOld, tEmployeeProject);
tEmployeeProjectService.updateById(tEmployeeProject);
//如果项目档案已减项,如果人员存在多个项目不处理,反之则减档
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectById(tEmployeeProject.getEmpId());
if (Common.isNotNull(tEmployeeInfo)) {
TEmployeeInfo tEmployeeInfoOld = tEmployeeInfoMapper.selectById(tEmployeeProject.getEmpId());
// 判断人员有无审核通过的其他合同
TEmployeeContractInfo contractInfoInUse = this.getOne(Wrappers.<TEmployeeContractInfo>query()
.lambda().eq(TEmployeeContractInfo::getEmpId, contractInfo.getEmpId())
.and(obj -> obj.ge(TEmployeeContractInfo::getContractEnd, DateUtil.getThisDayByPatten("yyyy-MM-dd"))
.or().isNull(TEmployeeContractInfo::getContractEnd))
.eq(TEmployeeContractInfo::getInUse, CommonConstants.ZERO_INT)
.eq(TEmployeeContractInfo::getDeleteFlag, CommonConstants.ZERO_INT)
.last(CommonConstants.LAST_ONE_SQL));
if (contractInfoInUse != null) {
tEmployeeInfo.setContractStatus(CommonConstants.ONE_INT);
} else {
tEmployeeInfo.setContractStatus(CommonConstants.TWO_INT);
}
if (tEmployeeProject.getProjectStatus() == CommonConstants.ONE_INT) {
tEmployeeInfo.setProjectNum(tEmployeeInfo.getProjectNum() - CommonConstants.ONE_INT);
//减项成功把人员档案现存项目数减一
if (tEmployeeInfo.getProjectNum() == CommonConstants.ZERO_INT) {
//减档
tEmployeeInfo.setFileStatus(CommonConstants.dingleDigitIntArray[1]);
tEmployeeInfo.setLeaveRemark(tEmployeeProject.getLeaveRemark());
tEmployeeInfo.setLeaveTime(DateUtil.getCurrentDateTime());
tEmployeeInfo.setLeaveUser(user.getId());
tEmployeeInfo.setLeaveUserName(user.getNickname());
workInfo.append("减档成功,");
} else {
failueInfo.append("存在其他项目,无法减档");
}
}
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], tEmployeeInfo.getId(),
"", tEmployeeInfoOld, tEmployeeInfo);
tEmployeeInfoMapper.updateById(tEmployeeInfo);
}
}
//更新任务处理情况数据
TWorkHandlerInfo handlerInfo = workHandlerInfoService.getOne(Wrappers.<TWorkHandlerInfo>query()
.lambda().eq(TWorkHandlerInfo::getDetailId, contractInfo.getId())
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(handlerInfo)) {
handlerInfo.setOperInfo(workInfo.substring(0, workInfo.length() - 1));
handlerInfo.setReason(failueInfo.length() > 1 ? failueInfo.toString() : "");
handlerInfo.setOperResult(failueInfo.length() > 1 ? "1" : "2");
workHandlerInfoService.updateById(handlerInfo);
}
changeStatus(contractInfo,user);
} else {
//先停用项目内的其他的员工合同————不要这个逻辑了
// 2022-7-22 16:54:12 产品倩倩与测试说,作废终止审核通过,仅将原先选择的合同不在用即可
......@@ -1401,11 +1300,14 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
if (socialFundR != null && socialFundR.getData() != null && socialFundR.getData() > 0) {
insert.setAuditStatus(CommonConstants.TWO_INT);
insert.setAuditUserName(user.getNickname());
if (EmployeeConstants.SITUATION_SEVEN.equals(insert.getSituation())
&& Common.isNotNull(insert.getChangeContractAndEmployee())
&& CommonConstants.ZERO_STRING.equals(insert.getChangeContractAndEmployee())) {
changeStatus(insert, user);
}
}
}
}
}
}
/**
......@@ -1960,4 +1862,131 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
}
}
//是否同步终止合同、减项、减档为是的时候 单独写逻辑
public void changeStatus(TEmployeeContractInfo contractInfo,YifuUser user) {
//同步任务处理清单执行详情
StringBuilder workInfo = new StringBuilder();
StringBuilder failueInfo = new StringBuilder();
workInfo.append("合同终止成功,");
//该项目下其他在用的合同统一更新成不在用
List<TEmployeeContractInfo> contractInfoList = baseMapper.selectList(Wrappers.<TEmployeeContractInfo>query()
.lambda().eq(TEmployeeContractInfo::getEmpId, contractInfo.getEmpId())
.eq(TEmployeeContractInfo::getSettleDomain, contractInfo.getSettleDomain())
.eq(TEmployeeContractInfo::getInUse, CommonConstants.ZERO_STRING)
.eq(TEmployeeContractInfo::getDeleteFlag, CommonConstants.ZERO_INT)
.ne(TEmployeeContractInfo::getId, contractInfo.getId()));
if (Common.isNotNull(contractInfoList)) {
for (TEmployeeContractInfo contractInfo1 : contractInfoList) {
contractInfo1.setInUse(CommonConstants.ONE_STRING);
contractInfo1.setAuditUserName(user.getNickname());
baseMapper.updateById(contractInfo1);
//增加审核记录
this.setAuditInfoNew(contractInfo1);
}
}
//在途的合同更新为审核不通过
List<TEmployeeContractInfo> contractInfoListZt = baseMapper.selectList(Wrappers.<TEmployeeContractInfo>query()
.lambda().eq(TEmployeeContractInfo::getEmpId, contractInfo.getEmpId())
.eq(TEmployeeContractInfo::getSettleDomain, contractInfo.getSettleDomain())
.and(obj -> obj.eq(TEmployeeContractInfo::getAuditStatus, CommonConstants.ONE_INT)
.or().eq(TEmployeeContractInfo::getAuditStatus, CommonConstants.ZERO_INT))
.ne(TEmployeeContractInfo::getId, contractInfo.getId())
.eq(TEmployeeContractInfo::getDeleteFlag, CommonConstants.ZERO_INT));
if (Common.isNotNull(contractInfoListZt)) {
for (TEmployeeContractInfo contractInfo1 : contractInfoListZt) {
contractInfo1.setAuditStatus(CommonConstants.THREE_INT);
contractInfo1.setAuditUserName(user.getNickname());
baseMapper.updateById(contractInfo1);
//增加审核记录
this.setAuditInfoNew(contractInfo1);
}
}
//项目档案处理
TEmployeeProject tEmployeeProject = tEmployeeProjectService.getOne(Wrappers.<TEmployeeProject>query()
.lambda().eq(TEmployeeProject::getEmpId, contractInfo.getEmpId())
.eq(TEmployeeProject::getDeptId, contractInfo.getSettleDomain())
.eq(TEmployeeProject::getProjectStatus, CommonConstants.ZERO_INT)
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.last(CommonConstants.LAST_ONE_SQL));
if (tEmployeeProject != null) {
TEmployeeProject tEmployeeProjectOld = tEmployeeProjectService.getById(tEmployeeProject.getId());
tEmployeeProject.setContractStatus(CommonConstants.TWO_INT);
//如果该项目仍有社保、公积金的数据不同步减项,如正常减项,记录项目档案操作记录
if ((tEmployeeProject.getSocialStatus() == CommonConstants.ZERO_INT
|| tEmployeeProject.getSocialStatus() == CommonConstants.FOUR_INT)
&& (tEmployeeProject.getFundStatus() == CommonConstants.ZERO_INT
|| tEmployeeProject.getFundStatus() == CommonConstants.FOUR_INT)) {
tEmployeeProject.setProjectStatus(CommonConstants.ONE_INT);
tEmployeeProject.setLeaveRemark("终止合同联动减项");
tEmployeeProject.setLeaveTime(LocalDateTime.now());
workInfo.append("减项成功,");
} else {
failueInfo.append("存在社保/公积金,无法减项");
}
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1], "",
tEmployeeProject.getId(), tEmployeeProjectOld, tEmployeeProject);
tEmployeeProjectService.updateById(tEmployeeProject);
//如果项目档案已减项,如果人员存在多个项目不处理,反之则减档
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectById(tEmployeeProject.getEmpId());
if (Common.isNotNull(tEmployeeInfo)) {
TEmployeeInfo tEmployeeInfoOld = tEmployeeInfoMapper.selectById(tEmployeeProject.getEmpId());
// 判断人员有无审核通过的其他合同
TEmployeeContractInfo contractInfoInUse = this.getOne(Wrappers.<TEmployeeContractInfo>query()
.lambda().eq(TEmployeeContractInfo::getEmpId, contractInfo.getEmpId())
.and(obj -> obj.ge(TEmployeeContractInfo::getContractEnd, DateUtil.getThisDayByPatten("yyyy-MM-dd"))
.or().isNull(TEmployeeContractInfo::getContractEnd))
.eq(TEmployeeContractInfo::getInUse, CommonConstants.ZERO_INT)
.eq(TEmployeeContractInfo::getDeleteFlag, CommonConstants.ZERO_INT)
.last(CommonConstants.LAST_ONE_SQL));
if (contractInfoInUse != null) {
tEmployeeInfo.setContractStatus(CommonConstants.ONE_INT);
} else {
tEmployeeInfo.setContractStatus(CommonConstants.TWO_INT);
}
if (tEmployeeProject.getProjectStatus() == CommonConstants.ONE_INT) {
tEmployeeInfo.setProjectNum(tEmployeeInfo.getProjectNum() - CommonConstants.ONE_INT);
//减项成功把人员档案现存项目数减一
if (tEmployeeInfo.getProjectNum() == CommonConstants.ZERO_INT) {
//减档
tEmployeeInfo.setFileStatus(CommonConstants.dingleDigitIntArray[1]);
tEmployeeInfo.setLeaveRemark(tEmployeeProject.getLeaveRemark());
tEmployeeInfo.setLeaveTime(DateUtil.getCurrentDateTime());
tEmployeeInfo.setLeaveUser(user.getId());
tEmployeeInfo.setLeaveUserName(user.getNickname());
workInfo.append("减档成功,");
} else {
failueInfo.append("存在其他项目,无法减档");
}
}
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], tEmployeeInfo.getId(),
"", tEmployeeInfoOld, tEmployeeInfo);
tEmployeeInfoMapper.updateById(tEmployeeInfo);
}
}
//更新任务处理情况数据
TWorkHandlerInfo handlerInfo1 = workHandlerInfoService.getOne(Wrappers.<TWorkHandlerInfo>query()
.lambda().eq(TWorkHandlerInfo::getDetailId, contractInfo.getId())
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(handlerInfo1)) {
handlerInfo1.setOperInfo(workInfo.substring(0, workInfo.length() - 1));
handlerInfo1.setReason(failueInfo.length() > 1 ? failueInfo.toString() : "");
handlerInfo1.setOperResult(failueInfo.length() > 1 ? "1" : "2");
workHandlerInfoService.updateById(handlerInfo1);
} else {
TWorkHandlerInfo handlerInfo = new TWorkHandlerInfo();
handlerInfo.setEmpIdcard(contractInfo.getEmpIdcard());
handlerInfo.setEmpName(contractInfo.getEmpName());
handlerInfo.setDepartName(contractInfo.getSubjectDepart());
handlerInfo.setDepartNo(contractInfo.getDeptNo());
handlerInfo.setInfoFrom("合同终止");
handlerInfo.setOperUser(user.getNickname());
handlerInfo.setOperTime(LocalDateTime.now());
handlerInfo.setDetailId(contractInfo.getId());
handlerInfo.setOperInfo(workInfo.substring(0, workInfo.length() - 1));
handlerInfo.setReason(failueInfo.length() > 1 ? failueInfo.toString() : "");
handlerInfo.setOperResult(failueInfo.length() > 1 ? "1" : "2");
workHandlerInfoService.save(handlerInfo);
}
}
}
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