浏览代码

答题卡

tags/正式版本
王宁 2 年前
父节点
当前提交
8465cab006
共有 24 个文件被更改,包括 294 次插入314 次删除
  1. 1
    1
      scommons/src/main/java/com/xhkjedu/utils/N_Utils.java
  2. 38
    0
      sexam/src/main/java/com/xhkjedu/sexam/controller/paper/EPaperScantronController.java
  3. 0
    31
      sexam/src/main/java/com/xhkjedu/sexam/controller/paper/ESubjectScantronController.java
  4. 3
    0
      sexam/src/main/java/com/xhkjedu/sexam/mapper/paper/EPaperFjtypeMapper.java
  5. 6
    0
      sexam/src/main/java/com/xhkjedu/sexam/mapper/paper/EPaperMapper.java
  6. 3
    0
      sexam/src/main/java/com/xhkjedu/sexam/mapper/paper/EPaperQtypeMapper.java
  7. 11
    0
      sexam/src/main/java/com/xhkjedu/sexam/mapper/paper/EPaperScantronMapper.java
  8. 0
    14
      sexam/src/main/java/com/xhkjedu/sexam/mapper/paper/ESubjectScantronMapper.java
  9. 0
    7
      sexam/src/main/java/com/xhkjedu/sexam/mapper/paper/ESubjectScantronQtypeMapper.java
  10. 0
    7
      sexam/src/main/java/com/xhkjedu/sexam/mapper/paperstudent/ESubjectScantronStudentMapper.java
  11. 0
    7
      sexam/src/main/java/com/xhkjedu/sexam/mapper/paperstudent/ESubjectScantronStudentQuestionMapper.java
  12. 7
    1
      sexam/src/main/java/com/xhkjedu/sexam/model/paper/EPaper.java
  13. 9
    20
      sexam/src/main/java/com/xhkjedu/sexam/model/paper/EPaperScantron.java
  14. 0
    47
      sexam/src/main/java/com/xhkjedu/sexam/model/paper/ESubjectScantronQtype.java
  15. 0
    45
      sexam/src/main/java/com/xhkjedu/sexam/model/paperstudent/ESubjectScantronStudent.java
  16. 0
    66
      sexam/src/main/java/com/xhkjedu/sexam/model/paperstudent/ESubjectScantronStudentQuestion.java
  17. 32
    9
      sexam/src/main/java/com/xhkjedu/sexam/service/paper/EPaperFjtypeService.java
  18. 111
    0
      sexam/src/main/java/com/xhkjedu/sexam/service/paper/EPaperScantronService.java
  19. 0
    24
      sexam/src/main/java/com/xhkjedu/sexam/service/paper/ESubjectScantronService.java
  20. 25
    1
      sexam/src/main/resources/mapper/paper/EPaperFjtypeMapper.xml
  21. 14
    1
      sexam/src/main/resources/mapper/paper/EPaperMapper.xml
  22. 23
    0
      sexam/src/main/resources/mapper/paper/EPaperQtypeMapper.xml
  23. 11
    0
      sexam/src/main/resources/mapper/paper/EPaperScantronMapper.xml
  24. 0
    33
      sexam/src/main/resources/mapper/paper/ESubjectScantronMapper.xml

+ 1
- 1
scommons/src/main/java/com/xhkjedu/utils/N_Utils.java 查看文件

@@ -1023,7 +1023,7 @@ public class N_Utils {
1023 1023
     }
1024 1024
 
1025 1025
     //处理题型中客观题
