|
@@ -87,7 +87,7 @@ public class UserService extends JedisUtil {
|
87
|
87
|
resultVo = this.checkLoginUser(user,userVo,1);
|
88
|
88
|
|
89
|
89
|
} else {
|
90
|
|
- resultVo = new ResultVo(1, "该账号不存在");
|
|
90
|
+ resultVo = new ResultVo(1, "此账号不存在");
|
91
|
91
|
}
|
92
|
92
|
|
93
|
93
|
return getLogResultVo(user, resultVo, loginpwd, request);
|
|
@@ -98,25 +98,29 @@ public class UserService extends JedisUtil {
|
98
|
98
|
//帐号密码登录
|
99
|
99
|
return new ResultVo(1, "密码错误");
|
100
|
100
|
} else {
|
101
|
|
-
|
102
|
|
- if(userVo.getUsertype() == 999){
|
|
101
|
+ Integer usertype = userVo.getUsertype();
|
|
102
|
+ if (usertype == 999) {
|
103
|
103
|
return new ResultVo(0, "登录成功", userVo);
|
104
|
104
|
}
|
105
|
105
|
//判断学校状态
|
106
|
|
- if(userVo.getSchoolstate() != 1){
|
107
|
|
- return new ResultVo(1, "该学校已锁定,禁止登录");
|
|
106
|
+ if (userVo.getSchoolstate() != 1) {
|
|
107
|
+ return new ResultVo(1, "此学校已锁定,禁止登录");
|
108
|
108
|
}
|
109
|
109
|
//判断用户状态
|
110
|
110
|
if (userVo.getUserstate() != 1) {
|
111
|
|
- return new ResultVo(1, "该账户无权访问,请联系老师");
|
|
111
|
+ if (usertype == 2) {//学生
|
|
112
|
+ return new ResultVo(1, "此账号无权访问,请联系老师");
|
|
113
|
+ } else {
|
|
114
|
+ return new ResultVo(1, "此账号无权访问,请联系管理员");
|
|
115
|
+ }
|
112
|
116
|
}
|
113
|
117
|
|
114
|
118
|
if(userVo.getUserlock() == 1){
|
115
|
|
- return new ResultVo(1, "该账户已被锁定,禁止登录");
|
|
119
|
+ return new ResultVo(1, "此账号已锁定,禁止登录");
|
116
|
120
|
}
|
117
|
121
|
|
118
|
122
|
//进行角色判断
|
119
|
|
- if (userVo.getUsertype() == 2) {
|
|
123
|
+ if (usertype == 2) {
|
120
|
124
|
Integer stuweb = userVo.getStuweb();
|
121
|
125
|
if (stuweb != null && stuweb != 1) return new ResultVo(1, "学生账号无法登录");
|
122
|
126
|
|
|
@@ -139,7 +143,7 @@ public class UserService extends JedisUtil {
|
139
|
143
|
}
|
140
|
144
|
//验证用户是否有行政班
|
141
|
145
|
if (binduser.getXznum() == 0) {
|
142
|
|
- return new ResultVo(1, "该账号未分配班级");
|
|
146
|
+ return new ResultVo(1, "此账号未分配班级");
|
143
|
147
|
}
|
144
|
148
|
|
145
|
149
|
//更新学生硬件绑定信息
|
|
@@ -171,17 +175,17 @@ public class UserService extends JedisUtil {
|
171
|
175
|
if (userVo.getUsertype() != 1) {
|
172
|
176
|
resultVo = new ResultVo(1, "禁止非教师账号登录");
|
173
|
177
|
} else if (userVo.getSchoolstate() != 1) {
|
174
|
|
- resultVo = new ResultVo(1, "用户所在学校暂无权限");
|
|
178
|
+ resultVo = new ResultVo(1, "此学校已锁定,禁止登录");
|
175
|
179
|
} else {
|
176
|
180
|
if (userVo.getUserstate() != 1) {
|
177
|
|
- resultVo = new ResultVo(1, "该账户无权访问,请联系老师");
|
|
181
|
+ resultVo = new ResultVo(1, "此账号无权访问,请联系管理员");
|
178
|
182
|
} else {
|
179
|
183
|
resultVo = new ResultVo(0, "登录成功", userVo);
|
180
|
184
|
}
|
181
|
185
|
}
|
182
|
186
|
}
|
183
|
187
|
} else {
|
184
|
|
- resultVo = new ResultVo(1, "该账号不存在");
|
|
188
|
+ resultVo = new ResultVo(1, "此账号不存在");
|
185
|
189
|
}
|
186
|
190
|
|
187
|
191
|
return getLogResultVo(user, resultVo, loginpwd, request);
|
|
@@ -209,7 +213,7 @@ public class UserService extends JedisUtil {
|
209
|
213
|
//验证学生登录系列问题
|
210
|
214
|
resultVo = checkLoginStudent(user,userVo);
|
211
|
215
|
} else {
|
212
|
|
- resultVo = new ResultVo(1, "该账号不存在");
|
|
216
|
+ resultVo = new ResultVo(1, "此账号不存在");
|
213
|
217
|
}
|
214
|
218
|
|
215
|
219
|
return getLogResultVo(user, resultVo, loginpwd, request);
|
|
@@ -226,7 +230,7 @@ public class UserService extends JedisUtil {
|
226
|
230
|
if (userVo.getUsertype() != 2) {
|
227
|
231
|
return new ResultVo(1, "登录失败,仅允许学生登录");
|
228
|
232
|
} else if (userVo.getXznum() == 0) {
|
229
|
|
- return new ResultVo(1, "该账号未分配班级");
|
|
233
|
+ return new ResultVo(1, "此账号未分配班级");
|
230
|
234
|
} else if (sbindmac == 1 && N_Utils.isNotEmpty(mac)) {
|
231
|
235
|
if (N_Utils.isNotEmpty(userVo.getMac()) && !mac.equals(userVo.getMac())) {
|
232
|
236
|
return new ResultVo(1, "登录失败,该账号已与其他设备关联");
|
|
@@ -266,7 +270,7 @@ public class UserService extends JedisUtil {
|
266
|
270
|
|
267
|
271
|
resultVo = checkLoginUser(user,userVo,2);
|
268
|
272
|
} else {
|
269
|
|
- resultVo = new ResultVo(1, "该账号不存在");
|
|
273
|
+ resultVo = new ResultVo(1, "此账号不存在");
|
270
|
274
|
}
|
271
|
275
|
|
272
|
276
|
return getLogResultVo(user, resultVo, user.getMsgcode() + "", request);
|
|
@@ -289,7 +293,7 @@ public class UserService extends JedisUtil {
|
289
|
293
|
UserVo userVo = (UserVo) result.getObj();
|
290
|
294
|
if (userVo.getUserlock() == 1) {
|
291
|
295
|
result.setCode(1);
|
292
|
|
- result.setMsg("该账户已被锁定,禁止登录");
|
|
296
|
+ result.setMsg("此账号已锁定,禁止登录");
|
293
|
297
|
return result;
|
294
|
298
|
}
|
295
|
299
|
String usertime = userVo.getUsertime();
|
|
@@ -297,7 +301,11 @@ public class UserService extends JedisUtil {
|
297
|
301
|
String dayBegin = DatesUtil.getDayBegin();
|
298
|
302
|
if (usertime.compareTo(dayBegin) < 0) {
|
299
|
303
|
result.setCode(1);
|
300
|
|
- result.setMsg("账号已过有效期,请联系管理员");
|
|
304
|
+ if (usertype == 2) {//学生
|
|
305
|
+ result.setMsg("账号已过有效期,请联系老师");
|
|
306
|
+ } else {
|
|
307
|
+ result.setMsg("账号已过有效期,请联系管理员");
|
|
308
|
+ }
|
301
|
309
|
return result;
|
302
|
310
|
}
|
303
|
311
|
}
|
|
@@ -408,7 +416,7 @@ public class UserService extends JedisUtil {
|
408
|
416
|
TUser user1 = getObjByLoginName(loginname);
|
409
|
417
|
//登录账号改变并且和别的账号冲突
|
410
|
418
|
if (user1 != null && !user1.getUserid().equals(user.getUserid())) {
|
411
|
|
- return new ResultVo(1, "此用户已存在,请更换!");
|
|
419
|
+ return new ResultVo(1, "此账号已存在,请更换!");
|
412
|
420
|
}
|
413
|
421
|
}
|
414
|
422
|
Integer bindphoned = 0;
|
|
@@ -530,9 +538,9 @@ public class UserService extends JedisUtil {
|
530
|
538
|
* @Date 2020/6/2 10:44
|
531
|
539
|
**/
|
532
|
540
|
public ResultVo checkLoginName(String loginname) {
|
533
|
|
- Integer num = userMapper.checkLoginName(loginname);
|
534
|
|
- if (num != 0) {
|
535
|
|
- return new ResultVo(1, "此用户已存在,请更换!");
|
|
541
|
+ Map num = userMapper.checkLoginName(loginname);
|
|
542
|
+ if (num != null) {
|
|
543
|
+ return new ResultVo(1, "此账号已存在,请更换", num);
|
536
|
544
|
} else {
|
537
|
545
|
return new ResultVo(0, "检查登录账号是否存在成功");
|
538
|
546
|
}
|
|
@@ -623,8 +631,10 @@ public class UserService extends JedisUtil {
|
623
|
631
|
map.remove("users");//导入成功的教师信息不返回给前端
|
624
|
632
|
Integer year = schoolMapper.getYearById(schoolid);
|
625
|
633
|
|
626
|
|
- // 以下教师信息已存在·
|
627
|
|
- List<TUser> usersExisted = new ArrayList<>();
|
|
634
|
+ List<TUser> teachersExisted = new ArrayList<>();//已存在教师列表
|
|
635
|
+ List<TUser> studentsExisted = new ArrayList<>();//已存在学生列表
|
|
636
|
+ List<TUser> usersExisted = new ArrayList<>();//已存在非本校账号列表
|
|
637
|
+ List<TUser> delUsers = new ArrayList<>();//已删除教师列表
|
628
|
638
|
List<TClassTeacher> ctlst = new ArrayList<>();//班级教师集合
|
629
|
639
|
List<Integer> teacherIds = new ArrayList<>();//要导入的教师id集合
|
630
|
640
|
List<TUser> teacherList = new ArrayList<>();//要导入的新教师集合
|
|
@@ -656,11 +666,18 @@ public class UserService extends JedisUtil {
|
656
|
666
|
user.setUserlock(0);
|
657
|
667
|
teacherList.add(user);
|
658
|
668
|
} else {
|
659
|
|
- if (1 != u.getUsertype() || schoolid != u.getSchoolid()) {
|
|
669
|
+ if (schoolid != u.getSchoolid()) {
|
660
|
670
|
usersExisted.add(u);
|
|
671
|
+ continue;//非本校账号处理下一条数据
|
|
672
|
+ } else if (1 != u.getUsertype()) {
|
|
673
|
+ studentsExisted.add(u);
|
661
|
674
|
continue;//非本校老师处理下一条数据
|
662
|
675
|
} else {
|
663
|
|
- usersExisted.add(u);
|
|
676
|
+ if (u.getUserstate() != 1) {//本校已删除教师
|
|
677
|
+ delUsers.add(u);
|
|
678
|
+ } else {//本校已存在教师
|
|
679
|
+ teachersExisted.add(u);
|
|
680
|
+ }
|
664
|
681
|
userid = u.getUserid();
|
665
|
682
|
teacherIds.add(userid);
|
666
|
683
|
//处理用户班级
|
|
@@ -685,7 +702,6 @@ public class UserService extends JedisUtil {
|
685
|
702
|
}
|
686
|
703
|
if (N_Utils.isListNotEmpty(teacherList)) {
|
687
|
704
|
batchSave(teacherList);//批量添加教师
|
688
|
|
- System.out.println("新教师:" + JSON.toJSONString(teacherList));
|
689
|
705
|
for (TUser user : teacherList) {
|
690
|
706
|
Integer userid = user.getId();
|
691
|
707
|
teacherIds.add(userid);//把新添加的教师id添加到要导入的教师id集合
|
|
@@ -708,14 +724,21 @@ public class UserService extends JedisUtil {
|
708
|
724
|
}
|
709
|
725
|
}
|
710
|
726
|
|
711
|
|
- if (N_Utils.isListNotEmpty(ctlst)) {
|
|
727
|
+ if (N_Utils.isListNotEmpty(teacherIds)) {
|
712
|
728
|
String teacherids = teacherIds.stream().distinct().map(String::valueOf).collect(Collectors.joining(","));
|
713
|
729
|
classTeacherMapper.deleteByUserid2(teacherids, year);//删除教师任教班级
|
|
730
|
+ }
|
|
731
|
+
|
|
732
|
+ if (N_Utils.isListNotEmpty(ctlst)) {
|
714
|
733
|
classTeacherMapper.insertList(ctlst);//添加教师任教班级
|
715
|
734
|
}
|
716
|
735
|
|
|
736
|
+ map.put("teachersExisted", teachersExisted);
|
|
737
|
+ map.put("studentsExisted", studentsExisted);
|
717
|
738
|
map.put("usersExisted", usersExisted);
|
718
|
|
- if (N_Utils.isListNotEmpty(usersExisted)) {
|
|
739
|
+ map.put("delUsers", delUsers);
|
|
740
|
+ if (N_Utils.isListNotEmpty(teachersExisted) || N_Utils.isListNotEmpty(studentsExisted)
|
|
741
|
+ || N_Utils.isListNotEmpty(usersExisted) || N_Utils.isListNotEmpty(delUsers)) {
|
719
|
742
|
map.put("code", 1);
|
720
|
743
|
} else {
|
721
|
744
|
map.put("code", 0);
|
|
@@ -840,7 +863,7 @@ public class UserService extends JedisUtil {
|
840
|
863
|
if ("yhzc".equals(templateCode)) {//用户注册验证码
|
841
|
864
|
msgtxt += "验证码" + messageCode + ",您正在注册成为新用户,感谢您的支持!";
|
842
|
865
|
} else if ("xgmm".equals(templateCode)) {//修改密码验证码
|
843
|
|
- msgtxt += "验证码" + messageCode + ",您正在尝试修改登录密码,请妥善保管账户信息。";
|
|
866
|
+ msgtxt += "验证码" + messageCode + ",您正在尝试修改登录密码,请妥善保管账号信息。";
|
844
|
867
|
} else if ("dlqr".equals(templateCode)) {//登录确认验证码
|
845
|
868
|
msgtxt += "验证码" + messageCode + ",您正在登录,若非本人操作,请勿泄露。";
|
846
|
869
|
} else if ("bdsj".equals(templateCode)) {//绑定手机验证码
|
|
@@ -910,26 +933,33 @@ public class UserService extends JedisUtil {
|
910
|
933
|
UserVo userVo = userMapper.getUserByUserPhone(userphone);
|
911
|
934
|
if (userVo == null || userVo.getBindphoned() == 0) return new ResultVo(1, "手机号码未绑定");
|
912
|
935
|
//判断学校状态
|
913
|
|
- if (userVo.getUsertype() != 999 && userVo.getSchoolstate() != 1) {
|
914
|
|
- return new ResultVo(1, "该学校已锁定,禁止登录");
|
|
936
|
+ Integer usertype = userVo.getUsertype();
|
|
937
|
+ if (usertype != 999 && userVo.getSchoolstate() != 1) {
|
|
938
|
+ return new ResultVo(1, "此学校已锁定,禁止登录");
|
|
939
|
+ }
|
|
940
|
+ String roleName;
|
|
941
|
+ if (usertype == 2) {
|
|
942
|
+ roleName = "老师";
|
|
943
|
+ } else {
|
|
944
|
+ roleName = "管理员";
|
915
|
945
|
}
|
916
|
946
|
//判断用户状态
|
917
|
947
|
if (userVo.getUserstate() != 1) {
|
918
|
|
- return new ResultVo(1, "该账户无权访问,请联系老师");
|
|
948
|
+ return new ResultVo(1, "此账号无权访问,请联系" + roleName);
|
919
|
949
|
}
|
920
|
950
|
//判断用户是否锁定
|
921
|
951
|
if (userVo.getUserlock() == 1) {
|
922
|
|
- return new ResultVo(1, "该账户已被锁定,禁止登录");
|
|
952
|
+ return new ResultVo(1, "此账号已锁定,禁止登录");
|
923
|
953
|
}
|
924
|
954
|
//判断用户是否过期
|
925
|
955
|
String usertime = userVo.getUsertime();
|
926
|
956
|
String dayBegin = DatesUtil.getDayBegin();
|
927
|
957
|
if (N_Utils.isNotEmpty(usertime) && usertime.compareTo(dayBegin) < 0) {
|
928
|
|
- return new ResultVo(1, "账号已过有效期,请联系管理员");
|
|
958
|
+ return new ResultVo(1, "账号已过有效期,请联系" + roleName);
|
929
|
959
|
}
|
930
|
960
|
|
931
|
961
|
//进行角色判断
|
932
|
|
- if (userVo.getUsertype() == 2) {
|
|
962
|
+ if (usertype == 2) {
|
933
|
963
|
Integer stuweb = userVo.getStuweb();
|
934
|
964
|
if (stuweb != null && stuweb != 1) return new ResultVo(1, "学生账号无法登录");
|
935
|
965
|
}
|
|
@@ -952,36 +982,43 @@ public class UserService extends JedisUtil {
|
952
|
982
|
UserVo user = userMapper.getUserSchoolByUserid(userid);
|
953
|
983
|
String usertime = user.getUsertime();
|
954
|
984
|
String dayBegin = DatesUtil.getDayBegin();
|
955
|
|
- String msg = "用户信息正常";
|
|
985
|
+ String msg = "账号信息正常";
|
956
|
986
|
if (!loginpwd.equals(user.getLoginpwd())) {
|
957
|
987
|
needLogin = true;
|
958
|
988
|
msg = "密码已修改,请重新登录";
|
959
|
989
|
}
|
960
|
990
|
//判断学校状态
|
961
|
|
- if (!needLogin && user.getUsertype() != 999 && user.getSchoolstate() != 1) {
|
|
991
|
+ Integer usertype = user.getUsertype();
|
|
992
|
+ String roleName;
|
|
993
|
+ if (usertype == 2) {//学生
|
|
994
|
+ roleName = "老师";
|
|
995
|
+ } else {
|
|
996
|
+ roleName = "管理员";
|
|
997
|
+ }
|
|
998
|
+ if (!needLogin && usertype != 999 && user.getSchoolstate() != 1) {
|
962
|
999
|
needLogin = true;
|
963
|
|
- msg = "该学校已锁定,请联系管理员";
|
|
1000
|
+ msg = "此学校已锁定,请联系" + roleName;
|
964
|
1001
|
}
|
965
|
1002
|
//判断用户状态
|
966
|
1003
|
if (!needLogin && user.getUserstate() != 1) {
|
967
|
1004
|
needLogin = true;
|
968
|
|
- msg = "该账户无权访问,请联系老师";
|
|
1005
|
+ msg = "此账号无权访问,请联系" + roleName;
|
969
|
1006
|
}
|
970
|
1007
|
if (!needLogin && N_Utils.isNotEmpty(usertime) && usertime.compareTo(dayBegin) < 0) {
|
971
|
1008
|
needLogin = true;
|
972
|
|
- msg = "账号已过有效期,请联系管理员";
|
|
1009
|
+ msg = "账号已过有效期,请联系" + roleName;
|
973
|
1010
|
}
|
974
|
1011
|
if (!needLogin && user.getUserlock() == 1) {
|
975
|
1012
|
needLogin = true;
|
976
|
|
- msg = "该用户已被锁定,请联系管理员";
|
|
1013
|
+ msg = "此账号已锁定,请联系" + roleName;
|
977
|
1014
|
}
|
978
|
|
- if (user.getUsertype() == 2) {
|
|
1015
|
+ if (usertype == 2) {
|
979
|
1016
|
needPhone = userMapper.checkUserPhone(userid);
|
980
|
1017
|
if (!needLogin && needPhone) msg = "未绑定手机号";
|
981
|
1018
|
|
982
|
|
- if(device != null && "pad".equals(device)){
|
|
1019
|
+ if (device != null && "pad".equals(device)) {
|
983
|
1020
|
//当是设备不为空并且是pad时,进行验证
|
984
|
|
- if(user.getSbindmac() == 1 && user.getBindmac() != 1){
|
|
1021
|
+ if (user.getSbindmac() == 1 && user.getBindmac() != 1) {
|
985
|
1022
|
needLogin = true;
|
986
|
1023
|
msg = "未绑定设备";
|
987
|
1024
|
}
|
|
@@ -1013,16 +1050,16 @@ public class UserService extends JedisUtil {
|
1013
|
1050
|
} else if (userVo.getUsertype() == 2) {
|
1014
|
1051
|
resultVo = new ResultVo(1, "禁止学生登录");
|
1015
|
1052
|
} else if (userVo.getSchoolstate() != 1) {
|
1016
|
|
- resultVo = new ResultVo(1, "用户所在学校暂无权限");
|
|
1053
|
+ resultVo = new ResultVo(1, "账号所在学校暂无权限");
|
1017
|
1054
|
} else {
|
1018
|
1055
|
if (userVo.getUserstate() != 1) {
|
1019
|
|
- resultVo = new ResultVo(1, "该账户无权访问,请联系老师");
|
|
1056
|
+ resultVo = new ResultVo(1, "此账号无权访问,请联系管理员");
|
1020
|
1057
|
} else {
|
1021
|
1058
|
resultVo = new ResultVo(0, "登录成功", userVo);
|
1022
|
1059
|
}
|
1023
|
1060
|
}
|
1024
|
1061
|
} else {
|
1025
|
|
- resultVo = new ResultVo(1, "该账号不存在");
|
|
1062
|
+ resultVo = new ResultVo(1, "此账号不存在");
|
1026
|
1063
|
}
|
1027
|
1064
|
|
1028
|
1065
|
return getLogResultVo(user, resultVo, "", request);
|
|
@@ -1087,11 +1124,11 @@ public class UserService extends JedisUtil {
|
1087
|
1124
|
public ResultVo checkUser(String loginname, String username) {
|
1088
|
1125
|
Map map = userMapper.getBindByName(loginname);
|
1089
|
1126
|
if (N_Utils.isEmpty(map)) {
|
1090
|
|
- return new ResultVo(1, "该账号不存在");
|
|
1127
|
+ return new ResultVo(1, "此账号不存在");
|
1091
|
1128
|
}
|
1092
|
1129
|
String username1 = map.get("username").toString();
|
1093
|
1130
|
if (!username.equals(username1)) {
|
1094
|
|
- return new ResultVo(1, "该账号和姓名不匹配");
|
|
1131
|
+ return new ResultVo(1, "此账号和姓名不匹配");
|
1095
|
1132
|
}
|
1096
|
1133
|
return new ResultVo(0, "验证身份成功", map);
|
1097
|
1134
|
}
|
|
@@ -1237,4 +1274,16 @@ public class UserService extends JedisUtil {
|
1237
|
1274
|
public void batchUpdateTime(String usertime, List<Integer> userids) {
|
1238
|
1275
|
userMapper.batchUpdateTime(usertime, userids);
|
1239
|
1276
|
}
|
|
1277
|
+
|
|
1278
|
+ /**
|
|
1279
|
+ * 批量激活
|
|
1280
|
+ *
|
|
1281
|
+ * @return void
|
|
1282
|
+ * @Param [userids]
|
|
1283
|
+ * @Author ywx
|
|
1284
|
+ * @Date 2022/6/8 17:10
|
|
1285
|
+ **/
|
|
1286
|
+ public void batchActivate(List<Integer> userids) {
|
|
1287
|
+ userMapper.batchUpdateUserState(1, userids);
|
|
1288
|
+ }
|
1240
|
1289
|
}
|