Browse Source

课堂模块

tags/正式3.2.0
雍文秀 2 years ago
parent
commit
5add3425a7
75 changed files with 4037 additions and 10 deletions
  1. 34
    8
      sclass/pom.xml
  2. 2
    0
      sclass/src/main/java/com/xhkjedu/sclass/SclassApplication.java
  3. 9
    0
      sclass/src/main/java/com/xhkjedu/sclass/base/TkMapper.java
  4. 81
    0
      sclass/src/main/java/com/xhkjedu/sclass/controller/classroom/ClassroomController.java
  5. 282
    0
      sclass/src/main/java/com/xhkjedu/sclass/controller/classroom/RoomController.java
  6. 108
    0
      sclass/src/main/java/com/xhkjedu/sclass/interceptors/DecryptRequestBodyAdvice.java
  7. 35
    0
      sclass/src/main/java/com/xhkjedu/sclass/interceptors/HttpServletFilter.java
  8. 143
    0
      sclass/src/main/java/com/xhkjedu/sclass/interceptors/RequestInterceptor.java
  9. 82
    0
      sclass/src/main/java/com/xhkjedu/sclass/interceptors/RequestWrapper.java
  10. 62
    0
      sclass/src/main/java/com/xhkjedu/sclass/interceptors/WebMvcConfg.java
  11. 34
    0
      sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomActivestudentMapper.java
  12. 7
    0
      sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomFileMapper.java
  13. 128
    0
      sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomMapper.java
  14. 20
    0
      sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomSignMapper.java
  15. 25
    0
      sclass/src/main/java/com/xhkjedu/sclass/mapper/room/RoomAskstudentMapper.java
  16. 16
    0
      sclass/src/main/java/com/xhkjedu/sclass/mapper/room/RoomAskteacherMapper.java
  17. 16
    0
      sclass/src/main/java/com/xhkjedu/sclass/mapper/room/RoomFileMapper.java
  18. 123
    0
      sclass/src/main/java/com/xhkjedu/sclass/mapper/room/RoomMapper.java
  19. 17
    0
      sclass/src/main/java/com/xhkjedu/sclass/mapper/room/RoomPaperFileMapper.java
  20. 13
    0
      sclass/src/main/java/com/xhkjedu/sclass/mapper/room/RoomPaperMapper.java
  21. 24
    0
      sclass/src/main/java/com/xhkjedu/sclass/mapper/room/RoomPaperQtypeMapper.java
  22. 23
    0
      sclass/src/main/java/com/xhkjedu/sclass/mapper/room/RoomPaperScantronMapper.java
  23. 27
    0
      sclass/src/main/java/com/xhkjedu/sclass/mapper/room/RoomPaperStudentMapper.java
  24. 26
    0
      sclass/src/main/java/com/xhkjedu/sclass/mapper/room/RoomPaperStudentScantronMapper.java
  25. 16
    0
      sclass/src/main/java/com/xhkjedu/sclass/mapper/room/RoomSignMapper.java
  26. 26
    0
      sclass/src/main/java/com/xhkjedu/sclass/model/BaseBean.java
  27. 67
    0
      sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroom.java
  28. 33
    0
      sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomActivestudent.java
  29. 47
    0
      sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomAskstudent.java
  30. 48
    0
      sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomAskteacher.java
  31. 33
    0
      sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomFile.java
  32. 56
    0
      sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomPaper.java
  33. 36
    0
      sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomPaperFile.java
  34. 49
    0
      sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomPaperQtype.java
  35. 48
    0
      sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomPaperScantron.java
  36. 64
    0
      sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomPaperStudent.java
  37. 63
    0
      sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomPaperStudentScantron.java
  38. 27
    0
      sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomSign.java
  39. 83
    0
      sclass/src/main/java/com/xhkjedu/sclass/model/paperstudent/TPaperStudent.java
  40. 83
    0
      sclass/src/main/java/com/xhkjedu/sclass/model/paperstudent/TPaperStudentScantron.java
  41. 103
    0
      sclass/src/main/java/com/xhkjedu/sclass/service/classroom/ClassroomService.java
  42. 228
    0
      sclass/src/main/java/com/xhkjedu/sclass/service/classroom/RoomPaperService.java
  43. 372
    0
      sclass/src/main/java/com/xhkjedu/sclass/service/classroom/RoomService.java
  44. 14
    0
      sclass/src/main/java/com/xhkjedu/sclass/utils/ClassUtil.java
  45. 106
    0
      sclass/src/main/java/com/xhkjedu/sclass/utils/JedisUtil.java
  46. 11
    0
      sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/ObjectiveAnswerVo.java
  47. 32
    0
      sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/ObjectiveVo.java
  48. 33
    0
      sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/ReportEQuestionVo.java
  49. 36
    0
      sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/ReportExamVo.java
  50. 57
    0
      sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/ReportRoomVo.java
  51. 24
    0
      sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/RoomCorrectCallVo.java
  52. 24
    0
      sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/RoomCorrectExamVo.java
  53. 35
    0
      sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/RoomCorrectVo.java
  54. 63
    0
      sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/RoomVo.java
  55. 30
    0
      sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/SubjectiveVo.java
  56. 48
    0
      sclass/src/main/java/com/xhkjedu/sclass/vo/paper/CheckClassVo.java
  57. 46
    0
      sclass/src/main/java/com/xhkjedu/sclass/vo/paper/PaperVo.java
  58. 21
    0
      sclass/src/main/java/com/xhkjedu/sclass/vo/paperstudent/StudentVo.java
  59. 14
    0
      sclass/src/main/java/com/xhkjedu/sclass/vo/room/RoomPVo.java
  60. 12
    0
      sclass/src/main/java/com/xhkjedu/sclass/vo/room/RoomParamVo.java
  61. 2
    2
      sclass/src/main/resources/application.properties
  62. 21
    0
      sclass/src/main/resources/mapper/classroom/ClassroomActivestudentMapper.xml
  63. 8
    0
      sclass/src/main/resources/mapper/classroom/ClassroomFileMapper.xml
  64. 125
    0
      sclass/src/main/resources/mapper/classroom/ClassroomMapper.xml
  65. 19
    0
      sclass/src/main/resources/mapper/classroom/ClassroomSignMapper.xml
  66. 17
    0
      sclass/src/main/resources/mapper/room/RoomAskstudentMapper.xml
  67. 12
    0
      sclass/src/main/resources/mapper/room/RoomAskteacherMapper.xml
  68. 9
    0
      sclass/src/main/resources/mapper/room/RoomFileMapper.xml
  69. 271
    0
      sclass/src/main/resources/mapper/room/RoomMapper.xml
  70. 16
    0
      sclass/src/main/resources/mapper/room/RoomPaperFileMapper.xml
  71. 13
    0
      sclass/src/main/resources/mapper/room/RoomPaperQtypeMapper.xml
  72. 14
    0
      sclass/src/main/resources/mapper/room/RoomPaperScantronMapper.xml
  73. 27
    0
      sclass/src/main/resources/mapper/room/RoomPaperStudentMapper.xml
  74. 48
    0
      sclass/src/main/resources/mapper/room/RoomPaperStudentScantronMapper.xml
  75. 10
    0
      sclass/src/main/resources/mapper/room/RoomSignMapper.xml

+ 34
- 8
sclass/pom.xml View File

22
             <groupId>org.springframework.boot</groupId>
22
             <groupId>org.springframework.boot</groupId>
23
             <artifactId>spring-boot-starter-web</artifactId>
23
             <artifactId>spring-boot-starter-web</artifactId>
24
         </dependency>
24
         </dependency>
25
-        <dependency>
26
-            <groupId>org.springframework.cloud</groupId>
27
-            <artifactId>spring-cloud-starter-config</artifactId>
28
-        </dependency>
29
-        <dependency>
30
-            <groupId>org.springframework.cloud</groupId>
31
-            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
32
-        </dependency>
25
+        <!--<dependency>-->
26
+        <!--    <groupId>org.springframework.cloud</groupId>-->
27
+        <!--    <artifactId>spring-cloud-starter-config</artifactId>-->
28
+        <!--</dependency>-->
29
+        <!--<dependency>-->
30
+        <!--    <groupId>org.springframework.cloud</groupId>-->
31
+        <!--    <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>-->
32
+        <!--</dependency>-->
33
 
33
 
34
         <dependency>
34
         <dependency>
35
             <groupId>mysql</groupId>
35
             <groupId>mysql</groupId>
45
             <artifactId>spring-boot-starter-test</artifactId>
45
             <artifactId>spring-boot-starter-test</artifactId>
46
             <scope>test</scope>
46
             <scope>test</scope>
47
         </dependency>
47
         </dependency>
48
+        <dependency>
49
+            <groupId>com.xhkjedu</groupId>
50
+            <artifactId>scommons</artifactId>
51
+            <version>0.0.1-SNAPSHOT</version>
52
+        </dependency>
53
+        <!-- https://mvnrepository.com/artifact/tk.mybatis/mapper-spring-boot-starter -->
54
+        <dependency>
55
+            <groupId>tk.mybatis</groupId>
56
+            <artifactId>mapper-spring-boot-starter</artifactId>
57
+            <version>2.0.2</version>
58
+        </dependency>
59
+        <dependency>
60
+            <groupId>com.alibaba</groupId>
61
+            <artifactId>fastjson</artifactId>
62
+            <version>1.2.56</version>
63
+        </dependency>
64
+        <!-- redis -->
65
+        <dependency>
66
+            <groupId>redis.clients</groupId>
67
+            <artifactId>jedis</artifactId>
68
+            <version>2.9.3</version>
69
+        </dependency>
70
+        <dependency>
71
+            <groupId>org.springframework.boot</groupId>
72
+            <artifactId>spring-boot-starter-data-redis</artifactId>
73
+        </dependency>
48
     </dependencies>
74
     </dependencies>
49
     <dependencyManagement>
75
     <dependencyManagement>
50
         <dependencies>
76
         <dependencies>

+ 2
- 0
sclass/src/main/java/com/xhkjedu/sclass/SclassApplication.java View File

2
 
2
 
3
 import org.springframework.boot.SpringApplication;
3
 import org.springframework.boot.SpringApplication;
4
 import org.springframework.boot.autoconfigure.SpringBootApplication;
4
 import org.springframework.boot.autoconfigure.SpringBootApplication;
5
+import tk.mybatis.spring.annotation.MapperScan;
5
 
6
 
6
 @SpringBootApplication
7
 @SpringBootApplication