1026
-    private static int[] octypelist = new int[]{1,2,4,5,6,7,8};
1026
+    private static int[] octypelist = new int[]{1,2,4,5,6,7,8,10};
1027 1027
     /**
1028 1028
      * @Description 判断ctype是否是客观题
1029 1029
      * @Param [ctype]

+ 38
- 0
sexam/src/main/java/com/xhkjedu/sexam/controller/paper/EPaperScantronController.java 查看文件

@@ -0,0 +1,38 @@
1
+package com.xhkjedu.sexam.controller.paper;
2
+
3
+import com.xhkjedu.sexam.model.paper.EPaper;
4
+import com.xhkjedu.sexam.model.paper.EPaperScantron;
5
+import com.xhkjedu.sexam.service.paper.EPaperScantronService;
6
+import com.xhkjedu.utils.N_Utils;
7
+import com.xhkjedu.vo.ResultVo;
8
+import org.springframework.web.bind.annotation.PostMapping;
9
+import org.springframework.web.bind.annotation.RequestBody;
10
+import org.springframework.web.bind.annotation.RequestMapping;
11
+import org.springframework.web.bind.annotation.RestController;
12
+
13
+import javax.annotation.Resource;
14
+import java.util.Map;
15
+
16
+@RestController
17
+@RequestMapping("/escan")
18
+public class EPaperScantronController {
19
+    @Resource
20
+    private EPaperScantronService ePaperScantronService;
21
+
22
+    //获取制作答题卡需要的试卷信息
23
+    @PostMapping("/pqs")
24
+    public ResultVo getPaperAndQuesitons(@RequestBody EPaperScantron eSubjectScantron) {
25
+        N_Utils.validation(new Object[]{eSubjectScantron.getEpid(),"试卷id",1});
26
+        Map rtn = ePaperScantronService.getPaperAndQuesitons(eSubjectScantron.getEpid());
27
+        return new ResultVo(0,"获取成功",rtn);
28
+    }
29
+
30
+    //保存答题卡
31
+    @PostMapping("/save")
32
+    public ResultVo save(@RequestBody EPaper epaper) {
33
+        ePaperScantronService.savePaperScantron(epaper);
34
+        return new ResultVo(0,"保存成功");
35
+    }
36
+
37
+
38
+}

+ 0
- 31
sexam/src/main/java/com/xhkjedu/sexam/controller/paper/ESubjectScantronController.java 查看文件

@@ -1,31 +0,0 @@
1
-package com.xhkjedu.sexam.controller.paper;
2
-
3
-import com.github.pagehelper.PageHelper;
4
-import com.github.pagehelper.PageInfo;
5
-import com.xhkjedu.sexam.model.paper.ESubjectScantron;
6
-import com.xhkjedu.sexam.service.paper.ESubjectScantronService;
7
-import com.xhkjedu.utils.PageUtil;
8
-import com.xhkjedu.vo.PageResult;
9
-import com.xhkjedu.vo.ResultVo;
10
-import org.springframework.web.bind.annotation.PostMapping;
11
-import org.springframework.web.bind.annotation.RequestBody;
12
-import org.springframework.web.bind.annotation.RequestMapping;
13
-import org.springframework.web.bind.annotation.RestController;
14
-
15
-import javax.annotation.Resource;
16
-import java.util.List;
17
-
18
-@RestController
19
-@RequestMapping("/e_scantron")
20
-public class ESubjectScantronController {
21
-    @Resource
22
-    private ESubjectScantronService eSubjectScantronService;
23
-
24
-    @PostMapping("/add")
25
-    public ResultVo add(@RequestBody ESubjectScantron eSubjectScantron) {
26
-        eSubjectScantronService.saveSubjectScantron(eSubjectScantron);
27
-        return new ResultVo(0,"保存成功");
28
-    }
29
-
30
-
31
-}

+ 3
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/paper/EPaperFjtypeMapper.java 查看文件

@@ -15,4 +15,7 @@ import java.util.Map;
15 15
 public interface EPaperFjtypeMapper extends TkMapper<EPaperFjtype> {
16 16
     //试卷题型试题信息
17 17
     List<Map> listPaperFjtypeQuestions(@Param("epid")Integer epid);
18
+
19
+    //制作答题卡时获取试卷中试题
20
+    List<Map> listPaperfjtypeQuestionsForScan(@Param("epid")Integer epid);
18 21
 }

+ 6
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/paper/EPaperMapper.java 查看文件

@@ -25,6 +25,9 @@ public interface EPaperMapper extends TkMapper<EPaper> {
25 25
     //试卷详情
26 26
     Map getExamPaperDetailByEpid(@Param("epid") Integer epid);
27 27
 
28
+    //获取考试科目和考试名称
29
+    Map getExamPaperAndSubject(@Param("epid") Integer epid);
30
+
28 31
     //删除试卷信息
29 32
     void deletePaperByEpid(@Param("epid") Integer epid);
30 33
 
@@ -36,4 +39,7 @@ public interface EPaperMapper extends TkMapper<EPaper> {
36 39
 
37 40
     //修改批阅设置
38 41
     void updateCorrectType(@Param("epid") Integer epid, @Param("correcttype") int correcttype);
42
+
43
+    //修改答题卡关联字段信息
44
+    void updatePaperScantron(@Param("paper") EPaper paper);
39 45
 }

+ 3
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/paper/EPaperQtypeMapper.java 查看文件

@@ -17,4 +17,7 @@ public interface EPaperQtypeMapper extends TkMapper<EPaperQtype> {
17 17
 
18 18
     //题型试题详情
19 19
     List<EPaperQtypeVo> listPaperQtypeQuestions(@Param("epid") Integer epid);
20
+
21
+    //制作答题卡时获取试卷中试题
22
+    List<Map> listPaperqtypeQuestionsForScan(@Param("epid") Integer epid);
20 23
 }

+ 11
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/paper/EPaperScantronMapper.java 查看文件

@@ -0,0 +1,11 @@
1
+package com.xhkjedu.sexam.mapper.paper;
2
+
3
+import com.xhkjedu.sexam.base.TkMapper;
4
+import com.xhkjedu.sexam.model.paper.EPaperScantron;
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+public interface EPaperScantronMapper extends TkMapper<EPaperScantron> {
8
+
9
+    //删除答题卡
10
+    void deleteScantronByEpid(@Param("epid")Integer epid);
11
+}

+ 0
- 14
sexam/src/main/java/com/xhkjedu/sexam/mapper/paper/ESubjectScantronMapper.java 查看文件

@@ -1,14 +0,0 @@
1
-package com.xhkjedu.sexam.mapper.paper;
2
-
3
-import com.xhkjedu.sexam.base.TkMapper;
4
-import com.xhkjedu.sexam.model.paper.ESubjectScantron;
5
-import org.apache.ibatis.annotations.Param;
6
-
7
-import java.util.List;
8
-import java.util.Map;
9
-
10
-public interface ESubjectScantronMapper extends TkMapper<ESubjectScantron> {
11
-
12
-    //答题卡中试题详情
13
-    List<Map> cantronQtypes(@Param("esid")Integer esid);
14
-}

+ 0
- 7
sexam/src/main/java/com/xhkjedu/sexam/mapper/paper/ESubjectScantronQtypeMapper.java 查看文件

@@ -1,7 +0,0 @@
1
-package com.xhkjedu.sexam.mapper.paper;
2
-
3
-import com.xhkjedu.sexam.base.TkMapper;
4
-import com.xhkjedu.sexam.model.paper.ESubjectScantronQtype;
5
-
6
-public interface ESubjectScantronQtypeMapper extends TkMapper<ESubjectScantronQtype> {
7
-}

+ 0
- 7
sexam/src/main/java/com/xhkjedu/sexam/mapper/paperstudent/ESubjectScantronStudentMapper.java 查看文件

@@ -1,7 +0,0 @@
1
-package com.xhkjedu.sexam.mapper.paperstudent;
2
-
3
-import com.xhkjedu.sexam.base.TkMapper;
4
-import com.xhkjedu.sexam.model.paperstudent.ESubjectScantronStudent;
5
-
6
-public interface ESubjectScantronStudentMapper extends TkMapper<ESubjectScantronStudent> {
7
-}

+ 0
- 7
sexam/src/main/java/com/xhkjedu/sexam/mapper/paperstudent/ESubjectScantronStudentQuestionMapper.java 查看文件

@@ -1,7 +0,0 @@
1
-package com.xhkjedu.sexam.mapper.paperstudent;
2
-
3
-import com.xhkjedu.sexam.base.TkMapper;
4
-import com.xhkjedu.sexam.model.paperstudent.ESubjectScantronStudentQuestion;
5
-
6
-public interface ESubjectScantronStudentQuestionMapper extends TkMapper<ESubjectScantronStudentQuestion> {
7
-}

+ 7
- 1
sexam/src/main/java/com/xhkjedu/sexam/model/paper/EPaper.java 查看文件

@@ -24,7 +24,7 @@ public class EPaper extends BaseBean {
24 24
     //科目id
25 25
     private String subjectid;
26 26
 
27
-    //试卷类型1题库2答题卡
27
+    //试卷类型1题库
28 28
     private Integer ptype;
29 29
 
30 30
     //试题数量
@@ -42,6 +42,9 @@ public class EPaper extends BaseBean {
42 42
     //听力题文件地址(附件试卷)
43 43
     private String hearfile;
44 44
 
45
+    //是否有附件0没有1有附件
46
+    private Integer hasfile;
47
+
45 48
     //答题卡文件
46 49
     private String scantronfile;
47 50
 
@@ -77,4 +80,7 @@ public class EPaper extends BaseBean {
77 80
 
78 81
     @Transient
79 82
     private List<EPaperQtype> qtypelist;//题库试卷内容
83
+
84
+    @Transient
85
+    private List<EPaperScantron> scanlist;//答题卡内容
80 86
 }

sexam/src/main/java/com/xhkjedu/sexam/model/paper/ESubjectScantron.java → sexam/src/main/java/com/xhkjedu/sexam/model/paper/EPaperScantron.java 查看文件

@@ -5,13 +5,14 @@ import lombok.Data;
5 5
 
6 6
 import javax.persistence.Id;
7 7
 import javax.persistence.Table;
8
+import java.util.List;
8 9
 
9
-@Table(name = "e_subject_scantron")
10
+@Table(name = "e_paper_scantron")
10 11
 @Data
11
-public class ESubjectScantron extends BaseBean {
12
+public class EPaperScantron extends BaseBean {
12 13
     @Id
13 14
     //试卷科目答题卡表
14
-    private Integer essid;
15
+    private Integer escanid;
15 16
 
16 17
     //考试科目id
17 18
     private Integer esid;
@@ -19,30 +20,15 @@ public class ESubjectScantron extends BaseBean {
19 20
     //考试试卷id
20 21
     private Integer epid;
21 22
 
22
-    //答题卡题型表id
23
-    private Integer esstid;
24
-
25 23
     //试题处理题型
26 24
     private Integer ctype;
27 25
 
28
-    //试题id
29
-    private String questionid;
30
-
31
-    //题号
32
-    private String qn;
33
-
34
-    //试题排序
35
-    private Integer order;
36
-
37
-    //分值
38
-    private Double score;
26
+    //试卷中生成的试题id
27
+    private Integer questionid;
39 28
 
40 29
     //选项数量
41 30
     private Integer optionnum;
42 31
 
43
-    //正确答案
44
-    private String answer;
45
-
46 32
     //试题坐标
47 33
     private String coord;
48 34
 
@@ -51,4 +37,7 @@ public class ESubjectScantron extends BaseBean {
51 37
 
52 38
     //创建时间
53 39
     private Integer createtime;
40
+
41
+    //二维坐标数组字符串
42
+    private List<String> coordlist;
54 43
 }

+ 0
- 47
sexam/src/main/java/com/xhkjedu/sexam/model/paper/ESubjectScantronQtype.java 查看文件

@@ -1,47 +0,0 @@
1
-package com.xhkjedu.sexam.model.paper;
2
-
3
-import com.xhkjedu.sexam.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 = "e_subject_scantron_qtype")
12
-@Data
13
-public class ESubjectScantronQtype extends BaseBean {
14
-    @Id
15
-    //试卷科目答题卡题型表
16
-    private Integer esstid;
17
-
18
-    //考试科目id
19
-    private Integer esid;
20
-
21
-    //考试试卷表
22
-    private Integer epid;
23
-
24
-    //处理题型
25
-    private Integer ctype;
26
-
27
-    //题型名称
28
-    private String esstname;
29
-
30
-    //题型序号
31
-    private String esstorder;
32
-
33
-    //题型下试题数量
34
-    private Integer esstnum;
35
-
36
-    //题型下试题总分值
37
-    private Double esstscore;
38
-
39
-    //创建人id
40
-    private Integer createid;
41
-
42
-    //创建时间
43
-    private Integer createtime;
44
-
45
-    @Transient
46
-    private List<ESubjectScantron> questions;//试题
47
-}

+ 0
- 45
sexam/src/main/java/com/xhkjedu/sexam/model/paperstudent/ESubjectScantronStudent.java 查看文件

@@ -1,45 +0,0 @@
1
-package com.xhkjedu.sexam.model.paperstudent;
2
-
3
-import com.xhkjedu.sexam.model.BaseBean;
4
-import lombok.Data;
5
-
6
-import javax.persistence.Id;
7
-import javax.persistence.Table;
8
-
9
-@Table(name = "e_subject_scantron_student")
10
-@Data
11
-public class ESubjectScantronStudent extends BaseBean {
12
-    @Id
13
-    //考试科目答题卡学生表
14
-    private Integer esssid;
15
-
16
-    //班级id
17
-    private Integer classid;
18
-
19
-    //学生id
20
-    private Integer studentid;
21
-
22
-    //考试试卷id
23
-    private Integer epid;
24
-
25
-    //考试科目答题卡id
26
-    private Integer essid;
27
-
28
-    //批阅状态0未批改1批改中2已批改
29
-    private Integer checked;
30
-
31
-    //批阅人
32
-    private Integer checkid;
33
-
34
-    //试题数量
35
-    private Integer num;
36
-
37
-    //试卷分值
38
-    private Double score;
39
-
40
-    //学生得分
41
-    private Double stuscore;
42
-
43
-    //保存时间
44
-    private Integer createtime;
45
-}

+ 0
- 66
sexam/src/main/java/com/xhkjedu/sexam/model/paperstudent/ESubjectScantronStudentQuestion.java 查看文件

@@ -1,66 +0,0 @@
1
-package com.xhkjedu.sexam.model.paperstudent;
2
-
3
-import com.xhkjedu.sexam.model.BaseBean;
4
-import lombok.Data;
5
-
6
-import javax.persistence.Id;
7
-import javax.persistence.Table;
8
-
9
-@Table(name = "e_subject_scantron_student_question")
10
-@Data
11
-public class ESubjectScantronStudentQuestion extends BaseBean {
12
-    @Id
13
-    //考试答题卡学生作答表
14
-    private Integer esssqid;
15
-
16
-    //班级id
17
-    private Integer classid;
18
-
19
-    //学生id
20
-    private Integer studentid;
21
-
22
-    //考试试卷id
23
-    private Integer epid;
24
-
25
-    //考试科目答题卡id
26
-    private Integer essid;
27
-
28
-    //学生答题卡表id
29
-    private Integer esssid;
30
-
31
-    //试题序号
32
-    private String qn;
33
-
34
-    //试题排序
35
-    private Integer qorder;
36
-
37
-    //是否作答0未作答1已作做答
38
-    private Integer answered;
39
-
40
-    //是否转换0未转换1已转换2转换失败
41
-    private Integer converted;
42
-
43
-    //试题分值
44
-    private Double qscore;
45
-
46
-    //学生得分
47
-    private Double stuscore;
48
-
49
-    //是否批改0未批改1批改中2已批改
50
-    private Integer checked;
51
-
52
-    //批改人
53
-    private Integer checkid;
54
-
55
-    //批改时间
56
-    private Integer checktime;
57
-
58
-    //作答情况0默认1优秀2违规
59
-    private Integer goodbad;
60
-
61
-    //保存时间
62
-    private Integer createtime;
63
-
64
-    //学生答案(选项、图片)
65
-    private String stuanswer;
66
-}

+ 32
- 9
sexam/src/main/java/com/xhkjedu/sexam/service/paper/EPaperFjtypeService.java 查看文件

@@ -42,12 +42,23 @@ public class EPaperFjtypeService {
42 42
         ESubject eSubject = eSubjectMapper.selectByPrimaryKey(paper.getEsid());
43 43
         List<EPaperFjtype> fjtypelist  = paper.getFjtypelist();//题型
44 44
         List<EPaperFjtypeQuestion> queslist = new ArrayList<>();//题型下试题集合
45
+        List<EPaperFile> files = paper.getPfiles();//附件文件
46
+        if(files!=null && files.size()>0){
47
+            paper.setHasfile(1);
48
+        }else{
49
+            paper.setHasfile(0);
50
+        }
51
+        setPaperBaseDetail(paper,eSubject,fjtypelist,queslist);
52
+
45 53
         ePaperMapper.insertUseGeneratedKeys(paper);
46 54
         int epid = paper.getId();
47 55
         paper.setEpid(epid);
48
-        setPaperBaseDetail(paper,eSubject,fjtypelist,queslist);
49
-        //保存作业附件
50
-        savePaperFile(paper);
56
+
57
+        if(paper.getHasfile() == 1){
58
+            //保存作业附件
59
+            savePaperFile(paper,files);
60
+        }
61
+
51 62
         //保存答题卡信息
52 63
         saveFjtypeQuestion(paper,fjtypelist);
53 64
 
@@ -82,9 +93,8 @@ public class EPaperFjtypeService {
82 93
     }
83 94
 
84 95
     //保存附件试卷文件
85
-    private void savePaperFile(EPaper paper){
96
+    private void savePaperFile(EPaper paper,List<EPaperFile> files){
86 97
         int fileorder = 1;
87
-        List<EPaperFile> files = paper.getPfiles();
88 98
         for(EPaperFile f : files){
89 99
             f.setCreateid(paper.getCreateid());
90 100
             f.setCreatetime(paper.getCreatetime());
@@ -100,7 +110,7 @@ public class EPaperFjtypeService {
100 110
         List<EPaperFjtypeQuestion> saveques = new ArrayList<>();
101 111
         for(EPaperFjtype fjt : fjtypelist){
102 112
             List<EPaperFjtypeQuestion> quelist = fjt.getQuestions();//题型下试题
103
-            fjt.setEpfjid(paper.getEpid());
113
+            fjt.setEpid(paper.getEpid());
104 114
             fjt.setCreateid(paper.getHandleid());
105 115
             fjt.setCreatetime(paper.getHandletime());
106 116
             fjt.setEpfjnum(quelist.size());
@@ -185,12 +195,20 @@ public class EPaperFjtypeService {
185 195
         ESubject eSubject = eSubjectMapper.selectByPrimaryKey(paper.getEsid());
186 196
         List<EPaperFjtype> fjtypelist  = paper.getFjtypelist();//题型
187 197
         List<EPaperFjtypeQuestion> queslist = new ArrayList<>();//题型下试题集合
198
+        List<EPaperFile> files = paper.getPfiles();//附件文件
199
+        if(files!=null && files.size()>0){
200
+            paper.setHasfile(1);
201
+        }else{
202
+            paper.setHasfile(0);
203
+        }
188 204
         ePaperMapper.insertUseGeneratedKeys(paper);
189 205
         int epid = paper.getId();
190 206
         paper.setEpid(epid);
191 207
         setPaperBaseDetail(paper,eSubject,fjtypelist,queslist);
192
-        //保存作业附件
193
-        savePaperFile(paper);
208
+        if(paper.getHasfile() == 1){
209
+            //保存作业附件
210
+            savePaperFile(paper,files);
211
+        }
194 212
         //保存答题卡信息
195 213
         saveFjtypeQuestion(paper,fjtypelist);
196 214
 
@@ -214,7 +232,12 @@ public class EPaperFjtypeService {
214 232
     public Map getPaperFjDetail(Integer epid){
215 233
         Map map = ePaperMapper.getExamPaperDetailByEpid(epid);//试卷信息
216 234
         List<Map> fjtypelist = ePaperFjtypeMapper.listPaperFjtypeQuestions(epid);//试卷题型试题信息
217
-        List<Map> fileslist = ePaperFileMapper.listPaperFiles(epid);//附件集合
235
+        int hasfile = Integer.parseInt(map.get("hasfile").toString());
236
+        List<Map> fileslist = new ArrayList<>();
237
+        if(hasfile == 1){
238
+            fileslist = ePaperFileMapper.listPaperFiles(epid);//附件集合
239
+        }
240
+
218 241
         map.put("qtypes",fjtypelist);
219 242
         map.put("files",fileslist);
220 243
         return map;

+ 111
- 0
sexam/src/main/java/com/xhkjedu/sexam/service/paper/EPaperScantronService.java 查看文件

@@ -0,0 +1,111 @@
1
+package com.xhkjedu.sexam.service.paper;
2
+
3
+import com.alibaba.fastjson.JSON;
4
+import com.xhkjedu.sexam.mapper.exam.ESubjectMapper;
5
+import com.xhkjedu.sexam.mapper.paper.EPaperFjtypeMapper;
6
+import com.xhkjedu.sexam.mapper.paper.EPaperMapper;
7
+import com.xhkjedu.sexam.mapper.paper.EPaperQtypeMapper;
8
+import com.xhkjedu.sexam.mapper.paper.EPaperScantronMapper;
9
+import com.xhkjedu.sexam.model.exam.ESubject;
10
+import com.xhkjedu.sexam.model.paper.*;
11
+import com.xhkjedu.utils.N_Utils;
12
+import org.springframework.stereotype.Service;
13
+import org.springframework.transaction.annotation.Transactional;
14
+
15
+import javax.annotation.Resource;
16
+import java.util.ArrayList;
17
+import java.util.HashMap;
18
+import java.util.List;
19
+import java.util.Map;
20
+import java.util.stream.IntStream;
21
+
22
+@Service
23
+public class EPaperScantronService {
24
+    @Resource
25
+    private EPaperScantronMapper ePaperScantronMapper;
26
+    @Resource
27
+    private EPaperQtypeMapper ePaperQtypeMapper;
28
+    @Resource
29
+    private EPaperFjtypeMapper ePaperFjtypeMapper;
30
+    @Resource
31
+    private EPaperMapper ePaperMapper;
32
+    @Resource
33
+    private ESubjectMapper eSubjectMapper;
34
+
35
+    /**
36
+     * @Description 获取制作答题卡需要的试卷信息
37
+     * @Param [epid]
38
+     * @Return java.util.Map
39
+     * @Author wn
40
+     * @Date 2022/7/22 10:19
41
+     **/
42
+    public Map getPaperAndQuesitons(Integer epid){
43
+        Map eps = ePaperMapper.getExamPaperAndSubject(epid);//考试考试科目名称
44
+        List<Map> qtypes = new ArrayList<>();//题型试题
45
+        int ptype = Integer.parseInt(eps.get("ptype").toString());//试卷类型1题库2附件
46
+        if(ptype == 1){
47
+            qtypes = ePaperQtypeMapper.listPaperqtypeQuestionsForScan(epid);
48
+            //处理试卷中试题选项数量
49
+            for(Map qtm : qtypes){
50
+                List<Map> qlist = (List<Map>) qtm.get("questions");
51
+                for(Map qm : qlist){
52
+                    String qoption = qm.get("qoption").toString();
53
+                    Integer ctype = Integer.parseInt(qm.get("ctype").toString());
54
+                    if(ctype == 1 || ctype ==2 || ctype==4 || ctype ==5 || ctype==6 ){
55
+                        List<String> strlst = JSON.parseArray(qoption,String.class);
56
+                        qm.put("qoption","");
57
+                        qm.put("optionnum",strlst.size());
58
+                    }
59
+                }
60
+            }
61
+        }else{
62
+            qtypes = ePaperFjtypeMapper.listPaperfjtypeQuestionsForScan(epid);
63
+        }
64
+        Map rtnmap = new HashMap();
65
+        rtnmap.put("paper",eps);
66
+        rtnmap.put("qtypes",qtypes);
67
+        return rtnmap;
68
+    }
69
+
70
+    /**
71
+     * @Description 保存答题卡
72
+     * @Param [ePaper]
73
+     * @Return void
74
+     * @Author wn
75
+     * @Date 2022/7/22 14:16
76
+     **/
77
+    @Transactional(rollbackFor = Exception.class)
78
+    public void savePaperScantron(EPaper ePaper) {
79
+        //获取考试科目信息
80
+        ESubject eSubject = eSubjectMapper.selectByPrimaryKey(ePaper.getEsid());
81
+        ePaper.setEsid(eSubject.getEsid());
82
+        List<EPaperScantron> sctypelist  = ePaper.getScanlist();//答题卡
83
+        int[] ctypes = new int[]{3,11,13,14,15};//ctype为指定值时会出现答题卡不在一个区域
84
+        int timestamp = N_Utils.getSecondTimestamp();
85
+        for(EPaperScantron ct : sctypelist){
86
+            ct.setCreateid(ePaper.getCreateid());
87
+            ct.setCreatetime(timestamp);
88
+            if(IntStream.of(ctypes).anyMatch(x -> x == ct.getCtype())){
89
+                List<List> savecoord = new ArrayList<>();
90
+                for(String str : ct.getCoordlist()){
91
+                    List<List> strlist = JSON.parseArray(str, List.class);
92
+                    for(List l : strlist){
93
+                        savecoord.add(l);
94
+                    }
95
+                }
96
+                ct.setCoord(JSON.toJSONString(savecoord));
97
+            }else{
98
+                ct.setCoord(ct.getCoordlist().get(0));
99
+            }
100
+        }
101
+        //先删除试题原有答题卡
102
+        ePaperScantronMapper.deleteScantronByEpid(ePaper.getId());
103
+        //批量保存答题卡信息
104
+        ePaperScantronMapper.insertList(sctypelist);
105
+        //完善试卷信息
106
+        ePaperMapper.updatePaperScantron(ePaper);
107
+    }
108
+
109
+
110
+
111
+}

