Pārlūkot izejas kodu

模板题块

wn
王宁 pirms 2 mēnešiem
vecāks
revīzija
21e4c6cfec

+ 17
- 3
smarking/src/main/java/com/xhkjedu/smarking/controller/paper/MsTemplateController.java Parādīt failu

@@ -41,7 +41,7 @@ public class MsTemplateController {
41 41
     }
42 42
 
43 43
     /**
44
-     * @Description 模-新增
44
+     * @Description 模-新增
45 45
      * @Param [msTemplate]
46 46
      * @Author auto
47 47
      * @Date 2024-10-15
@@ -55,7 +55,7 @@ public class MsTemplateController {
55 55
     }
56 56
 
57 57
     /*
58
-     * @Description 模-设置
58
+     * @Description 模-设置
59 59
      * @Date 2024/10/21 10:55:50
60 60
      * @Author WN
61 61
      * @Param [msTemplate]
@@ -97,7 +97,7 @@ public class MsTemplateController {
97 97
     }
98 98
 
99 99
     /*
100
-     * @Description 模详情
100
+     * @Description 模详情
101 101
      * @Date 2024/10/23 14:06:38
102 102
      * @Author WN
103 103
      * @Param [msTemplate]
@@ -110,5 +110,19 @@ public class MsTemplateController {
110 110
         return new ResultVo(0, "查询成功",rtnObj);
111 111
     }
112 112
 
113
+    /*
114
+     * @Description 模板题块详情-主观题
115
+     * @Date 2024/10/24 10:25:43
116
+     * @Author WN
117
+     * @Param [msTemplate]
118
+     * @Return com.xhkjedu.vo.ResultVo
119
+     **/
120
+    @PostMapping("/detail_sub")
121
+    public ResultVo getSubjectiveBlocks(@RequestBody MsTemplate msTemplate) {
122
+        N_Utils.validation(new Object[]{msTemplate.getMtid(),"模板id",1});
123
+        List<Map<String,Object>> rtnObjs = msTemplateService.listTemplateBlocksByMtidAndType(msTemplate.getMtid());
124
+        return new ResultVo(0, "查询成功",rtnObjs);
125
+    }
126
+
113 127
 
114 128
 }

+ 3
- 0
smarking/src/main/java/com/xhkjedu/smarking/mapper/paper/MsPaperBlockMapper.java Parādīt failu

@@ -18,4 +18,7 @@ public interface MsPaperBlockMapper extends TkMapper<MsPaperBlock> {
18 18
 
19 19
     //根据试卷ID删除试卷题块
20 20
     int deleteObjByMpidAndBlocktype(@Param("mpid")Integer mpid,@Param("blocktype")Integer blocktype);
21
+
22
+    //获取试卷中所有主观题题块ID
23
+    List<Integer> listSubjectiveBlockidsByMpid(@Param("mpid")Integer mpid);
21 24
 }

+ 4
- 0
smarking/src/main/java/com/xhkjedu/smarking/mapper/paper/MsTemplateBlockMapper.java Parādīt failu

@@ -5,6 +5,7 @@ import com.xhkjedu.smarking.model.paper.MsTemplateBlock;
5 5
 import org.apache.ibatis.annotations.Param;
6 6
 
7 7
 import java.util.List;
8
+import java.util.Map;
8 9
 
