Commit 4800c3a1 authored by fangxinjiang's avatar fangxinjiang

MVP1.2:项目档案-减档逻辑调整

parent 413d02a4
...@@ -366,6 +366,9 @@ public class TEmployeeProject extends BaseEntity { ...@@ -366,6 +366,9 @@ public class TEmployeeProject extends BaseEntity {
/** /**
* 员工合同状态(字典) * 员工合同状态(字典)
* 0 无合同
* 2 不在用
* 1 在用
*/ */
@Schema(description = "员工合同状态(字典)0初始状态") @Schema(description = "员工合同状态(字典)0初始状态")
@ExcelAttribute(name = "合同状态", isDataId = true,dataType = ExcelAttributeConstants.PERSONNEL_STATE) @ExcelAttribute(name = "合同状态", isDataId = true,dataType = ExcelAttributeConstants.PERSONNEL_STATE)
......
...@@ -31,9 +31,11 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; ...@@ -31,9 +31,11 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.constants.EmployeeConstants; import com.yifu.cloud.plus.v1.yifu.archives.constants.EmployeeConstants;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain; import com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeContractInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeInfoMapper; import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeProjectMapper; import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeProjectMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeLogService; import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeLogService;
...@@ -87,6 +89,9 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -87,6 +89,9 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
@Autowired @Autowired
private TSettleDomainService tSettleDomainService; private TSettleDomainService tSettleDomainService;
@Autowired
private TEmployeeContractInfoMapper contractInfoMapper;
@Autowired @Autowired
@Lazy @Lazy
private DoJointTask doJointTask; private DoJointTask doJointTask;
...@@ -389,10 +394,23 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -389,10 +394,23 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
TEmployeeProject tEmployeeProjectOld = this.getById(tEmployeeProject.getId()); TEmployeeProject tEmployeeProjectOld = this.getById(tEmployeeProject.getId());
String code = ""; String code = "";
if (CommonConstants.ONE_INT == tEmployeeProject.getSocialStatus() if (CommonConstants.ONE_INT == tEmployeeProject.getSocialStatus()
|| CommonConstants.ONE_INT == tEmployeeProject.getFundStatus() || CommonConstants.ONE_INT == tEmployeeProject.getFundStatus()) {
|| CommonConstants.ZERO_INT != tEmployeeProject.getInsuranceStatus()) {
return R.failed("人员在该项目下存在进行中/未完结的服务"); return R.failed("人员在该项目下存在进行中/未完结的服务");
} }
// 未作废,在用 或 审核中
long contractCount = contractInfoMapper.selectCount(Wrappers.<TEmployeeContractInfo>query().lambda()
.eq(TEmployeeContractInfo::getEmpIdcard,tEmployeeProject.getEmpIdcard())
.eq(TEmployeeContractInfo::getIsObsolete,CommonConstants.ZERO_STRING)
.eq(TEmployeeContractInfo::getDeleteFlag,CommonConstants.ZERO_STRING)
.and(obj->obj.eq(TEmployeeContractInfo::getInUse,CommonConstants.ZERO_STRING))
.or()
.eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.ZERO_STRING)
.or()
.eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.ONE_STRING)
);
if (contractCount > CommonConstants.ZERO_INT){
return R.failed(ErrorCodes.ARCHIVES_PROJECT_CHANGE_CONTRACT_EXIST);
}
tEmployeeProject.setProjectStatus(CommonConstants.dingleDigitIntArray[1]); tEmployeeProject.setProjectStatus(CommonConstants.dingleDigitIntArray[1]);
tEmployeeProject.setLeaveTime(LocalDateTime.now()); tEmployeeProject.setLeaveTime(LocalDateTime.now());
this.updateById(tEmployeeProject); this.updateById(tEmployeeProject);
...@@ -530,6 +548,8 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -530,6 +548,8 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
TEmployeeProject tEmployeeProject; TEmployeeProject tEmployeeProject;
TEmployeeInfo tEmployeeInfo; TEmployeeInfo tEmployeeInfo;
TEmployeeProject tEmployeeProjectOld; TEmployeeProject tEmployeeProjectOld;
// 在途和在用合同数目
long contractCount;
// 执行数据插入操作 组装 PostDto // 执行数据插入操作 组装 PostDto
for (EmployeeXProjectVO excel : excelVOList) { for (EmployeeXProjectVO excel : excelVOList) {
//根据身份证和项目编码获取项目档案 //根据身份证和项目编码获取项目档案
...@@ -557,29 +577,43 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -557,29 +577,43 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
errorMessage.append(";"); errorMessage.append(";");
} }
if (Common.isNotNull(tEmployeeProject)) { if (Common.isNotNull(tEmployeeProject)) {
if (tEmployeeProject.getInsuranceStatus() != CommonConstants.dingleDigitIntArray[0] || if (tEmployeeProject.getSocialStatus() == CommonConstants.dingleDigitIntArray[1] ||
tEmployeeProject.getSocialStatus() == CommonConstants.dingleDigitIntArray[1] ||
tEmployeeProject.getFundStatus() == CommonConstants.dingleDigitIntArray[1]) { tEmployeeProject.getFundStatus() == CommonConstants.dingleDigitIntArray[1]) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), errorMessage + errorMessageList.add(new ErrorMessage(excel.getRowIndex(), errorMessage +
MsgUtils.getMessage(ErrorCodes.ARCHIVES_PROJECT_CHANGE_NOT_EXIST))); MsgUtils.getMessage(ErrorCodes.ARCHIVES_PROJECT_CHANGE_NOT_EXIST)));
} else { break;
tEmployeeProjectOld = this.getById(tEmployeeProject.getId());
tEmployeeProject.setProjectStatus(CommonConstants.dingleDigitIntArray[1]);
tEmployeeProject.setLeaveReason(excel.getLeaveReason());
tEmployeeProject.setLeaveRemark(excel.getLeaveRemark());
tEmployeeProject.setLeaveTime(LocalDateTime.now());
updProjectList.add(tEmployeeProject);
newOldProject = new EmployeeProjectNewOldVO();
newOldProject.setOldProjectEmployee(tEmployeeProjectOld);
newOldProject.setNewProjectEmployee(tEmployeeProject);
updateProjectList.add(newOldProject);
tEmployeeInfo = tEmployeeInfoMapper.selectById(tEmployeeProject.getEmpId());
//从剩下的项目档案中查找员工类型并更新
updList.add(tEmployeeInfo);
} }
// 未作废,在用 或 审核中
contractCount = contractInfoMapper.selectCount(Wrappers.<TEmployeeContractInfo>query().lambda()
.eq(TEmployeeContractInfo::getEmpIdcard,tEmployeeProject.getEmpIdcard())
.eq(TEmployeeContractInfo::getIsObsolete,CommonConstants.ZERO_STRING)
.eq(TEmployeeContractInfo::getDeleteFlag,CommonConstants.ZERO_STRING)
.and(obj->obj.eq(TEmployeeContractInfo::getInUse,CommonConstants.ZERO_STRING))
.or()
.eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.ZERO_STRING)
.or()
.eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.ONE_STRING)
);
if (contractCount > CommonConstants.ZERO_INT){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), errorMessage +
MsgUtils.getMessage(ErrorCodes.ARCHIVES_PROJECT_CHANGE_CONTRACT_EXIST)));
break;
}
tEmployeeProjectOld = this.getById(tEmployeeProject.getId());
tEmployeeProject.setProjectStatus(CommonConstants.dingleDigitIntArray[1]);
tEmployeeProject.setLeaveReason(excel.getLeaveReason());
tEmployeeProject.setLeaveRemark(excel.getLeaveRemark());
tEmployeeProject.setLeaveTime(LocalDateTime.now());
updProjectList.add(tEmployeeProject);
newOldProject = new EmployeeProjectNewOldVO();
newOldProject.setOldProjectEmployee(tEmployeeProjectOld);
newOldProject.setNewProjectEmployee(tEmployeeProject);
updateProjectList.add(newOldProject);
tEmployeeInfo = tEmployeeInfoMapper.selectById(tEmployeeProject.getEmpId());
//从剩下的项目档案中查找员工类型并更新
updList.add(tEmployeeInfo);
} else { } else {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), errorMessage + errorMessageList.add(new ErrorMessage(excel.getRowIndex(), errorMessage +
MsgUtils.getMessage(ErrorCodes.PROJECT_PERSON_SEARCH_EXIT))); MsgUtils.getMessage(ErrorCodes.PROJECT_PERSON_SEARCH_EXIT)));
......
...@@ -299,6 +299,10 @@ public interface ErrorCodes { ...@@ -299,6 +299,10 @@ public interface ErrorCodes {
* 人员在该项目下存在进行中/未完结的服务 * 人员在该项目下存在进行中/未完结的服务
*/ */
String ARCHIVES_PROJECT_CHANGE_NOT_EXIST = "archives.project.change.not.exist"; String ARCHIVES_PROJECT_CHANGE_NOT_EXIST = "archives.project.change.not.exist";
/**
* 人员在该项目下存在存在在用或待审核、待提交的合同,不允许减项
*/
String ARCHIVES_PROJECT_CHANGE_CONTRACT_EXIST = "archives.project.change.contract.exist";
/** /**
* 人员在原项目中存在在途的服务,请先终止后,再进行划转 * 人员在原项目中存在在途的服务,请先终止后,再进行划转
*/ */
......
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