Commit b5066073 authored by hongguangwu's avatar hongguangwu

优化人员档案

parent 1bdf468e
......@@ -1466,9 +1466,6 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
}
// 通用校验获取失败的数据
Map<Long, ErrorMessage> errorMsgMap = new HashMap<>();
if (Common.isNotNull(errorMessageList)) {
errorMessageList.stream().forEach(errorMessage -> errorMsgMap.put(errorMessage.getLineNum(), errorMessage));
}
// 获取身份证、手机号列表,批量查询档案
List<String> idCardList = new ArrayList<>();
......@@ -1478,8 +1475,6 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
for (int i = 0; i < excelVOList.size(); i++) {
lineNum = i + 2L;
employeeVO = excelVOList.get(i);
// 判断空值
this.judgeNull(errorMsgMap, employeeVO, lineNum);
// 判空
if (Common.isEmpty(excelVOList.get(i).getEmpIdcard())) {
errorMsgMap.put(lineNum, new ErrorMessage("员工身份证必填"));
......@@ -1493,6 +1488,9 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
errorMsgMap.put(lineNum, new ErrorMessage("员工姓名必填"));
}
}
if (Common.isNotNull(errorMessageList)) {
errorMessageList.stream().forEach(errorMessage -> errorMsgMap.put(errorMessage.getLineNum(), errorMessage));
}
// 查找档案库
Map<String, TEmployeeInfo> existEmpMap = new HashMap<>();
Map<String, TEmployeeInfo> existPhoneMap = new HashMap<>();
......@@ -1576,6 +1574,9 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
saveEmp.setEmpPhone(excel.getEmpPhone());
}
// 判断空值
this.judgeNull(errorMsg, saveEmp);
// 校验手机号
if (Common.isNotNull(excel.getEmpPhone())) {
existEmp = existPhoneMap.get(excel.getEmpPhone());
......@@ -1827,63 +1828,63 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
* @Date: 2022/7/6 15:10
* @return: void
**/
private void judgeNull(Map<Long, ErrorMessage> errorMsgMap, EmployeeVO employeeInfo, long lineNum) {
private void judgeNull(Set<String> errorMsg, TEmployeeInfo employeeInfo) {
if (Common.isNotNull(employeeInfo.getEmpNatrue())
&& (EmployeeConstants.EMP_NATRUE_ZERO.equals(employeeInfo.getEmpNatrue())
|| EmployeeConstants.EMP_NATRUE_ONE.equals(employeeInfo.getEmpNatrue()))) {
&& (CommonConstants.ZERO_STRING.equals(employeeInfo.getEmpNatrue())
|| CommonConstants.ONE_STRING.equals(employeeInfo.getEmpNatrue()))) {
// 2.员工类型为外包和派遣,额外必填项有:身份证开始日期、身份证截止日期、民族、户籍所在(省市县)、户口性质、档案所在地(省市县)、是否大专及以上、通信地址
if (Common.isEmpty(employeeInfo.getValidityStart())) {
errorMsgMap.put(lineNum, new ErrorMessage(EmployeeConstants.VALIDITY_START));
errorMsg.add(EmployeeConstants.VALIDITY_START);
}
if (Common.isEmpty(employeeInfo.getValidityEnd())) {
errorMsgMap.put(lineNum, new ErrorMessage(EmployeeConstants.VALIDITY_END));
errorMsg.add(EmployeeConstants.VALIDITY_END);
}
if (Common.isEmpty(employeeInfo.getEmpNational())) {
errorMsgMap.put(lineNum, new ErrorMessage(EmployeeConstants.EMP_NATIONAL));
errorMsg.add(EmployeeConstants.EMP_NATIONAL);
}
if (Common.isEmpty(employeeInfo.getIdProvince())) {
errorMsgMap.put(lineNum, new ErrorMessage(EmployeeConstants.ID_PROVINCE));
errorMsg.add(EmployeeConstants.ID_PROVINCE);
}
if (Common.isEmpty(employeeInfo.getEmpRegisType())) {
errorMsgMap.put(lineNum, new ErrorMessage(EmployeeConstants.EMP_REGIS_TYPE));
errorMsg.add(EmployeeConstants.EMP_REGIS_TYPE);
}
if (Common.isEmpty(employeeInfo.getFileProvince())) {
errorMsgMap.put(lineNum, new ErrorMessage(EmployeeConstants.FILE_PROVINCE));
errorMsg.add(EmployeeConstants.FILE_PROVINCE);
}
if (Common.isEmpty(employeeInfo.getContactAddress())) {
errorMsgMap.put(lineNum, new ErrorMessage(EmployeeConstants.CONTACT_ADDRESS));
errorMsg.add(EmployeeConstants.CONTACT_ADDRESS);
}
if (Common.isNotNull(employeeInfo.getIsCollege())
&& CommonConstants.IS_TRUE.equals(employeeInfo.getIsCollege())) {
&& CommonConstants.ONE_INT == employeeInfo.getIsCollege()) {
// 3.员工类型为外包和派遣,并且是否大专及以上为是,再增加必填项:最高学历、学校、专业、入学时间、毕业时间
if (Common.isEmpty(employeeInfo.getHignEducation())) {
errorMsgMap.put(lineNum, new ErrorMessage(EmployeeConstants.HIGN_EDUCATION));
errorMsg.add(EmployeeConstants.HIGN_EDUCATION);
}
if (Common.isEmpty(employeeInfo.getSchool())) {
errorMsgMap.put(lineNum, new ErrorMessage(EmployeeConstants.SCHOOL));
errorMsg.add(EmployeeConstants.SCHOOL);
}
if (Common.isEmpty(employeeInfo.getMajor())) {
errorMsgMap.put(lineNum, new ErrorMessage(EmployeeConstants.MAJOR));
errorMsg.add(EmployeeConstants.MAJOR);
}
if (Common.isEmpty(employeeInfo.getAdmissionDate())) {
errorMsgMap.put(lineNum, new ErrorMessage(EmployeeConstants.ADMISSION_DATE));
errorMsg.add(EmployeeConstants.ADMISSION_DATE);
}
if (Common.isEmpty(employeeInfo.getGradutionDate())) {
errorMsgMap.put(lineNum, new ErrorMessage(EmployeeConstants.GRADUTION_DATE));
errorMsg.add(EmployeeConstants.GRADUTION_DATE);
}
}
}
if (Common.isNotNull(employeeInfo.getIdCity()) && Common.isEmpty(employeeInfo.getIdProvince())) {
errorMsgMap.put(lineNum, new ErrorMessage(EmployeeConstants.ID_ROVINCE_MUST));
errorMsg.add(EmployeeConstants.ID_ROVINCE_MUST);
}
if (Common.isNotNull(employeeInfo.getIdTown()) && Common.isEmpty(employeeInfo.getIdCity())) {
errorMsgMap.put(lineNum, new ErrorMessage(EmployeeConstants.ID_CITY_MUST));
errorMsg.add(EmployeeConstants.ID_CITY_MUST);
}
if (Common.isNotNull(employeeInfo.getFileCity()) && Common.isEmpty(employeeInfo.getFileProvince())) {
errorMsgMap.put(lineNum, new ErrorMessage(EmployeeConstants.FILE_ROVINCE_MUST));
errorMsg.add(EmployeeConstants.FILE_ROVINCE_MUST);
}
if (Common.isNotNull(employeeInfo.getFileTown()) && Common.isEmpty(employeeInfo.getFileCity())) {
errorMsgMap.put(lineNum, new ErrorMessage(EmployeeConstants.FILE_CITY_MUST));
errorMsg.add(EmployeeConstants.FILE_CITY_MUST);
}
}
......
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