Commit 57fdd48a authored by huyuchen's avatar huyuchen

huyc 项目档案代码提交

parent 48801cac
......@@ -81,7 +81,6 @@ public class TEmployeeProjectController {
return R.ok(tEmployeeProjectService.getTEmployeeProjectInfoPage(page,tEmployeeProject));
}
/**
* 通过id查询项目档案表
* @param id id
......@@ -176,6 +175,21 @@ public class TEmployeeProjectController {
return R.ok(tEmployeeProjectService.deleteEmpPro(tEmployeeProject));
}
/**
* 减项
* @param excelVOList
* @param bindingResult
* @Author huyc
* @Date 2022-06-20
*/
@Operation(summary = "批量减项", description = "批量减项")
@SysLog("批量减项" )
@PostMapping("/batchDeleteEmpPro")
@PreAuthorize("@pms.hasPermission('archives_temployeeproject_batchdelempproinfo')" )
public R<List<ErrorMessage>> batchDeleteEmpPro(@RequestExcel List<EmployeeProjectVO> excelVOList, BindingResult bindingResult) {
return tEmployeeProjectService.batchDeleteEmpPro(excelVOList,bindingResult);
}
/**
* 批量新增项目档案信息
*
......
......@@ -45,8 +45,24 @@ public interface TEmployeeProjectService extends IService<TEmployeeProject> {
R reEmpInfo(JSONObject jsonObject);
/**
* @param tEmployeeProject
* @Description: 减项
* @Author: huyc
* @Date: 2022/6/21 10:30
* @return: R
**/
R deleteEmpPro(TEmployeeProject tEmployeeProject);
/**
* @param list
* @Description: 批量减项
* @Author: huyc
* @Date: 2022/6/21 10:30
* @return: R
**/
R<List<ErrorMessage>> batchDeleteEmpPro(List<EmployeeProjectVO> list, BindingResult bindingResult);
/**
* @param excelVOList
* @param bindingResult
......@@ -91,7 +107,7 @@ public interface TEmployeeProjectService extends IService<TEmployeeProject> {
/**
* @param ids
* @Description: 批量删除项目档案
* @Author: hgw
* @Author: huyc
* @Date: 2022/6/22 12:30
* @return: R
**/
......
......@@ -189,7 +189,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
.eq(TEmployeeProject::getEmpId,tEmployeeProject.getEmpId())
.eq(TEmployeeProject::getProjectStatus,CommonConstants.dingleDigitIntArray[0]));
if (count.compareTo(CommonConstants.DEPT_TREE_ROOT_ID) >0) {
return R.failed("该人员存在其他进行中的项目,禁止同步减档!");
return R.failed("人员在该项目下存在进行中/未完结的服务");
}
tEmployeeInfo.setFileStatus(CommonConstants.dingleDigitIntArray[1]);
tEmployeeInfoMapper.updateById(tEmployeeInfo);
......@@ -203,6 +203,60 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
return R.failed("传参为空!");
}
@Override
public R<List<ErrorMessage>> batchDeleteEmpPro(List<EmployeeProjectVO> excelVOList, BindingResult bindingResult) {
// 通用校验获取失败的数据
List<ErrorMessage> errorMessageList = (List<ErrorMessage>) bindingResult.getTarget();
Map<Long,ErrorMessage> errorMsgMap = new HashMap<>();
if (Common.isNotNull(errorMessageList)){
errorMessageList.stream().forEach(errorMessage -> errorMsgMap.put(errorMessage.getLineNum(),errorMessage));
}
// 执行数据插入操作 组装 PostDto
for (int i = 0; i < excelVOList.size(); i++) {
EmployeeProjectVO excel = excelVOList.get(i);
Set<String> errorMsg = new HashSet<>();
// 已有验证报错直接下一个
if (Common.isNotNull(errorMsgMap.get(i + 2))) {
continue;
}
//根据身份证和项目编码获取项目档案
TEmployeeProject tEmployeeProject = this.getOne(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getEmpIdcard, excel.getEmpIdcard())
.eq(TEmployeeProject::getDeptNo, excel.getDeptNo())
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL));
TEmployeeInfo tEmployeeInfoOld = tEmployeeInfoMapper.selectById(tEmployeeProject.getEmpId());
TEmployeeProject tEmployeeProjectOld = this.getById(tEmployeeProject.getId());
if (Common.isNotNull(tEmployeeProject)) {
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectById(tEmployeeProject.getEmpId());
if (tEmployeeProject.getIsLeaveEmployee() == CommonConstants.dingleDigitIntArray[1]) {
Long count = this.count(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getEmpId, tEmployeeProject.getEmpId())
.eq(TEmployeeProject::getProjectStatus, CommonConstants.dingleDigitIntArray[0]));
if (count.compareTo(CommonConstants.DEPT_TREE_ROOT_ID) > 0) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_PROJECT_CHANGE_NOT_EXIST));
}
tEmployeeInfo.setFileStatus(CommonConstants.dingleDigitIntArray[1]);
tEmployeeInfoMapper.updateById(tEmployeeInfo);
}
tEmployeeProject.setProjectStatus(CommonConstants.dingleDigitIntArray[1]);
this.updateById(tEmployeeProject);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], tEmployeeInfo.getId(), "", tEmployeeProjectOld, tEmployeeInfo);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1], "", tEmployeeProject.getId(), tEmployeeInfoOld, tEmployeeProject);
}
if (!CollUtil.isEmpty(errorMsg)) {
errorMessageList.add(new ErrorMessage((long) (i + 2), errorMsg));
}
}
if (CollUtil.isNotEmpty(errorMessageList)) {
return R.failed(errorMessageList);
}
return R.ok();
}
/**
* 新增档案操作记录
* @param excelVOList
......@@ -228,6 +282,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
// 获取身份证、手机号列表,批量查询档案
Map<String, Integer> idCardMap = new HashMap<>();
String idCard;
String deptNo;
// 执行数据插入操作 组装 PostDto
for (int i = 0; i < excelVOList.size(); i++) {
......@@ -240,10 +295,11 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
}
idCard = excel.getEmpIdcard();
if (idCardMap.get(idCard) != null) {
errorMsgMap.put((i + 2L), new ErrorMessage("第" + (i + 2) + "行身份证号与第" + idCardMap.get(idCard) + "行重复!"));
deptNo = excel.getDeptNo();
if (idCardMap.get(idCard.concat(deptNo)) != null) {
errorMsgMap.put((i + 2L), new ErrorMessage("第" + (i + 2) + "行身份证号+项目编码与第" + idCardMap.get(idCard) + "行重复!"));
} else {
idCardMap.put(idCard, i + 2);
idCardMap.put(idCard.concat(deptNo), i + 2);
}
//根据身份证获取人员档案
......
......@@ -283,4 +283,8 @@ public interface ErrorCodes {
* 对应项目编码无项目档案信息,请核实后导入
*/
String ARCHIVES_PROJECT_EMP_NOT_EXIST = "archives.project.emp.not.exist";
/**
* 人员在该项目下存在进行中/未完结的服务
*/
String ARCHIVES_PROJECT_CHANGE_NOT_EXIST = "archives.project.change.not.exist";
}
......@@ -87,6 +87,7 @@ import.file.type.error=\u5BFC\u5165\u7684\u6587\u4EF6\u683C\u5F0F\u4E0D\u6B63\u7
archives.project.emp.not.exist=\u5BF9\u5E94\u9879\u76EE\u7F16\u7801\u65E0\u9879\u76EE\u6863\u6848\u4FE1\u606F\uFF0C\u8BF7\u6838\u5B9E\u540E\u5BFC\u5165
archives.project.change.not.exist=\u4EBA\u5458\u5728\u8BE5\u9879\u76EE\u4E0B\u5B58\u5728\u8FDB\u884C\u4E2D/\u672A\u5B8C\u7ED3\u7684\u670D\u52A1
......
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