Commit 6bca6186 authored by hongguangwu's avatar hongguangwu

MVP1.7.17-离职待办-优化代码

parent f6950e7a
...@@ -1068,8 +1068,26 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe ...@@ -1068,8 +1068,26 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
List<String> insuranceList; List<String> insuranceList;
String[] insuranceArr; String[] insuranceArr;
String errorMessage; String errorMessage;
// 1社保2公积金3商险4合同5项目档案6人员档案
List<EmployeeRegistrationLeaveLog> logList = new ArrayList<>();
EmployeeRegistrationLeaveLog leaveLog;
String preContent = "立即发起全部日期的事项:";
if (Common.isNotNull(isExit) && isExit.equals(CommonConstants.ONE_STRING)) {
preContent += "立即发起今日及之前的事项:";
}
StringBuilder logSubType;
for (EmployeeRegistrationLeave leave : leaveList) { for (EmployeeRegistrationLeave leave : leaveList) {
//日志
leaveLog = new EmployeeRegistrationLeaveLog();
leaveLog.setLeaveId(leave.getId());
leaveLog.setCreateName(user.getNickname());
leaveLog.setCreateTime(LocalDateTime.now());
leaveLog.setContent(preContent);
logSubType = new StringBuilder();
if (judgeToUpdateSocial(isExit, doType, nowTime, leave) ) { if (judgeToUpdateSocial(isExit, doType, nowTime, leave) ) {
logSubType.append(RegistConstants.DO_TYPE_ARR[CommonConstants.ONE_INT]).append(CommonConstants.DUNHAO_STRING);
leave.setFailSocialUser(userName); leave.setFailSocialUser(userName);
vo = new TDispatchReduceVo(); vo = new TDispatchReduceVo();
vo.setLeaveId(leave.getId()); vo.setLeaveId(leave.getId());
...@@ -1089,6 +1107,7 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe ...@@ -1089,6 +1107,7 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
socialOldList.add(vo); socialOldList.add(vo);
} }
if (judgeToUpdateFund(isExit, doType, nowTime, leave) ) { if (judgeToUpdateFund(isExit, doType, nowTime, leave) ) {
logSubType.append(RegistConstants.DO_TYPE_ARR[CommonConstants.TWO_INT]).append(CommonConstants.DUNHAO_STRING);
leave.setFailFundUser(userName); leave.setFailFundUser(userName);
vo = new TDispatchReduceVo(); vo = new TDispatchReduceVo();
vo.setLeaveId(leave.getId()); vo.setLeaveId(leave.getId());
...@@ -1108,6 +1127,7 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe ...@@ -1108,6 +1127,7 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
fundOldList.add(vo); fundOldList.add(vo);
} }
if (judgeToUpdateInsurance(isExit, doType, nowTime, leave) ) { if (judgeToUpdateInsurance(isExit, doType, nowTime, leave) ) {
logSubType.append(RegistConstants.DO_TYPE_ARR[CommonConstants.THREE_INT]).append(CommonConstants.DUNHAO_STRING);
insuranceArr = leave.getInsuranceIdOld().split(","); insuranceArr = leave.getInsuranceIdOld().split(",");
insuranceList = new ArrayList<>(); insuranceList = new ArrayList<>();
for (String id : insuranceArr) { for (String id : insuranceArr) {
...@@ -1117,6 +1137,7 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe ...@@ -1117,6 +1137,7 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
leaveInsuranceMap.put(leave.getId(), insuranceList); leaveInsuranceMap.put(leave.getId(), insuranceList);
} }
if (judgeToUpdateContract(isExit, doType, nowTime, leave) ) { if (judgeToUpdateContract(isExit, doType, nowTime, leave) ) {
logSubType.append(RegistConstants.DO_TYPE_ARR[CommonConstants.FOUR_INT]).append(CommonConstants.DUNHAO_STRING);
leave.setFailContractUser(userName); leave.setFailContractUser(userName);
searchVo = new BaseSearchVO(); searchVo = new BaseSearchVO();
searchVo.setSearchKey(leave.getContractIdOld()); searchVo.setSearchKey(leave.getContractIdOld());
...@@ -1131,6 +1152,7 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe ...@@ -1131,6 +1152,7 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
} }
if (judgeToUpdateProject(doType, leave) ) { if (judgeToUpdateProject(doType, leave) ) {
logSubType.append(RegistConstants.DO_TYPE_ARR[CommonConstants.FIVE_INT]).append(CommonConstants.DUNHAO_STRING);
leave.setFailEmpUser(userName); leave.setFailEmpUser(userName);
searchVo = new BaseSearchVO(); searchVo = new BaseSearchVO();
searchVo.setSearchKey(leave.getEmpProjectIdOld()); searchVo.setSearchKey(leave.getEmpProjectIdOld());
...@@ -1146,6 +1168,7 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe ...@@ -1146,6 +1168,7 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
listParamProject.add(searchVo); listParamProject.add(searchVo);
} }
if (judgeToUpdateEmp(doType, leave) ) { if (judgeToUpdateEmp(doType, leave) ) {
logSubType.append(RegistConstants.DO_TYPE_ARR[CommonConstants.SIX_INT]).append(CommonConstants.DUNHAO_STRING);
leave.setFailEmpProjectUser(userName); leave.setFailEmpProjectUser(userName);
searchVo = new BaseSearchVO(); searchVo = new BaseSearchVO();
searchVo.setSearchKey(leave.getEmpProjectIdOld()); searchVo.setSearchKey(leave.getEmpProjectIdOld());
...@@ -1159,6 +1182,11 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe ...@@ -1159,6 +1182,11 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
} }
listParamEmp.add(searchVo); listParamEmp.add(searchVo);
} }
if (logSubType.length() > 0) {
logSubType.setLength(logSubType.length() - 1); // 长度减1,去掉最后一个
leaveLog.setContent(preContent + logSubType);
logList.add(leaveLog);
}
} }
//组装返回给前端 //组装返回给前端
...@@ -1449,39 +1477,13 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe ...@@ -1449,39 +1477,13 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
} }
} }
} }
// 1社保2公积金3商险4合同5项目档案6人员档案
List<EmployeeRegistrationLeaveLog> logList = new ArrayList<>();
EmployeeRegistrationLeaveLog leaveLog;
String preContent = "立即发起全部日期的事项:";
if (Common.isNotNull(isExit) && isExit.equals(CommonConstants.ONE_STRING)) {
preContent += "立即发起今日及之前的事项:";
}
if (Common.isNotNull(doType)) {
String[] doTypeArray = doType.split(",");
StringBuilder subType = new StringBuilder();
for (String doTypeSub :doTypeArray) {
subType.append(RegistConstants.DO_TYPE_ARR[Integer.parseInt(doTypeSub)]).append(CommonConstants.DUNHAO_STRING);
}
if (subType.length() > 0) {
subType.setLength(subType.length() - 1); // 长度减1,去掉最后一个
}
preContent += subType;
} else {
preContent = "全部事项";
}
// 是否返回前端错误信息 // 是否返回前端错误信息
boolean isReturn = false; boolean isReturn = false;
// 最终更新总状态 // 最终更新总状态
for (EmployeeRegistrationLeave leave : leaveList) { for (EmployeeRegistrationLeave leave : leaveList) {
judgeStatus(leave); judgeStatus(leave);
//日志
leaveLog = new EmployeeRegistrationLeaveLog();
leaveLog.setLeaveId(leave.getId());
leaveLog.setCreateName(user.getNickname());
leaveLog.setCreateTime(LocalDateTime.now());
leaveLog.setContent(preContent);
logList.add(leaveLog);
if (!isReturn && (Common.isNotNull(leave.getDoStatusSocial()) && CommonConstants.THREE_STRING.equals(leave.getDoStatusSocial())) if (!isReturn && (Common.isNotNull(leave.getDoStatusSocial()) && CommonConstants.THREE_STRING.equals(leave.getDoStatusSocial()))
|| (Common.isNotNull(leave.getDoStatusFund()) && CommonConstants.THREE_STRING.equals(leave.getDoStatusFund())) || (Common.isNotNull(leave.getDoStatusFund()) && CommonConstants.THREE_STRING.equals(leave.getDoStatusFund()))
|| (Common.isNotNull(leave.getDoStatusContract()) && CommonConstants.THREE_STRING.equals(leave.getDoStatusContract())) || (Common.isNotNull(leave.getDoStatusContract()) && CommonConstants.THREE_STRING.equals(leave.getDoStatusContract()))
......
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