Commit 1898706a authored by huyuchen's avatar huyuchen

huyc 项目档案代码提交

parent 10327474
......@@ -219,21 +219,17 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
public R removeProjectInfo(String id) {
TEmployeeProject tEmployeeProject = this.getById(id);
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);
TEmployeeInfo tEmployeeInfoCop = tEmployeeInfoMapper.selectById(tEmployeeInfo.getId());
List<String> idList = new ArrayList<>();
idList.add(id);
//从剩下的项目档案中查找员工类型并更新
setEmpNature(tEmployeeProject.getEmpIdcard(), tEmployeeInfo, idList);
tEmployeeInfoMapper.updateById(tEmployeeInfo);
//更新操作日志
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], tEmployeeInfoCop.getId(), "", tEmployeeInfoCop, tEmployeeInfo);
if (Common.isNotNull(tEmployeeInfo)) {
updList.add(tEmployeeInfo);
doJointTask.doUpdateEmployeeInfo(updList);
}
return R.ok();
}
......@@ -403,7 +399,6 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
for (int i = 0; i < excelVOList.size(); i++) {
EmployeeXProjectVO excel = excelVOList.get(i);
List<TEmployeeProject> idList = new ArrayList<>();
//根据身份证和项目编码获取项目档案
TEmployeeProject tEmployeeProject = this.getOne(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getEmpIdcard, excel.getEmpIdcard())
......@@ -415,7 +410,6 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
if (tEmployeeProject.getInsuranceStatus() != CommonConstants.dingleDigitIntArray[0] || tEmployeeProject.getSocialStatus() != CommonConstants.dingleDigitIntArray[0] ||
tEmployeeProject.getFundStatus() != CommonConstants.dingleDigitIntArray[0]) {
idList.add(tEmployeeProject);
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.ARCHIVES_PROJECT_CHANGE_NOT_EXIST)));
} else {
TEmployeeProject tEmployeeProjectOld = this.getById(tEmployeeProject.getId());
......@@ -430,32 +424,12 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
newOldProject.setNewProjectEmployee(tEmployeeProject);
updateProjectList.add(newOldProject);
//查询该人员所有的项目档案
List<TEmployeeProject> list = this.list(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getEmpIdcard, tEmployeeProject.getEmpIdcard())
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.eq(TEmployeeProject::getProjectStatus, CommonConstants.ZERO_INT));
if (Common.isNotNull(list)) {
for (TEmployeeProject tEmployeeProject1 : list) {
if (!excelVOList.stream().anyMatch(e -> saveCheck(e, tEmployeeProject1))) {
idList.add(tEmployeeProject1);
}
}
}
TEmployeeInfo tEmployeeInfoOld = tEmployeeInfoMapper.selectById(tEmployeeProject.getEmpId());
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectById(tEmployeeProject.getEmpId());
List<String> projectIdList = idList.stream().map(TEmployeeProject::getId).collect(Collectors.toList());
//从剩下的项目档案中查找员工类型并更新
setEmpNature(tEmployeeProject.getEmpIdcard(), tEmployeeInfo, projectIdList);
updList.add(tEmployeeInfo);
newOld = new EmployeeNewOldVO();
newOld.setOldEmployee(tEmployeeInfoOld);
newOld.setNewEmployee(tEmployeeInfo);
updateList.add(newOld);
}
} else {
idList.add(tEmployeeProject);
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.PROJECT_PERSON_SEARCH_EXIT)));
}
}
......@@ -464,7 +438,8 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
} else {
//更新项目档案
if (updProjectList.size() > CommonConstants.dingleDigitIntArray[0]) {
this.updateBatchById(updProjectList);
List<TEmployeeInfo> updEmpInfoList = updList.stream().distinct().collect(Collectors.toList());
doJointTask.doUpdateEmployeeInfo(updEmpInfoList);
}
//更新人员档案
if (updList.size() > CommonConstants.dingleDigitIntArray[0]) {
......@@ -1033,11 +1008,6 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
if (num == CommonConstants.ONE_INT) {
tEmployeeInfo.setProjectNum(tEmployeeInfo.getProjectNum().intValue() + CommonConstants.ONE_INT);
}
if (CommonConstants.ZERO_STRING.equals(tEmployeeInfo.getEmpNatrue())) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ZERO_STRING);
} else if (CommonConstants.ONE_STRING.equals(tEmployeeInfo.getEmpNatrue()) && !CommonConstants.ZERO_STRING.equals(empNature)) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ONE_STRING);
}
updateList.add(tEmployeeInfo);
// 记录变更日志
TEmployeeInfo tEmployeeInfoOld = tEmployeeInfoMapper.selectById(tEmployeeInfo.getId());
......@@ -1139,30 +1109,6 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
return str;
}
//从剩下的项目档案中查找员工类型
public void setEmpNature(String empIdcard, TEmployeeInfo tEmployeeInfo, List<String> idlist) {
if (Common.isNotNull(idlist)) {
List<TEmployeeProject> list = this.list(Wrappers.<TEmployeeProject>query().lambda()
.in(TEmployeeProject::getId, idlist)
.eq(TEmployeeProject::getEmpIdcard, empIdcard)
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.eq(TEmployeeProject::getProjectStatus, CommonConstants.ZERO_INT));
if (Common.isNotNull(list)) {
for (TEmployeeProject t : list) {
if (CommonConstants.ZERO_STRING.equals(t.getEmpNatrue())) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ZERO_STRING);
break;
}
if (CommonConstants.ONE_STRING.equals(t.getEmpNatrue()) && !CommonConstants.ONE_STRING.equals(tEmployeeInfo.getEmpNatrue())) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ONE_STRING);
break;
}
}
}
}
}
public boolean saveCheck(EmployeeXProjectVO employeeXProjectVO, TEmployeeProject tEmployeeProject) {
if (employeeXProjectVO.getDeptNo().equals(tEmployeeProject.getDeptNo()) &&
employeeXProjectVO.getEmpIdcard().equals(tEmployeeProject.getEmpIdcard())) {
......
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