Browse Source

教师基本信息中班级添加年份

tags/正式3.2.0
王宁 2 years ago
parent
commit
96fd43248f

+ 111
- 90
suser/src/main/java/com/xhkjedu/suser/controller/system/UserController.java View File

4
 import com.xhkjedu.suser.model.system.TUser;
4
 import com.xhkjedu.suser.model.system.TUser;
5
 import com.xhkjedu.suser.service.system.UserService;
5
 import com.xhkjedu.suser.service.system.UserService;
6
 import com.xhkjedu.suser.utils.UserUtil;
6
 import com.xhkjedu.suser.utils.UserUtil;
7
-import com.xhkjedu.utils.N_Utils;
8
-import com.xhkjedu.vo.ResultVo;
9
 import com.xhkjedu.suser.vo.assess.AssessParams;
7
 import com.xhkjedu.suser.vo.assess.AssessParams;
10
 import com.xhkjedu.suser.vo.system.TeacherVo;
8
 import com.xhkjedu.suser.vo.system.TeacherVo;
9
+import com.xhkjedu.utils.N_Utils;
10
+import com.xhkjedu.vo.ResultVo;
11
 import org.springframework.beans.factory.annotation.Autowired;
11
 import org.springframework.beans.factory.annotation.Autowired;
12
 import org.springframework.beans.factory.annotation.Value;
12
 import org.springframework.beans.factory.annotation.Value;
13
 import org.springframework.util.LinkedMultiValueMap;
13
 import org.springframework.util.LinkedMultiValueMap;
37
     private String ssourl;
37
     private String ssourl;
38
 
38
 
39
     /**
39
     /**
40
-     *功能描述 登录接口--非学生
40
+     * 功能描述 登录接口--非学生
41
+     *
42
+     * @param * @param user
43
+     * @return com.xhkjedu.vo.ResultVo
41
      * @author WN
44
      * @author WN
42
      * @date 2020/6/1
45
      * @date 2020/6/1
43
-     * @param  * @param user
44
-     * @return com.xhkjedu.vo.ResultVo
45
      */
46
      */
46
     @PostMapping("/login")
47
     @PostMapping("/login")
47
-    public ResultVo login(@RequestBody TUser user,HttpServletRequest request){
48
+    public ResultVo login(@RequestBody TUser user, HttpServletRequest request) {
48
 //        if (N_Utils.isEmpty(user.getUltype())) return new ResultVo(1,"请更新新版本");
49
 //        if (N_Utils.isEmpty(user.getUltype())) return new ResultVo(1,"请更新新版本");
49
-        N_Utils.validation(new Object[]{user.getLoginname(),"登录名",2,user.getLoginpwd(),"登录密码",2});
50
+        N_Utils.validation(new Object[]{user.getLoginname(), "登录名", 2, user.getLoginpwd(), "登录密码", 2});
50
         if (user.getLoginname().length() > 18) return new ResultVo(1, "账号长度超过18个字符");
51
         if (user.getLoginname().length() > 18) return new ResultVo(1, "账号长度超过18个字符");
51
         Integer usertype = user.getUsertype();
52
         Integer usertype = user.getUsertype();
52
         if (usertype != null && usertype == 2) {//学生登录
53
         if (usertype != null && usertype == 2) {//学生登录
53
             return userService.loginStudent(user, request);
54
             return userService.loginStudent(user, request);
54
         } else {//教师、管理员登录
55
         } else {//教师、管理员登录
55
-            return userService.getUserByLoginnameAndPwd(user,request);
56
+            return userService.getUserByLoginnameAndPwd(user, request);
56
         }
57
         }
57
     }
58
     }
58
 
59
 
59
     //教师登录
60
     //教师登录
60
     @PostMapping("/login_teacher")
61
     @PostMapping("/login_teacher")
61
-    public ResultVo loginTeacher(@RequestBody TUser user,HttpServletRequest request){
62
+    public ResultVo loginTeacher(@RequestBody TUser user, HttpServletRequest request) {
62
 //        if (N_Utils.isEmpty(user.getUltype())) return new ResultVo(1,"请更新新版本");
63
 //        if (N_Utils.isEmpty(user.getUltype())) return new ResultVo(1,"请更新新版本");
63
-        N_Utils.validation(new Object[]{user.getLoginname(),"登录名",2,user.getLoginpwd(),"登录密码",2});
64
+        N_Utils.validation(new Object[]{user.getLoginname(), "登录名", 2, user.getLoginpwd(), "登录密码", 2});
64
         if (user.getLoginname().length() > 18) return new ResultVo(1, "账号长度超过18个字符");
65
         if (user.getLoginname().length() > 18) return new ResultVo(1, "账号长度超过18个字符");
65
-        return userService.loginTeacher(user,request);
66
+        return userService.loginTeacher(user, request);
66
     }
67
     }
67
 
68
 
68
     /**
69
     /**
69
-     *功能描述  登录--学生登录
70
+     * 功能描述  登录--学生登录
71
+     *
72
+     * @param * @param user
73
+     * @return com.xhkjedu.vo.ResultVo
70
      * @author WN
74
      * @author WN
71
      * @date 2020/6/1
75
      * @date 2020/6/1
72
-     * @param  * @param user
73
-     * @return com.xhkjedu.vo.ResultVo
74
      */
76
      */
75
     @PostMapping("/loginstu")
77
     @PostMapping("/loginstu")
76
-    public ResultVo loginStudent(@RequestBody TUser user,HttpServletRequest request){
77
-        N_Utils.validation(new Object[]{user.getLoginname(),"登录名",2,user.getLoginpwd(),"登录密码",2});
78
+    public ResultVo loginStudent(@RequestBody TUser user, HttpServletRequest request) {
79
+        N_Utils.validation(new Object[]{user.getLoginname(), "登录名", 2, user.getLoginpwd(), "登录密码", 2});
78
         if (user.getLoginname().length() > 18) return new ResultVo(1, "账号长度超过18个字符");
80
         if (user.getLoginname().length() > 18) return new ResultVo(1, "账号长度超过18个字符");
79
-        return userService.loginStudent(user,request);
81
+        return userService.loginStudent(user, request);
80
     }
82
     }
