|
@@ -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
|
}
|