+ 0
- 24
sexam/src/main/java/com/xhkjedu/sexam/service/paper/ESubjectScantronService.java 查看文件

@@ -1,24 +0,0 @@
1
-package com.xhkjedu.sexam.service.paper;
2
-
3
-import com.xhkjedu.sexam.mapper.paper.ESubjectScantronMapper;
4
-import com.xhkjedu.sexam.model.paper.ESubjectScantron;
5
-import com.xhkjedu.utils.N_Utils;
6
-import org.springframework.stereotype.Service;
7
-import org.springframework.transaction.annotation.Transactional;
8
-
9
-import javax.annotation.Resource;
10
-import java.util.List;
11
-
12
-@Service
13
-public class ESubjectScantronService {
14
-    @Resource
15
-    private ESubjectScantronMapper eSubjectScantronMapper;
16
-
17
-    //添加
18
-    @Transactional(rollbackFor = Exception.class)
19
-    public void saveSubjectScantron(ESubjectScantron model) {
20
-
21
-    }
22
-
23
-
24
-}

+ 25
- 1
sexam/src/main/resources/mapper/paper/EPaperFjtypeMapper.xml 查看文件

@@ -11,7 +11,7 @@
11 11
         <result column="epfjnum" property="epfjnum"></result>
12 12
         <result column="epfjorder" property="epfjorder"></result>
