|
@@ -1341,14 +1341,9 @@ public class MsPaperQtypeService {
|
1341
|
1341
|
//设置试卷题目数量和分值
|
1342
|
1342
|
setPaperNumAndScore(paper);
|
1343
|
1343
|
msPaperMapper.updateByPrimaryKeySelective(paper);
|
1344
|
|
- //更改顺序
|
1345
|
|
- List<MsPaperQtypeQuestion> queOrders = msPaperQtypeQuestionMapper.listQuesOrderByMpid(mptid);
|
1346
|
|
- int qorder = 1;
|
1347
|
|
- for(MsPaperQtypeQuestion que : queOrders){
|
1348
|
|
- que.setQorder(qorder);
|
1349
|
|
- qorder++;
|
1350
|
|
- }
|
1351
|
|
- msPaperQtypeQuestionMapper.updateBatchQuestionOrder(queOrders);
|
|
1344
|
+
|
|
1345
|
+ //试卷中小题重新排序
|
|
1346
|
+ chandleQuestionOrder(paper);
|
1352
|
1347
|
|
1353
|
1348
|
savePaperAnalyzeForFj(paper);
|
1354
|
1349
|
deletePaperOtherInfo(mpid);
|
|
@@ -1364,7 +1359,14 @@ public class MsPaperQtypeService {
|
1364
|
1359
|
* @Return void
|
1365
|
1360
|
**/
|
1366
|
1361
|
@Transactional(rollbackFor = Exception.class)
|
1367
|
|
- public void deleteQtypeOffline(MsPaperQtype paperQtype){
|
|
1362
|
+ public ResultVo deleteQtypeOffline(MsPaperQtype paperQtype){
|
|
1363
|
+ //根据试卷ID获取考试信息
|
|
1364
|
+ PExamSubjectVo exam = msPaperMapper.getExamSubjectForPaper(paperQtype.getMpid());
|
|
1365
|
+ //线下考试,发布成绩(生成报告)之前可以修改试卷结构
|
|
1366
|
+ if(exam.getExammode() < 3 && exam.getExamstate() > 2){
|
|
1367
|
+ throw new MissingParametersException("考试已统分禁止操作");
|
|
1368
|
+ }
|
|
1369
|
+
|
1368
|
1370
|
msPaperQtypeMapper.deleteByPrimaryKey(paperQtype.getMptid());
|
1369
|
1371
|
MsPaper paper = new MsPaper();
|
1370
|
1372
|
paper.setMpid(paperQtype.getMpid());
|
|
@@ -1374,6 +1376,7 @@ public class MsPaperQtypeService {
|
1374
|
1376
|
|
1375
|
1377
|
//重新生成试卷分析
|
1376
|
1378
|
savePaperAnalyzeForFj(paper);
|
|
1379
|
+ return new ResultVo(0,"删除成功",paper.getMpid());
|
1377
|
1380
|
}
|
1378
|
1381
|
|
1379
|
1382
|
//处理试卷试题数量和分值,题型排序,试题排序
|
|
@@ -1408,10 +1411,70 @@ public class MsPaperQtypeService {
|
1408
|
1411
|
msPaperMapper.updateByPrimaryKeySelective(paper);
|
1409
|
1412
|
}
|
1410
|
1413
|
|
|
1414
|
+ //处理试卷中小题排序
|
|
1415
|
+ private void chandleQuestionOrder(MsPaper paper){
|
|
1416
|
+ //小题重新排序
|
|
1417
|
+ List<MsPaperQtypeQuestion> queOrders = msPaperQtypeQuestionMapper.listQuesOrderByMpid(paper.getMpid());
|
|
1418
|
+ int qorder = 1;
|
|
1419
|
+ int pnum = 0;
|
|
1420
|
+ double pscore = 0;
|
|
1421
|
+ for(MsPaperQtypeQuestion que : queOrders){
|
|
1422
|
+ que.setQorder(qorder);
|
|
1423
|
+ qorder++;
|
|
1424
|
+ pnum++;
|
|
1425
|
+ pscore = MarkingUtil.add(pscore, que.getQscore());
|
|
1426
|
+ }
|
|
1427
|
+ paper.setPnum(pnum);
|
|
1428
|
+ paper.setPscore(pscore);
|
|
1429
|
+ msPaperQtypeQuestionMapper.updateBatchQuestionOrder(queOrders);
|
|
1430
|
+ }
|
|
1431
|
+
|
1411
|
1432
|
|
|
1433
|
+ /*
|
|
1434
|
+ * @Description 线下试卷-题型上下移动
|
|
1435
|
+ * @Date 2024/12/4 10:30:51
|
|
1436
|
+ * @Author WN
|
|
1437
|
+ * @Param [params]
|
|
1438
|
+ * @Return void
|
|
1439
|
+ **/
|
1412
|
1440
|
@Transactional(rollbackFor = Exception.class)
|
1413
|
|
- public void updateQtypeOrderOffline(MsPaperQtype paperQtype){
|
|
1441
|
+ public void updateQtypeOrderOffline(MsPaperParams params){
|
|
1442
|
+
|
|
1443
|
+ //根据试卷ID获取考试信息
|
|
1444
|
+ PExamSubjectVo exam = msPaperMapper.getExamSubjectForPaper(params.getMpid());
|
|
1445
|
+ //线下考试,发布成绩(生成报告)之前可以修改试卷结构
|
|
1446
|
+ if(exam.getExammode() < 3 && exam.getExamstate() > 2){
|
|
1447
|
+ throw new MissingParametersException("考试已统分禁止操作");
|
|
1448
|
+ }
|
|
1449
|
+
|
|
1450
|
+ MsPaperQtype moveQtype = new MsPaperQtype();//要移动的题型
|
|
1451
|
+ moveQtype.setMptid(params.getMptid());
|
1414
|
1452
|
|
|
1453
|
+ int movevalue;//移动试题的order变换值
|
|
1454
|
+ int bmovevalue;//被移动试题的order变换值
|
|
1455
|
+ if(params.getMovetype() == 1){ //上移
|
|
1456
|
+ movevalue = -1;//在原来基础上减一
|
|
1457
|
+ bmovevalue = 1;
|
|
1458
|
+ }else{
|
|
1459
|
+ movevalue = 1;//在原来基础上加一
|
|
1460
|
+ bmovevalue = -1;
|
|
1461
|
+ }
|
|
1462
|
+ params.setMovevalue(1);
|
|
1463
|
+ moveQtype.setMptorder(movevalue);
|
|
1464
|
+ //被交换位置的试题
|
|
1465
|
+ MsPaperQtype qtype = msPaperQtypeMapper.getQtypeForMoverOrder(params);
|
|
1466
|
+ qtype.setMptorder(bmovevalue);
|
|
1467
|
+
|
|
1468
|
+ List<MsPaperQtype> changeQuestions = new ArrayList<>();
|
|
1469
|
+ changeQuestions.add(moveQtype);
|
|
1470
|
+ changeQuestions.add(qtype);
|
|
1471
|
+ msPaperQtypeMapper.updateBatchMoveQtypeOrder(changeQuestions);
|
|
1472
|
+
|
|
1473
|
+ MsPaper paper = new MsPaper();
|
|
1474
|
+ paper.setMpid(params.getMpid());
|
|
1475
|
+ chandleQuestionOrder(paper);//小题重新排序
|
|
1476
|
+
|
|
1477
|
+ rebuildPaperAnalyzeOffline(paper.getMpid(),paper);
|
1415
|
1478
|
}
|
1416
|
1479
|
|
1417
|
1480
|
/*
|
|
@@ -1423,6 +1486,14 @@ public class MsPaperQtypeService {
|
1423
|
1486
|
**/
|
1424
|
1487
|
@Transactional(rollbackFor = Exception.class)
|
1425
|
1488
|
public void updateQuestionOffline(MsPaperQtypeQuestion question){
|
|
1489
|
+
|
|
1490
|
+ //根据试卷ID获取考试信息
|
|
1491
|
+ PExamSubjectVo exam = msPaperMapper.getExamSubjectForPaper(question.getMpid());
|
|
1492
|
+ //线下考试,发布成绩(生成报告)之前可以修改试卷结构
|
|
1493
|
+ if(exam.getExammode() < 3 && exam.getExamstate() > 2){
|
|
1494
|
+ throw new MissingParametersException("考试已统分禁止操作");
|
|
1495
|
+ }
|
|
1496
|
+
|
1426
|
1497
|
//获取原小题信息
|
1427
|
1498
|
MsPaperQtypeQuestion oldQuestion = msPaperQtypeQuestionMapper.selectByPrimaryKey(question.getMptqid());
|
1428
|
1499
|
//修改小题信息
|
|
@@ -1430,6 +1501,9 @@ public class MsPaperQtypeService {
|
1430
|
1501
|
if(!oldQuestion.getQscore().equals(question.getQscore())){
|
1431
|
1502
|
//说明修改题型和试卷分值
|
1432
|
1503
|
msPaperQtypeMapper.updateQtypeScore(question.getMptid(),question.getMpid());
|
|
1504
|
+
|
|
1505
|
+ //重新生成试卷分析
|
|
1506
|
+ rebuildPaperAnalyzeOffline(question.getMpid(),null);
|
1433
|
1507
|
}
|
1434
|
1508
|
}
|
1435
|
1509
|
|
|
@@ -1442,6 +1516,12 @@ public class MsPaperQtypeService {
|
1442
|
1516
|
**/
|
1443
|
1517
|
@Transactional(rollbackFor = Exception.class)
|
1444
|
1518
|
public void deleteQuestionOffline(MsPaperQtypeQuestion question){
|
|
1519
|
+ //根据试卷ID获取考试信息
|
|
1520
|
+ PExamSubjectVo exam = msPaperMapper.getExamSubjectForPaper(question.getMpid());
|
|
1521
|
+ //线下考试,发布成绩(生成报告)之前可以修改试卷结构
|
|
1522
|
+ if(exam.getExammode() < 3 && exam.getExamstate() > 2){
|
|
1523
|
+ throw new MissingParametersException("考试已统分禁止操作");
|
|
1524
|
+ }
|
1445
|
1525
|
Integer mptid = question.getMptid();
|
1446
|
1526
|
msPaperQtypeQuestionMapper.deleteByPrimaryKey(question.getMptqid());
|
1447
|
1527
|
//获取题型下试题数量
|
|
@@ -1454,33 +1534,66 @@ public class MsPaperQtypeService {
|
1454
|
1534
|
msPaperQtypeMapper.deleteByPrimaryKey(mptid);
|
1455
|
1535
|
//处理试卷试题数量和分值,题型排序,试题排序
|
1456
|
1536
|
chandlePaperNumQtypeOrder(paper);
|
1457
|
|
-
|
1458
|
1537
|
}else{
|
1459
|
1538
|
//修改题型和试卷分值
|
1460
|
|
- msPaperQtypeMapper.updateQtypeScore(mptid,question.getMpid());
|
|
1539
|
+ msPaperQtypeMapper.updateQtypeScoreAndNum(mptid,question.getMpid());
|
1461
|
1540
|
//小题重新排序
|
1462
|
|
- List<MsPaperQtypeQuestion> queOrders = msPaperQtypeQuestionMapper.listQuesOrderByMpid(mptid);
|
1463
|
|
- int qorder = 1;
|
1464
|
|
- int pnum = 0;
|
1465
|
|
- double pscore = 0;
|
1466
|
|
- for(MsPaperQtypeQuestion que : queOrders){
|
1467
|
|
- que.setQorder(qorder);
|
1468
|
|
- qorder++;
|
1469
|
|
- pnum++;
|
1470
|
|
- pscore = MarkingUtil.add(pscore, que.getQscore());
|
1471
|
|
- }
|
1472
|
|
- paper.setPnum(pnum);
|
1473
|
|
- paper.setPscore(pscore);
|
1474
|
|
- msPaperQtypeQuestionMapper.updateBatchQuestionOrder(queOrders);
|
|
1541
|
+ chandleQuestionOrder(paper);
|
1475
|
1542
|
}
|
1476
|
1543
|
|
1477
|
1544
|
//重新生成试卷分析
|
1478
|
|
- savePaperAnalyzeForFj(paper);
|
|
1545
|
+ rebuildPaperAnalyzeOffline(question.getMpid(), paper);
|
|
1546
|
+ deletePaperOtherInfo(question.getMpid());
|
1479
|
1547
|
}
|
1480
|
1548
|
|
|
1549
|
+ /*
|
|
1550
|
+ * @Description 线下试卷-试题上下移动
|
|
1551
|
+ * @Date 2024/12/4 10:13:29
|
|
1552
|
+ * @Author WN
|
|
1553
|
+ * @Param [params]
|
|
1554
|
+ * @Return void
|
|
1555
|
+ **/
|
1481
|
1556
|
@Transactional(rollbackFor = Exception.class)
|
1482
|
|
- public void updateQuestionOrderOffline(MsPaperQtypeQuestion question){
|
|
1557
|
+ public void updateQuestionOrderOffline(MsPaperParams params){
|
|
1558
|
+ //根据试卷ID获取考试信息
|
|
1559
|
+ PExamSubjectVo exam = msPaperMapper.getExamSubjectForPaper(params.getMpid());
|
|
1560
|
+ //线下考试,发布成绩(生成报告)之前可以修改试卷结构
|
|
1561
|
+ if(exam.getExammode() < 3 && exam.getExamstate() > 2){
|
|
1562
|
+ throw new MissingParametersException("考试已统分禁止操作");
|
|
1563
|
+ }
|
|
1564
|
+ MsPaperQtypeQuestion moveQuestion = new MsPaperQtypeQuestion();//要移动的试题
|
|
1565
|
+ moveQuestion.setMptqid(params.getMptqid());
|
|
1566
|
+
|
|
1567
|
+ int movevalue;//移动试题的order变换值
|
|
1568
|
+ int bmovevalue;//被移动试题的order变换值
|
|
1569
|
+ if(params.getMovetype() == 1){ //上移
|
|
1570
|
+ movevalue = -1;//在原来基础上减一
|
|
1571
|
+ bmovevalue = 1;
|
|
1572
|
+ }else{
|
|
1573
|
+ movevalue = 1;//在原来基础上加一
|
|
1574
|
+ bmovevalue = -1;
|
|
1575
|
+ }
|
|
1576
|
+ params.setMovevalue(1);
|
|
1577
|
+ moveQuestion.setQorder(movevalue);
|
|
1578
|
+ //被交换位置的试题
|
|
1579
|
+ MsPaperQtypeQuestion question = msPaperQtypeQuestionMapper.getQuestionForMoverOrder(params);
|
|
1580
|
+ question.setQorder(bmovevalue);
|
|
1581
|
+
|
|
1582
|
+ List<MsPaperQtypeQuestion> changeQuestions = new ArrayList<>();
|
|
1583
|
+ changeQuestions.add(moveQuestion);
|
|
1584
|
+ changeQuestions.add(question);
|
|
1585
|
+ msPaperQtypeQuestionMapper.updateBatchMoveQuestionOrder(changeQuestions);
|
|
1586
|
+
|
|
1587
|
+ //重新生成报告
|
|
1588
|
+ rebuildPaperAnalyzeOffline(params.getMpid(),null);
|
|
1589
|
+ }
|
1483
|
1590
|
|
|
1591
|
+ //重新生产线下试卷分析
|
|
1592
|
+ private void rebuildPaperAnalyzeOffline(Integer mpid,MsPaper paper){
|
|
1593
|
+ if(paper == null || !N_Utils.isTrueInteger(paper.getPnum())){
|
|
1594
|
+ paper = msPaperMapper.selectByPrimaryKey(mpid);
|
|
1595
|
+ }
|
|
1596
|
+ savePaperAnalyzeForFj(paper);
|
1484
|
1597
|
}
|
1485
|
1598
|
|
1486
|
1599
|
|