|
@@ -1169,7 +1169,8 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
InputStream inputStream = (InputStream) map.get("inputStream");
|
|
InputStream inputStream = (InputStream) map.get("inputStream");
|
|
List<LinkedMultiValueMap<Integer, Object>> finalList = ExcelUtil.excelReader(inputStream, Lists.newArrayList(SysUserImportDto.class), (finalExcelList, finalColumnNameList, finalExcelErrorList) -> {
|
|
List<LinkedMultiValueMap<Integer, Object>> finalList = ExcelUtil.excelReader(inputStream, Lists.newArrayList(SysUserImportDto.class), (finalExcelList, finalColumnNameList, finalExcelErrorList) -> {
|
|
List<ExcelError> excelErrorTemp = new ArrayList<>();
|
|
List<ExcelError> excelErrorTemp = new ArrayList<>();
|
|
- Map<String,String> checkMap = new HashMap<>();
|
|
|
|
|
|
+ Map<String,String> checkName = new HashMap<>();
|
|
|
|
+ Map<String,String> checkCode = new HashMap<>();
|
|
for (int i = 0; i < finalExcelList.size(); i++) {
|
|
for (int i = 0; i < finalExcelList.size(); i++) {
|
|
LinkedMultiValueMap<Integer, Object> excelMap = finalExcelList.get(i);
|
|
LinkedMultiValueMap<Integer, Object> excelMap = finalExcelList.get(i);
|
|
List<Object> sysUserImportDtoList = excelMap.get(i);
|
|
List<Object> sysUserImportDtoList = excelMap.get(i);
|
|
@@ -1182,10 +1183,15 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
String roleName = sysUserImportDto.getRoleName();
|
|
String roleName = sysUserImportDto.getRoleName();
|
|
|
|
|
|
// 检验excel中
|
|
// 检验excel中
|
|
- if (checkMap.containsKey(name)){
|
|
|
|
- throw ExceptionResultEnum.ERROR.exception("导入的excel中包含在重复的【name】:" + name);
|
|
|
|
|
|
+ if (checkName.containsKey(name)){
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("导入的excel中包含在重复的【姓名】:" + name);
|
|
}else {
|
|
}else {
|
|
- checkMap.put(name,code);
|
|
|
|
|
|
+ checkName.put(name,code);
|
|
|
|
+ }
|
|
|
|
+ if (checkCode.containsKey(code)){
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("导入的excel中包含在重复的【工号】:" + code);
|
|
|
|
+ }else {
|
|
|
|
+ checkCode.put(code,name);
|
|
}
|
|
}
|
|
|
|
|
|
excelErrorTemp.addAll(ExcelUtil.checkExcelField(sysUserImportDto, y, i));
|
|
excelErrorTemp.addAll(ExcelUtil.checkExcelField(sysUserImportDto, y, i));
|
|
@@ -1195,9 +1201,9 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
if (Objects.isNull(name) || name.length() > 30){
|
|
if (Objects.isNull(name) || name.length() > 30){
|
|
excelErrorTemp.add(new ExcelError(y + 1,"excel第" + (i + 1) + "个sheet第" + (y + 1) + "行[课程名称]不符合输入规范"));
|
|
excelErrorTemp.add(new ExcelError(y + 1,"excel第" + (i + 1) + "个sheet第" + (y + 1) + "行[课程名称]不符合输入规范"));
|
|
}
|
|
}
|
|
-// if (Objects.isNull(phoneNumber) || !phoneNumber.matches(SystemConstant.REGULAR_EXPRESSION_OF_PHONE)){
|
|
|
|
-// excelErrorTemp.add(new ExcelError(y + 1,"excel第" + (i + 1) + "个sheet第" + (y + 1) + "行[电话号码]不符合输入规范"));
|
|
|
|
-// }
|
|
|
|
|
|
+ if (Objects.isNull(phoneNumber) || !phoneNumber.matches(SystemConstant.REGULAR_EXPRESSION_OF_PHONE)){
|
|
|
|
+ excelErrorTemp.add(new ExcelError(y + 1,"excel第" + (i + 1) + "个sheet第" + (y + 1) + "行[电话号码]不符合输入规范"));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (excelErrorTemp.size() > 0) {
|
|
if (excelErrorTemp.size() > 0) {
|