13 13
         <result column="epfjscore" property="epfjscore"></result>
14
-        <collection property="questions" ofType="java.util.Map">
14
+        <collection property="questions" ofType="java.util.Map" javaType="java.util.Map">
15 15
             <result column="epfjqid" property="epfjqid"></result>
16 16
             <result column="epfjid" property="epfjid"></result>
17 17
             <result column="qtypeid" property="qtypeid"></result>
@@ -30,5 +30,29 @@
30 30
         from e_paper_fjtype t left join e_paper_fjtype_question q on t.epfjid=q.epfjid
31 31
         where t.epid=#{epid} order by t.epfjorder,q.order
32 32
     </select>
33
+
34
+    <resultMap id="fjtypeQuestionsForScan" type="java.util.Map">
35
+        <result column="esstname" property="esstname"></result>
36
+        <result column="ctype" property="ctype"></result>
37
+        <result column="esstnum" property="esstnum"></result>
38
+        <result column="esstorder" property="esstorder"></result>
39
+        <result column="esstscore" property="esstscore"></result>
40
+        <collection property="questions" ofType="java.util.Map" javaType="java.util.List">
41
+            <result column="epfjqid" property="questionid"></result>
42
+            <result column="ctype" property="ctype"></result>
43
+            <result column="score" property="score"></result>
44
+            <result column="qn" property="qn"></result>
45
+            <result column="order" property="order"></result>
46
+            <result column="answer" property="answer"></result>
47
+            <result column="optionnum" property="optionnum"></result>
48
+        </collection>
49
+    </resultMap>
50
+    <!--制作答题卡时获取试卷中试题-->
51
+    <select id="listPaperfjtypeQuestionsForScan" resultMap="fjtypeQuestionsForScan">
52
+        select t.epfjname esstname,t.ctype ctype,t.epfjnum esstnum,t.epfjorder esstorder,t.epfjscore esstscore,
53
+               q.epfjqid questionid,q.ctype,q.score,q.qn,q.order,q.qn,q.answer,q.optionnum
54
+        from e_paper_fjtype t left join e_paper_fjtype_question q on t.epfjid=q.epfjid
55
+        where t.epid=#{epid} order by t.epfjorder,q.order
56
+    </select>
33 57
     
