|
@@ -113,12 +113,12 @@ public class MsScanbatchPaperService {
|
113
|
113
|
|
114
|
114
|
/**
|
115
|
115
|
* @Description 新增
|
116
|
|
- * @Param [msScanbatchPaper]
|
|
116
|
+ * @Param [msScanbatchPaper, stype:1代表是客户端调用接口保存,2代表服务端自己识别调用]
|
117
|
117
|
* @Author auto
|
118
|
118
|
* @Date 2024-10-15
|
119
|
119
|
**/
|
120
|
120
|
@Transactional(rollbackFor = Exception.class)
|
121
|
|
- public void savePaperIdentify(MsScanbatchPaper msScanbatchPaper){
|
|
121
|
+ public void savePaperIdentify(MsScanbatchPaper msScanbatchPaper,Integer stype){
|
122
|
122
|
|
123
|
123
|
Integer examstate = msScanbatchMapper.getExamStateByBatchid(msScanbatchPaper.getBatchid());
|
124
|
124
|
if(examstate == 3){
|
|
@@ -127,13 +127,18 @@ public class MsScanbatchPaperService {
|
127
|
127
|
|
128
|
128
|
//更改扫描、识别次数
|
129
|
129
|
if(N_Utils.isTrueInteger(msScanbatchPaper.getIdentified()) && msScanbatchPaper.getIdentified() == 1){
|
130
|
|
- msScanbatchMapper.updateScannumAndIdentifynum(msScanbatchPaper.getBatchid());
|
|
130
|
+ if(stype == 1){
|
|
131
|
+ msScanbatchMapper.updateScannumAndIdentifynum(msScanbatchPaper.getBatchid());
|
|
132
|
+ }else{
|
|
133
|
+ msScanbatchMapper.updateIdentifynum(msScanbatchPaper.getBatchid());
|
|
134
|
+ }
|
|
135
|
+
|
131
|
136
|
}else{
|
132
|
137
|
//保存一次,扫描次数加1
|
133
|
138
|
msScanbatchMapper.updateScannum(msScanbatchPaper.getBatchid());
|
134
|
139
|
//识别出错
|
135
|
140
|
msScanbatchPaper.setErrortype(1);
|
136
|
|
- savePaperBlockQuestions(msScanbatchPaper);
|
|
141
|
+ savePaperBlockQuestions(msScanbatchPaper, stype);
|
137
|
142
|
return;
|
138
|
143
|
}
|
139
|
144
|
|
|
@@ -145,7 +150,7 @@ public class MsScanbatchPaperService {
|
145
|
150
|
//考号不存在,异常信息2考号有误(异常类型1扫描出错 2考号有误 3考号重复 4缺考异常)
|
146
|
151
|
if(N_Utils.isEmpty(examno)){
|
147
|
152
|
msScanbatchPaper.setErrortype(2);
|
148
|
|
- savePaperBlockQuestions(msScanbatchPaper);
|
|
153
|
+ savePaperBlockQuestions(msScanbatchPaper, stype);
|
149
|
154
|
return;
|
150
|
155
|
}
|
151
|
156
|
|
|
@@ -153,7 +158,7 @@ public class MsScanbatchPaperService {
|
153
|
158
|
Integer errorNum = msScanbatchPaperMapper.getErrorNumByMpidAndExamno(msScanbatchPaper.getMpid(),examno);
|
154
|
159
|
if(errorNum > 0){
|
155
|
160
|
msScanbatchPaper.setErrortype(3);
|
156
|
|
- savePaperBlockQuestions(msScanbatchPaper);
|
|
161
|
+ savePaperBlockQuestions(msScanbatchPaper, stype);
|
157
|
162
|
return;
|
158
|
163
|
}
|
159
|
164
|
|
|
@@ -162,7 +167,7 @@ public class MsScanbatchPaperService {
|
162
|
167
|
//用户不存在,异常信息2考号有误
|
163
|
168
|
if(!N_Utils.isTrueInteger(userid)){
|
164
|
169
|
msScanbatchPaper.setErrortype(2);
|
165
|
|
- savePaperBlockQuestions(msScanbatchPaper);
|
|
170
|
+ savePaperBlockQuestions(msScanbatchPaper, stype);
|
166
|
171
|
return;
|
167
|
172
|
}
|
168
|
173
|
//用户存在,获取用户试卷信息
|
|
@@ -170,13 +175,13 @@ public class MsScanbatchPaperService {
|
170
|
175
|
//试卷不存在,异常信息1扫描出错
|
171
|
176
|
if(msPaperStudent == null){
|
172
|
177
|
msScanbatchPaper.setErrortype(1);
|
173
|
|
- savePaperBlockQuestions(msScanbatchPaper);
|
|
178
|
+ savePaperBlockQuestions(msScanbatchPaper, stype);
|
174
|
179
|
return;
|
175
|
180
|
}
|
176
|
181
|
//试卷存在,判断学生是否已绑定扫描试卷信息,已有保存扫描信息本次异常,异常信息3考号重复
|
177
|
182
|
if(N_Utils.isTrueInteger(msPaperStudent.getMspid())){
|
178
|
183
|
msScanbatchPaper.setErrortype(3);
|
179
|
|
- savePaperBlockQuestions(msScanbatchPaper);
|
|
184
|
+ savePaperBlockQuestions(msScanbatchPaper, stype);
|
180
|
185
|
//处理上一次对应扫描试卷为3考号重复,并清空学生试卷试题信息
|
181
|
186
|
msScanbatchPaperMapper.updatePaperErrortype(msPaperStudent.getMspid(),3);
|
182
|
187
|
updatePaperStudentQuestion(msPaperStudent);
|
|
@@ -184,7 +189,7 @@ public class MsScanbatchPaperService {
|
184
|
189
|
}
|
185
|
190
|
|
186
|
191
|
//保存扫描信息
|
187
|
|
- savePaperBlockQuestions(msScanbatchPaper);
|
|
192
|
+ savePaperBlockQuestions(msScanbatchPaper, stype);
|
188
|
193
|
//学生试卷信息
|
189
|
194
|
int answernum = saveStudentBlockQuestions(msScanbatchPaper,msPaperStudent.getMpsid());
|
190
|
195
|
if (!N_Utils.isEmptyInteger(msScanbatchPaper.getMissexam()) && msScanbatchPaper.getMissexam() == 1 && answernum>0) {//缺考
|
|
@@ -196,8 +201,7 @@ public class MsScanbatchPaperService {
|
196
|
201
|
}
|
197
|
202
|
|
198
|
203
|
//保存扫描试卷-保存扫描题块试题信息
|
199
|
|
- private void savePaperBlockQuestions(MsScanbatchPaper msScanbatchPaper){
|
200
|
|
-
|
|
204
|
+ private void savePaperBlockQuestions(MsScanbatchPaper msScanbatchPaper,Integer stype){
|
201
|
205
|
if(msScanbatchPaper.getErrortype() == null){
|
202
|
206
|
msScanbatchPaper.setErrortype(0);
|
203
|
207
|
msScanbatchPaper.setMspstate(0);
|
|
@@ -205,11 +209,17 @@ public class MsScanbatchPaperService {
|
205
|
209
|
msScanbatchPaper.setMspstate(1);
|
206
|
210
|
}
|
207
|
211
|
|
208
|
|
- msScanbatchPaperMapper.insertUseGeneratedKeys(msScanbatchPaper);
|
|
212
|
+ Integer mspid = msScanbatchPaper.getMspid();
|
|
213
|
+ if(stype == 1 || msScanbatchPaper.getMspid() == null){
|
|
214
|
+ msScanbatchPaperMapper.insertUseGeneratedKeys(msScanbatchPaper);
|
|
215
|
+ mspid = msScanbatchPaper.getId();
|
|
216
|
+ }else{
|
|
217
|
+ msScanbatchPaperMapper.updateScanPaperForReidentified(msScanbatchPaper);
|
|
218
|
+ }
|
|
219
|
+
|
209
|
220
|
//如果识别出错则不再进行后续保存
|
210
|
221
|
if(msScanbatchPaper.getErrortype() == 1) return;
|
211
|
222
|
|
212
|
|
- Integer mspid = msScanbatchPaper.getId();
|
213
|
223
|
msScanbatchPaper.setMspid(mspid);
|
214
|
224
|
|
215
|
225
|
//保存试题
|
|
@@ -707,6 +717,14 @@ public class MsScanbatchPaperService {
|
707
|
717
|
}
|
708
|
718
|
if(templates.isEmpty()) throw new ServiceException("该考试未设置试卷模板");
|
709
|
719
|
|
|
720
|
+ //处理之前扫描识别结果,把需要重新识别的试卷按批次进行分组
|
|
721
|
+ // Map<Integer,List<MsScanbatchPaper>> batchMap = scanbatchPapers.stream().collect(Collectors.groupingBy(MsScanbatchPaper::getBatchid));
|
|
722
|
+ // for(Integer batchid : batchMap.keySet()){
|
|
723
|
+ // List<MsScanbatchPaper> papers = batchMap.get(batchid);
|
|
724
|
+ // //把识别数量、违规数量、缺考数量 减去
|
|
725
|
+ //
|
|
726
|
+ // }
|
|
727
|
+
|
710
|
728
|
//清空学生题块试题信息和学生试卷扫描识别信息
|
711
|
729
|
// msPaperStudentMapper.updateStudentBlockQuestionForReIdentify(param);
|
712
|
730
|
//清空符合条件的需要从新识别的试卷的识别信息
|
|
@@ -718,20 +736,10 @@ public class MsScanbatchPaperService {
|
718
|
736
|
System.out.println("saveFloder:" + saveFloder);
|
719
|
737
|
for(MsScanbatchPaper paper : scanbatchPapers){
|
720
|
738
|
chandleIdentifyPaper(paper,stps,saveFloder);
|
|
739
|
+ System.out.println("识别完成!");
|
721
|
740
|
|
722
|
|
- //修改扫描试卷信息
|
723
|
|
- // msScanbatchPaperMapper.updateScanPaperForReidentified(paper);
|
724
|
|
- List<MsScanbatchPaperBlock> blocks = paper.getSpblocks();
|
725
|
|
- // msScanbatchPaperBlockMapper.insertList(blocks);
|
726
|
|
- List<MsScanbatchPaperBlockQuestion> allQuestions = new ArrayList<>();
|
727
|
|
- for(MsScanbatchPaperBlock block : blocks){
|
728
|
|
- int mspbid = block.getId();
|
729
|
|
- for(MsScanbatchPaperBlockQuestion question : block.getSpbquestions()){
|
730
|
|
- question.setMspbid(mspbid);
|
731
|
|
- allQuestions.add(question);
|
732
|
|
- }
|
733
|
|
- }
|
734
|
|
- // if(!allQuestions.isEmpty()) msScanbatchPaperBlockQuestionMapper.insertList(allQuestions);
|
|
741
|
+ //保存扫描试卷信息,和客户端扫描保存调用同一个接口
|
|
742
|
+ // savePaperIdentify(paper, 2);
|
735
|
743
|
}
|
736
|
744
|
}
|
737
|
745
|
|