|
@@ -495,14 +495,25 @@ public class ClassStudentService {
|
495
|
495
|
List<TUser> teachersExisted = new ArrayList<>();//已存在教师列表
|
496
|
496
|
List<TUser> studentsExisted = new ArrayList<>();//已存在学生列表
|
497
|
497
|
List<TUser> usersExisted = new ArrayList<>();//已存在非本校账号列表
|
|
498
|
+ List<TUser> userexamnoExisted = new ArrayList<>();//已存在准考证号
|
498
|
499
|
List<TUser> delUsers = new ArrayList<>();//已删除学生列表
|
499
|
500
|
List<TUser> updateUsers = new ArrayList<>();//要更新学生列表
|
500
|
501
|
List<String> loginnames = students.stream().map(s -> s.getLoginname()).collect(Collectors.toList());
|
|
502
|
+ List<String> examnos = students.stream().filter(s -> N_Utils.isNotEmpty(s.getExamno())).map(s -> s.getExamno()).collect(Collectors.toList());
|
501
|
503
|
Map<String, TUser> userMap = userMapper.listByLoginNames(loginnames).stream()
|
502
|
504
|
.collect(Collectors.toMap(u -> u.getLoginname(), u -> u));
|
|
505
|
+ Map<String,TUser> userexamnoMap = null;
|
|
506
|
+ if(N_Utils.isListNotEmpty(examnos)){
|
|
507
|
+ userexamnoMap = userMapper.listByExamnos(examnos).stream().collect(Collectors.toMap(u -> u.getExamno(), u -> u));
|
|
508
|
+ }
|
|
509
|
+
|
503
|
510
|
for (TUser user : students) {
|
504
|
511
|
TUser u = userMap.get(user.getLoginname());
|
505
|
|
- if (null == u) {
|
|
512
|
+ TUser uexamno = null;
|
|
513
|
+ if(N_Utils.isNotEmpty(user.getExamno()) && userexamnoMap!=null){
|
|
514
|
+ uexamno = userexamnoMap.get(user.getExamno());
|
|
515
|
+ }
|
|
516
|
+ if (null == u && uexamno == null) {
|
506
|
517
|
user.setSchoolid(schoolid);
|
507
|
518
|
user.setCreateid(createid);
|
508
|
519
|
user.setCreatetime(N_Utils.getSecondTimestamp());
|
|
@@ -512,6 +523,10 @@ public class ClassStudentService {
|
512
|
523
|
user.setBindsecret(0);
|
513
|
524
|
user.setUserlock(0);
|
514
|
525
|
users.add(user);
|
|
526
|
+ } else if(null == u && uexamno != null){
|
|
527
|
+ user.setLoginpwd("");
|
|
528
|
+ userexamnoExisted.add(user);
|
|
529
|
+ continue;
|
515
|
530
|
} else {
|
516
|
531
|
if (schoolid != u.getSchoolid()) {
|
517
|
532
|
usersExisted.add(u);
|
|
@@ -618,8 +633,9 @@ public class ClassStudentService {
|
618
|
633
|
map.put("studentsExisted", studentsExisted);
|
619
|
634
|
map.put("usersExisted", usersExisted);
|
620
|
635
|
map.put("delUsers", delUsers);
|
|
636
|
+ map.put("userexamnoExisted", userexamnoExisted);
|
621
|
637
|
if (N_Utils.isListNotEmpty(teachersExisted) || N_Utils.isListNotEmpty(studentsExisted)
|
622
|
|
- || N_Utils.isListNotEmpty(usersExisted) || N_Utils.isListNotEmpty(delUsers)) {
|
|
638
|
+ || N_Utils.isListNotEmpty(usersExisted) || N_Utils.isListNotEmpty(delUsers) || N_Utils.isListNotEmpty(userexamnoExisted)) {
|
623
|
639
|
map.put("code", 1);
|
624
|
640
|
} else {
|
625
|
641
|
map.put("code", 0);
|