8
+@MapperScan("com.xhkjedu.sclass.mapper")
7
 public class SclassApplication {
9
 public class SclassApplication {
8
 
10
 
9
     public static void main(String[] args) {
11
     public static void main(String[] args) {

+ 9
- 0
sclass/src/main/java/com/xhkjedu/sclass/base/TkMapper.java View File

1
+package com.xhkjedu.sclass.base;
2
+
3
+import tk.mybatis.mapper.common.IdsMapper;
4
+import tk.mybatis.mapper.common.Mapper;
5
+import tk.mybatis.mapper.common.MySqlMapper;
6
+
7
+public interface TkMapper<T> extends Mapper<T>, MySqlMapper<T>, IdsMapper<T> {
8
+
9
+}

+ 81
- 0
sclass/src/main/java/com/xhkjedu/sclass/controller/classroom/ClassroomController.java View File

1
+package com.xhkjedu.sclass.controller.classroom;
2
+
3
+import com.github.pagehelper.PageHelper;
4
+import com.github.pagehelper.PageInfo;
5
+import com.xhkjedu.vo.PageResult;
6
+import com.xhkjedu.sclass.model.classroom.TClassroom;
7
+import com.xhkjedu.sclass.model.classroom.TClassroomFile;
8
+import com.xhkjedu.sclass.service.classroom.ClassroomService;
9
+import com.xhkjedu.utils.N_Utils;
10
+import com.xhkjedu.utils.PageUtil;
11
+import com.xhkjedu.vo.ResultVo;
12
+import com.xhkjedu.sclass.vo.classroom.RoomVo;
13
+import lombok.extern.slf4j.Slf4j;
14
+import org.springframework.web.bind.annotation.PostMapping;
15
+import org.springframework.web.bind.annotation.RequestBody;
16
+import org.springframework.web.bind.annotation.RequestMapping;
17
+import org.springframework.web.bind.annotation.RestController;
18
+
19
+import javax.annotation.Resource;
20
+import java.util.List;
21
+import java.util.Map;
22
+
23
+@RestController
24
+@RequestMapping("room")
25
+@Slf4j
26
+public class ClassroomController {
27
+
28
+    @Resource
29
+    private ClassroomService classroomService;
30
+
31
+    /**
32
+     * 获取课堂回顾列表
33
+     * @Param [room]
34
+     * @Author ywx
35
+     * @Date 2020/6/15 10:57
36
+     * @return com.xhkjedu.vo.ResultVo
37
+     **/
38
+    @PostMapping("list_class_directorid")
39
+    public ResultVo listClassByDirectorId(@RequestBody TClassroom room) {
40
+        try {
41
+            Integer teacherid = room.getTeacherid();
42
+            Integer page = room.getPage();
43
+            Integer pageSize = room.getPageSize();
44
+            N_Utils.validation(new Object[]{teacherid,"教师id",1,page,"显示页码",1,pageSize,"显示条数",1});
45
+            PageHelper.startPage(page, pageSize);
46
+            List<RoomVo> list = classroomService.listClassByDirectorId(room);
47
+            PageResult pageResult = PageUtil.getPageResult(new PageInfo<>(list));
48
+            return new ResultVo(0,"获取课堂回顾列表成功",pageResult);
49
+        } catch (Exception e) {
50
+            log.error("获取课堂回顾列表失败:" + e.getMessage());
51
+            return new ResultVo(1,"获取课堂回顾列表失败");
52
+        }
53
+    }
54
+
55
+    /**
56
+     * 课堂回顾详情
57
+     * @Param [room]
58
+     * @Author ywx
59
+     * @Date 2020/6/26 9:36
60
+     * @return com.xhkjedu.vo.ResultVo
61
+     **/
62
+    @PostMapping("/report")
63
+    public ResultVo report(@RequestBody TClassroom room) {
64
+        N_Utils.validation(new Object[]{room.getRoomid(),"课堂id",1});
65
+        return classroomService.getReport(room.getRoomid());
66
+    }
67
+
68
+    @PostMapping("/del_file")
69
+    public ResultVo delFile(@RequestBody TClassroomFile file) {
70
+        N_Utils.validation(new Object[]{file.getRfid(),"课堂图片id",1});
71
+        classroomService.delFile(file.getRfid());
72
+        return new ResultVo(0,"删除成功");
73
+    }
74
+
75
+    @PostMapping("/list_student")
76
+    public ResultVo listStudent(@RequestBody TClassroom room) {
77
+        N_Utils.validation(new Object[]{room.getClassid(),"班级id",1,room.getLsbid(),"教材关联id",2});
78
+        List<Map> list = classroomService.listStudent(room.getClassid(), room.getLsbid());
79
+        return new ResultVo(0,"获取班级学生列表成功",list);
80
+    }
81
+}

+ 282
- 0
sclass/src/main/java/com/xhkjedu/sclass/controller/classroom/RoomController.java View File

1
+package com.xhkjedu.sclass.controller.classroom;
2
+
3
+import com.alibaba.fastjson.JSON;
4
+import com.github.pagehelper.PageHelper;
5
+import com.github.pagehelper.PageInfo;
6
+import com.xhkjedu.sclass.model.classroom.TClassroom;
7
+import com.xhkjedu.sclass.model.classroom.TClassroomAskstudent;
8
+import com.xhkjedu.sclass.model.classroom.TClassroomAskteacher;
9
+import com.xhkjedu.sclass.model.classroom.TClassroomFile;
10
+import com.xhkjedu.sclass.model.classroom.TClassroomPaper;
11
+import com.xhkjedu.sclass.model.classroom.TClassroomPaperStudent;
12
+import com.xhkjedu.sclass.model.classroom.TClassroomSign;
13
+import com.xhkjedu.sclass.model.paperstudent.TPaperStudent;
14
+import com.xhkjedu.sclass.model.paperstudent.TPaperStudentScantron;
15
+import com.xhkjedu.sclass.service.classroom.RoomPaperService;
16
+import com.xhkjedu.sclass.service.classroom.RoomService;
17
+import com.xhkjedu.sclass.vo.classroom.ObjectiveVo;
18
+import com.xhkjedu.sclass.vo.classroom.ReportEQuestionVo;
19
+import com.xhkjedu.sclass.vo.classroom.RoomCorrectCallVo;
20
+import com.xhkjedu.sclass.vo.classroom.RoomCorrectExamVo;
21
+import com.xhkjedu.sclass.vo.classroom.RoomCorrectVo;
22
+import com.xhkjedu.sclass.vo.classroom.RoomVo;
23
+import com.xhkjedu.sclass.vo.classroom.SubjectiveVo;
24
+import com.xhkjedu.sclass.vo.paper.CheckClassVo;
25
+import com.xhkjedu.sclass.vo.paperstudent.StudentVo;
26
+import com.xhkjedu.sclass.vo.room.RoomPVo;
27
+import com.xhkjedu.sclass.vo.room.RoomParamVo;
28
+import com.xhkjedu.utils.N_Utils;
29
+import com.xhkjedu.utils.PageUtil;
30
+import com.xhkjedu.vo.PageResult;
31
+import com.xhkjedu.vo.ResultVo;
32
+import lombok.extern.slf4j.Slf4j;
33
+import org.springframework.web.bind.annotation.PostMapping;
34
+import org.springframework.web.bind.annotation.RequestBody;
35
+import org.springframework.web.bind.annotation.RequestMapping;
36
+import org.springframework.web.bind.annotation.RestController;
37
+
38
+import javax.annotation.Resource;
39
+import java.util.ArrayList;
40
+import java.util.List;
41
+import java.util.Map;
42
+import java.util.stream.Collectors;
43
+
44
+@RestController
45
+@RequestMapping("croom")
46
+@Slf4j
47
+public class RoomController {
48
+
49
+    @Resource
50
+    private RoomService roomService;
51
+    @Resource
52
+    private RoomPaperService roomPaperService;
53
+
54
+    /**
55
+     * 保存课堂数据
56
+     * @Param [params]
57
+     * @Author ywx
58
+     * @Date 2020/7/14 16:45
59
+     * @return com.xhkjedu.sclass.vo.ResultVo
60
+     **/
61
+    @PostMapping("/saveclass")
62
+    public ResultVo saveClass(@RequestBody List<RoomPVo> rooms) {
63
+        ResultVo resultVo = new ResultVo();
64
+        resultVo.setCode(1);
65
+        try {
66
+            List<Long> savelst = new ArrayList<>();//用于更新课堂时间参与学生
67
+            List<Integer> classlst = new ArrayList<>();//用于更新班级课堂状态
68
+            for (RoomPVo r : rooms) {
69
+                savelst.add(r.getRoomid());
70
+                List<RoomParamVo> params = r.getParams();
71
+                for (RoomParamVo param : params) {
72
+                    String rtype = param.getRtype();
73
+                    String jsonstr = param.getJsonstr();
74
+                    N_Utils.validation(new Object[]{rtype,"请求类型",2,jsonstr,"请求json",2});
75
+                    if (rtype.equals("startclass")){//课堂--开始
76
+                        TClassroom room = JSON.parseObject(jsonstr,TClassroom.class);
77
+                        classlst.add(room.getClassid());
78
+                        boolean rtn = roomService.startClass(room);//课堂是否重复请求
79
+                        if (rtn) {
80
+                            break;//课堂重复请求结束循环,执行下个课堂数据
81
+                        }
82
+                    } else if (rtype.equals("stopclass")){//课堂--结束
83
+                        TClassroom room = JSON.parseObject(jsonstr,TClassroom.class);
84
+                        roomService.stopClass(room);
85
+                    } else if (rtype.equals("savefile")){//课堂--保存图片
86
+                        TClassroomFile file = JSON.parseObject(jsonstr,TClassroomFile.class);
87
+                        roomService.saveFile(file);
88
+                    } else if (rtype.equals("askteacher")){//互动--发起
89
+                        TClassroomAskteacher teacher = JSON.parseObject(jsonstr,TClassroomAskteacher.class);
90
+                        roomService.saveWork(teacher);
91
+                    } else if (rtype.equals("askstudent")){//互动--保存学生作答情况
92
+                        TClassroomAskstudent student = JSON.parseObject(jsonstr,TClassroomAskstudent.class);
93
+                        roomService.saveStuAnswer(student);
94
+                    } else if (rtype.equals("sign")){//学生--签到
95
+                        TClassroomSign sign = JSON.parseObject(jsonstr,TClassroomSign.class);
96
+                        roomService.saveStudentSign(sign);
97
+                    } else if (rtype.equals("paper")){//堂测--发布
98
+                        TClassroomPaper paper = JSON.parseObject(jsonstr,TClassroomPaper.class);
99
+                        roomPaperService.saveScantronPaper(paper);
100
+                    } else if (rtype.equals("stupaper")){//堂测--学生作答详情
101
+                        TClassroomPaperStudent student = JSON.parseObject(jsonstr,TClassroomPaperStudent.class);
102
+                        roomPaperService.saveStudentScantron(student);
103
+                    }
104
+                }
105
+            }
106
+
107
+            //最后更新课堂中实际上课学生数量
108
+            roomService.updateBatchRoomRealStunum(savelst);
109
+
110
+            List<Integer> distinctclass = classlst.stream().distinct().collect(Collectors.toList());
111
+            //结束班级
112
+            roomService.updateBatchRoomState(distinctclass);
113
+            resultVo.setCode(0);
114
+            resultVo.setMsg("保存成功");
115
+        } catch (Exception e) {
116
+            log.error("保存课堂数据失败:"+e.getMessage());
117
+            resultVo.setMsg("保存失败");
118
+        }
119
+        return resultVo;
120
+    }
121
+
122
+    @PostMapping("/list_correct")
123
+    public ResultVo listCorrect(@RequestBody RoomVo room) {
124
+        Long roomid = room.getRoomid();
125
+        N_Utils.validation(new Object[]{roomid,"课堂id",1});
126
+        RoomCorrectVo correct = roomService.listCorrect(roomid);
127
+        return new ResultVo(0,"获取批阅信息成功",correct);
128
+    }
129
+
130
+    @PostMapping("/check_students_call")
131
+    public ResultVo listStudentsByAskTid(@RequestBody RoomCorrectCallVo call) {
132
+        Long asktid = call.getAsktid();
133
+        N_Utils.validation(new Object[]{asktid,"互动id",1});
134
+        CheckClassVo checkVo = roomService.listStudentsByAskTid(asktid);
135
+        return new ResultVo(0,"获取提问批改学生列表成功",checkVo);
136
+    }
137
+
138
+    @PostMapping("/check_students_exam")
139
+    public ResultVo listStudentsByPaperId(@RequestBody RoomCorrectExamVo exam) {
140
+        Long paperid = exam.getPaperid();
141
+        N_Utils.validation(new Object[]{paperid,"考试id",1});
142
+        CheckClassVo checkVo = roomService.listStudentsByPaperId(paperid);
143
+        return new ResultVo(0,"获取考试批改学生列表成功",checkVo);
144
+    }
145
+
146
+    @PostMapping("call_objective")
147
+    public ResultVo callObjective(@RequestBody RoomCorrectCallVo call) {
148
+        try {
149
+            Long asktid = call.getAsktid();
150
+            N_Utils.validation(new Object[]{asktid,"互动id",1});
151
+            ObjectiveVo objective = roomService.callObjective(asktid, call.getRealstunum());
152
+            return new ResultVo(0,"获取课堂提问客观题详情成功",objective);
153
+        } catch (Exception e) {
154
+            log.error("获取课堂提问客观题详情失败:" + e.getMessage());
155
+            return new ResultVo(1,"获取课堂提问客观题详情失败");
156
+        }
157
+    }
158
+
159
+    @PostMapping("exam_objective")
160
+    public ResultVo examObjective(@RequestBody ReportEQuestionVo question) {
161
+        try {
162
+            Long pscaid = question.getPscaid();
163
+            N_Utils.validation(new Object[]{pscaid,"答题卡id",1});
164
+            ObjectiveVo objective = roomService.examObjective(pscaid, question.getRealstunum());
165
+            return new ResultVo(0,"获取课堂考试客观题详情成功",objective);
166
+        } catch (Exception e) {
167
+            log.error("获取课堂考试客观题详情失败:" + e.getMessage());
168
+            return new ResultVo(1,"获取课堂考试客观题详情失败");
169
+        }
170
+    }
171
+
172
+    @PostMapping("call_subjective")
173
+    public ResultVo callSubjective(@RequestBody RoomCorrectCallVo call) {
174
+        try {
175
+            Long asktid = call.getAsktid();
176
+            N_Utils.validation(new Object[]{asktid,"互动id",1});
177
+            SubjectiveVo subjective = roomService.callSubjective(asktid, call.getRealstunum());
178
+            return new ResultVo(0,"获取课堂提问主观题详情成功",subjective);
179
+        } catch (Exception e) {
180
+            log.error("获取课堂提问客观题详情失败:" + e.getMessage());
181
+            return new ResultVo(1,"获取课堂提问主观题详情失败");
182
+        }
183
+    }
184
+
185
+    @PostMapping("exam_subjective")
186
+    public ResultVo examSubjective(@RequestBody ReportEQuestionVo question) {
187
+        try {
188
+            Long pscaid = question.getPscaid();
189
+            N_Utils.validation(new Object[]{pscaid,"答题卡id",1});
190
+            SubjectiveVo subjective = roomService.examSubjective(pscaid, question.getRealstunum());
191
+            return new ResultVo(0,"获取课堂考试主观题详情成功",subjective);
192
+        } catch (Exception e) {
193
+            log.error("获取课堂考试客观题详情失败:" + e.getMessage());
194
+            return new ResultVo(1,"获取课堂考试主观题详情失败");
195
+        }
196
+    }
197
+
198
+    @PostMapping("/correct_call")
199
+    public ResultVo correctCall(@RequestBody StudentVo student) {
200
+        Integer psid = student.getPsid();
201
+        Integer pschecked = student.getPschecked();
202
+        N_Utils.validation(new Object[]{psid,"互动学生id",1,pschecked,"批改结果",1});
203
+        roomService.correctCall(psid, pschecked);
204
+        return new ResultVo(0,"批阅成功");
205
+    }
206
+
207
+    @PostMapping("/correct_exam")
208
+    public ResultVo correctExam(@RequestBody TPaperStudent ps) {
209
+        try {
210
+            Integer psid = ps.getPsid();
211
+            Integer checkid = ps.getCreateid();
212
+            String questionResult = ps.getQuestionResult();
213
+            N_Utils.validation(new Object[]{psid,"试卷学生id",1,checkid,"批改人id",1});
214
+            int result = roomPaperService.correctExam(psid, checkid, questionResult);
215
+            if (result > 0) {
216
+                return new ResultVo(0, "批阅成功",0);
217
+            } else {
218
+                return new ResultVo(0, "批阅完成",1);
219
+            }
220
+        } catch (Exception e) {
221
+            return new ResultVo(1,"批阅失败");
222
+        }
223
+    }
224
+
225
+    @PostMapping("/list_correct_question")
226
+    public ResultVo listCorrectQuestion(@RequestBody TPaperStudent paperStudent) {
227
+        Integer psid = paperStudent.getPsid();
228
+        N_Utils.validation(new Object[]{psid,"考试学生id",1});
229
+        //根据考试学生id获取考试是否完成批阅
230
+        /*Integer checked = roomPaperService.getCheckedByPsId(psid);
231
+        if (checked == 1){
232
+            return new ResultVo(1,"考试已结束批阅");
233
+        }*/
234
+        List<Map> paperQuestions = roomPaperService.listCorrectQuestion(psid);
235
+        return new ResultVo(0,"获取考试学生待批改试题列表成功!",paperQuestions);
236
+    }
237
+
238
+    @PostMapping("/mark_call")
239
+    public ResultVo markCall(@RequestBody StudentVo student) {
240
+        Integer psid = student.getPsid();
241
+        String studentpic = student.getStudentpic();
242
+        N_Utils.validation(new Object[]{psid,"互动学生id",1,studentpic,"批改结果",1});
243
+        roomService.updateStudentpic(psid, studentpic);
244
+        return new ResultVo(0,"保存成功");
245
+    }
246
+
247
+    @PostMapping("/mark_question")
248
+    public ResultVo markQuestion(@RequestBody TPaperStudentScantron ps) {
249
+        Integer pssid = ps.getPssid();
250
+        String useranswer = ps.getUseranswer();
251
+        N_Utils.validation(new Object[]{pssid,"考试学生试题id",1,useranswer,"批改结果",2});
252
+        roomPaperService.updateScantronUseranswer(pssid, useranswer);
253
+        return new ResultVo(0, "保存成功");
254
+    }
255
+
256
+    @PostMapping("list_class_stu")
257
+    public ResultVo listStuClass(@RequestBody TClassroom room) {
258
+        try {
259
+            Integer studentid = room.getStudentid();
260
+            String subjectid = room.getSubjectid();
261
+            Integer page = room.getPage();
262
+            Integer pageSize = room.getPageSize();
263
+            N_Utils.validation(new Object[]{studentid,"学生id",1,subjectid,"科目id",2
264
+                    ,page,"显示页码",1,pageSize,"显示条数",1});
265
+            PageHelper.startPage(page, pageSize);
266
+            List<RoomVo> list = roomService.listStuClass(room);
267
+            PageResult pageResult = PageUtil.getPageResult(new PageInfo<>(list));
268
+            return new ResultVo(0,"获取学生课堂回顾列表成功",pageResult);
269
+        } catch (Exception e) {
270
+            log.error("获取学生课堂回顾列表失败:" + e.getMessage());
271
+            return new ResultVo(1,"获取学生课堂回顾列表失败");
272
+        }
273
+    }
274
+
275
+    @PostMapping("/report_stu")
276
+    public ResultVo reportStu(@RequestBody TClassroom room) {
277
+        Long roomid = room.getRoomid();
278
+        Integer createid = room.getCreateid();
279
+        N_Utils.validation(new Object[]{roomid,"课堂id",1,createid,"学生id",1});
280
+        return roomService.getReportStu(roomid, createid);
281
+    }
282
+}

+ 108
- 0
sclass/src/main/java/com/xhkjedu/sclass/interceptors/DecryptRequestBodyAdvice.java View File

1
+package com.xhkjedu.sclass.interceptors;
2
+
3
+import com.xhkjedu.utils.AES;
4
+import com.xhkjedu.utils.N_Utils;
5
+import lombok.extern.slf4j.Slf4j;
6
+import org.springframework.core.MethodParameter;
7
+import org.springframework.http.HttpHeaders;
8
+import org.springframework.http.HttpInputMessage;
9
+import org.springframework.http.converter.HttpMessageConverter;
10
+import org.springframework.util.StreamUtils;
11
+import org.springframework.web.bind.annotation.ControllerAdvice;
12
+import org.springframework.web.servlet.mvc.method.annotation.RequestBodyAdvice;
13
+
14
+import javax.crypto.BadPaddingException;
15
+import javax.crypto.IllegalBlockSizeException;
16
+import javax.crypto.NoSuchPaddingException;
17
+import java.io.ByteArrayInputStream;
18
+import java.io.IOException;
19
+import java.io.InputStream;
20
+import java.io.UnsupportedEncodingException;
21
+import java.lang.reflect.Type;
22
+import java.security.InvalidKeyException;
23
+import java.security.NoSuchAlgorithmException;
24
+import java.util.List;
25
+
26
+/**
27
+ * @ClassName DecryptRequestBodyAdvice
28
+ * Description TODO AES解密
29
+ * Author WN
30
+ * Date 2021/5/12 11:34
31
+ **/
32
+@Slf4j
33
+@ControllerAdvice
34
+public class DecryptRequestBodyAdvice implements RequestBodyAdvice {
35
+
36
+    private static String AES_KEY = "XINGHUOLIAOYUAN7";
37
+
38
+    /** 此处如果返回false , 则不执行当前Advice的业务 */
39
+    @Override
40
+    public boolean supports(MethodParameter methodParameter, Type type, Class<? extends HttpMessageConverter<?>> aClass) {
41
+//       log.info("----support----");
42
+        return true;
43
+    }
44
+
45
+    /**
46
+     * @title 读取参数前执行
47
+     * @description 在此做些编码 / 解密 / 封装参数为对象的操作
48
+     **/
49
+    @Override
50
+    public HttpInputMessage beforeBodyRead(HttpInputMessage httpInputMessage, MethodParameter methodParameter, Type type, Class<? extends HttpMessageConverter<?>> aClass) throws IOException {
51
+//        log.info("----beforeBodyRead----");
52
+
53
+        //AES解密,false不需要解密
54
+        List<String> decrypts = httpInputMessage.getHeaders().get("st");
55
+        String decrypt = N_Utils.isListNotEmpty(decrypts)?decrypts.get(0):"false";
56
+        if (!decrypt.equals("true")) {
57
+            return httpInputMessage;
58
+        }
59
+        // 读取加密的请求体
60
+        byte[] body = StreamUtils.copyToByteArray(httpInputMessage.getBody());
61
+        String str = new String(body,"utf-8");
62
+
63
+        try {
64
+            // 使用AES解密
65
+            body = AES.decryptForByte(str, AES_KEY);
66
+        } catch (InvalidKeyException | NoSuchAlgorithmException | NoSuchPaddingException | IllegalBlockSizeException |
67
+                BadPaddingException | UnsupportedEncodingException e) {
68
+            e.printStackTrace();
69
+            throw new RuntimeException(e);
70
+        } catch (Exception e){
71
+            e.printStackTrace();
72
+            throw new RuntimeException(e);
73
+        }
74
+
75
+        // 使用解密后的数据,构造新的读取流
76
+        InputStream rawInputStream = new ByteArrayInputStream(body);
77
+        return new HttpInputMessage() {
78
+            @Override
79
+            public HttpHeaders getHeaders() {
80
+                return httpInputMessage.getHeaders();
81
+            }
82
+
83
+            @Override
84
+            public InputStream getBody() throws IOException {
85
+                return rawInputStream;
86
+            }
87
+        };
88
+    }
89
+
90
+    /**
91
+     * @title 读取参数后执行
92
+     * @author Xingbz
93
+     */
94
+    @Override
95
+    public Object afterBodyRead(Object o, HttpInputMessage httpInputMessage, MethodParameter methodParameter, Type type, Class<? extends HttpMessageConverter<?>> aClass) {
96
+//        log.info("afterBodyRead:----");
97
+        return o;
98
+    }
99
+
100
+    /**
101
+     * @title 无请求时的处理
102
+     */
103
+    @Override
104
+    public Object handleEmptyBody(Object o, HttpInputMessage httpInputMessage, MethodParameter methodParameter, Type type, Class<? extends HttpMessageConverter<?>> aClass) {
105
+//        log.info("handleEmptyBody:----");
106
+        return o;
107
+    }
108
+}

+ 35
- 0
sclass/src/main/java/com/xhkjedu/sclass/interceptors/HttpServletFilter.java View File

1
+package com.xhkjedu.sclass.interceptors;
2
+
3
+import org.springframework.stereotype.Component;
4
+
5
+import javax.servlet.Filter;
6
+import javax.servlet.FilterChain;
7
+import javax.servlet.ServletException;
8
+import javax.servlet.ServletRequest;
9
+import javax.servlet.ServletResponse;
10
+import javax.servlet.http.HttpServletRequest;
11
+import java.io.IOException;
12
+
13
+/**
14
+ * @author ywx
15
+ * @classname HttpServletFilter
16
+ * @description 过滤器 以便http post请求body输入流可多次读取
17
+ * @date 2020/11/9 11:25
18
+ **/
19
+@Component
20
+public class HttpServletFilter implements Filter {
21
+
22
+    @Override
23
+    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
24
+        ServletRequest requestWrapper = null;
25
+        if (request instanceof HttpServletRequest) {
26
+            requestWrapper = new RequestWrapper((HttpServletRequest) request);
27
+        }
28
+        if (requestWrapper == null) {
29
+            chain.doFilter(request, response);
30
+        } else {
31
+            chain.doFilter(requestWrapper, response);
32
+        }
33
+    }
34
+
35
+}

+ 143
- 0
sclass/src/main/java/com/xhkjedu/sclass/interceptors/RequestInterceptor.java View File

1
+package com.xhkjedu.sclass.interceptors;
2
+
3
+import com.alibaba.fastjson.JSON;
4
+import com.xhkjedu.config.MissingParametersException;
5
+import com.xhkjedu.sclass.utils.ClassUtil;
6
+import com.xhkjedu.sclass.utils.JedisUtil;
7
+import com.xhkjedu.utils.N_Utils;
8
+import com.xhkjedu.vo.ResultVo;
9
+import lombok.extern.slf4j.Slf4j;
10
+import org.springframework.context.annotation.Configuration;
11
+import org.springframework.web.servlet.HandlerInterceptor;
12
+import org.springframework.web.servlet.ModelAndView;
13
+
14
+import javax.servlet.http.HttpServletRequest;
15
+import javax.servlet.http.HttpServletResponse;
16
+import java.util.Map;
17
+
18
+@Configuration
19
+@Slf4j
20
+public class RequestInterceptor extends JedisUtil implements HandlerInterceptor {
21
+    @Override
22
+    public void afterCompletion(HttpServletRequest arg0, HttpServletResponse arg1, Object arg2, Exception arg3)
23
+            throws Exception {
24
+        // 请求结束时间
25
+        Long endTime = System.currentTimeMillis();
26
+        // 从HttpServletRequest获取开始时间
27
+        Long startTime = (Long) arg0.getAttribute("_startTime");
28
+        double time = ((endTime - startTime) * 1.000) / 1000;
29
+        // 打印接口信息及耗时
30
+        if (time > 1) {
31
+            log.error(" {};耗时:{}s", arg0.getRequestURI(), time);
32
+        }
33
+    }
34
+
35
+    @Override
36
+    public void postHandle(HttpServletRequest arg0, HttpServletResponse arg1, Object arg2, ModelAndView arg3)
37
+            throws Exception {
38
+
39
+    }
40
+
41
+    /**
42
+     * 在调用controller具体方法前拦截
43
+     */
44
+    @Override
45
+    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
46
+//        log.info("请求的uri:" + request.getRequestURI());
47
+        response.setHeader("Access-Control-Allow-Origin", "*");
48
+        response.setContentType("application/json;charset=UTF-8");
49
+
50
+        // 记录请求开始时间
51
+        request.setAttribute("_startTime", System.currentTimeMillis());
52
+        String requestURI = request.getRequestURI();
53
+        String key = request.getHeader("Token-Key");
54
+        String token = request.getHeader("Token-Value");
55
+        if (!requestURI.contains("user/login") && !requestURI.endsWith("/get_new")
56
+                && N_Utils.isNotEmpty(key) && N_Utils.isNotEmpty(token)) {//非登录和获取最新版本相关接口验证token
57
+            String redis_token = get(key);//系统缓存中保存的token
58
+            if (!token.equals(redis_token)) {
59
+                ResultVo result = new ResultVo();
60
+                result.setCode(2);
61
+                result.setMsg("登录失效");
62
+
63
+                response.getWriter().print(JSON.toJSONString(result));
64
+                return false;
65
+            }
66
+        }
67
+
68
+        if (interceptorApi(requestURI)) {//需要拦截的请求
69
+            String encoding = request.getCharacterEncoding();
70
+            int contentLength = request.getContentLength();
71
+            byte buffer[] = new byte[request.getContentLength()];
72
+            request.getInputStream();
73
+            for (int i = 0;i < contentLength;) {
74
+
75
+                int readLen = request.getInputStream().read(buffer, i, contentLength - i);
76
+                if (readLen == -1) {
77
+                    break;
78
+                }
79
+                i += readLen;
80
+            }
81
+            if (encoding == null) {
82
+                encoding = "UTF-8";
83
+            }
84
+            String params = new String(buffer, encoding);
85
+            Map<String, String> uriMap = ClassUtil.uriMap;
86
+            String params2 = uriMap.get(requestURI);
87
+            if (N_Utils.isNotEmpty(params2) && params2.equals(params)) {
88
+                log.error("地址:{},参数:{}",requestURI,params);
89
+                throw new MissingParametersException("提交过快,请稍后重试");
90
+            } else {
91
+                uriMap.put(requestURI, params);
92
+            }
93
+        }
94
+        return true;
95
+    }
96
+
97
+    /**
98
+     * 需要拦截的请求
99
+     * @Param [uri]
100
+     * @Author ywx
101
+     * @Date 2020/5/20 14:14
102
+     * @return java.lang.Boolean
103
+     **/
104
+    private Boolean interceptorApi(String uri) {
105
+        boolean rtn = false;
106
+        String[] url = new String[]{
107
+                "/ps/start_paper",//题库作业--开始做作业
108
+                "/ps/sstart_paper",//图片作业--开始做作业
109
+                "/psw/sstart_paper",//图片作业--开始做作业
110
+                "/psw/start_paper",//题库作业--开始做作业
111
+                "/croom/saveclass",//课堂--保存数据
112
+                "/resource/add",//资源--添加
113
+                "/recite/save",//背诵--添加
114
+                "/read/savers",//阅读--保存阅读记录
115
+                "/ps/submit_question",//作业--提交单题
116
+                "/ps/submit_paper",//作业--提交
117
+                "/ps/ssubmit_question",//图片作业--提交单题
118
+                "/ps/ssubmit_paper",//图片作业--提交
119
+                "/ps/scorrect",//答题卡--批改
120
+                "/ps/correc",//试题库--批改
121
+                "/paper/saves",//答题卡--保存
122
+                "/paper/saveq",//试题库--保存
123
+                "/pg/save",//作业--发布
124
+                "/question/add",//试题--添加
125
+                "/basket/add",//试题篮--添加
126
+                "/recites/up",//背诵--学生保存
127
+                "/question_class/end_correct",//试题--批阅完成
128
+                "/research/save",//教研管理--添加
129
+                "/researchu/up",//教研教师--保存评价
130
+                "/notice/add",//通知--添加
131
+        };
132
+
133
+        for (int i = 0; i < url.length; i++) {
134
+            if (uri.equals(url[i])) {
135
+                rtn = true;
136
+                break;
137
+            }
138
+        }
139
+
140
+        return rtn;
141
+    }
142
+
143
+}

+ 82
- 0
sclass/src/main/java/com/xhkjedu/sclass/interceptors/RequestWrapper.java View File

1
+package com.xhkjedu.sclass.interceptors;
2
+
3
+import lombok.extern.slf4j.Slf4j;
4
+
5
+import javax.servlet.ReadListener;
6
+import javax.servlet.ServletInputStream;
7
+import javax.servlet.http.HttpServletRequest;
8
+import javax.servlet.http.HttpServletRequestWrapper;
9
+import java.io.BufferedReader;
10
+import java.io.ByteArrayInputStream;
11
+import java.io.IOException;
12
+import java.io.InputStream;
13
+import java.io.InputStreamReader;
14
+
15
+/**
16
+ * @author ywx
17
+ * @classname RequestWrapper
18
+ * @description 解决POST请求中的BODY参数不能重复读取多次的问题
19
+ * @date 2020/11/9 11:24
20
+ **/
21
+@Slf4j
22
+public class RequestWrapper extends HttpServletRequestWrapper {
23
+    private static final int BUFFER_LEN = 128;
24
+
25
+    private final String body;
26
+
27
+    public RequestWrapper(HttpServletRequest request) throws IOException {
28
+        super(request);
29
+        StringBuilder stringBuilder = new StringBuilder();
30
+        BufferedReader bufferedReader = null;
31
+        try {
32
+            InputStream inputStream = request.getInputStream();
33
+            if (inputStream != null) {
34
+                bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
35
+                char[] charBuffer = new char[BUFFER_LEN];
36
+                int bytesRead;
37
+                while ((bytesRead = bufferedReader.read(charBuffer)) > 0) {
38
+                    stringBuilder.append(charBuffer, 0, bytesRead);
39
+                }
40
+            }
41
+        } catch (IOException ex) {
42
+            throw ex;
43
+        } finally {
44
+            if (bufferedReader != null) {
45
+                try {
46
+                    bufferedReader.close();
47
+                } catch (IOException ex) {
48
+                    throw ex;
49
+                }
50
+            }
51
+        }
52
+        body = stringBuilder.toString();
53
+    }
54
+
55
+    @Override
56
+    public ServletInputStream getInputStream() throws IOException {
57
+        final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(body.getBytes());
58
+        ServletInputStream servletInputStream = new ServletInputStream() {
59
+            public boolean isFinished() {
60
+                return false;
61
+            }
62
+            public boolean isReady() {
63
+                return false;
64
+            }
65
+            public void setReadListener(ReadListener readListener) {}
66
+            public int read() throws IOException {
67
+                return byteArrayInputStream.read();
68
+            }
69
+        };
70
+        return servletInputStream;
71
+
72
+    }
73
+    @Override
74
+    public BufferedReader getReader() throws IOException {
75
+        return new BufferedReader(new InputStreamReader(this.getInputStream()));
76
+    }
77
+
78
+    public String getBody() {
79
+        return this.body;
80
+    }
81
+
82
+}

+ 62
- 0
sclass/src/main/java/com/xhkjedu/sclass/interceptors/WebMvcConfg.java View File

1
+package com.xhkjedu.sclass.interceptors;
2
+
3
+import org.springframework.beans.factory.annotation.Autowired;
4
+import org.springframework.boot.web.servlet.FilterRegistrationBean;
5
+import org.springframework.context.annotation.Bean;
6
+import org.springframework.context.annotation.Configuration;
7
+import org.springframework.web.servlet.config.annotation.CorsRegistry;
8
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
9
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
10
+
11
+import javax.annotation.Resource;
12
+
13
+/**
14
+ * @author WN
15
+ * @description
16
+ * @date 2019/4/3 15:50
17
+ **/
18
+@Configuration
19
+public class WebMvcConfg implements WebMvcConfigurer {
20
+
21
+    @Autowired
22
+    private RequestInterceptor requestInterceptor;
23
+    @Resource
24
+    private HttpServletFilter httpServletFilter;
25
+
26
+    /**
27
+     * 拦截器addPathPatterns用于添加拦截规则 excludePathPatterns 用于排除拦截
28
+     * @Param: registry
29
+     * @return void
30
+     * @author wn
31
+     * @date 2019/4/8
32
+     */
33
+    @Override
34
+    public void addInterceptors(InterceptorRegistry registry) {
35
+        registry.addInterceptor(requestInterceptor).addPathPatterns("/**");
36
+    }
37
+
38
+    /**
39
+     * 允许跨域
40
+     * @Param: registry
41
+     * @return void
42
+     * @author wn
43
+     * @date 2019/4/8
44
+     */
45
+    @Override
46
+    public void addCorsMappings(CorsRegistry registry){
47
+        registry.addMapping("/**")
48
+                .allowedOrigins("*")
49
+                .allowCredentials(true)
50
+                .allowedMethods("GET","POST")
51
+                .maxAge(3600);
52
+    }
53
+
54
+    @Bean
55
+    public FilterRegistrationBean registerFilter() {
56
+        FilterRegistrationBean registration = new FilterRegistrationBean();
57
+        registration.setFilter(httpServletFilter);
58
+        registration.addUrlPatterns("/*");
59
+        registration.setOrder(1);
60
+        return registration;
61
+    }
62
+}

+ 34
- 0
sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomActivestudentMapper.java View File

1
+package com.xhkjedu.sclass.mapper.classroom;
2
+
3
+import com.xhkjedu.sclass.base.TkMapper;
4
+import com.xhkjedu.sclass.model.classroom.TClassroomActivestudent;
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+public interface ClassroomActivestudentMapper extends TkMapper<TClassroomActivestudent> {
8
+    /**
9
+     * 更新活跃值排名
10
+     * @Param [roomid]
11
+     * @Author ywx
12
+     * @Date 2020/6/15 9:02
13
+     * @return java.lang.Integer
14
+     **/
15
+    Integer updateActiveRank(@Param("roomid") Long roomid);
16
+
17
+    /**
18
+     * 更新学生活跃值
19
+     * @Param [roomid, studentid]
20
+     * @Author ywx
21
+     * @Date 2020/6/15 9:05
22
+     * @return java.lang.Integer
23
+     **/
24
+    Integer updateActiveNum(@Param("roomid") Long roomid, @Param("studentid") Integer studentid);
25
+
26
+    /**
27
+     * 添加学生课堂活跃度表信息
28
+     * @Param [roomid, classid, schoolid]
29
+     * @Author ywx
30
+     * @Date 2020/6/15 9:49
31
+     * @return java.lang.Integer
32
+     **/
33
+    Integer saveStuActive(@Param("roomid") Long roomid, @Param("classid") Integer classid,@Param("schoolid") Integer schoolid);
34
+}

+ 7
- 0
sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomFileMapper.java View File

1
+package com.xhkjedu.sclass.mapper.classroom;
2
+
3
+import com.xhkjedu.sclass.base.TkMapper;
4
+import com.xhkjedu.sclass.model.classroom.TClassroomFile;
5
+
6
+public interface ClassroomFileMapper extends TkMapper<TClassroomFile> {
7
+}

+ 128
- 0
sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomMapper.java View File

1
+package com.xhkjedu.sclass.mapper.classroom;
2
+
3
+import com.xhkjedu.sclass.base.TkMapper;
4
+import com.xhkjedu.sclass.model.classroom.TClassroom;
5
+import com.xhkjedu.sclass.model.classroom.TClassroomFile;
6
+import com.xhkjedu.sclass.vo.classroom.ReportEQuestionVo;
7
+import com.xhkjedu.sclass.vo.classroom.ReportExamVo;
8
+import com.xhkjedu.sclass.vo.classroom.ReportRoomVo;
9
+import com.xhkjedu.sclass.vo.classroom.RoomVo;
10
+import org.apache.ibatis.annotations.Param;
11
+
12
+import java.util.List;
13
+import java.util.Map;
14
+
15
+public interface ClassroomMapper extends TkMapper<TClassroom> {
16
+
17
+    /**
18
+     * 结束课堂
19
+     * @Param [room]
20
+     * @Author ywx
21
+     * @Date 2020/6/15 9:07
22
+     * @return java.lang.Integer
23
+     **/
24
+    Integer endClass(@Param("room") TClassroom room);
25
+
26
+    /**
27
+     * 获取教师指定章节下上过的课堂历史
28
+     * @Param [room]
29
+     * @Author ywx
30
+     * @Date 2020/6/15 9:18
31
+     * @return java.util.List<com.xhkjedu.vo.classroom.RoomVo>
32
+     **/
33
+    List<RoomVo> listClassByDirectorId(@Param("room") TClassroom room);
34
+
35
+    /**
36
+     *功能描述  批量更新班级实际签到学生数量
37
+     * @author WN
38
+     * @date 2020/8/14
39
+     * @param  * @param roomidlist
40
+     * @return void
41
+     */
42
+    void updateBatchRoomRealStunum(List<Long> roomidlist);
43
+
44
+
45
+    /**
46
+     * 根据班级id获取学生数量
47
+     * @Param [classid]
48
+     * @Author ywx
49
+     * @Date 2020/6/15 9:08
50
+     * @return java.lang.Integer
51
+     **/
52
+    Integer getStudentNumById(@Param("classid") Integer classid);
53
+
54
+    /**
55
+     * 课堂回顾详情
56
+     * @Param [roomid]
57
+     * @Author ywx
58
+     * @Date 2020/6/26 9:36
59
+     * @return com.xhkjedu.vo.classroom.ReportRoomVo
60
+     **/
61
+    ReportRoomVo getReport(Long roomid);
62
+
63
+    /**
64
+     * 课堂提问列表
65
+     * @Param [roomid]
66
+     * @Author ywx
67
+     * @Date 2020/6/26 9:53
68
+     * @return java.util.List<com.xhkjedu.vo.classroom.ReportQuestionVo>
69
+     **/
70
+    List<Map> listQuestionReport(Long roomid);
71
+
72
+    /**
73
+     * 课堂点名列表
74
+     * @Param [roomid]
75
+     * @Author ywx
76
+     * @Date 2020/6/26 10:06
77
+     * @return java.util.List<com.xhkjedu.vo.classroom.ReportStudentVo>
78
+     **/
79
+    List<Map> listCallReport(Long roomid);
80
+
81
+    /**
82
+     * 课堂抢答列表
83
+     * @Param [roomid]
84
+     * @Author ywx
85
+     * @Date 2020/6/26 10:16
86
+     * @return java.util.List<com.xhkjedu.vo.classroom.ReportStudentVo>
87
+     **/
88
+    List<Map> listAskReport(Long roomid);
89
+
90
+    /**
91
+     * 课堂截图列表
92
+     * @Param [roomid]
93
+     * @Author ywx
94
+     * @Date 2020/6/26 10:24
95
+     * @return java.util.List<com.xhkjedu.model.classroom.TClassroomFile>
96
+     **/
97
+    List<TClassroomFile> listFileReport(Long roomid);
98
+
99
+    /**
100
+     * 课堂考试列表
101
+     * @Param [paperid,classid]
102
+     * @Author ywx
103
+     * @Date 2020/6/26 10:34
104
+     * @return java.util.List<com.xhkjedu.vo.classroom.ReportEQuestionVo>
105
+     **/
106
+    List<ReportEQuestionVo> listExamReport(Long paperid, Integer classid);
107
+
108
+    /**
109
+     *功能描述  批量结束之前班级的课堂状态
110
+     * @author WN
111
+     * @date 2020/8/14
112
+     * @param  * @param classidlist
113
+     * @return void
114
+     */
115
+    void updateBatchRoomState(List<Integer> classidlist);
116
+
117
+    /**
118
+     * 获取课堂考试列表
119
+     * @Param [roomid]
120
+     * @Author ywx
121
+     * @Date 2020/9/10 9:35
122
+     * @return java.util.List<com.xhkjedu.vo.classroom.ReportExamVo>
123
+     **/
124
+    List<ReportExamVo> listPaper(Long roomid);
125
+
126
+    //班级学生列表
127
+    List<Map> listStudent(Integer classid, String lsbid);
128
+}

+ 20
- 0
sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomSignMapper.java View File

1
+package com.xhkjedu.sclass.mapper.classroom;
2
+
3
+import com.xhkjedu.sclass.base.TkMapper;
4
+import com.xhkjedu.sclass.model.classroom.TClassroomSign;
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+import java.util.List;
8
+import java.util.Map;
9
+
10
+public interface ClassroomSignMapper extends TkMapper<TClassroomSign> {
11
+
12
+    /**
13
+     * 获取课堂学生列表
14
+     * @Param [roomid]
15
+     * @Author ywx
16
+     * @Date 2020/9/8 10:19
17
+     * @return java.util.List<com.xhkjedu.vo.classroom.StudentSignVo>
18
+     **/
19
+    List<Map> listStudent(@Param("roomid") Long roomid);
20
+}

+ 25
- 0
sclass/src/main/java/com/xhkjedu/sclass/mapper/room/RoomAskstudentMapper.java View File

1
+package com.xhkjedu.sclass.mapper.room;
2
+
3
+import com.xhkjedu.sclass.base.TkMapper;
4
+import com.xhkjedu.sclass.model.classroom.TClassroomAskstudent;
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+public interface RoomAskstudentMapper extends TkMapper<TClassroomAskstudent> {
8
+    /**
9
+     * 保存学生作答情况
10
+     * @Param [student]
11
+     * @Author ywx
12
+     * @Date 2020/7/14 14:04
13
+     * @return java.lang.Integer
14
+     **/
15
+    Integer save(@Param("r") TClassroomAskstudent student);
16
+
17
+    /**
18
+     * 修改学生作答记录(教师添加批注)
19
+     * @Param [asksid, studentpic]
20
+     * @Author ywx
21
+     * @Date 2020/9/11 15:08
22
+     * @return void
23
+     **/
24
+    void updateStudentpic(Integer asksid, String studentpic);
25
+}

+ 16
- 0
sclass/src/main/java/com/xhkjedu/sclass/mapper/room/RoomAskteacherMapper.java View File

1
+package com.xhkjedu.sclass.mapper.room;
2
+
3
+import com.xhkjedu.sclass.base.TkMapper;
4
+import com.xhkjedu.sclass.model.classroom.TClassroomAskteacher;
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+public interface RoomAskteacherMapper extends TkMapper<TClassroomAskteacher> {
8
+    /**
9
+     * 保存教师互动信息
10
+     * @Param [teacher]
11
+     * @Author ywx
12
+     * @Date 2020/7/14 14:10
13
+     * @return java.lang.Integer
14
+     **/
15
+    Integer save(@Param("r") TClassroomAskteacher teacher);
16
+}

+ 16
- 0
sclass/src/main/java/com/xhkjedu/sclass/mapper/room/RoomFileMapper.java View File

1
+package com.xhkjedu.sclass.mapper.room;
2
+
3
+import com.xhkjedu.sclass.base.TkMapper;
4
+import com.xhkjedu.sclass.model.classroom.TClassroomFile;
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+public interface RoomFileMapper extends TkMapper<TClassroomFile> {
8
+    /**
9
+     * 保存课堂图片信息
10
+     * @Param [file]
11
+     * @Author ywx
12
+     * @Date 2020/7/14 13:57
13
+     * @return java.lang.Integer
14
+     **/
15
+    Integer save(@Param("r") TClassroomFile file);
16
+}

+ 123
- 0
sclass/src/main/java/com/xhkjedu/sclass/mapper/room/RoomMapper.java View File

1
+package com.xhkjedu.sclass.mapper.room;
2
+
3
+import com.xhkjedu.sclass.base.TkMapper;
4
+import com.xhkjedu.sclass.model.classroom.TClassroom;
5
+import com.xhkjedu.sclass.vo.classroom.ObjectiveVo;
6
+import com.xhkjedu.sclass.vo.classroom.RoomCorrectVo;
7
+import com.xhkjedu.sclass.vo.classroom.RoomVo;
8
+import com.xhkjedu.sclass.vo.classroom.SubjectiveVo;
9
+import com.xhkjedu.sclass.vo.paper.CheckClassVo;
10
+import org.apache.ibatis.annotations.Param;
11
+
12
+import java.util.List;
13
+import java.util.Map;
14
+
15
+public interface RoomMapper extends TkMapper<TClassroom> {
16
+    /**
17
+     * 保存课堂
18
+     * @Param [r]
19
+     * @Author ywx
20
+     * @Date 2020/7/14 14:48
21
+     * @return java.lang.Integer
22
+     **/
23
+    Integer save(@Param("r") TClassroom room);
24
+
25
+    /**
26
+     * 获取班级学生id集合
27
+     * @Param [roomid]
28
+     * @Author ywx
29
+     * @Date 2020/7/14 17:01
30
+     * @return java.util.List<java.lang.Integer>
31
+     **/
32
+    List<Integer> listStudentId(@Param("roomid") Long roomid);
33
+
34
+    /**
35
+     * 获取批阅信息
36
+     * @Param [roomid]
37
+     * @Author ywx
38
+     * @Date 2020/9/9 15:38
39
+     * @return com.xhkjedu.sclass.vo.classroom.RoomCorrectVo
40
+     **/
41
+    RoomCorrectVo listCorrect(Long roomid);
42
+
43
+    /**
44
+     * 获取提问批改学生列表
45
+     * @Param [asktid]
46
+     * @Author ywx
47
+     * @Date 2020/9/9 16:39
48
+     * @return com.xhkjedu.sclass.vo.paper.CheckClassVo
49
+     **/
50
+    CheckClassVo listStudentsByAskTid(Long asktid);
51
+
52
+    /**
53
+     * 获取考试批改学生列表
54
+     * @Param [paperid]
55
+     * @Author ywx
56
+     * @Date 2020/9/9 17:12
57
+     * @return com.xhkjedu.sclass.vo.paper.CheckClassVo
58
+     **/
59
+    CheckClassVo listStudentsByPaperId(Long paperid);
60
+
61
+    /**
62
+     * 获取课堂提问客观题详情
63
+     * @Param [asktid]
64
+     * @Author ywx
65
+     * @Date 2020/9/10 11:12
66
+     * @return com.xhkjedu.sclass.vo.classroom.ObjectiveVo
67
+     **/
68
+    ObjectiveVo callObjective(Long asktid, Integer realstunum);
69
+
70
+    /**
71
+     * 获取课堂考试客观题详情
72
+     * @Param [pscaid]
73
+     * @Author ywx
74
+     * @Date 2020/9/10 11:21
75
+     * @return com.xhkjedu.sclass.vo.classroom.ObjectiveVo
76
+     **/
77
+    ObjectiveVo examObjective(Long pscaid, Integer realstunum);
78
+
79
+    /**
80
+     * 获取课堂提问主客观题详情
81
+     * @Param [asktid]
82
+     * @Author ywx
83
+     * @Date 2020/9/10 14:01
84
+     * @return com.xhkjedu.sclass.vo.classroom.SubjectiveVo
85
+     **/
86
+    SubjectiveVo callSubjective(Long asktid, Integer realstunum);
87
+
88
+    /**
89
+     * 获取课堂考试主客观题详情
90
+     * @Param [pscaid]
91
+     * @Author ywx
92
+     * @Date 2020/9/10 14:24
93
+     * @return com.xhkjedu.sclass.vo.classroom.SubjectiveVo
94
+     **/
95
+    SubjectiveVo examSubjective(Long pscaid, Integer realstunum);
96
+
97
+    /**
98
+     * 课堂提问批阅
99
+     * @Param [asksid, radiocorrect]
100
+     * @Author ywx
101
+     * @Date 2020/9/10 15:08
102
+     * @return void
103
+     **/
104
+    void correctCall(Integer asksid, Integer radiocorrect);
105
+
106
+    /**
107
+     * 学生课堂回顾列表
108
+     * @Param [room]
109
+     * @Author ywx
110
+     * @Date 2020/9/14 16:32
111
+     * @return java.util.List<com.xhkjedu.sclass.vo.classroom.RoomVo>
112
+     **/
113
+    List<RoomVo> listStuClass(@Param("room") TClassroom room);
114
+
115
+    /**
116
+     * 学生课堂回顾详情
117
+     * @Param [roomid, studentid]
118
+     * @Author ywx
119
+     * @Date 2020/9/14 16:57
120
+     * @return com.xhkjedu.sclass.vo.classroom.ReportRoomStuVo
121
+     **/
122
+    Map getReportStu(Long roomid, Integer studentid);
123
+}

+ 17
- 0
sclass/src/main/java/com/xhkjedu/sclass/mapper/room/RoomPaperFileMapper.java View File

1
+package com.xhkjedu.sclass.mapper.room;
2
+
3
+import com.xhkjedu.sclass.base.TkMapper;
4
+import com.xhkjedu.sclass.model.classroom.TClassroomPaperFile;
5
+
6
+import java.util.List;
7
+
8
+/**
9
+ * @author ywx
10
+ * @classname RoomPaperFileMapper
11
+ * @description
12
+ * @date 2020/7/15 8:36
13
+ **/
14
+public interface RoomPaperFileMapper extends TkMapper<TClassroomPaperFile> {
15
+    List<TClassroomPaperFile> listObjsByPaperid(Long paperid,Integer qctype);
16
+    List<String> listFilepath(Long paperid);
17
+}

+ 13
- 0
sclass/src/main/java/com/xhkjedu/sclass/mapper/room/RoomPaperMapper.java View File

1
+package com.xhkjedu.sclass.mapper.room;
2
+
3
+import com.xhkjedu.sclass.base.TkMapper;
4
+import com.xhkjedu.sclass.model.classroom.TClassroomPaper;
5
+
6
+/**
7
+ * @author ywx
8
+ * @classname RoomPaperMapper
9
+ * @description 
10
+ * @date 2020/7/15 8:18
11
+ **/
12
+public interface RoomPaperMapper extends TkMapper<TClassroomPaper> {
13
+}

+ 24
- 0
sclass/src/main/java/com/xhkjedu/sclass/mapper/room/RoomPaperQtypeMapper.java View File

1
+package com.xhkjedu.sclass.mapper.room;
2
+
3
+import com.xhkjedu.sclass.base.TkMapper;
4
+import com.xhkjedu.sclass.model.classroom.TClassroomPaperQtype;
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+import java.util.List;
8
+
9
+/**
10
+ * @author ywx
11
+ * @classname RoomPaperQtypeMapper
12
+ * @description 
13
+ * @date 2020/7/15 8:36
14
+ **/
15
+public interface RoomPaperQtypeMapper extends TkMapper<TClassroomPaperQtype> {
16
+    /**
17
+     * 保存答题卡题型
18
+     * @Param [qtypes]
19
+     * @Author ywx
20
+     * @Date 2020/7/15 16:42
21
+     * @return java.lang.Integer
22
+     **/
23
+    Integer batchSave(@Param("list") List<TClassroomPaperQtype> qtypes);
24
+}

+ 23
- 0
sclass/src/main/java/com/xhkjedu/sclass/mapper/room/RoomPaperScantronMapper.java View File

1
+package com.xhkjedu.sclass.mapper.room;
2
+
3
+import com.xhkjedu.sclass.base.TkMapper;
4
+import com.xhkjedu.sclass.model.classroom.TClassroomPaperScantron;
5
+
6
+import java.util.List;
7
+
8
+/**
9
+ * @author ywx
10
+ * @classname RoomPaperScantronMapper
11
+ * @description 
12
+ * @date 2020/7/15 8:36
13
+ **/
14
+public interface RoomPaperScantronMapper extends TkMapper<TClassroomPaperScantron> {
15
+    /**
16
+     * 保存答题卡题型下试题
17
+     * @Param [savescan]
18
+     * @Author ywx
19
+     * @Date 2020/7/15 16:46
20
+     * @return java.lang.Integer
21
+     **/
22
+    Integer batchSave(List<TClassroomPaperScantron> savescan);
23
+}

+ 27
- 0
sclass/src/main/java/com/xhkjedu/sclass/mapper/room/RoomPaperStudentMapper.java View File

1
+package com.xhkjedu.sclass.mapper.room;
2
+
3
+import com.xhkjedu.sclass.base.TkMapper;
4
+import com.xhkjedu.sclass.model.classroom.TClassroomPaperStudent;
5
+
6
+/**
7
+ * @author ywx
8
+ * @classname RoomPaperStudentMapper
9
+ * @description
10
+ * @date 2020/7/15 16:06
11
+ **/
12
+public interface RoomPaperStudentMapper extends TkMapper<TClassroomPaperStudent> {
13
+    //获取考试学生信息
14
+    TClassroomPaperStudent findById(Integer psid);
15
+
16
+    //更新用户考试批改状态
17
+    void updateState(int pschecked, Integer psid);
18
+
19
+    //更新用户得分
20
+    void updateScantronStuScore(Integer psid);
21
+
22
+    //判断该作业该班级是否存在未批改学生
23
+    Integer getNotCorrect(Long paperid, Integer classid);
24
+
25
+    //根据考试学生id获取考试是否完成批阅
26
+    Integer getCheckedByPsId(Integer psid);
27
+}

+ 26
- 0
sclass/src/main/java/com/xhkjedu/sclass/mapper/room/RoomPaperStudentScantronMapper.java View File

1
+package com.xhkjedu.sclass.mapper.room;
2
+
3
+import com.xhkjedu.sclass.base.TkMapper;
4
+import com.xhkjedu.sclass.model.classroom.TClassroomPaperStudentScantron;
5
+import com.xhkjedu.sclass.model.paperstudent.TPaperStudentScantron;
6
+import org.apache.ibatis.annotations.Param;
7
+
8
+import java.util.List;
9
+import java.util.Map;
10
+
11
+/**
12
+ * @author ywx
13
+ * @classname RoomPaperStudentScantronMapper
14
+ * @description
15
+ * @date 2020/7/15 8:37
16
+ **/
17
+public interface RoomPaperStudentScantronMapper extends TkMapper<TClassroomPaperStudentScantron> {
18
+    //批量更新试题批改信息
19
+    void updateScantronQuestionBatch(@Param("list") List<TPaperStudentScantron> psslist);
20
+
21
+    //获取考试学生待批改试题列表
22
+    List<Map> listCorrectQuestion(Integer psid);
23
+
24
+    //修改学生作答记录(教师添加批注)
25
+    void updateScantronUseranswer(Integer pssid, String useranswer);
26
+}

+ 16
- 0
sclass/src/main/java/com/xhkjedu/sclass/mapper/room/RoomSignMapper.java View File

1
+package com.xhkjedu.sclass.mapper.room;
2
+
3
+import com.xhkjedu.sclass.base.TkMapper;
4
+import com.xhkjedu.sclass.model.classroom.TClassroomSign;
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+public interface RoomSignMapper extends TkMapper<TClassroomSign> {
8
+    /**
9
+     * 保存学生签到信息
10
+     * @Param [sign]
11
+     * @Author ywx
12
+     * @Date 2020/7/14 14:13
13
+     * @return java.lang.Integer
14
+     **/
15
+    Integer save(@Param("r") TClassroomSign sign);
16
+}

+ 26
- 0
sclass/src/main/java/com/xhkjedu/sclass/model/BaseBean.java View File

1
+package com.xhkjedu.sclass.model;
2
+
3
+import lombok.Data;
4
+
5
+import javax.persistence.Transient;
6
+
7
+/**
8
+ * @author lgq
9
+ * @date 2019/11/8 9:29
10
+ * @description: 添加时返回主键绑定id
11
+ */
12
+@Data
13
+public class BaseBean {
14
+    //添加时返回主键
15
+    @Transient
16
+    private Integer id;
17
+    //创建人姓名
18
+    @Transient
19
+    private String createname;
20
+    //分页显示页码
21
+    @Transient
22
+    private Integer page;
23
+    //分页显示条数
24
+    @Transient
25
+    private Integer pageSize;
26
+}

+ 67
- 0
sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroom.java View File

1
+package com.xhkjedu.sclass.model.classroom;
2
+
3
+import com.xhkjedu.sclass.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+import javax.persistence.Transient;
9
+import java.util.List;
10
+
11
+@Table(name = "t_classroom")
12
+@Data
13
+public class TClassroom extends BaseBean {
14
+    //课堂主键id
15
+    @Id
16
+    private Long roomid;
17
+
18
+    //课堂名称
19
+    private String roomname;
20
+
21
+    //所属班级
22
+    private Integer classid;
23
+
24
+    //课堂状态0默认1进行中2已结束
25
+    private Integer roomstate;
26
+
27
+    //教材关联id
28
+    private String lsbid;
29
+
30
+    //教师id
31
+    private Integer teacherid;
32
+
33
+    //章节类型1系统2自定义
34
+    private Integer directortype;
35
+
36
+    //章节id
37
+    private String directorid;
38
+
39
+    //班级学生总人数
40
+    private Integer classnum;
41
+
42
+    //班级实际签到学生数量
43
+    private Integer realstunum;
44
+
45
+    //结束时间
46
+    private Integer endtime;
47
+
48
+    //创建人id
49
+    private Integer createid;
50
+
51
+    //创建时间
52
+    private Integer createtime;
53
+
54
+    //学校id
55
+    private Integer schoolid;
56
+
57
+    @Transient
58
+    //科目id
59
+    private String subjectid;
60
+
61
+    @Transient
62
+    //学生id
63
+    private Integer studentid;
64
+
65
+    @Transient
66
+    private List<TClassroomAskteacher> askteachers;
67
+}

+ 33
- 0
sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomActivestudent.java View File

1
+package com.xhkjedu.sclass.model.classroom;
2
+
3
+import com.xhkjedu.sclass.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "t_classroom_activestudent")
10
+@Data
11
+public class TClassroomActivestudent extends BaseBean {
12
+    //课堂活跃度主键id
13
+    @Id
14
+    private Integer rsid;
15
+
16
+    //课堂id(t_class)
17
+    private Long roomid;
18
+
19
+    //学生id
20
+    private Integer studentid;
21
+
22
+    //活跃值
23
+    private Integer activenum;
24
+
25
+    //活跃值排名
26
+    private Integer activerank;
27
+
28
+    //创建时间(时间戳)
29
+    private Integer createtime;
30
+
31
+    //学校id
32
+    private Integer schoolid;
33
+}

+ 47
- 0
sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomAskstudent.java View File

1
+package com.xhkjedu.sclass.model.classroom;
2
+
3
+import com.xhkjedu.sclass.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+import javax.persistence.Transient;
9
+
10
+@Table(name = "t_classroom_askstudent")
11
+@Data
12
+public class TClassroomAskstudent extends BaseBean {
13
+    //课堂互动学生表主键id
14
+    @Id
15
+    private Integer asksid;
16
+
17
+    //教师互动发起方主键id(cc_ask_teacher)
18
+    private Long asktid;
19
+
20
+    //班级id
21
+    private Integer classid;
22
+
23
+    //学生id
24
+    private Integer studentid;
25
+
26
+    //学生单选题答案
27
+    private String studentradio;
28
+
29
+    //学生单选是否正确0默认未批阅1正确2错误 
30
+    private Integer radiocorrect;
31
+
32
+    //学生简答题图片地址
33
+    private String studentpic;
34
+
35
+    //学生是否被选中0默认1选中
36
+    private Integer studentselected;
37
+
38
+    //创建时间(时间戳)
39
+    private Integer createtime;
40
+
41
+    //学校id
42
+    private Integer schoolid;
43
+
44
+    @Transient
45
+    //课堂id
46
+    private Long roomid;
47
+}

+ 48
- 0
sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomAskteacher.java View File

1
+package com.xhkjedu.sclass.model.classroom;
2
+
3
+import com.xhkjedu.sclass.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+import javax.persistence.Transient;
9
+import java.util.List;
10
+
11
+@Table(name = "t_classroom_askteacher")
12
+@Data
13
+public class TClassroomAskteacher extends BaseBean {
14
+    //互动发起方主键id
15
+    @Id
16
+    private Long asktid;
17
+
18
+    //课堂id(cc_class)
19
+    private Long roomid;
20
+
21
+    //互动类型20抢答21随机点名30判断题31选择题32简答题40课堂小测
22
+    private Integer asktype;
23
+
24
+    //课堂小测id(t_paper)
25
+    private Long paperid;
26
+
27
+    //互动类型下互动次数
28
+    private Integer asknum;
29
+
30
+    //图片地址(用户教师发送试题图片路径)
31
+    private String teacherpic;
32
+
33
+    //单选题选项数量
34
+    private Integer radionum;
35
+
36
+    //单选题正确答案(大写字母)
37
+    private String radioanswer;
38
+
39
+    //互动发起时间(时间戳)
40
+    private Integer createtime;
41
+
42
+    //学校id
43
+    private Integer schoolid;
44
+
45
+    @Transient
46
+    //学生作答详情
47
+    private List<TClassroomAskstudent> students;
48
+}

+ 33
- 0
sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomFile.java View File

1
+package com.xhkjedu.sclass.model.classroom;
2
+
3
+import com.xhkjedu.sclass.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "t_classroom_file")
10
+@Data
11
+public class TClassroomFile extends BaseBean {
12
+    //课堂图片表
13
+    @Id
14
+    private Integer rfid;
15
+
16
+    //课堂id
17
+    private Long roomid;
18
+
19
+    //图片保存路径
20
+    private String rfpath;
21
+
22
+    //图片类型1黑板2讲评
23
+    private Integer rftype;
24
+
25
+    //创建人id
26
+    private Integer createid;
27
+
28
+    //创建时间
29
+    private Integer createtime;
30
+
31
+    //学校id
32
+    private Integer schoolid;
33
+}