34 58
 </mapper>

+ 14
- 1
sexam/src/main/resources/mapper/paper/EPaperMapper.xml 查看文件

@@ -29,7 +29,7 @@
29 29
     <!--试卷详情-->
30 30
     <select id="getExamPaperDetailByEpid" resultType="java.util.Map">
31 31
         select ep.epid,ep.examid,e.examname,e.gradeid,e.examtype,e.exammode,e.examstate,e.monitored,ep.ptype,ep.pnum,
32
-               ep.pscore,ep.answered,ep.hearfile,u2.username teachername,
32
+               ep.pscore,ep.answered,ep.hearfile,ep.hasfile,u2.username teachername,
33 33
         ep.handleid,ep.handletime,ep.subjectid,s.subjectname,u.username as handlename,es.sdate,es.begintime,es.endtime
34 34
         from e_paper ep left join e_base e on ep.examid=e.examid
35 35
         left join t_subject s on ep.subjectid=s.subjectid
@@ -39,6 +39,13 @@
39 39
         where ep.epid=#{epid}
40 40
     </select>
41 41
 
42
+    <!--获取试卷考试名科目名称-->
43
+    <select id="getExamPaperAndSubject" resultType="java.util.Map">
44
+        select ep.epid,ep.esid,ep.ptype,e.examname,s.subjectname,ep.scantronfile,ep.scantronnote,ep.scantronwh
45
+        from e_paper ep left join e_base e on ep.examid=e.examid
46
+        left join t_subject s on ep.subjectid=s.subjectid where ep.epid=#{epid}
47
+    </select>
48
+
42 49
     <!--删除试卷信息-->
