Эх сурвалжийг харах

fix:模式四试卷结构后直接更新试卷结构状态为已提交

caozixuan 10 сар өмнө
parent
commit
f24c08e142

+ 28 - 15
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/ImportLogicServiceImpl.java

@@ -2,6 +2,7 @@ package com.qmth.distributed.print.business.templete.service.impl;
 
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.qmth.boot.tools.excel.ExcelReader;
 import com.qmth.boot.tools.excel.enums.ExcelType;
 import com.qmth.boot.tools.excel.model.DataMap;
@@ -953,20 +954,20 @@ public class ImportLogicServiceImpl implements ImportLogicService {
             // 4.判断答案是否符合题型
             if (questionType != null && SystemConstant.strNotNull(answer)) {
                 switch (questionType) {
-                    case 1:
-                        if (answer.length() > 1) {
-                            logicErrorList.add("单选题答案只能有一个");
-                        }
-                        break;
-                    case 2:
-                        break;
-                    case 3:
-                        if (optionCount != 2) {
-                            logicErrorList.add("判断题[选项个数]只能为2");
-                        }
-                        break;
-                    default:
-                        logicErrorList.add("[题型(1-单选,2-多选,3-判断)]必须从1、2、3中填写");
+                case 1:
+                    if (answer.length() > 1) {
+                        logicErrorList.add("单选题答案只能有一个");
+                    }
+                    break;
+                case 2:
+                    break;
+                case 3:
+                    if (optionCount != 2) {
+                        logicErrorList.add("判断题[选项个数]只能为2");
+                    }
+                    break;
+                default:
+                    logicErrorList.add("[题型(1-单选,2-多选,3-判断)]必须从1、2、3中填写");
                 }
             }
 
@@ -1011,6 +1012,12 @@ public class ImportLogicServiceImpl implements ImportLogicService {
                 markQuestionService.saveBatch(v);
                 markQuestionService.updateMarkPaperScore(examId, k, null);
             });
+            // 更改试卷结构状态为已提交
+            Set<String> paperNumberSet = markQuestionMap.keySet();
+            if (CollectionUtils.isNotEmpty(paperNumberSet)) {
+                markPaperService.update(new UpdateWrapper<MarkPaper>().lambda().eq(MarkPaper::getExamId, examId)
+                        .in(MarkPaper::getPaperNumber, paperNumberSet).set(MarkPaper::getQuestionStatus, true));
+            }
         }
         return map;
     }
@@ -1234,7 +1241,7 @@ public class ImportLogicServiceImpl implements ImportLogicService {
                                     userSaveParams.setPassword(SystemConstant.DEFAULT_PASSWORD);
                                     userSaveParams.setOrgId(orgId);
                                     userSaveParams.setEnable(true);
-                                    userSaveParams.setRoleIds(new Long[]{markerRole.getId()});
+                                    userSaveParams.setRoleIds(new Long[] { markerRole.getId() });
                                     try {
                                         markUser.setUserId(sysUserService.saveUser(userSaveParams, requestUser.getId()));
                                         markUser.setName(markerCode);
@@ -1284,6 +1291,12 @@ public class ImportLogicServiceImpl implements ImportLogicService {
             if (CollectionUtils.isNotEmpty(paperErrorList)) {
                 throw ExceptionResultEnum.ERROR.exception(String.join(System.lineSeparator(), paperErrorList));
             }
+            // 更改试卷结构状态为已提交
+            Set<String> paperNumberSet = paperQuestionsMap.keySet();
+            if (CollectionUtils.isNotEmpty(paperNumberSet)) {
+                markPaperService.update(new UpdateWrapper<MarkPaper>().lambda().eq(MarkPaper::getExamId, examId)
+                        .in(MarkPaper::getPaperNumber, paperNumberSet).set(MarkPaper::getQuestionStatus, true));
+            }
         }
         return map;
     }

+ 3 - 3
distributed-print/src/main/java/com/qmth/distributed/print/api/mark/MarkSettingController.java

@@ -1,14 +1,12 @@
 package com.qmth.distributed.print.api.mark;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.qmth.boot.api.annotation.Aac;
 import com.qmth.boot.api.constant.ApiConstant;
 import com.qmth.distributed.print.business.entity.ExamTaskDetail;
 import com.qmth.distributed.print.business.service.ExamTaskDetailService;
 import com.qmth.distributed.print.business.service.PrintCommonService;
 import com.qmth.distributed.print.business.templete.execute.AsyncObjectiveStructImportService;
 import com.qmth.distributed.print.business.templete.execute.AsyncSubjectiveStructImportService;
-import com.qmth.distributed.print.business.templete.service.ImportLogicService;
 import com.qmth.teachcloud.common.annotation.OperationLogDetail;
 import com.qmth.teachcloud.common.bean.dto.mark.MarkSettingDto;
 import com.qmth.teachcloud.common.bean.params.mark.setting.MarkPaperSettingParam;
@@ -25,7 +23,9 @@ import com.qmth.teachcloud.mark.dto.mark.score.CheckScoreListDto;
 import com.qmth.teachcloud.mark.entity.MarkPaper;
 import com.qmth.teachcloud.mark.service.MarkPaperService;
 import com.qmth.teachcloud.mark.service.MarkTaskService;
-import io.swagger.annotations.*;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
 import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;