Commit 95fb295b authored by hongguangwu's avatar hongguangwu

优化

parent 062bf3e6
......@@ -237,7 +237,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
errorMsg.add("工资状态非初始!");
}
// 数据合法情况
if (!CollUtil.isEmpty(errorMsg)) {
if (CollUtil.isNotEmpty(errorMsg)) {
isTrue = false;
errorMessageVO = this.getErrorMessageVO(i, CommonConstants.ZERO_INT, employee.getEmpName()
, employee.getEmpIdcard(), errorMsg);
......@@ -408,7 +408,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
canDeleteList.add(employee);
}
} else {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_IDCARD_LEAVE_EXISTING, excel.getEmpIdcard()));
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_NOT_EXISTS, excel.getEmpIdcard()));
}
} else {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_NOT_EXISTS, excel.getEmpIdcard()));
......@@ -511,9 +511,9 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
check = new TEmployeeInfo();
check.setDeleteFlag(CommonConstants.STATUS_NORMAL);
check.setEmpPhone(employeeInfo.getEmpPhone());
List<TEmployeeInfo> list = baseMapper.getList(employeeInfo);
List<TEmployeeInfo> list = baseMapper.getList(check);
if (list != null && !list.isEmpty()) {
return R.failed("该手机号已被使用!");
return R.failed(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_PHONE_EXIST_ERROR, employeeInfo.getEmpIdcard()));
}
// 调用校验服务-校验手机号
......@@ -644,7 +644,6 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
List<String> phoneList = new ArrayList<>();
Map<String, Integer> idCardMap = new HashMap<>();
String idCard;
ErrorMessage errorMessage;
// 个性化校验逻辑
Set<String> errorMsg;
for (int i = 0; i < excelVOList.size(); i++) {
......@@ -738,6 +737,8 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
areaMap = areaR.getData();
}
TEmployeeInfo checkPhone;
List<TEmployeeInfo> phoneEmpList;
// 执行数据插入操作 组装
for (int i = 0; i < excelVOList.size(); i++) {
// 已有验证报错直接下一个
......@@ -754,7 +755,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
if (existEmp.getFileStatus() == CommonConstants.ZERO_INT) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_IDCARD_EXISTING, excel.getEmpIdcard()));
} else if (isCanAdd == 0) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_IDCARD_LEAVE_EXISTING, excel.getEmpIdcard()));
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_NOT_EXISTS, excel.getEmpIdcard()));
} else {
saveEmp = existEmpMap.get(excel.getEmpIdcard());
}
......@@ -778,6 +779,14 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
saveEmp.setEmpIdcard(excel.getEmpIdcard());
// 校验手机号
checkPhone = new TEmployeeInfo();
checkPhone.setDeleteFlag(CommonConstants.STATUS_NORMAL);
checkPhone.setEmpPhone(excel.getEmpPhone());
phoneEmpList = baseMapper.getList(checkPhone);
if (phoneEmpList != null && !phoneEmpList.isEmpty()) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_PHONE_EXIST_ERROR, existEmp.getEmpIdcard()));
}
existEmp = existPhoneMap.get(excel.getEmpPhone());
// 手机号已存在
if (existEmp != null) {
......@@ -1311,7 +1320,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
saveEmp.setUpdateTime(LocalDateTime.now());
saveList.add(saveEmp);
} else if (saveEmp.getFileStatus() == CommonConstants.ONE_INT) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_IDCARD_LEAVE_EXISTING, excel.getEmpIdcard()));
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_NOT_EXISTS, excel.getEmpIdcard()));
}
} else {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_NOT_EXISTS, excel.getEmpIdcard()));
......
......@@ -225,9 +225,6 @@ public interface ErrorCodes {
// 该人员已存在,禁止重复添加
String ARCHIVES_IMPORT_EMP_IDCARD_EXISTING = "archives.import.emp.idCard.existing";
// 该人员已减档,禁止导入
String ARCHIVES_IMPORT_EMP_IDCARD_LEAVE_EXISTING = "archives.import.emp.idCard.leave.existing";
// 手机号校验错误
String ARCHIVES_IMPORT_EMP_PHONE_CHECK_ERROR = "archives.import.emp.phone.check.error";
......
......@@ -67,7 +67,6 @@ archives.emp.certificate.declare.year.error=\u7533\u62A5\u5E74\u5EA6\u4E0D\u53EF
checks.change.emp.project=\u5F85\u5212\u8F6C\u5458\u5DE5\u5DF2\u5728\u76EE\u6807\u9879\u76EE\u4E0B\u4E0D\u53EF\u5212\u8F6C
archives.import.emp.idCard.existing=\u8BE5\u4EBA\u5458\u5DF2\u5B58\u5728\uFF0C\u7981\u6B62\u91CD\u590D\u6DFB\u52A0
archives.import.emp.idCard.leave.existing=\u8BE5\u4EBA\u5458\u5DF2\u51CF\u6863\uFF0C\u7981\u6B62\u5BFC\u5165
archives.import.emp.phone.check.error=\u624B\u673A\u53F7\u6821\u9A8C\u9519\u8BEF
archives.import.emp.phone.exist.error=\u624B\u673A\u53F7\u5DF2\u88AB\u5176\u4ED6\u8EAB\u4EFD\u8BC1\u4F7F\u7528
archives.import.emp.married.error=\u5A5A\u59FB\u72B6\u51B5\u5728\u5B57\u5178\u4E2D\u672A\u627E\u5230
......@@ -79,7 +78,7 @@ archives.import.emp.natrue.error=\u5458\u5DE5\u7C7B\u578B\u5728\u5B57\u5178\u4E2
archives.import.emp.area.error=\u6237\u7C4D\u6240\u5728\u5730\u672A\u627E\u5230\u533A\u57DF
archives.import.emp.file.area.error=\u6863\u6848\u6240\u5728\u5730\u672A\u627E\u5230\u533A\u57DF
archives.import.emp.high.education.error=\u5927\u4E13\u53CA\u4EE5\u4E0A\uFF0C\u6700\u9AD8\u5B66\u5386\u5FC5\u586B
archives.import.emp.not.exists=\u6839\u636E\u8EAB\u4EFD\u8BC1\u672A\u627E\u5230\u4EBA\u5458\u6863\u6848\u4FE1\u606F
archives.import.emp.not.exists=\u8BE5\u4EBA\u5458\u672A\u5728\u6863\uFF0C\u8BF7\u6838\u5B9E
archives.import.emp.idCard.must=\u8EAB\u4EFD\u8BC1\u5FC5\u586B
archives.import.emp.empName.must=\u5458\u5DE5\u59D3\u540D\u5FC5\u586B
archives.import.emp.leaveReason.must=\u51CF\u6863\u539F\u56E0\u5FC5\u586B
......
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