43 50
     <select id="deletePaperByEpid">
44 51
         delete from e_paper where epid=#{epid}
@@ -57,4 +64,10 @@
57 64
     <update id="updateCorrectType">
58 65
         update e_paper set correcttype=#{correcttype} where epid=#{epid}
59 66
     </update>
67
+
68
+    <!--修改设置答题卡-->
69
+    <update id="updatePaperScantron">
70
+        update e_paper set scantronfile=#{paper.scantronfile},scantronnote=#{paper.scantronnote}
71
+        ,scantronwh=#{paper.scantronwh} where epid=#{paper.epid}
72
+    </update>
60 73
 </mapper>

+ 23
- 0
sexam/src/main/resources/mapper/paper/EPaperQtypeMapper.xml 查看文件

@@ -58,6 +58,29 @@
58 58
         where qp.questionid=#{questionid} order by p.pointorder
59 59
     </select>
60 60
 
61
+    <resultMap id="qtypesQuestionsForScan" type="java.util.Map">
62
+        <result column="eptname" property="esstname"></result>
63
+        <result column="ctype" property="ctype"></result>
64
+        <result column="esstname" property="esstnum"></result>
65
+        <result column="esstorder" property="esstorder"></result>
66
+        <result column="esstscore" property="esstscore"></result>
67
+        <collection property="questions" ofType="java.util.Map" javaType="java.util.List">
68
+            <result column="questionid" property="questionid"></result>
69
+            <result column="ctype" property="ctype"></result>
70
+            <result column="score" property="score"></result>
71
+            <result column="order" property="order"></result>
72
+            <result column="qoption" property="qoption"></result>
73
+        </collection>
74
+    </resultMap>
75
+    <!--制作答题卡时获取试卷中试题-->
76
+    <select id="listPaperqtypeQuestionsForScan" resultMap="qtypesQuestionsForScan">
77
+        select t.eptname esstname,t.ctype ctype,t.eptnum esstnum,t.eptorder esstorder,t.eptscore esstscore,
78
+        tq.eptqid questionid,tq.ctype,tq.score,tq.order,q.qoption
79
+        from e_paper_qtype t left join e_paper_qtype_question tq on t.eptid=tq.eptid
80
+        left join t_question q on tq.questionid=q.questionid
81
+        where t.epid=#{epid} order by t.eptorder,tq.order,q.sorder
82
+    </select>
83
+
61 84
 