81
 
83
 
82
     /**
84
     /**
83
      * 添加用户信息
85
      * 添加用户信息
86
+     *
87
+     * @return com.xhkjedu.vo.ResultVo
84
      * @Param [user]
88
      * @Param [user]
85
      * @Author ywx
89
      * @Author ywx
86
      * @Date 2020/6/2 9:44
90
      * @Date 2020/6/2 9:44
87
-     * @return com.xhkjedu.vo.ResultVo
88
      **/
91
      **/
89
     @PostMapping("/add")
92
     @PostMapping("/add")
90
-    public ResultVo add(@RequestBody TUser user){
93
+    public ResultVo add(@RequestBody TUser user) {
91
         return userService.save(user);
94
         return userService.save(user);
92
     }
95
     }
93
 
96
 
94
     /**
97
     /**
95
      * 修改用户信息
98
      * 修改用户信息
99
+     *
100
+     * @return com.xhkjedu.vo.ResultVo
96
      * @Param [user]
101
      * @Param [user]
97
      * @Author ywx
102
      * @Author ywx
98
      * @Date 2020/6/2 9:51
103
      * @Date 2020/6/2 9:51
99
-     * @return com.xhkjedu.vo.ResultVo
100
      **/
104
      **/
101
     @PostMapping("/update")
105
     @PostMapping("/update")
102
-    public ResultVo update(@RequestBody TUser user){
103
-        N_Utils.validation(new Object[]{user.getUserid(),"用户id",1});
106
+    public ResultVo update(@RequestBody TUser user) {
107
+        N_Utils.validation(new Object[]{user.getUserid(), "用户id", 1});
104
         return userService.update(user);
108
         return userService.update(user);
105
     }
109
     }
106
 
110
 
107
     /**
111
     /**
108
      * 删除用户
112
      * 删除用户
113
+     *
114
+     * @return com.xhkjedu.vo.ResultVo
109
      * @Param [user]
115
      * @Param [user]
110
      * @Author ywx
116
      * @Author ywx
111
      * @Date 2020/6/2 9:59
117
      * @Date 2020/6/2 9:59
112
-     * @return com.xhkjedu.vo.ResultVo
113
      **/
118
      **/
114
     @PostMapping("/delete")
119
     @PostMapping("/delete")
115
-    public ResultVo delete(@RequestBody TUser user){
116
-        N_Utils.validation(new Object[]{user.getUserid(),"用户id",1,user.getDeleteid(),"删除人id",1});
120
+    public ResultVo delete(@RequestBody TUser user) {
121
+        N_Utils.validation(new Object[]{user.getUserid(), "用户id", 1, user.getDeleteid(), "删除人id", 1});
117
         return userService.deleteById(user);
122
         return userService.deleteById(user);
118
     }
123
     }
119
 
124
 
120
     /**
125
     /**
121
      * 获取用户列表
126
      * 获取用户列表
127
+     *
128
+     * @return com.xhkjedu.vo.ResultVo
122
      * @Param [user]
129
      * @Param [user]
123
      * @Author ywx
130
      * @Author ywx
124
      * @Date 2020/6/2 10:06
131
      * @Date 2020/6/2 10:06
125
-     * @return com.xhkjedu.vo.ResultVo
126
      **/
132
      **/
127
     @PostMapping("/list")
133
     @PostMapping("/list")
128
-    public ResultVo list(@RequestBody TUser user){
129
-        N_Utils.validation(new Object[]{user.getPage(),"显示页码",1,user.getPageSize(),"显示条数",1,user.getSchoolid(),"学校id",1});
134
+    public ResultVo list(@RequestBody TUser user) {
135
+        N_Utils.validation(new Object[]{user.getPage(), "显示页码", 1, user.getPageSize(), "显示条数", 1, user.getSchoolid(), "学校id", 1});
130
         return userService.findAll(user);
136
         return userService.findAll(user);
131
     }
137
     }
132
 
138
 
133
     /**
139
     /**
134
      * 获取用户详情
140
      * 获取用户详情
141
+     *
142
+     * @return com.xhkjedu.vo.ResultVo
135
      * @Param [user]
143
      * @Param [user]
136
      * @Author ywx
144
      * @Author ywx
137
      * @Date 2020/6/2 10:23
145
      * @Date 2020/6/2 10:23
138
-     * @return com.xhkjedu.vo.ResultVo
139
      **/
146
      **/
140
     @PostMapping("/detail")
147
     @PostMapping("/detail")
141
-    public ResultVo detail(@RequestBody TUser user){
148
+    public ResultVo detail(@RequestBody TUser user) {
142
         Integer userid = user.getUserid();
149
         Integer userid = user.getUserid();
143
-        N_Utils.validation(new Object[]{userid,"用户id",1});
150
+        N_Utils.validation(new Object[]{userid, "用户id", 1});
144
         return userService.findById(userid);
151
         return userService.findById(userid);
145
     }
152
     }
146
 
153
 
147
     /**
154
     /**
148
      * 修改用户密码
155
      * 修改用户密码
156
+     *
157
+     * @return com.xhkjedu.vo.ResultVo
149
      * @Param [user]
158
      * @Param [user]
150
      * @Author ywx
159
      * @Author ywx
151
      * @Date 2020/6/2 10:30
160
      * @Date 2020/6/2 10:30
152
-     * @return com.xhkjedu.vo.ResultVo
153
      **/
161
      **/
154
     @PostMapping("/update_pwd")
162
     @PostMapping("/update_pwd")
