Commit 6bca6186 authored by hongguangwu's avatar hongguangwu

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

parent f6950e7a
......@@ -1068,8 +1068,26 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
List<String> insuranceList;
String[] insuranceArr;
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) {
//日志
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) ) {
logSubType.append(RegistConstants.DO_TYPE_ARR[CommonConstants.ONE_INT]).append(CommonConstants.DUNHAO_STRING);
leave.setFailSocialUser(userName);
vo = new TDispatchReduceVo();
vo.setLeaveId(leave.getId());
......@@ -1089,6 +1107,7 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
socialOldList.add(vo);
}
if (judgeToUpdateFund(isExit, doType, nowTime, leave) ) {
logSubType.append(RegistConstants.DO_TYPE_ARR[CommonConstants.TWO_INT]).append(CommonConstants.DUNHAO_STRING);
leave.setFailFundUser(userName);
vo = new TDispatchReduceVo();
vo.setLeaveId(leave.getId());
......@@ -1108,6 +1127,7 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
fundOldList.add(vo);
}
if (judgeToUpdateInsurance(isExit, doType, nowTime, leave) ) {
logSubType.append(RegistConstants.DO_TYPE_ARR[CommonConstants.THREE_INT]).append(CommonConstants.DUNHAO_STRING);
insuranceArr = leave.getInsuranceIdOld().split(",");
insuranceList = new ArrayList<>();
for (String id : insuranceArr) {
......@@ -1117,6 +1137,7 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
leaveInsuranceMap.put(leave.getId(), insuranceList);
}
if (judgeToUpdateContract(isExit, doType, nowTime, leave) ) {
logSubType.append(RegistConstants.DO_TYPE_ARR[CommonConstants.FOUR_INT]).append(CommonConstants.DUNHAO_STRING);
leave.setFailContractUser(userName);
searchVo = new BaseSearchVO();
searchVo.setSearchKey(leave.getContractIdOld());
......@@ -1131,6 +1152,7 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
}
if (judgeToUpdateProject(doType, leave) ) {
logSubType.append(RegistConstants.DO_TYPE_ARR[CommonConstants.FIVE_INT]).append(CommonConstants.DUNHAO_STRING);
leave.setFailEmpUser(userName);
searchVo = new BaseSearchVO();
searchVo.setSearchKey(leave.getEmpProjectIdOld());
......@@ -1146,6 +1168,7 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
listParamProject.add(searchVo);
}
if (judgeToUpdateEmp(doType, leave) ) {
logSubType.append(RegistConstants.DO_TYPE_ARR[CommonConstants.SIX_INT]).append(CommonConstants.DUNHAO_STRING);
leave.setFailEmpProjectUser(userName);
searchVo = new BaseSearchVO();
searchVo.setSearchKey(leave.getEmpProjectIdOld());
......@@ -1159,6 +1182,11 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
}
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
}
}
}
// 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;
// 最终更新总状态
for (EmployeeRegistrationLeave leave : leaveList) {
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()))
|| (Common.isNotNull(leave.getDoStatusFund()) && CommonConstants.THREE_STRING.equals(leave.getDoStatusFund()))
|| (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