Browse Source

Merge remote-tracking branch 'origin/ywx' into wn

ywx
王宁 2 months ago
parent
commit
8aaac220b3

+ 47
- 9
smarking/src/main/java/com/xhkjedu/smarking/controller/exam/MsSubjectController.java View File

@@ -41,7 +41,7 @@ public class MsSubjectController {
41 41
     @PostMapping("/exam_overview")
42 42
     public ResultVo examOverview(@RequestBody MsSubject msSubject) {
43 43
         N_Utils.validation(new Object[]{msSubject.getExamid(), "考试id", 1});
44
-        return new ResultVo(0, "查询成功", msSubjectService.examOverview(msSubject));
44
+        return new ResultVo(0, "查询成功", msSubjectService.examOverview(msSubject));
45 45
     }
46 46
 
47 47
     /**
@@ -59,7 +59,7 @@ public class MsSubjectController {
59 59
                 , msSubject.getHandleid(), "设置人id", 1
60 60
         });
61 61
         msSubjectService.updateById(msSubject);
62
-        return new ResultVo(0, "设置成功");
62
+        return new ResultVo(0, "设置成功");
63 63
     }
64 64
 
65 65
     /**
@@ -75,19 +75,19 @@ public class MsSubjectController {
75 75
         N_Utils.validation(new Object[]{
76 76
                 exam.getExamid(), "考试id", 1
77 77
                 , exam.getSubjects(), "考试科目", 3
78
-                , handleid, "操作人id", 1
78
+                , handleid, "设置人id", 1
79 79
         });
80 80
         MsExam msExam = msExamMapper.selectByPrimaryKey(exam.getExamid());
81
-        if (2 <= msExam.getExamstate()) throw new ServiceException("考试已结束禁止操作");
81
+        if (2 <= msExam.getExamstate()) throw new ServiceException("考试已结束禁止操作");
82 82
         List<MsSubject> subjects = exam.getSubjects();
83 83
         for (MsSubject subject : subjects) {
84 84
             String sdate = subject.getSdate();
85 85
             if (N_Utils.isEmpty(sdate) || N_Utils.isEmpty(subject.getBegintime()) || N_Utils.isEmpty(subject.getEndtime())) {
86
-                throw new ServiceException("考试时间不能为空");
86
+                throw new ServiceException("考试时间不能为空");
87 87
             } else if (DatesUtil.dateNan(sdate)) {
88
-                throw new ServiceException("日期格式不正确");
88
+                throw new ServiceException("日期格式不正确");
89 89
             } else if (N_Utils.isEmpty(subject.getSubjectid()) || N_Utils.isEmpty(subject.getSubjectname())) {
90
-                throw new ServiceException("科目不能为空");
90
+                throw new ServiceException("科目不能为空");
91 91
             }
92 92
         }
93 93
         msSubjectService.setExamDate(subjects, handleid);
@@ -114,7 +114,7 @@ public class MsSubjectController {
114 114
                 nt.setUserid(teacherid);
115 115
                 nt.setGradeid(gradeid);
116 116
                 nt.setSubjectid(s.getSubjectid());
117
-                n.setUsers(Arrays.asList(nt));
117
+                n.setUsers(Collections.singletonList(nt));
118 118
                 noticeList.add(n);
119 119
             }
120 120
             if (msg == 1) {
@@ -125,7 +125,7 @@ public class MsSubjectController {
125 125
             }
126 126
         }
127 127
         noticeService.batchSave(noticeList, msgList, msExam.getSchoolid(), handleid, 2);
128
-        return new ResultVo(0, "设置成功");
128
+        return new ResultVo(0, "设置成功");
129 129
     }
130 130
 
131 131
     /*
@@ -144,4 +144,42 @@ public class MsSubjectController {
144 144
         Map<String, Object> map = msSubjectService.getExamAndSubjectByLeaderid(msSubject.getExamid(),msSubject.getLeaderid());
145 145
         return new ResultVo(0, "获取成功",map);
146 146
     }
147
+
148
+    /**
149
+     * @Description 开始阅卷
150
+     * @Date 2024/10/25 9:53
151
+     * @Author YWX
152
+     * @Param [msSubject]
153
+     * @Return com.xhkjedu.vo.ResultVo
154
+     **/
155
+    @PostMapping("/start_check")
156
+    public ResultVo startCheck(@RequestBody MsSubject msSubject) {
157
+        Integer msid = msSubject.getMsid();
158
+        Integer handleid = msSubject.getHandleid();
159
+        N_Utils.validation(new Object[]{
160
+                msid, "考试科目id", 1
161
+                , handleid, "设置人id", 1
162
+        });
163
+        msSubjectService.updateCheckState(msid, handleid, 1);
164
+        return new ResultVo(0, "开始成功");
165
+    }
166
+
167
+    /**
168
+     * @Description 停止阅卷
169
+     * @Date 2024/10/25 9:54
170
+     * @Author YWX
171
+     * @Param [msSubject]
172
+     * @Return com.xhkjedu.vo.ResultVo
173
+     **/
174
+    @PostMapping("/stop_check")
175
+    public ResultVo stopCheck(@RequestBody MsSubject msSubject) {
176
+        Integer msid = msSubject.getMsid();
177
+        Integer handleid = msSubject.getHandleid();
178
+        N_Utils.validation(new Object[]{
179
+                msid, "考试科目id", 1
180
+                , handleid, "设置人id", 1
181
+        });
182
+        msSubjectService.updateCheckState(msid, handleid, 2);
183
+        return new ResultVo(0, "停止成功");
184
+    }
147 185
 }