62 85
     
63 86
 </mapper>

+ 11
- 0
sexam/src/main/resources/mapper/paper/EPaperScantronMapper.xml 查看文件

@@ -0,0 +1,11 @@
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.sexam.mapper.paper.EPaperScantronMapper">
4
+
5
+    <!--删除答题卡-->
6
+    <delete id="deleteScantronByEpid">
7
+        delete from e_paper_scantron where epid=#{epid}
8
+    </delete>
9
+
10
+    
11
+</mapper>

+ 0
- 33
sexam/src/main/resources/mapper/paper/ESubjectScantronMapper.xml 查看文件

@@ -1,33 +0,0 @@
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.sexam.mapper.paper.ESubjectScantronMapper">
4
-
5
-    <resultMap id="cantronQtypes" type="java.util.Map">
6
-        <result property="esstid" column="esstid"></result>
7
-        <result property="esid" column="esid"></result>
8
-        <result property="epid" column="epid"></result>
9
-        <result property="esstname" column="esstname"></result>
10
-        <result property="esstorder" column="esstorder"></result>
11
-        <result property="esstnum" column="esstnum"></result>
12
-        <result property="esstscore" column="esstscore"></result>
13
-        <collection property="scans" ofType="java.util.Map" resultMap="java.util.List" >
14
-            <result property="essid" column="essid"></result>
15
-            <result property="esstid" column="esstid"></result>
16
-            <result property="ctype" column="ctype"></result>
17
-            <result property="questionid" column="questionid"></result>
18
-            <result property="qtypeid" column="qtypeid"></result>
19
-            <result property="qtypename" column="qtypename"></result>
20
-            <result property="answer" column="answer"></result>
21
-            <result property="coord" column="coord"></result>
22
-        </collection>
23
-    </resultMap>
24
-
25
-    <select id="listCantronQtypes" resultMap="cantronQtypes">
26
-        select st.esstid,st.esid,st.epid,st.esstname,st.esstorder,st.esstnum,st.esstscore,
27
-               s.essid,s.ctype,s.questionid,s.qtypeid,s.qtypename,s.answer,s.coord
28
-        from e_subject_scantron_qtype st left join e_subject_scantron s on st.esstid=s.esstid
29
-        where st.esid=#{esid}
30
-    </select>
31
-
32
-    
33
-</mapper>

正在加载...
取消
保存