|
|
@@ -42,35 +42,46 @@ public class TechnicianImportListener extends BaseReadListener {
|
|
|
excel.setName(data.get(1));
|
|
|
excel.setNumber(data.get(2));
|
|
|
excel.setIdCard(data.get(3));
|
|
|
+
|
|
|
+ if(Func.isBlank(excel.getNumber()) && Func.isBlank(excel.getIdCard())){
|
|
|
+ errors.add("工号和身份证号不能都为空");
|
|
|
+ }
|
|
|
+
|
|
|
String sexName = data.get(4);
|
|
|
List<String> sexList = DictCache.getList(DictEnum.SEX.getName()).stream().map(Dict::getDictValue).toList();
|
|
|
- if(Func.isNotEmpty(sexList) && !sexList.contains(sexName)){
|
|
|
- errors.add("性别错误,请重新选择");
|
|
|
+ if (Func.isNotBlank(sexName)) {
|
|
|
+ if(Func.isNotEmpty(sexList) && !sexList.contains(sexName)){
|
|
|
+ errors.add("性别错误,请重新选择");
|
|
|
+ }else {
|
|
|
+ excel.setGender(Integer.valueOf(DictCache.getKey(DictEnum.SEX, sexName)));
|
|
|
+ }
|
|
|
}
|
|
|
- excel.setGender(Integer.valueOf(DictCache.getKey(DictEnum.SEX, sexName)));
|
|
|
-
|
|
|
- if (!ValidationUtils.isValidDateFormat(data.get(5), DateUtil.PATTERN_DATE)) {
|
|
|
+ String birthday = data.get(5);
|
|
|
+ if (Func.isNotBlank(birthday) && !ValidationUtils.isValidDateFormat(birthday, DateUtil.PATTERN_DATE)) {
|
|
|
errors.add("出生日期为空或格式错误,yyyy-MM-dd");
|
|
|
}
|
|
|
- excel.setBirthday(data.get(5));
|
|
|
+ excel.setBirthday(birthday);
|
|
|
+
|
|
|
excel.setEthnic(data.get(6));
|
|
|
excel.setDepartment(data.get(7));
|
|
|
excel.setPost(data.get(8));
|
|
|
excel.setPostLocation(data.get(9));
|
|
|
String nature = data.get(10);
|
|
|
List<String> natureList = DictCache.getList("yonggongxingzhi").stream().map(Dict::getDictValue).toList();
|
|
|
- if(Func.isNotEmpty(natureList) && !natureList.contains(nature)){
|
|
|
+ if (Func.isNotBlank(nature) && Func.isNotEmpty(natureList) && !natureList.contains(nature)) {
|
|
|
errors.add("用工性质错误,请重新选择");
|
|
|
}
|
|
|
excel.setNature(nature);
|
|
|
- if (!ValidationUtils.isValidDateFormat(data.get(11), DateUtil.PATTERN_DATE)) {
|
|
|
+
|
|
|
+ String hireDate = data.get(11);
|
|
|
+ if (Func.isNotBlank(hireDate) && !ValidationUtils.isValidDateFormat(hireDate, DateUtil.PATTERN_DATE)) {
|
|
|
errors.add("入职时间为空或格式错误,yyyy-MM-dd");
|
|
|
}
|
|
|
- excel.setHireDate(data.get(11));
|
|
|
+ excel.setHireDate(hireDate);
|
|
|
|
|
|
String education = data.get(12);
|
|
|
List<String> educationList = DictCache.getList("xueli").stream().map(Dict::getDictValue).toList();
|
|
|
- if(Func.isNotEmpty(educationList) && !educationList.contains(education)){
|
|
|
+ if (Func.isNotBlank(education) && Func.isNotEmpty(educationList) && !educationList.contains(education)) {
|
|
|
errors.add("最高学历错误,请重新选择");
|
|
|
}
|
|
|
excel.setEducation(education);
|
|
|
@@ -80,9 +91,9 @@ public class TechnicianImportListener extends BaseReadListener {
|
|
|
excel.setMajor(data.get(15));
|
|
|
|
|
|
String rank = data.get(16);
|
|
|
- if(Func.isNotBlank(rank)){
|
|
|
+ if (Func.isNotBlank(rank)) {
|
|
|
List<String> rankList = DictCache.getList("zhicheng").stream().map(Dict::getDictValue).toList();
|
|
|
- if(Func.isNotEmpty(rankList) && !rankList.contains(rank.trim())){
|
|
|
+ if (Func.isNotEmpty(rankList) && !rankList.contains(rank.trim())) {
|
|
|
errors.add("职称错误,请重新选择");
|
|
|
}
|
|
|
excel.setRank(rank);
|
|
|
@@ -93,14 +104,14 @@ public class TechnicianImportListener extends BaseReadListener {
|
|
|
|
|
|
String situation = data.get(19);
|
|
|
List<String> situationList = DictCache.getList("canyanqingkuang").stream().map(Dict::getDictValue).toList();
|
|
|
- if(Func.isNotEmpty(situationList) && !situationList.contains(situation)){
|
|
|
+ if (Func.isNotBlank(situation) && Func.isNotEmpty(situationList) && !situationList.contains(situation)) {
|
|
|
errors.add("参研情况错误,请重新选择");
|
|
|
}
|
|
|
- excel.setSituation(situation);
|
|
|
+ excel.setSituation(situation);
|
|
|
|
|
|
String personnelType = data.get(20);
|
|
|
List<String> personnelTypeList = DictCache.getList("renyuanleixing").stream().map(Dict::getDictValue).toList();
|
|
|
- if(Func.isNotEmpty(personnelTypeList) && !personnelTypeList.contains(personnelType)){
|
|
|
+ if (Func.isNotBlank(personnelType) && Func.isNotEmpty(personnelTypeList) && !personnelTypeList.contains(personnelType)) {
|
|
|
errors.add("人员类型错误,请重新选择");
|
|
|
}
|
|
|
excel.setPersonnelType(personnelType);
|