+ 56
- 0
sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomPaper.java View File

1
+package com.xhkjedu.sclass.model.classroom;
2
+
3
+import com.xhkjedu.sclass.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+import javax.persistence.Transient;
9
+import java.util.ArrayList;
10
+import java.util.List;
11
+
12
+@Table(name = "t_classroom_paper")
13
+@Data
14
+public class TClassroomPaper extends BaseBean {
15
+    @Id
16
+    //作业表
17
+    private Long paperid;
18
+
19
+    //作业名称
20
+    private String papername;
21
+
22
+    //试题数量
23
+    private Integer papernum;
24
+
25
+    //作业总分
26
+    private Double paperscore;
27
+
28
+    //科目id
29
+    private String subjectid;
30
+
31
+    //关联关系id
32
+    private String lsbid;
33
+
34
+    //章节id
35
+    private String directorid;
36
+
37
+    //作业说明
38
+    private String comm;
39
+
40
+    //创建人id
41
+    private Integer createid;
42
+
43
+    //创建时间
44
+    private Integer createtime;
45
+
46
+    //学校id
47
+    private Integer schoolid;
48
+
49
+    //作业附件
50
+    @Transient
51
+    private List<TClassroomPaperFile> pfiles = new ArrayList<>();
52
+
53
+    //答题卡种试题json对象集合
54
+    @Transient
55
+    private List<TClassroomPaperQtype> qtypes;
56
+}

