Browse Source

模板题块

ywx
王宁 3 months ago
parent
commit
21e4c6cfec

+ 17
- 3
smarking/src/main/java/com/xhkjedu/smarking/controller/paper/MsTemplateController.java View File

41
     }
41
     }
42
 
42
 
43
     /**
43
     /**
44
-     * @Description 模-新增
44
+     * @Description 模-新增
45
      * @Param [msTemplate]
45
      * @Param [msTemplate]
46
      * @Author auto
46
      * @Author auto
47
      * @Date 2024-10-15
47
      * @Date 2024-10-15
55
     }
55
     }
56
 
56
 
57
     /*
57
     /*
58
-     * @Description 模-设置
58
+     * @Description 模-设置
59
      * @Date 2024/10/21 10:55:50
59
      * @Date 2024/10/21 10:55:50
60
      * @Author WN
60
      * @Author WN
61
      * @Param [msTemplate]
61
      * @Param [msTemplate]
97
     }
97
     }
98
 
98
 
99
     /*
99
     /*
100
-     * @Description 模详情
100
+     * @Description 模详情
101
      * @Date 2024/10/23 14:06:38
101
      * @Date 2024/10/23 14:06:38
102
      * @Author WN
102
      * @Author WN
103
      * @Param [msTemplate]
103
      * @Param [msTemplate]
110
         return new ResultVo(0, "查询成功",rtnObj);
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 View File

18
 
18
 
19
     //根据试卷ID删除试卷题块
19
     //根据试卷ID删除试卷题块
20
     int deleteObjByMpidAndBlocktype(@Param("mpid")Integer mpid,@Param("blocktype")Integer blocktype);
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 View File

5
 import org.apache.ibatis.annotations.Param;
5
 import org.apache.ibatis.annotations.Param;
6
 
6
 
7
 import java.util.List;
7
 import java.util.List;
8
+import java.util.Map;
8
 
9
 
9
 /**
10
 /**
10
  * @Description 阅卷模块客观题定位区表 Mapper 接口
11
  * @Description 阅卷模块客观题定位区表 Mapper 接口
18
 
19
 
19
     //版信息详情
20
     //版信息详情
20
     List<MsTemplateBlock> listTemplateBlockQuestions(@Param("mtid")Integer mtid,@Param("mttype")Integer mttype);
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 View File

1
 package com.xhkjedu.smarking.service.paper;
1
 package com.xhkjedu.smarking.service.paper;
2
 
2
 
3
+import com.xhkjedu.smarking.mapper.exam.MsSubjectMapper;
3
 import com.xhkjedu.smarking.mapper.paper.MsPaperBlockMapper;
4
 import com.xhkjedu.smarking.mapper.paper.MsPaperBlockMapper;
4
 import com.xhkjedu.smarking.mapper.paper.MsPaperBlockQuestionMapper;
5
 import com.xhkjedu.smarking.mapper.paper.MsPaperBlockQuestionMapper;
5
 import com.xhkjedu.smarking.mapper.paper.MsPaperMapper;
6
 import com.xhkjedu.smarking.mapper.paper.MsPaperMapper;
28
     private MsPaperMapper msPaperMapper;
29
     private MsPaperMapper msPaperMapper;
29
     @Resource
30
     @Resource
30
     private MsPaperBlockQuestionMapper msPaperBlockQuestionMapper;
31
     private MsPaperBlockQuestionMapper msPaperBlockQuestionMapper;
32
+    @Resource
33
+    private MsSubjectMapper msSubjectMapper;
31
 
34
 
32
     /*
35
     /*
33
      * @Description 获取试卷所有题块
36
      * @Description 获取试卷所有题块
80
         }
83
         }
81
 
84
 
82
         msPaperBlockQuestionMapper.insertList(questions);
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 View File

1
 package com.xhkjedu.smarking.service.paper;
1
 package com.xhkjedu.smarking.service.paper;
2
 
2
 
3
+import com.xhkjedu.exception.MissingParametersException;
3
 import com.xhkjedu.smarking.mapper.exam.MsSubjectMapper;
4
 import com.xhkjedu.smarking.mapper.exam.MsSubjectMapper;
4
 import com.xhkjedu.smarking.mapper.paper.*;
5
 import com.xhkjedu.smarking.mapper.paper.*;
5
 import com.xhkjedu.smarking.model.paper.*;
6
 import com.xhkjedu.smarking.model.paper.*;
71
     }
72
     }
72
 
73
 
73
     /*
74
     /*
74
-     * @Description 设置模
75
+     * @Description 设置模
75
      * @Date 2024/10/21 10:47:00
76
      * @Date 2024/10/21 10:47:00
76
      * @Author WN
77
      * @Author WN
77
      * @Param [msTemplate]
78
      * @Param [msTemplate]
83
         msTemplateMapper.updateTemplateForCurrstep(msTemplate);
84
         msTemplateMapper.updateTemplateForCurrstep(msTemplate);
84
         //如果当前保存为6,则需要保存客观题信息
85
         //如果当前保存为6,则需要保存客观题信息
85
         if(msTemplate.getCurrstep() == 5){
86
         if(msTemplate.getCurrstep() == 5){
86
-            //模题块信息
87
+            //模题块信息
87
             List<MsTemplateBlock> tblocks = msTemplate.getTblocks();
88
             List<MsTemplateBlock> tblocks = msTemplate.getTblocks();
88
             savePaperBlockAndTemplate(tblocks,msTemplate);
89
             savePaperBlockAndTemplate(tblocks,msTemplate);
89
         }
90
         }
99
         return msTemplateMapper.selectByPrimaryKey(msTemplate.getMtid());
100
         return msTemplateMapper.selectByPrimaryKey(msTemplate.getMtid());
100
     }
101
     }
101
 
102
 
102
-    //保存客观题题块和模信息
103
+    //保存客观题题块和模信息
103
     private void savePaperBlockAndTemplate(List<MsTemplateBlock> tblocks,MsTemplate msTemplate){
104
     private void savePaperBlockAndTemplate(List<MsTemplateBlock> tblocks,MsTemplate msTemplate){
104
         Integer mpid = msTemplate.getMpid();
105
         Integer mpid = msTemplate.getMpid();
105
         Integer mtid = msTemplate.getMtid();
106
         Integer mtid = msTemplate.getMtid();
106
         Integer timestamp = N_Utils.getSecondTimestamp();
107
         Integer timestamp = N_Utils.getSecondTimestamp();
107
         Integer createid = msTemplate.getCreateid();
108
         Integer createid = msTemplate.getCreateid();
108
 
109
 
109
-        //保存之前先清除已保存的信息试卷客观题题块、模题块
110
+        //保存之前先清除已保存的信息试卷客观题题块、模题块
110
         msTemplateBlockMapper.deleteByMtidAndMtype(msTemplate.getMtid(),1);
111
         msTemplateBlockMapper.deleteByMtidAndMtype(msTemplate.getMtid(),1);
111
         msPaperBlockMapper.deleteObjByMpidAndBlocktype(mpid,1);
112
         msPaperBlockMapper.deleteObjByMpidAndBlocktype(mpid,1);
112
 
113
 
192
         Integer createid = params.getCreateid();
193
         Integer createid = params.getCreateid();
193
         Integer timestamp = N_Utils.getSecondTimestamp();
194
         Integer timestamp = N_Utils.getSecondTimestamp();
194
         List<MsTemplateBlock> templateBlocks = params.getTblocks();
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
         for (MsTemplateBlock templateBlock : templateBlocks){
206
         for (MsTemplateBlock templateBlock : templateBlocks){
199
             templateBlock.setMtid(mtid);
207
             templateBlock.setMtid(mtid);
200
             templateBlock.setMttype(2);
208
             templateBlock.setMttype(2);
201
             templateBlock.setCreateid(createid);
209
             templateBlock.setCreateid(createid);
202
             templateBlock.setCreatetime(timestamp);
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
         msTemplateMapper.updateTemplateTbstate(mtid,1);
220
         msTemplateMapper.updateTemplateTbstate(mtid,1);
208
-        //获取试卷中所有模版题块框选状态
221
+        //获取试卷中所有模题块框选状态
209
         int tbnum = msTemplateMapper.getUnSelTemplateCount(mpid);
222
         int tbnum = msTemplateMapper.getUnSelTemplateCount(mpid);
210
-        int pbstate;
211
         if(tbnum == 0){
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
     }
239
     }
230
 
240
 
231
     /*
241
     /*
232
-     * @Description 获取模详情
242
+     * @Description 获取模详情
233
      * @Date 2024/10/23 11:47:48
243
      * @Date 2024/10/23 11:47:48
234
      * @Author WN
244
      * @Author WN
235
      * @Param [mtid]
245
      * @Param [mtid]
240
         msTemplate.setTblocks(msTemplateBlockMapper.listTemplateBlockQuestions(mt.getMtid(),mt.getMttype()));
250
         msTemplate.setTblocks(msTemplateBlockMapper.listTemplateBlockQuestions(mt.getMtid(),mt.getMttype()));
241
         return msTemplate;
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 View File

42
         </if>
42
         </if>
43
     </delete>
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
 </mapper>
50
 </mapper>

+ 6
- 0
smarking/src/main/resources/mapper/paper/MsTemplateBlockMapper.xml View File

38
         </if>
38
         </if>
39
         order by b.mtborder,q.mtbqorder
39
         order by b.mtborder,q.mtbqorder
40
     </select>
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
 </mapper>
47
 </mapper>

+ 1
- 1
smarking/src/main/resources/mapper/paper/MsTemplateMapper.xml View File

45
 
45
 
46
     <!--获取试卷未框选主观题模板数量-->
46
     <!--获取试卷未框选主观题模板数量-->
47
     <select id="getUnSelTemplateCount" resultType="java.lang.Integer">
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
     </select>
49
     </select>
50
 </mapper>
50
 </mapper>

Loading…
Cancel
Save