155
-    public ResultVo updatePwd(@RequestBody TUser user){
156
-        N_Utils.validation(new Object[]{user.getUserid(),"用户id",1,user.getOldpwd(),"原密码",2,user.getLoginpwd(),"新密码",2});
163
+    public ResultVo updatePwd(@RequestBody TUser user) {
164
+        N_Utils.validation(new Object[]{user.getUserid(), "用户id", 1, user.getOldpwd(), "原密码", 2, user.getLoginpwd(), "新密码", 2});
157
         return userService.updatePwd(user);
165
         return userService.updatePwd(user);
158
     }
166
     }
159
 
167
 
160
     /**
168
     /**
161
      * 修改用户头像
169
      * 修改用户头像
170
+     *
171
+     * @return com.xhkjedu.vo.ResultVo
162
      * @Param [user]
172
      * @Param [user]
163
      * @Author ywx
173
      * @Author ywx
164
      * @Date 2020/6/2 10:37
174
      * @Date 2020/6/2 10:37
165
-     * @return com.xhkjedu.vo.ResultVo
166
      **/
175
      **/
167
     @PostMapping("/update_headpic")
176
     @PostMapping("/update_headpic")
168
-    public ResultVo updateHeadPic(@RequestBody TUser user){
169
-        N_Utils.validation(new Object[]{user.getUserid(),"用户id",1});
177
+    public ResultVo updateHeadPic(@RequestBody TUser user) {
178
+        N_Utils.validation(new Object[]{user.getUserid(), "用户id", 1});
170
         return userService.updateHeadPic(user);
179
         return userService.updateHeadPic(user);
171
     }
180
     }
172
 
181
 
173
     /**
182
     /**
174
      * 检查登录账号是否存在
183
      * 检查登录账号是否存在
184
+     *
185
+     * @return com.xhkjedu.vo.ResultVo
175
      * @Param [user]
186
      * @Param [user]
176
      * @Author ywx
187
      * @Author ywx
177
      * @Date 2020/6/2 10:43
188
      * @Date 2020/6/2 10:43
178
-     * @return com.xhkjedu.vo.ResultVo
179
      **/
189
      **/
180
     @PostMapping("/check_loginname")
190
     @PostMapping("/check_loginname")
181
-    public ResultVo checkLoginName(@RequestBody TUser user){
191
+    public ResultVo checkLoginName(@RequestBody TUser user) {
182
         String loginname = user.getLoginname();
192
         String loginname = user.getLoginname();
183
-        N_Utils.validation(new Object[]{loginname,"登录名",2});
193
+        N_Utils.validation(new Object[]{loginname, "登录名", 2});
184
         return userService.checkLoginName(loginname);
194
         return userService.checkLoginName(loginname);
185
     }
195
     }
186
 
196
 
187
     /**
197
     /**
188
      * 导入教师
198
      * 导入教师
199
+     *
200
+     * @return com.xhkjedu.vo.ResultVo
189
      * @Param [file, user]
201
      * @Param [file, user]
190
      * @Author ywx
202
      * @Author ywx
191
      * @Date 2020/6/5 8:42
203
      * @Date 2020/6/5 8:42
192
-     * @return com.xhkjedu.vo.ResultVo
193
      **/
204
      **/
194
     @PostMapping("/import_teacher")
205
     @PostMapping("/import_teacher")
195
     public ResultVo importTeacher(MultipartFile file, TUser user) {
206
     public ResultVo importTeacher(MultipartFile file, TUser user) {
197
     }
208
     }
198
 
209
 
199
     /**
210
     /**
200
-     *功能描述  设置操作密码
211
+     * 功能描述  设置操作密码
212
+     *
213
+     * @param * @param user
214
+     * @return com.xhkjedu.vo.ResultVo
201
      * @author WN
215
      * @author WN
202
      * @date 2020/6/17
216
      * @date 2020/6/17
203
-     * @param  * @param user
204
-     * @return com.xhkjedu.vo.ResultVo
205
      */
217
      */
206
     @PostMapping("/update_opepass")
218
     @PostMapping("/update_opepass")
207
-    public ResultVo updateOpepass(@RequestBody TUser user){
219
+    public ResultVo updateOpepass(@RequestBody TUser user) {
208
         N_Utils.validation(new Object[]{
220
         N_Utils.validation(new Object[]{
209
-                user.getUserid(),"用户id",1,
210
-                user.getOpepassword(),"操作密码",2
221
+                user.getUserid(), "用户id", 1,
222
+                user.getOpepassword(), "操作密码", 2
211
         });
223
         });
212
         userService.updateOpepasswordByUserId(user);
224
         userService.updateOpepasswordByUserId(user);
213
-        return new ResultVo(0,"设置操作密码成功");
225
+        return new ResultVo(0, "设置操作密码成功");
214
     }
226
     }
215
 
227
 
216
     /**
228
     /**
217
-     *功能描述  验证操作密码是否正确
229
+     * 功能描述  验证操作密码是否正确
230
+     *
231
+     * @param * @param user
232
+     * @return com.xhkjedu.vo.ResultVo
218
      * @author WN
233
      * @author WN
219
      * @date 2020/6/17
234
      * @date 2020/6/17
220
-     * @param  * @param user
221
-     * @return com.xhkjedu.vo.ResultVo
222
      */
235
      */
223
     @PostMapping("/validate_opepass")
236
     @PostMapping("/validate_opepass")
224
-    public ResultVo validateOpepass(@RequestBody TUser user){
237
+    public ResultVo validateOpepass(@RequestBody TUser user) {
225
         N_Utils.validation(new Object[]{
238
         N_Utils.validation(new Object[]{
226
-                user.getUserid(),"用户id",1,
227
-                user.getOpepassword(),"操作密码",2
239
+                user.getUserid(), "用户id", 1,
240
+                user.getOpepassword(), "操作密码", 2
228
         });
241
         });
229
         Integer result = userService.getUserIdByOpepassword(user);
242
         Integer result = userService.getUserIdByOpepassword(user);
230
-        if(result==1){
231
-            return new ResultVo(0,"操作密码验证成功");
232
-        }else{
233
-            return new ResultVo(1,"操作密码输入有误");
243
+        if (result == 1) {
244
+            return new ResultVo(0, "操作密码验证成功");
245
+        } else {
246
+            return new ResultVo(1, "操作密码输入有误");
234
         }
247
         }
235
 
248
 
236
     }
249
     }
