Browse Source

完善附件、题库试卷

tags/正式版本
王宁 2 years ago
parent
commit
6bcebd22f1
26 changed files with 268 additions and 208 deletions
  1. 16
    1
      scommons/src/main/java/com/xhkjedu/utils/N_Utils.java
  2. 1
    1
      sexam/src/main/java/com/xhkjedu/sexam/controller/paper/EPaperFjtypeController.java
  3. 0
    7
      sexam/src/main/java/com/xhkjedu/sexam/controller/paper/EPaperQtypeController.java
  4. 1
    25
      sexam/src/main/java/com/xhkjedu/sexam/controller/paper/ESubjectScantronController.java
  5. 6
    0
      sexam/src/main/java/com/xhkjedu/sexam/mapper/paper/EPaperFileMapper.java
  6. 7
    0
      sexam/src/main/java/com/xhkjedu/sexam/mapper/paper/ESubjectScantronMapper.java
  7. 14
    0
      sexam/src/main/java/com/xhkjedu/sexam/mapper/system/UserBasketMapper.java
  8. 3
    0
      sexam/src/main/java/com/xhkjedu/sexam/model/paper/EPaperFjtype.java
  9. 3
    0
      sexam/src/main/java/com/xhkjedu/sexam/model/paper/EPaperQtype.java
  10. 6
    12
      sexam/src/main/java/com/xhkjedu/sexam/model/paper/ESubjectScantron.java
  11. 5
    2
      sexam/src/main/java/com/xhkjedu/sexam/model/paper/ESubjectScantronQtype.java
  12. 17
    12
      sexam/src/main/java/com/xhkjedu/sexam/service/paper/EPaperFjtypeService.java
  13. 85
    67
      sexam/src/main/java/com/xhkjedu/sexam/service/paper/EPaperQtypeService.java
  14. 3
    20
      sexam/src/main/java/com/xhkjedu/sexam/service/paper/ESubjectScantronService.java
  15. 21
    5
      sexam/src/main/java/com/xhkjedu/sexam/vo/paper/EPaperQtypeQuestionVo.java
  16. 3
    0
      sexam/src/main/java/com/xhkjedu/sexam/vo/paper/EPaperQtypeVo.java
  17. 4
    1
      sexam/src/main/resources/mapper/paper/EPaperFileMapper.xml
  18. 2
    1
      sexam/src/main/resources/mapper/paper/EPaperFjtypeMapper.xml
  19. 17
    36
      sexam/src/main/resources/mapper/paper/EPaperQtypeMapper.xml
  20. 33
    0
      sexam/src/main/resources/mapper/paper/ESubjectScantronMapper.xml
  21. 7
    0
      sexam/src/main/resources/mapper/system/UserBasketMapper.xml
  22. 0
    9
      sexam/src/test/java/com/xhkjedu/sexam/SexamApplicationTests.java
  23. 3
    3
      sstudy/src/main/java/com/xhkjedu/sstudy/model/question/TQuestion.java
  24. 4
    5
      sstudy/src/main/java/com/xhkjedu/sstudy/service/question/QuestionService.java
  25. 6
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/vo/question/QuestionVo.java
  26. 1
    1
      sstudy/src/main/resources/mapper/paperstudent/PaperStudentMapper.xml

+ 16
- 1
scommons/src/main/java/com/xhkjedu/utils/N_Utils.java View File

@@ -577,6 +577,21 @@ public class N_Utils {
577 577
         return count.doubleValue();
578 578
     }
579 579
 
580
+    //两个double 类型相加
581
+    public static Double getDoubleSum(Double value1,Double value2){
582
+        BigDecimal b1 = new BigDecimal(Double.toString(value1));
583
+        BigDecimal b2 = new BigDecimal(Double.toString(value2));
584
+
585
+        return b1.add(b2).doubleValue();
586
+    }
587
+    //两个double 类型相减
588
+    public static Double getDoubleReduce(Double value1,Double value2){
589
+        BigDecimal b1 = new BigDecimal(Double.toString(value1));
590
+        BigDecimal b2 = new BigDecimal(Double.toString(value2));
591
+
592
+        return b1.subtract(b2).doubleValue();
593
+    }
594
+
580 595
     //计算比例向下取整
