Commit cfb74e83 authored by huyuchen's avatar huyuchen

Merge remote-tracking branch 'origin/develop' into develop

parents 543ffbe8 84eec9e0
......@@ -56,7 +56,6 @@ import org.springframework.cache.CacheManager;
import org.springframework.cache.support.SimpleValueWrapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.BindingResult;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
......@@ -1466,20 +1465,13 @@ 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<>();
List<String> phoneList = new ArrayList<>();
EmployeeVO employeeVO;
long lineNum;
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 +1485,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 +1571,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 +1825,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