237
 
250
 
238
     /**
251
     /**
239
      * 教师基本信息
252
      * 教师基本信息
253
+     *
254
+     * @return com.xhkjedu.vo.ResultVo
240
      * @Param [user]
255
      * @Param [user]
241
      * @Author ywx
256
      * @Author ywx
242
      * @Date 2020/6/29 16:23
257
      * @Date 2020/6/29 16:23
243
-     * @return com.xhkjedu.vo.ResultVo
244
      **/
258
      **/
245
     @PostMapping("/teacher_info")
259
     @PostMapping("/teacher_info")
246
-    public ResultVo teacherInfo(@RequestBody TUser user){
260
+    public ResultVo teacherInfo(@RequestBody TUser user) {
247
         Integer userid = user.getUserid();
261
         Integer userid = user.getUserid();
248
-        N_Utils.validation(new Object[]{userid,"用户id",1});
249
-        TeacherVo teacherVo = userService.getTeacherInfo(userid, user.getClasstype());
250
-        return new ResultVo(0,"获取教师基本信息成功",teacherVo);
262
+        N_Utils.validation(new Object[]{userid, "用户id", 1, user.getSchoolid(), "学校id", 1});
263
+        TeacherVo teacherVo = userService.getTeacherInfo(user.getSchoolid(), userid, user.getClasstype());
264
+        return new ResultVo(0, "获取教师基本信息成功", teacherVo);
251
     }
265
     }
252
 
266
 
253
     /**
267
     /**
254
      * 重置密码
268
      * 重置密码
269
+     *
270
+     * @return com.xhkjedu.vo.ResultVo
255
      * @Param [user]
271
      * @Param [user]
256
      * @Author ywx
272
      * @Author ywx
257
      * @Date 2020/7/30 14:25
273
      * @Date 2020/7/30 14:25
258
-     * @return com.xhkjedu.vo.ResultVo
259
      **/
274
      **/
260
     @PostMapping("/reset_pwd")
275
     @PostMapping("/reset_pwd")
261
-    public ResultVo resetPwd(@RequestBody TUser user){
262
-        N_Utils.validation(new Object[]{user.getUserid(),"用户id",1,user.getLoginpwd(),"密码",2});
276
+    public ResultVo resetPwd(@RequestBody TUser user) {
277
+        N_Utils.validation(new Object[]{user.getUserid(), "用户id", 1, user.getLoginpwd(), "密码", 2});
263
         return userService.resetPwd(user);
278
         return userService.resetPwd(user);
264
     }
279
     }
265
 
280
 
266
     /**
281
     /**
267
      * 生成修改码
282
      * 生成修改码
283
+     *
284
+     * @return com.xhkjedu.vo.ResultVo
268
      * @Param [user]
285
      * @Param [user]
269
      * @Author ywx
286
      * @Author ywx
270
      * @Date 2020/10/13 15:08
287
      * @Date 2020/10/13 15:08
271
-     * @return com.xhkjedu.vo.ResultVo
272
      **/
288
      **/
273
     @PostMapping("/update_code")
289
     @PostMapping("/update_code")
274
     public ResultVo updateCode(@RequestBody TUser user) {
290
     public ResultVo updateCode(@RequestBody TUser user) {
275
         String userphone = user.getUserphone();
291
         String userphone = user.getUserphone();
276
-        N_Utils.validation(new Object[]{userphone,"手机号",2});
292
+        N_Utils.validation(new Object[]{userphone, "手机号", 2});
277
         return userService.updateCode(userphone);
293
         return userService.updateCode(userphone);
278
     }
294
     }
279
 
295
 
280
     /**
296
     /**
281
      * 通过短信修改密码
297
      * 通过短信修改密码
298
+     *
299
+     * @return com.xhkjedu.vo.ResultVo
282
      * @Param [user]
300
      * @Param [user]
283
      * @Author ywx
301
      * @Author ywx
284
      * @Date 2020/10/13 15:12
302
      * @Date 2020/10/13 15:12
285
-     * @return com.xhkjedu.vo.ResultVo
286
      **/
303
      **/
287
     @PostMapping("/update_pwd_byCode")
304
     @PostMapping("/update_pwd_byCode")
288
     public ResultVo updatePwdByCode(@RequestBody TUser user) {
305
     public ResultVo updatePwdByCode(@RequestBody TUser user) {
289
         String userphone = user.getUserphone();
306
         String userphone = user.getUserphone();
290
         String loginpwd = user.getLoginpwd();
307
         String loginpwd = user.getLoginpwd();
291
         Integer msgcode = user.getMsgcode();
308
         Integer msgcode = user.getMsgcode();
292
-        N_Utils.validation(new Object[]{userphone,"手机号",2,loginpwd,"密码",2,msgcode,"验证码",1});
309
+        N_Utils.validation(new Object[]{userphone, "手机号", 2, loginpwd, "密码", 2, msgcode, "验证码", 1});
293
         return userService.updatePwdByCode(user);
310
         return userService.updatePwdByCode(user);
294
     }
311
     }
295
 
312
 
296
     /**
313
     /**
297
      * 生成登录确认码
314
      * 生成登录确认码
315
+     *
316
+     * @return com.xhkjedu.vo.ResultVo
298
      * @Param [user]
317
      * @Param [user]
299
      * @Author ywx
318
      * @Author ywx
300
      * @Date 2020/10/13 15:18
319
      * @Date 2020/10/13 15:18
301
-     * @return com.xhkjedu.vo.ResultVo
302
      **/
320
      **/
303
     @PostMapping("/login_code")
321
     @PostMapping("/login_code")
