|
|
@@ -221,9 +221,8 @@ public class WhitelistManagementServiceImpl extends MPJBaseServiceImpl<Whitelist
|
|
|
}
|
|
|
|
|
|
Set<Long> whitelistUsers = this.baseMapper.selectList(new QueryWrapper<>()).stream().map(WhitelistManagement::getUserId).collect(Collectors.toSet());
|
|
|
-
|
|
|
-
|
|
|
// 1、先把文件中的所有家长信息去重并提取出来
|
|
|
+ Map<String, String> phoneNameMap = new HashMap<>();
|
|
|
List<Map<Integer, Object>> dataList = new ArrayList<>();
|
|
|
for (Map<Integer, Object> vo : savedDataList) {
|
|
|
List<String> errorLogs = new ArrayList<>();
|
|
|
@@ -247,6 +246,14 @@ public class WhitelistManagementServiceImpl extends MPJBaseServiceImpl<Whitelist
|
|
|
if(!studentMap.containsKey(studentKey)){
|
|
|
errorLogs.add("未能查询到该学生");
|
|
|
}
|
|
|
+ if(vo.get(3) != null&& vo.get(4) != null
|
|
|
+ && phoneNameMap.get(vo.get(4).toString()) != null
|
|
|
+ && !vo.get(3).toString().equals(phoneNameMap.get(vo.get(4).toString()))){
|
|
|
+ errorLogs.add("手机号已被其他家长使用,请检查是否正确");
|
|
|
+ }else{
|
|
|
+ phoneNameMap.put(vo.get(4).toString(), vo.get(3).toString());
|
|
|
+ }
|
|
|
+
|
|
|
if(!errorLogs.isEmpty()){
|
|
|
vo.put(5, errorLogs.toString().replace("[", "").replace("]", ""));
|
|
|
errorList.add(vo);
|
|
|
@@ -254,33 +261,31 @@ public class WhitelistManagementServiceImpl extends MPJBaseServiceImpl<Whitelist
|
|
|
}
|
|
|
dataList.add(vo);
|
|
|
}
|
|
|
+ LocalDateTime now = LocalDateTime.now();
|
|
|
+ Date createDate = new Date();
|
|
|
+ Set<String> parentKeySet = dataList.stream().map(x -> x.get(3).toString() + "<@>" + x.get(4).toString()).collect(Collectors.toSet());
|
|
|
|
|
|
- List<User> updateList = new ArrayList<>();
|
|
|
- List<BaseUserStudent> userStudentList = new ArrayList<>();
|
|
|
List<User> parentInsList = new ArrayList<>();
|
|
|
List<User> parentUpdList = new ArrayList<>();
|
|
|
List<UserRoleRelation> roleRelationList = new ArrayList<>();
|
|
|
- List<WhitelistManagement> whitelist = new ArrayList();
|
|
|
- LocalDateTime now = LocalDateTime.now();
|
|
|
- Date createDate = new Date();
|
|
|
-
|
|
|
- for (Map<Integer, Object> vo : dataList) {
|
|
|
- String studentKey = vo.get(0).toString() + vo.get(1).toString();
|
|
|
+ Map<String, Long> parentIdMap = new HashMap<>();
|
|
|
+ for (String parentKey : parentKeySet) {
|
|
|
+ String[] split = parentKey.split("<@>");
|
|
|
long parentId = IdUtil.getSnowflakeNextId();
|
|
|
- if(parentsMap.get(vo.get(4).toString()) != null){
|
|
|
- User parent = parentsMap.get(vo.get(4).toString());
|
|
|
+ if(parentsMap.get(split[1]) != null){
|
|
|
+ User parent = parentsMap.get(split[1]);
|
|
|
parentId = parent.getId();
|
|
|
- parent.setName(vo.get(3).toString());
|
|
|
+ parent.setName(split[0]);
|
|
|
parent.setModifyDate(now);
|
|
|
parentUpdList.add(parent);
|
|
|
}else{
|
|
|
User parent = new User();
|
|
|
parent.setId(parentId);
|
|
|
- parent.setPassword(BCrypt.hashpw(vo.get(4).toString(), BCrypt.gensalt()));
|
|
|
+ parent.setPassword(BCrypt.hashpw(split[1], BCrypt.gensalt()));
|
|
|
parent.setCreateDate(now);
|
|
|
- parent.setMobile(vo.get(4).toString());
|
|
|
- parent.setName(vo.get(3).toString());
|
|
|
- parent.setUserName(vo.get(4).toString());
|
|
|
+ parent.setMobile(split[1]);
|
|
|
+ parent.setName(split[0]);
|
|
|
+ parent.setUserName(split[1]);
|
|
|
parent.setIsChangePassword(1);
|
|
|
parentInsList.add(parent);
|
|
|
|
|
|
@@ -289,6 +294,15 @@ public class WhitelistManagementServiceImpl extends MPJBaseServiceImpl<Whitelist
|
|
|
roleRelation.setUserId(parentId);
|
|
|
roleRelationList.add(roleRelation);
|
|
|
}
|
|
|
+ parentIdMap.put(parentKey, parentId);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<User> updateList = new ArrayList<>();
|
|
|
+ List<BaseUserStudent> userStudentList = new ArrayList<>();
|
|
|
+ List<WhitelistManagement> whitelist = new ArrayList();
|
|
|
+
|
|
|
+ for (Map<Integer, Object> vo : dataList) {
|
|
|
+ String studentKey = vo.get(0).toString() + vo.get(1).toString();
|
|
|
|
|
|
User user = studentMap.get(studentKey);
|
|
|
user.setMobile(vo.get(2).toString());
|
|
|
@@ -305,7 +319,7 @@ public class WhitelistManagementServiceImpl extends MPJBaseServiceImpl<Whitelist
|
|
|
userStudent.setCreateDate(new Date());
|
|
|
userStudent.setClassId(classId);
|
|
|
userStudent.setTeacherId(teacherId);
|
|
|
- userStudent.setUserId(parentId);
|
|
|
+ userStudent.setUserId(parentIdMap.get(vo.get(3).toString() + "<@>" + vo.get(4).toString()));
|
|
|
userStudent.setUserPhone(vo.get(4).toString());
|
|
|
userStudentList.add(userStudent);
|
|
|
|