派生自 projectDept/qhighschool

胡仁荣
2022-11-08 9cf4f11047a4915024696a51d92d5b80c208fac1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
package com.qxueyou.scc.controller;
 
import java.lang.reflect.InvocationTargetException;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
 
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
 
import com.qxueyou.scc.admin.classes.model.ClsClass;
import com.qxueyou.scc.admin.classes.model.ClsSubjectChapter;
import com.qxueyou.scc.admin.classes.service.IClassLectureService;
import com.qxueyou.scc.admin.classes.service.IClassService;
import com.qxueyou.scc.admin.teacher.service.ITeacherService;
import com.qxueyou.scc.base.model.Pager;
import com.qxueyou.scc.base.model.Result;
import com.qxueyou.scc.base.util.ClientUtils;
import com.qxueyou.scc.base.util.CollectionUtils;
import com.qxueyou.scc.base.util.DateUtils;
import com.qxueyou.scc.base.util.QBeanUtils;
import com.qxueyou.scc.teach.student.service.IStudentService;
import com.qxueyou.scc.teach.subject.model.Subject;
import com.qxueyou.scc.teach.subject.service.ISubjectService;
import com.qxueyou.scc.user.model.UserTeacher;
 
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
 
/**
 * °à¼¶¹ÜÀí¿ØÖÆÆ÷
 *
 * @author chenjunliang
 */
@Api(tags="°à¼¶¹ÜÀí½Ó¿Ú")
@RestController
@RequestMapping("/admin/class")
public class ClassController {
 
    private final Logger log = LogManager.getLogger(ClassController.class);
 
    @Autowired
    IClassService classService;
 
    @Autowired
    ISubjectService subjectService;
 
    @Autowired
    IStudentService studentService;
 
    @Autowired
    ITeacherService teacherService;
 
    @Autowired
    IClassLectureService clsLectureService;
 
    //---------------------------------------------------------------------------------app½Ó¿Ú--------------------------------------------------------------------------------------------------------------------/
    /**
     * »ñÈ¡Õý³£°à¼¶Áбí
     *
     * @param keyword
     * @param limit
     * @param pageNum
     * @return
     */
    @ApiOperation(value = "»ñÈ¡Õý³£°à¼¶Áбí", notes = "")
    @GetMapping(value = "/app/classList")
    public Result classList(@RequestParam(defaultValue = "") String keyword, Pager pager) {
        return this.classService.classList(keyword, pager, 1);
    }
 
    /**
     * »ñÈ¡ÀúÊ·°à¼¶Áбí
     *
     * @param keyword
     * @param limit
     * @param pageNum
     * @return
     */
    @ApiOperation(value = "»ñÈ¡ÀúÊ·°à¼¶Áбí", notes = "")
    @GetMapping(value = "/app/historyClassList")
    public Result historyClassList(@RequestParam(defaultValue = "") String keyword, Pager pager) {
        return this.classService.classList(keyword, pager, 2);
    }
 