304
     public ResultVo loginCode(@RequestBody TUser user) {
322
     public ResultVo loginCode(@RequestBody TUser user) {
305
         String userphone = user.getUserphone();
323
         String userphone = user.getUserphone();
306
-        N_Utils.validation(new Object[]{userphone,"手机号",2});
324
+        N_Utils.validation(new Object[]{userphone, "手机号", 2});
307
         return userService.loginCode(userphone);
325
         return userService.loginCode(userphone);
308
     }
326
     }
309
 
327
 
310
     /**
328
     /**
311
      * 验证码登录
329
      * 验证码登录
330
+     *
331
+     * @return com.xhkjedu.vo.ResultVo
312
      * @Param [user]
332
      * @Param [user]
313
      * @Author ywx
333
      * @Author ywx
314
      * @Date 2020/10/13 15:35
334
      * @Date 2020/10/13 15:35
315
-     * @return com.xhkjedu.vo.ResultVo
316
      **/
335
      **/
317
     @PostMapping("/login_byCode")
336
     @PostMapping("/login_byCode")
318
-    public ResultVo loginByCode(@RequestBody TUser user,HttpServletRequest request) {
319
-        if (N_Utils.isEmpty(user.getUltype())) return new ResultVo(1,"请更新新版本");
337
+    public ResultVo loginByCode(@RequestBody TUser user, HttpServletRequest request) {
338
+        if (N_Utils.isEmpty(user.getUltype())) return new ResultVo(1, "请更新新版本");
320
         String userphone = user.getUserphone();
339
         String userphone = user.getUserphone();
321
         Integer msgcode = user.getMsgcode();
340
         Integer msgcode = user.getMsgcode();
322
-        N_Utils.validation(new Object[]{userphone,"手机号",2,msgcode,"验证码",1});
341
+        N_Utils.validation(new Object[]{userphone, "手机号", 2, msgcode, "验证码", 1});
323
         return userService.loginByCode(user, request);
342
         return userService.loginByCode(user, request);
324
     }
343
     }
325
 
344
 
326
     /**
345
     /**
327
      * 批量修改用户密码
346
      * 批量修改用户密码
347
+     *
348
+     * @return com.xhkjedu.vo.ResultVo
328
      * @Param [user]
349
      * @Param [user]
329
      * @Author ywx
350
      * @Author ywx
330
      * @Date 2020/10/30 16:04
351
      * @Date 2020/10/30 16:04
331
-     * @return com.xhkjedu.vo.ResultVo
332
      **/
352
      **/
333
     @PostMapping("/batch_update_pwd")
353
     @PostMapping("/batch_update_pwd")
334
-    public ResultVo batchUpdatePwd(@RequestBody TUser user){
335
-        N_Utils.validation(new Object[]{user.getSchoolid(),"学校id",1,user.getLoginpwd(),"新密码",2});
336
-        if (N_Utils.isListEmpty(user.getUsertypes())) return new ResultVo(1,"用户类型集合不能为空");
354
+    public ResultVo batchUpdatePwd(@RequestBody TUser user) {
355
+        N_Utils.validation(new Object[]{user.getSchoolid(), "学校id", 1, user.getLoginpwd(), "新密码", 2});
356
+        if (N_Utils.isListEmpty(user.getUsertypes())) return new ResultVo(1, "用户类型集合不能为空");
337
         return userService.batchUpdatePwd(user);
357
         return userService.batchUpdatePwd(user);
338
     }
358
     }
339
 
359
 
340
     //校验登录状态成功
360
     //校验登录状态成功
341
     @PostMapping("/check_login")
361
     @PostMapping("/check_login")
342
-    public ResultVo checkLogin(@RequestBody TUser user){
362
+    public ResultVo checkLogin(@RequestBody TUser user) {
343
         Integer userid = user.getUserid();
363
         Integer userid = user.getUserid();
344
         String loginpwd = user.getLoginpwd();
364
         String loginpwd = user.getLoginpwd();
345
-        N_Utils.validation(new Object[]{userid,"用户id",1,loginpwd,"登录密码",2});
365
+        N_Utils.validation(new Object[]{userid, "用户id", 1, loginpwd, "登录密码", 2});
346
         return userService.checkLogin(userid, loginpwd);
366
         return userService.checkLogin(userid, loginpwd);
347
     }
367
     }
348
 
368
 
357
 
377
 
358
     /**
378
     /**
359
      * 用户名登录
379
      * 用户名登录
380
+     *
381
+     * @return com.xhkjedu.vo.ResultVo
360
      * @Param [user, request]
382
      * @Param [user, request]
361
      * @Author ywx
383
      * @Author ywx
362
      * @Date 2021/11/18 9:52
384
      * @Date 2021/11/18 9:52
363
-     * @return com.xhkjedu.vo.ResultVo
364
      **/
385
      **/
365
     @PostMapping("/login_byName")
386
     @PostMapping("/login_byName")
366
-    public ResultVo loginByName(@RequestBody TUser user,HttpServletRequest request) {
387
+    public ResultVo loginByName(@RequestBody TUser user, HttpServletRequest request) {
367
         String loginname = user.getLoginname();
388
         String loginname = user.getLoginname();
368
-        N_Utils.validation(new Object[]{loginname,"token",2});
389
+        N_Utils.validation(new Object[]{loginname, "token", 2});
369
         MultiValueMap<String, String> param = new LinkedMultiValueMap<>();
390
         MultiValueMap<String, String> param = new LinkedMultiValueMap<>();
370
-        param.add("token",loginname);
391
+        param.add("token", loginname);
371
         String str = UserUtil.sendFormData(ssourl, param);
392
         String str = UserUtil.sendFormData(ssourl, param);
372
         ResultVo result = JSON.parseObject(str, ResultVo.class);
393
         ResultVo result = JSON.parseObject(str, ResultVo.class);
373
         if (result.getCode() != 0) return result;
394
         if (result.getCode() != 0) return result;
374
-        Map map = JSON.parseObject(result.getObj().toString(),Map.class);
395
+        Map map = JSON.parseObject(result.getObj().toString(), Map.class);
375
         user.setLoginname(map.get("loginname").toString());
396
         user.setLoginname(map.get("loginname").toString());
376
         return userService.loginByName(user, request);
397
         return userService.loginByName(user, request);
377
     }
398
     }
