deason 6 anos atrás
pai
commit
43df14363f

+ 4 - 0
examcloud-core-print-provider/src/main/java/cn/com/qmth/examcloud/core/print/api/provider/CoursePaperCloudServiceProvider.java

@@ -14,6 +14,8 @@ import cn.com.qmth.examcloud.core.print.api.response.SyncCoursePaperResp;
 import cn.com.qmth.examcloud.core.print.common.utils.Check;
 import cn.com.qmth.examcloud.core.print.entity.CoursePaper;
 import cn.com.qmth.examcloud.core.print.service.CoursePaperService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -28,6 +30,7 @@ import org.springframework.web.bind.annotation.RestController;
  * @since: 2018/11/15
  */
 @RestController
+@Api(tags = "课程试卷相关接口")
 @RequestMapping("${$rmp.cloud.print}/course/paper")
 public class CoursePaperCloudServiceProvider extends ControllerSupport implements CoursePaperCloudService {
     @Autowired
@@ -37,6 +40,7 @@ public class CoursePaperCloudServiceProvider extends ControllerSupport implement
      * 同步考试课程的试卷
      */
     @PostMapping("/save")
+    @ApiOperation(value = "同步考试课程的试卷")
     public SyncCoursePaperResp syncCoursePaper(@RequestBody SyncCoursePaperReq req) {
         Check.isNull(req, "请求不能为空!");
         Check.isNull(req.getBean(), "试卷信息不能为空!");

+ 14 - 4
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/bean/printingproject/PrintingProjectLessInfo.java

@@ -18,17 +18,27 @@ import java.io.Serializable;
 public class PrintingProjectLessInfo implements Serializable {
     private static final long serialVersionUID = 1L;
     /**
-     * 印刷项目ID
+     * 学校机构ID
      */
-    private Long projectId;
+    private Long orgId;
     /**
      * 考试ID
      */
     private Long examId;
     /**
-     * 学校机构ID
+     * 印刷项目ID
      */
-    private Long orgId;
+    private Long projectId;
+
+    public PrintingProjectLessInfo(Long orgId, Long examId, Long projectId) {
+        this.projectId = projectId;
+        this.examId = examId;
+        this.orgId = orgId;
+    }
+
+    public PrintingProjectLessInfo() {
+
+    }
 
     public Long getProjectId() {
         return projectId;

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

@@ -18,6 +18,7 @@ import cn.com.qmth.examcloud.core.print.service.PrintingProjectStatisticService;
 import cn.com.qmth.examcloud.core.print.service.bean.printingproject.PrintingProjectLessInfo;
 import cn.com.qmth.examcloud.core.print.service.bean.printingprojectstatistic.PrintingProjectStatisticConvert;
 import cn.com.qmth.examcloud.core.print.service.bean.printingprojectstatistic.PrintingProjectStatisticInfo;
+import com.google.common.collect.Lists;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -65,12 +66,7 @@ public class PrintingProjectStatisticServiceImpl implements PrintingProjectStati
             throw new StatusException(PRT_CODE_500, "当前项目不存在!");
         }
 
-        ProjectStatistic statistic = projectStatisticRepository.getProjectStatisticByProjectId(project.getId());
-        if (statistic == null) {
-            throw new StatusException(PRT_CODE_500, "当前项目统计不存在!");
-        }
-
-        //todo
+        this.doStatistic(Lists.newArrayList(new PrintingProjectLessInfo(orgId, examId, project.getId())));
     }
 
     @Override
@@ -79,12 +75,39 @@ public class PrintingProjectStatisticServiceImpl implements PrintingProjectStati
 
         //只处理已有的印刷项目
         List<PrintingProjectLessInfo> projects = printingProjectService.getPrintingProjectLessInfoList();
+
+        this.doStatistic(projects);
+    }
+
+    private void doStatistic(List<PrintingProjectLessInfo> projects) {
         if (projects == null || projects.isEmpty()) {
             return;
         }
 
         for (PrintingProjectLessInfo project : projects) {
+            ProjectStatistic statistic = projectStatisticRepository.getProjectStatisticByProjectId(project.getProjectId());
+            if (statistic == null) {
+                statistic = new ProjectStatistic();
+                statistic.setProjectId(project.getProjectId());
+            }
             //todo
+
+            //人科次
+            //课程数量
+            //试卷数量
+            //试卷袋数量
+
+            //常规-A3数量
+            //备份-A3数量
+            //合计-A3数量
+
+            //常规-A4数量
+            //备份-A4数量
+            //合计-A4数量
+
+            //常规-总数(A3)
+            //备份-总数(A3
+            //合计-总数(A3
         }
     }