|
@@ -1103,7 +1103,8 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
System.out.println(inputStream);
|
|
|
List<LinkedMultiValueMap<Integer, Object>> finalList = ExcelUtil.excelReader(inputStream, Lists.newArrayList(BasicStudentImportDto.class,DescribeImportDto.class), (finalExcelList, finalColumnNameList, finalExcelErrorList) -> {
|
|
|
List<ExcelError> excelErrorTemp = new ArrayList<>();
|
|
|
- Map<String, String> checkMap = new HashMap<>();
|
|
|
+ Map<String, String> checkCodeMap = new HashMap<>();
|
|
|
+ Map<String, String> checkPhoneMap = new HashMap<>();
|
|
|
for (int i = 0; i < finalExcelList.size(); i++) {
|
|
|
LinkedMultiValueMap<Integer, Object> excelMap = finalExcelList.get(i);
|
|
|
List<Object> basicStudentImportDtoList = excelMap.get(i);
|
|
@@ -1120,12 +1121,22 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
String clazz = basicStudentImportDto.getClazz();
|
|
|
|
|
|
// 检验excel中
|
|
|
- if (checkMap.containsKey(studentCode)) {
|
|
|
+ // 检验学号
|
|
|
+ if (checkCodeMap.containsKey(studentCode)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("导入的excel中包含在重复的【学生编号】:" + studentCode);
|
|
|
} else {
|
|
|
- checkMap.put(studentCode, studentName);
|
|
|
+ checkCodeMap.put(studentCode, studentName);
|
|
|
+ }
|
|
|
+ // 如果电话有值则检验电话excel中唯一性
|
|
|
+ if (SystemConstant.strNotNull(phoneNumber)){
|
|
|
+ if (checkPhoneMap.containsKey(phoneNumber)) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("导入的excel中包含在重复的【电话号码】:" + phoneNumber);
|
|
|
+ } else {
|
|
|
+ checkPhoneMap.put(phoneNumber, studentCode);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+
|
|
|
excelErrorTemp.addAll(ExcelUtil.checkExcelField(basicStudentImportDto, y, i));
|
|
|
if (Objects.isNull(studentCode) || studentCode.length() > 30 || !studentCode.matches(SystemConstant.REGULAR_EXPRESSION_OF_CODE)) {
|
|
|
excelErrorTemp.add(new ExcelError(y + 1, "excel第" + (i + 1) + "个sheet第" + (y + 1) + "行[学号]不符合输入规范"));
|
|
@@ -1200,6 +1211,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
List<ExcelError> excelErrorTemp = new ArrayList<>();
|
|
|
Map<String, String> checkName = new HashMap<>();
|
|
|
Map<String, String> checkCode = new HashMap<>();
|
|
|
+ Map<String, String> checkPhoneMap = new HashMap<>();
|
|
|
for (int i = 0; i < finalExcelList.size(); i++) {
|
|
|
LinkedMultiValueMap<Integer, Object> excelMap = finalExcelList.get(i);
|
|
|
List<Object> sysUserImportDtoList = excelMap.get(i);
|
|
@@ -1226,6 +1238,14 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
} else {
|
|
|
checkCode.put(code, name);
|
|
|
}
|
|
|
+ // 如果电话有值则检验电话excel中唯一性
|
|
|
+ if (SystemConstant.strNotNull(phoneNumber)){
|
|
|
+ if (checkPhoneMap.containsKey(phoneNumber)) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("导入的excel中包含在重复的【电话号码】:" + phoneNumber);
|
|
|
+ } else {
|
|
|
+ checkPhoneMap.put(phoneNumber, code);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
excelErrorTemp.addAll(ExcelUtil.checkExcelField(sysUserImportDto, y, i));
|
|
|
if (Objects.isNull(code) || code.length() > 30 || !code.matches(SystemConstant.REGULAR_EXPRESSION_OF_CODE)) {
|