378
 
399
 
379
     @PostMapping("/get_headtime")
400
     @PostMapping("/get_headtime")
380
-    public ResultVo getHeadTime(@RequestBody TUser user){
401
+    public ResultVo getHeadTime(@RequestBody TUser user) {
381
         Integer userid = user.getUserid();
402
         Integer userid = user.getUserid();
382
-        N_Utils.validation(new Object[]{userid,"用户id",1});
403
+        N_Utils.validation(new Object[]{userid, "用户id", 1});
383
         Integer headtime = userService.getHeadTime(userid);
404
         Integer headtime = userService.getHeadTime(userid);
384
-        return new ResultVo(0,"获取头像是否可以修改成功",headtime);
405
+        return new ResultVo(0, "获取头像是否可以修改成功", headtime);
385
     }
406
     }
386
 }
407
 }

+ 44
- 28
suser/src/main/java/com/xhkjedu/suser/mapper/system/UserMapper.java View File

21
 public interface UserMapper extends TkMapper<TUser> {
21
 public interface UserMapper extends TkMapper<TUser> {
22
 
22
 
23
     /**
23
     /**
24
-     *功能描述  根据帐号密码获取用户
24
+     * 功能描述  根据帐号密码获取用户
25
+     *
26
+     * @param * @param loginname
27
+     * @return com.xhkjedu.model.system.TUser
25
      * @author WN
28
      * @author WN
26
      * @date 2020/5/29
29
      * @date 2020/5/29
27
-     * @param  * @param loginname
28
-     * @return com.xhkjedu.model.system.TUser
29
      */
30
      */
30
     UserVo getUserByLoginname(String loginname);
31
     UserVo getUserByLoginname(String loginname);
31
 
32
 
32
     /**
33
     /**
33
      * 删除用户
34
      * 删除用户
35
+     *
36
+     * @return java.lang.Integer
34
      * @Param [user]
37
      * @Param [user]
35
      * @Author ywx
38
      * @Author ywx
36
      * @Date 2020/6/2 9:59
39
      * @Date 2020/6/2 9:59
37
-     * @return java.lang.Integer
38
      **/
40
      **/
39
     Integer deleteById(@Param("user") TUser user);
41
     Integer deleteById(@Param("user") TUser user);
40
 
42
 
41
     /**
43
     /**
42
      * 获取用户列表
44
      * 获取用户列表
45
+     *
46
+     * @return java.util.List<com.xhkjedu.suser.vo.system.UserVo>
43
      * @Param [user]
47
      * @Param [user]
44
      * @Author ywx
48
      * @Author ywx
45
      * @Date 2020/6/2 10:07
49
      * @Date 2020/6/2 10:07
46
-     * @return java.util.List<com.xhkjedu.suser.vo.system.UserVo>
47
      **/
50
      **/
48
     List<UserVo> findAll(@Param("user") TUser user);
51
     List<UserVo> findAll(@Param("user") TUser user);
49
 
52
 
50
     /**
53
     /**
51
      * 获取用户详情
54
      * 获取用户详情
55
+     *
56
+     * @return com.xhkjedu.suser.vo.system.UserVo
52
      * @Param [userid]
57
      * @Param [userid]
53
      * @Author ywx
58
      * @Author ywx
54
      * @Date 2020/6/2 10:23
59
      * @Date 2020/6/2 10:23
55
-     * @return com.xhkjedu.suser.vo.system.UserVo
56
      **/
60
      **/
57
     UserVo findById(@Param("userid") Integer userid);
61
     UserVo findById(@Param("userid") Integer userid);
58
 
62
 
59
     /**
63
     /**
60
      * 修改用户密码
64
      * 修改用户密码
65
+     *
66
+     * @return java.lang.Integer
61
      * @Param [user]
67
      * @Param [user]
62
      * @Author ywx
68
      * @Author ywx
63
      * @Date 2020/6/2 10:30
69
      * @Date 2020/6/2 10:30
64
-     * @return java.lang.Integer
65
      **/
70
      **/
66
     Integer updatePwd(@Param("user") TUser user);
71
     Integer updatePwd(@Param("user") TUser user);
67
 
72
 
68
     /**
73
     /**
69
      * 修改用户头像
74
      * 修改用户头像
75
+     *
76
+     * @return java.lang.Integer
70
      * @Param [user]
77
      * @Param [user]
71
      * @Author ywx
78
      * @Author ywx
72
      * @Date 2020/6/2 10:36
79
      * @Date 2020/6/2 10:36
73
-     * @return java.lang.Integer
74
      **/
80
      **/
75
     Integer updateHeadPic(@Param("user") TUser user);
81
     Integer updateHeadPic(@Param("user") TUser user);
76
 
82
 
77
     /**
83
     /**
78
      * 检查登录账号是否存在
84
      * 检查登录账号是否存在
85
+     *
86
+     * @return java.lang.Integer
79
      * @Param [loginname]
87
      * @Param [loginname]
80
      * @Author ywx
88
      * @Author ywx
81
      * @Date 2020/6/2 10:44
89
      * @Date 2020/6/2 10:44
82
-     * @return java.lang.Integer
83
      **/
90
      **/
84
     Integer checkLoginName(@Param("loginname") String loginname);
91
     Integer checkLoginName(@Param("loginname") String loginname);
85
 
92
 
86
     /**
93
     /**
87
      * 根据登录账号获取用户详情
94
      * 根据登录账号获取用户详情
95
+     *
96
+     * @return com.xhkjedu.model.system.TUser
88
      * @Param [loginname]
97
      * @Param [loginname]
89
      * @Author ywx
98
      * @Author ywx
90
      * @Date 2020/6/3 9:33
99
      * @Date 2020/6/3 9:33
91
-     * @return com.xhkjedu.model.system.TUser
92
      **/
100
      **/
93
     TUser getObjByLoginName(@Param("loginname") String loginname);
101
     TUser getObjByLoginName(@Param("loginname") String loginname);
94
 
102
 
95
     /**
103
     /**
96
      * 修改用户状态
104
      * 修改用户状态
105
+     *
106
+     * @return void
97
      * @Param [userid, userstate]
107
      * @Param [userid, userstate]
98
      * @Author ywx
108
      * @Author ywx
99
      * @Date 2020/6/4 9:08
109
      * @Date 2020/6/4 9:08
100
-     * @return void
101
      **/
110
      **/
102
-    void updateState(@Param("userid") Integer userid,@Param("userstate") int userstate);
111
+    void updateState(@Param("userid") Integer userid, @Param("userstate") int userstate);
103
 
112
 
104
     /**
113
     /**
105
-     *功能描述 设置操作密码
106
-     * @author WN
107
-     * @date 2020/6/17
108
-     * @param  * @param userid
114
+     * 功能描述 设置操作密码
115
+     *
116
+     * @param *           @param userid
109
      * @param opepassword
117
      * @param opepassword
110
      * @return void
118
      * @return void
119
+     * @author WN
120
+     * @date 2020/6/17
111
      */
121
      */
112
-    void updateOpepasswordByUserId(@Param("userid") Integer userid,@Param("opepassword") String opepassword);
122
+    void updateOpepasswordByUserId(@Param("userid") Integer userid, @Param("opepassword") String opepassword);
113
 
123
 
114
     /**
124
     /**
115
-     *功能描述 验证用户操作密码是否正确
116
-     * @author WN
117
-     * @date 2020/6/17
118
-     * @param  * @param userid
125
+     * 功能描述 验证用户操作密码是否正确
126
+     *
127
+     * @param *           @param userid
119
      * @param opepassword
128
      * @param opepassword
120
      * @return java.lang.Integer
129
      * @return java.lang.Integer
130
+     * @author WN
131
+     * @date 2020/6/17
121
      */
132
      */
122
-    Integer getUserIdByOpepassword(@Param("userid") Integer userid,@Param("opepassword") String opepassword);
133
+    Integer getUserIdByOpepassword(@Param("userid") Integer userid, @Param("opepassword") String opepassword);
123
 
134
 
124
     /**
135
     /**
125
      * 教师基本信息
136
      * 教师基本信息
137
+     *
138
+     * @return com.xhkjedu.suser.vo.system.TeacherVo
126
      * @Param [userid]
139
      * @Param [userid]
127
      * @Author ywx
140
      * @Author ywx
128
      * @Date 2020/6/29 16:24
141
      * @Date 2020/6/29 16:24
129
-     * @return com.xhkjedu.suser.vo.system.TeacherVo
130
      **/
142
      **/
131
-    TeacherVo getTeacherInfo(Integer userid, Integer classtype);
143
+    TeacherVo getTeacherInfo(Integer userid, Integer classtype, Integer year);
132
 
144
 
133
     /**
145
     /**
134
      * 更新学生硬件绑定信息
146
      * 更新学生硬件绑定信息
147
+     *
148
+     * @return void
135
      * @Param [user]
149
      * @Param [user]
136
      * @Author ywx
150
      * @Author ywx
137
      * @Date 2020/9/18 11:38
151
      * @Date 2020/9/18 11:38
138
-     * @return void
139
      **/
152
      **/
140
     void updateBindMac(@Param("user") UserVo user);
153
     void updateBindMac(@Param("user") UserVo user);
141
 
154
 
142
     /**
155
     /**
143
      * 根据登录账号和硬件地址获取用户信息
156
      * 根据登录账号和硬件地址获取用户信息
157
+     *
158
+     * @return com.xhkjedu.suser.vo.system.UserVo
144
      * @Param [loginname, mac]
159
      * @Param [loginname, mac]
145
      * @Author ywx
160
      * @Author ywx
146
      * @Date 2020/9/21 16:17
161
      * @Date 2020/9/21 16:17
147
-     * @return com.xhkjedu.suser.vo.system.UserVo
148
      **/
162
      **/
149
     UserVo getUserByLoginnameMac(String loginname, String mac);
163
     UserVo getUserByLoginnameMac(String loginname, String mac);
150
 
164
 
151
     /**
165
     /**
152
      * 通过短信修改密码
166
      * 通过短信修改密码
167
+     *
168
+     * @return void
153
      * @Param [user]
169
      * @Param [user]
154
      * @Author ywx
170
      * @Author ywx
155
      * @Date 2020/10/13 15:17
171
      * @Date 2020/10/13 15:17
156
-     * @return void
157
      **/
172
      **/
158
     void updatePwdByCode(@Param("user") TUser user);
173
     void updatePwdByCode(@Param("user") TUser user);
159
 
174
 
160
     /**
175
     /**
161
      * 批量修改用户密码
176
      * 批量修改用户密码
177
+     *
178
+     * @return void
162
      * @Param [user]
179
      * @Param [user]
163
      * @Author ywx
180
      * @Author ywx
164
      * @Date 2020/10/30 16:04
181
      * @Date 2020/10/30 16:04
165
-     * @return void
166
      **/
182
      **/
167
     void batchUpdatePwd(@Param("user") TUser user);
183
     void batchUpdatePwd(@Param("user") TUser user);
168
 
184
 

+ 9
- 8
suser/src/main/java/com/xhkjedu/suser/service/system/UserService.java View File

459
         Integer createid = tUser.getCreateid();
459
         Integer createid = tUser.getCreateid();
460
         N_Utils.validation(new Object[]{schoolid, "学校id", 1, createid, "创建人id", 1});
460
         N_Utils.validation(new Object[]{schoolid, "学校id", 1, createid, "创建人id", 1});
461
         try {
461
         try {
462
-            Map<Integer, Map<String,Integer>> gclasses = new HashMap<>();//年级下班级集合
462
+            Map<Integer, Map<String, Integer>> gclasses = new HashMap<>();//年级下班级集合
463
             List<Map> classes = classMapper.listClass(schoolid, 1);
463
             List<Map> classes = classMapper.listClass(schoolid, 1);
464
-            Map<Integer, List<Map>> grades = classes.stream().collect(Collectors.groupingBy(c->(Integer) c.get("gradeid")));
464
+            Map<Integer, List<Map>> grades = classes.stream().collect(Collectors.groupingBy(c -> (Integer) c.get("gradeid")));
465
             for (Map.Entry<Integer, List<Map>> g : grades.entrySet()) {
465
             for (Map.Entry<Integer, List<Map>> g : grades.entrySet()) {
466
-                Map<String,Integer> cmap = new HashMap<>();
466
+                Map<String, Integer> cmap = new HashMap<>();
467
                 List<Map> list = g.getValue();
467
                 List<Map> list = g.getValue();
468
                 for (Map m : list) {
468
                 for (Map m : list) {
469
-                    cmap.put(m.get("classname").toString(),(Integer) m.get("classid"));
469
+                    cmap.put(m.get("classname").toString(), (Integer) m.get("classid"));
470
                 }
470
                 }
471
-                gclasses.put(g.getKey(),cmap);
471
+                gclasses.put(g.getKey(), cmap);
472
             }
472
             }
473
 
473
 
474
             Map<String, Object> map = PoiUtils.readExcelTeacher(file, gclasses);
474
             Map<String, Object> map = PoiUtils.readExcelTeacher(file, gclasses);
500
                 //处理用户班级
500
                 //处理用户班级
501
                 //先删除任教班级
501
                 //先删除任教班级
502
                 Integer year = schoolMapper.getYearById(schoolid);
502
                 Integer year = schoolMapper.getYearById(schoolid);
503
-                classTeacherMapper.deleteByUserid(userid,year);
503
+                classTeacherMapper.deleteByUserid(userid, year);
504
 
504
 
505
                 Integer grageid = user.getGrageid();
505
                 Integer grageid = user.getGrageid();
506
                 if (N_Utils.isEmptyInteger(grageid)) continue;//年级为空处理下一条数据
506
                 if (N_Utils.isEmptyInteger(grageid)) continue;//年级为空处理下一条数据
575
      * @Author ywx
575
      * @Author ywx
576
      * @Date 2020/6/29 16:23
576
      * @Date 2020/6/29 16:23
577
      **/
577
      **/
578
-    public TeacherVo getTeacherInfo(Integer userid, Integer classtype) {
579
-        return userMapper.getTeacherInfo(userid, classtype);
578
+    public TeacherVo getTeacherInfo(Integer schoolid, Integer userid, Integer classtype) {
579
+        Integer year = schoolMapper.getYearById(schoolid);
580
+        return userMapper.getTeacherInfo(userid, classtype, year);
580
     }
581
     }
581
 
582
 
582
     /**
583
     /**

+ 3
- 3
suser/src/main/resources/mapper/system/UserMapper.xml View File

90
         <result property="headpic" column="headpic"></result>
90
         <result property="headpic" column="headpic"></result>
91
         <result property="subjectname" column="subjectname"></result>
91
         <result property="subjectname" column="subjectname"></result>
92
         <collection property="classlist" ofType="com.xhkjedu.suser.vo.gradeclass.ClassVo"
92
         <collection property="classlist" ofType="com.xhkjedu.suser.vo.gradeclass.ClassVo"
93
-                    javaType="java.util.List" select="listTeacherClass" column="{userid=userid,classtype=classtype}">
93
+                    javaType="java.util.List" select="listTeacherClass" column="{userid=userid,classtype=classtype,year=year}">
94
         </collection>
94
         </collection>
95
     </resultMap>
95
     </resultMap>
96
 
96
 
103
     <select id="listTeacherClass" resultMap="teacherClass">
103
     <select id="listTeacherClass" resultMap="teacherClass">
104
         select c.classid,c.classname,c.gradeid from t_class c
104
         select c.classid,c.classname,c.gradeid from t_class c
105
         left join t_class_teacher ct on c.classid=ct.classid
105
         left join t_class_teacher ct on c.classid=ct.classid
106
-        where ct.teacherid=#{userid} and c.classstate=1
106
+        where ct.teacherid=#{userid} and c.classstate=1 and c.year=#{year}
107
         <if test="classtype!=null and classtype!=0">
107
         <if test="classtype!=null and classtype!=0">
108
             <if test="classtype!=11">and c.classtype=#{classtype}</if>
108
             <if test="classtype!=11">and c.classtype=#{classtype}</if>
109
             <if test="classtype==11">and c.classtype in(1,2)</if>
109
             <if test="classtype==11">and c.classtype in(1,2)</if>
117
     <!--教师基本信息-->
117
     <!--教师基本信息-->
118
     <select id="getTeacherInfo" resultMap="teacherInfoMap">
118
     <select id="getTeacherInfo" resultMap="teacherInfoMap">
119
         select u.userid,u.username,u.headpic,group_concat(distinct s.subjectname order by s.subjectorder)subjectname
119
         select u.userid,u.username,u.headpic,group_concat(distinct s.subjectname order by s.subjectorder)subjectname
120
-        ,#{classtype} classtype,u.usertime
120
+        ,#{classtype} classtype,u.usertime,#{year} year
121
         from t_user u
121
         from t_user u
122
         left join t_teacher_powersb ts on u.userid = ts.teacherid
122
         left join t_teacher_powersb ts on u.userid = ts.teacherid
123
         left join t_subject_book sb on ts.lsbid=sb.lsbid
123
         left join t_subject_book sb on ts.lsbid=sb.lsbid

Loading…
Cancel
Save