+ 36
- 0
sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomPaperFile.java View File

1
+package com.xhkjedu.sclass.model.classroom;
2
+
3
+import com.xhkjedu.sclass.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "t_classroom_paper_file")
10
+@Data
11
+public class TClassroomPaperFile extends BaseBean {
12
+    @Id
13
+    //课堂检测附件表
14
+    private Integer pfid;
15
+
16
+    //作业id
17
+    private Long paperid;
18
+
19
+    //文件地址
20
+    private String filepath;
21
+
22
+    //文件属于1题干2答案
23
+    private Integer fileclass;
24
+
25
+    //文件顺序
26
+    private Integer fileorder;
27
+
28
+    //创建人id
29
+    private Integer createid;
30
+
31
+    //创建时间
32
+    private Integer createtime;
33
+
34
+    //学校id
35
+    private Integer schoolid;
36
+}

+ 49
- 0
sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomPaperQtype.java View File

1
+package com.xhkjedu.sclass.model.classroom;
2
+
3
+import com.xhkjedu.sclass.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+import javax.persistence.Transient;
9
+import java.util.ArrayList;
10
+import java.util.List;
11
+
12
+@Table(name = "t_classroom_paper_qtype")
13
+@Data
14
+public class TClassroomPaperQtype extends BaseBean {
15
+    @Id
16
+    //课堂检测题型表
17
+    private Long pqtypeid;
18
+
19
+    //作业id
20
+    private Long paperid;
21
+
22
+    //题型
23
+    private Integer ctype;
24
+
25
+    //题型名称
26
+    private String ctypename;
27
+
28
+    //题型序号
29
+    private Integer pqorder;
30
+
31
+    //题型总分
32
+    private Double pqscore;
33
+
34
+    //题型下试题数量
35
+    private Integer pqnum;
36
+
37
+    //创建人id
38
+    private Integer createid;
39
+
40
+    //创建时间
41
+    private Integer createtime;
42
+
43
+    //学校id
44
+    private Integer schoolid;
45
+
46
+    //题型下试题
47
+    @Transient
48
+    private List<TClassroomPaperScantron> scantrons = new ArrayList<>();
49
+}

+ 48
- 0
sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomPaperScantron.java View File

1
+package com.xhkjedu.sclass.model.classroom;
2
+
3
+import com.xhkjedu.sclass.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "t_classroom_paper_scantron")
10
+@Data
11
+public class TClassroomPaperScantron extends BaseBean {
12
+    @Id
13
+    //课堂检测答题卡表
14
+    private Long pscaid;
15
+
16
+    //作业id
17
+    private Long paperid;
18
+
19
+    //作业答题卡题型关联表id
20
+    private Long pqtypeid;
21
+
22
+    //题型
23
+    private Integer ctype;
24
+
25
+    //题型名称
26
+    private String ctypename;
27
+
28
+    //题号
29
+    private Integer psorder;
30
+
31
+    //分值
32
+    private Double psscore;
33
+
34
+    //创建人id
35
+    private Integer createid;
36
+
37
+    //创建时间
38
+    private Integer createtime;
39
+
40
+    //学校id
41
+    private Integer schoolid;
42
+
43
+    //正确答案
44
+    private String psanswer;
45
+
46
+    //选项数量
47
+    private Integer optionnum;
48
+}

+ 64
- 0
sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomPaperStudent.java View File

1
+package com.xhkjedu.sclass.model.classroom;
2
+
3
+import com.xhkjedu.sclass.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+import javax.persistence.Transient;
9
+import java.util.List;
10
+
11
+@Table(name = "t_classroom_paper_student")
12
+@Data
13
+public class TClassroomPaperStudent extends BaseBean {
14
+    @Id
15
+    //课堂检测学生表
16
+    private Integer psid;
17
+
18
+    //试卷id
19
+    private Long paperid;
20
+
21
+    //班级id
22
+    private Integer classid;
23
+
24
+    //学生id
25
+    private Integer studentid;
26
+
27
+    //批改状态0未批改1已批改2批改中
28
+    private Integer pschecked;
29
+
30
+    //作业开始时间
31
+    private Integer starttime;
32
+
33
+    //作业结束时间
34
+    private Integer stoptime;
35
+
36
+    //花费时长(时间s)
37
+    private Integer costtime;
38
+
39
+    //试题数量
40
+    private Integer papernum;
41
+
42
+    //试卷总分
43
+    private Double paperscore;
44
+
45
+    //用户得分
46
+    private Double stuscore;
47
+
48
+    //创建人id
49
+    private Integer createid;
50
+
51
+    //创建时间
52
+    private Integer createtime;
53
+
54
+    //学校id
55
+    private Integer schoolid;
56
+
57
+    @Transient
58
+    //作答列表
59
+    private List<TClassroomPaperStudentScantron> scantrons;
60
+
61
+    @Transient
62
+    //科目id
63
+    private String subjectid;
64
+}

+ 63
- 0
sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomPaperStudentScantron.java View File

1
+package com.xhkjedu.sclass.model.classroom;
2
+
3
+import com.xhkjedu.sclass.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "t_classroom_paper_student_scantron")
10
+@Data
11
+public class TClassroomPaperStudentScantron extends BaseBean {
12
+    @Id
13
+    //课堂检测学生答题卡表
14
+    private Integer pssid;
15
+
16
+    //作业id
17
+    private Long paperid;
18
+
19
+    //班级id
20
+    private Integer classid;
21
+
22
+    //学生id
23
+    private Integer studentid;
24
+
25
+    //作业答题卡id
26
+    private Long pscaid;
27
+
28
+    //作业学生id
29
+    private Integer psid;
30
+
31
+    //排序
32
+    private Integer qorder;
33
+
34
+    //是否作答0未作答1已作答
35
+    private Integer answered;
36
+
37
+    //提交时间
38
+    private Integer answertime;
39
+
40
+    //花费时间(秒)
41
+    private Integer costtime;
42
+
43
+    //是否批改0默认未批改1已批改2批改中
44
+    private Integer checked;
45
+
46
+    //学生得分
47
+    private Double stuscore;
48
+
49
+    //试题分值
50
+    private Double qscore;
51
+
52
+    //批改人id
53
+    private Integer checkid;
54
+
55
+    //批改时间
56
+    private Integer checktime;
57
+
58
+    //学校id
59
+    private Integer schoolid;
60
+
61
+    //学生答案
62
+    private String useranswer;
63
+}

+ 27
- 0
sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomSign.java View File

1
+package com.xhkjedu.sclass.model.classroom;
2
+
3
+import com.xhkjedu.sclass.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "t_classroom_sign")
10
+@Data
11
+public class TClassroomSign extends BaseBean {
12
+    //学生签到表主键id
13
+    @Id
14
+    private Integer csid;
15
+
16
+    //课堂id(t_classroom)
17
+    private Long roomid;
18
+
19
+    //用户id
20
+    private Integer userid;
21
+
22
+    //签到时间
23
+    private Integer createtime;
24
+
25
+    //学校id
26
+    private Integer schoolid;
27
+}

+ 83
- 0
sclass/src/main/java/com/xhkjedu/sclass/model/paperstudent/TPaperStudent.java View File

1
+package com.xhkjedu.sclass.model.paperstudent;
2
+
3
+import com.xhkjedu.sclass.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+import javax.persistence.Transient;
9
+
10
+@Table(name = "t_paper_student")
11
+@Data
12
+public class TPaperStudent extends BaseBean {
13
+    //试卷学生表id
14
+    @Id
15
+    private Integer psid;
16
+
17
+    //试卷id
18
+    private Integer paperid;
19
+
20
+    //班级id
21
+    private Integer classid;
22
+
23
+    //班级分组id
24
+    //private Integer groupid;
25
+
26
+    //学生id
27
+    private Integer studentid;
28
+
29
+    //状态0未提交1已提交2超时提交
30
+    private Integer psstate;
31
+
32
+    //需要哪个用户批改
33
+    private Integer checkid;
34
+
35
+    //批改状态0未批改1已批改2批改中
36
+    private Integer pschecked;
37
+
38
+    //作业开始时间
39
+    private Integer starttime;
40
+
41
+    //作业结束时间
42
+    private Integer stoptime;
43
+
44
+    //花费时长(时间s)
45
+    private Integer costtime;
46
+
47
+    //试题数量
48
+    private Integer papernum;
49
+
50
+    //试卷总分
51
+    private Double paperscore;
52
+
53
+    //用户得分
54
+    private Double userscore;
55
+
56
+    //是否显示答案0不显示1显示
57
+    private Integer showanswer;
58
+
59
+    //创建人id
60
+    private Integer createid;
61
+
62
+    //创建时间
63
+    private Integer createtime;
64
+
65
+    //学校id
66
+    private Integer schoolid;
67
+
68
+    @Transient
69
+    //科目id
70
+    private String subjectid;
71
+
72
+    @Transient
73
+    //作业名称
74
+    private String papername;
75
+
76
+    @Transient
77
+    //试题批改结果json字符串
78
+    private String questionResult;
79
+
80
+    @Transient
81
+    //作业是否完成批阅0未完成1已完成
82
+    private Integer checked;
83
+}

+ 83
- 0
sclass/src/main/java/com/xhkjedu/sclass/model/paperstudent/TPaperStudentScantron.java View File

1
+package com.xhkjedu.sclass.model.paperstudent;
2
+
3
+import com.xhkjedu.sclass.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+import javax.persistence.Transient;
9
+
10
+@Table(name = "t_paper_student_scantron")
11
+@Data
12
+public class TPaperStudentScantron extends BaseBean {
13
+    //作业学生答题卡表
14
+    @Id
15
+    private Integer pssid;
16
+
17
+    //作业id
18
+    private Integer paperid;
19
+
20
+    //班级id
21
+    private Integer classid;
22
+
23
+    //班级分组id
24
+    //private Integer groupid;
25
+
26
+    //学生id
27
+    private Integer studentid;
28
+
29
+    //作业答题卡id
30
+    private Integer pscaid;
31
+
32
+    //作业学生id
33
+    private Integer psid;
34
+
35
+    //排序
36
+    private Integer qorder;
37
+
38
+    //是否作答0未作答1已作答
39
+    private Integer answered;
40
+
41
+    //提交时间
42
+    private Integer answertime;
43
+
44
+    //花费时间(秒)
45
+    private Integer costtime;
46
+
47
+    //是否批改0默认未批改1已批改2批改中
48
+    private Integer checked;
49
+
50
+    //学生得分
51
+    private Double stuscore;
52
+
53
+    //试题分值
54
+    private Double qscore;
55
+
56
+    //批改人id
57
+    private Integer checkid;
58
+
59
+    //批改时间
60
+    private Integer checktime;
61
+
62
+    //批语
63
+    private String checkcomm;
64
+
65
+    //学校id
66
+    private Integer schoolid;
67
+
68
+    //学生答案
69
+    private String useranswer;
70
+
71
+    //学生答案富文本
72
+    private String useranswertext;
73
+
74
+    //答案纯文本
75
+    private String useranswertxt;
76
+
77
+    //设备1选择、图片(useranswer) 2富文本(useranswertext)3纯文本(useranswertxt)
78
+    private Integer device;
79
+
80
+    @Transient
81
+    //试题题型id
82
+    private String qtypeid;
83
+}

+ 103
- 0
sclass/src/main/java/com/xhkjedu/sclass/service/classroom/ClassroomService.java View File