+ 51
- 0
smarking/src/main/java/com/xhkjedu/smarking/controller/papercheck/MsPaperCheckController.java View File

@@ -109,4 +109,55 @@ public class MsPaperCheckController {
109 109
         msPaperCheckService.setDispenseWay(msPaperCheck);
110 110
         return new ResultVo(0, "设置成功");
111 111
     }
112
+
113
+    /**
114
+     * @Description 题块阅卷教师列表
115
+     * @Date 2024/10/25 9:05
116
+     * @Author YWX
117
+     * @Param [msPaperCheck]
118
+     * @Return com.xhkjedu.vo.ResultVo
119
+     **/
120
+    @PostMapping("/list_check_teacher")
121
+    public ResultVo listCheckTeacher(@RequestBody MsPaperCheck msPaperCheck) {
122
+        Integer mblockid = msPaperCheck.getMblockid();
123
+        N_Utils.validation(new Object[]{
124
+                mblockid, "题块id", 1
125
+        });
126
+        List<Map> list = msPaperCheckService.listCheckTeacher(mblockid);
127
+        return new ResultVo(0, "查询成功", list);
128
+    }
129
+
130
+    /**
131
+     * @Description 获取试卷分配总数
132
+     * @Date 2024/10/25 11:29
133
+     * @Author YWX
134
+     * @Param [msPaperCheck]
135
+     * @Return com.xhkjedu.vo.ResultVo
136
+     **/
137
+    @PostMapping("/get_dispense_num")
138
+    public ResultVo getDispenseNum(@RequestBody MsPaperCheck msPaperCheck) {
139
+        Integer mpid = msPaperCheck.getMpid();
140
+        N_Utils.validation(new Object[]{
141
+                mpid, "试卷id", 1
142
+        });
143
+        return new ResultVo(0, "获取成功", msPaperCheckService.getDispenseNum(mpid));
144
+    }
145
+
146
+    /**
147
+     * @Description 添加任务
148
+     * @Date 2024/10/25 17:45
149
+     * @Author YWX
150
+     * @Param [msPaperCheck]
151
+     * @Return com.xhkjedu.vo.ResultVo
152
+     **/
153
+    @PostMapping("/add_task_to_teacher")
154
+    public ResultVo addTaskToTeacher(@RequestBody MsPaperCheck msPaperCheck) {
155
+        N_Utils.validation(new Object[]{
156
+                msPaperCheck.getMblockid(), "题块id", 1
157
+                ,msPaperCheck.getTeacherid(), "教师id", 1
158
+                ,msPaperCheck.getTeachers(), "任务教师", 3
159
+        });
160
+        msPaperCheckService.addTaskToTeacher(msPaperCheck);
161
+        return new ResultVo(0, "添加任务成功");
162
+    }
112 163
 }

