Commit aaa17af0 authored by huyuchen's avatar huyuchen

huyc 项目档案代码提交

parent 7f513c12
...@@ -83,7 +83,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -83,7 +83,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
@Override @Override
public R addCheck(TEmployeeProject tEmployeeProject) { public R addCheck(TEmployeeProject tEmployeeProject) {
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
//身份证系统中是否已有 //身份证系统中是否已有
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda() TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda()
...@@ -92,9 +92,9 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -92,9 +92,9 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
//项目下已有身份证信息 //项目下已有身份证信息
TEmployeeProject employeeProject = this.getOne(Wrappers.<TEmployeeProject>query().lambda() TEmployeeProject employeeProject = this.getOne(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getEmpIdcard,tEmployeeProject.getEmpIdcard()) .eq(TEmployeeProject::getEmpIdcard, tEmployeeProject.getEmpIdcard())
.eq(TEmployeeProject::getDeptNo,tEmployeeProject.getDeptNo()) .eq(TEmployeeProject::getDeptNo, tEmployeeProject.getDeptNo())
.eq(TEmployeeProject::getDeleteFlag,CommonConstants.STATUS_NORMAL)); .eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL));
if (!Common.isEmpty(employeeProject)) { if (!Common.isEmpty(employeeProject)) {
//身份证实名认证 //身份证实名认证
...@@ -105,9 +105,9 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -105,9 +105,9 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
} }
//项目编码校验 //项目编码校验
TSettleDomain tSettleDomain = tSettleDomainService.getOne(Wrappers.<TSettleDomain>query().lambda() TSettleDomain tSettleDomain = tSettleDomainService.getOne(Wrappers.<TSettleDomain>query().lambda()
.eq(TSettleDomain::getDepartNo,tEmployeeProject.getDeptNo()) .eq(TSettleDomain::getDepartNo, tEmployeeProject.getDeptNo())
.eq(TSettleDomain::getStopFlag,CommonConstants.ZERO_STRING) .eq(TSettleDomain::getStopFlag, CommonConstants.ZERO_STRING)
.eq(TSettleDomain::getDeleteFlag,CommonConstants.ZERO_STRING)); .eq(TSettleDomain::getDeleteFlag, CommonConstants.ZERO_STRING));
if (Common.isEmpty(tSettleDomain)) { if (Common.isEmpty(tSettleDomain)) {
return R.failed("未找到对应的项目,请核实"); return R.failed("未找到对应的项目,请核实");
} }
...@@ -115,12 +115,12 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -115,12 +115,12 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
//项目状态为已减项 //项目状态为已减项
if (CommonConstants.dingleDigitIntArray[1] == employeeProject.getProjectStatus()) { if (CommonConstants.dingleDigitIntArray[1] == employeeProject.getProjectStatus()) {
if (!Common.isEmpty(tEmployeeInfo)) { if (!Common.isEmpty(tEmployeeInfo)) {
map.put("empProId",employeeProject.getId()); map.put("empProId", employeeProject.getId());
if (CommonConstants.dingleDigitIntArray[0] == tEmployeeInfo.getFileStatus()) { if (CommonConstants.dingleDigitIntArray[0] == tEmployeeInfo.getFileStatus()) {
return new R<>(CommonConstants.dingleDigitIntArray[4],"该人员已减项,是否“复项”",map); return new R<>(CommonConstants.dingleDigitIntArray[4], "该人员已减项,是否“复项”", map);
} else { } else {
map.put("employeeId", tEmployeeInfo.getId()); map.put("employeeId", tEmployeeInfo.getId());
return new R<>(CommonConstants.dingleDigitIntArray[2],"该人员已减档减项,是否“复档复项”",map); return new R<>(CommonConstants.dingleDigitIntArray[2], "该人员已减档减项,是否“复档复项”", map);
} }
} }
} }
...@@ -136,7 +136,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -136,7 +136,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
//判断是否已经减档 //判断是否已经减档
if (tEmployeeInfo.getFileStatus() == CommonConstants.dingleDigitIntArray[1]) { if (tEmployeeInfo.getFileStatus() == CommonConstants.dingleDigitIntArray[1]) {
map.put("employeeId", tEmployeeInfo.getId()); map.put("employeeId", tEmployeeInfo.getId());
return new R<>(CommonConstants.dingleDigitIntArray[3],"该人员在离职库已存在,是否“恢复档案”",map); return new R<>(CommonConstants.dingleDigitIntArray[3], "该人员在离职库已存在,是否“恢复档案”", map);
} }
} }
return R.ok(); return R.ok();
...@@ -159,7 +159,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -159,7 +159,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
if (CommonConstants.ZERO_STRING.equals(tEmployeeProject.getEmpNatrue())) { if (CommonConstants.ZERO_STRING.equals(tEmployeeProject.getEmpNatrue())) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ZERO_STRING); tEmployeeInfo.setEmpNatrue(CommonConstants.ZERO_STRING);
}else if (CommonConstants.ONE_STRING.equals(tEmployeeProject.getEmpNatrue()) && !CommonConstants.ZERO_STRING.equals(tEmployeeInfo.getEmpNatrue())) { } else if (CommonConstants.ONE_STRING.equals(tEmployeeProject.getEmpNatrue()) && !CommonConstants.ZERO_STRING.equals(tEmployeeInfo.getEmpNatrue())) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ONE_STRING); tEmployeeInfo.setEmpNatrue(CommonConstants.ONE_STRING);
} }
tEmployeeInfo.setProjectNum(tEmployeeInfo.getProjectNum().intValue() + CommonConstants.ONE_INT); tEmployeeInfo.setProjectNum(tEmployeeInfo.getProjectNum().intValue() + CommonConstants.ONE_INT);
...@@ -178,15 +178,15 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -178,15 +178,15 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
.eq(TEmployeeInfo::getDeleteFlag, CommonConstants.STATUS_NORMAL)); .eq(TEmployeeInfo::getDeleteFlag, CommonConstants.STATUS_NORMAL));
if (Common.isNotNull(tEmployeeInfo)) { if (Common.isNotNull(tEmployeeInfo)) {
TEmployeeInfo tEmployeeInfoCompare = tEmployeeInfoMapper.selectById(tEmployeeInfo.getId()); TEmployeeInfo tEmployeeInfoCompare = tEmployeeInfoMapper.selectById(tEmployeeInfo.getId());
if (CommonConstants.ZERO_STRING.equals(tEmployeeInfo.getEmpNatrue())) { if (CommonConstants.ZERO_STRING.equals(tEmployeeProject.getEmpNatrue())) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ZERO_STRING); tEmployeeInfo.setEmpNatrue(CommonConstants.ZERO_STRING);
} else if (CommonConstants.ONE_STRING.equals(tEmployeeInfo.getEmpNatrue()) && !CommonConstants.ZERO_STRING.equals(tEmployeeInfo.getEmpNatrue())) { } else if (CommonConstants.ONE_STRING.equals(tEmployeeProject.getEmpNatrue()) && !CommonConstants.ZERO_STRING.equals(tEmployeeInfo.getEmpNatrue())) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ONE_STRING); tEmployeeInfo.setEmpNatrue(CommonConstants.ONE_STRING);
} }
tEmployeeInfoMapper.updateById(tEmployeeInfo); tEmployeeInfoMapper.updateById(tEmployeeInfo);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1], tEmployeeInfoCompare.getId(), "", tEmployeeInfoCompare, tEmployeeInfo); tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], tEmployeeInfoCompare.getId(), "", tEmployeeInfoCompare, tEmployeeInfo);
} }
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1],"",tEmployeeProject.getId(),compareProject,tEmployeeProject); tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1], "", tEmployeeProject.getId(), compareProject, tEmployeeProject);
return R.ok(flag); return R.ok(flag);
} }
...@@ -199,23 +199,15 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -199,23 +199,15 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
.eq(TEmployeeInfo::getDeleteFlag, CommonConstants.STATUS_NORMAL)); .eq(TEmployeeInfo::getDeleteFlag, CommonConstants.STATUS_NORMAL));
//删除项目档案 //删除项目档案
this.removeById(id); this.removeById(id);
//从剩下的项目档案中查找员工类型
List<TEmployeeProject> list = this.list(Wrappers.<TEmployeeProject>query().lambda() TEmployeeInfo tEmployeeInfoCop = tEmployeeInfoMapper.selectById(tEmployeeInfo.getId());
.eq(TEmployeeProject::getEmpIdcard, tEmployeeProject.getEmpIdcard())
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL)); //从剩下的项目档案中查找员工类型并更新
if (Common.isNotNull(list)) { setEmpNature(tEmployeeProject.getEmpIdcard(),tEmployeeInfo);
for (TEmployeeProject t :list) { tEmployeeInfoMapper.updateById(tEmployeeInfo);
if (CommonConstants.ZERO_STRING.equals(t.getEmpNatrue())) { //更新操作日志
tEmployeeInfo.setEmpNatrue(CommonConstants.ZERO_STRING); tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], tEmployeeInfoCop.getId(), "", tEmployeeInfoCop, tEmployeeInfo);
break;
}
if (CommonConstants.ONE_STRING.equals(t.getEmpNatrue()) && !CommonConstants.ONE_STRING.equals(tEmployeeInfo.getEmpNatrue())) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ONE_STRING);
break;
}
}
tEmployeeInfoMapper.updateById(tEmployeeInfo);
}
return R.ok(); return R.ok();
} }
...@@ -231,13 +223,13 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -231,13 +223,13 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectById(empId); TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectById(empId);
tEmployeeInfo.setFileStatus(CommonConstants.dingleDigitIntArray[0]); tEmployeeInfo.setFileStatus(CommonConstants.dingleDigitIntArray[0]);
tEmployeeInfoMapper.updateById(tEmployeeInfo); tEmployeeInfoMapper.updateById(tEmployeeInfo);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0],empId,"",tEmployeeInfoOld,tEmployeeInfo); tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], empId, "", tEmployeeInfoOld, tEmployeeInfo);
} else if (Common.isEmpty(empId) && !Common.isEmpty(empProId)) { } else if (Common.isEmpty(empId) && !Common.isEmpty(empProId)) {
//复项 //复项
TEmployeeProject tEmployeeProject = this.getById(empProId); TEmployeeProject tEmployeeProject = this.getById(empProId);
tEmployeeProject.setProjectStatus(CommonConstants.dingleDigitIntArray[0]); tEmployeeProject.setProjectStatus(CommonConstants.dingleDigitIntArray[0]);
this.updateById(tEmployeeProject); this.updateById(tEmployeeProject);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1],"",empProId,tEmployeeProjectOld,tEmployeeProject); tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1], "", empProId, tEmployeeProjectOld, tEmployeeProject);
} else { } else {
//复档复项 //复档复项
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectById(empId); TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectById(empId);
...@@ -246,8 +238,8 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -246,8 +238,8 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
tEmployeeInfoMapper.updateById(tEmployeeInfo); tEmployeeInfoMapper.updateById(tEmployeeInfo);
tEmployeeProject.setProjectStatus(CommonConstants.dingleDigitIntArray[0]); tEmployeeProject.setProjectStatus(CommonConstants.dingleDigitIntArray[0]);
this.updateById(tEmployeeProject); this.updateById(tEmployeeProject);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1],"",empProId,tEmployeeProjectOld,tEmployeeProject); tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1], "", empProId, tEmployeeProjectOld, tEmployeeProject);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0],empId,"",tEmployeeInfoOld,tEmployeeInfo); tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], empId, "", tEmployeeInfoOld, tEmployeeInfo);
} }
} else { } else {
return R.failed("传参为空!"); return R.failed("传参为空!");
...@@ -258,10 +250,10 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -258,10 +250,10 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
@Override @Override
public R deleteEmpPro(TEmployeeProject tEmployeeProject) { public R deleteEmpPro(TEmployeeProject tEmployeeProject) {
Long count = this.count(Wrappers.<TEmployeeProject>query().lambda() Long count = this.count(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getId,tEmployeeProject.getId()) .eq(TEmployeeProject::getId, tEmployeeProject.getId())
.eq(TEmployeeProject::getInsuranceStatus,CommonConstants.dingleDigitIntArray[0]) .eq(TEmployeeProject::getInsuranceStatus, CommonConstants.dingleDigitIntArray[0])
.eq(TEmployeeProject::getSocialStatus,CommonConstants.dingleDigitIntArray[0]) .eq(TEmployeeProject::getSocialStatus, CommonConstants.dingleDigitIntArray[0])
.eq(TEmployeeProject::getFundStatus,CommonConstants.dingleDigitIntArray[0])); .eq(TEmployeeProject::getFundStatus, CommonConstants.dingleDigitIntArray[0]));
if (count == CommonConstants.ONE_INT) { if (count == CommonConstants.ONE_INT) {
TEmployeeInfo tEmployeeInfoOld = tEmployeeInfoMapper.selectById(tEmployeeProject.getEmpId()); TEmployeeInfo tEmployeeInfoOld = tEmployeeInfoMapper.selectById(tEmployeeProject.getEmpId());
TEmployeeProject tEmployeeProjectOld = this.getById(tEmployeeProject.getId()); TEmployeeProject tEmployeeProjectOld = this.getById(tEmployeeProject.getId());
...@@ -270,17 +262,22 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -270,17 +262,22 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectById(tEmployeeProject.getEmpId()); TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectById(tEmployeeProject.getEmpId());
if (tEmployeeProject.getIsLeaveEmployee() == CommonConstants.dingleDigitIntArray[1]) { if (tEmployeeProject.getIsLeaveEmployee() == CommonConstants.dingleDigitIntArray[1]) {
tEmployeeInfo.setFileStatus(CommonConstants.dingleDigitIntArray[1]); tEmployeeInfo.setFileStatus(CommonConstants.dingleDigitIntArray[1]);
tEmployeeInfoMapper.updateById(tEmployeeInfo);
code = CommonConstants.ONE_STRING; code = CommonConstants.ONE_STRING;
} }
//从剩下的项目档案中查找员工类型并更新
setEmpNature(tEmployeeProject.getEmpIdcard(),tEmployeeInfo);
tEmployeeInfoMapper.updateById(tEmployeeInfo);
tEmployeeProject.setProjectStatus(CommonConstants.dingleDigitIntArray[1]); tEmployeeProject.setProjectStatus(CommonConstants.dingleDigitIntArray[1]);
this.updateById(tEmployeeProject); this.updateById(tEmployeeProject);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], tEmployeeInfo.getId(), "", tEmployeeProjectOld, tEmployeeInfo); tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], tEmployeeInfo.getId(), "", tEmployeeProjectOld, tEmployeeInfo);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1], "", tEmployeeProject.getId(), tEmployeeInfoOld, tEmployeeProject); tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1], "", tEmployeeProject.getId(), tEmployeeInfoOld, tEmployeeProject);
if (CommonConstants.ONE_STRING.equals(code)) { if (CommonConstants.ONE_STRING.equals(code)) {
return R.ok(null,"减项减档成功"); return R.ok(null, "减项减档成功");
} else { } else {
return R.ok(null,"减项成功,项目状态已更新为“已减项”"); return R.ok(null, "减项成功,项目状态已更新为“已减项”");
} }
} }
} }
...@@ -310,29 +307,32 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -310,29 +307,32 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
.eq(TEmployeeProject::getEmpId, tEmployeeProject.getEmpId()) .eq(TEmployeeProject::getEmpId, tEmployeeProject.getEmpId())
.eq(TEmployeeProject::getProjectStatus, CommonConstants.dingleDigitIntArray[0])); .eq(TEmployeeProject::getProjectStatus, CommonConstants.dingleDigitIntArray[0]));
if (count.compareTo(CommonConstants.DEPT_TREE_ROOT_ID) > 0) { if (count.compareTo(CommonConstants.DEPT_TREE_ROOT_ID) > 0) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(),MsgUtils.getMessage(ErrorCodes.ARCHIVES_PROJECT_CHANGE_NOT_EXIST))); errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.ARCHIVES_PROJECT_CHANGE_NOT_EXIST)));
} }
tEmployeeInfo.setFileStatus(CommonConstants.dingleDigitIntArray[1]); tEmployeeInfo.setFileStatus(CommonConstants.dingleDigitIntArray[1]);
tEmployeeInfo.setLeaveReason(excel.getLeaveReason()); tEmployeeInfo.setLeaveReason(excel.getLeaveReason());
tEmployeeInfo.setLeaveRemark(excel.getLeaveRemark()); tEmployeeInfo.setLeaveRemark(excel.getLeaveRemark());
tEmployeeInfoMapper.updateById(tEmployeeInfo);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], tEmployeeInfo.getId(), "", tEmployeeProjectOld, tEmployeeInfo);
} }
tEmployeeProject.setProjectStatus(CommonConstants.dingleDigitIntArray[1]); tEmployeeProject.setProjectStatus(CommonConstants.dingleDigitIntArray[1]);
tEmployeeProject.setLeaveReason(excel.getLeaveReason()); tEmployeeProject.setLeaveReason(excel.getLeaveReason());
tEmployeeProject.setLeaveRemark(excel.getLeaveRemark()); tEmployeeProject.setLeaveRemark(excel.getLeaveRemark());
this.updateById(tEmployeeProject); this.updateById(tEmployeeProject);
//从剩下的项目档案中查找员工类型并更新
setEmpNature(tEmployeeProject.getEmpIdcard(),tEmployeeInfo);
tEmployeeInfoMapper.updateById(tEmployeeInfo);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], tEmployeeInfo.getId(), "", tEmployeeProjectOld, tEmployeeInfo);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1], "", tEmployeeProject.getId(), tEmployeeInfoOld, tEmployeeProject); tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1], "", tEmployeeProject.getId(), tEmployeeInfoOld, tEmployeeProject);
} }
} }
if (errorMessageList.size()> CommonConstants.ZERO_INT) { if (errorMessageList.size() > CommonConstants.ZERO_INT) {
return R.failed(errorMessageList); return R.failed(errorMessageList);
} }
return R.ok(); return R.ok();
} }
@Override @Override
public R<List<ErrorMessage>> importListAdd(InputStream inputStream,String isAdd) { public R<List<ErrorMessage>> importListAdd(InputStream inputStream, String isAdd) {
List<ErrorMessage> errorMessageList = new ArrayList<>(); List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<EmployeeProjectVO> util1 = new ExcelUtil<>(EmployeeProjectVO.class); ExcelUtil<EmployeeProjectVO> util1 = new ExcelUtil<>(EmployeeProjectVO.class);
// 写法2: // 写法2:
...@@ -378,7 +378,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -378,7 +378,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
*/ */
private void saveData() { private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size()); log.info("{}条数据,开始存储数据库!", cachedDataList.size());
importListAdd(cachedDataList, errorMessageList,isAdd); importListAdd(cachedDataList, errorMessageList, isAdd);
log.info("存储数据库成功!"); log.info("存储数据库成功!");
} }
}).sheet().doRead(); }).sheet().doRead();
...@@ -391,6 +391,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -391,6 +391,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
/** /**
* 新增档案操作记录 * 新增档案操作记录
*
* @param excelVOList * @param excelVOList
* @param errorMessageList * @param errorMessageList
* @param * @param
...@@ -398,7 +399,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -398,7 +399,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
* @date 2022-06-20 18:52:16 * @date 2022-06-20 18:52:16
*/ */
@Transactional @Transactional
public void importListAdd(List<EmployeeProjectVO> excelVOList, List<ErrorMessage> errorMessageList, String idAdd) { public void importListAdd(List<EmployeeProjectVO> excelVOList, List<ErrorMessage> errorMessageList, String idAdd) {
// 通用校验获取失败的数据 // 通用校验获取失败的数据
List<TEmployeeInfo> updateList = new ArrayList(); List<TEmployeeInfo> updateList = new ArrayList();
List<TEmployeeProject> proInsList = new ArrayList(); List<TEmployeeProject> proInsList = new ArrayList();
...@@ -429,7 +430,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -429,7 +430,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
} }
} }
if (idCardMap.get(idCard.concat(deptNo)) != null) { if (idCardMap.get(idCard.concat(deptNo)) != null) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(),"第" + (excel.getRowIndex()) + "行身份证号+项目编码与第" + idCardMap.get(idCard) + "行重复!")); errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "第" + (excel.getRowIndex()) + "行身份证号+项目编码与第" + idCardMap.get(idCard) + "行重复!"));
} else { } else {
idCardMap.put(idCard.concat(deptNo), i + 2); idCardMap.put(idCard.concat(deptNo), i + 2);
} }
...@@ -447,17 +448,17 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -447,17 +448,17 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
//不存在复档或复项的情况 //不存在复档或复项的情况
//档案无(在档人员、离职库皆无),项目无 //档案无(在档人员、离职库皆无),项目无
if (Common.isEmpty(tEmployeeInfo) && Common.isEmpty(tEmployeeProject)) { if (Common.isEmpty(tEmployeeInfo) && Common.isEmpty(tEmployeeProject)) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(),MsgUtils.getMessage(ErrorCodes.CHECKS_EXIT_EMPPROJECT_ERROR))); errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.CHECKS_EXIT_EMPPROJECT_ERROR)));
//档案有(在档人员),项目无 //档案有(在档人员),项目无
} else if (Common.isNotNull(tEmployeeInfo) && Common.isEmpty(tEmployeeProject) } else if (Common.isNotNull(tEmployeeInfo) && Common.isEmpty(tEmployeeProject)
&& CommonConstants.dingleDigitIntArray[0] == tEmployeeInfo.getFileStatus()) { && CommonConstants.dingleDigitIntArray[0] == tEmployeeInfo.getFileStatus()) {
updateExcelPost(excel, updateList, tEmployeeInfo,CommonConstants.ONE_INT); updateExcelPost(excel, updateList, tEmployeeInfo, CommonConstants.ONE_INT);
insertExcelPro(excel, proInsList); insertExcelPro(excel, proInsList);
//档案有(在档人员),项目有(草稿/已审核); //档案有(在档人员),项目有(草稿/已审核);
} else if (Common.isNotNull(tEmployeeInfo) && CommonConstants.dingleDigitIntArray[0] == tEmployeeInfo.getFileStatus() } else if (Common.isNotNull(tEmployeeInfo) && CommonConstants.dingleDigitIntArray[0] == tEmployeeInfo.getFileStatus()
&& Common.isNotNull(tEmployeeProject) && CommonConstants.dingleDigitIntArray[0] == tEmployeeProject.getProjectStatus()) { && Common.isNotNull(tEmployeeProject) && CommonConstants.dingleDigitIntArray[0] == tEmployeeProject.getProjectStatus()) {
updateExcelPost(excel, updateList, tEmployeeInfo,CommonConstants.ZERO_INT); updateExcelPost(excel, updateList, tEmployeeInfo, CommonConstants.ZERO_INT);
updateExcelPro(excel, proupdateList, tEmployeeProject); updateExcelPro(excel, proupdateList, tEmployeeProject);
} }
...@@ -465,18 +466,18 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -465,18 +466,18 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
if (CommonConstants.ONE_STRING.equals(idAdd)) { if (CommonConstants.ONE_STRING.equals(idAdd)) {
//档案有(离职库),项目(已减档) //档案有(离职库),项目(已减档)
if (Common.isNotNull(tEmployeeInfo) && CommonConstants.dingleDigitIntArray[1] == tEmployeeInfo.getFileStatus() if (Common.isNotNull(tEmployeeInfo) && CommonConstants.dingleDigitIntArray[1] == tEmployeeInfo.getFileStatus()
&& Common.isNotNull(tEmployeeProject) && CommonConstants.dingleDigitIntArray[1] == tEmployeeProject.getProjectStatus()) { && Common.isNotNull(tEmployeeProject) && CommonConstants.dingleDigitIntArray[1] == tEmployeeProject.getProjectStatus()) {
updateExcelPost(excel, updateList, tEmployeeInfo,CommonConstants.ZERO_INT); updateExcelPost(excel, updateList, tEmployeeInfo, CommonConstants.ZERO_INT);
updateExcelPro(excel, proupdateList, tEmployeeProject); updateExcelPro(excel, proupdateList, tEmployeeProject);
//档案有(离职库),项目无; //档案有(离职库),项目无;
} else if (Common.isNotNull(tEmployeeInfo) && CommonConstants.dingleDigitIntArray[1] == tEmployeeInfo.getFileStatus() } else if (Common.isNotNull(tEmployeeInfo) && CommonConstants.dingleDigitIntArray[1] == tEmployeeInfo.getFileStatus()
&& Common.isEmpty(tEmployeeProject) ) { && Common.isEmpty(tEmployeeProject)) {
updateExcelPost(excel, updateList, tEmployeeInfo,CommonConstants.ONE_INT); updateExcelPost(excel, updateList, tEmployeeInfo, CommonConstants.ONE_INT);
insertExcelPro(excel, proInsList); insertExcelPro(excel, proInsList);
//档案有(在档人员),项目(已减档) //档案有(在档人员),项目(已减档)
} else if (Common.isNotNull(tEmployeeInfo) && CommonConstants.dingleDigitIntArray[0] == tEmployeeInfo.getFileStatus() } else if (Common.isNotNull(tEmployeeInfo) && CommonConstants.dingleDigitIntArray[0] == tEmployeeInfo.getFileStatus()
&& Common.isNotNull(tEmployeeProject) && CommonConstants.dingleDigitIntArray[1] == tEmployeeProject.getProjectStatus()) { && Common.isNotNull(tEmployeeProject) && CommonConstants.dingleDigitIntArray[1] == tEmployeeProject.getProjectStatus()) {
updateExcelPost(excel, updateList, tEmployeeInfo,CommonConstants.ZERO_INT); updateExcelPost(excel, updateList, tEmployeeInfo, CommonConstants.ZERO_INT);
updateExcelPro(excel, proupdateList, tEmployeeProject); updateExcelPro(excel, proupdateList, tEmployeeProject);
} }
//不允许复档复项 //不允许复档复项
...@@ -484,14 +485,15 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -484,14 +485,15 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
//档案有(离职库),项目(已减档) //档案有(离职库),项目(已减档)
if (Common.isNotNull(tEmployeeInfo) && CommonConstants.dingleDigitIntArray[1] == tEmployeeInfo.getFileStatus() if (Common.isNotNull(tEmployeeInfo) && CommonConstants.dingleDigitIntArray[1] == tEmployeeInfo.getFileStatus()
&& Common.isNotNull(tEmployeeProject) && CommonConstants.dingleDigitIntArray[1] == tEmployeeProject.getProjectStatus()) { && Common.isNotNull(tEmployeeProject) && CommonConstants.dingleDigitIntArray[1] == tEmployeeProject.getProjectStatus()) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(),MsgUtils.getMessage(ErrorCodes.CHECKS_EMP_PROJECT_ERROR))); errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.CHECKS_EMP_PROJECT_ERROR)));
} else if (Common.isNotNull(tEmployeeInfo) && CommonConstants.dingleDigitIntArray[1] == tEmployeeInfo.getFileStatus() } else if (Common.isNotNull(tEmployeeInfo) && CommonConstants.dingleDigitIntArray[1] == tEmployeeInfo.getFileStatus()
&& Common.isEmpty(tEmployeeProject)) { && Common.isEmpty(tEmployeeProject)) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(),MsgUtils.getMessage(ErrorCodes.CHECKS_REDUCE_EMP_ERROR))); errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.CHECKS_REDUCE_EMP_ERROR)));
//档案有(在档人员),项目(已减档) //档案有(在档人员),项目(已减档)
} else if (Common.isNotNull(tEmployeeInfo) && CommonConstants.dingleDigitIntArray[0] == tEmployeeInfo.getFileStatus() } else if (Common.isNotNull(tEmployeeInfo) && CommonConstants.dingleDigitIntArray[0] == tEmployeeInfo.getFileStatus()
&& Common.isNotNull(tEmployeeProject) && CommonConstants.dingleDigitIntArray[1] == tEmployeeProject.getProjectStatus()){ && Common.isNotNull(tEmployeeProject) && CommonConstants.dingleDigitIntArray[1] == tEmployeeProject.getProjectStatus()) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(),MsgUtils.getMessage(ErrorCodes.CHECKS_REDUCE_PROJECT_ERROR))); } errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.CHECKS_REDUCE_PROJECT_ERROR)));
}
} }
} }
...@@ -502,21 +504,23 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -502,21 +504,23 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
if (proInsList.size() > CommonConstants.dingleDigitIntArray[0]) { if (proInsList.size() > CommonConstants.dingleDigitIntArray[0]) {
baseMapper.insertExcelEmpProject(proInsList); baseMapper.insertExcelEmpProject(proInsList);
List<String> idList = proInsList.stream().map(TEmployeeProject::getEmpIdcard).collect(Collectors.toList()); List<String> idList = proInsList.stream().map(TEmployeeProject::getEmpIdcard).collect(Collectors.toList());
List<TEmployeeInfo> updList = tEmployeeInfoMapper.selectList(Wrappers.<TEmployeeInfo>query().lambda().in(TEmployeeInfo::getEmpIdcard,idList)); List<TEmployeeInfo> updList = tEmployeeInfoMapper.selectList(Wrappers.<TEmployeeInfo>query().lambda().in(TEmployeeInfo::getEmpIdcard, idList));
baseMapper.updateEmpIdById(updList); baseMapper.updateEmpIdById(updList);
} }
if (proupdateList.size() > CommonConstants.dingleDigitIntArray[0]) { if (proupdateList.size() > CommonConstants.dingleDigitIntArray[0]) {
baseMapper.updateExcelEmpProject(proupdateList); baseMapper.updateExcelEmpProject(proupdateList);
} }
} catch (Exception e) { } catch (Exception e) {
log.error("数据更新异常",e); log.error("数据更新异常", e);
} }
} }
@Override @Override
@Transactional
public R<List<ErrorMessage>> importEmpProjectUpdate(InputStream inputStream) { public R<List<ErrorMessage>> importEmpProjectUpdate(InputStream inputStream) {
List<ErrorMessage> errorMessageList = new ArrayList<>(); List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<EmployeeProjectVO> util1 = new ExcelUtil<>(EmployeeProjectVO.class);; ExcelUtil<EmployeeProjectVO> util1 = new ExcelUtil<>(EmployeeProjectVO.class);
;
// 写法2: // 写法2:
// 匿名内部类 不用额外写一个DemoDataListener // 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭 // 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
...@@ -535,11 +539,11 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -535,11 +539,11 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
public void invoke(EmployeeProjectVO data, AnalysisContext context) { public void invoke(EmployeeProjectVO data, AnalysisContext context) {
ReadRowHolder readRowHolder = context.readRowHolder(); ReadRowHolder readRowHolder = context.readRowHolder();
Integer rowIndex = readRowHolder.getRowIndex(); Integer rowIndex = readRowHolder.getRowIndex();
data.setRowIndex(rowIndex+1); data.setRowIndex(rowIndex + 1);
ErrorMessage errorMessage = util1.checkEntity(data, data.getRowIndex()); ErrorMessage errorMessage = util1.checkEntity(data, data.getRowIndex());
if (Common.isNotNull(errorMessage)){ if (Common.isNotNull(errorMessage)) {
errorMessageList.add(errorMessage); errorMessageList.add(errorMessage);
}else { } else {
cachedDataList.add(data); cachedDataList.add(data);
} }
if (cachedDataList.size() >= BATCH_COUNT) { if (cachedDataList.size() >= BATCH_COUNT) {
...@@ -559,25 +563,25 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -559,25 +563,25 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
*/ */
private void saveData() { private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size()); log.info("{}条数据,开始存储数据库!", cachedDataList.size());
importEmpProjectUpdate(cachedDataList,errorMessageList); importEmpProjectUpdate(cachedDataList, errorMessageList);
log.info("存储数据库成功!"); log.info("存储数据库成功!");
} }
}).sheet().doRead(); }).sheet().doRead();
}catch (Exception e){ } catch (Exception e) {
log.error(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR,e); log.error(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR, e);
return R.failed(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR); return R.failed(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR);
} }
return R.ok(errorMessageList); return R.ok(errorMessageList);
} }
/** /**
* @Author huyc * @Author huyc
* @Description 批量更新项目档案信息 * @Description 批量更新项目档案信息
* @Date 19:25 2022/6/21 * @Date 19:25 2022/6/21
**/ **/
public void importEmpProjectUpdate(List<EmployeeProjectVO> excelVOList, List<ErrorMessage> errorMessageList) { public void importEmpProjectUpdate(List<EmployeeProjectVO> excelVOList, List<ErrorMessage> errorMessageList) {
// 通用校验获取失败的数据 // 通用校验获取失败的数据
Map<Long,ErrorMessage> errorMsgMap = new HashMap<>(); Map<Long, ErrorMessage> errorMsgMap = new HashMap<>();
List<TEmployeeProject> updateList = new ArrayList<>(); List<TEmployeeProject> updateList = new ArrayList<>();
...@@ -592,7 +596,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -592,7 +596,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
String checkCount = excel.getEmpIdcard().concat(excel.getDeptNo()); String checkCount = excel.getEmpIdcard().concat(excel.getDeptNo());
if (Common.isNotNull(checkCountMap.get(checkCount))) { if (Common.isNotNull(checkCountMap.get(checkCount))) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(),"第" + (excel.getRowIndex()) + "行身份证号+项目编码与第" + checkCountMap.get(checkCount) + "行重复!")); errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "第" + (excel.getRowIndex()) + "行身份证号+项目编码与第" + checkCountMap.get(checkCount) + "行重复!"));
} else { } else {
checkCountMap.put(checkCount, i + 2); checkCountMap.put(checkCount, i + 2);
} }
...@@ -602,12 +606,29 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -602,12 +606,29 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
.eq(TEmployeeProject::getDeptNo, excel.getDeptNo()) .eq(TEmployeeProject::getDeptNo, excel.getDeptNo())
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL)); .eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL));
if (Common.isEmpty(tEmployeeProject)) { if (Common.isEmpty(tEmployeeProject)) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(),MsgUtils.getMessage(ErrorCodes.CHECKS_EMP_EXIT_ERROR))); errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.CHECKS_EMP_EXIT_ERROR)));
} }
// 数据合法情况 // 数据合法情况
if (CollUtil.isEmpty(errorMessageList)) { if (CollUtil.isEmpty(errorMessageList)) {
updateExcelPro(excel,updateList,tEmployeeProject); updateExcelPro(excel, updateList, tEmployeeProject);
if (!excel.getEmpNatrue().equals(tEmployeeProject.getEmpNatrue())) {
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getEmpIdcard, excel.getEmpIdcard())
.eq(TEmployeeInfo::getFileStatus, CommonConstants.ZERO_INT)
.eq(TEmployeeInfo::getDeleteFlag, CommonConstants.STATUS_NORMAL));
if (Common.isNotNull(tEmployeeInfo)) {
TEmployeeInfo tEmployeeInfoCof = tEmployeeInfoMapper.selectById(tEmployeeInfo.getId());
String empNature = tEmployeeInfo.getEmpNatrue();
if (CommonConstants.ZERO_STRING.equals(excel.getEmpNatrue())) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ZERO_STRING);
} else if (CommonConstants.ONE_STRING.equals(excel.getEmpNatrue()) && !CommonConstants.ZERO_STRING.equals(empNature)) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ONE_STRING);
}
tEmployeeInfoMapper.updateById(tEmployeeInfo);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], tEmployeeInfo.getId(), "", tEmployeeInfoCof, tEmployeeInfo);
}
}
} }
} }
try { try {
...@@ -615,18 +636,18 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -615,18 +636,18 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
baseMapper.updateExcelEmpProject(updateList); baseMapper.updateExcelEmpProject(updateList);
} }
} catch (Exception e) { } catch (Exception e) {
log.error("数据更新异常",e); log.error("数据更新异常", e);
} }
} }
/** /**
* 插入excel Pro * 插入excel Pro
*/ */
private void insertExcelPro(EmployeeProjectVO excel,List<TEmployeeProject> proInsList) { private void insertExcelPro(EmployeeProjectVO excel, List<TEmployeeProject> proInsList) {
TEmployeeProject insTEmployeePro = new TEmployeeProject(); TEmployeeProject insTEmployeePro = new TEmployeeProject();
BeanUtil.copyProperties(excel, insTEmployeePro); BeanUtil.copyProperties(excel, insTEmployeePro);
insTEmployeePro.setId(String.valueOf(UUID.randomUUID()).replaceAll("-","")); insTEmployeePro.setId(String.valueOf(UUID.randomUUID()).replaceAll("-", ""));
insTEmployeePro.setDeleteFlag(CommonConstants.STATUS_NORMAL); insTEmployeePro.setDeleteFlag(CommonConstants.STATUS_NORMAL);
insTEmployeePro.setStatus(CommonConstants.dingleDigitIntArray[0]); insTEmployeePro.setStatus(CommonConstants.dingleDigitIntArray[0]);
//人员档案主表id先设置成空,后面更新id //人员档案主表id先设置成空,后面更新id
...@@ -634,13 +655,14 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -634,13 +655,14 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
//获取项目和单位信息 //获取项目和单位信息
TSettleDomain tSettleDomain = tSettleDomainService.getOne(Wrappers.<TSettleDomain>query().lambda() TSettleDomain tSettleDomain = tSettleDomainService.getOne(Wrappers.<TSettleDomain>query().lambda()
.eq(TSettleDomain::getDepartNo,insTEmployeePro.getDeptNo()).eq(TSettleDomain::getDeleteFlag,CommonConstants.STATUS_NORMAL) .eq(TSettleDomain::getDepartNo, insTEmployeePro.getDeptNo()).eq(TSettleDomain::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.eq(TSettleDomain::getStopFlag,CommonConstants.STATUS_NORMAL)); .eq(TSettleDomain::getStopFlag, CommonConstants.STATUS_NORMAL));
if (Common.isNotNull(tSettleDomain)) { if (Common.isNotNull(tSettleDomain)) {
insTEmployeePro.setDeptId(tSettleDomain.getId()); insTEmployeePro.setDeptId(tSettleDomain.getId());
insTEmployeePro.setDeptName(tSettleDomain.getDepartName()); insTEmployeePro.setDeptName(tSettleDomain.getDepartName());
TCustomerInfo tCustomerInfo = tCustomerInfoMapper.selectById(tSettleDomain.getCustomerId()); TCustomerInfo tCustomerInfo = tCustomerInfoMapper.selectById(tSettleDomain.getCustomerId());
if(Common.isNotNull(tCustomerInfo)) {; if (Common.isNotNull(tCustomerInfo)) {
;
insTEmployeePro.setUnitId(tCustomerInfo.getId()); insTEmployeePro.setUnitId(tCustomerInfo.getId());
insTEmployeePro.setUnitNo(tCustomerInfo.getCustomerCode()); insTEmployeePro.setUnitNo(tCustomerInfo.getCustomerCode());
insTEmployeePro.setUnitName(tCustomerInfo.getCustomerName()); insTEmployeePro.setUnitName(tCustomerInfo.getCustomerName());
...@@ -674,21 +696,21 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -674,21 +696,21 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
if (Common.isNotEmpty(idsList)) { if (Common.isNotEmpty(idsList)) {
list = baseMapper.selectList(Wrappers.<TEmployeeProject>query().lambda().in(TEmployeeProject::getId, idsList)); list = baseMapper.selectList(Wrappers.<TEmployeeProject>query().lambda().in(TEmployeeProject::getId, idsList));
} }
if(Common.isNotEmpty(list)) { if (Common.isNotEmpty(list)) {
int i = 0; int i = 0;
for (TEmployeeProject delProject : list) { for (TEmployeeProject delProject : list) {
++i; ++i;
try { try {
if (CommonConstants.dingleDigitIntArray[0] ==delProject.getStatus()) { if (CommonConstants.dingleDigitIntArray[0] == delProject.getStatus()) {
delProject.setDeleteFlag(CommonConstants.ONE_STRING); delProject.setDeleteFlag(CommonConstants.ONE_STRING);
baseMapper.updateById(delProject); baseMapper.updateById(delProject);
}else { } else {
errorList.add(new ErrorMessage(i,MsgUtils.getMessage(ErrorCodes.CHECKS_PROJECT_DELETE_ERROR))); errorList.add(new ErrorMessage(i, MsgUtils.getMessage(ErrorCodes.CHECKS_PROJECT_DELETE_ERROR)));
} }
} catch (Exception e) { } catch (Exception e) {
log.error("项目档案批量删除异常:" + e.getMessage()); log.error("项目档案批量删除异常:" + e.getMessage());
errorList.add(new ErrorMessage(i,MsgUtils.getMessage("项目档案批量删除异常:", e.getMessage()))); errorList.add(new ErrorMessage(i, MsgUtils.getMessage("项目档案批量删除异常:", e.getMessage())));
return R.failed(errorList,CommonConstants.RESULT_DATA_FAIL); return R.failed(errorList, CommonConstants.RESULT_DATA_FAIL);
} }
} }
} }
...@@ -700,13 +722,13 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -700,13 +722,13 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
@Override @Override
public IPage<TEmployeeProject> getTEmployeeProjectInfoPage(Page page, TEmployeeProject tEmployeeProject) { public IPage<TEmployeeProject> getTEmployeeProjectInfoPage(Page page, TEmployeeProject tEmployeeProject) {
return baseMapper.getTEmployeeProjectInfoPage(page,tEmployeeProject); return baseMapper.getTEmployeeProjectInfoPage(page, tEmployeeProject);
} }
/** /**
* @Author huyc * @Author huyc
* @Description 批量导出项目档案信息 * @Description 批量导出项目档案信息
* @Date 10:55 2022/6/23 * @Date 10:55 2022/6/23
**/ **/
@Override @Override
...@@ -725,28 +747,28 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -725,28 +747,28 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
//获取记录 //获取记录
list = gettEmpProInfoExportVos(idstr, projectDTO); list = gettEmpProInfoExportVos(idstr, projectDTO);
if (Common.isNotNull(list)){ if (Common.isNotNull(list)) {
ExcelUtil<EmployeeProjectExportVO> util = new ExcelUtil<>(EmployeeProjectExportVO.class); ExcelUtil<EmployeeProjectExportVO> util = new ExcelUtil<>(EmployeeProjectExportVO.class);
for (EmployeeProjectExportVO vo:list){ for (EmployeeProjectExportVO vo : list) {
util.convertEntity(vo,null,null,null); util.convertEntity(vo, null, null, null);
} }
} }
ServletOutputStream out = null; ServletOutputStream out = null;
try { try {
if (list.size()>0) { if (list.size() > 0) {
out = response.getOutputStream(); out = response.getOutputStream();
response.setContentType("multipart/form-data"); response.setContentType("multipart/form-data");
response.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8");
response.setHeader("Content-Disposition", "attachment;filename*=utf-8'zh_cn'" + URLEncoder.encode(fileName , "UTF-8")); response.setHeader("Content-Disposition", "attachment;filename*=utf-8'zh_cn'" + URLEncoder.encode(fileName, "UTF-8"));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭 // 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
EasyExcel.write(out, EmployeeProjectExportVO.class).includeColumnFiledNames(includeColumnFiledNames).sheet("项目档案") EasyExcel.write(out, EmployeeProjectExportVO.class).includeColumnFiledNames(includeColumnFiledNames).sheet("项目档案")
.doWrite(list); .doWrite(list);
out.flush(); out.flush();
} }
}catch (Exception e){ } catch (Exception e) {
log.error("执行异常" ,e); log.error("执行异常", e);
}finally { } finally {
try { try {
if (null != out) { if (null != out) {
out.close(); out.close();
...@@ -779,13 +801,14 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -779,13 +801,14 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
tEmployeeProject.setDeptNo(employeeInfo.getDeptNo()); tEmployeeProject.setDeptNo(employeeInfo.getDeptNo());
TSettleDomain tSettleDomain = tSettleDomainService.getOne(Wrappers.<TSettleDomain>query().lambda() TSettleDomain tSettleDomain = tSettleDomainService.getOne(Wrappers.<TSettleDomain>query().lambda()
.eq(TSettleDomain::getDepartNo,employeeInfo.getDeptNo()).eq(TSettleDomain::getDeleteFlag,CommonConstants.STATUS_NORMAL) .eq(TSettleDomain::getDepartNo, employeeInfo.getDeptNo()).eq(TSettleDomain::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.eq(TSettleDomain::getStopFlag,CommonConstants.STATUS_NORMAL)); .eq(TSettleDomain::getStopFlag, CommonConstants.STATUS_NORMAL));
if (Common.isNotNull(tSettleDomain)) { if (Common.isNotNull(tSettleDomain)) {
tEmployeeProject.setDeptId(tSettleDomain.getId()); tEmployeeProject.setDeptId(tSettleDomain.getId());
tEmployeeProject.setDeptName(tSettleDomain.getDepartName()); tEmployeeProject.setDeptName(tSettleDomain.getDepartName());
TCustomerInfo tCustomerInfo = tCustomerInfoMapper.selectById(tSettleDomain.getCustomerId()); TCustomerInfo tCustomerInfo = tCustomerInfoMapper.selectById(tSettleDomain.getCustomerId());
if(Common.isNotNull(tCustomerInfo)) {; if (Common.isNotNull(tCustomerInfo)) {
;
tEmployeeProject.setUnitId(tCustomerInfo.getId()); tEmployeeProject.setUnitId(tCustomerInfo.getId());
tEmployeeProject.setUnitNo(tCustomerInfo.getCustomerCode()); tEmployeeProject.setUnitNo(tCustomerInfo.getCustomerCode());
tEmployeeProject.setUnitName(tCustomerInfo.getCustomerName()); tEmployeeProject.setUnitName(tCustomerInfo.getCustomerName());
...@@ -797,7 +820,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -797,7 +820,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
/** /**
* 获取导出的项目档案列表 * 获取导出的项目档案列表
*/ */
private List<EmployeeProjectExportVO> gettEmpProInfoExportVos(String idstr,EmployeeProjectExportVO projectDTO) { private List<EmployeeProjectExportVO> gettEmpProInfoExportVos(String idstr, EmployeeProjectExportVO projectDTO) {
List<EmployeeProjectExportVO> list; List<EmployeeProjectExportVO> list;
if (!Common.isEmpty(idstr)) { if (!Common.isEmpty(idstr)) {
projectDTO.setIdList(Common.initStrToList(idstr, CommonConstants.COMMA_STRING)); projectDTO.setIdList(Common.initStrToList(idstr, CommonConstants.COMMA_STRING));
...@@ -809,7 +832,8 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -809,7 +832,8 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
/** /**
* 更新人员档案 * 更新人员档案
*/ */
private void updateExcelPost(EmployeeProjectVO excel,List<TEmployeeInfo> updateList,TEmployeeInfo tEmployeeInfo,int num) { private void updateExcelPost(EmployeeProjectVO excel, List<TEmployeeInfo> updateList, TEmployeeInfo tEmployeeInfo, int num) {
String empNature = tEmployeeInfo.getEmpNatrue();
BeanUtil.copyProperties(excel, tEmployeeInfo); BeanUtil.copyProperties(excel, tEmployeeInfo);
YifuUser user = SecurityUtils.getUser(); YifuUser user = SecurityUtils.getUser();
tEmployeeInfo.setUpdateBy(user.getId()); tEmployeeInfo.setUpdateBy(user.getId());
...@@ -818,7 +842,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -818,7 +842,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
} }
if (CommonConstants.ZERO_STRING.equals(tEmployeeInfo.getEmpNatrue())) { if (CommonConstants.ZERO_STRING.equals(tEmployeeInfo.getEmpNatrue())) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ZERO_STRING); tEmployeeInfo.setEmpNatrue(CommonConstants.ZERO_STRING);
}else if (CommonConstants.ONE_STRING.equals(tEmployeeInfo.getEmpNatrue()) && !CommonConstants.ZERO_STRING.equals(tEmployeeInfo.getEmpNatrue())) { } else if (CommonConstants.ONE_STRING.equals(tEmployeeInfo.getEmpNatrue()) && !CommonConstants.ZERO_STRING.equals(empNature)) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ONE_STRING); tEmployeeInfo.setEmpNatrue(CommonConstants.ONE_STRING);
} }
updateList.add(tEmployeeInfo); updateList.add(tEmployeeInfo);
...@@ -830,7 +854,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -830,7 +854,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
/** /**
* 更新项目档案 * 更新项目档案
*/ */
private void updateExcelPro(EmployeeProjectVO excel,List<TEmployeeProject> proupdateList,TEmployeeProject tEmployeeProject) { private void updateExcelPro(EmployeeProjectVO excel, List<TEmployeeProject> proupdateList, TEmployeeProject tEmployeeProject) {
BeanUtil.copyProperties(excel, tEmployeeProject); BeanUtil.copyProperties(excel, tEmployeeProject);
YifuUser user = SecurityUtils.getUser(); YifuUser user = SecurityUtils.getUser();
tEmployeeProject.setUpdateBy(user.getId()); tEmployeeProject.setUpdateBy(user.getId());
...@@ -863,10 +887,10 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -863,10 +887,10 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
@Override @Override
public R getItemByEmpNo(String empIdcard, String empNo) { public R getItemByEmpNo(String empIdcard, String empNo) {
TSettleDomain tSettleDomain = tSettleDomainService.getOne(Wrappers.<TSettleDomain>query().lambda() TSettleDomain tSettleDomain = tSettleDomainService.getOne(Wrappers.<TSettleDomain>query().lambda()
.eq(TSettleDomain::getDepartNo,empNo)); .eq(TSettleDomain::getDepartNo, empNo));
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda() TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getEmpIdcard,empIdcard)); .eq(TEmployeeInfo::getEmpIdcard, empIdcard));
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
String empCode = ""; String empCode = "";
if (Common.isNotNull(tEmployeeInfo)) { if (Common.isNotNull(tEmployeeInfo)) {
empCode = tEmployeeInfo.getEmpCode(); empCode = tEmployeeInfo.getEmpCode();
...@@ -874,27 +898,27 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -874,27 +898,27 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
String customerName = ""; String customerName = "";
if (Common.isNotNull(tSettleDomain)) { if (Common.isNotNull(tSettleDomain)) {
TCustomerInfo tCustomerInfo = tCustomerInfoMapper.selectOne(Wrappers.<TCustomerInfo>query().lambda() TCustomerInfo tCustomerInfo = tCustomerInfoMapper.selectOne(Wrappers.<TCustomerInfo>query().lambda()
.eq(TCustomerInfo::getId,tSettleDomain.getCustomerId())); .eq(TCustomerInfo::getId, tSettleDomain.getCustomerId()));
if (Common.isNotNull(tCustomerInfo)) { if (Common.isNotNull(tCustomerInfo)) {
customerName = tCustomerInfo.getCustomerName(); customerName = tCustomerInfo.getCustomerName();
} }
} }
map.put("empCode",empCode); map.put("empCode", empCode);
map.put("itemInfo",tSettleDomain); map.put("itemInfo", tSettleDomain);
map.put("customerName",customerName); map.put("customerName", customerName);
return R.ok(map); return R.ok(map);
} }
@Override @Override
public R<Map<String, String>> getProjectByIdCard(String empIdCard) { public R<Map<String, String>> getProjectByIdCard(String empIdCard) {
List<TEmployeeProject> projects = baseMapper.selectList(Wrappers.<TEmployeeProject>query().lambda() List<TEmployeeProject> projects = baseMapper.selectList(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getDeleteFlag,CommonConstants.ZERO_STRING) .eq(TEmployeeProject::getDeleteFlag, CommonConstants.ZERO_STRING)
.eq(TEmployeeProject::getProjectStatus,CommonConstants.ZERO_STRING) .eq(TEmployeeProject::getProjectStatus, CommonConstants.ZERO_STRING)
.eq(TEmployeeProject::getEmpIdcard,empIdCard)); .eq(TEmployeeProject::getEmpIdcard, empIdCard));
Map<String,String> projectMap = new HashMap<>(); Map<String, String> projectMap = new HashMap<>();
if (Common.isNotNull(projects)){ if (Common.isNotNull(projects)) {
for (TEmployeeProject project:projects){ for (TEmployeeProject project : projects) {
projectMap.put(project.getDeptName(),project.getDeptNo()); projectMap.put(project.getDeptName(), project.getDeptNo());
} }
} }
return R.ok(projectMap); return R.ok(projectMap);
...@@ -911,4 +935,25 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -911,4 +935,25 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
} }
return str; return str;
} }
//从剩下的项目档案中查找员工类型
public void setEmpNature(String empIdcard,TEmployeeInfo tEmployeeInfo) {
List<TEmployeeProject> list = this.list(Wrappers.<TEmployeeProject>query().lambda()
.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;
}
}
}
}
} }
...@@ -104,9 +104,6 @@ ...@@ -104,9 +104,6 @@
<if test="fddContractAttachInfo.salaryStandardPerPiece != null"> <if test="fddContractAttachInfo.salaryStandardPerPiece != null">
AND a.SALARY_STANDARD_PER_PIECE = #{fddContractAttachInfo.salaryStandardPerPiece} AND a.SALARY_STANDARD_PER_PIECE = #{fddContractAttachInfo.salaryStandardPerPiece}
</if> </if>
<if test="fddContractAttachInfo.createUserId != null and fddContractAttachInfo.createUserId.trim() != ''">
AND a.CREATE_USER_ID = #{fddContractAttachInfo.createUserId}
</if>
<if test="fddContractAttachInfo.fddTemplateId != null and fddContractAttachInfo.fddTemplateId.trim() != ''"> <if test="fddContractAttachInfo.fddTemplateId != null and fddContractAttachInfo.fddTemplateId.trim() != ''">
AND a.FDD_TEMPLATE_ID = #{fddContractAttachInfo.fddTemplateId} AND a.FDD_TEMPLATE_ID = #{fddContractAttachInfo.fddTemplateId}
</if> </if>
......
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