9 10
 /**
10 11
  * @Description 阅卷模块客观题定位区表 Mapper 接口
@@ -18,4 +19,7 @@ public interface MsTemplateBlockMapper extends TkMapper<MsTemplateBlock> {
18 19
 
19 20
     //版信息详情
20 21
     List<MsTemplateBlock> listTemplateBlockQuestions(@Param("mtid")Integer mtid,@Param("mttype")Integer mttype);
22
+
23
+    //获取模版主观题题块信息
24
+    List<Map<String,Object>> listSubjectiveBlockQuestions(@Param("mtid")Integer mtid);
21 25
 }

+ 5
- 0
smarking/src/main/java/com/xhkjedu/smarking/service/paper/MsPaperBlockService.java Parādīt failu

@@ -1,5 +1,6 @@
1 1
 package com.xhkjedu.smarking.service.paper;
2 2
 
3
+import com.xhkjedu.smarking.mapper.exam.MsSubjectMapper;
3 4
 import com.xhkjedu.smarking.mapper.paper.MsPaperBlockMapper;
4 5
 import com.xhkjedu.smarking.mapper.paper.MsPaperBlockQuestionMapper;
5 6
 import com.xhkjedu.smarking.mapper.paper.MsPaperMapper;
@@ -28,6 +29,8 @@ public class MsPaperBlockService {
28 29
     private MsPaperMapper msPaperMapper;
29 30
     @Resource
30 31
     private MsPaperBlockQuestionMapper msPaperBlockQuestionMapper;
32
+    @Resource
33
+    private MsSubjectMapper msSubjectMapper;
31 34
 
32 35
     /*
33 36
      * @Description 获取试卷所有题块
@@ -80,6 +83,8 @@ public class MsPaperBlockService {
80 83
         }
81 84
 
82 85
         msPaperBlockQuestionMapper.insertList(questions);
86
+        //更改科目题块框选状态
87
+        msSubjectMapper.updatePbstateByMpid(mpid,1);//题块状态变成设置中
83 88
         //保存完题块后,需要清除之前已经生产的学生答案、批阅信息之类的数据,
84 89
         //知识点,难易度关联需要重新处理;新的题块试题需要绑定知识点,难度度如何处理?
85 90
 

+ 38
- 17
smarking/src/main/java/com/xhkjedu/smarking/service/paper/MsTemplateService.java Parādīt failu

@@ -1,5 +1,6 @@
1 1
 package com.xhkjedu.smarking.service.paper;
2 2
 
3
+import com.xhkjedu.exception.MissingParametersException;
3 4
 import com.xhkjedu.smarking.mapper.exam.MsSubjectMapper;
4 5
 import com.xhkjedu.smarking.mapper.paper.*;
5 6
 import com.xhkjedu.smarking.model.paper.*;
@@ -71,7 +72,7 @@ public class MsTemplateService {
71 72
     }
72 73
 
73 74
     /*
74
-     * @Description 设置模
75
+     * @Description 设置模
75 76
      * @Date 2024/10/21 10:47:00
76 77
      * @Author WN
77 78
      * @Param [msTemplate]
@@ -83,7 +84,7 @@ public class MsTemplateService {
83 84
         msTemplateMapper.updateTemplateForCurrstep(msTemplate);
84 85
         //如果当前保存为6,则需要保存客观题信息
85 86
         if(msTemplate.getCurrstep() == 5){
86
-            //模题块信息
87
+            //模题块信息
87 88
             List<MsTemplateBlock> tblocks = msTemplate.getTblocks();
88 89
             savePaperBlockAndTemplate(tblocks,msTemplate);
89 90
         }
@@ -99,14 +100,14 @@ public class MsTemplateService {
99 100
         return msTemplateMapper.selectByPrimaryKey(msTemplate.getMtid());
100 101
     }
101 102
 
102
-    //保存客观题题块和模信息
103
+    //保存客观题题块和模信息
103 104
     private void savePaperBlockAndTemplate(List<MsTemplateBlock> tblocks,MsTemplate msTemplate){
104 105
         Integer mpid = msTemplate.getMpid();
105 106
         Integer mtid = msTemplate.getMtid();
106 107
         Integer timestamp = N_Utils.getSecondTimestamp();
107 108
         Integer createid = msTemplate.getCreateid();
108 109
 
109
-        //保存之前先清除已保存的信息试卷客观题题块、模题块
110
+        //保存之前先清除已保存的信息试卷客观题题块、模题块
110 111
         msTemplateBlockMapper.deleteByMtidAndMtype(msTemplate.getMtid(),1);
111 112
         msPaperBlockMapper.deleteObjByMpidAndBlocktype(mpid,1);
112 113
 
@@ -192,29 +193,38 @@ public class MsTemplateService {
192 193
         Integer createid = params.getCreateid();
193 194
         Integer timestamp = N_Utils.getSecondTimestamp();
194 195
         List<MsTemplateBlock> templateBlocks = params.getTblocks();
195
-        //删除模块中题块定位数据
196
-        msTemplateBlockMapper.deleteByMtidAndMtype(mtid,2);
196
+        //获取试卷中所有主观题id
197
+        List<Integer> blockids = msPaperBlockMapper.listSubjectiveBlockidsByMpid(mpid);
198
+        List<Integer> selids = templateBlocks.stream().map(MsTemplateBlock::getMblockid).collect(Collectors.toList());
199
+
200
+        boolean areEqual = blockids.stream().sorted().collect(Collectors.toList())
201
+                                .equals(selids.stream().sorted().collect(Collectors.toList()));
202
+        if(!areEqual){
203
+            throw new MissingParametersException("题块未全部框选");
204
+        }
197 205
 
198 206
         for (MsTemplateBlock templateBlock : templateBlocks){
199 207
             templateBlock.setMtid(mtid);
200 208
             templateBlock.setMttype(2);
201 209
             templateBlock.setCreateid(createid);
202 210
             templateBlock.setCreatetime(timestamp);
203
-
204
-            msTemplateBlockMapper.insertList(templateBlocks);
205 211
         }
206
-        //更改模版题块框选状态
212
+
213
+        //删除模块中题块定位数据
214
+        msTemplateBlockMapper.deleteByMtidAndMtype(mtid,2);
215
+
216
+        //保存模块题块信息
217
+        msTemplateBlockMapper.insertList(templateBlocks);
218
+
219
+        //更改模板题块框选状态
207 220
         msTemplateMapper.updateTemplateTbstate(mtid,1);
208
-        //获取试卷中所有模版题块框选状态
221
+        //获取试卷中所有模题块框选状态
209 222
         int tbnum = msTemplateMapper.getUnSelTemplateCount(mpid);
210
-        int pbstate;
211 223
         if(tbnum == 0){
212
-            pbstate = 2;
213
-        }else{
214
-            pbstate = 1;
224
+            //更改科目题块框选状态已完成
225
+            msSubjectMapper.updatePbstateByMpid(mpid,2);
215 226
         }
216
-        //更改科目题块框选状态
217
-        msSubjectMapper.updatePbstateByMpid(mpid,pbstate);
227
+
218 228
     }
219 229
 
220 230
     /*
@@ -229,7 +239,7 @@ public class MsTemplateService {
229 239
     }
230 240
 
231 241
     /*
232
-     * @Description 获取模详情
242
+     * @Description 获取模详情
233 243
      * @Date 2024/10/23 11:47:48
234 244
      * @Author WN
235 245
      * @Param [mtid]
@@ -240,4 +250,15 @@ public class MsTemplateService {
240 250
         msTemplate.setTblocks(msTemplateBlockMapper.listTemplateBlockQuestions(mt.getMtid(),mt.getMttype()));
241 251
         return msTemplate;
242 252
     }
253
+
254
+    /*
255
+     * @Description 模板题块详情-主观题
256
+     * @Date 2024/10/24 10:24:05
257
+     * @Author WN
258
+     * @Param [mtid]
259
+     * @Return java.util.List<com.xhkjedu.smarking.model.paper.MsTemplateBlock>
260
+     **/
261
+    public List<Map<String,Object>> listTemplateBlocksByMtidAndType(Integer mtid){
262
+        return msTemplateBlockMapper.listSubjectiveBlockQuestions(mtid);
263
+    }
243 264
 }

