소스 검색

考试管理

ywx
雍文秀 1 개월 전
부모
커밋
db54ce684a

+ 50
- 0
smarking/src/main/java/com/xhkjedu/smarking/controller/exam/MsExamController.java 파일 보기

@@ -176,10 +176,60 @@ public class MsExamController {
176 176
         return msExamService.update(msExam);
177 177
     }
178 178
 
179
+    /**
180
+     * @Description 详情
181
+     * @Date 2024/11/26 8:51
182
+     * @Author YWX
183
+     * @Param [msExam]
184
+     * @Return com.xhkjedu.vo.ResultVo
185
+     **/
179 186
     @PostMapping("/detail")
180 187
     public ResultVo detail(@RequestBody MsExam msExam) {
181 188
         Integer examid = msExam.getExamid();
182 189
         N_Utils.validation(new Object[]{examid, "考试id", 1});
183 190
         return new ResultVo(0, "查询成功", msExamService.findById(examid));
184 191
     }
192
+
193
+    /**
194
+     * @Description 发布成绩
195
+     * @Date 2024/11/26 9:10
196
+     * @Author YWX
197
+     * @Param [msExam]
198
+     * @Return com.xhkjedu.vo.ResultVo
199
+     **/
200
+    @PostMapping("/fb_cj")
201
+    public ResultVo fbCj(@RequestBody MsExam msExam) {
202
+        Integer examid = msExam.getExamid();
203
+        N_Utils.validation(new Object[]{examid, "考试id", 1});
204
+        msExamService.updateExamState(examid,4);
205
+        return new ResultVo(0, "发布成绩成功");
206
+    }
207
+
208
+    /**
209
+     * @Description 获取考试关联学校
210
+     * @Date 2024/11/26 11:44
211
+     * @Author YWX
212
+     * @Param [msExam]
213
+     * @Return com.xhkjedu.vo.ResultVo
214
+     **/
215
+    @PostMapping("/list_school")
216
+    public ResultVo listSchool(@RequestBody MsExam msExam) {
217
+        Integer examid = msExam.getExamid();
218
+        N_Utils.validation(new Object[]{examid, "考试id", 1});
219
+        return new ResultVo(0, "查询成功", msExamService.listSchool(examid));
220
+    }
221
+
222
+    /**
223
+     * @Description 考试科目列表
224
+     * @Date 2024/11/26 15:17
225
+     * @Author YWX
226
+     * @Param [msExam]
227
+     * @Return com.xhkjedu.vo.ResultVo
228
+     **/
229
+    @PostMapping("/list_subject")
230
+    public ResultVo listSubject(@RequestBody MsExam msExam) {
231
+        Integer examid = msExam.getExamid();
232
+        N_Utils.validation(new Object[]{examid, "考试id", 1});
233
+        return new ResultVo(0, "查询成功", msExamService.listSubject(examid));
234
+    }
185 235
 }

+ 4
- 2
smarking/src/main/java/com/xhkjedu/smarking/controller/exam/MsSubjectController.java 파일 보기

