Просмотр исходного кода

改分、扫描 统分判断,学生作答及得分

ywx
王宁 1 месяц назад
Родитель
Сommit
e5203fe0f5
20 измененных файлов: 260 добавлений и 24 удалений
  1. 1
    2
      smarking/src/main/java/com/xhkjedu/smarking/controller/scan/MsScanbatchController.java
  2. 11
    2
      smarking/src/main/java/com/xhkjedu/smarking/controller/scan/MsScanbatchPaperController.java
  3. 14
    0
      smarking/src/main/java/com/xhkjedu/smarking/controller/stupaper/MsPaperStudentController.java
  4. 10
    2
      smarking/src/main/java/com/xhkjedu/smarking/controller/stupaper/MsPaperStudentQuestionScoreController.java
  5. 23
    6
      smarking/src/main/java/com/xhkjedu/smarking/controller/stupaper/MsPaperStudentScoreController.java
  6. 2
    0
      smarking/src/main/java/com/xhkjedu/smarking/mapper/exam/MsExamMapper.java
  7. 3
    0
      smarking/src/main/java/com/xhkjedu/smarking/mapper/paper/MsPaperMapper.java
  8. 6
    0
      smarking/src/main/java/com/xhkjedu/smarking/mapper/scan/MsScanbatchMapper.java
  9. 1
    0
      smarking/src/main/java/com/xhkjedu/smarking/mapper/stupaper/MsPaperStudentMapper.java
  10. 6
    0
      smarking/src/main/java/com/xhkjedu/smarking/mapper/stupaper/MsPaperStudentQuestionMapper.java
  11. 7
    1
      smarking/src/main/java/com/xhkjedu/smarking/service/scan/MsScanbatchPaperService.java
  12. 11
    3
      smarking/src/main/java/com/xhkjedu/smarking/service/scan/MsScanbatchService.java
  13. 11
    1
      smarking/src/main/java/com/xhkjedu/smarking/service/stupaper/MsPaperStudentQuestionScoreService.java
  14. 26
    5
      smarking/src/main/java/com/xhkjedu/smarking/service/stupaper/MsPaperStudentScoreService.java
  15. 22
    0
      smarking/src/main/java/com/xhkjedu/smarking/service/stupaper/MsPaperStudentService.java
  16. 5
    0
      smarking/src/main/resources/mapper/exam/MsExamMapper.xml
  17. 5
    0
      smarking/src/main/resources/mapper/paper/MsPaperMapper.xml
  18. 11
    0
      smarking/src/main/resources/mapper/scan/MsScanbatchMapper.xml
  19. 0
    2
      smarking/src/main/resources/mapper/stupaper/MsPaperStudentMapper.xml
  20. 85
    0
      smarking/src/main/resources/mapper/stupaper/MsPaperStudentQuestionMapper.xml

+ 1
- 2
smarking/src/main/java/com/xhkjedu/smarking/controller/scan/MsScanbatchController.java Просмотреть файл

@@ -43,8 +43,7 @@ public class MsScanbatchController {
43 43
     @PostMapping("/save")
44 44
     public ResultVo save(@RequestBody MsScanbatch msScanbatch) {
45 45
         N_Utils.validation(new Object[]{msScanbatch.getMpid(), "试卷id", 1});
46
-        Map<String,Object> map = msScanbatchService.save(msScanbatch);
47
-        return new ResultVo(0, "保存成功", map);
46
+        return msScanbatchService.save(msScanbatch);
48 47
     }
49 48
 
50 49
     /*

+ 11
- 2
smarking/src/main/java/com/xhkjedu/smarking/controller/scan/MsScanbatchPaperController.java Просмотреть файл

@@ -70,8 +70,17 @@ public class MsScanbatchPaperController {
70 70
     @PostMapping("/save")
71 71
     public ResultVo saveScanPaper(@RequestBody MsScanbatchPaper msScanbatchPaper) {
72 72
         N_Utils.validation(new Object[]{msScanbatchPaper.getBatchid(), "扫描批次id", 1,msScanbatchPaper.getMpid(), "试卷id", 1});
73
-        msScanbatchPaperService.savePaperIdentify(msScanbatchPaper);
74
-        return new ResultVo(0, "保存成功");
73
+        try{
74
+            msScanbatchPaperService.savePaperIdentify(msScanbatchPaper);
75
+            return new ResultVo(0, "保存成功");
76
+        }catch (Exception e){
77
+            String message = e.getMessage();
78
+            if(!message.contains("禁止扫描")){
79
+                message = "保存失败";
80
+                log.error("保存扫描试卷失败", e.getMessage());
81
+            }
82
+            return new ResultVo(1, message);
83
+        }
75 84
     }
76 85
 
77 86
     /*

+ 14
- 0
smarking/src/main/java/com/xhkjedu/smarking/controller/stupaper/MsPaperStudentController.java Просмотреть файл

@@ -173,4 +173,18 @@ public class MsPaperStudentController {
173 173
         return msPaperStudentService.saveCommitPaper(paperStudent);
174 174
     }
175 175
 
176
+    /*
177
+     * @Description 学生试卷-题型试题、作答、得分情况 (修改分数)
178
+     * @Date 2024/11/14 14:39:57
179
+     * @Author WN
180
+     * @Param [paperStudent]
181
+     * @Return com.xhkjedu.vo.ResultVo
182
+     **/
183
+    @PostMapping("/stu_paper")
184
+    public ResultVo listStuPaperQtypeQueAnswerForWeb(@RequestBody MsPaperStudent paperStudent) {
185
+        N_Utils.validation(new Object[]{paperStudent.getMpsid(), "学生试卷id", 1});
186
+        List<Map<String,Object>> rtnlst = msPaperStudentService.listStuPaperQtypeQueAnswerForWeb(paperStudent.getMpsid());
187
+        return new ResultVo(0, "查询成功", rtnlst);
188
+    }
189
+
176 190
 }

