Procházet zdrojové kódy

Merge remote-tracking branch 'origin/dev_v3.1.0' into dev_v3.1.0

wangliang před 3 roky
rodič
revize
1ccff76f83

+ 2 - 2
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/AnalyzeDataCheckServiceImpl.java

@@ -18,9 +18,9 @@ import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
 /**
- * @Description:
+ * @Description: 教研分析数据校验服务实现类
  * @Author: CaoZixuan
- * @Date:
+ * @Date: 2022-06-09
  */
 @Service
 public class AnalyzeDataCheckServiceImpl implements AnalyzeDataCheckService {

+ 5 - 5
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/AnalyzeDataGetAndEditServiceImpl.java

@@ -82,7 +82,7 @@ public class AnalyzeDataGetAndEditServiceImpl implements AnalyzeDataGetAndEditSe
     public boolean tbPaperDispose(Long examId, String courseCode, Long schoolId) throws IOException {
         boolean repeat = false;
         if (tbExamCourseService.verifyExamCourseCantRun(examId, schoolId, courseCode, null)) {
-            throw ExceptionResultEnum.ERROR.exception("课程编号为【" + courseCode + "】的课程不能进行数据更改");
+            return false;
         }
         String courseName = basicCourseService.findByCourseCode(courseCode, schoolId).getName();
         PaperConfig paperConfig = callPrintOpenApiService.callPaperConfig(schoolId, examId, courseCode);
@@ -149,7 +149,7 @@ public class AnalyzeDataGetAndEditServiceImpl implements AnalyzeDataGetAndEditSe
     public boolean tbPaperDimensionDispose(Long examId, String courseCode, Long schoolId) throws IOException {
         boolean repeat = false;
         if (tbExamCourseService.verifyExamCourseCantRun(examId, schoolId, courseCode, null)) {
-            throw ExceptionResultEnum.ERROR.exception("课程编号为【" + courseCode + "】的课程不能进行数据更改");
+            return false;
         }
         List<PaperDimension> paperDimensionList = callPrintOpenApiService.callPaperDimension(schoolId, examId, courseCode);
 
@@ -205,7 +205,7 @@ public class AnalyzeDataGetAndEditServiceImpl implements AnalyzeDataGetAndEditSe
     public boolean tbPaperStructDispose(Long examId, String courseCode, Long schoolId) throws IOException {
         boolean repeat = false;
         if (tbExamCourseService.verifyExamCourseCantRun(examId, schoolId, courseCode, null)) {
-            throw ExceptionResultEnum.ERROR.exception("课程编号为【" + courseCode + "】的课程不能进行数据更改");
+            return false;
         }
         List<TBPaper> tbPaperList = tbPaperService.list(new QueryWrapper<TBPaper>().lambda().eq(TBPaper::getExamId, examId).eq(TBPaper::getCourseCode, courseCode));
         if (tbPaperList.size() != 1) {
@@ -297,7 +297,7 @@ public class AnalyzeDataGetAndEditServiceImpl implements AnalyzeDataGetAndEditSe
     public boolean tbPaperModuleDispose(Long examId, String courseCode, Long schoolId) throws IOException {
         boolean repeat = false;
         if (tbExamCourseService.verifyExamCourseCantRun(examId, schoolId, courseCode, null)) {
-            throw ExceptionResultEnum.ERROR.exception("课程编号为【" + courseCode + "】的课程不能进行数据更改");
+            return false;
         }
         String courseName = basicCourseService.findByCourseCode(courseCode, schoolId).getName();
         List<PaperEvaluation> paperEvaluationList = callPrintOpenApiService.callPaperModule(schoolId, examId, courseCode);
@@ -399,7 +399,7 @@ public class AnalyzeDataGetAndEditServiceImpl implements AnalyzeDataGetAndEditSe
     public boolean tbExamStudentScoreDatasourceDispose(Long examId, String courseCode, Long schoolId) throws IOException {
         boolean repeat = false;
         if (tbExamCourseService.verifyExamCourseCantRun(examId, schoolId, courseCode, null)) {
-            throw ExceptionResultEnum.ERROR.exception("课程编号为【" + courseCode + "】的课程不能进行数据更改");
+            return false;
         }
         String courseName = basicCourseService.findByCourseCode(courseCode, schoolId).getName();
         List<ExamStudentScore> examStudentScoreList = callPrintOpenApiService.callExamStudentScore(schoolId, examId, courseCode);

+ 8 - 22
teachcloud-report/src/main/java/com/qmth/teachcloud/report/api/OpenApiController.java

@@ -28,12 +28,14 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
 import java.io.IOException;
 import java.net.URLDecoder;
-import java.util.List;
 import java.util.Optional;
 
 /**
@@ -84,7 +86,7 @@ public class OpenApiController {
         Optional.ofNullable(basicSemesterParams).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("转换后的数据为空"));
         basicSemesterParams.validParams();
         BasicSchool basicSchool = AuthThirdUtil.hasPermission();
-        return ResultUtil.ok(basicSemesterService.saveBasicSemesterCommon(basicSemesterParams, basicSchool.getId(), null,true));
+        return ResultUtil.ok(basicSemesterService.saveBasicSemesterCommon(basicSemesterParams, basicSchool.getId(), null, true));
     }
 
     @ApiOperation(value = "考试创建/更新接口")
@@ -154,28 +156,12 @@ public class OpenApiController {
 
         Boolean publishStatus = publishParams.getPublishStatus();
         PublishStatusEnum publishStatusEnum;
-        if (publishStatus){
+        if (publishStatus) {
             publishStatusEnum = PublishStatusEnum.PUBLISH;
-        }else {
+        } else {
             publishStatusEnum = PublishStatusEnum.UN_PUBLISH;
         }
-        analyzeForReportService.publishReport(publishParams.getExamId(),publishParams.getCourseCode(),publishStatusEnum);
-        return ResultUtil.ok(true);
-    }
-
-
-    @ApiOperation(value = "生成课程(试卷)分析报告接口测试")
-    @ApiResponses({@ApiResponse(code = 200, message = "生成课程(试卷)分析报告接口", response = Object.class)})
-    @RequestMapping(value = "/calculate_test", method = RequestMethod.POST)
-    @Aac(auth = BOOL.FALSE)
-    public Result calculateTest(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
-                            @ApiParam(value = "科目编号", required = true) @RequestParam List<String> courseCode,
-                            @ApiParam(value = "学校id", required = true) @RequestParam Long schoolId) throws IOException {
-        CalculateParams calculateParams = new CalculateParams();
-        calculateParams.setSchoolId(schoolId);
-        calculateParams.setCourseCode(courseCode);
-        calculateParams.setExamId(examId);
-        courseCodeSyncTaskService.start(calculateParams);
+        analyzeForReportService.publishReport(publishParams.getExamId(), publishParams.getCourseCode(), publishStatusEnum);
         return ResultUtil.ok(true);
     }
 }

+ 0 - 142
teachcloud-report/src/main/java/com/qmth/teachcloud/report/api/TestCallPrintOpenApiController.java

@@ -1,142 +0,0 @@
-package com.qmth.teachcloud.report.api;
-
-import com.alibaba.fastjson.JSON;
-import com.qmth.boot.api.annotation.Aac;
-import com.qmth.boot.api.annotation.BOOL;
-import com.qmth.boot.api.constant.ApiConstant;
-import com.qmth.teachcloud.common.util.Result;
-import com.qmth.teachcloud.common.util.ResultUtil;
-import com.qmth.teachcloud.report.business.bean.dto.printOpen.*;
-import com.qmth.teachcloud.report.business.bean.params.CalculateParams;
-import com.qmth.teachcloud.report.business.service.AnalyzeDataCalculateService;
-import com.qmth.teachcloud.report.business.service.AnalyzeDataCheckService;
-import com.qmth.teachcloud.report.business.service.AnalyzeDataGetAndEditService;
-import com.qmth.teachcloud.report.business.service.CallPrintOpenApiService;
-import io.swagger.annotations.*;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.annotation.Resource;
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.util.List;
-
-/**
- * @Description: 需要删除的controllor
- * @Author: CaoZixuan
- * @Date:
- */
-@Api(tags = "测试请求分布式印刷开放接口Controller")
-@RestController
-@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + "/test/call")
-@Validated
-@Deprecated
-public class TestCallPrintOpenApiController {
-    @Resource
-    CallPrintOpenApiService callPrintOpenApiService;
-    @Resource
-    AnalyzeDataCalculateService analyzeDataCalculateService;
-    @Resource
-    AnalyzeDataCheckService analyzeDataCheckService;
-    @Resource
-    AnalyzeDataGetAndEditService analyzeDataGetAndEditService;
-
-    @ApiOperation(value = "试卷配置")
-    @ApiResponses({@ApiResponse(code = 200, message = "试卷配置", response = Object.class)})
-    @RequestMapping(value = "/paper_config", method = RequestMethod.POST)
-    @Aac(auth = BOOL.FALSE)
-    public Result paperConfig(@ApiParam(value = "考试id", required = true) @RequestParam Long thirdExamId,
-                              @ApiParam(value = "科目编号", required = true) @RequestParam String courseCode) throws IOException {
-        PaperConfig paperConfig = callPrintOpenApiService.callPaperConfig(2L,thirdExamId, courseCode);
-        System.out.println(JSON.toJSONString(paperConfig));
-        return ResultUtil.ok();
-    }
-
-    @ApiOperation(value = "维度配置")
-    @ApiResponses({@ApiResponse(code = 200, message = "试卷配置", response = Object.class)})
-    @RequestMapping(value = "/paper_dimension", method = RequestMethod.POST)
-    @Aac(auth = BOOL.FALSE)
-    public Result paperDimension(@ApiParam(value = "考试id", required = true) @RequestParam Long thirdExamId,
-                                 @ApiParam(value = "科目编号", required = true) @RequestParam String courseCode) throws IOException {
-        List<PaperDimension> paperDimensionList = callPrintOpenApiService.callPaperDimension(2L,thirdExamId, courseCode);
-        System.out.println(JSON.toJSONString(paperDimensionList));
-        return ResultUtil.ok();
-    }
-
-    @ApiOperation(value = "蓝图配置")
-    @ApiResponses({@ApiResponse(code = 200, message = "试卷配置", response = Object.class)})
-    @RequestMapping(value = "/paper_struct", method = RequestMethod.POST)
-    @Aac(auth = BOOL.FALSE)
-    public Result paperStruct(@ApiParam(value = "考试id", required = true) @RequestParam Long thirdExamId,
-                              @ApiParam(value = "科目编号", required = true) @RequestParam String courseCode) throws IOException {
-        List<PaperStructure> paperStructureList = callPrintOpenApiService.callPaperStruct(2L,thirdExamId, courseCode);
-        System.out.println(JSON.toJSONString(paperStructureList));
-        return ResultUtil.ok();
-    }
-
-    @ApiOperation(value = "模块配置")
-    @ApiResponses({@ApiResponse(code = 200, message = "试卷配置", response = Object.class)})
-    @RequestMapping(value = "/paper_module", method = RequestMethod.POST)
-    @Aac(auth = BOOL.FALSE)
-    public Result paperModule(@ApiParam(value = "考试id", required = true) @RequestParam Long thirdExamId,
-                              @ApiParam(value = "科目编号", required = true) @RequestParam String courseCode) throws IOException {
-        List<PaperEvaluation> paperEvaluationList = callPrintOpenApiService.callPaperModule(2L,thirdExamId, courseCode);
-        System.out.println(JSON.toJSONString(paperEvaluationList));
-        return ResultUtil.ok();
-    }
-
-    @ApiOperation(value = "考生成绩")
-    @ApiResponses({@ApiResponse(code = 200, message = "考生成绩", response = Object.class)})
-    @RequestMapping(value = "/exam_student_score", method = RequestMethod.POST)
-    @Aac(auth = BOOL.FALSE)
-    public Result examStudentScore(@ApiParam(value = "考试id", required = true) @RequestParam Long thirdExamId,
-                                   @ApiParam(value = "科目编号", required = true) @RequestParam String courseCode) throws IOException {
-        List<ExamStudentScore> examStudentScoreList = callPrintOpenApiService.callExamStudentScore(2L,thirdExamId, courseCode);
-        System.out.println(JSON.toJSONString(examStudentScoreList));
-        return ResultUtil.ok();
-    }
-
-    @ApiOperation(value = "获取和新增数据")
-    @ApiResponses({@ApiResponse(code = 200, message = "获取和新增数据", response = Object.class)})
-    @RequestMapping(value = "/insert_analyze_data", method = RequestMethod.POST)
-    @Aac(auth = BOOL.FALSE)
-    public Result insertAnalyzeData(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
-                                    @ApiParam(value = "科目编号", required = true) @RequestParam String courseCode,
-                                    @ApiParam(value = "学校id", required = true) @RequestParam Long schoolId) throws IOException {
-        analyzeDataGetAndEditService.dataGetAndEdit(examId, courseCode, schoolId);
-        return ResultUtil.ok();
-    }
-
-    @ApiOperation(value = "数据检验和分析触发器")
-    @ApiResponses({@ApiResponse(code = 200, message = "数据检验和分析触发器", response = Object.class)})
-    @RequestMapping(value = "/check_and_trigger", method = RequestMethod.POST)
-    @Aac(auth = BOOL.FALSE)
-    public Result checkAndTrigger(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
-                                  @ApiParam(value = "科目编号", required = true) @RequestParam List<String> courseCode,
-                                  @ApiParam(value = "学校id", required = true) @RequestParam Long schoolId) throws IOException {
-        CalculateParams calculateParams = new CalculateParams();
-        calculateParams.setSchoolId(schoolId);
-        calculateParams.setCourseCode(courseCode);
-        calculateParams.setExamId(examId);
-        analyzeDataCheckService.analyzeDataCheck(calculateParams);
-        return ResultUtil.ok();
-    }
-
-    @ApiOperation(value = "数据计算")
-    @ApiResponses({@ApiResponse(code = 200, message = "数据计算", response = Object.class)})
-    @RequestMapping(value = "/calculate", method = RequestMethod.POST)
-    @Aac(auth = BOOL.FALSE)
-    public Result calculate(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
-                            @ApiParam(value = "科目编号", required = true) @RequestParam List<String> courseCode,
-                            @ApiParam(value = "学校id", required = true) @RequestParam Long schoolId) throws IOException, InvocationTargetException, InstantiationException, IllegalAccessException, NoSuchMethodException {
-        CalculateParams calculateParams = new CalculateParams();
-        calculateParams.setSchoolId(schoolId);
-        calculateParams.setCourseCode(courseCode);
-        calculateParams.setExamId(examId);
-        analyzeDataCalculateService.dataCalculateStart(calculateParams);
-        return ResultUtil.ok();
-    }
-}