deason 6 лет назад
Родитель
Сommit
9565a9b788

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

@@ -16,10 +16,7 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-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;
 
@@ -43,9 +40,9 @@ public class CourseStatisticController extends ControllerSupport {
     }
 
     @PostMapping("/init")
-    @ApiOperation(value = "初始课程的统计信息")
-    public Result init() {
-        courseStatisticService.initCourseStatistics();
+    @ApiOperation(value = "刷新某些课程的统计信息")
+    public Result init(@RequestParam Long orgId, @RequestParam Long examId, @RequestParam Long[] courseIds) {
+        courseStatisticService.initCourseStatistics(orgId, examId, courseIds);
         return success();
     }
 

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

@@ -23,7 +23,12 @@ public interface CourseStatisticService {
     Page<CourseStatisticInfo> getCourseStatisticList(CourseStatisticQuery query);
 
     /**
-     * 初始课程的统计信息
+     * 刷新某些课程的统计信息
+     */
+    void initCourseStatistics(Long orgId, Long examId, Long[] courseIds);
+
+    /**
+     * 初始所有课程的统计信息
      */
     void initCourseStatistics();
 

+ 25 - 0
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/bean/coursestatistic/CourseStatisticConvert.java

@@ -0,0 +1,25 @@
+/*
+ * *************************************************
+ * Copyright (c) 2018 QMTH. All Rights Reserved.
+ * Created by Deason on 2018-11-05 16:58:51.
+ * *************************************************
+ */
+
+package cn.com.qmth.examcloud.core.print.service.bean.coursestatistic;
+
+import cn.com.qmth.examcloud.core.print.entity.CoursePaper;
+import cn.com.qmth.examcloud.core.print.entity.CourseStatistic;
+
+/**
+ * @author: fengdesheng
+ * @since: 2018/11/05
+ */
+public class CourseStatisticConvert {
+
+    public static CourseStatisticInfo of(CourseStatistic statistic, CoursePaper paper) {
+        CourseStatisticInfo info = new CourseStatisticInfo();
+        //todo
+        return info;
+    }
+
+}

+ 6 - 6
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/bean/coursestatistic/CourseStatisticInfo.java

@@ -56,7 +56,7 @@ public class CourseStatisticInfo implements Serializable {
      * @See PaperBindingStatus.java
      * 试卷绑定状态
      */
-    private Integer bindingStatus;
+    private Integer paperBindingStatus;
     /**
      * 试卷文件URL
      */
@@ -75,7 +75,7 @@ public class CourseStatisticInfo implements Serializable {
     private Integer totalStudent;
 
     public String getBindingStatusName() {
-        return PaperBindingStatus.getNameByIndex(bindingStatus);
+        return PaperBindingStatus.getNameByIndex(paperBindingStatus);
     }
 
     public Long getId() {
@@ -150,12 +150,12 @@ public class CourseStatisticInfo implements Serializable {
         this.paperType = paperType;
     }
 
-    public Integer getBindingStatus() {
-        return bindingStatus;
+    public Integer getPaperBindingStatus() {
+        return paperBindingStatus;
     }
 
-    public void setBindingStatus(Integer bindingStatus) {
-        this.bindingStatus = bindingStatus;
+    public void setPaperBindingStatus(Integer paperBindingStatus) {
+        this.paperBindingStatus = paperBindingStatus;
     }
 
     public String getPaperFileUrl() {

+ 25 - 0
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/impl/CourseStatisticServiceImpl.java

@@ -7,6 +7,8 @@
 
 package cn.com.qmth.examcloud.core.print.service.impl;
 
+import cn.com.qmth.examcloud.core.print.common.jpa.SearchBuilder;
+import cn.com.qmth.examcloud.core.print.common.utils.Check;
 import cn.com.qmth.examcloud.core.print.repository.CourseStatisticRepository;
 import cn.com.qmth.examcloud.core.print.service.CourseStatisticService;
 import cn.com.qmth.examcloud.core.print.service.bean.coursestatistic.CourseStatisticInfo;
@@ -26,10 +28,33 @@ public class CourseStatisticServiceImpl implements CourseStatisticService {
 
     @Override
     public Page<CourseStatisticInfo> getCourseStatisticList(CourseStatisticQuery query) {
+        Check.isNull(query, "查询参数不能为空!");
+        //查询条件
+        SearchBuilder searches = new SearchBuilder();
+        if (query.getOrgId() != null) {
+            searches.eq("orgId", query.getOrgId());
+        }
+        if (query.getExamId() != null) {
+            searches.eq("examId", query.getExamId());
+        }
+        if (query.getCourseId() != null) {
+            searches.eq("courseId", query.getCourseId());
+        }
+        if (query.getPaperId() != null) {
+            searches.eq("paperId", query.getPaperId());
+        }
+        if (query.getPaperBindingStatus() != null) {
+            searches.eq("paperBindingStatus", query.getPaperBindingStatus());
+        }
         //todo
         return null;
     }
 
+    @Override
+    public void initCourseStatistics(Long orgId, Long examId, Long[] courseIds) {
+        //todo
+    }
+
     @Override
     public void initCourseStatistics() {
         //todo

+ 4 - 5
examcloud-core-print-starter/src/main/resources/security-exclusions.conf

@@ -5,28 +5,27 @@
 [/swagger-resources][/configuration/ui][GET]
 [/swagger-resources][/configuration/security][GET]
 [][${springfox.documentation.swagger.v2.path:/v2/api-docs}][GET]
-[${server.error.path:${error.path:/error}}][][POST]
 
 [${$rmp.ctrl.print}/upload][/upyun/info][POST]
 [${$rmp.ctrl.print}/printing/project][/list][POST]
 [${$rmp.ctrl.print}/printing/project][/{id}][POST]
 [${$rmp.ctrl.print}/printing/project][/update][POST]
 [${$rmp.ctrl.print}/printing/project][/init][GET]
-
 [${$rmp.ctrl.print}/printing/project/statistic][/{orgId}/{examId}][POST]
 [${$rmp.ctrl.print}/printing/project/statistic][/init/{projectId}][POST]
 [${$rmp.ctrl.print}/project/backup/setting][/{projectId}][POST]
 [${$rmp.ctrl.print}/project/backup/setting][/save][POST]
-[${$rmp.ctrl.print}/project/other/setting][/delete/{id}][POST]
+[${$rmp.ctrl.print}/project/backup/setting][/delete/{projectId}][POST]
+[${$rmp.ctrl.print}/project/other/setting][/list][POST]
 [${$rmp.ctrl.print}/project/other/setting][/{id}][POST]
 [${$rmp.ctrl.print}/project/other/setting][/save][POST]
-[${$rmp.ctrl.print}/project/other/setting][/list][POST]
-
+[${$rmp.ctrl.print}/project/other/setting][/delete/{id}][POST]
 [${$rmp.ctrl.print}/course/statistic][/list][POST]
 [${$rmp.ctrl.print}/course/statistic][/init][POST]
 [${$rmp.ctrl.print}/project/template][/{orgId}/{examId}][POST]
 [${$rmp.ctrl.print}/project/template][/save][POST]
 [${$rmp.ctrl.print}/project/template][/{id}][POST]
+
 [${$rmp.ctrl.print}/examStructure][/list][POST]
 [${$rmp.ctrl.print}/examStructure][/save][POST]
 [${$rmp.ctrl.print}/examStructure][/findOne][POST]

+ 4 - 0
examcloud-core-print-starter/src/test/java/cn/com/qmth/examcloud/core/print/test/CourseStatisticServiceTest.java

@@ -33,6 +33,10 @@ public class CourseStatisticServiceTest extends BaseTest {
 
     @Test
     public void initCourseStatisticsTest() throws Exception {
+        Long orgId = 1L;
+        Long examId = 1L;
+        Long[] courseIds = {1L};
+        courseStatisticService.initCourseStatistics(orgId, examId, courseIds);
         courseStatisticService.initCourseStatistics();
     }