+ 10
- 2
smarking/src/main/java/com/xhkjedu/smarking/controller/stupaper/MsPaperStudentQuestionScoreController.java Просмотреть файл

@@ -42,8 +42,16 @@ public class MsPaperStudentQuestionScoreController {
42 42
         if(N_Utils.isListEmpty(stuscore.getQuescores())){
43 43
             return new ResultVo(1, "试题不能为空");
44 44
         }
45
-        msPaperStudentQuestionScoreService.add(stuscore);
46
-        return new ResultVo(0, "保存成功");
45
+        try {
46
+            msPaperStudentQuestionScoreService.add(stuscore);
47
+            return new ResultVo(0, "保存成功");
48
+        }catch (Exception e){
49
+            String message = e.getMessage();
50
+            if(!message.contains("无法修改分数")){
51
+                message = "保存失败";
52
+            }
53
+            return new ResultVo(1, message);
54
+        }
47 55
     }
48 56
 
49 57
     /*

+ 23
- 6
smarking/src/main/java/com/xhkjedu/smarking/controller/stupaper/MsPaperStudentScoreController.java Просмотреть файл

@@ -58,8 +58,17 @@ public class MsPaperStudentScoreController {
58 58
     @PostMapping("/save")
59 59
     public ResultVo save(@RequestBody MsPaperStudentScore msPaperStudentScore) {
60 60
         N_Utils.validation(new Object[]{msPaperStudentScore.getMpsid(), "学生试卷id", 1,msPaperStudentScore.getFillscore(),"补录分数",1});
61
-        msPaperStudentScoreService.saveStudentScore(msPaperStudentScore);
62
-        return new ResultVo(0, "保存成功");
61
+        try {
62
+            msPaperStudentScoreService.saveStudentScore(msPaperStudentScore);
63
+            return new ResultVo(0, "保存成功");
64
+        }catch (Exception e){
65
+            String message = e.getMessage();
66
+            if(!message.contains("无法补录成绩")){
67
+                message = "保存失败";
68
+                log.error("补录单科成绩失败", e.getMessage());
69
+            }
70
+            return new ResultVo(1, message);
71
+        }
63 72
     }
64 73
 
65 74
     /*
@@ -75,8 +84,17 @@ public class MsPaperStudentScoreController {
75 84
         if(N_Utils.isListEmpty(stuScoreVo.getStuscores())){
76 85
             return new ResultVo(1, "补录科目不能为空");
77 86
         }
78
-        msPaperStudentScoreService.saveBatchStudentScores(stuScoreVo);
79
-        return new ResultVo(0, "保存成功");
87
+        try {
88
+            msPaperStudentScoreService.saveBatchStudentScores(stuScoreVo);
89
+            return new ResultVo(0, "保存成功");
90
+        }catch (Exception e){
91
+            String message = e.getMessage();
92
+            if(!message.contains("无法补录成绩")){
93
+                message = "保存失败";
94
+                log.error("补录多科成绩失败", e.getMessage());
95
+            }
96
+            return new ResultVo(1, message);
97
+        }
80 98
     }
81 99
 
82 100
     /*
@@ -157,8 +175,7 @@ public class MsPaperStudentScoreController {
157 175
         N_Utils.validation(new Object[]{stuScoreVo.getExamid(), "考试id", 1});
158 176
 
159 177
         try {
160
-            msPaperStudentScoreService.saveBatch(stuScoreVo, file);
161
-            return new ResultVo(0, "保存成功");
178
+            return msPaperStudentScoreService.saveBatch(stuScoreVo, file);
162 179
         }catch (Exception e){
163 180
             log.error("补录成绩导入失败", e.getMessage());
164 181
             return new ResultVo(1, "保存失败");

+ 2
- 0
smarking/src/main/java/com/xhkjedu/smarking/mapper/exam/MsExamMapper.java Просмотреть файл

@@ -25,4 +25,6 @@ public interface MsExamMapper extends TkMapper<MsExam> {
25 25
 
26 26
     //考试基本信息
27 27
     Map findById(@Param("examid") Integer examid);
28
+    //考试状态
29
+    Integer getExamstate(@Param("examid") Integer examid);
28 30
 }

+ 3
- 0
smarking/src/main/java/com/xhkjedu/smarking/mapper/paper/MsPaperMapper.java Просмотреть файл

@@ -64,4 +64,7 @@ public interface MsPaperMapper extends TkMapper<MsPaper> {
64 64
 
65 65
     //获取试卷批阅设置
66 66
     Integer getCorrectTypeByMpId(@Param("mpid") Integer mpid);
67
+
68
+    //获取试卷类型
69
+    Integer getPaperTypeByMpsid(@Param("mpsid") Integer mpsid);
67 70
 }

+ 6
- 0
smarking/src/main/java/com/xhkjedu/smarking/mapper/scan/MsScanbatchMapper.java Просмотреть файл

@@ -1,6 +1,7 @@
1 1
 package com.xhkjedu.smarking.mapper.scan;
2 2
 
3 3
 import com.xhkjedu.base.TkMapper;
4
+import com.xhkjedu.smarking.model.exam.MsExam;
4 5
 import com.xhkjedu.smarking.model.scan.MsScanbatch;
5 6
 import com.xhkjedu.smarking.vo.scan.ScanParams;
6 7
 import org.apache.ibatis.annotations.Param;
@@ -41,4 +42,9 @@ public interface MsScanbatchMapper extends TkMapper<MsScanbatch> {
41 42
 
42 43
     //修改识别数量
43 44
     int updateIdentifynum(@Param("batchid")Integer batchid);
45
+
46
+    //根据试卷ID获取考试状态和ID
47
+    MsExam getExamStateAndId(@Param("mpid")Integer mpid);
48
+    //根据批次ID获取考试状态
49
+    Integer getExamStateByBatchid(@Param("batchid")Integer batchid);
44 50
 }

+ 1
- 0
smarking/src/main/java/com/xhkjedu/smarking/mapper/stupaper/MsPaperStudentMapper.java Просмотреть файл

@@ -80,4 +80,5 @@ public interface MsPaperStudentMapper extends TkMapper<MsPaperStudent> {
80 80
     int updateBatchStuScoreForFillScore(@Param("list") List<MsPaperStudentScore> list);
81 81
     //补录成绩-清空学生补录分数
82 82
     int updateStuScoreForRestoreFillScore(@Param("examid") Integer examid,@Param("studentid") Integer studentid);
83
+
83 84
 }

+ 6
- 0
smarking/src/main/java/com/xhkjedu/smarking/mapper/stupaper/MsPaperStudentQuestionMapper.java Просмотреть файл

@@ -9,6 +9,7 @@ import com.xhkjedu.smarking.vo.stupaper.QuestionAnswerVo;
9 9
 import org.apache.ibatis.annotations.Param;
10 10
 
11 11
 import java.util.List;
12
+import java.util.Map;
12 13
 
13 14
 /**
14 15
  * @Description 阅卷试卷学生试题表 Mapper 接口
@@ -49,4 +50,9 @@ public interface MsPaperStudentQuestionMapper extends TkMapper<MsPaperStudentQue
49 50
 
50 51
     //修改分数-批量修改分值
51 52
     int updateBatchStuscore(@Param("list") List<MsPaperStudentQuestionScore> list);
53
+
54
+    //学生试卷-题型试题、作答、得分情况(题库)
55
+    List<Map<String,Object>> listStuPaperQtypeQueAnswerForWebTk(@Param("mpsid")Integer mpsid);
56
+    //学生试卷-题型试题、作答、得分情况(附件)
57
+    List<Map<String,Object>> listStuPaperQtypeQueAnswerForWebFj(@Param("mpsid")Integer mpsid);
52 58
 }

+ 7
- 1
smarking/src/main/java/com/xhkjedu/smarking/service/scan/MsScanbatchPaperService.java Просмотреть файл

@@ -100,7 +100,13 @@ public class MsScanbatchPaperService {
100 100
      * @Date 2024-10-15
101 101
      **/