@@ -72,15 +72,17 @@ public class MsSubjectController {
72 72
     @PostMapping("/set_exam_date")
73 73
     public ResultVo setExamDate(@RequestBody ExamVo exam) {
74 74
         Integer handleid = exam.getHandleid();
75
+        Integer examid = exam.getExamid();
75 76
         N_Utils.validation(new Object[]{
76
-                exam.getExamid(), "考试id", 1
77
+                examid, "考试id", 1
77 78
                 , exam.getSubjects(), "考试科目", 3
78 79
                 , handleid, "设置人id", 1
79 80
         });
80
-        MsExam msExam = msExamMapper.selectByPrimaryKey(exam.getExamid());
81
+        MsExam msExam = msExamMapper.selectByPrimaryKey(examid);
81 82
         if (2 <= msExam.getExamstate()) throw new ServiceException("考试已结束禁止操作");
82 83
         List<MsSubject> subjects = exam.getSubjects();
83 84
         for (MsSubject subject : subjects) {
85
+            subject.setExamid(examid);
84 86
             String sdate = subject.getSdate();
85 87
             if (N_Utils.isEmpty(sdate) || N_Utils.isEmpty(subject.getBegintime()) || N_Utils.isEmpty(subject.getEndtime())) {
86 88
                 throw new ServiceException("考试时间不能为空");

+ 1
- 1
smarking/src/main/java/com/xhkjedu/smarking/controller/papercheck/MsPaperCheckController.java 파일 보기

@@ -136,7 +136,7 @@ public class MsPaperCheckController {
136 136
                 , msPaperCheck.getCreateid(), "创建人id", 1
137 137
                 , msPaperCheck.getCorrecttype(), "批阅设置", 1
138 138
         });
139
-        if (!dispenseway.equals(3) && !N_Utils.isTrueInteger(msPaperCheck.getNumtype())) {
139
+        if (!dispenseway.equals(2) && !N_Utils.isTrueInteger(msPaperCheck.getNumtype())) {
140 140
             return new ResultVo(1, "请选择分配总数");
141 141
         }
142 142
         msPaperCheckService.setDispenseWay(msPaperCheck);

+ 6
- 0
smarking/src/main/java/com/xhkjedu/smarking/mapper/exam/MsClassMapper.java 파일 보기

@@ -42,4 +42,10 @@ public interface MsClassMapper extends TkMapper<MsClass> {
42 42
 
43 43
     //班级选择列表(创建考试用)
44 44
     List<Map> listSchoolClass(@Param("schoolid") Integer schoolid, @Param("year") Integer year,@Param("teacherid") Integer teacherid);
45
+
46
+    //考试班级名称和人数列表
47
+    List<Map> listNameAndNumByExamId(@Param("examid") Integer examid);
48
+
49
+    //获取考试关联学校
50
+    List<Map<String, Object>> listSchoolByExamId(@Param("schoolid") Integer schoolid,@Param("examid") Integer examid);
45 51
 }

+ 3
- 0
smarking/src/main/java/com/xhkjedu/smarking/mapper/exam/MsExamMapper.java 파일 보기

@@ -36,4 +36,7 @@ public interface MsExamMapper extends TkMapper<MsExam> {
36 36
 
37 37
     //更新考试状态
38 38
     void updateExamState(@Param("examid") Integer examid,@Param("examstate") int examstate);
39
+
40
+    //获取考试学校id
41
+    Integer getSchoolIdByExamId(@Param("examid") Integer examid);
39 42
 }

+ 1
- 1
smarking/src/main/java/com/xhkjedu/smarking/model/exam/MsExam.java 파일 보기

@@ -27,7 +27,7 @@ public class MsExam extends BaseBean {
27 27
     private Integer exammode;
28 28
     //是否启用监控0未启用1启用
29 29
     private Integer monitored;
30
-    //考试状态0未开始1已开始2已结束3已生成报告
30
+    //考试状态0未开始1已开始2已结束3己生成报告(一键统分)4发布成绩
31 31
     private Integer examstate;
32 32
     //年级
33 33
     private Integer gradeid;

+ 52
- 1
smarking/src/main/java/com/xhkjedu/smarking/service/exam/MsExamService.java 파일 보기

@@ -89,6 +89,12 @@ public class MsExamService {
89 89
             s.setSchoolid(schoolid);
90 90
             s.setExamid(examid);
91 91
             s.setMsstate(0);
92
+            s.setPstate(0);
93
+            s.setPtstate(0);
94
+            s.setPbstate(0);
95
+            s.setCheckstate(0);
96
+            s.setCheckset(0);
97
+            s.setInvigilatestate(0);
92 98
 
93 99
             MsPaper p = new MsPaper();
94 100
             p.setExamid(examid);
@@ -100,6 +106,7 @@ public class MsExamService {
100 106
             p.setAnswered(0);
101 107
             p.setHasfile(0);
102 108
             p.setHearnum(0);
109
+            p.setCorrecttype(0);
103 110
             papers.add(p);
104 111
         }
105 112
         msSubjectMapper.insertList(subjects);//考试科目
@@ -356,6 +363,7 @@ public class MsExamService {
356 363
         model.setGradeid(null);
357 364
         model.setExammode(null);
358 365
         msExamMapper.updateByPrimaryKeySelective(model);
366
+        model.setExammode(exam.getExammode());
359 367
         Integer examid = model.getExamid();
360 368
         List<Integer> classids = model.getClassids();
361 369
         //班级集合为空不处理班级
@@ -367,10 +375,53 @@ public class MsExamService {
367 375
         return new ResultVo(0, "修改成功");
368 376
     }
369 377
 
378
+    /**
379
+     * @Description 详情
380
+     * @Date 2024/11/26 8:50
381
+     * @Author YWX
382
+     * @Param [examid]
383
+     * @Return java.util.Map
384
+     **/
370 385
     public Map findById(Integer examid) {
386
+        Map map = msExamMapper.findById(examid);
387
+        map.put("subjects", msSubjectMapper.listSubjectNameByExamId(examid));
388
+        map.put("classes",  msClassMapper.listNameAndNumByExamId(examid));
389
+        return map;
390
+    }
391
+
392
+    /**
393
+     * @Description 更新考试状态
394
+     * @Date 2024/11/26 9:12
395
+     * @Author YWX
396
+     * @Param [examid, examstate]
397
+     * @Return void
398
+     **/
399
+    public void updateExamState(Integer examid, int examstate) {
400
+        msExamMapper.updateExamState(examid, examstate);
401
+    }
402
+
403
+    /**
404
+     * @Description 获取考试关联学校
405
+     * @Date 2024/11/26 11:49
406
+     * @Author YWX
407
+     * @Param [examid]
408
+     * @Return java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
409
+     **/
410
+    public List<Map<String, Object>> listSchool(Integer examid) {
411
+        Integer schoolid = msExamMapper.getSchoolIdByExamId(examid);
412
+        return msClassMapper.listSchoolByExamId(schoolid, examid);
413
+    }
414
+
415
+    /**
416
+     * @Description 考试科目列表
417
+     * @Date 2024/11/26 15:17
418
+     * @Author YWX
419
+     * @Param [examid]
420
+     * @Return java.util.Map
421
+     **/
422
+    public Map  listSubject(Integer examid) {
371 423
         Map map = msExamMapper.findById(examid);
372 424
         map.put("subjects", msSubjectMapper.listByExamId(examid));
373
-        map.put("classes",  msClassMapper.listByExamId(examid,null));
374 425
         return map;
375 426
     }
376 427
 }

+ 8
- 1
smarking/src/main/java/com/xhkjedu/smarking/service/papercheck/MsPaperCheckService.java 파일 보기

@@ -122,6 +122,9 @@ public class MsPaperCheckService {
122 122
     @Transactional(rollbackFor = Exception.class)
123 123
     public void setDispenseWay(MsPaperCheck msPaperCheck) {
124 124
         Integer dispenseway = msPaperCheck.getDispenseway();
125
+        Integer mpid = msPaperCheck.getMpid();
126
+        Integer mblockid = msPaperCheck.getMblockid();
127
+        Integer createid = msPaperCheck.getCreateid();
125 128
         if (dispenseway.equals(3)) {
126 129
             List<MsPaperCheckTeacher> teachers = msPaperCheck.getTeachers();
127 130
             if (N_Utils.isListEmpty(teachers)) throw new ServiceException("请选择阅卷教师");
@@ -129,12 +132,16 @@ public class MsPaperCheckService {
129 132
                 if (N_Utils.isTrueInteger(teacher.getTasknum())) {
130 133
                     throw new ServiceException("请设置每位教师的阅卷任务数");
131 134
                 }
135
+                teacher.setMpid(mpid);
136
+                teacher.setMblockid(mblockid);
137
+                teacher.setCreateid(createid);
138
+                teacher.setCreatetime(N_Utils.getSecondTimestamp());
132 139
                 teacher.setDeleted(1);
133 140
             }
134 141
             msPaperCheckTeacherMapper.batchSave(teachers);
135 142
         }
136 143
         saveOrUpdate(msPaperCheck);
137
-        setBlockTask(msPaperCheck.getMpid(), msPaperCheck.getMblockid());//设置一个题块的批卷任务
144
+        setBlockTask(mpid, mblockid);//设置一个题块的批卷任务
138 145
     }
139 146
 
140 147
     //设置一个题块的批卷任务

+ 15
- 0
smarking/src/main/resources/mapper/exam/MsClassMapper.xml 파일 보기

@@ -93,4 +93,19 @@
93 93
         group by c.classid
94 94
         order by c.classtype,c.classorder,c.classid
95 95
     </select>
96
+    <!--考试班级名称和人数列表-->
97
+    <select id="listNameAndNumByExamId" resultType="java.util.Map">
98
+        select c.classid,c.classname,count(distinct cs.studentid) as num
99
+        from ms_class c inner join ms_class_student cs on c.examid=cs.examid and c.classid=cs.classid
100
+        where c.examid=#{examid}
101
+        group by c.classid order by c.mcid
102
+    </select>
103
+    <!--获取考试关联学校-->
104
+    <select id="listSchoolByExamId" resultType="java.util.Map">
105
+        select c.schoolid, s.schoolname
106
+        from ms_class c inner join t_school s on c.schoolid = s.schoolid
107
+        where c.examid = #{examid}
108
+        group by s.schoolid
109
+        order by if(c.schoolid =#{schoolid}, 0, 1), c.schoolid
110
+    </select>
96 111
 </mapper>

+ 4
- 0
smarking/src/main/resources/mapper/exam/MsExamMapper.xml 파일 보기

@@ -70,4 +70,8 @@
70 70
     <select id="getExamstate" resultType="java.lang.Integer">
71 71
         select examstate from ms_exam where examid=#{examid}
72 72
     </select>
73
+    <!--获取考试学校id-->
74
+    <select id="getSchoolIdByExamId" resultType="java.lang.Integer">
75
+        select schoolid from ms_exam where examid=#{examid}
76
+    </select>
73 77
 </mapper>

+ 3
- 1
smarking/src/main/resources/mapper/exam/MsSubjectMapper.xml 파일 보기

@@ -122,7 +122,9 @@
122 122
     </select>
123 123
     <!--获取考试科目信息-->
124 124
     <select id="listByExamId" resultType="java.util.Map">
125
-        select * from ms_subject where examid=#{examid}
125
+        select s.msid,s.subjectid,s.subjectname,s.sdate,s.begintime,s.endtime,s.teacherid,u.username as teachername
126
+        from ms_subject s left join t_user u on s.teacherid=u.userid
127
+        where examid=#{examid}
126 128
     </select>
127 129
     <!--定时任务-科目结束考试-->
128 130
     <update id="updateEndSubject">

Loading…
취소
저장