Browse Source

批次删除

caozixuan 3 năm trước cách đây
mục cha
commit
585df18020

+ 17 - 11
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/DataSyncReportServiceImpl.java

@@ -114,9 +114,13 @@ public class DataSyncReportServiceImpl implements DataSyncReportService {
                     gradeBatchPaperService.updateById(gradeBatchPaper);
                 }
             }
+            if (gradeBatchPaperList.size() == 0) {
+                gradeBatch.setStatus(GradeAnalyzePaperStatusEnum.SETTING_GRADE_PAPER);
+            } else {
+                long batchCount = gradeBatchPaperList.stream().filter(m -> m.getEnable() && GradeAnalyzePaperStatusEnum.SETTING_GRADE_PAPER_PARAM.equals(m.getStatus())).count();
+                gradeBatch.setStatus(batchCount > 0 ? GradeAnalyzePaperStatusEnum.SETTING_GRADE_PAPER_PARAM : GradeAnalyzePaperStatusEnum.READY_TO_CALCULATE);
+            }
 
-            long batchCount = gradeBatchPaperList.stream().filter(m -> m.getEnable() && GradeAnalyzePaperStatusEnum.SETTING_GRADE_PAPER_PARAM.equals(m.getStatus())).count();
-            gradeBatch.setStatus(batchCount > 0 ? GradeAnalyzePaperStatusEnum.SETTING_GRADE_PAPER_PARAM : GradeAnalyzePaperStatusEnum.READY_TO_CALCULATE);
 
             // 任务结果
             result = TaskResultEnum.SUCCESS;