1
+package com.xhkjedu.sclass.service.classroom;
2
+
3
+import com.xhkjedu.sclass.mapper.classroom.ClassroomFileMapper;
4
+import com.xhkjedu.sclass.mapper.classroom.ClassroomMapper;
5
+import com.xhkjedu.sclass.mapper.classroom.ClassroomSignMapper;
6
+import com.xhkjedu.sclass.mapper.room.RoomPaperFileMapper;
7
+import com.xhkjedu.sclass.model.classroom.TClassroom;
8
+import com.xhkjedu.sclass.model.classroom.TClassroomFile;
9
+import com.xhkjedu.sclass.vo.classroom.ReportEQuestionVo;
10
+import com.xhkjedu.sclass.vo.classroom.ReportExamVo;
11
+import com.xhkjedu.sclass.vo.classroom.ReportRoomVo;
12
+import com.xhkjedu.sclass.vo.classroom.RoomVo;
13
+import com.xhkjedu.utils.N_Utils;
14
+import com.xhkjedu.vo.ResultVo;
15
+import lombok.extern.slf4j.Slf4j;
16
+import org.springframework.stereotype.Service;
17
+
18
+import javax.annotation.Resource;
19
+import java.util.List;
20
+import java.util.Map;
21
+
22
+@Slf4j
23
+@Service
24
+public class ClassroomService {
25
+    @Resource
26
+    private ClassroomMapper classroomMapper;
27
+    @Resource
28
+    private ClassroomSignMapper classroomSignMapper;
29
+    @Resource
30
+    private RoomPaperFileMapper roomPaperFileMapper;
31
+    @Resource
32
+    private ClassroomFileMapper classroomFileMapper;
33
+
34
+    /**
35
+     * 获取教师指定章节下上过的课堂历史
36
+     * @Param [room]
37
+     * @Author ywx
38
+     * @Date 2020/6/15 9:19
39
+     * @return java.util.List<com.xhkjedu.sclass.vo.classroom.RoomVo>
40
+     **/
41
+    public List<RoomVo> listClassByDirectorId(TClassroom room) {
42
+        return classroomMapper.listClassByDirectorId(room);
43
+    }
44
+
45
+    /**
46
+     * 课堂回顾详情
47
+     * @Param [roomid]
48
+     * @Author ywx
49
+     * @Date 2020/6/26 9:36
50
+     * @return com.xhkjedu.sclass.vo.ResultVo
51
+     **/
52
+    public ResultVo getReport(Long roomid) {
53
+        ReportRoomVo room = classroomMapper.getReport(roomid);
54
+        Integer realstunum = room.getRealstunum();
55
+        //课堂提问列表
56
+        List<Map> questions = classroomMapper.listQuestionReport(roomid);
57
+        room.setQuestions(questions);
58
+
59
+        //课堂考试列表
60
+        List<ReportExamVo> exams = classroomMapper.listPaper(roomid);
61
+        for (ReportExamVo exam : exams) {
62
+            realstunum = exam.getYtjnum();
63
+            List<String> paperfiles = roomPaperFileMapper.listFilepath(exam.getPaperid());
64
+            exam.setPaperfiles(paperfiles);
65
+
66
+            List<ReportEQuestionVo> equestions = classroomMapper.listExamReport(exam.getPaperid(),exam.getClassid());
67
+            for (ReportEQuestionVo equestion : equestions) {
68
+                Double correctrate = N_Utils.getDoubleDivideAndMulitiply(equestion.getCorrectrate(),realstunum);
69
+                equestion.setCorrectrate(correctrate);
70
+                equestion.setCommitrate(N_Utils.getDoubleDivideAndMulitiply(equestion.getCommitrate(),realstunum));
71
+            }
72
+            exam.setQuestions(equestions);
73
+        }
74
+        room.setExams(exams);
75
+
76
+        //课堂点名列表
77
+        List<Map> calls = classroomMapper.listCallReport(roomid);
78
+        room.setCalls(calls);
79
+
80
+        //课堂抢答列表
81
+        List<Map> asks = classroomMapper.listAskReport(roomid);
82
+        room.setAsks(asks);
83
+
84
+        //课堂截图列表
85
+        List<TClassroomFile> files = classroomMapper.listFileReport(roomid);
86
+        room.setFiles(files);
87
+
88
+        //课堂学生列表
89
+        List<Map> students = classroomSignMapper.listStudent(roomid);
90
+        room.setStudents(students);
91
+        return new ResultVo(0, "获取课堂回顾详情成功",room);
92
+    }
93
+
94
+    //删除课堂图片
95
+    public void delFile(Integer rfid) {
96
+        classroomFileMapper.deleteByPrimaryKey(rfid);
97
+    }
98
+
99
+    //班级学生列表
100
+    public List<Map> listStudent(Integer classid, String lsbid) {
101
+        return classroomMapper.listStudent(classid, lsbid);
102
+    }
103
+}

+ 228
- 0
sclass/src/main/java/com/xhkjedu/sclass/service/classroom/RoomPaperService.java View File

1
+package com.xhkjedu.sclass.service.classroom;
2
+
3
+import com.alibaba.fastjson.JSON;
4
+import com.xhkjedu.sclass.mapper.room.RoomPaperFileMapper;
5
+import com.xhkjedu.sclass.mapper.room.RoomPaperMapper;
6
+import com.xhkjedu.sclass.mapper.room.RoomPaperQtypeMapper;
7
+import com.xhkjedu.sclass.mapper.room.RoomPaperScantronMapper;
8
+import com.xhkjedu.sclass.mapper.room.RoomPaperStudentMapper;
9
+import com.xhkjedu.sclass.mapper.room.RoomPaperStudentScantronMapper;
10
+import com.xhkjedu.sclass.model.classroom.TClassroomPaper;
11
+import com.xhkjedu.sclass.model.classroom.TClassroomPaperFile;
12
+import com.xhkjedu.sclass.model.classroom.TClassroomPaperQtype;
13
+import com.xhkjedu.sclass.model.classroom.TClassroomPaperScantron;
14
+import com.xhkjedu.sclass.model.classroom.TClassroomPaperStudent;
15
+import com.xhkjedu.sclass.model.classroom.TClassroomPaperStudentScantron;
16
+import com.xhkjedu.sclass.model.paperstudent.TPaperStudentScantron;
17
+import com.xhkjedu.utils.N_Utils;
18
+import lombok.extern.slf4j.Slf4j;
19
+import org.springframework.stereotype.Service;
20
+import org.springframework.transaction.annotation.Transactional;
21
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
22
+
23
+import javax.annotation.Resource;
24
+import java.util.ArrayList;
25
+import java.util.List;
26
+import java.util.Map;
27
+import java.util.stream.Collectors;
28
+
29
+/**
30
+ * @author ywx
31
+ * @classname RoomPaperService
32
+ * @description 堂测
33
+ * @date 2020/7/15 8:20
34
+ **/
35
+@Slf4j
36
+@Service
37
+public class RoomPaperService {
38
+    @Resource
39
+    private RoomPaperMapper roomPaperMapper;
40
+    @Resource
41
+    private RoomPaperFileMapper roomPaperFileMapper;
42
+    @Resource
43
+    private RoomPaperQtypeMapper roomPaperQtypeMapper;
44
+    @Resource
45
+    private RoomPaperScantronMapper roomPaperScantronMapper;
46
+    @Resource
47
+    private RoomPaperStudentMapper roomPaperStudentMapper;
48
+    @Resource
49
+    private RoomPaperStudentScantronMapper roomPaperStudentScantronMapper;
50
+
51
+    /**
52
+     * 答题卡作业--保存
53
+     * @Param [paper]
54
+     * @Author ywx
55
+     * @Date 2020/7/15 8:22
56
+     * @return void
57
+     **/
58
+    @Transactional(rollbackFor = Exception.class)
59
+    public void saveScantronPaper(TClassroomPaper paper) {
60
+        try {
61
+            List<TClassroomPaperQtype> qtypes = paper.getQtypes();
62
+            //答题卡中试题
63
+            List<TClassroomPaperScantron> scanlist = new ArrayList<>();
64
+            qtypes.forEach(t->{
65
+                scanlist.addAll(t.getScantrons());
66
+            });
67
+            paper.setPapernum(scanlist.size());
68
+            Double paperscore = scanlist.stream().collect(Collectors.summingDouble(TClassroomPaperScantron::getPsscore));
69
+            paper.setPaperscore(paperscore);
70
+            String directorid = paper.getDirectorid();
71
+            if (directorid != null && (directorid.equals("0") || directorid.equals(""))) {
72
+                paper.setDirectorid(null);
73
+            }
74
+            roomPaperMapper.insertSelective(paper);//保存作业
75
+
76
+            //保存作业关联信息
77
+            List<TClassroomPaperFile> lst = paper.getPfiles();
78
+            if(lst==null || lst.size()==0 || scanlist ==null || scanlist.size()==0){
79
+            }else{
80
+                //保存作业附件
81
+                savePaperScantronFile(paper);
82
+                //保存答题卡信息
83
+                savePaperScantronQtype(paper,qtypes);
84
+            }
85
+
86
+        }catch (Exception e){
87
+            log.error("保存答题卡作业失败:" + e.getMessage());
88
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
89
+        }
90
+    }
91
+
92
+    //课堂考试--保存附件信息
93
+    private void savePaperScantronFile(TClassroomPaper paper){
94
+        List<TClassroomPaperFile> lst = paper.getPfiles();
95
+        for(TClassroomPaperFile pf : lst){
96
+            pf.setCreateid(paper.getCreateid());
97
+            pf.setCreatetime(N_Utils.getSecondTimestamp());
98
+            pf.setSchoolid(paper.getSchoolid());
99
+            pf.setPaperid(paper.getPaperid());
100
+        }
101
+        roomPaperFileMapper.insertList(lst);
102
+    }
103
+
104
+    //课堂考试--保存答题卡-题型-试题
105
+    private void savePaperScantronQtype(TClassroomPaper paper,List<TClassroomPaperQtype> qtypes){
106
+        int sorder = 1;//答题卡试题序号
107
+        int qtypeorder = 1;//答题卡题型序号
108
+        //处理答题卡--题型--试题
109
+        List<TClassroomPaperScantron> savescan = new ArrayList<>();
110
+        for(TClassroomPaperQtype qtype : qtypes){
111
+            List<TClassroomPaperScantron> scanlst = qtype.getScantrons();//题型下试题
112
+            qtype.setCreateid(paper.getCreateid());
113
+            qtype.setCreatetime(paper.getCreatetime());
114
+            qtype.setSchoolid(paper.getSchoolid());
115
+            qtype.setPqnum(scanlst.size());
116
+            Double qtypescore = scanlst.stream().collect(Collectors.summingDouble(TClassroomPaperScantron::getPsscore));
117
+            qtype.setPqscore(qtypescore);
118
+            qtype.setPaperid(paper.getPaperid());
119
+            qtype.setPqorder(qtypeorder);
120
+            qtypeorder++;
121
+
122
+            for(TClassroomPaperScantron sc : scanlst){
123
+                sc.setCreateid(paper.getCreateid());
124
+                sc.setCreatetime(N_Utils.getSecondTimestamp());
125
+                sc.setSchoolid(paper.getSchoolid());
126
+                sc.setPaperid(paper.getPaperid());
127
+                sc.setPsorder(sorder);
128
+                savescan.add(sc);
129
+                sorder++;
130
+            }
131
+        }
132
+
133
+        //保存答题卡题型
134
+        roomPaperQtypeMapper.batchSave(qtypes);
135
+        //保存答题卡题型下试题
136
+        roomPaperScantronMapper.batchSave(savescan);
137
+    }
138
+
139
+    /**
140
+     * 堂测--学生作答详情
141
+     * @Param [scantrons]
142
+     * @Author ywx
143
+     * @Date 2020/7/15 9:34
144
+     * @return void
145
+     **/
146
+    @Transactional(rollbackFor = Exception.class)
147
+    public void saveStudentScantron(TClassroomPaperStudent student) {
148
+        try {
149
+            roomPaperStudentMapper.insertUseGeneratedKeys(student);
150
+            Integer psid = student.getId();
151
+            List<TClassroomPaperStudentScantron> scantrons = student.getScantrons();
152
+            int qorder = 1;//试题序号
153
+            for (TClassroomPaperStudentScantron s : scantrons) {
154
+                s.setPsid(psid);
155
+                s.setQorder(qorder);
156
+                qorder++;
157
+            }
158
+            roomPaperStudentScantronMapper.insertList(scantrons);
159
+        } catch (Exception e) {
160
+            log.error("保存学生作答详情失败:"+e.getMessage());
161
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
162
+        }
163
+    }
164
+
165
+    @Transactional(rollbackFor = Exception.class)
166
+    public int correctExam(Integer psid, Integer checkid, String questionResult) throws Exception {
167
+        try {
168
+            TClassroomPaperStudent ps = roomPaperStudentMapper.findById(psid);
169
+            Long paperid = ps.getPaperid();
170
+            Integer classid = ps.getClassid();
171
+            List<TPaperStudentScantron> psslist = JSON.parseArray(questionResult, TPaperStudentScantron.class);
172
+            if (N_Utils.isListNotEmpty(psslist)) {
173
+                for (TPaperStudentScantron pss : psslist) {
174
+                    //设置批改状态为已批改
175
+                    pss.setCheckid(checkid);
176
+                    pss.setChecked(1);
177
+                    pss.setChecktime(N_Utils.getSecondTimestamp());
178
+                }
179
+
180
+                //批量更新试题批改信息
181
+                roomPaperStudentScantronMapper.updateScantronQuestionBatch(psslist);
182
+            }
183
+            //更新用户得分
184
+            roomPaperStudentMapper.updateScantronStuScore(psid);
185
+            //判断该作业该班级时候已经批改完成
186
+            //查询如果为0,则证明本作业本班级截止当前时间已经提交作业学生全部批改完成
187
+            Integer notCorrect = roomPaperStudentMapper.getNotCorrect(paperid, classid);
188
+            return notCorrect;
189
+        } catch (Exception e) {
190
+            log.error("课堂考试批阅失败:"+e.getMessage());
191
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
192
+            throw new Exception("课堂考试批阅失败");
193
+        }
194
+    }
195
+
196
+    /**
197
+     * 根据考试学生id获取考试是否完成批阅
198
+     * @Param [psid]
199
+     * @Author ywx
200
+     * @Date 2020/9/10 16:23
201
+     * @return java.lang.Integer
202
+     **/
203
+    public Integer getCheckedByPsId(Integer psid) {
204
+        return roomPaperStudentMapper.getCheckedByPsId(psid);
205
+    }
206
+
207
+    /**
208
+     * 获取考试学生待批改试题列表
209
+     * @Param [psid]
210
+     * @Author ywx
211
+     * @Date 2020/9/10 16:24
212
+     * @return java.util.List<com.xhkjedu.vo.paperstudent.PaperStudentScantronVo>
213
+     **/
214
+    public List<Map> listCorrectQuestion(Integer psid) {
215
+        return roomPaperStudentScantronMapper.listCorrectQuestion(psid);
216
+    }
217
+
218
+    /**
219
+     * 修改学生作答记录(教师添加批注)
220
+     * @Param [pssid, useranswer]
221
+     * @Author ywx
222
+     * @Date 2020/9/11 15:15
223
+     * @return void
224
+     **/
225
+    public void updateScantronUseranswer(Integer pssid, String useranswer) {
226
+        roomPaperStudentScantronMapper.updateScantronUseranswer(pssid, useranswer);
227
+    }
228
+}

+ 372
- 0
sclass/src/main/java/com/xhkjedu/sclass/service/classroom/RoomService.java View File