102 102
     @Transactional(rollbackFor = Exception.class)
103
-    public void savePaperIdentify(MsScanbatchPaper msScanbatchPaper){
103
+    public void savePaperIdentify(MsScanbatchPaper msScanbatchPaper) throws Exception {
104
+
105
+        Integer examstate  = msScanbatchMapper.getExamStateByBatchid(msScanbatchPaper.getBatchid());
106
+        if(examstate == 3){
107
+            throw new Exception("考试已统分,禁止扫描");
108
+        }
109
+
104 110
         //保存一次,扫描次数加1
105 111
         msScanbatchMapper.updateScannum(msScanbatchPaper.getBatchid());
106 112
 

+ 11
- 3
smarking/src/main/java/com/xhkjedu/smarking/service/scan/MsScanbatchService.java Просмотреть файл

@@ -4,10 +4,12 @@ import com.xhkjedu.smarking.mapper.exam.MsClassMapper;
4 4
 import com.xhkjedu.smarking.mapper.paper.MsPaperMapper;
5 5
 import com.xhkjedu.smarking.mapper.scan.MsScanbatchMapper;
6 6
 import com.xhkjedu.smarking.mapper.scan.MsScanbatchPaperMapper;
7
+import com.xhkjedu.smarking.model.exam.MsExam;
7 8
 import com.xhkjedu.smarking.model.scan.MsScanbatch;
8 9
 import com.xhkjedu.smarking.model.scan.MsScanbatchPaper;
9 10
 import com.xhkjedu.smarking.vo.scan.ScanParams;
10 11
 import com.xhkjedu.utils.N_Utils;
12
+import com.xhkjedu.vo.ResultVo;
11 13
 import org.springframework.stereotype.Service;
12 14
 
13 15
 import javax.annotation.Resource;
@@ -38,7 +40,13 @@ public class MsScanbatchService {
38 40
      * @Date 2024-10-15
39 41
      * @return void
40 42
      **/
41
-    public Map<String,Object> save(MsScanbatch msScanbatch){
43
+    public ResultVo save(MsScanbatch msScanbatch){
44
+        MsExam exam = msScanbatchMapper.getExamStateAndId(msScanbatch.getMpid());
45
+        if(exam.getExamstate()==3){
46
+            return new ResultVo(1,"考试已统分,禁止扫描");
47
+        }
48
+
49
+
42 50
         String batchname = msScanbatch.getDevice() + "-" + msScanbatch.getMpid() + "-";
43 51
         Integer batchnum = msScanbatchMapper.getBatchNumByBatchname(batchname);
44 52
         if(!N_Utils.isTrueInteger(batchnum)){
@@ -47,7 +55,7 @@ public class MsScanbatchService {
47 55
             batchnum ++;
48 56
         }
49 57
         batchname += batchnum;
50
-        Integer examid = msPaperMapper.getExamidByMpid(msScanbatch.getMpid());
58
+        Integer examid = exam.getExamid();
51 59
         msScanbatch.setBatchname(batchname);
52 60
         msScanbatch.setExamid(examid);
53 61
         msScanbatch.setCreatetime(N_Utils.getSecondTimestamp());
@@ -59,7 +67,7 @@ public class MsScanbatchService {
59 67
         Map<String,Object> map = new HashMap<>();
60 68
         map.put("batchname",batchname);
61 69
         map.put("batchid",msScanbatch.getId());
62
-        return map;
70
+        return new ResultVo(0,"保存成功",map);
63 71
     }
64 72
 
65 73
     /*

+ 11
- 1
smarking/src/main/java/com/xhkjedu/smarking/service/stupaper/MsPaperStudentQuestionScoreService.java Просмотреть файл

@@ -1,5 +1,6 @@
1 1
 package com.xhkjedu.smarking.service.stupaper;
2 2
 
3
+import com.xhkjedu.smarking.mapper.exam.MsExamMapper;
3 4
 import com.xhkjedu.smarking.mapper.stupaper.MsPaperStudentMapper;
4 5
 import com.xhkjedu.smarking.mapper.stupaper.MsPaperStudentQuestionMapper;
5 6
 import com.xhkjedu.smarking.mapper.stupaper.MsPaperStudentQuestionScoreMapper;
@@ -29,6 +30,8 @@ public class MsPaperStudentQuestionScoreService {
29 30
     private MsPaperStudentQuestionMapper msPaperStudentQuestionMapper;
30 31
     @Resource
31 32
     private MsPaperStudentMapper msPaperStudentMapper;
33
+    @Resource
34
+    private MsExamMapper msExamMapper;
32 35
 
33 36
     /**
34 37
      * @Description 新增
@@ -38,7 +41,14 @@ public class MsPaperStudentQuestionScoreService {
38 41
      * @return void
39 42
      **/
40 43
     @Transactional(rollbackFor = Exception.class)
41
-    public void add(PaperStuScoreVo paperStuScoreVo){
44
+    public void add(PaperStuScoreVo paperStuScoreVo) throws Exception {
45
+
46
+        //获取考试状态
47
+        Integer examStatus = msExamMapper.getExamstate(paperStuScoreVo.getExamid());
48
+        if(examStatus==3){
49
+            throw new Exception("考试已统分,无法修改分数");
50
+        }
51
+
42 52
         //获取试卷中所有试题
43 53
         List<MsPaperStudentQuestion> stuQuestions = msPaperStudentQuestionScoreMapper.listStudentQuestions(paperStuScoreVo.getMpsid());
44 54
         List<MsPaperStudentQuestionScore> stuscores = paperStuScoreVo.getQuescores();

+ 26
- 5
smarking/src/main/java/com/xhkjedu/smarking/service/stupaper/MsPaperStudentScoreService.java Просмотреть файл

@@ -1,5 +1,6 @@
1 1
 package com.xhkjedu.smarking.service.stupaper;
2 2
 
3
+import com.xhkjedu.smarking.mapper.exam.MsExamMapper;
3 4
 import com.xhkjedu.smarking.mapper.stupaper.MsPaperStudentMapper;
4 5
 import com.xhkjedu.smarking.mapper.stupaper.MsPaperStudentScoreMapper;
5 6
 import com.xhkjedu.smarking.model.exam.MsClass;
@@ -10,6 +11,7 @@ import com.xhkjedu.smarking.utils.ImportUtil;
10 11
 import com.xhkjedu.smarking.vo.exam.ESubjectVo;
11 12
 import com.xhkjedu.smarking.vo.stupaper.PaperStuScoreVo;
12 13
 import com.xhkjedu.utils.N_Utils;
14
+import com.xhkjedu.vo.ResultVo;
13 15
 import org.springframework.stereotype.Service;
14 16
 import org.springframework.transaction.annotation.Transactional;
15 17
 import org.springframework.web.multipart.MultipartFile;
@@ -31,6 +33,8 @@ public class MsPaperStudentScoreService {
31 33
     private MsPaperStudentScoreMapper msPaperStudentScoreMapper;
32 34
     @Resource
33 35
     private MsPaperStudentMapper msPaperStudentMapper;
36
+    @Resource
37
+    private MsExamMapper msExamMapper;
34 38
 
35 39
     /*
36 40
      * @Description 补录成绩-列表
@@ -51,8 +55,14 @@ public class MsPaperStudentScoreService {
51 55
      * @Return void
52 56
      **/
53 57
     @Transactional(rollbackFor = Exception.class)
54
-    public void saveStudentScore(MsPaperStudentScore msPaperStudentScore){
58
+    public void saveStudentScore(MsPaperStudentScore msPaperStudentScore) throws Exception{
55 59
         MsPaperStudent paperStudent = msPaperStudentMapper.selectByPrimaryKey(msPaperStudentScore.getMpsid());
60
+        //获取考试状态
61
+        Integer examStatus = msExamMapper.getExamstate(paperStudent.getExamid());
62
+        if(examStatus==3){
63
+            throw new Exception("考试已统分,无法补录成绩");
64
+        }
65
+
56 66
         msPaperStudentScore.setMpid(paperStudent.getMpid());
57 67
         msPaperStudentScore.setExamid(paperStudent.getExamid());
58 68
         msPaperStudentScore.setSubjectid(paperStudent.getSubjectid());
@@ -71,7 +81,13 @@ public class MsPaperStudentScoreService {
71 81
      * @Return void
72 82
      **/
73 83
     @Transactional(rollbackFor = Exception.class)
74
-    public void saveBatchStudentScores(PaperStuScoreVo stuscore){
84
+    public void saveBatchStudentScores(PaperStuScoreVo stuscore) throws Exception{
85
+        //获取考试状态
86
+        Integer examStatus = msExamMapper.getExamstate(stuscore.getExamid());
87
+        if(examStatus==3){
88
+            throw new Exception("考试已统分,无法补录成绩");
89
+        }
90
+
75 91
         //获取考试对应学生所有科目信息
76 92
         List<MsPaperStudent> paperStudents = msPaperStudentMapper.listPaperStudentForFillScore(stuscore.getExamid(), stuscore.getStudentid());
77 93
 
@@ -149,9 +165,13 @@ public class MsPaperStudentScoreService {
149 165
     }
150 166
 
151 167
     @Transactional(rollbackFor = Exception.class)
152
-    public void saveBatch(MsPaperStudentScore mpstuScore, MultipartFile file) throws Exception{
153
-        //表格中学生在考生管理找不到时:统一成:学生不存在或没有参加本次考试
168
+    public ResultVo saveBatch(MsPaperStudentScore mpstuScore, MultipartFile file) throws Exception{
154 169
 
170
+        //获取考试状态
171
+        Integer examStatus = msExamMapper.getExamstate(mpstuScore.getExamid());
172
+        if(examStatus==3){
173
+            return new ResultVo(1, "考试已统分,无法补录成绩");
174
+        }
155 175
         //获取考试的所有科目
156 176
         List<ESubjectVo> subjects = msPaperStudentScoreMapper.listSubjectsByExamid(mpstuScore.getExamid());
157 177
         Map<String,ESubjectVo> subjectMap = subjects.stream().collect(HashMap::new, (m,v)->m.put(v.getSubjectid(),v), HashMap::putAll);
@@ -161,11 +181,12 @@ public class MsPaperStudentScoreService {
161 181
         //获取考试的所有学生
162 182
         List<PaperStuScoreVo> allStudents = msPaperStudentScoreMapper.listStudentScoreByExamid(mpstuScore.getExamid());
163 183
         Map<String,PaperStuScoreVo> stuMap = allStudents.stream().collect(HashMap::new, (m,v)->m.put(v.getExamno(),v), HashMap::putAll);
164
-
184
+        //表格中学生在考生管理找不到时:统一成:学生不存在或没有参加本次考试
165 185
         List<MsPaperStudentScore> saveScore = ImportUtil.readExcelStudentScore(file, subjectMap, stuMap,classNames, mpstuScore.getCreateid());
166 186
         if(!saveScore.isEmpty()){
167 187
             msPaperStudentScoreMapper.insertList(saveScore);//保存补录历史
168 188
             msPaperStudentMapper.updateBatchStuScoreForFillScore(saveScore);//修改学生得分
169 189
         }
190
+        return new ResultVo(0, "保存成功");
170 191
     }
171 192
 }

+ 22
- 0
smarking/src/main/java/com/xhkjedu/smarking/service/stupaper/MsPaperStudentService.java Просмотреть файл

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
4 4
 import com.xhkjedu.exception.MissingParametersException;
5 5
 import com.xhkjedu.smarking.config.ConfigKey;
6 6
 import com.xhkjedu.smarking.mapper.paper.MsPaperFileMapper;
7
+import com.xhkjedu.smarking.mapper.paper.MsPaperMapper;
7 8
 import com.xhkjedu.smarking.mapper.stupaper.MsPaperStudentMapper;
8 9
 import com.xhkjedu.smarking.mapper.stupaper.MsPaperStudentQuestionMapper;
9 10
 import com.xhkjedu.smarking.model.paper.MsPaperFile;
@@ -39,6 +40,8 @@ public class MsPaperStudentService {
39 40
     private MsPaperStudentQuestionMapper msPaperStudentQuestionMapper;
40 41
     @Resource
41 42
     private ConvertUtil convertUtil;
43
+    @Resource
44
+    private MsPaperMapper msPaperMapper;
42 45
 
43 46
     /*
44 47
      * @Description 学生考试列表-待进行
@@ -297,4 +300,23 @@ public class MsPaperStudentService {
297 300
             }
298 301
         }
299 302
     }
303
+
304
+    /*
305
+     * @Description 学生试卷-题型试题、作答、得分情况
306
+     * @Date 2024/11/14 14:37:40
307
+     * @Author WN
308
+     * @Param [mpsid]
309
+     * @Return java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
310
+     **/
311
+    public List<Map<String,Object>> listStuPaperQtypeQueAnswerForWeb(Integer mpsid){
312
+        Integer papertype = msPaperMapper.getPaperTypeByMpsid(mpsid);
313
+        List<Map<String,Object>> rtnList;
314
+        if(papertype == 1) {
315
+            //题库试卷
316
+            rtnList = msPaperStudentQuestionMapper.listStuPaperQtypeQueAnswerForWebTk(mpsid);
317
+        }else{
318
+            rtnList = msPaperStudentQuestionMapper.listStuPaperQtypeQueAnswerForWebFj(mpsid);
319
+        }
320
+        return rtnList;
321
+    }
300 322
 }

+ 5
- 0
smarking/src/main/resources/mapper/exam/MsExamMapper.xml Просмотреть файл

@@ -52,4 +52,9 @@
52 52
         ,fixedscore,schoolid,hashb,year
53 53
         from ms_exam where examid=#{examid}
54 54
     </select>
55
+
56
+    <!--考试状态-->
57
+    <select id="getExamstate" resultType="java.lang.Integer">
58
+        select examstate from ms_exam where examid=#{examid}
59
+    </select>
55 60
 </mapper>

+ 5
- 0
smarking/src/main/resources/mapper/paper/MsPaperMapper.xml Просмотреть файл

@@ -112,4 +112,9 @@
112 112
     <select id="getCorrectTypeByMpId" resultType="java.lang.Integer">
113 113
         select correcttype from ms_paper where mpid=#{mpid}
114 114
     </select>
115
+
116
+    <!--获取试卷类型-->
117
+    <select id="getPaperTypeByMpsid" resultType="java.lang.Integer">
118
+        select p.ptype from ms_paper p left join ms_paper_student ps on p.mpid=ps.mpid where ps.mpsid=#{mpsid}
119
+    </select>
115 120
 </mapper>

+ 11
- 0
smarking/src/main/resources/mapper/scan/MsScanbatchMapper.xml Просмотреть файл

@@ -89,4 +89,15 @@
89 89
         update ms_scanbatch_paper set identified=(select count(*) from ms_scanbatch_paper where batchid=#{batchid} and identified=1) where batchid=#{batchid} and mspid=#{mspid}
90 90
     </update>
91 91
 
92
+    <!--根据试卷ID获取考试状态和ID-->
93
+    <select id="getExamStateAndId" resultType="com.xhkjedu.smarking.model.exam.MsExam">
94
+        select p.examid,e.examstate from ms_paper p left join ms_exam e on p.examid=e.examid
95
+        where p.mpid=#{mpid}
96
+    </select>
97
+    <!--根据批次ID获取考试状态-->
98
+    <select id="getExamStateByBatchid" resultType="java.lang.Integer">
99
+        select e.examstate from ms_exam e
100
+        right join ms_scanbatch b on e.examid=b.examid and b.batchid=#{batchid}
101
+    </select>
102
+
92 103
 </mapper>

+ 0
- 2
smarking/src/main/resources/mapper/stupaper/MsPaperStudentMapper.xml Просмотреть файл

@@ -99,8 +99,6 @@
99 99
             <result column="qstem" property="qstem"></result>
100 100
             <result column="hearfile" property="hearfile"></result>
101 101
             <result column="qoption" property="qoption"></result>
102
-            <result column="answer" property="answer"></result>
103
-            <result column="stuscore" property="stuscore"></result>
104 102
             <result column="qanalyze" property="qanalyze"></result>
105 103
             <result column="qlevel" property="qlevel"></result>
106 104
             <result column="sorder" property="sorder"></result>

+ 85
- 0
smarking/src/main/resources/mapper/stupaper/MsPaperStudentQuestionMapper.xml Просмотреть файл

@@ -217,4 +217,89 @@
217 217
             update ms_paper_student_question set stuscore=#{q.stuscore} where mpsqid=#{q.mpsqid}
218 218
         </foreach>
219 219
     </update>
220
+
221
+    <!--学生试卷-题型试题、作答、得分情况(题库)-->
222
+    <resultMap id="qtypesQuestion" type="java.util.Map">
223
+        <result column="mptid" property="mptid"></result>
224
+        <result column="mptname" property="mptname"></result>
225
+        <result column="mptnum" property="mptnum"></result>
226
+        <result column="mptorder" property="mptorder"></result>
227
+        <result column="mptscore" property="mptscore"></result>
228
+        <collection property="questions" ofType="java.util.Map" javaType="java.util.List">
229
+            <result column="mpsqid" property="mpsqid"></result>
230
+            <result column="questionid" property="questionid"></result>
231
+            <result column="qscore" property="qscore"></result>
232
+            <result column="qorder" property="qorder"></result>
233
+            <result column="qn" property="qn"></result>
234
+            <result column="qanswer" property="qanswer"></result>
235
+            <result column="answered" property="answered"></result>
236
+            <result column="answertype" property="answertype"></result>
237
+            <result column="stuanswer" property="stuanswer"></result>
238
+            <result column="mptqid" property="mptqid"></result>
239
+            <result column="qtypeid" property="qtypeid"></result>
240
+            <result column="qtypename" property="qtypename"></result>
241
+            <result column="qctype" property="ctype"></result>
242
+            <result column="qstem" property="qstem"></result>
243
+            <result column="hearfile" property="hearfile"></result>
244
+            <result column="qoption" property="qoption"></result>
245
+            <result column="answer" property="answer"></result>
246
+            <result column="stuscore" property="stuscore"></result>
247
+            <result column="qanalyze" property="qanalyze"></result>
248
+            <result column="qlevel" property="qlevel"></result>
249
+            <result column="sorder" property="sorder"></result>
250
+            <result column="snum" property="snum"></result>
251
+            <result column="questionpid" property="questionpid"></result>
252
+            <result column="mquestionid" property="mquestionid"></result>
253
+            <result column="mqstem" property="mqstem"></result>
254
+            <result column="mqtypeid" property="mqtypeid"></result>
255
+            <result column="mqtypename" property="mqtypename"></result>
256
+            <result column="mctype" property="mctype"></result>
257
+            <result column="mhearfile" property="mhearfile"></result>
258
+        </collection>
259
+    </resultMap>
260
+    <!--学生试卷-题型试题、作答、得分情况(题库)-->
261
+    <select id="listStuPaperQtypeQueAnswerForWebTk" resultMap="qtypesQuestion">
262
+        select pt.mptid,pt.mptname,pt.mptnum,pt.mptorder,pt.mptscore,psq.mpsqid,psq.questionid,
263
+        psq.qorder,psq.qn,psq.qscore,ptq.qanswer,psq.answered,psq.answertype,psq.stuanswer,psq.stuscore,
264
+        psq.mptqid,q.qstem,q.qoption,q.ctype qctype,q.hearfile,q.qtypeid,q.qtypename,q.qlevel,
265
+        q.snum,q.sorder,q.questionpid,mq.questionid mquestionid,mq.qstem mqstem,mq.qoption mqoption,
266
+        mq.ctype mctype,mq.qtypeid mqtypeid,mq.qtypename mqtypename,mq.hearfile mhearfile
267
+        from ms_paper_student_question psq left join ms_paper_qtype_question ptq on psq.mptqid=ptq.mptqid
268
+        left join ms_paper_qtype pt on pt.mptid=ptq.mptid
269
+        left join t_question q on psq.questionid=q.questionid
270
+        left join t_question mq on q.questionpid=mq.questionid
271
+        where psq.mpsid=#{mpsid} order by pt.mptorder,psq.qorder,q.sorder
272
+    </select>
273
+    <!--学生试卷-题型试题、作答、得分情况(附件)-->
274
+    <resultMap id="fjtypeQuestions" type="java.util.Map">
275
+        <result column="mptid" property="mptid"></result>
276
+        <result column="mptname" property="mptname"></result>
277
+        <result column="mptnum" property="mptnum"></result>
278
+        <result column="mptorder" property="mptorder"></result>
279
+        <result column="mptscore" property="mptscore"></result>
280
+        <collection property="questions" ofType="java.util.Map" javaType="java.util.Map">
281
+            <result column="stuscore" property="stuscore"></result>
282
+            <result column="mpsqid" property="mpsqid"></result>
283
+            <result column="qscore" property="qscore"></result>
284
+            <result column="qorder" property="qorder"></result>
285
+            <result column="qn" property="qn"></result>
286
+            <result column="mptqid" property="mptqid"></result>
287
+            <result column="qtypeid" property="qtypeid"></result>
288
+            <result column="qtypename" property="qtypename"></result>
289
+            <result column="ctype" property="ctype"></result>
290
+            <result column="optionnum" property="optionnum"></result>
291
+            <result column="answered" property="answered"></result>
292
+            <result column="answertype" property="answertype"></result>
293
+            <result column="stuanswer" property="stuanswer"></result>
294
+        </collection>
295
+    </resultMap>
296
+    <!--学生试卷-题型试题、作答、得分情况(附件)-->
297
+    <select id="listStuPaperQtypeQueAnswerForWebFj" resultMap="fjtypeQuestions">
298
+        select pt.mptid,pt.mptname,pt.mptnum,pt.mptorder,pt.mptscore,
299
+        psq.mpsqid,psq.qn,psq.qorder,psq.answered,psq.answertype,psq.stuanswer,psq.stuscore,
300
+        psq.mptqid,psq.qscore,pq.optionnum,pq.ctype,pq.qtypeid,pq.qtypename,pq.qanswer
301
+        from ms_paper_student_question psq left join ms_paper_qtype_question pq on psq.mptqid=pq.mptqid
302
+        left join ms_paper_qtype pt on pq.mptid=pt.mptid
303
+        where psq.mpsid=#{mpsid} order by pt.mptorder, psq.qorder
304
+    </select>
220 305
 </mapper>

Загрузка…
Отмена
Сохранить