|
@@ -67,15 +67,15 @@ public class EPaperStudentService {
|
67
|
67
|
return ePaperStudentMapper.listExamPapersForStudent(eps.getStudentid());
|
68
|
68
|
}
|
69
|
69
|
|
70
|
|
- public Map getExamSubjectPaperByEpsid(Integer epsid){
|
|
70
|
+ public Map getExamSubjectPaperByEpsid(Integer epsid) {
|
71
|
71
|
Map map = ePaperStudentMapper.getExamSubjectPaperByEpsid(epsid);
|
72
|
72
|
Long times = null;
|
73
|
|
- if(map.get("sdate")!=null && map.get("begintime")!=null && map.get("endtime")!=null){
|
|
73
|
+ if (map.get("sdate") != null && map.get("begintime") != null && map.get("endtime") != null) {
|
74
|
74
|
long bg = ExamUtil.strToTimestamp(map.get("sdate").toString() + " " + map.get("begintime").toString() + ":00");
|
75
|
75
|
long ed = ExamUtil.strToTimestamp(map.get("sdate").toString() + " " + map.get("endtime").toString() + ":00");
|
76
|
|
- times = ExamUtil.subtract(ed,bg);
|
|
76
|
+ times = ExamUtil.subtract(ed, bg);
|
77
|
77
|
}
|
78
|
|
- map.put("times",times);
|
|
78
|
+ map.put("times", times);
|
79
|
79
|
return map;
|
80
|
80
|
}
|
81
|
81
|
|
|
@@ -125,14 +125,14 @@ public class EPaperStudentService {
|
125
|
125
|
questions = ePaperStudentMapper.listStuPaperFjQuestionsForAndroid(epsid);
|
126
|
126
|
}
|
127
|
127
|
}
|
128
|
|
- if(ptype == 2){
|
|
128
|
+ if (ptype == 2) {
|
129
|
129
|
List<Map> files = ePaperFileMapper.listPaperFiles(psvo.getEpid());
|
130
|
|
- map.put("files",files);
|
|
130
|
+ map.put("files", files);
|
131
|
131
|
}
|
132
|
132
|
|
133
|
|
- ePaperStudentMapper.updateStuStartime(epsid,N_Utils.getSecondTimestamp());
|
134
|
|
- map.put("paper",psvo);
|
135
|
|
- map.put("questions",questions);
|
|
133
|
+ ePaperStudentMapper.updateStuStartime(epsid, N_Utils.getSecondTimestamp());
|
|
134
|
+ map.put("paper", psvo);
|
|
135
|
+ map.put("questions", questions);
|
136
|
136
|
return map;
|
137
|
137
|
}
|
138
|
138
|
|
|
@@ -200,12 +200,12 @@ public class EPaperStudentService {
|
200
|
200
|
}
|
201
|
201
|
}
|
202
|
202
|
|
203
|
|
- if(ptype==2){
|
|
203
|
+ if (ptype == 2) {
|
204
|
204
|
List<Map> files = ePaperFileMapper.listPaperFiles(psvo.getEpid());
|
205
|
205
|
psvo.setFiles(files);
|
206
|
206
|
}
|
207
|
207
|
psvo.setQtypelist(questions);
|
208
|
|
- ePaperStudentMapper.updateStuStartime(epsid,N_Utils.getSecondTimestamp());
|
|
208
|
+ ePaperStudentMapper.updateStuStartime(epsid, N_Utils.getSecondTimestamp());
|
209
|
209
|
return psvo;
|
210
|
210
|
}
|
211
|
211
|
|
|
@@ -220,17 +220,17 @@ public class EPaperStudentService {
|
220
|
220
|
try {
|
221
|
221
|
//学生作答提交时先判断试卷是否设置的正确答案
|
222
|
222
|
PsqAnswerVo answerVo = ePaperStudentQuestionMapper.getPaperQuestionAnswer(psq.getEpsqid());
|
223
|
|
- setCommitQuestion(psq,answerVo);
|
|
223
|
+ setCommitQuestion(psq, answerVo);
|
224
|
224
|
ePaperStudentQuestionMapper.updateStuAnswer(psq);
|
225
|
|
- }catch (Exception e){
|
226
|
|
- log.error("提交试题失败:"+e.getMessage());
|
|
225
|
+ } catch (Exception e) {
|
|
226
|
+ log.error("提交试题失败:" + e.getMessage());
|
227
|
227
|
throw new Exception("提交试题失败");
|
228
|
228
|
}
|
229
|
229
|
|
230
|
230
|
}
|
231
|
231
|
|
232
|
232
|
//判断单道题情况
|
233
|
|
- private void setCommitQuestion(EPaperStudentQuestion psq,PsqAnswerVo answerVo){
|
|
233
|
+ private void setCommitQuestion(EPaperStudentQuestion psq, PsqAnswerVo answerVo) {
|
234
|
234
|
int timestamp = N_Utils.getSecondTimestamp();
|
235
|
235
|
psq.setAnswertime(timestamp);
|
236
|
236
|
int coverted = 1;//是否转换0未转换1已转换2转换失败
|
|
@@ -238,94 +238,94 @@ public class EPaperStudentService {
|
238
|
238
|
List<String> stuanswers = JSON.parseArray(stuanswer, String.class);
|
239
|
239
|
Double stuscore = 0D;
|
240
|
240
|
|
241
|
|
- if(N_Utils.isListEmpty(stuanswers) && N_Utils.isEmpty(psq.getStuanswertxt())
|
242
|
|
- && N_Utils.isEmpty(psq.getStuanswertxt())){
|
|
241
|
+ if (N_Utils.isListEmpty(stuanswers) && N_Utils.isEmpty(psq.getStuanswertxt())
|
|
242
|
+ && N_Utils.isEmpty(psq.getStuanswertxt())) {
|
243
|
243
|
psq.setStuscore(stuscore);
|
244
|
244
|
psq.setChecked(2);
|
245
|
245
|
psq.setChecktime(timestamp);
|
246
|
246
|
psq.setAnswered(0);
|
247
|
|
- }else{
|
|
247
|
+ } else {
|
248
|
248
|
//试卷已经设置了正确答案
|
249
|
|
- if (answerVo.getAnswered() == 1){
|
|
249
|
+ if (answerVo.getAnswered() == 1) {
|
250
|
250
|
String qanswer = answerVo.getAnswer();
|
251
|
|
- List<String> qanswers = JSON.parseArray(qanswer,String.class);
|
|
251
|
+ List<String> qanswers = JSON.parseArray(qanswer, String.class);
|
252
|
252
|
int ctype = answerVo.getCtype();
|
253
|
|
- if(psq.getAnswertype() == 1){
|
254
|
|
- if(N_Utils.isObjectiveQuestion(ctype)){
|
|
253
|
+ if (psq.getAnswertype() == 1) {
|
|
254
|
+ if (N_Utils.isObjectiveQuestion(ctype)) {
|
255
|
255
|
//客观题进行批阅
|
256
|
|
- if(ctype == 1 || ctype == 4 || ctype == 5 || ctype == 6){
|
|
256
|
+ if (ctype == 1 || ctype == 4 || ctype == 5 || ctype == 6) {
|
257
|
257
|
//单选、判断
|
258
|
|
- if(stuanswer.equalsIgnoreCase(qanswer)) {
|
|
258
|
+ if (stuanswer.equalsIgnoreCase(qanswer)) {
|
259
|
259
|
stuscore = answerVo.getScore();
|
260
|
260
|
}
|
261
|
|
- }else if(ctype == 2){//多选
|
|
261
|
+ } else if (ctype == 2) {//多选
|
262
|
262
|
//多选、选错不得分
|
263
|
|
- if(stuanswers.get(0).length() <= qanswer.length()){
|
|
263
|
+ if (stuanswers.get(0).length() <= qanswer.length()) {
|
264
|
264
|
String[] qanswerList = qanswers.get(0).split("");
|
265
|
265
|
String[] stuanswerList = stuanswers.get(0).split("");
|
266
|
266
|
int rightNum = 0;//选对个数
|
267
|
|
- for(String sa : stuanswerList){
|
|
267
|
+ for (String sa : stuanswerList) {
|
268
|
268
|
int right = 0;
|
269
|
|
- for(String qa : qanswerList){
|
270
|
|
- if(qa.equals(sa)){
|
|
269
|
+ for (String qa : qanswerList) {
|
|
270
|
+ if (qa.equals(sa)) {
|
271
|
271
|
right = 1;
|
272
|
|
- rightNum ++;
|
|
272
|
+ rightNum++;
|
273
|
273
|
}
|
274
|
274
|
}
|
275
|
|
- if(right == 0){//说明选错
|
|
275
|
+ if (right == 0) {//说明选错
|
276
|
276
|
rightNum = 0;
|
277
|
277
|
break;
|
278
|
278
|
}
|
279
|
279
|
}
|
280
|
|
- if(rightNum>0){
|
281
|
|
- if(qanswerList.length == rightNum){
|
|
280
|
+ if (rightNum > 0) {
|
|
281
|
+ if (qanswerList.length == rightNum) {
|
282
|
282
|
//全选对
|
283
|
283
|
stuscore = answerVo.getScore();
|
284
|
|
- }else if (qanswerList.length > rightNum){
|
|
284
|
+ } else if (qanswerList.length > rightNum) {
|
285
|
285
|
//少选得半分
|
286
|
|
- stuscore = ExamUtil.div(answerVo.getScore(),2,1);
|
|
286
|
+ stuscore = ExamUtil.div(answerVo.getScore(), 2, 1);
|
287
|
287
|
}
|
288
|
288
|
}
|
289
|
289
|
}
|
290
|
|
- }else if(ctype == 7 || ctype == 8 || ctype == 10){
|
|
290
|
+ } else if (ctype == 7 || ctype == 8 || ctype == 10) {
|
291
|
291
|
//完形填空、阅读理解、任务型阅读
|
292
|
|
- Double qscore = ExamUtil.div(answerVo.getScore(),qanswers.size());
|
|
292
|
+ Double qscore = ExamUtil.div(answerVo.getScore(), qanswers.size());
|
293
|
293
|
Double stuScoreDouble = 0d;
|
294
|
|
- for(int i=0;i<qanswers.size();i++){
|
295
|
|
- if(qanswers.get(i).equalsIgnoreCase(stuanswers.get(i))){
|
296
|
|
- stuScoreDouble = ExamUtil.add(stuScoreDouble,qscore);
|
|
294
|
+ for (int i = 0; i < qanswers.size(); i++) {
|
|
295
|
+ if (qanswers.get(i).equalsIgnoreCase(stuanswers.get(i))) {
|
|
296
|
+ stuScoreDouble = ExamUtil.add(stuScoreDouble, qscore);
|
297
|
297
|
}
|
298
|
298
|
}
|
299
|
|
- stuscore = ExamUtil.round(stuScoreDouble,1);
|
|
299
|
+ stuscore = ExamUtil.round(stuScoreDouble, 1);
|
300
|
300
|
}
|
301
|
|
- if(stuscore.compareTo(answerVo.getScore()) == 1){
|
|
301
|
+ if (stuscore.compareTo(answerVo.getScore()) == 1) {
|
302
|
302
|
stuscore = answerVo.getScore();
|
303
|
303
|
}
|
304
|
304
|
|
305
|
305
|
psq.setChecked(2);
|
306
|
306
|
psq.setChecktime(timestamp);
|
307
|
|
- }else{
|
308
|
|
- if(stuanswers.size() > 1){
|
|
307
|
+ } else {
|
|
308
|
+ if (stuanswers.size() > 1) {
|
309
|
309
|
coverted = 0;//上传的多张图片设为0未转换
|
310
|
310
|
}
|
311
|
311
|
psq.setChecked(0);
|
312
|
312
|
}
|
313
|
|
- }else{
|
|
313
|
+ } else {
|
314
|
314
|
psq.setChecked(0);
|
315
|
315
|
}
|
316
|
|
- }else{
|
|
316
|
+ } else {
|
317
|
317
|
psq.setStuscore(stuscore);
|
318
|
318
|
psq.setChecked(0);
|
319
|
319
|
}
|
320
|
320
|
}
|
321
|
321
|
psq.setStuscore(stuscore);
|
322
|
322
|
Integer costtime = answerVo.getCosttime();
|
323
|
|
- if(costtime == null){
|
|
323
|
+ if (costtime == null) {
|
324
|
324
|
costtime = 0;
|
325
|
325
|
}
|
326
|
|
- if(psq.getCosttime() == null){
|
|
326
|
+ if (psq.getCosttime() == null) {
|
327
|
327
|
psq.setCosttime(costtime);
|
328
|
|
- }else{
|
|
328
|
+ } else {
|
329
|
329
|
psq.setCosttime(psq.getCosttime());
|
330
|
330
|
}
|
331
|
331
|
|
|
@@ -340,9 +340,9 @@ public class EPaperStudentService {
|
340
|
340
|
* @Date 2022/7/28 16:59
|
341
|
341
|
**/
|
342
|
342
|
@Transactional(rollbackFor = Exception.class)
|
343
|
|
- public void saveCommitPaper(Integer epsid){
|
|
343
|
+ public void saveCommitPaper(Integer epsid) {
|
344
|
344
|
EPaperStudent ps = ePaperStudentMapper.selectByPrimaryKey(epsid);
|
345
|
|
- if(ps == null || ps.getSstate() == 2){
|
|
345
|
+ if (ps == null || ps.getSstate() == 2) {
|
346
|
346
|
return;
|
347
|
347
|
}
|
348
|
348
|
EPaperStudent paperStudent = new EPaperStudent();
|
|
@@ -355,22 +355,22 @@ public class EPaperStudentService {
|
355
|
355
|
//获取试卷中未批阅试题数量
|
356
|
356
|
int noCheckNum = ePaperStudentQuestionMapper.getStuQuestionNoCheckNum(epsid);
|
357
|
357
|
int checked = 0;
|
358
|
|
- if(noCheckNum == 0){
|
|
358
|
+ if (noCheckNum == 0) {
|
359
|
359
|
checked = 2;//试卷中所有试题都批完后标识试卷已批改
|
360
|
360
|
}
|
361
|
361
|
paperStudent.setChecked(checked);
|
362
|
362
|
ePaperStudentMapper.updateStudentPaper(paperStudent);//修改试卷信息
|
363
|
|
- chandleStudentQuestionNoconvertedPic(epsid,1);//处理试卷中多张图片未合并情况
|
|
363
|
+ chandleStudentQuestionNoconvertedPic(epsid, 1);//处理试卷中多张图片未合并情况
|
364
|
364
|
}
|
365
|
365
|
|
366
|
366
|
//处理试卷中未已提交需要合并的图片,type1代表线上2代表扫码答题卡图片
|
367
|
|
- private void chandleStudentQuestionNoconvertedPic(Integer epsid,Integer type){
|
|
367
|
+ private void chandleStudentQuestionNoconvertedPic(Integer epsid, Integer type) {
|
368
|
368
|
List<EPaperStudentQuestion> psqlist = ePaperStudentQuestionMapper.listStuQuesitonStuAnswerPic(epsid);
|
369
|
|
- if(N_Utils.isListNotEmpty(psqlist)){
|
370
|
|
- for(EPaperStudentQuestion sq : psqlist){
|
371
|
|
- List<String> stuanswer = JSON.parseArray(sq.getStuanswer(),String.class);
|
372
|
|
- if(N_Utils.isListNotEmpty(stuanswer) && stuanswer.size()>1){
|
373
|
|
- convertUtil.imgMerge(sq.getEpsqid(),stuanswer,type);
|
|
369
|
+ if (N_Utils.isListNotEmpty(psqlist)) {
|
|
370
|
+ for (EPaperStudentQuestion sq : psqlist) {
|
|
371
|
+ List<String> stuanswer = JSON.parseArray(sq.getStuanswer(), String.class);
|
|
372
|
+ if (N_Utils.isListNotEmpty(stuanswer) && stuanswer.size() > 1) {
|
|
373
|
+ convertUtil.imgMerge(sq.getEpsqid(), stuanswer, type);
|
374
|
374
|
}
|
375
|
375
|
}
|
376
|
376
|
}
|
|
@@ -383,25 +383,25 @@ public class EPaperStudentService {
|
383
|
383
|
* @Author wn
|
384
|
384
|
* @Date 2022/7/28 19:18
|
385
|
385
|
**/
|
386
|
|
- public void saveCommitPaperForWeb(PaperStudentWebVo pswvo){
|
|
386
|
+ public void saveCommitPaperForWeb(PaperStudentWebVo pswvo) {
|
387
|
387
|
List<EPaperStudentQuestion> sqlist = pswvo.getQuestions();//学生提交试卷中试题
|
388
|
388
|
EPaperStudent ps = ePaperStudentMapper.selectByPrimaryKey(pswvo.getEpsid());
|
389
|
389
|
//试卷不存在或者已提交
|
390
|
|
- if(ps == null || ps.getSstate() == 2){
|
|
390
|
+ if (ps == null || ps.getSstate() == 2) {
|
391
|
391
|
return;
|
392
|
392
|
}
|
393
|
393
|
//获取试卷中所有试题答案及分值
|
394
|
394
|
List<PsqAnswerVo> anvolist = ePaperStudentQuestionMapper.listPaperQuestionsAnswer(pswvo.getEpsid());
|
395
|
395
|
Integer checknum = 0;//记录试卷中试题批阅数量
|
396
|
396
|
Double paperscore = 0D;//学生试卷得分
|
397
|
|
- for(EPaperStudentQuestion q : sqlist){
|
|
397
|
+ for (EPaperStudentQuestion q : sqlist) {
|
398
|
398
|
|
399
|
399
|
//获取该试题正确答案
|
400
|
400
|
PsqAnswerVo anvo = anvolist.stream().filter(a -> a.getEpsqid().equals(q.getEpsqid())).findFirst().orElse(null);
|
401
|
401
|
|
402
|
|
- setCommitQuestion(q,anvo);
|
403
|
|
- if(q.getChecked() == 2){
|
404
|
|
- checknum ++;
|
|
402
|
+ setCommitQuestion(q, anvo);
|
|
403
|
+ if (q.getChecked() == 2) {
|
|
404
|
+ checknum++;
|
405
|
405
|
}
|
406
|
406
|
paperscore = ExamUtil.add(paperscore, q.getStuscore());
|
407
|
407
|
}
|
|
@@ -411,7 +411,7 @@ public class EPaperStudentService {
|
411
|
411
|
paperStudent.setSstate(2);
|
412
|
412
|
paperStudent.setStuscore(paperscore);
|
413
|
413
|
int checked = 0;
|
414
|
|
- if(checknum == sqlist.size()){
|
|
414
|
+ if (checknum == sqlist.size()) {
|
415
|
415
|
checked = 2;
|
416
|
416
|
}
|
417
|
417
|
paperStudent.setChecked(checked);
|
|
@@ -420,7 +420,7 @@ public class EPaperStudentService {
|
420
|
420
|
ePaperStudentMapper.updateStudentPaper(paperStudent);
|
421
|
421
|
|
422
|
422
|
//获取试卷中需要合并图片的试题
|
423
|
|
- chandleStudentQuestionNoconvertedPic(pswvo.getEpsid(),1);
|
|
423
|
+ chandleStudentQuestionNoconvertedPic(pswvo.getEpsid(), 1);
|
424
|
424
|
}
|
425
|
425
|
|
426
|
426
|
/**
|
|
@@ -431,7 +431,7 @@ public class EPaperStudentService {
|
431
|
431
|
* @Date 2022/8/3 9:17
|
432
|
432
|
**/
|
433
|
433
|
@Transactional(rollbackFor = Exception.class)
|
434
|
|
- public void saveCommitPaperForScantron(PaperStudentWebVo pswvo) throws Exception{
|
|
434
|
+ public void saveCommitPaperForScantron(PaperStudentWebVo pswvo) throws Exception {
|
435
|
435
|
|
436
|
436
|
//扫描一次扫描数量+1
|
437
|
437
|
eScanbatchMapper.updateScannum(pswvo.getBatchid());
|
|
@@ -473,7 +473,7 @@ public class EPaperStudentService {
|
473
|
473
|
}
|
474
|
474
|
|
475
|
475
|
//更新扫描出错信息
|
476
|
|
- private void updateScanErrorInfo(Integer errortype,PaperStudentWebVo pswvo){
|
|
476
|
+ private void updateScanErrorInfo(Integer errortype, PaperStudentWebVo pswvo) {
|
477
|
477
|
//识别出错
|
478
|
478
|
EScanerror er = new EScanerror();
|
479
|
479
|
er.setBatchid(pswvo.getBatchid());
|
|
@@ -507,103 +507,93 @@ public class EPaperStudentService {
|
507
|
507
|
* @Author wn
|
508
|
508
|
* @Date 2022/8/12 10:45
|
509
|
509
|
**/
|
510
|
|
- public Map getStudentPaperScore(Integer epsid){
|
|
510
|
+ public Map getStudentPaperScore(Integer epsid) {
|
511
|
511
|
Map paper = ePaperStudentMapper.getStudentPaperScore(epsid);
|
512
|
512
|
Integer ptype = Integer.parseInt(paper.get("ptype").toString());
|
513
|
513
|
Integer epid = Integer.parseInt(paper.get("epid").toString());
|
514
|
514
|
List<Map> qtypeques = null;
|
515
|
|
- if(ptype == 1){
|
|
515
|
+ if (ptype == 1) {
|
516
|
516
|
qtypeques = ePaperStudentQuestionMapper.listQStuQuestionScore(epsid);
|
517
|
517
|
setQuestionsForPaper(qtypeques);
|
518
|
|
- }else{
|
|
518
|
+ } else {
|
519
|
519
|
qtypeques = ePaperStudentQuestionMapper.listFjStuQuestionScore(epsid);
|
520
|
520
|
List<Map> files = ePaperFileMapper.listPaperFiles(epid);
|
521
|
|
- paper.put("files",files);
|
|
521
|
+ paper.put("files", files);
|
522
|
522
|
}
|
523
|
|
- paper.put("qtypes",qtypeques);
|
|
523
|
+ paper.put("qtypes", qtypeques);
|
524
|
524
|
return paper;
|
525
|
525
|
}
|
526
|
526
|
|
527
|
|
- private void setQuestionsForPaper(List<Map> qtypes){
|
528
|
|
- for(Map mt : qtypes){
|
529
|
|
- Integer ctype = Integer.parseInt(mt.get("ctype").toString());
|
530
|
|
- List<Map> mqlist = new ArrayList<>();
|
531
|
|
- if(ctype == 11 || ctype == 16 || ctype == 17){
|
532
|
|
- //符合题、完形填空、任务型阅读
|
533
|
|
- List<Map> questions = (List<Map>) mt.get("questions");
|
534
|
|
- Map<String,List<Map>> quemap = questions.stream().collect(Collectors.groupingBy(o -> o.get("questionpid").toString()));
|
535
|
|
-
|
536
|
|
- for(Map.Entry<String,List<Map>> entry : quemap.entrySet()){
|
537
|
|
- List<Map> sonqlst = entry.getValue();
|
538
|
|
- Double sontotalsocre = sonqlst.stream().mapToDouble(o -> Double.parseDouble(o.get("score").toString())).sum();
|
539
|
|
- Double stuscore = sonqlst.stream().mapToDouble(o -> Double.parseDouble(o.get("stuscore").toString())).sum();
|
540
|
|
- Map sque = sonqlst.get(0);
|
541
|
|
- Map mque = new HashMap();
|
542
|
|
- mque.put("questionid",sque.get("mquestionid").toString());
|
543
|
|
- mque.put("qlevel",2);
|
544
|
|
- mque.put("qstem",sque.get("mqstem").toString());
|
545
|
|
- mque.put("ctype",Integer.parseInt(sque.get("mctype").toString()));
|
546
|
|
- mque.put("qtypeid",sque.get("mqtypeid").toString());
|
547
|
|
- mque.put("qtypename",sque.get("mqtypename").toString());
|
548
|
|
- mque.put("qorder",sque.get("qorder").toString());
|
549
|
|
- mque.put("qn",sque.get("qn").toString());
|
550
|
|
- mque.put("snum",Integer.parseInt(sque.get("snum").toString()));
|
551
|
|
- Integer hashear = Integer.parseInt(sque.get("mhashear").toString());
|
552
|
|
- mque.put("hashear",hashear);
|
553
|
|
- if(ctype == 12 && hashear==1){
|
554
|
|
- mque.put("hearfile",sque.get("mhearfile").toString());
|
555
|
|
- }else{
|
556
|
|
- mque.put("hearfile","");
|
557
|
|
- }
|
558
|
|
- mque.put("score",sontotalsocre);
|
559
|
|
- mque.put("sonques",sonqlst);
|
560
|
|
- mque.put("stuscore",stuscore);
|
561
|
|
- mqlist.add(mque);
|
562
|
|
- }
|
563
|
|
- }else if(ctype == 12){
|
564
|
|
- //听力题,包含单题和复合题
|
565
|
|
- List<Map> questions = (List<Map>) mt.get("questions");
|
566
|
|
- List<String> questionpids = new ArrayList<>();
|
567
|
|
- for(Map q : questions){
|
568
|
|
- Integer qlevel = Integer.parseInt(q.get("qlevel").toString());
|
569
|
|
- if(qlevel == 1){
|
570
|
|
- mqlist.add(q);
|
571
|
|
- }else{
|
572
|
|
- String questionpid = q.get("questionpid").toString();
|
573
|
|
- if(!questionpids.contains(questionpid)){
|
574
|
|
- questionpids.add(questionpid);
|
575
|
|
-
|
576
|
|
- List<Map> sonques = questions.stream().filter(s -> qlevel.equals(Integer.parseInt(s.get("qlevel").toString())) && questionpid.equals(s.get("questionpid").toString())).collect(Collectors.toList());
|
577
|
|
- Double sontotalsocre = sonques.stream().mapToDouble(o -> Double.parseDouble(o.get("score").toString())).sum();
|
578
|
|
- Double stuscore = sonques.stream().mapToDouble(o -> Double.parseDouble(o.get("stuscore").toString())).sum();
|
579
|
|
- Map mque = new HashMap();
|
580
|
|
- mque.put("questionid",questionpid);
|
581
|
|
- mque.put("qlevel",2);
|
582
|
|
- mque.put("qstem",q.get("mqstem").toString());
|
583
|
|
- mque.put("ctype",Integer.parseInt(q.get("mctype").toString()));
|
584
|
|
- mque.put("qtypeid",q.get("mqtypeid").toString());
|
585
|
|
- mque.put("qtypename",q.get("mqtypename").toString());
|
586
|
|
- mque.put("qorder",q.get("qorder").toString());
|
587
|
|
- mque.put("qn",q.get("qn").toString());
|
588
|
|
- mque.put("snum",Integer.parseInt(q.get("snum").toString()));
|
589
|
|
- Integer hashear = Integer.parseInt(q.get("mhashear").toString());
|
590
|
|
- mque.put("hashear",hashear);
|
591
|
|
- if(ctype == 12 && hashear == 1){
|
592
|
|
- mque.put("hearfile",q.get("mhearfile").toString());
|
593
|
|
- }else{
|
594
|
|
- mque.put("hearfile","");
|
595
|
|
- }
|
596
|
|
- mque.put("score",sontotalsocre);
|
597
|
|
- mque.put("stuscore",stuscore);
|
598
|
|
- mque.put("sonques",sonques);
|
599
|
|
- mqlist.add(mque);
|
|
527
|
+ //这只试卷中母子题
|
|
528
|
+ private void setQuestionsForPaper(List<Map> qtypes) {
|
|
529
|
+ for (Map mt : qtypes) {
|
|
530
|
+ List<Map> questions = (List<Map>) mt.get("questions");
|
|
531
|
+ List<Map> mqlist = new ArrayList<>();//存放母子题结构试题
|
|
532
|
+ List<String> mtquestionids = new ArrayList<>();//存放母题的id
|
|
533
|
+ for (Map qmap : questions) {
|
|
534
|
+ Integer qlevel = Integer.parseInt(qmap.get("qlevel").toString());
|
|
535
|
+ if (qlevel == 1) {
|
|
536
|
+ //单题
|
|
537
|
+ qmap.remove("mqstem");
|
|
538
|
+ qmap.remove("mqoption");
|
|
539
|
+ qmap.remove("msum");
|
|
540
|
+ qmap.remove("mqtypeid");
|
|
541
|
+ qmap.remove("mqtypename");
|
|
542
|
+ qmap.remove("mhashear");
|
|
543
|
+ qmap.remove("mhearfile");
|
|
544
|
+ qmap.remove("mquestionid");
|
|
545
|
+ qmap.remove("mctype");
|
|
546
|
+ qmap.remove("questionpid");
|
|
547
|
+
|
|
548
|
+ mqlist.add(qmap);
|
|
549
|
+ } else {
|
|
550
|
+ //子题
|
|
551
|
+ String questionpid = qmap.get("questionpid").toString();
|
|
552
|
+ if (!mtquestionids.contains(questionpid)) {
|
|
553
|
+ mtquestionids.add(questionpid);
|
|
554
|
+ List<Map> sonqueslist =
|
|
555
|
+ questions.stream().filter(s -> qlevel.equals(Integer.parseInt(s.get("qlevel").toString())) && questionpid.equals(s.get("questionpid").toString())).collect(Collectors.toList());
|
|
556
|
+
|
|
557
|
+ Double sontotalsocre = sonqueslist.stream().mapToDouble(o -> Double.parseDouble(o.get("score").toString())).sum();
|
|
558
|
+ Double stuscore = sonqueslist.stream().mapToDouble(o -> Double.parseDouble(o.get("stuscore").toString())).sum();
|
|
559
|
+ Map sque = sonqueslist.get(0);
|
|
560
|
+ Map mque = new HashMap();
|
|
561
|
+ mque.put("questionid", sque.get("mquestionid").toString());
|
|
562
|
+ mque.put("qlevel", 2);
|
|
563
|
+ mque.put("qstem", sque.get("mqstem").toString());
|
|
564
|
+ mque.put("ctype", Integer.parseInt(sque.get("mctype").toString()));
|
|
565
|
+ mque.put("qtypeid", sque.get("mqtypeid").toString());
|
|
566
|
+ mque.put("qtypename", sque.get("mqtypename").toString());
|
|
567
|
+ mque.put("qorder", sque.get("qorder").toString());
|
|
568
|
+ mque.put("qn", sque.get("qn").toString());
|
|
569
|
+ mque.put("snum", Integer.parseInt(sque.get("snum").toString()));
|
|
570
|
+ Integer hashear = Integer.parseInt(sque.get("mhashear").toString());
|
|
571
|
+ mque.put("hashear", hashear);
|
|
572
|
+ if (hashear == 1) {
|
|
573
|
+ mque.put("hearfile", sque.get("mhearfile").toString());
|
|
574
|
+ } else {
|
|
575
|
+ mque.put("hearfile", "");
|
|
576
|
+ }
|
|
577
|
+ mque.put("score", sontotalsocre);
|
|
578
|
+ mque.put("stuscore", stuscore);
|
|
579
|
+
|
|
580
|
+ for(Map sonquem : sonqueslist){
|
|
581
|
+ sonquem.remove("mqstem");
|
|
582
|
+ sonquem.remove("mqoption");
|
|
583
|
+ sonquem.remove("msum");
|
|
584
|
+ sonquem.remove("mqtypeid");
|
|
585
|
+ sonquem.remove("mqtypename");
|
|
586
|
+ sonquem.remove("mhashear");
|
|
587
|
+ sonquem.remove("mhearfile");
|
|
588
|
+ sonquem.remove("mquestionid");
|
|
589
|
+ sonquem.remove("mctype");
|
|
590
|
+ sonquem.remove("hashear");
|
|
591
|
+ sonquem.remove("hearfile");
|
600
|
592
|
}
|
|
593
|
+ mque.put("sonques", sonqueslist);
|
|
594
|
+ mqlist.add(mque);
|
601
|
595
|
}
|
602
|
596
|
}
|
603
|
|
-
|
604
|
|
- }else{
|
605
|
|
- List<Map> questions = (List<Map>) mt.get("questions");
|
606
|
|
- mqlist.addAll(questions);
|
607
|
597
|
}
|
608
|
598
|
mt.put("questions",mqlist);
|
609
|
599
|
}
|
|
@@ -719,7 +709,7 @@ public class EPaperStudentService {
|
719
|
709
|
}
|
720
|
710
|
q.setEpsqid(anvo.getEpsqid());
|
721
|
711
|
paperscore = ExamUtil.add(paperscore, q.getStuscore());
|
722
|
|
- if(N_Utils.isObjectiveQuestion(q.getCtype()) && q.getAnswered()!=null && q.getAnswered()==1){
|
|
712
|
+ if (N_Utils.isObjectiveQuestion(q.getCtype()) && q.getAnswered() != null && q.getAnswered() == 1) {
|
723
|
713
|
rtnanswernum++;
|
724
|
714
|
}
|
725
|
715
|
}
|
|
@@ -782,7 +772,7 @@ public class EPaperStudentService {
|
782
|
772
|
@Transactional(rollbackFor = Exception.class)
|
783
|
773
|
public void qkConfirm(List<PaperStudentWebVo> list) throws Exception {
|
784
|
774
|
List<EPaperStudent> pslist = new ArrayList<>();
|
785
|
|
- for(PaperStudentWebVo objvo : list){
|
|
775
|
+ for (PaperStudentWebVo objvo : list) {
|
786
|
776
|
EPaperStudent ps = new EPaperStudent();
|
787
|
777
|
ps.setEpsid(objvo.getEpsid());
|
788
|
778
|
ps.setSstate(objvo.getSstate());
|