Browse Source

定时任务、试卷分

ywx
王宁 1 month ago
parent
commit
949cd9e45c

+ 2
- 0
sapi/src/main/java/com/xhkjedu/sapi/model/scantron/TScantron.java View File

@@ -34,6 +34,8 @@ public class TScantron extends BaseBean {
34 34
     private Double typedistance;
35 35
     // 布局1一栏 2二栏 3三栏
36 36
     private Integer slayout;
37
+    //栏边距
38
+    private Double columndistance;
37 39
     // 颜色
38 40
     private String scolor;
39 41
     // 考号类型1涂卡 2条形码 3手写1 4手写2

+ 61
- 0
smarking/src/main/java/com/xhkjedu/smarking/config/ThreadPoolTaskExecutorConfig.java View File

@@ -0,0 +1,61 @@
1
+package com.xhkjedu.smarking.config;
2
+
3
+import org.springframework.context.annotation.Bean;
4
+import org.springframework.context.annotation.Configuration;
5
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
6
+import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
7
+
8
+import java.util.concurrent.ThreadPoolExecutor;
9
+
10
+/**
11
+ * @描述 :配置线程池
12
+ * @创建时间 2019/9/30
13
+ * @修改人和其它信息
14
+ */
15
+@Configuration
16
+public class ThreadPoolTaskExecutorConfig {
17
+    /**
18
+     * 配置执行任务线程池
19
+     * 应用此池: @Async("asyncPoolTaskExecutor")
20
+     *
21
+     * @return
22
+     */
23
+    @Bean(name = "asyncPoolTaskExecutor")
24
+    public ThreadPoolTaskExecutor getAsyncThreadPoolTaskExecutor() {
25
+        ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
26
+        taskExecutor.setCorePoolSize(20);
27
+        taskExecutor.setMaxPoolSize(200);
28
+        taskExecutor.setQueueCapacity(25);
29
+        taskExecutor.setKeepAliveSeconds(200);
30
+        //定义线程池名字
31
+        taskExecutor.setThreadNamePrefix("asyncPoolTaskExecutor。");
32
+        //该方法就是这里的关键,用来设置线程池关闭的时候等待所有任务都完成再继续销毁其他的Bean,这样这些异步任务的销毁就会先于Redis线程池的销毁。
33
+        // 同时,这里还设置了setAwaitTerminationSeconds(60),该方法用来设置线程池中任务的等待时间,如果超过这个时候还没有销毁就强制销毁,
34
+        // 以确保应用最后能够被关闭,而不是阻塞住。
35
+        taskExecutor.setWaitForTasksToCompleteOnShutdown(true);
36
+        taskExecutor.setAwaitTerminationSeconds(60);
37
+        // 线程池对拒绝任务(无线程可用)的处理策略,目前只支持AbortPolicy、CallerRunsPolicy;默认为后者
38
+        taskExecutor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
39
+        taskExecutor.initialize();
40
+        return taskExecutor;
41
+    }
42
+
43
+    /** 
44
+    * @Description: 配置调度任务线程池
45
+    * @Author: lgq 
46
+    * @Date: 2020-03-11 16:15:27
47
+    */ 
48
+    @Bean
49
+    public ThreadPoolTaskScheduler threadPoolTaskScheduler() {
50
+        ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler();
51
+        threadPoolTaskScheduler.setPoolSize(500);
52
+        threadPoolTaskScheduler.setThreadNamePrefix("taskExecutor-");
53
+        threadPoolTaskScheduler.setWaitForTasksToCompleteOnShutdown(true);
54
+        threadPoolTaskScheduler.setRemoveOnCancelPolicy(true);
55
+        threadPoolTaskScheduler.setWaitForTasksToCompleteOnShutdown(true);
56
+        threadPoolTaskScheduler.setAwaitTerminationSeconds(60);
57
+        threadPoolTaskScheduler.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
58
+        return threadPoolTaskScheduler;
59
+    }
60
+
61
+}

+ 2
- 3
smarking/src/main/java/com/xhkjedu/smarking/listener/MessageSender.java View File

@@ -39,16 +39,15 @@ public class MessageSender {
39 39
 
40 40
     /**
41 41
      * @Description 学生答案合并
42
-     * @Param [mpsqid, userAnswers, device]
42
+     * @Param [mpsqid, userAnswers]
43 43
      * @Return void
44 44
      * @Author wn
45 45
      * @Date 2022/7/28 16:46
46 46
      **/
47
-    public void imgMerge(Integer mpsqid, List<String> userAnswers, Integer device) {
47
+    public void imgMerge(Integer mpsqid, List<String> userAnswers) {
48 48
         Map map = new HashMap();
49 49
         map.put("mpsqid", mpsqid);
50 50
         map.put("stuanswers", userAnswers);
51
-        map.put("device", device);
52 51
         if (userAnswers.toString().contains(node2)) {
53 52
             rabbitTemplate.convertAndSend(markingImgMergeQueue2, JSON.toJSONString(map));
54 53
         } else {

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

@@ -47,4 +47,10 @@ public interface MsSubjectMapper extends TkMapper<MsSubject> {
47 47
 
48 48
     //试监控-考试基本信息
49 49
     Map<String,Object> getExamSubjectByMsid(@Param("msid") Integer msid);
50
+    //定时任务-科目开始考试
51
+    int updateStartSubject(@Param("strtime") String strtime);
52
+    //定时任务-科目结束考试-获取待结束考试
53
+    List<Integer> listMsidsForEndSubject(@Param("strtime") String strtime);
54
+    //定时任务-科目结束考试
55
+    int updateEndSubject(@Param("timestamp") Integer timestamp,@Param("msids")List<Integer> msids);
50 56
 }

+ 9
- 0
smarking/src/main/java/com/xhkjedu/smarking/mapper/stupaper/MsPaperStudentQuestionMapper.java View File

@@ -30,6 +30,10 @@ public interface MsPaperStudentQuestionMapper extends TkMapper<MsPaperStudentQue
30 30
     List<MsPaperStudentQuestion> listStuQuestionStuAnswerPic(@Param("mpsid") Integer mpsid);
31 31
     //学生考试-提交试卷-生产学生题块-试卷中所有试题
32 32
     List<MsPaperStudentQuestion> listStuQuestionsByMpsid(@Param("mpsid") Integer mpsid);
33
+    //学生考试-提交试卷-修改未提交试题为已批阅
34
+    int updateStuQuestionsNoCommit(@Param("mpsid") Integer mpsid,@Param("timestamp") Integer timestamp);
35
+    //学生考试-提交试卷-获取试卷中未批改试题数量
36
+    Integer getStuQuestionNoCheckedNum(@Param("mpsid") Integer mpsid);
33 37
 
34 38
     //试卷答案-客观题-批量更新学生提交指定试题是否需要重新批改
35 39
     Integer updateBatchStuQuesNeeddeal(@Param("mpid") Integer mpid,@Param("list")List<MsPaperQtypeQuestion> list);
@@ -55,4 +59,9 @@ public interface MsPaperStudentQuestionMapper extends TkMapper<MsPaperStudentQue
55 59
     List<Map<String,Object>> listStuPaperQtypeQueAnswerForWebTk(@Param("mpsid")Integer mpsid);
56 60
     //学生试卷-题型试题、作答、得分情况(附件)
57 61
     List<Map<String,Object>> listStuPaperQtypeQueAnswerForWebFj(@Param("mpsid")Integer mpsid);
62
+
63
+    //定时任务-获取学生答案待合并试题
64
+    List<MsPaperStudentQuestion> listNoMergeStupic();
65
+
66
+
58 67
 }

+ 43
- 0
smarking/src/main/java/com/xhkjedu/smarking/service/stupaper/MsPaperStudentQuestionService.java View File

@@ -0,0 +1,43 @@
1
+package com.xhkjedu.smarking.service.stupaper;
2
+
3
+import com.alibaba.fastjson.JSON;
4
+import com.xhkjedu.smarking.mapper.stupaper.MsPaperStudentQuestionMapper;
5
+import com.xhkjedu.smarking.model.stupaper.MsPaperStudentQuestion;
6
+import com.xhkjedu.smarking.utils.ConvertUtil;
7
+import com.xhkjedu.utils.N_Utils;
8
+import org.springframework.stereotype.Service;
9
+
10
+import javax.annotation.Resource;
11
+import java.util.List;
12
+
13
+/**
14
+ * @Description 阅卷试卷学生试题表 服务实现类
15
+ * @Author auto
16
+ * @Date 2024-10-15
17
+ */
18
+@Service
19
+public class MsPaperStudentQuestionService {
20
+    @Resource
21
+    private MsPaperStudentQuestionMapper msPaperStudentQuestionMapper;
22
+    @Resource
23
+    private ConvertUtil convertUtil;
24
+
25
+    /*
26
+     * @Description 定时任务-合并
27
+     * @Date 2024/11/15 14:18:36
28
+     * @Author WN
29
+     * @Param []
30
+     * @Return void
31
+     **/
32
+    public void paperStuQuestionAnswerMerge() {
33
+        //获取试卷中未合并图片
34
+        List<MsPaperStudentQuestion> list = msPaperStudentQuestionMapper.listNoMergeStupic();
35
+        if (N_Utils.isListEmpty(list)) return;
36
+            for (MsPaperStudentQuestion sq : list) {
37
+                List<String> stuanswer = JSON.parseArray(sq.getStuanswer(), String.class);
38
+                if (N_Utils.isListNotEmpty(stuanswer) && stuanswer.size() > 1) {
39
+                    convertUtil.imgMerge(sq.getMpsqid(), stuanswer);
40
+                }
41
+            }
42
+    }
43
+}

+ 12
- 2
smarking/src/main/java/com/xhkjedu/smarking/service/stupaper/MsPaperStudentService.java View File

@@ -196,7 +196,7 @@ public class MsPaperStudentService {
196 196
         // //获取试题正确答案
197 197
         List<QuestionAnswerVo> qaVos = msPaperStudentQuestionMapper.listPaperQuestionAnswers(pswvo.getMpsid());
198 198
         for (MsPaperStudentQuestion sq : questions) {
199
-            QuestionAnswerVo qaVo = qaVos.stream().filter(q -> q.getMpsqid() == sq.getMpsqid()).findFirst().orElse(null);
199
+            QuestionAnswerVo qaVo = qaVos.stream().filter(q -> q.getMpsqid().equals(sq.getMpsqid())).findFirst().orElse(null);
200 200
             setCommitQuestion(sq,qaVo);
201 201
         }
202 202
         msPaperStudentQuestionMapper.updateBatchStudentAnswer(questions);
@@ -281,8 +281,18 @@ public class MsPaperStudentService {
281 281
         if(paperStuExamVo.getMsstate() == 2) return new ResultVo(0, "考试已结束");
282 282
 
283 283
         int timestamp = N_Utils.getSecondTimestamp();
284
+
285
+        //更改未提交试题的批阅状态为已批改
286
+        msPaperStudentQuestionMapper.updateStuQuestionsNoCommit(mpsid,timestamp);
287
+        Integer nocheckedNum = msPaperStudentQuestionMapper.getStuQuestionNoCheckedNum(mpsid);
288
+        int checked = 0;
289
+        if (nocheckedNum == 0) {
290
+            checked = 2;//试卷中所有试题都批完后标识试卷已批改
291
+        }
292
+        ps.setChecked(checked);
284 293
         ps.setEndtime(timestamp);
285 294
         ps.setSstate(2);
295
+
286 296
         msPaperStudentMapper.updateStudentPaper(ps);
287 297
         chandleStudentQuestionNoconvertedPic(mpsid);
288 298
         return new ResultVo(1, "提交成功");
@@ -295,7 +305,7 @@ public class MsPaperStudentService {
295 305
             for (MsPaperStudentQuestion sq : psqlist) {
296 306
                 List<String> stuanswer = JSON.parseArray(sq.getStuanswer(), String.class);
297 307
                 if (N_Utils.isListNotEmpty(stuanswer) && stuanswer.size() > 1) {
298
-                    convertUtil.imgMerge(sq.getMpsqid(), stuanswer, 1);
308
+                    convertUtil.imgMerge(sq.getMpsqid(), stuanswer);
299 309
                 }
300 310
             }
301 311
         }

+ 76
- 0
smarking/src/main/java/com/xhkjedu/smarking/task/ExamSubjectTask.java View File

@@ -0,0 +1,76 @@
1
+package com.xhkjedu.smarking.task;
2
+
3
+import com.xhkjedu.smarking.mapper.exam.MsSubjectMapper;
4
+import com.xhkjedu.smarking.service.stupaper.MsPaperStudentQuestionService;
5
+import com.xhkjedu.utils.N_Utils;
6
+import lombok.extern.slf4j.Slf4j;
7
+import org.springframework.scheduling.annotation.Async;
8
+import org.springframework.scheduling.annotation.Scheduled;
9
+import org.springframework.stereotype.Component;
10
+
11
+import javax.annotation.Resource;
12
+import java.util.List;
13
+
14
+/**
15
+ * @Description:考试科目状态定时任务
16
+ * @Author: WN
17
+ * @Date: 2024/11/15 10:10:48
18
+ **/
19
+@Slf4j
20
+@Component
21
+public class ExamSubjectTask {
22
+
23
+    @Resource
24
+    private MsSubjectMapper msSubjectMapper;
25
+    @Resource
26
+    private MsPaperStudentQuestionService msPaperStudentQuestionService;
27
+
28
+    /*
29
+     * @Description 单科开始考试
30
+     * @Date 2024/11/15 10:59:27
31
+     * @Author WN
32
+     * @Return void
33
+     **/
34
+    @Async("threadPoolTaskScheduler")
35
+    @Scheduled(cron = "${cron.updateSubjectState}")
36
+    public void startSubject() {
37
+        int timestamp = N_Utils.getSecondTimestamp();
38
+        String strtime = N_Utils.getStrtimeTimestamp(timestamp, "yyyy-MM-dd HH:mm");
39
+        msSubjectMapper.updateStartSubject(strtime);
40
+    }
41
+
42
+    /*
43
+     * @Description 单科结束考试
44
+     * @Date 2024/11/15 10:59:27
45
+     * @Author WN
46
+     * @Return void
47
+     **/
48
+    @Async("threadPoolTaskScheduler")
49
+    @Scheduled(cron = "${cron.updateSubjectState}")
50
+    public void endSubject() {
51
+        int timestamp = N_Utils.getSecondTimestamp();
52
+        String strtime = N_Utils.getStrtimeTimestamp(timestamp, "yyyy-MM-dd HH:mm");
53
+        //获取待结束科目(延后5分钟)
54
+        List<Integer> msids = msSubjectMapper.listMsidsForEndSubject(strtime);
55
+        if(N_Utils.isListNotEmpty(msids)){
56
+            msSubjectMapper.updateEndSubject(timestamp, msids);
57
+        }
58
+    }
59
+
60
+    @Scheduled(cron = "${cron.questionCheckState}")
61
+    public void unLockQuestion() {
62
+        // int timestamp = N_Utils.getSecondTimestamp();
63
+
64
+    }
65
+
66
+    /*
67
+     * @Description 合并学生作答多图
68
+     * @Date 2024/11/15 14:21:05
69
+     * @Author WN
70
+     * @Return void
71
+     **/
72
+    @Scheduled(cron = "${cron.mergeStupic}")
73
+    public void paperStuQuestionAnswerMerge() {
74
+        msPaperStudentQuestionService.paperStuQuestionAnswerMerge();
75
+    }
76
+}

+ 49
- 0
smarking/src/main/java/com/xhkjedu/smarking/task/UriMapTask.java View File

@@ -0,0 +1,49 @@
1
+package com.xhkjedu.smarking.task;
2
+
3
+import com.xhkjedu.smarking.utils.MarkingUtil;
4
+import org.springframework.scheduling.annotation.Scheduled;
5
+import org.springframework.stereotype.Component;
6
+
7
+import java.util.concurrent.ConcurrentHashMap;
8
+
9
+/**
10
+ * @author ywx
11
+ * @classname ReadTask
12
+ * @description 阅读定时任务
13
+ * CronTrigger配置完整格式为: [秒] [分] [小时] [日] [月] [周] [年]
14
+ * 说明    必填    值                  允许的通配符
15
+ * 秒        是    0-59                , - * /
16
+ * 分        是    0-59                , - * /
17
+ * 时        是    0-23                , - * /
18
+ * 日        是    1-31                , - * ? / L W
19
+ * 月        是    1-12或JAN-DEC       , - * /
20
+ * 周        是    1-7或SUN-SAT        , - * ? / L W
21
+ * 年        否    empty 或1970-2099   , - * /
22
+ * , 表示指定多个值,例如在周字段上设置 "MON,WED,FRI" 表示周一,周三和周五触发
23
+ * - 表示区间。例如 在小时上设置 "10-12",表示 10,11,12点都会触发。
24
+ * * 表示所有值. 例如:在分的字段上设置 "*",表示每一分钟都会触发
25
+ * ? 表示不指定值。使用的场景为不需要关心当前设置这个字段的值。每月的10号触发一个操作,但不关心是周几,具体设置为 0 0 0 10 * ?
26
+ * / 用于递增触发。如在秒上面设置"5/15" 表示从5秒开始,每增15秒触发(5,20,35,50)
27
+ * L 表示最后的意思。在日字段设置上,表示当月的最后一天(依据当前月份,如果是二月还会依据是否是润年[leap]),
28
+ * 在周字段上表示星期六,相当于"7"或"SAT(不区分大小写)"。
29
+ * 如果在"L"前加上数字,则表示该数据的最后一个。例如在周字段上设置"6L"这样的格式,则表示“本月最后一个星期五"
30
+ * W 表示离指定日期的最近那个工作日(周一至周五). 例如在日字段上设置"15W",表示离每月15号最近的那个工作日触发。
31
+ * 如果15号正好是周六,则找最近的周五(14号)触发, 如果15号是周未,则找最近的下周一(16号)触发.
32
+ * 如果15号正好在工作日(周一至周五),则就在该天触发。(注,"W"前只能设置具体的数字,不允许区间"-").
33
+ * @date 2020/9/1 9:36
34
+ **/
35
+@Component
36
+public class UriMapTask {
37
+
38
+    /**
39
+     * 每隔3s清除一下请求地址map
40
+     * @Param []
41
+     * @Author ywx
42
+     * @Date 2020/11/9 12:30
43
+     * @return void
44
+     **/
45
+    @Scheduled(cron = "${cron.deleteUriMap}")
46
+    public void deleteUriMap() {
47
+        MarkingUtil.uriMap = new ConcurrentHashMap<>();
48
+    }
49
+}

+ 3
- 3
smarking/src/main/java/com/xhkjedu/smarking/utils/ConvertUtil.java View File

@@ -21,13 +21,13 @@ public class ConvertUtil {
21 21
     /**
22 22
      * 学生答案图片合并mq
23 23
      *
24
-     * @param [mpsqid, userAnswers, device(1线上线下2答题卡)]
24
+     * @param [mpsqid, userAnswers,]
25 25
      * @return void
26 26
      * @author ywx
27 27
      * @date 2022/5/9 14:57
28 28
      */
29
-    public void imgMerge(Integer mpsqid, List<String> userAnswers, Integer device) {
30
-        messageSender.imgMerge(mpsqid, userAnswers, device);
29
+    public void imgMerge(Integer mpsqid, List<String> userAnswers) {
30
+        messageSender.imgMerge(mpsqid, userAnswers);
31 31
     }
32 32
 
33 33
     /** 考试附件试卷图片转pdf

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

@@ -80,4 +80,34 @@
80 80
         where ms.msid=#{msid}
81 81
     </select>
82 82
 
83
+    <!--定时任务-科目开始考试-->
84
+    <update id="updateStartSubject">
85
+        update ms_exam e left join ms_subject ms on e.examid = ms.examid
86
+        set ms.msstate=1
87
+        where e.examstate>=1 and e.deleted=1 and e.exammode=3
88
+        and ms.msstate=0 and concat(ms.sdate,' ',ms.begintime)&lt;=#{strtime}
89
+    </update>
90
+    <!--定时任务-科目结束考试-获取待结束考试-->
91
+    <select id="listMsidsForEndSubject">
92
+        select ms.msid from ms_subject ms left join ms_exam e on ms.examid=e.examid
93
+        where e.examstate>=1 and e.deleted=1 and e.exammode=3 and ms.msstate=1
94
+        and adddate(concat(ms.sdate,' ',ms.endtime),interval 5 minute) &lt;#{strtime}
95
+    </select>
96
+    <!--定时任务-科目结束考试-->
97
+    <update id="updateEndSubject">
98
+        update ms_subject ms
99
+        left join ms_paper_student mps on ms.msid=mps.msid and mps.sstate in(0,1)
100
+        set ms.msstate=2,mps.sstate=(case when mps.sstate=0 then 3 else 2 end)
101
+        ,mps.endtime=(case when mps.sstate=1 then #{timestamp} else mps.endtime end)
102
+        ,mps.stuscoretype=(case when mps.sstate=1 then 1 else 0 end)
103
+        ,mps.stuscore=(case when mps.sstate=1 then
104
+        (SELECT SUM(IFNULL(q.stuscore,0)) FROM ms_paper_student_question q WHERE q.mpsid=mps.mpsid)
105
+        else 0 end)
106
+        ,mps.costtime=(case where mps.sstate=1 then
107
+        (SELECT SUM(IFNULL(q.costtime,0)) FROM ms_paper_student_question q WHERE q.mpsid=mps.mpsid)
108
+        else 0 end)
109
+        where ms.msstate=1 and ms.msid in
110
+        <foreach collection="msids" item="msid" separator="," open="(" close=")">#{msid}</foreach>
111
+    </update>
112
+
83 113
 </mapper>

+ 5
- 4
smarking/src/main/resources/mapper/stupaper/MsPaperStudentMapper.xml View File

@@ -204,7 +204,8 @@
204 204
     </select>
205 205
     <!--学生考试-提交试卷-->
206 206
     <update id="updateStudentPaper">
207
-        update ms_paper_student set endtime=#{ps.endtime},sstate=#{ps.sstate}
207
+        update ms_paper_student set endtime=#{ps.endtime},sstate=#{ps.sstate},stuscoretype=1
208
+        ,stuscore=(SELECT SUM(IFNULL(q.stuscore,0)) FROM ms_paper_student_question q WHERE q.mpsid=#{ps.mpsid})
208 209
         <if test="ps.costtime==null and ps.costtime==0">
209 210
             ,costtime=(SELECT SUM(IFNULL(q.costtime,0)) FROM ms_paper_student_question q WHERE q.mpsid=#{ps.mpsid})
210 211
         </if>
@@ -235,7 +236,7 @@
235 236
 
236 237
     <!--扫描异常-清空学生扫描试卷信息-->
237 238
     <update id="updateStuPaperForScanErrorClear">
238
-        update ms_paper_student set sstate=0,checked=0,stuscore=0.0,hasbad=0,batchid=null,mspid=null,
239
+        update ms_paper_student set sstate=0,checked=0,stuscore=0.0,stuscoretype=0,hasbad=0,batchid=null,mspid=null,
239 240
                                     paperfront=null,paperback=null,pagenum=0 where mpsid=#{mpsid}
240 241
     </update>
241 242
     <!--扫描异常-缺考异常-更改状态-->
@@ -252,12 +253,12 @@
252 253
 
253 254
     <!--补录成绩-补录单科-->
254 255
     <update id="updateStuScoreForFillScore">
255
-        update ms_paper_student set stuscore=#{psc.fillscore},stuscoretype=2 where mpsid=#{psc.mpsid}
256
+        update ms_paper_student set stuscore=#{psc.fillscore},stuscoretype=2 where mpsid=#{psc.mpsid} and stuscoretype=0
256 257
     </update>
257 258
     <!--补录成绩-补录多科-->
258 259
     <update id="updateBatchStuScoreForFillScore">
259 260
         <foreach collection="list" item="p" separator=";">
260
-            update ms_paper_student set stuscore=#{p.fillscore},stuscoretype=2 where mpsid=#{p.mpsid}
261
+            update ms_paper_student set stuscore=#{p.fillscore},stuscoretype=2 where mpsid=#{p.mpsid} and stuscoretype=0
261 262
         </foreach>
262 263
     </update>
263 264
     <!--补录成绩-清空学生补录分数-->

+ 16
- 1
smarking/src/main/resources/mapper/stupaper/MsPaperStudentQuestionMapper.xml View File

@@ -64,10 +64,19 @@
64 64
         where mpsid=#{mpsid} and answertype=2 and answered=1 and converted=1 order by qorder
65 65
     </select>
66 66
 
67
-    <!--学生考试-提交试卷-生学生题块-试卷中所有试题-->
67
+    <!--学生考试-提交试卷-生学生题块-试卷中所有试题-->
68 68
     <select id="listStuQuestionsByMpsid" resultType="com.xhkjedu.smarking.model.stupaper.MsPaperStudentQuestion">
69 69
         select * from ms_paper_student_question where mpsid=#{mpsid} order by qorder
70 70
     </select>
71
+    <!--学生考试-提交试卷-修改未提交试题为已批阅-->
72
+    <update id="updateStuQuestionsNoCommit">
73
+        UPDATE ms_paper_student_question SET costtime=0,checked=2,stuscore=0,firstccore=0,firstcime=#{timestamp}
74
+        WHERE mpsid=#{mpsid} AND answered=0
75
+    </update>
76
+    <!--学生考试-提交试卷-获取试卷中未批改试题数量-->
77
+    <select id="getStuQuestionNoCheckedNum" resultType="java.lang.Integer">
78
+        SELECT count(*) FROM ms_paper_student_question WHERE mpsid=#{mpsid} AND checked!=2
79
+    </select>
71 80
 
72 81
     <!--试卷答案-客观题-批量更新学生提交指定试题是否需要重新批改-->
73 82
     <update id="updateBatchStuQuesNeeddeal">
@@ -302,4 +311,10 @@
302 311
         left join ms_paper_qtype pt on pq.mptid=pt.mptid
303 312
         where psq.mpsid=#{mpsid} order by pt.mptorder, psq.qorder
304 313
     </select>
314
+
315
+    <!--定时任务-获取学生答案待合并试题-->
316
+    <select id="listNoMergeStupic" resultType="com.xhkjedu.smarking.model.stupaper.MsPaperStudentQuestion">
317
+        select mpsqid,stuanswer,examid from ms_paper_student_question
318
+        where answered=1 and answertype=2 and converted=1 order by mpsqid
319
+    </select>
305 320
 </mapper>

Loading…
Cancel
Save