1
+package com.xhkjedu.sclass.service.classroom;
2
+
3
+import com.xhkjedu.sclass.mapper.classroom.ClassroomActivestudentMapper;
4
+import com.xhkjedu.sclass.mapper.classroom.ClassroomMapper;
5
+import com.xhkjedu.sclass.mapper.room.RoomAskstudentMapper;
6
+import com.xhkjedu.sclass.mapper.room.RoomAskteacherMapper;
7
+import com.xhkjedu.sclass.mapper.room.RoomFileMapper;
8
+import com.xhkjedu.sclass.mapper.room.RoomMapper;
9
+import com.xhkjedu.sclass.mapper.room.RoomPaperFileMapper;
10
+import com.xhkjedu.sclass.mapper.room.RoomSignMapper;
11
+import com.xhkjedu.sclass.model.classroom.TClassroom;
12
+import com.xhkjedu.sclass.model.classroom.TClassroomAskstudent;
13
+import com.xhkjedu.sclass.model.classroom.TClassroomAskteacher;
14
+import com.xhkjedu.sclass.model.classroom.TClassroomFile;
15
+import com.xhkjedu.sclass.model.classroom.TClassroomPaperFile;
16
+import com.xhkjedu.sclass.model.classroom.TClassroomSign;
17
+import com.xhkjedu.utils.N_Utils;
18
+import com.xhkjedu.vo.ResultVo;
19
+import com.xhkjedu.sclass.vo.classroom.ObjectiveVo;
20
+import com.xhkjedu.sclass.vo.classroom.RoomCorrectCallVo;
21
+import com.xhkjedu.sclass.vo.classroom.RoomCorrectExamVo;
22
+import com.xhkjedu.sclass.vo.classroom.RoomCorrectVo;
23
+import com.xhkjedu.sclass.vo.classroom.RoomVo;
24
+import com.xhkjedu.sclass.vo.classroom.SubjectiveVo;
25
+import com.xhkjedu.sclass.vo.paper.CheckClassVo;
26
+import lombok.extern.slf4j.Slf4j;
27
+import org.springframework.dao.DuplicateKeyException;
28
+import org.springframework.stereotype.Service;
29
+import org.springframework.transaction.annotation.Transactional;
30
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
31
+
32
+import javax.annotation.Resource;
33
+import java.util.List;
34
+import java.util.Map;
35
+
36
+@Slf4j
37
+@Service
38
+public class RoomService {
39
+    @Resource
40
+    private ClassroomMapper classroomMapper;
41
+    @Resource
42
+    private RoomAskteacherMapper roomAskteacherMapper;
43
+    @Resource
44
+    private ClassroomActivestudentMapper classroomActivestudentMapper;
45
+    @Resource
46
+    private RoomAskstudentMapper roomAskstudentMapper;
47
+    @Resource
48
+    private RoomSignMapper roomSignMapper;
49
+    @Resource
50
+    private RoomFileMapper roomFileMapper;
51
+    @Resource
52
+    private RoomMapper roomMapper;
53
+    @Resource
54
+    private RoomPaperFileMapper roomPaperFileMapper;
55
+
56
+    /**
57
+     * 开始课堂
58
+     * @Param [room]
59
+     * @Author ywx
60
+     * @Date 2020/7/14 17:17
61
+     * @return void
62
+     **/
63
+    @Transactional(rollbackFor = Exception.class)
64
+    public boolean startClass(TClassroom room) {
65
+        boolean rtn = false;//课堂是否重复请求
66
+        try {
67
+            room.setRoomstate(1);
68
+            Integer num = classroomMapper.getStudentNumById(room.getClassid());//根据班级id获取学生数量
69
+            room.setClassnum(num);
70
+            roomMapper.save(room);
71
+            classroomActivestudentMapper.saveStuActive(room.getRoomid(),room.getClassid(),room.getSchoolid());
72
+        } catch (Exception e) {
73
+            if (e instanceof DuplicateKeyException) {
74
+                rtn = true;
75
+                log.error("接口重复请求,课堂id:" + room.getRoomid()+",课堂名称:"+room.getRoomname());
76
+            } else {
77
+                log.error("开始课堂失败:" + e.getMessage());
78
+            }
79
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
80
+        }
81
+        return rtn;
82
+    }
83
+
84
+    /**
85
+     * 结束课堂
86
+     * @Param [room]
87
+     * @Author ywx
88
+     * @Date 2020/7/14 17:17
89
+     * @return void
90
+     **/
91
+    @Transactional(rollbackFor = Exception.class)
92
+    public void stopClass(TClassroom room) {
93
+        try {
94
+            Long roomid = room.getRoomid();
95
+            if (N_Utils.isEmptyInteger(room.getEndtime())) {//异常结束:结束时间=开始时间+45分钟
96
+                TClassroom tClassroom = roomMapper.selectByPrimaryKey(roomid);
97
+                room.setEndtime(tClassroom.getCreatetime() + 60 * 45);
98
+            }
99
+            classroomMapper.endClass(room);//结束课堂
100
+            classroomActivestudentMapper.updateActiveRank(roomid);//更新活跃值排名
101
+        } catch (Exception e) {
102
+            log.error("结束课堂失败:" + e.getMessage());
103
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
104
+        }
105
+    }
106
+
107
+    /**
108
+     * 保存学生签到信息
109
+     * @Param [sign]
110
+     * @Author ywx
111
+     * @Date 2020/7/14 16:32
112
+     * @return void
113
+     **/
114
+    @Transactional(rollbackFor = Exception.class)
115
+    public void saveStudentSign(TClassroomSign sign) {
116
+        try {
117
+            Long roomid = sign.getRoomid();
118
+            Integer userid = sign.getUserid();
119
+            List<Integer> studentids = roomMapper.listStudentId(roomid);//获取班级学生id集合
120
+            if (N_Utils.numInList(userid, studentids)) {//签到学生是本课堂所在班级学生,添加签到信息
121
+                roomSignMapper.save(sign);
122
+                //如果一个学生退出课堂再进来数据就不对了,最后计算
123
+                //classroomMapper.updateRealStuNum(sign.getRoomid());//更新班级实际签到学生数量
124
+                classroomActivestudentMapper.updateActiveNum(roomid,userid);//更新学生活跃值
125
+            }
126
+        } catch (Exception e) {
127
+            log.error("保存学生签到信息失败:" + e.getMessage());
128
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
129
+        }
130
+    }
131
+
132
+
133
+    /**
134
+     *功能描述 最后更新课堂名称
135
+     * @author WN
136
+     * @date 2020/8/14
137
+     * @param  * @param roomlist
138
+     * @return void
139
+     */
140
+    public void updateBatchRoomRealStunum(List<Long> roomlist){
141
+        classroomMapper.updateBatchRoomRealStunum(roomlist);
142
+    }
143
+
144
+    /**
145
+     * 互动发起
146
+     * @Param [teacher]
147
+     * @Author ywx
148
+     * @Date 2020/6/15 9:58
149
+     * @return void
150
+     **/
151
+    public void saveWork(TClassroomAskteacher teacher) {
152
+        try {
153
+            if (teacher.getPaperid() == null){
154
+                teacher.setPaperid(0L);
155
+            }
156
+            if (teacher.getRadionum() == null){
157
+                teacher.setRadionum(0);
158
+            }
159
+            roomAskteacherMapper.save(teacher);
160
+        } catch (Exception e) {
161
+            log.error("互动发起失败:" + e.getMessage());
162
+        }
163
+    }
164
+
165
+    /**
166
+     * 保存学生作答情况
167
+     * @Param [student]
168
+     * @Author ywx
169
+     * @Date 2020/7/14 16:34
170
+     * @return void
171
+     **/
172
+    @Transactional(rollbackFor = Exception.class)
173
+    public void saveStuAnswer(TClassroomAskstudent student) {
174
+        try {
175
+            if (student.getStudentradio() == null){
176
+                student.setStudentradio("");
177
+            }
178
+            if (student.getStudentpic() == null){
179
+                student.setStudentpic("");
180
+            }
181
+            if (student.getRadiocorrect() == null){
182
+                student.setRadiocorrect(0);
183
+            }
184
+            if (student.getStudentselected() == null){
185
+                student.setStudentselected(0);
186
+            }
187
+            roomAskstudentMapper.save(student);
188
+            //保存成功更新学生活跃值
189
+            classroomActivestudentMapper.updateActiveNum(student.getRoomid(),student.getStudentid());
190
+        } catch (Exception e) {
191
+            log.error("保存学生作答情况失败:" + e.getMessage());
192
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
193
+        }
194
+    }
195
+
196
+    /**
197
+     * 保存课堂图片
198
+     * @Param [file]
199
+     * @Author ywx
200
+     * @Date 2020/7/14 16:42
201
+     * @return void
202
+     **/
203
+    public void saveFile(TClassroomFile file) {
204
+        try {
205
+            roomFileMapper.save(file);
206
+        } catch (Exception e) {
207
+            log.error("批量保存课堂图片失败:"+e.getMessage());
208
+        }
209
+    }
210
+
211
+    /**
212
+     *功能描述 批量结束班级之前的课堂
213
+     * @author WN
214
+     * @date 2020/8/14
215
+     * @param  * @param classidlist
216
+     * @return void
217
+     */
218
+    public void updateBatchRoomState(List<Integer> classidlist){
219
+        classroomMapper.updateBatchRoomState(classidlist);
220
+    }
221
+
222
+    /**
223
+     * 获取批阅信息
224
+     * @Param [roomid]
225
+     * @Author ywx
226
+     * @Date 2020/9/9 15:37
227
+     * @return com.xhkjedu.sclass.vo.classroom.RoomCorrectVo
228
+     **/
229
+    public RoomCorrectVo listCorrect(Long roomid) {
230
+        RoomCorrectVo correct = roomMapper.listCorrect(roomid);
231
+        List<RoomCorrectCallVo> calls = correct.getCalls();
232
+        if (N_Utils.isListNotEmpty(calls)){
233
+            for (RoomCorrectCallVo call : calls) {
234
+                call.setCorrectrate(N_Utils.getIntegerDivideAndMulitiply(call.getCorrectnum(),call.getStunum()));
235
+            }
236
+        }
237
+        List<RoomCorrectExamVo> exams = correct.getExams();
238
+        if (N_Utils.isListNotEmpty(exams)){
239
+            for (RoomCorrectExamVo exam : exams) {
240
+                exam.setCorrectrate(N_Utils.getIntegerDivideAndMulitiply(exam.getCorrectnum(),exam.getStunum()));
241
+            }
242
+        }
243
+        return correct;
244
+    }
245
+
246
+    /**
247
+     * 获取提问批改学生列表
248
+     * @Param [asktid]
249
+     * @Author ywx
250
+     * @Date 2020/9/9 16:38
251
+     * @return com.xhkjedu.sclass.vo.paper.CheckClassVo
252
+     **/
253
+    public CheckClassVo listStudentsByAskTid(Long asktid) {
254
+        CheckClassVo classVo = roomMapper.listStudentsByAskTid(asktid);
255
+        return getCheckClassVo(classVo);
256
+    }
257
+
258
+    /**
259
+     * 计算未提交数、批阅进度
260
+     * @Param [classVo]
261
+     * @Author ywx
262
+     * @Date 2020/9/10 8:56
263
+     * @return com.xhkjedu.sclass.vo.paper.CheckClassVo
264
+     **/
265
+    private CheckClassVo getCheckClassVo(CheckClassVo classVo) {
266
+        Integer ytjnum = classVo.getYtjnum();
267
+        classVo.setWtjnum(classVo.getClassnum() - ytjnum);
268
+        if (!N_Utils.isEmptyInteger(ytjnum)) {
269
+            double scale = N_Utils.getIntegerDivideAndMulitiply(classVo.getYpynum(), ytjnum);
270
+            classVo.setScale(scale);
271
+        } else {
272
+            classVo.setScale(0);
273
+        }
274
+        return classVo;
275
+    }
276
+
277
+    /**
278
+     * 获取考试批改学生列表
279
+     * @Param [paperid]
280
+     * @Author ywx
281
+     * @Date 2020/9/9 17:12
282
+     * @return com.xhkjedu.sclass.vo.paper.CheckClassVo
283
+     **/
284
+    public CheckClassVo listStudentsByPaperId(Long paperid) {
285
+        CheckClassVo classVo = roomMapper.listStudentsByPaperId(paperid);
286
+        List<TClassroomPaperFile> files = roomPaperFileMapper.listObjsByPaperid(paperid , 3);
287
+        classVo.setFiles(files);
288
+        return getCheckClassVo(classVo);
289
+    }
290
+
291
+    /**
292
+     * 获取课堂提问客观题详情
293
+     * @Param [asktid]
294
+     * @Author ywx
295
+     * @Date 2020/9/10 11:12
296
+     * @return com.xhkjedu.sclass.vo.classroom.ObjectiveVo
297
+     **/
298
+    public ObjectiveVo callObjective(Long asktid, Integer realstunum) {
299
+        return roomMapper.callObjective(asktid, realstunum);
300
+    }
301
+
302
+    /**
303
+     * 获取课堂考试客观题详情
304
+     * @Param [pscaid]
305
+     * @Author ywx
306
+     * @Date 2020/9/10 11:21
307
+     * @return com.xhkjedu.sclass.vo.classroom.ObjectiveVo
308
+     **/
309
+    public ObjectiveVo examObjective(Long pscaid, Integer realstunum) {
310
+        return roomMapper.examObjective(pscaid, realstunum);
311
+    }
312
+
313
+    /**
314
+     * 获取课堂提问主客观题详情
315
+     * @Param [asktid]
316
+     * @Author ywx
317
+     * @Date 2020/9/10 14:01
318
+     * @return com.xhkjedu.sclass.vo.classroom.SubjectiveVo
319
+     **/
320
+    public SubjectiveVo callSubjective(Long asktid, Integer realstunum) {
321
+        return roomMapper.callSubjective(asktid, realstunum);
322
+    }
323
+
324
+    /**
325
+     * 获取课堂考试主客观题详情
326
+     * @Param [pscaid]
327
+     * @Author ywx
328
+     * @Date 2020/9/10 14:25
329
+     * @return com.xhkjedu.sclass.vo.classroom.SubjectiveVo
330
+     **/
331
+    public SubjectiveVo examSubjective(Long pscaid, Integer realstunum) {
332
+        return roomMapper.examSubjective(pscaid, realstunum);
333
+    }
334
+
335
+    /**
336
+     * 课堂提问批阅
337
+     * @Param [asksid, radiocorrect]
338
+     * @Author ywx
339
+     * @Date 2020/9/10 15:08
340
+     * @return void
341
+     **/
342
+    public void correctCall(Integer asksid, Integer radiocorrect) {
343
+        roomMapper.correctCall(asksid,radiocorrect);
344
+    }
345
+
346
+    /**
347
+     * 修改学生作答记录(教师添加批注)
348
+     * @Param [asksid, studentpic]
349
+     * @Author ywx
350
+     * @Date 2020/9/11 15:08
351
+     * @return void
352
+     **/
353
+    public void updateStudentpic(Integer asksid, String studentpic) {
354
+        roomAskstudentMapper.updateStudentpic(asksid, studentpic);
355
+    }
356
+
357
+    /**
358
+     * 学生课堂回顾列表
359
+     * @Param [room]
360
+     * @Author ywx
361
+     * @Date 2020/9/14 16:32
362
+     * @return java.util.List<com.xhkjedu.sclass.vo.classroom.RoomVo>
363
+     **/
364
+    public List<RoomVo> listStuClass(TClassroom room) {
365
+        return roomMapper.listStuClass(room);
366
+    }
367
+
368
+    public ResultVo getReportStu(Long roomid, Integer studentid) {
369
+        Map room = roomMapper.getReportStu(roomid, studentid);
370
+        return new ResultVo(0, "获取学生课堂回顾详情成功",room);
371
+    }
372
+}

+ 14
- 0
sclass/src/main/java/com/xhkjedu/sclass/utils/ClassUtil.java View File

1
+package com.xhkjedu.sclass.utils;
2
+
3
+import java.util.Map;
4
+import java.util.concurrent.ConcurrentHashMap;
5
+
6
+/**
7
+ * @author ywx
8
+ * @className ClassUtil
9
+ * @description
10
+ * @date 2022/2/21 17:20
11
+ **/
12
+public class ClassUtil {
13
+    public static Map<String, String> uriMap = new ConcurrentHashMap<>();
14
+}

+ 106
- 0
sclass/src/main/java/com/xhkjedu/sclass/utils/JedisUtil.java View File

1
+package com.xhkjedu.sclass.utils;
2
+
3
+import com.alibaba.fastjson.JSON;
4
+import org.springframework.beans.factory.annotation.Autowired;
5
+import org.springframework.beans.factory.annotation.Value;
6
+import org.springframework.data.redis.core.StringRedisTemplate;
7
+import org.springframework.data.redis.core.ValueOperations;
8
+import org.springframework.stereotype.Component;
9
+
10
+import javax.annotation.PostConstruct;
11
+import java.util.concurrent.TimeUnit;
12
+
13
+/**
14
+ * @author ywx
15
+ * @classname JedisUtil
16
+ * @description Redis工具类
17
+ * @date 2019/8/2 16:48
18
+ **/
19
+@Component
20
+public class JedisUtil {
21
+	@Autowired
22
+	private StringRedisTemplate stringRedisTemplate;
23
+	private ValueOperations<String, String> valueOperations;
24
+
25
+	@PostConstruct
26
+	public void init(){
27
+		this.valueOperations = stringRedisTemplate.opsForValue();
28
+	}
29
+
30
+	/**  默认过期时长,单位:秒 */
31
+	//redis失效时间
32
+	@Value("${redisdatatime}")
33
+	private Integer redisdatatime;
34
+	/**  不设置过期时长 */
35
+	public final static long NOT_EXPIRE = -1;
36
+
37
+	public boolean set(String key, Object value, Integer expire){
38
+		boolean rtn = false;
39
+		valueOperations.set(key, toJson(value));
40
+		if(expire != NOT_EXPIRE){
41
+			rtn = stringRedisTemplate.expire(key, expire, TimeUnit.SECONDS);
42
+		}
43
+		return rtn;
44
+	}
45
+
46
+	public void set(String key, Object value){
47
+		set(key, value, redisdatatime);
48
+	}
49
+
50
+	public Boolean setObject(String key, Object value, int cacheSeconds) {
51
+		String val = toJson(value);
52
+		return set(key,val,cacheSeconds);
53
+	}
54
+
55
+	public <T> T get(String key, Class<T> clazz, long expire) {
56
+		String value = valueOperations.get(key);
57
+		if(expire != NOT_EXPIRE){
58
+			stringRedisTemplate.expire(key, expire, TimeUnit.SECONDS);
59
+		}
60
+		return value == null ? null : fromJson(value, clazz);
61
+	}
62
+
63
+	public <T> T get(String key, Class<T> clazz) {
64
+		return get(key, clazz, NOT_EXPIRE);
65
+	}
66
+
67
+	public String get(String key, long expire) {
68
+		String value = valueOperations.get(key);
69
+		if(expire != NOT_EXPIRE){
70
+			stringRedisTemplate.expire(key, expire, TimeUnit.SECONDS);
71
+		}
72
+		return value;
73
+	}
74
+
75
+	public String get(String key) {
76
+		return get(key, NOT_EXPIRE);
77
+	}
78
+
79
+	public Object getObject(String key,Class<?> clazz) {
80
+		String value = get(key);
81
+		return fromJson(value,clazz);
82
+	}
83
+
84
+	public boolean delete(String key) {
85
+		return stringRedisTemplate.delete(key);
86
+	}
87
+
88
+	/**
89
+	 * Object转成JSON数据
90
+	 */
91
+	private String toJson(Object object){
92
+		if(object instanceof Integer || object instanceof Long || object instanceof Float ||
93
+				object instanceof Double || object instanceof Boolean || object instanceof String){
94
+			return String.valueOf(object);
95
+		}
96
+		return JSON.toJSONString(object);
97
+	}
98
+
99
+	/**
100
+	 * JSON数据,转成Object
101
+	 */
102
+	private <T> T fromJson(String json, Class<T> clazz){
103
+		return JSON.parseObject(json, clazz);
104
+	}
105
+
106
+}

+ 11
- 0
sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/ObjectiveAnswerVo.java View File

1
+package com.xhkjedu.sclass.vo.classroom;
2
+
3
+import lombok.Data;
4
+
5
+@Data
6
+public class ObjectiveAnswerVo {
7
+    private String section;//选项
8
+    private Integer stunum;//人数
9
+    private Double stuscore;//得分
10
+    private String stuname;//学生名单
11
+}

+ 32
- 0
sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/ObjectiveVo.java View File

1
+package com.xhkjedu.sclass.vo.classroom;
2
+
3
+import lombok.Data;
4
+
5
+import java.util.List;
6
+
7
+@Data
8
+public class ObjectiveVo {
9
+    //题型
10
+    private String typename;
11
+
12
+    //答案
13
+    private String answer;
14
+
15
+    //正确率
16
+    private double correctrate;
17
+
18
+    //题号
19
+    private Integer psorder;
20
+
21
+    //分值
22
+    private Double psscore;
23
+
24
+    //平均分
25
+    private Double avgscore;
26
+
27
+    //最高分
28
+    private Double maxscore;
29
+
30
+    //答题详情
31
+    private List<ObjectiveAnswerVo> answers;
32
+}

+ 33
- 0
sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/ReportEQuestionVo.java View File

1
+package com.xhkjedu.sclass.vo.classroom;
2
+
3
+import lombok.Data;
4
+
5
+@Data
6
+public class ReportEQuestionVo {
7
+    //答题卡id
8
+    private Long pscaid;
9
+
10
+    //题号
11
+    private Integer psorder;
12
+
13
+    //正确答案
14
+    private String psanswer;
15
+
16
+    //分值
17
+    private Double psscore;
18
+
19
+    //提交率
20
+    private double commitrate;
21
+
22
+    //正确率
23
+    private double correctrate;
24
+
25
+    //题型名称
26
+    private String ctypename;
27
+
28
+    //题型
29
+    private Integer ctype;
30
+
31
+    //签到人数
32
+    private Integer realstunum;
33
+}

+ 36
- 0
sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/ReportExamVo.java View File

1
+package com.xhkjedu.sclass.vo.classroom;
2
+
3
+import lombok.Data;
4
+
5
+import java.util.List;
6
+
7
+@Data
8
+public class ReportExamVo {
9
+    private Long paperid;
10
+    //考试名称
11
+    private String papername;
12
+
13
+    //课堂考试图片集合
14
+    private List<String> paperfiles;
15
+
16
+    //试题列表
17
+    private List<ReportEQuestionVo> questions;
18
+
19
+    //班级id
20
+    private Integer classid;
21
+
22
+    //得分率
23
+    private double scorerate;
24
+
25
+    //已提交人数
26
+    private Integer ytjnum;
27
+
28
+    //未提交人数
29
+    private Integer wtjnum;
30
+
31
+    //最高分
32
+    private Double maxscore;
33
+
34
+    //平均分
35
+    private Double avgscore;
36
+}

+ 57
- 0
sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/ReportRoomVo.java View File

1
+package com.xhkjedu.sclass.vo.classroom;
2
+
3
+import com.xhkjedu.sclass.model.classroom.TClassroomFile;
4
+import lombok.Data;
5
+
6
+import java.util.List;
7
+import java.util.Map;
8
+
9
+@Data
10
+public class ReportRoomVo {
11
+    //课堂名称
12
+    private String roomname;
13
+
14
+    //创建人姓名
15
+    private String createname;
16
+
17
+    //班级名称
18
+    private String classname;
19
+
20
+    private Integer gradeid;
21
+
22
+    //结束时间
23
+    private Integer endtime;
24
+
25
+    //创建时间
26
+    private Integer createtime;
27
+
28
+    //班级学生总人数
29
+    private Integer classnum;
30
+
31
+    //班级实际签到学生数量
32
+    private Integer realstunum;
33
+
34
+    //发布抢答次数
35
+    private Integer asknum;
36
+
37
+    //发布点名次数
38
+    private Integer callnum;
39
+
40
+    //课堂提问列表
41
+    private List<Map> questions;
42
+
43
+    //课堂考试列表
44
+    private List<ReportExamVo> exams;
45
+
46
+    //课堂点名列表
47
+    private List<Map> calls;
48
+
49
+    //课堂抢答列表
50
+    private List<Map> asks;
51
+
52
+    //课堂截图列表
53
+    private List<TClassroomFile> files;
54
+
55
+    //课堂学生列表
56
+    private List<Map> students;
57
+}

+ 24
- 0
sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/RoomCorrectCallVo.java View File

1
+package com.xhkjedu.sclass.vo.classroom;
2
+
3
+import lombok.Data;
4
+
5
+@Data
6
+public class RoomCorrectCallVo {
7
+    //教师互动发起方主键id(cc_ask_teacher)
8
+    private Long asktid;
9
+
10
+    //批阅率
11
+    private double correctrate;
12
+
13
+    //学生数
14
+    private Integer stunum;
15
+
16
+    //提交数
17
+    private Integer commitnum;
18
+
19
+    //批阅数
20
+    private Integer correctnum;
21
+
22
+    //签到人数
23
+    private Integer realstunum;
24
+}

+ 24
- 0
sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/RoomCorrectExamVo.java View File

1
+package com.xhkjedu.sclass.vo.classroom;
2
+
3
+import lombok.Data;
4
+
5
+@Data
6
+public class RoomCorrectExamVo {
7
+    //考试id
8
+    private Long paperid;
9
+
10
+    //考试名称
11
+    private String papername;
12
+
13
+    //批阅率
14
+    private double correctrate;
15
+
16
+    //学生数
17
+    private Integer stunum;
18
+
19
+    //提交数
20
+    private Integer commitnum;
21
+
22
+    //批阅数
23
+    private Integer correctnum;
24
+}

+ 35
- 0
sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/RoomCorrectVo.java View File

1
+package com.xhkjedu.sclass.vo.classroom;
2
+
3
+import lombok.Data;
4
+
5
+import java.util.List;
6
+
7
+@Data
8
+public class RoomCorrectVo {
9
+    //课堂主键id
10
+    private Long roomid;
11
+
12
+    //课堂名称
13
+    private String roomname;
14
+
15
+    //班级名称
16
+    private String classname;
17
+
18
+    //年级id
19
+    private Integer gradeid;
20
+
21
+    //教师名称
22
+    private String teachername;
23
+
24
+    //结束时间
25
+    private Integer endtime;
26
+
27
+    //创建时间
28
+    private Integer createtime;
29
+
30
+    //课堂提问
31
+    List<RoomCorrectCallVo> calls;
32
+
33
+    //课堂考试
34
+    List<RoomCorrectExamVo> exams;
35
+}

+ 63
- 0
sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/RoomVo.java View File

1
+package com.xhkjedu.sclass.vo.classroom;
2
+
3
+import lombok.Data;
4
+
5
+@Data
6
+public class RoomVo {
7
+    //课堂主键id
8
+    private Long roomid;
9
+
10
+    //课堂名称
11
+    private String roomname;
12
+
13
+    //所属班级
14
+    private Integer classid;
15
+
16
+    //班级名称
17
+    private String classname;
18
+
19
+    //所属年级
20
+    private Integer gradeid;
21
+
22
+    //年级名称
23
+    private String gradename;
24
+
25
+    //课堂状态0默认1进行中2已结束
26
+    private Integer roomstate;
27
+
28
+    //教材关联id
29
+    private String lsbid;
30
+
31
+    //教师id
32
+    private Integer teacherid;
33
+
34
+    //教师名称
35
+    private String teachername;
36
+
37
+    //章节类型1系统2自定义
38
+    private Integer directortype;
39
+
40
+    //章节id
41
+    private String directorid;
42
+
43
+    //班级学生总人数
44
+    private Integer classnum;
45
+
46
+    //班级实际签到学生数量
47
+    private Integer realstunum;
48
+
49
+    //结束时间
50
+    private Integer endtime;
51
+
52
+    //创建时间
53
+    private Integer createtime;
54
+
55
+    //章节名称
56
+    private String directorname;
57
+
58
+    //创建人姓名
59
+    private String createname;
60
+
61
+    //未批阅数量
62
+    private Integer wpynum;
63
+}

+ 30
- 0
sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/SubjectiveVo.java View File

1
+package com.xhkjedu.sclass.vo.classroom;
2
+
3
+import lombok.Data;
4
+
5
+import java.util.List;
6
+import java.util.Map;
7
+
8
+@Data
9
+public class SubjectiveVo {
10
+    //题型
11
+    private String typename;
12
+
13
+    //正确率
14
+    private Double correctrate;
15
+
16
+    //题号
17
+    private Integer psorder;
18
+
19
+    //分值
20
+    private Double psscore;
21
+
22
+    //平均分
23
+    private Double avgscore;
24
+
25
+    //最高分
26
+    private Double maxscore;
27
+
28
+    //答题详情
29
+    private List<Map> answers;
30
+}

+ 48
- 0
sclass/src/main/java/com/xhkjedu/sclass/vo/paper/CheckClassVo.java View File

1
+package com.xhkjedu.sclass.vo.paper;
2
+
3
+import com.xhkjedu.sclass.model.classroom.TClassroomPaperFile;
4
+import com.xhkjedu.sclass.vo.paperstudent.StudentVo;
5
+import lombok.Data;
6
+
7
+import java.util.List;
8
+
9
+/**
10
+ * @author ywx
11
+ * @classname CheckClassVo
12
+ * @description
13
+ * @date 2020/6/12 10:48
14
+ **/
15
+@Data
16
+public class CheckClassVo {
17
+    //班级id
18
+    private Integer classid;
19
+
20
+    //班级名称
21
+    private String classname;
22
+
23
+    private Integer gradeid;//年级id
24
+
25
+    //总人数
26
+    private Integer classnum;
27
+
28
+    //已提交人数
29
+    private Integer ytjnum;
30
+
31
+    //未提交人数
32
+    private Integer wtjnum;
33
+
34
+    //已批阅人数
35
+    private Integer ypynum;
36
+
37
+    //批阅进度
38
+    private double scale;
39
+
40
+    //图片地址(用户教师发送试题图片路径)
41
+    private String teacherpic;
42
+
43
+    //提交作业学生集合
44
+    private List<StudentVo> students;
45
+
46
+    //考试附件
47
+    private List<TClassroomPaperFile> files;
48
+}

