Commit 8174550e authored by huyuchen's avatar huyuchen

huyc 项目档案代码提交

parent 9a3ecece
......@@ -42,14 +42,49 @@ import java.util.Map;
*/
public interface TEmployeeProjectService extends IService<TEmployeeProject> {
/**
* @param tEmployeeProject
* @Description: 新增项目档案校验
* @Author: huyc
* @Date: 2022/6/21 10:30
* @return: R
**/
R addCheck(TEmployeeProject tEmployeeProject);
/**
* @param jsonObject
* @Description: 复档复项相关操作
* @Author: huyc
* @Date: 2022/6/21 10:30
* @return: R
**/
R reEmpInfo(JSONObject jsonObject);
/**
* @param tEmployeeProject
* @Description: 新增项目档案表
* @Author: huyc
* @Date: 2022/6/21 10:30
* @return: R
**/
R saveEmp(TEmployeeProject tEmployeeProject);
/**
* @param tEmployeeProject
* @Description: 修改项目档案表
* @Author: huyc
* @Date: 2022/6/21 10:30
* @return: R
**/
R updateProject(TEmployeeProject tEmployeeProject);
/**
* @param id
* @Description: 通过id删除项目档案
* @Author: huyc
* @Date: 2022/6/21 10:30
* @return: R
**/
R removeProjectInfo(String id);
/**
......
......@@ -157,10 +157,12 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
//查询人员档案
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getEmpIdcard, tEmployeeProject.getEmpIdcard())
.eq(TEmployeeInfo::getDeleteFlag, CommonConstants.STATUS_NORMAL));
.eq(TEmployeeInfo::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.eq(TEmployeeInfo::getFileStatus, CommonConstants.ZERO_INT));
if (Common.isNotNull(tEmployeeInfo)) {
TEmployeeInfo tEmployeeInfoCompare = tEmployeeInfoMapper.selectById(tEmployeeInfo.getId());
String empNO = getEmpNo(tEmployeeProject.getDeptNo());
tEmployeeProject.setEmpNo(empNO);
tEmployeeProject.setEmpId(tEmployeeInfo.getId());
......@@ -174,6 +176,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
}
tEmployeeInfo.setProjectNum(tEmployeeInfo.getProjectNum().intValue() + CommonConstants.ONE_INT);
tEmployeeInfoMapper.updateById(tEmployeeInfo);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], tEmployeeInfoCompare.getId(), "", tEmployeeInfoCompare, tEmployeeInfo);
return R.ok();
}
return R.failed("未在人员档案中查到身份信息");
......@@ -217,16 +220,31 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
@Override
@Transactional
public R removeProjectInfo(String id) {
TEmployeeProject tEmployeeProject = this.getById(id);
//对比对象
TEmployeeProject compareProject = this.getById(id);
if (tEmployeeProject.getInsuranceStatus() != CommonConstants.dingleDigitIntArray[0] || tEmployeeProject.getSocialStatus() != CommonConstants.dingleDigitIntArray[0] ||
tEmployeeProject.getFundStatus() != CommonConstants.dingleDigitIntArray[0]) {
return R.failed("人员在该项目下存在进行中/未完结的服务,禁止删除");
}
//逻辑删除项目档案
tEmployeeProject.setDeleteFlag(CommonConstants.ONE_STRING);
baseMapper.updateById(tEmployeeProject);
//更新操作记录
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1], "", tEmployeeProject.getId(), compareProject, tEmployeeProject);
List<TEmployeeInfo> updList = new ArrayList<>();
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getEmpIdcard, tEmployeeProject.getEmpIdcard())
.eq(TEmployeeInfo::getDeleteFlag, CommonConstants.STATUS_NORMAL));
//删除项目档案
this.removeById(id);
if (Common.isNotNull(tEmployeeInfo)) {
tEmployeeInfo.setProjectNum(tEmployeeInfo.getProjectNum() - CommonConstants.ONE_INT);
updList.add(tEmployeeInfo);
doJointTask.doUpdateEmployeeInfo(updList);
}
......@@ -279,6 +297,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
tEmployeeInfo.setEmpNatrue(CommonConstants.TWO_STRING);
}
}
tEmployeeInfo.setProjectNum(tEmployeeInfo.getProjectNum() + CommonConstants.ONE_INT);
tEmployeeInfoMapper.updateById(tEmployeeInfo);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], tEmployeeInfo.getId(), "", tEmployeeInfoOld, tEmployeeInfo);
}
......@@ -312,6 +331,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
tEmployeeInfo.setEmpNatrue(CommonConstants.TWO_STRING);
}
}
tEmployeeInfo.setProjectNum(CommonConstants.ONE_INT);
tEmployeeInfoMapper.updateById(tEmployeeInfo);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], empId, "", tEmployeeInfoOld, tEmployeeInfo);
}
......@@ -350,19 +370,21 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
}
tEmployeeInfo.setFileStatus(CommonConstants.dingleDigitIntArray[1]);
code = CommonConstants.ONE_STRING;
}
} else {
//从剩下的项目档案中查找员工类型并更新
if (Common.isNotNull(list)) {
Set<String> empNatrue = list.stream().map(TEmployeeProject::getEmpNatrue).collect(Collectors.toSet());
if (empNatrue.stream().anyMatch(e-> e.equals(CommonConstants.ZERO_STRING))) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ZERO_STRING);
} else if (empNatrue.stream().anyMatch(e-> e.equals(CommonConstants.ONE_STRING))){
tEmployeeInfo.setEmpNatrue(CommonConstants.ONE_STRING);
} else {
tEmployeeInfo.setEmpNatrue(CommonConstants.TWO_STRING);
//从剩下的项目档案中查找员工类型并更新
if (Common.isNotNull(list)) {
Set<String> empNatrue = list.stream().map(TEmployeeProject::getEmpNatrue).collect(Collectors.toSet());
if (empNatrue.stream().anyMatch(e -> e.equals(CommonConstants.ZERO_STRING))) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ZERO_STRING);
} else if (empNatrue.stream().anyMatch(e -> e.equals(CommonConstants.ONE_STRING))) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ONE_STRING);
} else {
tEmployeeInfo.setEmpNatrue(CommonConstants.TWO_STRING);
}
}
}
tEmployeeInfo.setProjectNum(tEmployeeInfo.getProjectNum() - CommonConstants.ONE_INT);
tEmployeeInfoMapper.updateById(tEmployeeInfo);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], tEmployeeInfo.getId(), "", tEmployeeInfoOld, tEmployeeInfo);
......@@ -386,10 +408,6 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
List<TEmployeeProject> updProjectList = new ArrayList<>();
//人员档案更新list
List<TEmployeeInfo> updList = new ArrayList<>();
// 新老档案List
List<EmployeeNewOldVO> updateList = new ArrayList<>();
// 新老档案vo
EmployeeNewOldVO newOld;
// 新老项目档案vo
EmployeeProjectNewOldVO newOldProject;
// 新老项目档案List
......@@ -438,23 +456,14 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
} else {
//更新项目档案
if (updProjectList.size() > CommonConstants.dingleDigitIntArray[0]) {
List<TEmployeeInfo> updEmpInfoList = updList.stream().distinct().collect(Collectors.toList());
doJointTask.doUpdateEmployeeInfo(updEmpInfoList);
this.updateBatchById(updProjectList);
}
//更新人员档案
if (updList.size() > CommonConstants.dingleDigitIntArray[0]) {
for (TEmployeeInfo tEmployeeInfo : updList) {
tEmployeeInfoMapper.updateById(tEmployeeInfo);
}
List<TEmployeeInfo> updEmpInfoList = updList.stream().distinct().collect(Collectors.toList());
doJointTask.doUpdateEmployeeInfo(updEmpInfoList);
}
// 记录变更日志
if (updateList.size() > CommonConstants.dingleDigitIntArray[0]) {
for (EmployeeNewOldVO newOldInfo : updateList) {
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0]
, newOldInfo.getOldEmployee().getId(), ""
, newOldInfo.getOldEmployee(), newOldInfo.getNewEmployee());
}
}
if (updateProjectList.size() > CommonConstants.dingleDigitIntArray[0]) {
for (EmployeeProjectNewOldVO newOldVO : updateProjectList) {
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1]
......@@ -884,6 +893,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getEmpIdcard, delProject.getEmpIdcard())
.eq(TEmployeeInfo::getDeleteFlag, CommonConstants.STATUS_NORMAL));
tEmployeeInfo.setProjectNum(tEmployeeInfo.getProjectNum() - CommonConstants.ONE_INT);
infoUpdList.add(tEmployeeInfo);
} else {
errorList.add(new ErrorMessage(i, MsgUtils.getMessage(ErrorCodes.CHECKS_PROJECT_DELETE_ERROR)));
......
......@@ -7,6 +7,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeLogService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeProjectService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
......@@ -52,15 +53,19 @@ public class DoJointTask {
.eq(TEmployeeProject::getEmpIdcard, tEmployeeInfo.getEmpIdcard())
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.eq(TEmployeeProject::getProjectStatus, CommonConstants.ZERO_INT));
Set<String> empNatrue = list.stream().map(TEmployeeProject::getEmpNatrue).collect(Collectors.toSet());
if (empNatrue.stream().anyMatch(e-> e.equals(CommonConstants.ZERO_STRING))) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ZERO_STRING);
} else if (empNatrue.stream().anyMatch(e-> e.equals(CommonConstants.ONE_STRING))){
tEmployeeInfo.setEmpNatrue(CommonConstants.ONE_STRING);
if (Common.isNotNull(list)) {
Set<String> empNatrue = list.stream().map(TEmployeeProject::getEmpNatrue).collect(Collectors.toSet());
if (empNatrue.stream().anyMatch(e -> e.equals(CommonConstants.ZERO_STRING))) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ZERO_STRING);
} else if (empNatrue.stream().anyMatch(e -> e.equals(CommonConstants.ONE_STRING))) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ONE_STRING);
} else {
tEmployeeInfo.setEmpNatrue(CommonConstants.TWO_STRING);
}
tEmployeeInfo.setProjectNum(list.size());
} else {
tEmployeeInfo.setEmpNatrue(CommonConstants.TWO_STRING);
tEmployeeInfo.setProjectNum(CommonConstants.ZERO_INT);
}
tEmployeeInfoService.updateById(tEmployeeInfo);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0]
, tEmployeeInfo.getId(), "", tEmployeeInfoOld, tEmployeeInfo);
......
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