+ 3
- 0
smarking/src/main/java/com/xhkjedu/smarking/mapper/exam/MsSubjectMapper.java View File

@@ -35,4 +35,7 @@ public interface MsSubjectMapper extends TkMapper<MsSubject> {
35 35
 
36 36
     //获取考试下所有科目名称
37 37
     List<Map<String,String>> listSubjectNameByExamId(@Param("examid") Integer examid);
38
+
39
+    //根据试卷id获取阅卷状态
40
+    Integer getCheckStateByMpId(@Param("mpid") Integer mpid);
38 41
 }

+ 3
- 0
smarking/src/main/java/com/xhkjedu/smarking/mapper/papercheck/MsPaperCheckMapper.java View File

@@ -18,4 +18,7 @@ public interface MsPaperCheckMapper extends TkMapper<MsPaperCheck> {
18 18
 
19 19
     //阅卷分配列表
20 20
     List<Map> listPaperCheck(@Param("mpid") Integer mpid);
21
+
22
+    //获取试卷分配总数
23
+    Map getDispenseNum(@Param("mpid") Integer mpid);
21 24
 }

+ 7
- 0
smarking/src/main/java/com/xhkjedu/smarking/mapper/papercheck/MsPaperCheckTeacherMapper.java View File

@@ -5,6 +5,7 @@ import com.xhkjedu.smarking.model.papercheck.MsPaperCheckTeacher;
5 5
 import org.apache.ibatis.annotations.Param;
6 6
 
7 7
 import java.util.List;
8
+import java.util.Map;
8 9
 
9 10
 /**
10 11
  * @Description 阅卷批阅分配教师表 Mapper 接口
@@ -14,4 +15,10 @@ import java.util.List;
14 15
 public interface MsPaperCheckTeacherMapper extends TkMapper<MsPaperCheckTeacher> {
15 16
     //批量保存
16 17
     void batchSave(@Param("list") List<MsPaperCheckTeacher> teachers);
18
+
19
+    //题块阅卷教师列表
20
+    List<Map> listCheckTeacher(@Param("mblockid") Integer mblockid);
21
+
22
+    //根据题块id查询批阅教师任务信息
23
+    MsPaperCheckTeacher findByBlockId(@Param("mblockid") Integer mblockid,@Param("teacherid") Integer teacherid);
17 24
 }

+ 6
- 0
smarking/src/main/java/com/xhkjedu/smarking/model/papercheck/MsPaperCheck.java View File

@@ -43,4 +43,10 @@ public class MsPaperCheck extends BaseBean {
43 43
     @Transient
44 44
     //阅卷教师
45 45
     private List<MsPaperCheckTeacher> teachers;
46
+    @Transient
47
+    //分配总数1已上传试卷数2报名学生总数
48
+    private Integer numtype;
49
+    @Transient
50
+    //教师ID
51
+    private Integer teacherid;
46 52
 }

+ 16
- 3
smarking/src/main/java/com/xhkjedu/smarking/service/exam/MsSubjectService.java View File

@@ -1,6 +1,5 @@
1 1
 package com.xhkjedu.smarking.service.exam;
2 2
 
3
-import com.xhkjedu.smarking.mapper.exam.MsExamMapper;
4 3
 import com.xhkjedu.smarking.mapper.exam.MsSubjectMapper;
5 4
 import com.xhkjedu.smarking.model.exam.MsSubject;
6 5
 import com.xhkjedu.utils.N_Utils;
@@ -19,8 +18,6 @@ import java.util.Map;
19 18
 public class MsSubjectService {
20 19
     @Resource
21 20
     private MsSubjectMapper msSubjectMapper;
22
-    @Resource
23
-    private MsExamMapper msExamMapper;
24 21
 
25 22
     /**
26 23
      * @Description 考试进度总览
@@ -60,4 +57,20 @@ public class MsSubjectService {
60 57
     public Map<String,Object> getExamAndSubjectByLeaderid(Integer examid,Integer leaderid){
61 58
         return msSubjectMapper.getExamLeadSubjects(examid,leaderid);
62 59
     }
60
+
61
+    /**
62
+     * @Description 修改阅卷状态
63
+     * @Date 2024/10/25 9:53
64
+     * @Author YWX
65
+     * @Param [msid, handleid, checkstate]
66
+     * @Return void
67
+     **/
68
+    public void updateCheckState(Integer msid, Integer handleid, int checkstate) {
69
+        MsSubject msSubject = new MsSubject();
70
+        msSubject.setMsid(msid);
71
+        msSubject.setHandleid(handleid);
72
+        msSubject.setCheckstate(checkstate);
73
+        msSubject.setHandletime(N_Utils.getSecondTimestamp());
74
+        msSubjectMapper.updateByPrimaryKeySelective(msSubject);
75
+    }
63 76
 }