581 596
     public static Integer floorDiv(Integer num,Integer totalNum) {
582 597
         if (isEmptyInteger(totalNum) || isEmptyInteger(num)) return 0;
@@ -1012,7 +1027,7 @@ public class N_Utils {
1012 1027
     /**
1013 1028
      * @Description 判断ctype是否是客观题
1014 1029
      * @Param [ctype]
1015
-     * @Return boolean 如果是客观题返回true,否则返回主观题
1030
+     * @Return boolean 如果是客观题返回true,否则返回false
1016 1031
      * @Author wn
1017 1032
      * @Date 2022/7/20 15:20
1018 1033
      **/

+ 1
- 1
sexam/src/main/java/com/xhkjedu/sexam/controller/paper/EPaperFjtypeController.java View File

@@ -92,7 +92,7 @@ public class EPaperFjtypeController {
92 92
      * @Author wn
93 93
      * @Date 2022/7/19 15:02
94 94
      **/
95
-    @PostMapping("/sans")
95
+    @PostMapping("/answer")
96 96
     public ResultVo savePaperQuestionAnswer(@RequestBody EPaper paper){
97 97
         N_Utils.validation(new Object[]{paper.getEpid(),"试卷id",1});
98 98
         if(paper.getFjqueslist()==null || paper.getFjqueslist().size() ==0){

+ 0
- 7
sexam/src/main/java/com/xhkjedu/sexam/controller/paper/EPaperQtypeController.java View File

@@ -75,11 +75,4 @@ public class EPaperQtypeController {
75 75
         Map map = ePaperQtypeService.getPaperQtDetail(paper.getEpid());
76 76
         return new ResultVo(0,"成功获取试卷详情",map);
77 77
     }
78
-
79
-    @PostMapping("/savean")
80
-    public ResultVo saveAlype(@RequestBody EPaper paper){
81
-        N_Utils.validation(new Object[]{paper.getEpid(),"试卷id",1});
82
-        ePaperQtypeService.savePaperAnalyze(paper);
83
-        return new ResultVo(0,"成功保存试卷分析");
84
-    }
85 78
 }

+ 1
- 25
sexam/src/main/java/com/xhkjedu/sexam/controller/paper/ESubjectScantronController.java View File

@@ -23,33 +23,9 @@ public class ESubjectScantronController {
23 23
 
24 24
     @PostMapping("/add")
25 25
     public ResultVo add(@RequestBody ESubjectScantron eSubjectScantron) {
26
-        eSubjectScantronService.save(eSubjectScantron);
26
+        eSubjectScantronService.saveSubjectScantron(eSubjectScantron);
27 27
         return new ResultVo(0,"保存成功");
28 28
     }
29 29
 
30
-    @PostMapping("/delete")
31
-    public ResultVo delete(@RequestBody ESubjectScantron eSubjectScantron) {
32
-        eSubjectScantronService.deleteById(eSubjectScantron.getId());
33
-        return new ResultVo(0,"删除成功");
34
-    }
35
-
36
-    @PostMapping("/update")
37
-    public ResultVo update(@RequestBody ESubjectScantron eSubjectScantron) {
38
-        eSubjectScantronService.update(eSubjectScantron);
39
-        return new ResultVo(0,"修改成功");
40
-    }
41 30
 
42
-    @PostMapping("/detail")
43
-    public ResultVo detail(@RequestBody ESubjectScantron eSubjectScantron) {
44
-        ESubjectScantron es = eSubjectScantronService.findById(eSubjectScantron.getId());
45
-        return new ResultVo(0,"获取详情成功",es);
46
-    }
47
-
48
-    @PostMapping("/list")
49
-    public ResultVo list(@RequestBody ESubjectScantron eSubjectScantron) {
50
-        PageHelper.startPage(eSubjectScantron.getPage(), eSubjectScantron.getPageSize());
51
-        List<ESubjectScantron> list = eSubjectScantronService.listAll();
52
-        PageResult pageResult = PageUtil.getPageResult(new PageInfo(list));
53
-        return new ResultVo(0,"获取列表成功",pageResult);
54
-    }
55 31
 }

+ 6
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/paper/EPaperFileMapper.java View File

@@ -2,6 +2,10 @@ package com.xhkjedu.sexam.mapper.paper;
2 2
 
3 3
 import com.xhkjedu.sexam.base.TkMapper;
4 4
 import com.xhkjedu.sexam.model.paper.EPaperFile;
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+import java.util.List;
8
+import java.util.Map;
5 9
 
6 10
 /**
7 11
  * @Description 附件试卷文件
@@ -9,4 +13,6 @@ import com.xhkjedu.sexam.model.paper.EPaperFile;
9 13
  * Date 2022/7/18 14:10
10 14
  **/
11 15
 public interface EPaperFileMapper extends TkMapper<EPaperFile> {
16
+
17
+    List<Map> listPaperFiles(@Param("epid") Integer epid);
12 18
 }

+ 7
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/paper/ESubjectScantronMapper.java View File

@@ -2,6 +2,13 @@ package com.xhkjedu.sexam.mapper.paper;
2 2
 
3 3
 import com.xhkjedu.sexam.base.TkMapper;
4 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;
5 9
 
6 10
 public interface ESubjectScantronMapper extends TkMapper<ESubjectScantron> {
11
+
12
+    //答题卡中试题详情
13
+    List<Map> cantronQtypes(@Param("esid")Integer esid);
7 14
 }

+ 14
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/system/UserBasketMapper.java View File

@@ -0,0 +1,14 @@
1
+package com.xhkjedu.sexam.mapper.system;
2
+
3
+import org.apache.ibatis.annotations.Param;
4
+
5
+/**
6
+ * @Description
7
+ * @Author WN
8
+ * Date 2022/7/21 17:48
9
+ **/
10
+public interface UserBasketMapper {
11
+
12
+    //试清空试题栏
13
+    void deleteByUseridAndSubjectid(@Param("userid")Integer userid,@Param("subjectid")String subjectid);
14
+}

+ 3
- 0
sexam/src/main/java/com/xhkjedu/sexam/model/paper/EPaperFjtype.java View File

@@ -18,6 +18,9 @@ public class EPaperFjtype extends BaseBean {
18 18
     //试卷id
19 19
     private Integer epid;
20 20
 
21
+    //处理题型
22
+    private Integer ctype;
23
+
21 24
     //题型名称
22 25
     private String epfjname;
23 26
 

+ 3
- 0
sexam/src/main/java/com/xhkjedu/sexam/model/paper/EPaperQtype.java View File

@@ -19,6 +19,9 @@ public class EPaperQtype extends BaseBean {
19 19
     //试卷id
20 20
     private Integer epid;
21 21
 
22
+    //处理题型
23
+    private Integer ctype;
24
+
22 25
     //题型名称
23 26
     private String eptname;
24 27
 

+ 6
- 12
sexam/src/main/java/com/xhkjedu/sexam/model/paper/ESubjectScantron.java View File

@@ -13,8 +13,8 @@ public class ESubjectScantron extends BaseBean {
13 13
     //试卷科目答题卡表
14 14
     private Integer essid;
15 15
 
16
-    //考试id
17
-    private Integer examid;
16
+    //考试科目id
17
+    private Integer esid;
18 18
 
19 19
     //考试试卷id
20 20
     private Integer epid;
@@ -22,23 +22,17 @@ public class ESubjectScantron extends BaseBean {
22 22
     //答题卡题型表id
23 23
     private Integer esstid;
24 24
 
25
-    //试卷类型1题库2答题卡3仅答题卡
26
-    private Integer ptype;
27
-
28 25
     //试题处理题型
29 26
     private Integer ctype;
30 27
 
31 28
     //试题id
32 29
     private String questionid;
33 30
 
34
-    //题型id
35
-    private String qtypeid;
36
-
37
-    //题型名称
38
-    private String qtypename;
39
-
40 31
     //题号
41
-    private String order;
32
+    private String qn;
33
+
34
+    //试题排序
35
+    private Integer order;
42 36
 
43 37
     //分值
44 38
     private Double score;

+ 5
- 2
sexam/src/main/java/com/xhkjedu/sexam/model/paper/ESubjectScantronQtype.java View File

@@ -15,12 +15,15 @@ public class ESubjectScantronQtype extends BaseBean {
15 15
     //试卷科目答题卡题型表
16 16
     private Integer esstid;
17 17
 
18
-    //考试id
19
-    private Integer examid;
18
+    //考试科目id
19
+    private Integer esid;
20 20
 
21 21
     //考试试卷表
22 22
     private Integer epid;
23 23
 
24
+    //处理题型
25
+    private Integer ctype;
26
+
24 27
     //题型名称
25 28
     private String esstname;
26 29
 

+ 17
- 12
sexam/src/main/java/com/xhkjedu/sexam/service/paper/EPaperFjtypeService.java View File

@@ -6,15 +6,13 @@ import com.xhkjedu.sexam.mapper.paper.*;
6 6
 import com.xhkjedu.sexam.model.exam.ESubject;
7 7
 import com.xhkjedu.sexam.model.paper.*;
8 8
 import com.xhkjedu.sexam.vo.paper.EPaperQsVo;
9
+import com.xhkjedu.sexam.vo.paper.EPaperQtypeQuestionVo;
9 10
 import com.xhkjedu.utils.N_Utils;
10 11
 import org.springframework.stereotype.Service;
11 12
 import org.springframework.transaction.annotation.Transactional;
12 13
 
13 14
 import javax.annotation.Resource;
14
-import java.util.ArrayList;
15
-import java.util.HashMap;
16
-import java.util.List;
17
-import java.util.Map;
15
+import java.util.*;
18 16
 import java.util.stream.Collectors;
19 17
 
20 18
 /**
@@ -132,7 +130,7 @@ public class EPaperFjtypeService {
132 130
         int knum = 0;
133 131
         double kscore = 0;
134 132
         for(EPaperFjtypeQuestion q : queslist){
135
-            if(q.getCtype() == 3 || q.getCtype() == 11){
133
+            if(N_Utils.isObjectiveQuestion(q.getCtype())){
136 134
                 znum ++;
137 135
                 zscore = zscore + q.getScore();
138 136
             }else{
@@ -155,15 +153,20 @@ public class EPaperFjtypeService {
155 153
         ztmap.put("pscore",ePaper.getPscore());
156 154
         ztmap.put("ranglist",ranglist);
157 155
 
158
-        //题型分布(保存大题型及分组)
156
+        //题型分布(按照名称进行分组)
157
+        fjtypelist.stream().sorted(Comparator.comparing(EPaperFjtype::getEpfjorder)).collect(Collectors.toList());
158
+        Map<String,List<EPaperFjtype>> qtypemap =  fjtypelist.stream().collect(Collectors.groupingBy(EPaperFjtype:: getEpfjname, Collectors.toList()));
159 159
         List<EPaperQsVo> qtlist = new ArrayList<>();
160
-        for(EPaperFjtype fjt : fjtypelist){
160
+        for(Map.Entry<String, List<EPaperFjtype>> entry : qtypemap.entrySet()){
161
+            List<EPaperFjtype> aq = entry.getValue();
162
+            int num = aq.stream().mapToInt(EPaperFjtype::getEpfjnum).sum();
163
+            double tscore = aq.stream().collect(Collectors.summingDouble(EPaperFjtype:: getEpfjscore));
164
+            double storerate = N_Utils.getDoubleDivideAndMulitiply(tscore, ePaper.getPscore());
161 165
             EPaperQsVo qvo = new EPaperQsVo();
162
-            qvo.setQtname(fjt.getEpfjname());
163
-            qvo.setNum(fjt.getEpfjnum());
164
-            qvo.setScore(fjt.getEpfjscore());
165
-            double scorerate = N_Utils.getDoubleDivideAndMulitiply(fjt.getEpfjscore(), ePaper.getPscore());
166
-            qvo.setSrate(scorerate);
166
+            qvo.setQtname(entry.getKey());
167
+            qvo.setNum(num);
168
+            qvo.setScore(tscore);
169
+            qvo.setSrate(storerate);
167 170
             qtlist.add(qvo);
168 171
         }
169 172
 
@@ -211,7 +214,9 @@ public class EPaperFjtypeService {
211 214
     public Map getPaperFjDetail(Integer epid){
212 215
         Map map = ePaperMapper.getExamPaperDetailByEpid(epid);//试卷信息
213 216
         List<Map> fjtypelist = ePaperFjtypeMapper.listPaperFjtypeQuestions(epid);//试卷题型试题信息
217
+        List<Map> fileslist = ePaperFileMapper.listPaperFiles(epid);//附件集合
214 218
         map.put("qtypes",fjtypelist);
219
+        map.put("files",fileslist);
215 220
         return map;
216 221
     }
217 222
 

+ 85
- 67
sexam/src/main/java/com/xhkjedu/sexam/service/paper/EPaperQtypeService.java View File

@@ -6,6 +6,7 @@ import com.xhkjedu.sexam.mapper.paper.EPaperAnalyzeMapper;
6 6
 import com.xhkjedu.sexam.mapper.paper.EPaperMapper;
7 7
 import com.xhkjedu.sexam.mapper.paper.EPaperQtypeMapper;
8 8
 import com.xhkjedu.sexam.mapper.paper.EPaperQtypeQuestionMapper;
9
+import com.xhkjedu.sexam.mapper.system.UserBasketMapper;
9 10
 import com.xhkjedu.sexam.model.exam.ESubject;
10 11
 import com.xhkjedu.sexam.model.paper.*;
11 12
 import com.xhkjedu.sexam.vo.paper.EPaperQPointVo;
@@ -38,6 +39,9 @@ public class EPaperQtypeService {
38 39
     @Resource
39 40
     private ESubjectMapper eSubjectMapper;
40 41
 
42
+    @Resource
43
+    private UserBasketMapper userBasketMapper;
44
+
41 45
 
42 46
     /**
43 47
      * @Description 保存题库试卷
@@ -67,6 +71,8 @@ public class EPaperQtypeService {
67 71
             eSubject.setEsstate(1);
68 72
             eSubjectMapper.updateExamSubjectState(eSubject);
69 73
         }
74
+        //保存后清除试题栏中试题
75
+        userBasketMapper.deleteByUseridAndSubjectid(paper.getCreateid(),eSubject.getSubjectid());
70 76
     }
71 77
 
72 78
     //设置试卷基本信息
@@ -112,97 +118,109 @@ public class EPaperQtypeService {
112 118
     }
113 119
 
114 120
     //保存试卷分析List<EPaperQtype> qtypelist,List<EPaperQtypeQuestion> queslist
115
-    public void savePaperAnalyze(EPaper ePaper){
121
+    private void savePaperAnalyze(EPaper ePaper){
116 122
         //保存之前先清除之前的试卷分析
117 123
         ePaperAnalyzeMapper.deleteByEpid(ePaper.getEpid());
118 124
         //总体分析(主观题、客观题)
119 125
         List<EPaperQtypeVo> qtypelist = ePaperQtypeMapper.listPaperQtypeQuestions(ePaper.getEpid());//试卷题型试题信息
120
-        List<EPaperQtypeQuestionVo> queslist = new ArrayList<>();//试卷中所有试题
121
-        List<EPaperQPointVo> quespoints = new ArrayList<>();//试卷中所有试题包含子题已经题号和对应知识点
126
+        List<EPaperQtypeQuestionVo> queslist = new ArrayList<>();//试卷中所有试题(子题)
127
+        List<EPaperQPointVo> quespoints = new ArrayList<>();//试卷中所有单题和子题以及对应知识点
122 128
 
123 129
         //处理题型1单选题2多选题3主观题4判断对错5判断√×6判断TF7完形填空8阅读理解10任务型阅读11综合题12听力
130
+        List<EPaperQsVo> typelist = new ArrayList<>();//题型分析
124 131
         //处理出试卷中所有试题、知识点
125 132
         for(EPaperQtypeVo qt : qtypelist){
126 133
             for(EPaperQtypeQuestionVo q : qt.getQuestions()){
127
-                queslist.add(q);
128
-                if(q.getQlevel() == 0 && q.getHasson() == 1){
129
-                    //说明试题有子题
130
-                    /*for(EPaperQtypeQuestionVo sq : q.getSonquestions()){
131
-                        List<EPaperQPointVo> pointslist = sq.getPoints();
132
-                        if(pointslist != null && pointslist.size()>0){
133
-                            for(EPaperQPointVo point : pointslist){
134
-                                EPaperQPointVo p = new EPaperQPointVo();
135
-                                p.setPointid(point.getPointid());
136
-                                p.setPointname(point.getPointname());
137
-                                p.setQuestionid(sq.getQuestionid());
138
-                                p.setOrder(q.getOrder());
139
-                                p.setScore(sq.getScore());
140
-                                quespoints.add(p);
141
-                            }
142
-                        }
143
-                    }*/
144
-                }else{
145
-                    List<EPaperQPointVo> pointslist = q.getPoints();
146
-                    if(pointslist != null && pointslist.size()>0){
147
-                        for(EPaperQPointVo point : pointslist){
148
-                            EPaperQPointVo p = new EPaperQPointVo();
149
-                            p.setPointid(point.getPointid());
150
-                            p.setPointname(point.getPointname());
151
-                            p.setQuestionid(q.getQuestionid());
152
-                            p.setOrder(q.getOrder());
153
-                            p.setScore(q.getScore());
154
-                            quespoints.add(p);
155
-                        }
134
+                //处理试题关联知识点
135
+                List<EPaperQPointVo> pointslist = q.getPoints();
136
+                if(pointslist != null && pointslist.size()>0){
137
+                    for(EPaperQPointVo point : pointslist){
138
+                        EPaperQPointVo p = new EPaperQPointVo();
139
+                        p.setPointid(point.getPointid());
140
+                        p.setPointname(point.getPointname());
141
+                        p.setQuestionid(q.getQuestionid());
142
+                        p.setOrder(q.getOrder());
143
+                        p.setScore(q.getScore());
144
+                        quespoints.add(p);
156 145
                     }
157 146
                 }
147
+                if(q.getQlevel()==1){
148
+                    q.setQuestionpid("000");
149
+                }
150
+                queslist.add(q);
158 151
             }
152
+
153
+            double storerate = N_Utils.getDoubleDivideAndMulitiply(qt.getEptscore(), ePaper.getPscore());
154
+            EPaperQsVo tvo = new EPaperQsVo();
155
+            tvo.setQtname(qt.getEptname());
156
+            tvo.setNum(qt.getEptnum());
157
+            tvo.setScore(qt.getEptscore());
158
+            tvo.setSrate(storerate);
159
+            typelist.add(tvo);
159 160
         }
160 161
 
161
-        //总体分布
162
-        int znum = 0;
163
-        double zscore = 0;
164
-        int knum = 0;
165
-        double kscore = 0;
166
-        for(EPaperQtypeQuestionVo q : queslist){
167
-            if(!N_Utils.isObjectiveQuestion(q.getCtype())){
168
-                znum ++;
169
-                zscore = zscore + q.getScore();
162
+        //获取出所有单题和母题,进行判断区分
163
+        Map<String,List<EPaperQtypeQuestionVo>> quesMap = queslist.stream().collect(Collectors.groupingBy(EPaperQtypeQuestionVo:: getQuestionpid, Collectors.toList()));
164
+        List<EPaperQtypeQuestionVo> mquestions = new ArrayList<>();//仅存放单题和母题
165
+        for(Map.Entry<String, List<EPaperQtypeQuestionVo>> entry : quesMap.entrySet()){
166
+            if(entry.getKey().equals("000")){
167
+                for(EPaperQtypeQuestionVo dq : entry.getValue()){
168
+                    if(N_Utils.isObjectiveQuestion(dq.getCtype())){
169
+                        //判断试题是否是客观题,暂时用mctype进行标识
170
+                        dq.setMctype(111);
171
+                    }else{
172
+                        dq.setMctype(112);
173
+                    }
174
+                    mquestions.add(dq);
175
+                }
170 176
             }else{
171
-                knum ++;
172
-                kscore = kscore + q.getScore();
177
+                EPaperQtypeQuestionVo mq = new EPaperQtypeQuestionVo();
178
+                List<EPaperQtypeQuestionVo> sonques = entry.getValue();
179
+                int k = 0;//如果k大于1说明有小题是主观题,则母题为主观题
180
+                double score = 0;
181
+                for(EPaperQtypeQuestionVo sq : sonques){
182
+                    if(!N_Utils.isObjectiveQuestion(sq.getCtype())){
183
+                        k++;
184
+                    }
185
+                    score = N_Utils.getDoubleSum(score,sq.getScore());
186
+                }
187
+
188
+                EPaperQtypeQuestionVo qobj = sonques.get(0);
189
+                mq.setQuestionid(qobj.getQuestionpid());
190
+                mq.setComplexity(qobj.getMcomplexity());
191
+                mq.setScore(score);
192
+                if(k == 0){
193
+                    mq.setMctype(111);
194
+                }else{
195
+                    mq.setMctype(112);
196
+                }
197
+                mquestions.add(mq);
173 198
             }
174 199
         }
175
-        double znumrate = N_Utils.getIntegerDivideAndMulitiply(znum, ePaper.getPnum());
176
-        double knumrate = 100-znumrate;
177
-        double zscorerate = N_Utils.getDoubleDivideAndMulitiply(zscore, ePaper.getPscore());
178
-        double kscorerate = 100 - zscorerate;
179 200
 
201
+        //试题总体分布进行分析
202
+        //客观题集合
203
+        List<EPaperQtypeQuestionVo> ktlst = mquestions.stream().filter(q->q.getMctype() == 111).collect(Collectors.toList());
204
+        int ktnum = ktlst.size();
205
+        double ktscore = ktlst.stream().collect(Collectors.summingDouble(EPaperQtypeQuestionVo:: getScore));
206
+        double ktnrate = N_Utils.getIntegerDivideAndMulitiply(ktnum, ePaper.getPnum());
207
+        double ktsrate = N_Utils.getDoubleDivideAndMulitiply(ktscore, ePaper.getPscore());
180 208
         List<EPaperQsVo> ranglist = new ArrayList<>();
181
-        ranglist.add(new EPaperQsVo("主观题",zscore,znum,zscorerate,znumrate));
182
-        ranglist.add(new EPaperQsVo("客观题",kscore,knum,kscorerate,knumrate));
183
-
209
+        ranglist.add(new EPaperQsVo("客观题",ktscore,ktnum,ktsrate,ktnrate));
210
+        EPaperQsVo zgq = new EPaperQsVo();
211
+        zgq.setQtname("主观题");
212
+        zgq.setNum(ePaper.getPnum() - ktnum);
213
+        zgq.setNrate(N_Utils.getDoubleReduce(100.0,ktnrate));
214
+        zgq.setScore(N_Utils.getDoubleReduce(ePaper.getPscore(),ktscore));
215
+        zgq.setSrate(N_Utils.getDoubleReduce(100.0,ktsrate));
216
+        ranglist.add(zgq);
184 217
         Map ztmap = new HashMap<>();
185 218
         ztmap.put("pnum", ePaper.getPnum());
186 219
         ztmap.put("pscore",ePaper.getPscore());
187 220
         ztmap.put("ranglist",ranglist);
188 221
 
189
-        //题型分布
190
-        queslist.stream().sorted(Comparator.comparing(EPaperQtypeQuestionVo::getOrder)).collect(Collectors.toList());
191
-        Map<String,List<EPaperQtypeQuestionVo>> qtypemap =  queslist.stream().collect(Collectors.groupingBy(EPaperQtypeQuestionVo:: getQtypeid, Collectors.toList()));
192
-        List<EPaperQsVo> typelist = new ArrayList<>();
193
-        for(Map.Entry<String, List<EPaperQtypeQuestionVo>> entry : qtypemap.entrySet()){
194
-            List<EPaperQtypeQuestionVo> aq = entry.getValue();
195
-            double tscore = aq.stream().collect(Collectors.summingDouble(EPaperQtypeQuestionVo:: getScore));
196
-            double storerate = N_Utils.getDoubleDivideAndMulitiply(tscore, ePaper.getPscore());
197
-            EPaperQsVo tvo = new EPaperQsVo();
198
-            tvo.setQtname(aq.get(0).getQtypename());
199
-            tvo.setNum(aq.size());
200
-            tvo.setScore(tscore);
201
-            tvo.setSrate(storerate);
202
-            typelist.add(tvo);
203
-        }
204 222
         //难易度
205
-        Map<Integer,List<EPaperQtypeQuestionVo>> complxmap =  queslist.stream().collect(Collectors.groupingBy(EPaperQtypeQuestionVo:: getComplexity, Collectors.toList()));
223
+        Map<Integer,List<EPaperQtypeQuestionVo>> complxmap =  mquestions.stream().collect(Collectors.groupingBy(EPaperQtypeQuestionVo:: getComplexity, Collectors.toList()));
206 224
         List<Map> clist = new ArrayList<>();
207 225
         for(Map.Entry<Integer, List<EPaperQtypeQuestionVo>> entry : complxmap.entrySet()){
208 226
             Map cmap = new HashMap();
@@ -227,7 +245,7 @@ public class EPaperQtypeService {
227 245
             pm.put("pointname",pvo.get(0).getPointname());
228 246
             pm.put("score",cscore);
229 247
             pm.put("srate",scorerate);
230
-            pm.put("order",thlist);
248
+            pm.put("order",thlist.stream().distinct().collect(Collectors.toList()));
231 249
             pointlist.add(pm);
232 250
         }
233 251
 

+ 3
- 20
sexam/src/main/java/com/xhkjedu/sexam/service/paper/ESubjectScantronService.java View File

@@ -4,6 +4,7 @@ import com.xhkjedu.sexam.mapper.paper.ESubjectScantronMapper;
4 4
 import com.xhkjedu.sexam.model.paper.ESubjectScantron;
5 5
 import com.xhkjedu.utils.N_Utils;
6 6
 import org.springframework.stereotype.Service;
7
+import org.springframework.transaction.annotation.Transactional;
7 8
 
8 9
 import javax.annotation.Resource;
9 10
 import java.util.List;
@@ -14,28 +15,10 @@ public class ESubjectScantronService {
14 15
     private ESubjectScantronMapper eSubjectScantronMapper;
15 16
 
16 17
     //添加
17
-    public void save(ESubjectScantron model) {
18
-        model.setCreatetime(N_Utils.getSecondTimestamp());
19
-        eSubjectScantronMapper.insertSelective(model);
20
-    }
18
+    @Transactional(rollbackFor = Exception.class)
19
+    public void saveSubjectScantron(ESubjectScantron model) {
21 20
 
22
-    //删除
23
-    public Integer deleteById(Integer id) {
24
-        return eSubjectScantronMapper.deleteByPrimaryKey(id);
25 21
     }
26 22
 
27
-    //修改
28
-    public Integer update(ESubjectScantron model) {
29
-        return eSubjectScantronMapper.updateByPrimaryKeySelective(model);
30
-    }
31 23
 
32
-    //获取详情
33
-    public ESubjectScantron findById(Integer id) {
34
-        return eSubjectScantronMapper.selectByPrimaryKey(id);
35
-    }
36
-
37
-    //获取列表
38
-    public List <ESubjectScantron> listAll() {
39
-        return eSubjectScantronMapper.selectAll();
40
-    }
41 24
 }

+ 21
- 5
sexam/src/main/java/com/xhkjedu/sexam/vo/paper/EPaperQtypeQuestionVo.java View File

@@ -51,18 +51,34 @@ public class EPaperQtypeQuestionVo {
51 51
     //难易度
52 52
     private Integer complexity;
53 53
 
54
-    //试题类型0母题1子题
54
+    //试题类型1单体2母题3子题
55 55
     private Integer qlevel;
56 56
 
57
-    //是否包含子题0不包含1包含
58
-    private Integer hasson;
57
+    //子题排序
58
+    private Integer sorder;
59 59
 
60 60
     //母题id
61 61
     private String questionpid;
62 62
 
63
+    //子题数量
64
+    private Integer snum;
65
+
66
+    //母题难易度
67
+    private Integer  mcomplexity;
68
+
69
+    //母题题干
70
+    private String  mqstem;
71
+
72
+    //母题题型id
73
+    private String mqtypeid;
74
+
75
+    //母题名称
76
+    private String mqtypename;
77
+
78
+    //母题处理题型
79
+    private Integer mctype;
80
+
63 81
     //试题关联知识点
64 82
     private List<EPaperQPointVo> points = new ArrayList<>();
65 83
 
66
-    //子试题集合
67
-    private List<EPaperQtypeQuestionVo> sonquestions = new ArrayList<>();
68 84
 }

+ 3
- 0
sexam/src/main/java/com/xhkjedu/sexam/vo/paper/EPaperQtypeVo.java View File

@@ -15,6 +15,9 @@ public class EPaperQtypeVo {
15 15
     //考试试卷题型表
16 16
     private Integer eptid;
17 17
 
18
+    //处理题型
19
+    private Integer ctype;
20
+
18 21
     //题型名称
19 22
     private String eptname;
20 23
 

+ 4
- 1
sexam/src/main/resources/mapper/paper/EPaperFileMapper.xml View File

@@ -2,5 +2,8 @@
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 3
 <mapper namespace="com.xhkjedu.sexam.mapper.paper.EPaperFileMapper">
4 4
 
5
-
5
+    <!--获取文件附件-->
6
+    <select id="listPaperFiles" resultType="java.util.Map">
7
+        select * from e_paper_file where epid=#{epid}
8
+    </select>
6 9
 </mapper>

+ 2
- 1
sexam/src/main/resources/mapper/paper/EPaperFjtypeMapper.xml View File

@@ -6,6 +6,7 @@
6 6
     <resultMap id="fjtypeQuestions" type="java.util.Map">
7 7
         <result column="epfjid" property="epfjid"></result>
8 8
         <result column="epid" property="epid"></result>
9
+        <result column="ctype" property="ctype"></result>
9 10
         <result column="epfjname" property="epfjname"></result>
10 11
         <result column="epfjnum" property="epfjnum"></result>
11 12
         <result column="epfjorder" property="epfjorder"></result>
@@ -24,7 +25,7 @@
24 25
         </collection>
25 26
     </resultMap>
26 27
     <select id="listPaperFjtypeQuestions" resultMap="fjtypeQuestions">
27
-        select t.epfjid,t.epid,t.epfjname,t.epfjnum,t.epfjorder,t.epfjscore,
28
+        select t.epfjid,t.epid,t.ctype,t.epfjname,t.epfjnum,t.epfjorder,t.epfjscore,
28 29
                q.epfjqid,q.epfjid,q.epid,q.qtypeid,q.qtypename,q.ctype,q.score,q.qn,q.order,q.answer,q.optionnum
29 30
         from e_paper_fjtype t left join e_paper_fjtype_question q on t.epfjid=q.epfjid
30 31
         where t.epid=#{epid} order by t.epfjorder,q.order

+ 17
- 36
sexam/src/main/resources/mapper/paper/EPaperQtypeMapper.xml View File

@@ -5,6 +5,7 @@
5 5
     <!--试卷题型试题信息-->
6 6
     <resultMap id="qtypesQuestion" type="com.xhkjedu.sexam.vo.paper.EPaperQtypeVo">
7 7
         <result column="eptid" property="eptid"></result>
8
+        <result column="ctype" property="ctype"></result>
8 9
         <result column="eptname" property="eptname"></result>
9 10
         <result column="eptnum" property="eptnum"></result>
10 11
         <result column="eptorder" property="eptorder"></result>
@@ -24,47 +25,31 @@
24 25
             <result column="qanalyze" property="qanalyze"></result>
25 26
             <result column="complexity" property="complexity"></result>
26 27
             <result column="qlevel" property="qlevel"></result>
27
-            <result column="hasson" property="hasson"></result>
28
+            <result column="sorder" property="sorder"></result>
29
+            <result column="snum" property="snum"></result>
30
+            <result column="questionpid" property="questionpid"></result>
31
+            <result column="mqstem" property="mqstem"></result>
32
+            <result column="mcomplexity" property="mcomplexity"></result>
33
+            <result column="mqtypeid" property="mqtypeid"></result>
34
+            <result column="mqtypename" property="mqtypename"></result>
35
+            <result column="mctype" property="mctype"></result>
28 36
             <collection property="points" ofType="com.xhkjedu.sexam.vo.paper.EPaperQPointVo" javaType="java.util.List"
29 37
                         column="questionid" select="listQuestionPoints">
30 38
                 <result column="pointid" property="pointid"></result>
31 39
                 <result column="pointname" property="pointname"></result>
32 40
             </collection>
33
-            <collection property="sonquestions" ofType="com.xhkjedu.sexam.vo.paper.EPaperQtypeQuestionVo" javaType="java.util.List"
34
-                        column="questionid" select="listSonQuestions" >
35
-            </collection>
36
-        </collection>
37
-    </resultMap>
38
-    <!--子题信息和关联知识点(题型-母题-子题-子题知识点 不能放在一个resultMap中处理不支持三层)-->
39
-    <resultMap id="qtypeSonQuestions" type="com.xhkjedu.sexam.vo.paper.EPaperQtypeQuestionVo">
40
-        <result column="questionid" property="questionid"></result>
41
-        <result column="score" property="score"></result>
42
-        <result column="order" property="order"></result>
43
-        <result column="qtypeid" property="qtypeid"></result>
44
-        <result column="qtypename" property="qtypename"></result>
45
-        <result column="ctype" property="ctype"></result>
46
-        <result column="qstem" property="qstem"></result>
47
-        <result column="qoption" property="qoption"></result>
48
-        <result column="qanswer" property="qanswer"></result>
49
-        <result column="qanalyze" property="qanalyze"></result>
50
-        <result column="complexity" property="complexity"></result>
51
-        <result column="qlevel" property="qlevel"></result>
52
-        <result column="hasson" property="hasson"></result>
53
-        <result column="questionpid" property="questionpid"></result>
54
-        <collection property="points" ofType="com.xhkjedu.sexam.vo.paper.EPaperQPointVo" javaType="java.util.List"
55
-                    column="questionid" select="listQuestionPoints">
56
-            <result column="pointid" property="pointid"></result>
57
-            <result column="pointname" property="pointname"></result>
58 41
         </collection>
59 42
     </resultMap>
60 43
     <!--试题详情-->
61 44
     <select id="listPaperQtypeQuestions" resultMap="qtypesQuestion">
62
-        select t.eptid,t.epid,t.eptname,t.eptnum,t.eptorder,t.eptscore,tq.eptqid,tq.questionid,
45
+        select t.eptid,t.epid,t.ctype,t.eptname,t.eptnum,t.eptorder,t.eptscore,tq.eptqid,tq.questionid,
63 46
                tq.score,tq.order,q.qtypeid,q.qtypename,q.ctype,q.qstem,q.qoption,q.qanswer,q.qanalyze,
64
-               q.complexity,q.qlevel,q.hasson
47
+               q.complexity,q.qlevel,q.sorder,q.questionpid,fq.snum,fq.qstem as mqstem,fq.complexity as mcomplexity,
48
+               fq.qtypeid mqtypeid,fq.qtypename mqtypename,fq.ctype mctype
65 49
         from e_paper_qtype_question tq left join e_paper_qtype t on t.eptid=tq.eptid
66
-                             left join t_question q on tq.questionid=q.questionid
67
-        where t.epid=#{epid} order by t.eptorder,tq.order
50
+        left join t_question q on tq.questionid=q.questionid
51
+        left JOIN t_question fq on q.questionpid=fq.questionid
52
+        where t.epid=#{epid} order by t.eptorder,tq.order,q.sorder
68 53
     </select>
69 54
     <!--试题关联知识点-->
70 55
     <select id="listQuestionPoints" resultType="com.xhkjedu.sexam.vo.paper.EPaperQPointVo">
@@ -72,11 +57,7 @@
72 57
         left join t_point p on qp.pointid=p.pointid
73 58
         where qp.questionid=#{questionid} order by p.pointorder
74 59
     </select>
75
-    <!--子题-->
76
-    <select id="listSonQuestions"  resultMap="qtypeSonQuestions">
77
-        select q.questionid,q.qtypeid,q.qtypename,q.ctype,q.qstem,q.qoption,q.qanswer,q.qanalyze,
78
-               q.complexity,q.qlevel,q.hasson,q.sorder,q.questionpid from t_question q
79
-        where q.questionpid=#{questionid} order by q.sorder
80
-    </select>
60
+
61
+
81 62
     
82 63
 </mapper>

+ 33
- 0
sexam/src/main/resources/mapper/paper/ESubjectScantronMapper.xml View File

@@ -0,0 +1,33 @@
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>

+ 7
- 0
sexam/src/main/resources/mapper/system/UserBasketMapper.xml View File

@@ -0,0 +1,7 @@
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.system.UserBasketMapper">
4
+    <delete id="deleteByUseridAndSubjectid">
5
+        delete from t_user_basket where userid=#{userid} and subjectid=#{subjectid}
6
+    </delete>
7
+</mapper>

+ 0
- 9
sexam/src/test/java/com/xhkjedu/sexam/SexamApplicationTests.java View File

@@ -15,15 +15,6 @@ class SexamApplicationTests {
15 15
 
16 16
     @Test
17 17
     void contextLoads() {
18
-        EPaper epaper = new EPaper();
19
-        epaper.setEpid(5);
20
-        epaper.setPnum(4);
21
-        epaper.setPscore(50.0);
22
-        saveA(epaper);
23
-    }
24
-
25
-    private void saveA(EPaper epaper){
26
-        ePaperQtypeService.savePaperAnalyze(epaper);
27 18
     }
28 19
 
29 20
 }

+ 3
- 3
sstudy/src/main/java/com/xhkjedu/sstudy/model/question/TQuestion.java View File

@@ -50,11 +50,11 @@ public class TQuestion extends BaseBean {
50 50
     //资源归属1平台1区平台3学校4个人(搜索时5我的收藏 6我的上传)
51 51
     private Integer belong;
52 52
 
53
-    //试题类型0母题1子题
53
+    //试题类型1单体2母题3子题
54 54
     private Integer qlevel;
55 55
 
56
-    //是否包含子题0不包含1包含
57
-    private Integer hasson;
56
+    //子题数量
57
+    private Integer snum;
58 58
 
59 59
     //子题排序
60 60
     private Integer sorder;

+ 4
- 5
sstudy/src/main/java/com/xhkjedu/sstudy/service/question/QuestionService.java View File

@@ -359,17 +359,16 @@ public class QuestionService {
359 359
         String questionid = StudyUtil.getId();
360 360
         question.setQuestionid(questionid);
361 361
         saveQues.add(question);
362
-        if(question.getQlevel() == 0 && question.getHasson() ==1){//是母体并且包含子题
362
+        //qlevel试题类型1单体2母题3子题
363
+        if(question.getQlevel() == 2){//是母体并且包含子题
363 364
             List<TQuestion> sonques = question.getQuestions();
364 365
             for(TQuestion sq : sonques){
365 366
                 String sqid = StudyUtil.getId();
366
-                sq.setQuestionpid(sqid);
367
+                sq.setQuestionid(sqid);
367 368
                 sq.setCount(0);
368 369
                 sq.setQstate(1);
369
-                sq.setQlevel(1);
370
-                sq.setHasson(0);
371 370
                 sq.setBelong(4);
372
-                sq.setQuestionid(questionid);
371
+                sq.setQuestionpid(questionid);
373 372
                 sq.setSubjectid(question.getSubjectid());
374 373
                 sq.setCreateid(question.getCreateid());
375 374
                 sq.setCreatetime(timestamp);

+ 6
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/vo/question/QuestionVo.java View File

@@ -51,6 +51,12 @@ public class QuestionVo {
51 51
     //试题关联章节
52 52
     private List<DirectorVo> directors;
53 53
 
54
+    //试题类型1单体2母题3子题
55
+    private Integer qlevel;
56
+
57
+    //子题数量
58
+    private Integer snum;
59
+
54 60
     //组题次数
55 61
     private Integer count;
56 62
 

+ 1
- 1
sstudy/src/main/resources/mapper/paperstudent/PaperStudentMapper.xml View File

@@ -218,7 +218,7 @@
218 218
         <if test="ps.stoptime!=null and ps.stoptime!=0">
219 219
             and UNIX_TIMESTAMP(FROM_UNIXTIME(pg.starttime,'%Y%m%d'))&lt;=#{ps.stoptime}
220 220
         </if>
221
-        GROUP BY ps.psid ORDER BY pg.starttime DESC,p.createtime DESC,p.psid desc
221
+        GROUP BY ps.psid ORDER BY pg.starttime DESC,p.createtime DESC,ps.psid desc
222 222
     </select>
223 223
     <!--提交作业-->
224 224
     <update id="submitPaper">

Loading…
Cancel
Save