@@ -172,15 +176,17 @@ public class DataSyncReportServiceImpl implements DataSyncReportService {
             errorMessage = e.getMessage();
             if (e instanceof ApiException) {
                 ApiException apiException = (ApiException) e;
-                String code = errorMessage.substring(errorMessage.indexOf("(") + 1, errorMessage.indexOf(")"));
-                if (String.valueOf(ExceptionResultEnum.PAPER_STRUCT_EXCEPTION.getCode()).equals(code)) {
-                    // 截取试卷编号当做remark
-                    remark = errorMessage.substring(errorMessage.indexOf("【") + 1, errorMessage.indexOf("】"));
-                    errorMessage = errorMessage.substring(0,errorMessage.indexOf("("));
-                    // 更新状态(structureChange)
-                    UpdateWrapper<ExamPaperStructure> updateWrapper = new UpdateWrapper<>();
-                    updateWrapper.lambda().set(ExamPaperStructure::getStructureChange, true).eq(ExamPaperStructure::getSchoolId, schoolId).eq(ExamPaperStructure::getPaperNumber, remark);
-                    examPaperStructureService.update(updateWrapper);
+                if (SystemConstant.strNotNull(errorMessage) && errorMessage.contains("(") && errorMessage.contains("(") && errorMessage.contains("【") && errorMessage.contains("】")) {
+                    String code = errorMessage.substring(errorMessage.indexOf("(") + 1, errorMessage.indexOf(")"));
+                    if (String.valueOf(ExceptionResultEnum.PAPER_STRUCT_EXCEPTION.getCode()).equals(code)) {
+                        // 截取试卷编号当做remark
+                        remark = errorMessage.substring(errorMessage.indexOf("【") + 1, errorMessage.indexOf("】"));
+                        errorMessage = errorMessage.substring(0, errorMessage.indexOf("("));
+                        // 更新状态(structureChange)
+                        UpdateWrapper<ExamPaperStructure> updateWrapper = new UpdateWrapper<>();
+                        updateWrapper.lambda().set(ExamPaperStructure::getStructureChange, true).eq(ExamPaperStructure::getSchoolId, schoolId).eq(ExamPaperStructure::getPaperNumber, remark);
+                        examPaperStructureService.update(updateWrapper);
+                    }
                 }
             }
 

+ 9 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/GradeBatchServiceImpl.java

@@ -149,6 +149,14 @@ public class GradeBatchServiceImpl extends ServiceImpl<GradeBatchMapper, GradeBa
         if (!SystemConstant.longNotNull(id)){
             throw ExceptionResultEnum.ERROR.exception("请选择要删除的批次对象");
         }
+        GradeBatch gradeBatch = this.getById(id);
+        if (Objects.isNull(gradeBatch)){
+            throw ExceptionResultEnum.ERROR.exception("要删除的批次不存在");
+        }
+        Long thirdExamId = gradeBatch.getThirdExamId();
+        if (!SystemConstant.longNotNull(thirdExamId)){
+            throw ExceptionResultEnum.ERROR.exception("要删除的批次中第三方考试id不存在,删除失败");
+        }
         // 要删除的批次试卷集合
         List<GradeBatchPaper> gradeBatchPaperList = gradeBatchPaperService.list(new QueryWrapper<GradeBatchPaper>()
                 .lambda()
@@ -166,7 +174,7 @@ public class GradeBatchServiceImpl extends ServiceImpl<GradeBatchMapper, GradeBa
 
             throw ExceptionResultEnum.ERROR.exception("成绩分析批次【" + String.join(",", cantDeleteBatchNameList) + "】存在分析课程,不能删除");
         }
-        if (teachCloudReportTaskUtils.syncDeleteExam(schoolId,id)){
+        if (teachCloudReportTaskUtils.syncDeleteExam(schoolId,thirdExamId)){
             this.removeById(id);
         }
     }

+ 9 - 8
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/GradePaperStructServiceImpl.java

@@ -251,9 +251,9 @@ public class GradePaperStructServiceImpl extends ServiceImpl<GradePaperStructMap
         // 更新试卷结构参数的云阅卷试卷结构
         List<ExamPaperStructure> examPaperStructureList = examPaperStructureService.list(new QueryWrapper<ExamPaperStructure>()
                 .lambda()
-                .eq(ExamPaperStructure::getSchoolId,schoolId)
-                .eq(ExamPaperStructure::getPaperNumber,paperNumber));
-        if (examPaperStructureList.size() != 1){
+                .eq(ExamPaperStructure::getSchoolId, schoolId)
+                .eq(ExamPaperStructure::getPaperNumber, paperNumber));
+        if (examPaperStructureList.size() != 1) {
             throw ExceptionResultEnum.ERROR.exception("知学知考试卷结构异常");
         }
         ExamPaperStructure examPaperStructure = examPaperStructureList.get(0);
@@ -261,7 +261,8 @@ public class GradePaperStructServiceImpl extends ServiceImpl<GradePaperStructMap
         String examId = String.valueOf(examPaperStructure.getThirdRelateId());
         // 科目代码(课程代码+卷型+课程序号)
         String subjectCode = examPaperStructure.getCourseCode().concat(examPaperStructure.getPaperType()).concat(examPaperStructure.getSequence());
-        String cloudInfoJson = cloudMarkingTaskUtils.queryPaperStructure(schoolId, examId, subjectCode, examPaperStructure.getPaperType());
+        String objective = examPaperStructure.getObjectiveStructure();
+        String cloudInfoJson = cloudMarkingTaskUtils.queryPaperStructure(schoolId, examId, subjectCode, SystemConstant.strNotNull(objective) ? examPaperStructure.getPaperType() : null);
         examPaperStructure.setCloudInfoJson(cloudInfoJson);
         examPaperStructure.setStructureChange(false);
         examPaperStructureService.updateById(examPaperStructure);
@@ -269,8 +270,8 @@ public class GradePaperStructServiceImpl extends ServiceImpl<GradePaperStructMap
         // 更新grade_paper_struct
         this.remove(new QueryWrapper<GradePaperStruct>()
                 .lambda()
-                .eq(GradePaperStruct::getSchoolId,schoolId)
-                .eq(GradePaperStruct::getPaperNumber,paperNumber));
+                .eq(GradePaperStruct::getSchoolId, schoolId)
+                .eq(GradePaperStruct::getPaperNumber, paperNumber));
     }
 
     /**
@@ -334,7 +335,7 @@ public class GradePaperStructServiceImpl extends ServiceImpl<GradePaperStructMap
                     return Stream.of(cell);
                 }).collect(Collectors.toList());
         if (!Question.matchTwoQuestionList(examPaperObjList, gradePaperObjList)) {
-            throw ExceptionResultEnum.ERROR.exception(code,"试卷编号为【" + paperNumber + "】,试卷类型为【" + paperType +
+            throw ExceptionResultEnum.ERROR.exception(code, "试卷编号为【" + paperNumber + "】,试卷类型为【" + paperType +
                     "】的分析试卷结构和 [" + comparison + "] 试卷结构在【" + QuestionType.OBJECTIVE.getDesc() + "】上不一致");
         }
 
@@ -349,7 +350,7 @@ public class GradePaperStructServiceImpl extends ServiceImpl<GradePaperStructMap
                     return Stream.of(cell);
                 }).collect(Collectors.toList());
         if (!Question.matchTwoQuestionList(examPaperSubList, gradePaperSubList)) {
-            throw ExceptionResultEnum.ERROR.exception(code,"试卷编号为【" + paperNumber + "】,试卷类型为【" + paperType +
+            throw ExceptionResultEnum.ERROR.exception(code, "试卷编号为【" + paperNumber + "】,试卷类型为【" + paperType +
                     "】的分析试卷结构和 [" + comparison + "] 试卷结构在【" + QuestionType.SUBJECTIVE.getDesc() + "】上不一致");
         }
 

+ 4 - 4
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/TBExamServiceImpl.java

@@ -108,19 +108,19 @@ public class TBExamServiceImpl extends ServiceImpl<TBExamMapper, TBExam> impleme
     @Transactional(rollbackFor = Exception.class)
     @Override
     public synchronized Boolean deleteTBExam(TBExamDeleteParam tbExamDeleteParam) {
-        Long id = tbExamDeleteParam.getId();
+        Long examId = tbExamDeleteParam.getId();
         Long schoolId = tbExamDeleteParam.getSchoolId();
         if (!SystemConstant.longNotNull(schoolId)) {
             throw ExceptionResultEnum.ERROR.exception("缺少参数学校id");
         }
-        TBExam tbExam = this.getById(id);
+        TBExam tbExam = this.getById(examId);
         if (Objects.isNull(tbExam)){
             throw ExceptionResultEnum.ERROR.exception("未找到考试信息");
         }
-        List<TBExamCourse> tbExamCourseList = tbExamCourseService.list(new QueryWrapper<TBExamCourse>().lambda().eq(TBExamCourse::getSchoolId,schoolId).eq(TBExamCourse::getExamId, id));
+        List<TBExamCourse> tbExamCourseList = tbExamCourseService.list(new QueryWrapper<TBExamCourse>().lambda().eq(TBExamCourse::getSchoolId,schoolId).eq(TBExamCourse::getExamId, examId));
         if (tbExamCourseList.size() > 0){
             throw ExceptionResultEnum.ERROR.exception("考试下还有分析课程不能删除");
         }
-        return this.removeById(id);
+        return this.removeById(examId);
     }
 }