+ 46
- 0
sclass/src/main/java/com/xhkjedu/sclass/vo/paper/PaperVo.java View File

1
+package com.xhkjedu.sclass.vo.paper;
2
+
3
+import lombok.Data;
4
+
5
+import java.util.List;
6
+
7
+@Data
8
+public class PaperVo {
9
+    //作业id
10
+    private Integer paperid;
11
+
12
+    //作业名称
13
+    private String papername;
14
+
15
+    //试题数量
16
+    private Integer papernum;
17
+
18
+    //作业总分
19
+    private Double paperscore;
20
+
21
+    //作业类型1结构性试题2自定义答题卡
22
+    private Integer papertype;//
23
+
24
+    //作业说明
25
+    private String comm;
26
+
27
+    //上传时间
28
+    private Integer createtime;
29
+
30
+    //创建人姓名
31
+    private String createname;
32
+
33
+    //private List<PaperQtypeVo> types;
34
+
35
+    //作业分类1课前2课后
36
+    private Integer paperclass;
37
+
38
+    //章节id
39
+    private String directorid;
40
+
41
+    //章节名称
42
+    private String directorname;
43
+
44
+    //答案显示方式:1作业截至时间,2提交后显示
45
+    private Integer showtype;
46
+}

+ 21
- 0
sclass/src/main/java/com/xhkjedu/sclass/vo/paperstudent/StudentVo.java View File

1
+package com.xhkjedu.sclass.vo.paperstudent;
2
+
3
+import lombok.Data;
4
+
5
+@Data
6
+public class StudentVo {
7
+    //试卷学生id
8
+    private Integer psid;
9
+
10
+    //学生id
11
+    private Integer studentid;
12
+
13
+    //学生姓名
14
+    private String studentname;
15
+
16
+    //批改状态0未批改1已批改2批改中
17
+    private Integer pschecked;
18
+
19
+    //学生简答题图片地址
20
+    private String studentpic;
21
+}

+ 14
- 0
sclass/src/main/java/com/xhkjedu/sclass/vo/room/RoomPVo.java View File

1
+package com.xhkjedu.sclass.vo.room;
2
+
3
+import lombok.Data;
4
+
5
+import java.util.List;
6
+
7
+@Data
8
+public class RoomPVo {
9
+    //课堂主键id
10
+    private Long roomid;
11
+
12
+    //请求json
13
+    private List<RoomParamVo> params;
14
+}

+ 12
- 0
sclass/src/main/java/com/xhkjedu/sclass/vo/room/RoomParamVo.java View File

1
+package com.xhkjedu.sclass.vo.room;
2
+
3
+import lombok.Data;
4
+
5
+@Data
6
+public class RoomParamVo {
7
+    //请求类型
8
+    private String rtype;
9
+
10
+    //请求json
11
+    private String jsonstr;
12
+}

+ 2
- 2
sclass/src/main/resources/application.properties View File

27
 spring.datasource.hikari.connection-test-query=SELECT 1
27
 spring.datasource.hikari.connection-test-query=SELECT 1
28
 
28
 
29
 # 所有Entity别名类所在包
29
 # 所有Entity别名类所在包
30
-mybatis.type-aliases-package=com.xhkjedu.model,com.xhkjedu.vo
30
+mybatis.type-aliases-package=com.xhkjedu.sclass.model,com.xhkjedu.sclass.vo
31
 mybatis.mapper-Locations=classpath*:mapper/**/*.xml
31
 mybatis.mapper-Locations=classpath*:mapper/**/*.xml
32
-mapper.mappers=com.xhkjedu.base.TkMapper
32
+mapper.mappers=com.xhkjedu.sclass.base.TkMapper
33
 mapper.identity=MYSQL
33
 mapper.identity=MYSQL
34
 #打印日志的两种方式第一种可以指定包名,第二种都可以打印
34
 #打印日志的两种方式第一种可以指定包名,第二种都可以打印
35
 logging.level.com.xhkjedu.mapper=debug
35
 logging.level.com.xhkjedu.mapper=debug

+ 21
- 0
sclass/src/main/resources/mapper/classroom/ClassroomActivestudentMapper.xml View File

