|
@@ -9,6 +9,7 @@ import com.xhkjedu.suser.mapper.liveplay.CourseMapper;
|
9
|
9
|
import com.xhkjedu.suser.mapper.system.UserMapper;
|
10
|
10
|
import com.xhkjedu.suser.model.gradeclass.TClassStudent;
|
11
|
11
|
import com.xhkjedu.suser.model.gradeclass.TGroupStudent;
|
|
12
|
+import com.xhkjedu.suser.model.gradeclass.TSchool;
|
12
|
13
|
import com.xhkjedu.suser.model.system.TUser;
|
13
|
14
|
import com.xhkjedu.suser.utils.PoiUtils;
|
14
|
15
|
import com.xhkjedu.suser.vo.gradeclass.ClassStudentVo;
|
|
@@ -210,6 +211,13 @@ public class ClassStudentService {
|
210
|
211
|
} else if (N_Utils.isNotEmpty(headpic) || 1 != user.getUserstate()
|
211
|
212
|
|| (N_Utils.isNotEmpty(examno) && !examno.equals(user.getExamno()))) {
|
212
|
213
|
TUser stu = new TUser();
|
|
214
|
+ if (N_Utils.isNotEmpty(examno)) {
|
|
215
|
+ TSchool school = schoolMapper.getSchoolInfoById(schoolid);
|
|
216
|
+ Integer limitenolen = school.getLimitenolen();
|
|
217
|
+ if (!N_Utils.isEmptyInteger(limitenolen) && !limitenolen.equals(examno.length())) {
|
|
218
|
+ throw new Exception("准考证号长度不符合要求");
|
|
219
|
+ }
|
|
220
|
+ }
|
213
|
221
|
stu.setExamno(examno);
|
214
|
222
|
Integer userid = user.getUserid();
|
215
|
223
|
stu.setUserid(userid);
|
|
@@ -289,6 +297,12 @@ public class ClassStudentService {
|
289
|
297
|
*/
|
290
|
298
|
private TUser saveUser(TClassStudent model) throws Exception {
|
291
|
299
|
Integer schoolid = model.getSchoolid();
|
|
300
|
+ TSchool school = schoolMapper.getSchoolInfoById(schoolid);
|
|
301
|
+ Integer limitenolen = school.getLimitenolen();
|
|
302
|
+ String examno = model.getExamno();
|
|
303
|
+ if (N_Utils.isNotEmpty(examno) && !N_Utils.isEmptyInteger(limitenolen) && !limitenolen.equals(examno.length())) {
|
|
304
|
+ throw new Exception("准考证号长度不符合要求");
|
|
305
|
+ }
|
292
|
306
|
TUser user = new TUser();
|
293
|
307
|
user.setUsertype(2);
|
294
|
308
|
user.setUsername(model.getStudentname());
|
|
@@ -296,13 +310,13 @@ public class ClassStudentService {
|
296
|
310
|
user.setLoginpwd(N_Utils.getMD5Pwd("123456"));
|
297
|
311
|
user.setUsersex(model.getUsersex());
|
298
|
312
|
user.setStudentno(model.getStudentno());
|
299
|
|
- user.setExamno(model.getExamno());
|
|
313
|
+ user.setExamno(examno);
|
300
|
314
|
user.setCreateid(model.getCreateid());
|
301
|
315
|
user.setSchoolid(schoolid);
|
302
|
316
|
user.setUsertime(model.getUsertime());
|
303
|
317
|
user.setHeadpic(model.getHeadpic());
|
304
|
318
|
user.setUserphone(model.getUserphone());
|
305
|
|
- Integer usernum = schoolMapper.getUserNumById(schoolid);
|
|
319
|
+ Integer usernum = school.getUsernum();
|
306
|
320
|
if (usernum != null) {
|
307
|
321
|
Integer usernum2 = userMapper.getUserNumBySchoolId(schoolid);
|
308
|
322
|
usernum2 = usernum2 + 1;//学校账号数量+本次添加的人
|
|
@@ -380,13 +394,21 @@ public class ClassStudentService {
|
380
|
394
|
if (u != null && !model.getStudentid().equals(u.getUserid())) {
|
381
|
395
|
return new ResultVo(1, "此账号已被【" + u.getUsername() + "】占用");
|
382
|
396
|
}
|
|
397
|
+ String examno = model.getExamno();
|
|
398
|
+ if (N_Utils.isNotEmpty(examno)) {
|
|
399
|
+ TSchool school = schoolMapper.getSchoolInfoById(model.getSchoolid());
|
|
400
|
+ Integer limitenolen = school.getLimitenolen();
|
|
401
|
+ if (!N_Utils.isEmptyInteger(limitenolen) && !limitenolen.equals(examno.length())) {
|
|
402
|
+ return new ResultVo(1, "准考证号长度不符合要求");
|
|
403
|
+ }
|
|
404
|
+ }
|
383
|
405
|
//修改学生信息
|
384
|
406
|
TUser user = new TUser();
|
385
|
407
|
user.setUserid(model.getStudentid());
|
386
|
408
|
user.setUsersex(model.getUsersex());
|
387
|
409
|
user.setUsername(model.getStudentname());
|
388
|
410
|
user.setStudentno(model.getStudentno());
|
389
|
|
- user.setExamno(model.getExamno());
|
|
411
|
+ user.setExamno(examno);
|
390
|
412
|
user.setLoginname(model.getStudentno());
|
391
|
413
|
user.setUserphone(model.getUserphone());
|
392
|
414
|
user.setUsertime(model.getUsertime());
|
|
@@ -436,13 +458,21 @@ public class ClassStudentService {
|
436
|
458
|
if (stunum.compareTo(lnum) != 0) {
|
437
|
459
|
return new ResultVo(1, "有重复的登录学号");
|
438
|
460
|
}
|
439
|
|
- List<String> elist = students.stream().filter(u -> N_Utils.isNotEmpty(u.getExamno())).map(TUser::getExamno).collect(Collectors.toList());
|
|
461
|
+ List<String> elist = students.stream().filter(u -> N_Utils.isNotEmpty(u.getExamno()))
|
|
462
|
+ .map(TUser::getExamno).collect(Collectors.toList());
|
440
|
463
|
long examnum2 = elist.stream().distinct().count();
|
441
|
464
|
Integer examnum = elist.size();
|
442
|
465
|
if (examnum2 < examnum) {
|
443
|
466
|
return new ResultVo(1, "有重复的准考证号");
|
444
|
467
|
}
|
445
|
|
- Integer usernum = schoolMapper.getUserNumById(schoolid);
|
|
468
|
+ TSchool school = schoolMapper.getSchoolInfoById(schoolid);
|
|
469
|
+ Integer limitenolen = school.getLimitenolen();
|
|
470
|
+ for (String examno : elist) {
|
|
471
|
+ if (!N_Utils.isEmptyInteger(limitenolen) && !limitenolen.equals(examno.length())) {
|
|
472
|
+ throw new Exception("准考证号长度不符合要求");
|
|
473
|
+ }
|
|
474
|
+ }
|
|
475
|
+ Integer usernum = school.getUsernum();
|
446
|
476
|
if (usernum != null) {
|
447
|
477
|
Integer usernum2 = userMapper.getUserNumBySchoolId(schoolid);
|
448
|
478
|
usernum2 = usernum2 + stunum;//学校账号数量+本次添加的人
|
|
@@ -659,12 +689,20 @@ public class ClassStudentService {
|
659
|
689
|
if (stunum.compareTo(lnum) != 0) {
|
660
|
690
|
return new ResultVo(1, "有重复的登录学号");
|
661
|
691
|
}
|
662
|
|
- List<String> elist = students.stream().filter(u -> N_Utils.isNotEmpty(u.getExamno())).map(TUser::getExamno).collect(Collectors.toList());
|
|
692
|
+ List<String> elist = students.stream().filter(u -> N_Utils.isNotEmpty(u.getExamno()))
|
|
693
|
+ .map(TUser::getExamno).collect(Collectors.toList());
|
663
|
694
|
long examnum2 = elist.stream().distinct().count();
|
664
|
695
|
Integer examnum = elist.size();
|
665
|
696
|
if (examnum2 < examnum) {
|
666
|
697
|
return new ResultVo(1, "有重复的准考证号");
|
667
|
698
|
}
|
|
699
|
+ TSchool school = schoolMapper.getSchoolInfoById(schoolid);
|
|
700
|
+ Integer limitenolen = school.getLimitenolen();
|
|
701
|
+ for (String examno : elist) {
|
|
702
|
+ if (!N_Utils.isEmptyInteger(limitenolen) && !limitenolen.equals(examno.length())) {
|
|
703
|
+ throw new Exception("准考证号长度不符合要求");
|
|
704
|
+ }
|
|
705
|
+ }
|
668
|
706
|
map.remove("users");//导入成功的学生信息不返回给前端
|
669
|
707
|
|
670
|
708
|
List<TClassStudent> classStudents = new ArrayList<>();
|