+ 5
- 0
smarking/src/main/resources/mapper/paper/MsPaperBlockMapper.xml Parādīt failu

@@ -42,4 +42,9 @@
42 42
         </if>
43 43
     </delete>
44 44
 
45
+    <!--获取试卷中所有主观题题块ID-->
46
+    <select id="listSubjectiveBlockidsByMpid" resultType="com.xhkjedu.smarking.model.paper.MsPaperBlock">
47
+        select mblockid from ms_paper_block where mpid = #{mpid} and blocktype = 2 order by mblockid
48
+    </select>
49
+
45 50
 </mapper>

+ 6
- 0
smarking/src/main/resources/mapper/paper/MsTemplateBlockMapper.xml Parādīt failu

@@ -38,4 +38,10 @@
38 38
         </if>
39 39
         order by b.mtborder,q.mtbqorder
40 40
     </select>
41
+
42
+    <!--获取模版主观题题块信息-->
43
+    <select id="listSubjectiveBlockQuestions" resultType="java.util.Map">
44
+        select b.mtbid,b.mblockid,b.blockname,b.mttype,b.localcoor,b.pagenum,b.extendcoor,b.scorecoor,
45
+        b.mtborder from ms_template_block b where b.mtid=#{mtid} and b.mttype=2 order by b.mtborder
46
+    </select>
41 47
 </mapper>

+ 1
- 1
smarking/src/main/resources/mapper/paper/MsTemplateMapper.xml Parādīt failu

@@ -45,6 +45,6 @@
45 45
 
46 46
     <!--获取试卷未框选主观题模板数量-->
47 47
     <select id="getUnSelTemplateCount" resultType="java.lang.Integer">
48
-        select count(*) from ms_template where mpid=#{mpid} and tbstate != 2
48
+        select count(*) from ms_template where mpid=#{mpid} and tbstate=0
49 49
     </select>
50 50
 </mapper>

Notiek ielāde…
Atcelt
Saglabāt