deason %!s(int64=6) %!d(string=hai) anos
pai
achega
ea00aa5f6b

+ 10 - 7
examcloud-core-print-provider/src/main/java/cn/com/qmth/examcloud/core/print/api/controller/PrintingProjectStatisticController.java

@@ -14,10 +14,7 @@ import cn.com.qmth.examcloud.core.print.service.bean.printingproject.ProjectStat
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import static cn.com.qmth.examcloud.core.print.common.Result.success;
 
@@ -40,10 +37,16 @@ public class PrintingProjectStatisticController extends ControllerSupport {
         return printingProjectStatisticService.getPrintingProjectStatistic(orgId, examId);
     }
 
-    @PostMapping("/init/{projectId}")
+    @PostMapping("/init/{orgId}/{examId}")
     @ApiOperation(value = "刷新某个印刷项目的统计信息")
-    public Result init(@PathVariable Long projectId) {
-        printingProjectStatisticService.initPrintingProjectStatistic(projectId);
+    public Result init(@PathVariable Long orgId, @PathVariable Long examId) {
+        printingProjectStatisticService.initPrintingProjectStatistic(orgId, examId);
+        return success();
+    }
+
+    @GetMapping("/all/init")
+    public Result init() {
+        printingProjectStatisticService.initAllPrintingProjectStatistic();
         return success();
     }
 

+ 7 - 2
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/CommonService.java

@@ -35,6 +35,7 @@ public class CommonService {
      * (正式场景数据极少,一次获取全部)
      */
     public List<ExamInfo> getExamList(String examType) {
+        //todo 暂时直接查库,待“考务”接口提供后改为通过接口获取数据
         SqlWrapper sql = new SqlWrapper()
                 .select("em.id examId,em.name examName,em.root_org_id orgId,org.name orgName").from("ec_e_exam em")
                 .innerJoin("ec_b_org org").on("org.id", "em.root_org_id");
@@ -42,7 +43,6 @@ public class CommonService {
             sql.where().eq("em.exam_type", examType);
         }
         sql.orderBy("em.id", false);
-        //log.debug(sql.build());
         return jdbcTemplate.query(sql.build(), new BeanPropertyRowMapper(ExamInfo.class));
     }
 
@@ -51,9 +51,10 @@ public class CommonService {
      * 含试卷类型、考生数量
      */
     public List<ExamCourseInfo> getExamCourseList(Long orgId, Long examId, Long courseId, String paperType) {
+        //todo 暂时直接查库,待“考务”接口提供后改为通过接口获取数据
         SqlWrapper sql = new SqlWrapper()
                 .select("root_org_id orgId,exam_id,course_id,course_code,course_name,paper_type,count(course_code) totalStudent")
-                .from("ecs_exam_student")//todo ec_e_exam_student
+                .from("ecs_exam_student") // ec_e_exam_student
                 .where()
                 .eq("root_org_id", orgId)
                 .and().eq("exam_id", examId);
@@ -67,6 +68,10 @@ public class CommonService {
         return jdbcTemplate.query(sql.build(), new BeanPropertyRowMapper(ExamCourseInfo.class));
     }
 
+    /**
+     * 获取考试所有的开考课程列表
+     * 含试卷类型、考生数量
+     */
     public List<ExamCourseInfo> getExamCourseList(Long orgId, Long examId) {
         return this.getExamCourseList(orgId, examId, null, null);
     }

+ 1 - 1
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/PrintingProjectStatisticService.java

@@ -29,7 +29,7 @@ public interface PrintingProjectStatisticService {
     /**
      * 刷新某个印刷项目的统计信息
      */
-    void initPrintingProjectStatistic(Long projectId);
+    void initPrintingProjectStatistic(@NotNull Long orgId, @NotNull Long examId);
 
     /**
      * 初始所有印刷项目的统计信息

+ 1 - 1
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/impl/PrintingProjectStatisticServiceImpl.java

@@ -54,7 +54,7 @@ public class PrintingProjectStatisticServiceImpl implements PrintingProjectStati
     }
 
     @Override
-    public void initPrintingProjectStatistic(Long projectId) {
+    public void initPrintingProjectStatistic(Long orgId, Long examId) {
         //todo init
     }
 

+ 2 - 1
examcloud-core-print-starter/src/main/resources/security-exclusions.conf

@@ -13,7 +13,8 @@
 [${$rmp.ctrl.print}/printing/project][/update][POST]
 [${$rmp.ctrl.print}/printing/project][/all/init][GET]
 [${$rmp.ctrl.print}/printing/project/statistic][/{orgId}/{examId}][POST]
-[${$rmp.ctrl.print}/printing/project/statistic][/init/{projectId}][POST]
+[${$rmp.ctrl.print}/printing/project/statistic][/init/{orgId}/{examId}][POST]
+[${$rmp.ctrl.print}/printing/project/statistic][/all/init][GET]
 [${$rmp.ctrl.print}/project/backup/setting][/{projectId}][POST]
 [${$rmp.ctrl.print}/project/backup/setting][/save][POST]
 [${$rmp.ctrl.print}/project/backup/setting][/delete/{projectId}][POST]

+ 4 - 3
examcloud-core-print-starter/src/test/java/cn/com/qmth/examcloud/core/print/test/ProjectStatisticServiceTest.java

@@ -28,9 +28,10 @@ public class ProjectStatisticServiceTest extends BaseTest {
 
     @Test
     public void initPrintingProjectStatisticTest() throws Exception {
-        Long projectId = 1L;
-        printingProjectStatisticService.initPrintingProjectStatistic(projectId);
-        printingProjectStatisticService.initAllPrintingProjectStatistic();
+        Long orgId = 1L;
+        Long examId = 1L;
+        printingProjectStatisticService.initPrintingProjectStatistic(orgId, examId);
+        //printingProjectStatisticService.initAllPrintingProjectStatistic();
     }
 
 }