    /**
     * Ñ§Ô±ÏêÇé
     *
     * @param classId
     * @param studentId
     * @return
     */
    @ApiOperation(value = "ѧԱÏêÇé", notes = "")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "studentId", value = "ѧԱid", required = true, paramType="query", dataType = "String"),
        @ApiImplicitParam(name = "classId", value = "°à¼¶id", required = true, paramType="query", dataType = "String"),
    })
       @GetMapping(value = "/app/studentInfo")
       public Result studentInfo(String classId, String studentId) {
           return this.studentService.queryStudent(classId, studentId);
       }
 
    /**
     * Ñ§Ô±ÏêÇé
     *
     * @param classId
     * @param studentId
     * @return
     */
    @ApiOperation(value = "ѧԱѧϰ½ø¶È", notes = "")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "studentId", value = "ѧԱid", required = true, paramType="query", dataType = "String"),
        @ApiImplicitParam(name = "classId", value = "°à¼¶id", required = true, paramType="query", dataType = "String"),
    })
       @GetMapping(value = "/app/studentProgress")
       public Result studentProgress(String classId, String studentId) {
           return this.studentService.studentProgress(classId, studentId);
       }
 
       /**
        * »ñÈ¡Ê×Ò³Êý¾ÝÅÅÐÐ
        *
        *
        * @param subjectId
        */
       @ApiOperation(value = "°à¼¶ÅÅÐаñ", notes = "")
       @ApiImplicitParams({
           @ApiImplicitParam(name = "classId", value = "°à¼¶id", required = true, paramType="query", dataType = "String"),
       })
       @GetMapping(value = "/app/getDataDesc")
       public Result getDataDesc(String classId, String subjectId) {
           return subjectService.getDataDesc(classId, subjectId);
       }
 
    /**
     * Ñ§Ô±¿Î³Ì½ø¶È
     *
     *
     * @param subjectId
    */
    @ApiOperation(value = "ѧԱ¿Î³Ì½ø¶È", notes = "")
       @ApiImplicitParams({
           @ApiImplicitParam(name = "classId", value = "°à¼¶id", required = true, paramType="query", dataType = "String"),
           @ApiImplicitParam(name = "subjectId", value = "¿Î³Ìid", required = true, paramType="query", dataType = "String"),
           @ApiImplicitParam(name = "studentId", value = "ѧԱid", required = true, paramType="query", dataType = "String"),
       })
       @GetMapping(value = "/app/studentSubjectProgress")
       public Result studentSubjectProgress(String classId, String subjectId, String studentId) {
 
           return new Result(true, "success", CollectionUtils.newObjectMap("homework", this.subjectService.studentSubjectHomeworkProgress(classId, subjectId, studentId),
                   "exam", this.subjectService.studentSubjectExamProgress(classId, subjectId, studentId)));
       }
 
    /**
     * °à¼¶Ñ§Ô±¿Î³Ì×ÜÌå½ø¶È
     *
     *
     * @param classId
    */
    @ApiOperation(value = "°à¼¶Ñ§Ô±¿Î³Ì×ÜÌå½ø¶È", notes = "")
       @ApiImplicitParams({
           @ApiImplicitParam(name = "classId", value = "°à¼¶id", required = true, paramType="query", dataType = "String"),
       })
       @GetMapping(value = "/app/studentAllSubjectProgress")
       public Result studentSubjectProgress(String classId) {
        if(StringUtils.isEmpty(classId)) {
            return new Result(false, "°à¼¶id²ÎÊý²»ÄÜΪ¿Õ");
        }
           return new Result(true, "success", CollectionUtils.newObjectMap("subjectList", this.subjectService.studentSubjectProgress(classId, new Pager())));
       }
 
    /**
     * °à¼¶Ñ§Ô±¿Î¼þ×ÜÌå½ø¶È
     *
     *
     * @param classId
     */
    @ApiOperation(value = "°à¼¶Ñ§Ô±¿Î¼þ×ÜÌå½ø¶È", notes = "")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "classId", value = "°à¼¶id", required = true, paramType="query", dataType = "String"),
        @ApiImplicitParam(name = "subjectId", value = "¿Î³Ìid", required = true, paramType="query", dataType = "String"),
    })
    @GetMapping(value = "/app/studentSubjectLectureProgress")
    public Result studentSubjectLectureProgress(String classId, String subjectId) {
        if(StringUtils.isEmpty(classId)) {
            return new Result(false, "°à¼¶id²ÎÊý²»ÄÜΪ¿Õ");
        }
        if(StringUtils.isEmpty(subjectId)) {
            return new Result(false, "¿Î³Ìid²ÎÊý²»ÄÜΪ¿Õ");
        }
 
        //»ñÈ¡ËùÓпμþ
        List<Map<String, Object>> lectures = this.subjectService.studentSubjectLectureProgress(subjectId, classId);
        //»ñÈ¡ËùÒÔÕ½Ú
        List<ClsSubjectChapter> chapterLst = clsLectureService.getChapterLectures(clsLectureService.getListChapter(classId, subjectId, null), lectures);
 
        return new Result(true, "success", CollectionUtils.newObjectMap("count",clsLectureService.stuLectureCountBySubject(subjectId, classId), "listData", QBeanUtils.listBean2ListMap(chapterLst,
                CollectionUtils.newStringMap("name", "name", "chapterId", "chapterId", "lectures", "lectures"))));
    }
 
    /**
     * Ñ§Ô±×¢²á
     *
     * @param name          Ñ§Ô±Ãû³Æ
     * @param studentNumber Ñ§ºÅ
     * @param sex           ÐÔ±ð
     * @param mobilePhone   ÊÖ»úºÅ
     */
    @ApiOperation(value = "app¶ËѧԱע²á½Ó¿Ú", notes = "")
       @ApiImplicitParams({
           @ApiImplicitParam(name = "name", value = "Ãû³Æ", required = true, paramType="query", dataType = "String"),
           @ApiImplicitParam(name = "studentNumber", value = "ѧºÅ", required = true, paramType="query", dataType = "String"),
           @ApiImplicitParam(name = "sex", value = "ÐÔ±ð(0Å®£¬1ÄÐ)", required = true, paramType="query", dataType = "String"),
           @ApiImplicitParam(name = "mobilePhone", value = "ÊÖ»úºÅ", required = false, paramType="query", dataType = "String"),
           @ApiImplicitParam(name = "orgId", value = "»ú¹¹", required = true, paramType="query", dataType = "String"),
       })
    @PostMapping(value = "/app/studentRegister")
    public Result studentRegister(String name, String studentNumber, Boolean sex, String mobilePhone, String orgId) {
        return studentService.insertStudent(null, name, studentNumber, sex, mobilePhone, orgId);
    }
 
    //---------------------------------------------------------------------------------app½Ó¿Ú--------------------------------------------------------------------------------------------------------------------/
 
 
    /**
     * ÐÂÔö°à¼¶
     *
     * @param className   °à¼¶Ãû³Æ
     * @param classNumber °à¼¶±àÂë
     * @param startTime   ¿ª°àʱ¼ä
     * @param endTime     ½áÊøÊ±¼ä
     * @param subjectId   ¿Î³Ìid
     */
    @PostMapping(value = "add")
    public Result add(String className, String classNumber, String startTime, String endTime, String subjectId,
                      String teacherId) {
        try {
            return classService.insertClass(className, classNumber, DateUtils.convertStringToDate(startTime),
                    DateUtils.convertStringToDate(endTime), subjectId, teacherId);
 
        } catch (ParseException e) {
            log.error(e, e);
            return new Result(false, "ÈÕÆÚ²ÎÊý´íÎó");
        }
    }
    /**
     * ÐÂÔö²¹¿¼·Ö×é
     * @param className   °à¼¶Ãû³Æ
     * @param classNumber °à¼¶±àÂë
     * @param startTime   ¿ª°àʱ¼ä
     * @param endTime     ½áÊøÊ±¼ä
     * @param subjectId   ¿Î³Ìid
     */
    @PostMapping(value = "addRe")
    public Result addRe(String className, String classNumber, String startTime, String endTime, String subjectId,
                      String teacherId,String classTypes) {
        try {
            ClsClass reClass = classService.getReClass("1");
            //Èç¹û²¹¿¼ÀàÐÍ·Ö×é²»´æÔÚ£¬ÐÂÔö
            if (reClass==null){
                return classService.insertReClass(className, classNumber, DateUtils.convertStringToDate(startTime),
                        DateUtils.convertStringToDate(endTime), subjectId, teacherId,classTypes);
            }else {
                //´æÔÚ·µ»Øfalse
                return new Result(false, "²¹¿¼·Ö×éÒÑ´æÔÚ");
            }
        } catch (ParseException e) {
            log.error(e, e);
            return new Result(false, "ÈÕÆÚ²ÎÊý´íÎó");
        }
    }
 
    /**
     * ÐÂÔö°à¼¶»ñÈ¡¿Î³ÌÁбí
     */
    @GetMapping(value = "getSubjectLst")
    public Result getSubjectlst() {
 
        List<Subject> subjectLst = subjectService.list("", null, "",Subject.TYPE_ORG_SUBJECT, 1000, 1);
 
        return new Result(true, "success", QBeanUtils.listBean2ListMap(subjectLst,
                CollectionUtils.newStringMap("name", "subjectName", "subjectId", "subjectId")));
    }
 
    /**
     * »ñÈ¡°à¼¶Áбí
     *
     * @param keyword
     * @param limit
     * @param pageNum
     * @return
     */
    @ApiOperation(value = "»ñÈ¡°à¼¶Áбí", notes = "")
    @SuppressWarnings({ "unchecked", "rawtypes" })
    @GetMapping(value = "list")
    public Result list(@RequestParam(defaultValue = "") String keyword,
                       @RequestParam(defaultValue = "10") Integer limit, @RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "1")Integer pageType) {
 
        String teacherId = ClientUtils.isAdmin() ? null : teacherService.getTeacherIdByUserId(ClientUtils.getUserId());
        // »ñÈ¡Êý¾Ý
        List<ClsClass> clsLst = classService.getClassLst(keyword, teacherId, limit, pageNum, pageType);
        // »ñÈ¡°à¼¶×ÜÊý
        int count = classService.getClassLstCount(keyword, teacherId, pageType);
        // ×ª³Éǰ¶ËËùÐè×ֶκͽṹ
       List<Map<String, Object>> lstResult = QBeanUtils.listBean2ListMap(clsLst,
                CollectionUtils.newStringMap("name", "className", "classId", "classId", "classNumber", "classNumber","classTypes","classTypes",
                        "studentCount", "studentCount", "createTime", "createTime", "startTime", "startTime", "endTime",
                        "endTime", "subjects", "sbjLst"));
 
        // µ¥¶À´¦Àí¿Î³ÌµÄ×ֶκͽṹ
        for (Map<String, Object> item : lstResult) {
 
            if(item.get("sbjLst")==null){
                continue;
 
            }
 
             item.put("subjectLst",
                   QBeanUtils.listBean2ListMap(
                           this.filtCurrTeacherSubjects((List<Subject>) item.get("sbjLst"),teacherId),
                           CollectionUtils.newStringMap("subjectId", "subjectId", "name", "subjectName",
                                   "teacherId","teacherId","teacherName","teacherName","schoolYear","schoolYear","term","term")));
 
            item.remove("sbjLst");
        }
 
        return new Result(true, "success", CollectionUtils.newObjectMap("classLst", lstResult, "classCount", count));
    }
 
 
    private List<Subject> filtCurrTeacherSubjects(List<Subject> subjects,String teacherId){
        if(StringUtils.isEmpty(teacherId) || subjects==null || subjects.size()==0){
            return subjects;
        }
 
        List<Subject> newSubjects = new ArrayList<Subject>(subjects.size());
 
        for(Subject subject:subjects){
            if(teacherId.equals(subject.getTeacherId())){
                newSubjects.add(subject);
            }
        }
 
        return newSubjects;
    }
 
 
    /**
     * ²éѯ°à¼¶»ù±¾ÐÅÏ¢
     *
     * @param classId °à¼¶id
     * @return
     */
    @ApiOperation(value = "²éѯ°à¼¶»ù±¾ÐÅÏ¢", notes = "")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "classId", value = "°à¼¶id", required = true, paramType="query", dataType = "String"),
    })
    @GetMapping(value = "queryClass")
    public Result findClass(String classId) {
 
        ClsClass cls = classService.read(classId);
 
        return new Result(true, "success", QBeanUtils.bean2Map(cls,
                CollectionUtils.newStringMap("name", "className", "classId", "classId", "classNumber", "classNumber",
                        "studentCount", "studentCount", "createTime", "createTime", "startTime", "startTime", "endTime","endTime","classTypes",
                        "classTypes", "subjects", "subjectLst", "needJoinAudit", "needJoinAudit", "needQuitAudit",
                        "needQuitAudit", "showAnalysisAfterExer", "showAnalysisAfterExer", "canMultiExer",
                        "canMultiExer", "needForum", "needForum", "teacherId", "teacherId")));
    }
 
    /**
     * É¾³ý°à¼¶
     *
     * @param classId °à¼¶id
     * @return
     */
    @GetMapping("delete")
    public Result delete(String classId) {
 
        return classService.deleteClass(classId.split(","));
 
    }
 
    /**
     * ¸´Öư༶
     *
     * @param classId               °à¼¶id
     * @param className             °à¼¶Ãû³Æ
     * @param classNumber           °à¼¶±àÂë
     * @param startTime             ¿ª°àʱ¼ä
     * @param endTime               ½áÊøÊ±¼ä
     * @param subjectId
     * @param needJoinAudit         ÊÇ·ñ¼Ó°àÉóÅú
     * @param needQuitAudit         ÊÇ·ñÍ˰àÉóÅú
     * @param showAnalysisAfterExer Íê³ÉÁ·Ï°ºóÊÇ·ñÏÔʾ´ð°¸
     * @param canMultiExer          ÊÇ·ñÔÊÐíÖØ¸´Ñ§Ï°
     * @param needForum             ÊÇ·ñ¿ªÍ¨ÂÛ̳
     * @return
     */
    @PostMapping(value = "copy")
    public Result doCopy(String classId, String className, String classNumber, String startTime, String endTime,
                         String subjectId, Integer needJoinAudit, Integer needQuitAudit, Integer showAnalysisAfterExer,
                         Integer canMultiExer, Integer needForum) {
        return new Result(true, "copy success");
    }
 
    /**
     * ¸üа༶
     *
     * @param classId               °à¼¶id
     * @param className             °à¼¶Ãû³Æ
     * @param classNumber           °à¼¶±àÂë
     * @param startTime             ¿ª°àʱ¼ä
     * @param endTime               ½áÊøÊ±¼ä
     * @param subjectId
     * @param needJoinAudit         ÊÇ·ñ¼Ó°àÉóÅú
     * @param needQuitAudit         ÊÇ·ñÍ˰àÉóÅú
     * @param showAnalysisAfterExer Íê³ÉÁ·Ï°ºóÊÇ·ñÏÔʾ´ð°¸
     * @param canMultiExer          ÊÇ·ñÔÊÐíÖØ¸´Ñ§Ï°
     * @param needForum             ÊÇ·ñ¿ªÍ¨ÂÛ̳
     * @return
     */
    @PostMapping(value = "update")
    public Result update(String classId, String className, String classNumber, String startTime, String endTime,
                         String teacherId, String subjectId, @RequestParam(defaultValue = "false") Boolean needJoinAudit,
                         @RequestParam(defaultValue = "false") Boolean needQuitAudit,
                         @RequestParam(defaultValue = "false") Boolean showAnalysisAfterExer,
                         @RequestParam(defaultValue = "false") Boolean canMultiExer,
                         @RequestParam(defaultValue = "false") Boolean needForum) {
        try {
            return classService.updateClass(classId, className, classNumber, DateUtils.convertStringToDate(startTime),
                    DateUtils.convertStringToDate(endTime), subjectId, needJoinAudit, needQuitAudit,
                    showAnalysisAfterExer, canMultiExer, needForum, teacherId);
        } catch (ParseException e) {
            log.error(e, e);
            return new Result(false, "ÈÕÆÚ²ÎÊý´íÎó");
        }
    }
 
    /**
     * °à¼¶¹ÜÀí Ñ§Ô±¹ÜÀí »ñȡѧԱÁбí
     *
     * @param classId °à¼¶id
     * @param limit   Ã¿Ò³ÏÔʾ¼¸Ìõ
     * @param pageNum Ò³Âë
     * @param keyword ËÑË÷¹Ø¼ü×Ö
     * @return Ñ§Ï°×´Ì¬ËµÃ÷(0, Î´¿ªÊ¼ ¡£ 1, Ñ§Ï°ÖР¡£ 2, ÒѽáÊø, 3, ´ý¼¤»î ¡£ 4, ÒѶ³½á)
     */
    @ApiOperation(value = "»ñȡѧԱÁбí", notes = "ѧϰ״̬˵Ã÷(0, Î´¿ªÊ¼ ¡£ 1, Ñ§Ï°ÖР¡£ 2, ÒѽáÊø, 3, ´ý¼¤»î ¡£ 4, ÒѶ³½á)")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "classId", value = "°à¼¶id", required = true, paramType="query", dataType = "String"),
    })
    @GetMapping(value = "lstStudent4Class")
    public Result lstStudent4Class(String classId, @RequestParam(defaultValue = "10") Integer limit,
                                   @RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "") String keyword) {
 
        List<Map<String, Object>> students = studentService.getStudentLst(classId, keyword, new Pager(limit, pageNum));
        int studentCount = studentService.getStudentsCount(classId, keyword);
 
        return new Result(true, "success",
                CollectionUtils.newObjectMap("studentCount", studentCount, "studentLst", students));
    }
 
    /**
     * µ¼ÈëѧԱ
     *
     * @param classId °à¼¶id
     */
    @GetMapping(value = "importStudent")
    public Result importStudent(String classId) {
        return new Result(true, "import success");
    }
 
    /**
     * ÐÂÔöѧԱ
     *
     * @param name          Ñ§Ô±Ãû³Æ
     * @param studentNumber Ñ§ºÅ
     * @param classId       °à¼¶id
     * @param sex           ÐÔ±ð
     * @param mobilePhone   ÊÖ»úºÅ
     */
    @PostMapping(value = "addStudent")
    public Result addStudent(String classId, String name, String studentNumber, Boolean sex, String mobilePhone,String comName) {
 
        return studentService.insertStudent(classId, name, studentNumber, sex, mobilePhone, ClientUtils.getOrgId(),comName);
 
    }
 
    /**
     * ¸üÐÂѧԱ
     *
     * @param name          Ñ§Ô±Ãû³Æ
     * @param studentNumber Ñ§ºÅ
     * @param classId       °à¼¶id
     * @param sex           ÐÔ±ð
     * @param mobilePhone   ÊÖ»úºÅ
     */
    @PostMapping(value = "updateStudent")
    public Result updateStudent(String studentId, String name,String password, String studentNumber, Boolean sex, String mobilePhone) {
 
        return studentService.updateStudent(studentId, name,password, studentNumber, sex, mobilePhone);
 
    }
 
 
 
    /**
     * ¼¤»îѧԱ
     *
     * @param studentIds Ñ§Ô±Ids
     */
    @GetMapping(value = "activateStudent")
    public Result activate(String studentIds) {
        return studentService.doActivateStudent(studentIds.split(","));
    }
 
    /**
     * ¶³½áѧԱ
     *
     * @param studentIds Ñ§Ô±Ids
     */
    @GetMapping(value = "blockStudent")
    public Result block(String studentIds) {
        return studentService.doDeActivateStudent(studentIds.split(","));
    }
 
    /**
     * É¾³ýѧԱ
     *
     * @param studentIds Ñ§Ô±Ids
     */
    @GetMapping(value = "deleteStudent")
    public Result deleteStudent(String classId, String studentIds) {
        return studentService.deleteStudent(classId, studentIds.split(","));
    }
 
    /**
     * Ìí¼Ó°à¼¶¿Î³Ì
     * @throws InvocationTargetException
     * @throws IllegalAccessException
     *
     */
    @PostMapping(value = "addClsSubject")
    public Result addClsSubject(String classId, String origSubjectId,String teacherId,Integer schoolYear ,Integer term) throws IllegalAccessException, InvocationTargetException {
        return  this.subjectService.addClsSubject(classId,origSubjectId,teacherId,schoolYear,term);
    }
 
    /**
     * ¸üа༶¿Î³Ì
     */
    @PostMapping(value = "updateClsSubject")
    public Result updateClsSubject(String classId,String subjectId, String origSubjectId,String teacherId,Integer schoolYear ,Integer term) {
        return this.subjectService.updateClsSubject(classId,subjectId,origSubjectId,teacherId,schoolYear,term);
    }
 
    /**
     * É¾³ý°à¼¶¿Î³Ì
     */
    @GetMapping(value = "deleteClsSubject")
    public Result deleteClsSubject(String classId,String subjectIds){
        //ɾ³ý¿Î³Ì¼°¿Î³Ì°à¼¶¹ØÁª¹ØÏµ
        return subjectService.deleteClsSubject(classId,subjectIds.split(","));
    }
 
    /**
     * ËùÓа༶Áбí
     * @param subjectId ¸ù¾ÝsubjectId¹ýÂË
     * @return
     */
    @RequestMapping(value = "/selectlist", method = RequestMethod.GET)
    public @ResponseBody List<Map<String,Object>> classList() {
        return classService.queryAllClassIdAndName();
    }
 
    /**
     * »ñȡѧԱÏêϸÐÅÏ¢
     *
     * @param studentId Ñ§Ô±id
     * @return percent (״̬˵Ã÷£º0,δ¿ªÊ¼¡£1,ѧϰÖС£2,ÒѽáÊø¡£) status (0,δÌá½»¡£1,ÒÑÌá½»)
     */
    @GetMapping(value = "getStudentDetail")
    public Result getStudentDetail(String studentId) {
        // Ñ§Ô±ÐÅÏ¢
        Map<String, Object> studentDetail = CollectionUtils.newObjectMap("studentName", "Àî¸Õ", "classNumber", "123456",
                "sex", 1, "registerTime", new Date(), "email", "12345676@qq.com", "mobilePhone", "13611111123",
                "stuSubjects", 3, "commitExerInfo", 3, "examCount", 3, "releaseTopic", 3, "commentCount", 2);
        // Ñ§Ï°µµ°¸
        Map<String, Object> subjectOne = CollectionUtils.newObjectMap("subjectName", "ÎïÁ÷¿ÆÑ§Ó빤³Ì", "percent", 2,
                "studyDuration", 18, "endStudyTime", new Date(), "score", 96.2);
        Map<String, Object> subjectTwo = CollectionUtils.newObjectMap("subjectName", "ÎïÁ÷¹¤³Ì»ù´¡", "percent", 1,
                "studyDuration", 18, "endStudyTime", new Date(), "score", "");
        Map<String, Object> subjectThree = CollectionUtils.newObjectMap("subjectName", "ÎïÁ÷¹¤³Ì»ù´¡2", "percent", 0,
                "studyDuration", "", "endStudyTime", "", "score", "");
        // ×÷Òµ¼Ç¼
        Map<String, Object> exerOne = CollectionUtils.newObjectMap("exerciseName", "ÎïÁ÷¿ÆÑ§Ó빤³Ì", "subjectName", "ÎïÁ÷¿ÆÑ§Ó빤³Ì",
                "status", 1, "commitTime", new Date(), "score", 96.2);
        Map<String, Object> exerTwo = CollectionUtils.newObjectMap("exerciseName", "ÎïÁ÷¹¤³Ì»ù´¡", "subjectName", "ÎïÁ÷¹¤³Ì»ù´¡",
                "status", 0, "commitTime", "", "score", "");
        Map<String, Object> exerThree = CollectionUtils.newObjectMap("exerciseName", "ÎïÁ÷¹¤³Ì»ù´¡2", "subjectName",
                "ÎïÁ÷¹¤³Ì»ù´¡2", "status", 0, "commitTime", "", "score", "");
        // ¿¼ÊԼǼ
        Map<String, Object> examOne = CollectionUtils.newObjectMap("examName", "ÎïÁ÷¿ÆÑ§Ó빤³Ì", "subjectName", "ÎïÁ÷¿ÆÑ§Ó빤³Ì",
                "status", 1, "commintTime", new Date(), "score", 90.6);
        Map<String, Object> examTwo = CollectionUtils.newObjectMap("examName", "ÎïÁ÷¿ÆÑ§Ó빤³Ì", "subjectName", "ÎïÁ÷¿ÆÑ§Ó빤³Ì",
                "status", 0, "commintTime", new Date(), "score", "");
        return new Result(true, "success",
                CollectionUtils.newObjectMap("studentDetail", studentDetail, "subjectLst",
                        CollectionUtils.newList(subjectOne, subjectTwo, subjectThree), "exerInfoLst",
                        CollectionUtils.newList(exerOne, exerTwo, exerThree), "examLst",
                        CollectionUtils.newList(examOne, examTwo)));
    }
}