Browse Source

Merge remote-tracking branch 'cloud-schoolapi/ywx'

tags/正式版本
王宁 2 years ago
parent
commit
8db57c7a25

+ 19
- 9
sexam/src/main/java/com/xhkjedu/sexam/service/paper/EPaperQtypeService.java View File

@@ -71,12 +71,14 @@ public class EPaperQtypeService {
71 71
         }
72 72
 
73 73
         List<EPaperQtype> qtypelist = paper.getQtypelist();
74
-        List<EPaperQtypeQuestion> questions = new ArrayList<>();
75
-        qtypelist.forEach(t -> {
76
-            questions.addAll(t.getQuestions());
77
-        });
78
-        long count = questions.stream().map(q -> q.getQn()).distinct().count();
79
-        if (count < questions.size()) return new ResultVo(1, "题号不能重复");
74
+        if (paper.getPtype() == 2) {
75
+            List<EPaperQtypeQuestion> questions = new ArrayList<>();
76
+            qtypelist.forEach(t -> {
77
+                questions.addAll(t.getQuestions());
78
+            });
79
+            long count = questions.stream().map(q -> q.getQn()).distinct().count();
80
+            if (count < questions.size()) return new ResultVo(1, "题号不能重复");
81
+        }
80 82
 
81 83
         //说明已经有改考试对应的试卷,删除试卷中试题,试卷分析
82 84
         ePaperQtypeMapper.deleteByEpid(espVo.getEpid());
@@ -145,14 +147,22 @@ public class EPaperQtypeService {
145 147
         }
146 148
         ePaperQtypeMapper.insertList(qtypelist);//保存题型
147 149
         for(EPaperQtype qtype : qtypelist){
148
-            for(EPaperQtypeQuestion q : qtype.getQuestions()){
150
+            List<EPaperQtypeQuestion> questions = qtype.getQuestions();
151
+            Integer ctype = qtype.getCtype();
152
+            Integer ptype = epaper.getPtype();
153
+
154
+            for (int i = 0; i < questions.size(); i++) {
155
+                EPaperQtypeQuestion q=questions.get(i);
149 156
                 q.setEpid(epaper.getEpid());
150 157
                 q.setEptid(qtype.getId());
151 158
                 if(q.getOptionnum()==null){
152 159
                     q.setOptionnum(0);
153 160
                 }
154
-                if(epaper.getPtype() == 1){
155
-                    q.setQn(q.getQorder().toString());
161
+                Integer qorder = q.getQorder();
162
+                if (ptype == 1 && ctype != 11) {
163
+                    q.setQn(qorder.toString());
164
+                } else if (ptype == 1 && ctype == 11) {
165
+                    q.setQn(qorder + "." + (i + 1));
156 166
                 }
157 167
                 if(q.getCtype() == 14){
158 168
                     q.setGnum(900);//语文作文格数

Loading…
Cancel
Save