1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xhkjedu.sclass.mapper.classroom.ClassroomActivestudentMapper">
4
+    <!--更新活跃值排名-->
5
+    <update id="updateActiveRank">
6
+        UPDATE t_classroom_activestudent a LEFT JOIN (SELECT s.roomid,s.activenum,
7
+        (SELECT COUNT(DISTINCT activenum)+1 FROM t_classroom_activestudent WHERE activenum>s.activenum)activerank
8
+        FROM t_classroom_activestudent s WHERE s.roomid=#{roomid} ORDER BY s.activenum DESC)s2
9
+        ON a.activenum=s2.activenum AND a.roomid=s2.roomid
10
+        SET a.activerank=s2.activerank WHERE a.roomid=#{roomid}
11
+    </update>
12
+    <!--更新学生活跃值-->
13
+    <update id="updateActiveNum">
14
+        UPDATE t_classroom_activestudent SET activenum=activenum+1 WHERE roomid=#{roomid} AND studentid=#{studentid}
15
+    </update>
16
+    <!--添加学生课堂活跃度表信息-->
17
+    <insert id="saveStuActive">
18
+        insert into t_classroom_activestudent(roomid,studentid,createtime,schoolid)
19
+        SELECT #{roomid},s.studentid,UNIX_TIMESTAMP(),#{schoolid} FROM t_class_student s WHERE s.classid=#{classid}
20
+    </insert>
21
+</mapper>

+ 8
- 0
sclass/src/main/resources/mapper/classroom/ClassroomFileMapper.xml View File

1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xhkjedu.sclass.mapper.classroom.ClassroomFileMapper">
4
+    <!--获取课堂图片列表-->
5
+    <select id="listFile" resultType="com.xhkjedu.sclass.model.classroom.TClassroomFile">
6
+        SELECT * FROM t_classroom_file WHERE roomid=#{roomid} ORDER BY rfid
7
+    </select>
8
+</mapper>

+ 125
- 0
sclass/src/main/resources/mapper/classroom/ClassroomMapper.xml View File

1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xhkjedu.sclass.mapper.classroom.ClassroomMapper">
4
+    <!--结束课堂-->
5
+    <update id="endClass">
6
+        UPDATE t_classroom SET roomstate=2,endtime=#{room.endtime} where roomid=#{room.roomid};
7
+        UPDATE t_classroom_askteacher t LEFT JOIN (SELECT s.asktid,count(*)asknum
8
+        FROM t_classroom_askstudent s left join t_classroom_askteacher ct on s.asktid=ct.asktid
9
+        LEFT JOIN t_classroom c ON ct.roomid=c.roomid
10
+        WHERE ct.roomid=#{room.roomid} AND s.classid=c.classid GROUP BY ct.asktid)t2
11
+        ON t.asktid=t2.asktid
12
+        SET t.asknum=t2.asknum WHERE t.roomid=#{room.roomid}
13
+    </update>
14
+    <!--根据班级id获取学生数量-->
15
+    <select id="getStudentNumById" resultType="java.lang.Integer">
16
+        SELECT COUNT(*) FROM t_class_student s WHERE s.classid=#{classid}
17
+    </select>
18
+    <!--获取教师指定章节下上过的课堂历史-->
19
+    <select id="listClassByDirectorId" resultType="com.xhkjedu.sclass.vo.classroom.RoomVo">
20
+        SELECT c.roomid,c.roomname,c.classid,g.classname,g.gradeid,c.roomstate,c.createtime,c.endtime,c.realstunum,d.directorname,u.username createname
21
+        ,(select count(rs.asksid)+count(ps.psid) from t_classroom_askteacher rt
22
+        left join t_classroom_askstudent rs on rt.asktid=rs.asktid and rs.radiocorrect=0
23
+        left join t_classroom_paper_student ps on rt.paperid=ps.paperid and ps.pschecked!=1
24
+        where rt.roomid=c.roomid and rt.asktype between 32 and 40)wpynum
25
+        FROM t_classroom c LEFT JOIN t_class g ON c.classid=g.classid
26
+        left join t_director d on c.directorid=d.directorid
27
+        left join t_user u on c.teacherid=u.userid
28
+        WHERE c.teacherid=#{room.teacherid} and c.lsbid=#{room.lsbid}
29
+        <if test="room.directorid!=null and room.directorid!='0'.toString() and room.directorid!=''">AND c.directorid=#{room.directorid}</if>
30
+        <if test="room.classid!=null and room.classid!=0">AND c.classid=#{room.classid}</if>
31
+        <if test="room.createtime!=null and room.createtime!=0">AND UNIX_TIMESTAMP(FROM_UNIXTIME(c.createtime,'%Y%m%d'))>=#{room.createtime}</if>
32
+        <if test="room.endtime!=null and room.endtime!=0">AND UNIX_TIMESTAMP(FROM_UNIXTIME(c.createtime,'%Y%m%d'))&lt;=#{room.endtime}</if>
33
+        ORDER BY c.createtime DESC
34
+    </select>
35
+    <!--更新班级实际签到学生数量-->
36
+    <update id="updateBatchRoomRealStunum" parameterType="java.util.List">
37
+        UPDATE t_classroom c SET c.realstunum=(SELECT COUNT(DISTINCT s.userid) FROM t_classroom_sign s WHERE s.roomid=c.roomid )
38
+        WHERE
39
+        <foreach collection="list" item="roomid" index="index" separator="or">
40
+            c.roomid=#{roomid}
41
+        </foreach>
42
+    </update>
43
+    <!--批量结束班级之前的课堂-->
44
+    <update id="updateBatchRoomState" parameterType="java.util.List">
45
+        UPDATE t_classroom set roomstate=2 WHERE
46
+        <foreach collection="list" item="classid" index="index" separator="or">
47
+            classid=#{classid} and roomstate=1
48
+        </foreach>
49
+    </update>
50
+    <!--课堂回顾详情-->
51
+    <select id="getReport" resultType="com.xhkjedu.sclass.vo.classroom.ReportRoomVo">
52
+        select r.roomname,r.classnum,r.realstunum,r.createtime,r.endtime,c.classname,c.gradeid,u.username createname
53
+        ,(select count(*) from t_classroom_askteacher ct where ct.roomid=r.roomid and ct.asktype=20)asknum
54
+        ,(select count(*) from t_classroom_askteacher ct where ct.roomid=r.roomid and ct.asktype=21)callnum
55
+        from t_classroom r left join t_class c on r.classid=c.classid
56
+        left join t_user u on r.createid=u.userid
57
+        where r.roomid=#{roomid}
58
+    </select>
59
+    <!--课堂提问列表-->
60
+    <select id="listQuestionReport" resultType="java.util.Map">
61
+        select ct.asktype,ct.teacherpic,ct.asktid,ct.radioanswer
62
+        ,(case when count(cs.asksid)=0 then 0 else 100 end)commitrate
63
+        ,ifnull(truncate(sum(case when cs.radiocorrect=1 and cs.classid=c.classid then 1 else 0 end)*100/count(cs.asksid),2),0)correctrate
64
+        from t_classroom_askteacher ct left join t_classroom_askstudent cs on ct.asktid = cs.asktid
65
+        left join t_classroom c on ct.roomid=c.roomid and cs.classid=c.classid
66
+        where ct.roomid=#{roomid} and ct.asktype between 30 and 33
67
+        group by ct.asktid order by ct.createtime
68
+    </select>
69
+    <!--课堂点名列表-->
70
+    <select id="listCallReport" resultType="java.util.Map">
71
+        select cs.studentid,u.username studentname,u.headpic,u.usersex,count(*)num
72
+        from t_classroom_askteacher ct left join t_classroom_askstudent cs on ct.asktid = cs.asktid
73
+        left join t_user u on cs.studentid=u.userid
74
+        left join t_classroom c on ct.roomid=c.roomid and cs.classid=c.classid
75
+        where ct.roomid=#{roomid} and ct.asktype=21
76
+        group by cs.studentid
77
+        order by convert(u.username using gbk)
78
+    </select>
79
+    <!--课堂抢答列表-->
80
+    <select id="listAskReport" resultType="java.util.Map">
81
+        select cs.studentid,u.username studentname,u.headpic,u.usersex,count(*)num
82
+        from t_classroom_askteacher ct left join t_classroom_askstudent cs on ct.asktid = cs.asktid
83
+        left join t_user u on cs.studentid=u.userid
84
+        left join t_classroom c on ct.roomid=c.roomid
85
+        where ct.roomid=#{roomid} and ct.asktype=20 and cs.classid=c.classid
86
+        group by cs.studentid
87
+        order by convert(u.username using gbk)
88
+    </select>
89
+    <!--课堂截图列表-->
90
+    <select id="listFileReport" resultType="com.xhkjedu.sclass.model.classroom.TClassroomFile">
91
+        select * from t_classroom_file f where f.roomid=#{roomid} order by f.createtime
92
+    </select>
93
+    <!--课堂考试列表-->
94
+    <select id="listExamReport" resultType="com.xhkjedu.sclass.vo.classroom.ReportEQuestionVo">
95
+        select ps.psorder,ps.psanswer,ps.psscore,ps.ctypename,ps.ctype,ps.pscaid
96
+        ,sum(case when q.answered=1 then 1 else 0 end)commitrate
97
+        ,sum(case when q.stuscore=ps.psscore then 1 else 0 end)correctrate
98
+        from t_classroom_paper_scantron ps left join t_classroom_paper_student_scantron q
99
+        on q.pscaid=ps.pscaid and q.classid=#{classid}
100
+        where ps.paperid=#{paperid}
101
+        group by ps.pscaid order by ps.psorder
102
+    </select>
103
+    <!--获取课堂考试列表-->
104
+    <select id="listPaper" resultType="com.xhkjedu.sclass.vo.classroom.ReportExamVo">
105
+      SELECT p.paperid,p.papername,c.classid,truncate(SUM(ps.stuscore)*100/(p.paperscore*COUNT(ps.psid)),2)scorerate
106
+        ,truncate(SUM(ps.stuscore)/COUNT(ps.psid),2)avgscore,MAX(ps.stuscore)maxscore,COUNT(ps.psid)ytjnum,0 wjtnum
107
+        FROM  t_classroom_paper p
108
+        LEFT JOIN t_classroom_paper_student ps ON p.paperid=ps.paperid
109
+        LEFT JOIN t_classroom_askteacher rt ON p.paperid=rt.paperid
110
+        LEFT JOIN t_classroom c ON rt.roomid=c.roomid
111
+        WHERE c.roomid=#{roomid} GROUP BY ps.paperid
112
+    </select>
113
+
114
+    <!--班级学生列表-->
115
+    <select id="listStudent" resultType="java.util.Map">
116
+        select cs.studentid,u.username studentname,count(rs.asksid) num
117
+        from t_class_student cs left join t_classroom r on cs.classid=r.classid
118
+        and r.createtime>UNIX_TIMESTAMP(DATE_SUB(now(), INTERVAL 1 YEAR)) and r.lsbid=#{lsbid}
119
+        left join t_user u on cs.studentid=u.userid
120
+        left join t_classroom_askteacher ct on r.roomid=ct.roomid and ct.asktype=21
121
+        left join t_classroom_askstudent rs on ct.asktid=rs.asktid and cs.studentid=rs.studentid
122
+        where cs.classid=#{classid}
123
+        group by cs.studentid order by convert(u.username using gbk)
124
+    </select>
125
+</mapper>

+ 19
- 0
sclass/src/main/resources/mapper/classroom/ClassroomSignMapper.xml View File

1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xhkjedu.sclass.mapper.classroom.ClassroomSignMapper">
4
+    <!--获取课堂学生列表-->
5
+    <select id="listStudent" resultType="java.util.Map">
6
+        select a.studentid,a.studentname,a.headpic,a.online
7
+        from(select cs.userid studentid,u.username studentname,u.headpic,count(cs.csid)online
8
+        from t_classroom_sign cs left join t_user u on cs.userid=u.userid
9
+        where cs.roomid=#{roomid} group by cs.userid
10
+        union
11
+        select s.studentid,u.username studentname,u.headpic,0 online
12
+        from t_class_student s left join t_user u on u.userid=s.studentid
13
+        left join t_classroom r on s.classid=r.classid
14
+        left join t_classroom_sign cs on r.roomid = cs.roomid and s.studentid=cs.userid
15
+        where r.roomid=#{roomid} and cs.userid is null group by s.studentid)a
16
+        order by convert(a.studentname using gbk)
17
+    </select>
18
+</mapper>
19
+

+ 17
- 0
sclass/src/main/resources/mapper/room/RoomAskstudentMapper.xml View File

1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xhkjedu.sclass.mapper.room.RoomAskstudentMapper">
4
+    <!--保存学生作答情况-->
5
+    <insert id="save">
6
+        insert into t_classroom_askstudent
7
+        (asktid,classid,studentid,studentradio,radiocorrect,studentpic,studentselected,createtime,schoolid)
8
+        values
9
+        (#{r.asktid},#{r.classid},#{r.studentid},#{r.studentradio},#{r.radiocorrect},#{r.studentpic}
10
+        ,#{r.studentselected},#{r.createtime},#{r.schoolid})
11
+    </insert>
12
+    <!--修改学生作答记录(教师添加批注)-->
13
+    <update id="updateStudentpic">
14
+        update t_classroom_askstudent set studentpic=#{studentpic} where asksid=#{asksid}
15
+    </update>
16
+</mapper>
17
+

+ 12
- 0
sclass/src/main/resources/mapper/room/RoomAskteacherMapper.xml View File

1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xhkjedu.sclass.mapper.room.RoomAskteacherMapper">
4
+    <!--保存教师互动信息-->
5
+    <insert id="save">
6
+        insert into t_classroom_askteacher
7
+        (asktid,roomid,asktype,paperid,asknum,teacherpic,radionum,radioanswer,createtime,schoolid)
8
+        values
9
+        (#{r.asktid},#{r.roomid},#{r.asktype},#{r.paperid},#{r.asknum},#{r.teacherpic}
10
+        ,#{r.radionum},#{r.radioanswer},#{r.createtime},#{r.schoolid})
11
+    </insert>
12
+</mapper>

+ 9
- 0
sclass/src/main/resources/mapper/room/RoomFileMapper.xml View File

1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xhkjedu.sclass.mapper.room.RoomFileMapper">
4
+    <!--保存课堂图片信息-->
5
+    <insert id="save">
6
+        insert into t_classroom_file(roomid,rfpath,rftype,createid,createtime,schoolid)
7
+        values (#{r.roomid},#{r.rfpath},#{r.rftype},#{r.createid},#{r.createtime},#{r.schoolid})
8
+    </insert>
9
+</mapper>

+ 271
- 0
sclass/src/main/resources/mapper/room/RoomMapper.xml View File

1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xhkjedu.sclass.mapper.room.RoomMapper">
4
+    <!--保存课堂-->
5
+    <insert id="save">
6
+        insert into t_classroom(roomid,roomname,classid,roomstate,lsbid,teacherid,directorid
7
+        ,directortype,classnum,endtime,createid,createtime,schoolid)
8
+        values
9
+        (#{r.roomid},#{r.roomname},#{r.classid},#{r.roomstate},#{r.lsbid},#{r.teacherid},#{r.directorid}
10
+        ,#{r.directortype},#{r.classnum},#{r.endtime},#{r.teacherid},#{r.createtime},#{r.schoolid})
11
+    </insert>
12
+    <!--获取班级学生id集合-->
13
+    <select id="listStudentId" resultType="java.lang.Integer">
14
+        select cs.studentid from t_class_student cs
15
+        left join t_classroom r on cs.classid=r.classid
16
+        where r.roomid=#{roomid};
17
+    </select>
18
+    <!--获取批阅信息-->
19
+    <resultMap id="correctResult" type="com.xhkjedu.sclass.vo.classroom.RoomCorrectVo">
20
+        <result property="roomid" column="roomid"></result>
21
+        <result property="roomname" column="roomname"></result>
22
+        <result property="createtime" column="createtime"></result>
23
+        <result property="endtime" column="endtime"></result>
24
+        <result property="classname" column="classname"></result>
25
+        <result property="gradeid" column="gradeid"></result>
26
+        <result property="teachername" column="teachername"></result>
27
+        <collection property="calls" ofType="com.xhkjedu.sclass.vo.classroom.RoomCorrectCallVo"
28
+                    select="listCall" column="{roomid=roomid,realstunum=realstunum}">
29
+        </collection>
30
+        <collection property="exams" ofType="com.xhkjedu.sclass.vo.classroom.RoomCorrectExamVo"
31
+                    select="listExam" column="{roomid=roomid,realstunum=realstunum}">
32
+        </collection>
33
+    </resultMap>
34
+    <select id="listCall" resultType="com.xhkjedu.sclass.vo.classroom.RoomCorrectCallVo">
35
+        select s.asktid,count(*)commitnum,count(*) stunum
36
+        ,sum(case when s.radiocorrect!=0 then 1 else 0 end)correctnum
37
+        from t_classroom_askstudent s left join t_classroom_askteacher rt on s.asktid=rt.asktid
38
+        where rt.roomid=#{roomid} and rt.asktype between 32 and 33
39
+        group by s.asktid
40
+    </select>
41
+    <select id="listExam" resultType="com.xhkjedu.sclass.vo.classroom.RoomCorrectExamVo">
42
+        select s.paperid,p.papername,count(*)commitnum,count(*) stunum
43
+        ,sum(case when s.pschecked!=0 then 1 else 0 end)correctnum
44
+        from t_classroom_paper_student s left join t_classroom_paper p on s.paperid=p.paperid
45
+        left join t_classroom_askteacher rt on s.paperid=rt.paperid
46
+        where rt.roomid=#{roomid} and rt.asktype=40
47
+        group by s.paperid
48
+    </select>
49
+    <select id="listCorrect" resultMap="correctResult">
50
+        select r.roomid,r.roomname,r.createtime,r.endtime,r.realstunum
51
+        ,c.classname,c.gradeid
52
+        ,(select u.username  from t_user u where u.userid=r.createid)teachername
53
+        from t_classroom r left join t_class c on r.classid=c.classid
54
+        where r.roomid=#{roomid}
55
+    </select>
56
+
57
+    <!--获取提问批改学生列表-->
58
+    <resultMap id="checkResult" type="com.xhkjedu.sclass.vo.paper.CheckClassVo">
59
+        <result property="classid" column="classid"></result>
60
+        <result property="classnum" column="classnum"></result>
61
+        <result property="ytjnum" column="ytjnum"></result>
62
+        <result property="ypynum" column="ypynum"></result>
63
+        <result property="teacherpic" column="teacherpic"></result>
64
+        <collection property="students" ofType="com.xhkjedu.sclass.vo.paperstudent.StudentVo">
65
+            <result property="psid" column="psid"></result>
66
+            <result property="studentid" column="studentid"></result>
67
+            <result property="studentname" column="studentname"></result>
68
+            <result property="pschecked" column="pschecked"></result>
69
+            <result property="studentpic" column="studentpic"></result>
70
+        </collection>
71
+    </resultMap>
72
+    <select id="listStudentsByAskTid" resultMap="checkResult">
73
+        select rs.classid,rs.asksid psid,rs.studentid,u.username studentname,rs.radiocorrect pschecked,rs.studentpic,rt.teacherpic
74
+        ,count(rs2.asksid)ytjnum,count(rs2.asksid)classnum
75
+        ,sum(case when rs2.radiocorrect!=0 then 1 else 0 end)ypynum
76
+        from t_classroom_askstudent rs left join t_user u on rs.studentid=u.userid
77
+        left join t_classroom_askteacher rt on rs.asktid=rt.asktid
78
+        left join t_classroom_askstudent rs2 on rs2.asktid=rs.asktid
79
+        where rs.asktid=#{asktid}
80
+        group by rs.asksid
81
+    </select>
82
+    <!--获取考试批改学生列表-->
83
+    <select id="listStudentsByPaperId" resultMap="checkResult">
84
+        select ps.classid,ps.paperid,ps.psid,ps.studentid,u.username studentname,ps.pschecked
85
+        ,count(ps2.psid)ytjnum,count(ps2.psid)classnum
86
+        ,sum(case when ps2.pschecked=1 then 1 else 0 end)ypynum
87
+        from t_classroom_paper_student ps left join t_user u on ps.studentid=u.userid
88
+        left join t_classroom_paper_student ps2 on ps2.paperid=ps.paperid
89
+        where ps.paperid=#{paperid}
90
+        group by ps.psid
91
+    </select>
92
+
93
+    <resultMap id="objectiveResult" type="com.xhkjedu.sclass.vo.classroom.ObjectiveVo">
94
+        <result property="typename" column="typename"></result>
95
+        <result property="answer" column="answer"></result>
96
+        <result property="correctrate" column="correctrate"></result>
97
+        <result property="psorder" column="psorder"></result>
98
+        <result property="psscore" column="psscore"></result>
99
+        <result property="avgscore" column="avgscore"></result>
100
+        <result property="maxscore" column="maxscore"></result>
101
+        <collection property="answers" ofType="com.xhkjedu.sclass.vo.classroom.ObjectiveAnswerVo">
102
+            <result property="section" column="section"></result>
103
+            <result property="stunum" column="stunum"></result>
104
+            <result property="stuscore" column="stuscore"></result>
105
+            <result property="stuname" column="stuname"></result>
106
+        </collection>
107
+    </resultMap>
108
+    <!--客观题详情-->
109
+    <select id="callObjective" resultMap="objectiveResult">
110
+        select (case rt.asktype when 30 then '判断题' when 31 then '选择题' when 32 then '简答题' else '画图题' end )typename
111
+        ,rt.radioanswer answer,rs.studentradio section,count(*)stunum
112
+        ,group_concat(u.username order by convert(u.username using gbk) separator '  ')stuname
113
+        ,truncate((select sum(case when rs2.radiocorrect=1 then 1 else 0 end)*100/
114
+        count(*) from t_classroom_askstudent rs2 where rs2.asktid=rt.asktid),2)correctrate
115
+        from t_classroom_askstudent rs right join t_classroom_askteacher rt on rs.asktid=rt.asktid
116
+        left join t_user u on rs.studentid=u.userid
117
+        where rt.asktid=#{asktid}
118
+        group by rs.studentradio
119
+    </select>
120
+    <!--2020.11.16修改,125行添加left-->
121
+    <select id="examObjective" resultMap="objectiveResult">
122
+        select ps.ctypename typename,ps.psanswer answer,ps.psorder,ps.psscore
123
+        ,pss.useranswer section,count(*)stunum,pss.stuscore,a.avgscore,a.maxscore
124
+        ,group_concat(u.username order by convert(u.username using gbk) separator '  ')stuname
125
+        from t_classroom_paper_scantron ps left join t_classroom_paper_student_scantron pss on ps.pscaid=pss.pscaid
126
+        left join (select truncate(sum(pss2.stuscore)/(select count(ps2.psid)
127
+        from t_classroom_paper_student ps2 where ps2.paperid=pss2.paperid),2)avgscore
128
+        ,max(pss2.stuscore)maxscore,pss2.pscaid
129
+        FROM t_classroom_paper_student_scantron pss2 WHERE pss2.pscaid=#{pscaid})a on ps.pscaid=a.pscaid
130
+        left join t_user u on pss.studentid=u.userid
131
+        where ps.pscaid=#{pscaid}
132
+        group by pss.useranswer
133
+    </select>
134
+
135
+    <resultMap id="subjectiveResult" type="com.xhkjedu.sclass.vo.classroom.SubjectiveVo">
136
+        <result property="typename" column="typename"></result>
137
+        <result property="correctrate" column="correctrate"></result>
138
+        <result property="psorder" column="psorder"></result>
139
+        <result property="psscore" column="psscore"></result>
140
+        <result property="avgscore" column="avgscore"></result>
141
+        <result property="maxscore" column="maxscore"></result>
142
+        <collection property="answers" ofType="java.util.Map">
143
+            <result property="useranswer" column="useranswer"></result>
144
+            <result property="checked" column="checked"></result>
145
+            <result property="stuscore" column="stuscore"></result>
146
+            <result property="stuname" column="stuname"></result>
147
+        </collection>
148
+    </resultMap>
149
+    <!--主观题详情-->
150
+    <select id="callSubjective" resultMap="subjectiveResult">
151
+        select (case rt.asktype when 30 then '判断题' when 31 then '选择题' when 32 then '简答题' else '画图题' end )typename
152
+        ,rs.studentpic useranswer,rs.radiocorrect checked,u.username stuname
153
+        ,(select ifnull(truncate(sum(case when s.radiocorrect=1 then 1 else 0 end)*100/count(*),2),0)
154
+        from t_classroom_askstudent s where s.asktid=rt.asktid)correctrate
155
+        from t_classroom_askstudent rs right join t_classroom_askteacher rt on rs.asktid=rt.asktid
156
+        left join t_user u on rs.studentid=u.userid
157
+        where rt.asktid=#{asktid}
158
+    </select>
159
+    <select id="examSubjective" resultMap="subjectiveResult">
160
+        select ps.ctypename typename,ps.psorder,ps.psscore,a.avgscore,a.maxscore
161
+        ,pss.useranswer,pss.checked,pss.stuscore,u.username stuname
162
+        from t_classroom_paper_scantron ps left join t_classroom_paper_student_scantron pss on ps.pscaid=pss.pscaid
163
+        left join t_user u on pss.studentid=u.userid
164
+        left join(select truncate(sum(pss1.stuscore)/(select count(ps2.psid)
165
+        from t_classroom_paper_student ps2 where ps2.paperid=pss1.paperid),2)avgscore
166
+        ,max(pss1.stuscore)maxscore,pss1.pscaid
167
+        from t_classroom_paper_student_scantron pss1 where pss1.pscaid=#{pscaid})a on pss.pscaid=a.pscaid
168
+        where ps.pscaid=#{pscaid}
169
+    </select>
170
+
171
+    <!--课堂提问批阅-->
172
+    <update id="correctCall">
173
+        update t_classroom_askstudent set radiocorrect=#{radiocorrect} where asksid=#{asksid}
174
+    </update>
175
+    <!--学生课堂回顾列表-->
176
+    <select id="listStuClass" resultType="com.xhkjedu.sclass.vo.classroom.RoomVo">
177
+        select r.roomid,r.roomname,r.classid,r.roomstate,r.directorid,r.createtime,r.endtime,r.realstunum,u.username createname
178
+        ,(select d.directorname from t_director d where d.directorid=r.directorid)directorname
179
+        from t_classroom r left join t_user u on r.teacherid=u.userid
180
+        left join t_subject_book sb on r.lsbid=sb.lsbid
181
+        left join t_class_student cs on r.classid=cs.classid
182
+        where cs.studentid=#{room.studentid} and sb.subjectid=#{room.subjectid}
183
+        <if test="room.directorid!=null and room.directorid!='0'.toString() and room.directorid!=''">and r.directorid=#{room.directorid}</if>
184
+        order by r.createtime desc
185
+    </select>
186
+    <!--学生课堂回顾详情-->
187
+    <resultMap id="stuRoomResult" type="java.util.Map">
188
+        <result property="roomid" column="roomid"></result>
189
+        <result property="roomname" column="roomname"></result>
190
+        <result property="createtime" column="createtime"></result>
191
+        <result property="endtime" column="endtime"></result>
192
+        <result property="classnum" column="classnum"></result>
193
+        <result property="realstunum" column="realstunum"></result>
194
+        <collection property="questions" ofType="java.util.Map"
195
+                    select="listStuCall" column="{roomid=roomid,studentid=studentid}">
196
+        </collection>
197
+        <collection property="exams" ofType="java.util.Map"
198
+                    select="listStuExam" column="{roomid=roomid,studentid=studentid,realstunum=realstunum}">
199
+        </collection>
200
+        <collection property="asks" ofType="java.util.Map"
201
+                    select="listStuAsk" column="{roomid=roomid,studentid=studentid}">
202
+        </collection>
203
+        <collection property="files" ofType="com.xhkjedu.sclass.model.classroom.TClassroomFile"
204
+                    select="listFile" column="{roomid=roomid}">
205
+        </collection>
206
+    </resultMap>
207
+    <select id="listFile" resultType="com.xhkjedu.sclass.model.classroom.TClassroomFile">
208
+        select * from t_classroom_file where roomid=#{roomid}
209
+    </select>
210
+    <select id="getReportStu" resultMap="stuRoomResult">
211
+        select r.roomid,r.roomname,r.endtime,r.createtime,r.classnum,r.realstunum,#{studentid} studentid
212
+        from t_classroom r where r.roomid=#{roomid} limit 1
213
+    </select>
214
+    <select id="listStuCall" resultType="java.util.Map">
215
+        select rt.asktype,rt.teacherpic,rt.radioanswer,ifnull(s.createtime,0)createtime,s.radiocorrect
216
+        ,(case when rt.asktype between 32 and 33 then s.studentpic else s.studentradio end)useranswer
217
+        ,(select ifnull(truncate(sum(case when s1.radiocorrect=1 then 1 else 0 end)*100/count(*),2),0)
218
+        from t_classroom_askstudent s1 where s1.asktid=rt.asktid)correctrate
219
+        from t_classroom_askstudent s right join t_classroom_askteacher rt on s.asktid=rt.asktid and s.studentid=#{studentid}
220
+        where rt.roomid=#{roomid} and rt.asktype between 30 and 33
221
+        group by rt.asktid
222
+    </select>
223
+    <select id="listStuAsk" resultType="java.util.Map">
224
+        select a.asktype,a.fqnum,a.cynum,truncate(a.cynum*100/a.fqnum,2)cyrate
225
+        from(select rt.asktype,count(distinct rt.asktid)fqnum,(select count(*) from t_classroom_askstudent s1
226
+        left join t_classroom_askteacher rt1 on s1.asktid=rt1.asktid
227
+        where rt1.roomid=rt.roomid and rt1.asktype=rt.asktype and s1.studentid=#{studentid})cynum
228
+        from t_classroom_askstudent s right join t_classroom_askteacher rt on s.asktid=rt.asktid
229
+        where rt.roomid=#{roomid} and rt.asktype between 20 and 21
230
+        group by rt.asktype)a
231
+    </select>
232
+    <resultMap id="stuExamResult" type="java.util.Map">
233
+        <result property="paperid" column="paperid"></result>
234
+        <result property="papername" column="papername"></result>
235
+        <result property="papernum" column="papernum"></result>
236
+        <result property="paperscore" column="paperscore"></result>
237
+        <result property="avgscore" column="avgscore"></result>
238
+        <result property="maxscore" column="maxscore"></result>
239
+        <result property="scorerate" column="scorerate"></result>
240
+        <result property="stuscore" column="stuscore"></result>
241
+        <collection property="files" ofType="java.lang.String"
242
+                    select="listStuEFile" column="{paperid=paperid}">
243
+        </collection>
244
+        <collection property="questions" ofType="java.util.Map"
245
+                    select="listStuEQuestion" column="{paperid=paperid,studentid=studentid,realstunum=realstunum}">
246
+        </collection>
247
+    </resultMap>
248
+    <select id="listStuEFile" resultType="java.lang.String">
249
+        select filepath from t_classroom_paper_file where paperid=#{paperid} order by fileorder
250
+    </select>
251
+    <select id="listStuExam" resultMap="stuExamResult">
252
+        select p.paperid,p.papername,p.papernum,p.paperscore
253
+        ,(select ifnull(truncate(sum(s.stuscore)/(count(s.psid)*s.paperscore),2),0))avgscore
254
+        ,(select ifnull(max(s.stuscore),0))maxscore
255
+        ,ifnull(truncate(s1.stuscore*100/p.paperscore,2),0)scorerate,ifnull(s1.stuscore,0)stuscore,s1.psid
256
+        ,#{studentid} studentid,count(s.psid) realstunum
257
+        from t_classroom_paper p right join t_classroom_askteacher rt on p.paperid=rt.paperid
258
+        left join t_classroom_paper_student s on s.paperid=p.paperid
259
+        left join t_classroom_paper_student s1 on s1.paperid=rt.paperid and s1.studentid=#{studentid}
260
+        where rt.roomid=#{roomid} and rt.asktype=40 and p.paperid is not null
261
+        group by p.paperid
262
+    </select>
263
+    <select id="listStuEQuestion" resultType="java.util.Map">
264
+        select ps.pscaid,ps.psorder,ps.ctypename,ps.ctype,ps.psscore,ps.psanswer,ifnull(pss.stuscore,0)stuscore,pss.useranswer
265
+        ,ifnull(truncate(pss.stuscore*100/pss.qscore,2),0)scorerate
266
+        ,ifnull(truncate(sum(pss1.stuscore)/#{realstunum},2),0)avgscore,ifnull(max(pss1.stuscore),0)maxscore
267
+        from t_classroom_paper_scantron ps left join t_classroom_paper_student_scantron pss1 on ps.pscaid=pss1.pscaid
268
+        left join t_classroom_paper_student_scantron pss on ps.pscaid=pss.pscaid and pss.studentid=#{studentid}
269
+        where ps.paperid=#{paperid} group by ps.pscaid
270
+    </select>
271
+</mapper>

+ 16
- 0
sclass/src/main/resources/mapper/room/RoomPaperFileMapper.xml View File

1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xhkjedu.sclass.mapper.room.RoomPaperFileMapper">
4
+    <!-- 根据作业id获取作业附件 -->
5
+    <select id="listObjsByPaperid" resultType="com.xhkjedu.sclass.model.classroom.TClassroomPaperFile">
6
+        SELECT pfid,paperid,filepath,fileclass,fileorder,createtime
7
+        FROM
8
+        <if test="qctype==2">t_paper_file</if>
9
+        <if test="qctype==3">t_classroom_paper_file</if>
10
+        WHERE paperid=#{paperid} ORDER BY fileorder asc
11
+    </select>
12
+    <select id="listFilepath" resultType="java.lang.String">
13
+        SELECT filepath FROM t_classroom_paper_file
14
+        WHERE paperid=#{paperid} ORDER BY fileorder asc
15
+    </select>
16
+</mapper>

+ 13
- 0
sclass/src/main/resources/mapper/room/RoomPaperQtypeMapper.xml View File

1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xhkjedu.sclass.mapper.room.RoomPaperQtypeMapper">
4
+    <!--保存答题卡题型-->
5
+    <insert id="batchSave">
6
+        insert into t_classroom_paper_qtype(pqtypeid,paperid,ctype,ctypename,pqorder,pqscore,pqnum,createid,createtime,schoolid)
7
+        values
8
+        <foreach collection ="list" item="r" index= "index" separator =",">
9
+            (#{r.pqtypeid},#{r.paperid},#{r.ctype},#{r.ctypename},#{r.pqorder},#{r.pqscore},#{r.pqnum}
10
+            ,#{r.createid},#{r.createtime},#{r.schoolid})
11
+        </foreach>
12
+    </insert>
13
+</mapper>

+ 14
- 0
sclass/src/main/resources/mapper/room/RoomPaperScantronMapper.xml View File

1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xhkjedu.sclass.mapper.room.RoomPaperScantronMapper">
4
+    <!--保存答题卡题型下试题-->
5
+    <insert id="batchSave">
6
+        insert into t_classroom_paper_scantron(pscaid,paperid,pqtypeid,ctype,ctypename,psorder,psscore
7
+        ,createid,createtime,schoolid,psanswer)
8
+        values
9
+        <foreach collection ="list" item="r" index= "index" separator =",">
10
+            (#{r.pscaid},#{r.paperid},#{r.pqtypeid},#{r.ctype},#{r.ctypename},#{r.psorder},#{r.psscore}
11
+            ,#{r.createid},#{r.createtime},#{r.schoolid},#{r.psanswer})
12
+        </foreach>
13
+    </insert>
14
+</mapper>

+ 27
- 0
sclass/src/main/resources/mapper/room/RoomPaperStudentMapper.xml View File

1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xhkjedu.sclass.mapper.room.RoomPaperStudentMapper">
4
+    <!--获取考试学生信息-->
5
+    <select id="findById" resultType="com.xhkjedu.sclass.model.classroom.TClassroomPaperStudent">
6
+        select s.*,p.subjectid,p.papername from t_classroom_paper_student s
7
+        left join t_classroom_paper p on p.paperid=s.paperid
8
+        where s.psid=#{psid} limit 1
9
+    </select>
10
+    <!--更新用户得分-->
11
+    <update id="updateScantronStuScore">
12
+        UPDATE t_classroom_paper_student s SET pschecked=1
13
+        ,s.stuscore = (SELECT SUM(IFNULL(q.stuscore,0)) FROM t_classroom_paper_student_scantron q WHERE q.psid=s.psid)
14
+        WHERE s.psid = #{psid}
15
+    </update>
16
+    <!--判断该作业该班级是否存在未批改学生-->
17
+    <select id="getNotCorrect" resultType="java.lang.Integer">
18
+        select count(*) from t_classroom_paper_student
19
+        where paperid=#{paperid} and classid=#{classid} and pschecked!=1
20
+    </select>
21
+    <!--根据考试学生id获取考试是否完成批阅-->
22
+    <select id="getCheckedByPsId" resultType="java.lang.Integer">
23
+        select p.checked from t_classroom_paper_student ps
24
+        left join t_classroom_paper p on ps.paperid=p.paperid
25
+        where ps.psid=#{psid}
26
+    </select>
27
+</mapper>

+ 48
- 0
sclass/src/main/resources/mapper/room/RoomPaperStudentScantronMapper.xml View File

1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xhkjedu.sclass.mapper.room.RoomPaperStudentScantronMapper">
4
+    <!--批量更新试题批改信息-->
5
+    <update id="updateScantronQuestionBatch" parameterType="java.util.List">
6
+        UPDATE t_classroom_paper_student_scantron
7
+        <trim prefix="set" suffixOverrides=",">
8
+            <trim prefix="stuscore = CASE " suffix="END,">
9
+                <foreach collection="list" index="index" item="item" >
10
+                    when pssid = #{item.pssid} then #{item.stuscore}
11
+                </foreach>
12
+            </trim>
13
+            <trim prefix="checked = CASE " suffix="END,">
14
+                <foreach collection="list" index="index" item="item" >
15
+                    when pssid = #{item.pssid} then #{item.checked}
16
+                </foreach>
17
+            </trim>
18
+            <trim prefix="checkid = CASE " suffix="END,">
19
+                <foreach collection="list" index="index" item="item" >
20
+                    when pssid = #{item.pssid} then #{item.checkid}
21
+                </foreach>
22
+            </trim>
23
+            <trim prefix="checktime = CASE " suffix="END,">
24
+                <foreach collection="list" index="index" item="item" >
25
+                    when pssid = #{item.pssid} then #{item.checktime}
26
+                </foreach>
27
+            </trim>
28
+        </trim>
29
+        where
30
+        <foreach collection="list" item="item" index="index" separator="or">
31
+            pssid =#{item.pssid}
32
+        </foreach>
33
+    </update>
34
+
35
+    <!-- 获取考试学生待批改试题列表- -->
36
+    <select id="listCorrectQuestion" resultType="java.util.Map">
37
+        SELECT pss.pssid,pss.paperid,pss.studentid,pss.psid,pss.qorder,pss.answered,pss.useranswer,
38
+        pss.answertime,pss.costtime,pss.checked,pss.stuscore,pss.qscore,pss.pscaid,
39
+        psc.ctypename qtypename,psc.ctype,psc.psanswer,u.username studentname
40
+        FROM t_classroom_paper_student_scantron pss LEFT JOIN t_user u ON pss.studentid=u.userid
41
+        LEFT JOIN t_classroom_paper_scantron psc ON pss.pscaid = psc.pscaid
42
+        WHERE pss.psid=#{psid} and psc.ctype=3 order by pss.qorder
43
+    </select>
44
+    <!--修改学生作答记录(教师添加批注)-->
45
+    <update id="updateScantronUseranswer">
46
+        update t_classroom_paper_student_scantron set useranswer=#{useranswer} where pssid=#{pssid}
47
+    </update>
48
+</mapper>

+ 10
- 0
sclass/src/main/resources/mapper/room/RoomSignMapper.xml View File

1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xhkjedu.sclass.mapper.room.RoomSignMapper">
4
+    <!--保存学生签到信息-->
5
+    <insert id="save">
6
+        insert into t_classroom_sign(roomid,userid,createtime,schoolid)
7
+        values (#{r.roomid},#{r.userid},#{r.createtime},#{r.schoolid})
8
+    </insert>
9
+</mapper>
10
+

Loading…
Cancel
Save