Commit c82fc54e authored by hongguangwu's avatar hongguangwu

减档加变更记录

parent aaa17af0
......@@ -348,8 +348,12 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
ErrorMessageVO errorMessageVO;
Map<Integer, Integer> errorMsgMap = new HashMap<>();
TEmployeeInfo oldEmployee;
TEmployeeInfo employee;
// 可以更新的列表
List<TEmployeeInfo> canDeleteList = new ArrayList<>();
// 为了记录变更日志而加的
List<TEmployeeInfo> deleteOldList = new ArrayList<>();
Set<String> errorMsg;
EmployeeLeaveVO excel;
......@@ -413,6 +417,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
if (projectList != null && !projectList.isEmpty()) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_HAVE_PROJECT, employee.getEmpIdcard()));
} else {
oldEmployee = existEmpMap.get(excel.getEmpIdcard());
// 开始减档
employee.setFileStatus(CommonConstants.ONE_INT);
employee.setLeaveUser(user.getId());
......@@ -421,6 +426,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
employee.setLeaveReason(excel.getLeaveReason());
employee.setLeaveRemark(excel.getLeaveRemark());
canDeleteList.add(employee);
deleteOldList.add(oldEmployee);
}
} else {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_NOT_EXISTS, excel.getEmpIdcard()));
......@@ -444,12 +450,18 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
} else {
// 仅更新自己
this.updateBatchById(canDeleteList);
for (int i = 0; i < canDeleteList.size(); i++) {
this.updateById(canDeleteList.get(i));
// 记录变更日志
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], canDeleteList.get(i).getId(), "", deleteOldList.get(i), canDeleteList.get(i));
}
}
return R.ok();
}
@Override
public R<String> minusEmployee(String id, String leaveReason, String leaveRemark) {
TEmployeeInfo oldEmp = this.getById(id);
TEmployeeInfo employee = this.getById(id);
if (employee != null) {
// 获取项目档案,传参0,过滤项目状态
......@@ -468,6 +480,8 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
employee.setLeaveReason(leaveReason);
employee.setLeaveRemark(leaveRemark);
this.updateById(employee);
// 记录变更日志
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], id, "", oldEmp, employee);
return R.ok("已减档");
} else {
return R.failed("未找到人员档案信息");
......@@ -668,7 +682,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
for (int i = 0; i < excelVOList.size(); i++) {
errorMsg = new HashSet<>();
// 判空
this.checkEmployeeVOR((i+2L), excelVOList.get(i), errorMsgMap, errorMsg);
this.checkEmployeeVOR((i + 2L), excelVOList.get(i), errorMsgMap, errorMsg);
idCard = excelVOList.get(i).getEmpIdcard();
if (Common.isEmpty(idCard)) {
......@@ -747,9 +761,9 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
}
// 调用区域服务,渲染区域值
R<Map<String,Map<String, String>>> areaR = HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl(), daprUpmsProperties.getAppId()
R<Map<String, Map<String, String>>> areaR = HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl(), daprUpmsProperties.getAppId()
, "/area/inner/getAreaToName", null, Map.class, SecurityConstants.FROM_IN);
Map<String,Map<String, String>> areaMapR;
Map<String, Map<String, String>> areaMapR;
Map<String, String> areaMap;
if (areaR == null) {
return R.failed("获取区域失败!");
......@@ -934,7 +948,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
if (Common.isEmpty(excel.getHignEducation())) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_HIGH_EDUCATION_ERROR, excel.getEmpIdcard()));
}
} else if (CommonConstants.IS_FALSE.equals(excel.getIsCollege())){
} else if (CommonConstants.IS_FALSE.equals(excel.getIsCollege())) {
saveEmp.setIsCollege(CommonConstants.ZERO_INT);
} else {
errorMsg.add(EmployeeConstants.IS_OR_NOT);
......@@ -1214,13 +1228,13 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
}
// 调用区域服务,渲染区域值
R<Map<String,Map<String, String>>> areaMapR = HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl(), daprUpmsProperties.getAppId()
R<Map<String, Map<String, String>>> areaMapR = HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl(), daprUpmsProperties.getAppId()
, "/area/inner/getAreaToName", null, Map.class, SecurityConstants.FROM_IN);
Map<String, String> areaMap;
if (areaMapR == null) {
return R.failed("获取区域失败!");
} else {
Map<String,Map<String, String>> areaMaps = areaMapR.getData();
Map<String, Map<String, String>> areaMaps = areaMapR.getData();
areaMap = areaMaps.get("data");
}
......@@ -1369,7 +1383,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
if (Common.isEmpty(excel.getHignEducation())) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_HIGH_EDUCATION_ERROR, excel.getEmpIdcard()));
}
} else if (CommonConstants.IS_FALSE.equals(excel.getIsCollege())){
} else if (CommonConstants.IS_FALSE.equals(excel.getIsCollege())) {
saveEmp.setIsCollege(CommonConstants.ZERO_INT);
} else {
errorMsg.add(EmployeeConstants.IS_OR_NOT);
......@@ -1518,7 +1532,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
try {
ExcelUtil<EmployeeExportVO> util = new ExcelUtil<>(EmployeeExportVO.class);
for (EmployeeExportVO vo : list) {
util.convertEntity(vo,null,null,null);
util.convertEntity(vo, null, null, null);
}
out = response.getOutputStream();
response.setContentType("multipart/form-data");
......
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