+ 46
- 5
smarking/src/main/java/com/xhkjedu/smarking/service/papercheck/MsPaperCheckService.java View File

@@ -1,6 +1,7 @@
1 1
 package com.xhkjedu.smarking.service.papercheck;
2 2
 
3 3
 import com.xhkjedu.exception.ServiceException;
4
+import com.xhkjedu.smarking.mapper.exam.MsSubjectMapper;
4 5
 import com.xhkjedu.smarking.mapper.papercheck.MsPaperCheckMapper;
5 6
 import com.xhkjedu.smarking.mapper.papercheck.MsPaperCheckTeacherMapper;
6 7
 import com.xhkjedu.smarking.model.papercheck.MsPaperCheck;
@@ -23,6 +24,8 @@ public class MsPaperCheckService {
23 24
     private MsPaperCheckMapper msPaperCheckMapper;
24 25
     @Resource
25 26
     private MsPaperCheckTeacherMapper msPaperCheckTeacherMapper;
27
+    @Resource
28
+    private MsSubjectMapper msSubjectMapper;
26 29
 
27 30
     /**
28 31
      * @Description 设置评卷方式
@@ -32,11 +35,13 @@ public class MsPaperCheckService {
32 35
      * @Return void
33 36
      **/
34 37
     public void add(MsPaperCheck msPaperCheck) {
38
+        Integer checkstate = msSubjectMapper.getCheckStateByMpId(msPaperCheck.getMpid());//根据试卷id获取阅卷状态
39
+        if (checkstate.equals(0)) throw new ServiceException("开始阅卷后不支持修改");
35 40
         saveOrUpdate(msPaperCheck);
36 41
     }
37 42
 
38 43
     //添加或更新阅卷方式
39
-    private MsPaperCheck saveOrUpdate(MsPaperCheck msPaperCheck) {
44
+    private void saveOrUpdate(MsPaperCheck msPaperCheck) {
40 45
         Integer mpcid = msPaperCheckMapper.getMpcIdByMBlockId(msPaperCheck.getMblockid());
41 46
         if (N_Utils.isTrueInteger(mpcid)) {
42 47
             msPaperCheck.setMpcid(mpcid);
@@ -45,7 +50,6 @@ public class MsPaperCheckService {
45 50
             msPaperCheck.setCreatetime(N_Utils.getSecondTimestamp());
46 51
             msPaperCheckMapper.insertSelective(msPaperCheck);
47 52
         }
48
-        return msPaperCheck;
49 53
     }
50 54
 
51 55
     /**
@@ -77,10 +81,11 @@ public class MsPaperCheckService {
77 81
      * @Param [msPaperCheck]
78 82
      * @Return void
79 83
      **/
84
+    @Transactional(rollbackFor = Exception.class)
80 85
     public void setCheckTeacher(MsPaperCheck msPaperCheck) {
81
-        MsPaperCheck check = saveOrUpdate(msPaperCheck);
82
-        Integer mpid = check.getMpid();
83
-        Integer mblockid = check.getMblockid();
86
+        saveOrUpdate(msPaperCheck);
87
+        Integer mpid = msPaperCheck.getMpid();
88
+        Integer mblockid = msPaperCheck.getMblockid();
84 89
         Integer createid = msPaperCheck.getCreateid();
85 90
         int timestamp = N_Utils.getSecondTimestamp();
86 91
         List<MsPaperCheckTeacher> teachers = msPaperCheck.getTeachers();
@@ -115,4 +120,40 @@ public class MsPaperCheckService {
115 120
         }
116 121
         saveOrUpdate(msPaperCheck);
117 122
     }
123
+
124
+    /**
125
+     * @Description 题块阅卷教师列表
126
+     * @Date 2024/10/25 9:05
127
+     * @Author YWX
128
+     * @Param [mblockid]
129
+     * @Return java.util.List<java.util.Map>
130
+     **/
131
+    public List<Map> listCheckTeacher(Integer mblockid) {
132
+        return msPaperCheckTeacherMapper.listCheckTeacher(mblockid);
133
+    }
134
+
135
+    /**
136
+     * @Description 获取试卷分配总数
137
+     * @Date 2024/10/25 11:29
138
+     * @Author YWX
139
+     * @Param [mpid]
140
+     * @Return java.util.Map
141
+     **/
142
+    public Map getDispenseNum(Integer mpid) {
143
+        return msPaperCheckMapper.getDispenseNum(mpid);
144
+    }
145
+
146
+    /**
147
+     * @Description 添加任务
148
+     * @Date 2024/10/25 17:57
149
+     * @Author YWX
150
+     * @Param [check]
151
+     * @Return void
152
+     **/
153
+    public void addTaskToTeacher(MsPaperCheck check) {
154
+        MsPaperCheckTeacher teacher = msPaperCheckTeacherMapper.findByBlockId(check.getMblockid(), check.getTeacherid());
155
+        if (teacher == null) {
156
+            throw new ServiceException("教师未分配该题块");
157
+        }
158
+    }
118 159
 }

+ 4
- 0
smarking/src/main/resources/mapper/exam/MsSubjectMapper.xml View File

@@ -48,6 +48,10 @@
48 48
     <select id="listSubjectNameByExamId" resultType="java.util.Map">
49 49
         select subjectid,subjectname from ms_subject where examid=#{examid}
50 50
     </select>
51
+    <!--根据试卷id获取阅卷状态-->
52
+    <select id="getCheckStateByMpId" resultType="java.lang.Integer">
53
+        select s.checkstate from ms_paper p inner join ms_subject s on p.msid=s.msid where p.mpid=#{mpid}
54
+    </select>
51 55
 
52 56
     <!--更改科目试卷模板设置状态-->
53 57
     <update id="updatePtstateByMpid">

+ 5
- 0
smarking/src/main/resources/mapper/papercheck/MsPaperCheckMapper.xml View File

@@ -24,4 +24,9 @@
24 24
         where pb.mpid = #{mpid} and pb.blocktype = 2
25 25
         order by pb.blockorder
26 26
     </select>
27
+    <!--获取试卷分配总数-->
28
+    <select id="getDispenseNum" resultType="java.util.Map">
29
+        select count(*) as signupnum,count(if(ps.sstate=2,1,null)) as commitnum
30
+        from ms_paper_student ps where ps.mpid = #{mpid}
31
+    </select>
27 32
 </mapper>

+ 13
- 0
smarking/src/main/resources/mapper/papercheck/MsPaperCheckTeacherMapper.xml View File

@@ -9,4 +9,17 @@
9 9
             on duplicate key update tasknum=#{s.tasknum}
10 10
         </foreach>
11 11
     </insert>
12
+    <!--题块阅卷教师列表-->
13
+    <select id="listCheckTeacher" resultType="java.util.Map">
14
+        select pct.mpid,pct.mblockid,pct.teacherid,pct.tasknum,u.username as teachername
15
+        ,count(if(pctt.checkstate=3,1,null)) as checknum
16
+        from ms_paper_check_teacher pct left join t_user u on pct.teacherid = u.userid
17
+        left join ms_paper_check_teacher_task pctt on  pct.mblockid = pctt.mblockid and pct.teacherid = pctt.teacherid
18
+        where pct.mblockid = #{mblockid}
19
+        group by pct.teacherid
20
+    </select>
21
+    <!--根据题块id查询批阅教师任务信息-->
22
+    <select id="findByBlockId" resultType="com.xhkjedu.smarking.model.papercheck.MsPaperCheckTeacher">
23
+        select * from ms_paper_check_teacher where mblockid = #{mblockid} and teacherid = #{teacherid} limit 1
24
+    </select>
12 25
 </mapper>

Loading…
Cancel
Save