deason vor 6 Jahren
Ursprung
Commit
49ccb80cff

+ 18 - 18
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/bean/printingprojectstatistic/PrintingProjectStatisticInfo.java

@@ -70,7 +70,7 @@ public class PrintingProjectStatisticInfo implements Serializable {
      */
     private Integer normalA4;
     /**
-     * 备份 印刷数量A4
+     * 备份 印刷数量A3
      */
     private Integer backupA3;
     /**
@@ -79,40 +79,40 @@ public class PrintingProjectStatisticInfo implements Serializable {
     private Integer backupA4;
 
     /**
-     * 常规总数(A3)
+     * 合计 印刷数量A3 = 常规A3数 + 备份A3数
      */
-    public Integer getSummary() {
-        Double ceil = Math.ceil(getNormalA4() / 2.0);
-        return getNormalA3() + ceil.intValue();
+    public Integer getTotalA3() {
+        return getNormalA3() + getBackupA3();
     }
 
     /**
-     * 备份总数(A3)
+     * 合计 印刷数量A4 = 常规A4数 + 备份A4数
      */
-    public Integer getBackupSummary() {
-        Double ceil = Math.ceil(getBackupA4() / 2.0);
-        return getBackupA3() + ceil.intValue();
+    public Integer getTotalA4() {
+        return getNormalA4() + getBackupA4();
     }
 
     /**
-     * 合计总数(A3)
+     * 常规总数(A3) = 常规A3 + 常规A4/2
      */
-    public Integer getTotalSummary() {
-        return getSummary() + getBackupSummary();
+    public Integer getSummary() {
+        Double ceil = Math.ceil(getNormalA4() / 2.0);
+        return getNormalA3() + ceil.intValue();
     }
 
     /**
-     * 合计 印刷数量A3
+     * 备份总数(A3) = 备份A3 + 备份A4/2
      */
-    public Integer getTotalA3() {
-        return getNormalA3() + getBackupA3();
+    public Integer getBackupSummary() {
+        Double ceil = Math.ceil(getBackupA4() / 2.0);
+        return getBackupA3() + ceil.intValue();
     }
 
     /**
-     * 合计 印刷数量A4
+     * 合计总数(A3) = 常规总数 + 备份总数
      */
-    public Integer getTotalA4() {
-        return getNormalA4() + getBackupA4();
+    public Integer getTotalSummary() {
+        return getSummary() + getBackupSummary();
     }
 
     public Long getProjectId() {

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

@@ -15,6 +15,7 @@ import cn.com.qmth.examcloud.core.print.repository.ProjectStatisticRepository;
 import cn.com.qmth.examcloud.core.print.service.CourseStatisticService;
 import cn.com.qmth.examcloud.core.print.service.PrintingProjectService;
 import cn.com.qmth.examcloud.core.print.service.PrintingProjectStatisticService;
+import cn.com.qmth.examcloud.core.print.service.ProjectBackupSettingService;
 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;
@@ -41,6 +42,8 @@ public class PrintingProjectStatisticServiceImpl implements PrintingProjectStati
     private PrintingProjectService printingProjectService;
     @Autowired
     private CourseStatisticService courseStatisticService;
+    @Autowired
+    private ProjectBackupSettingService projectBackupSettingService;
 
     @Override
     public PrintingProjectStatisticInfo getPrintingProjectStatistic(Long orgId, Long examId) {
@@ -90,25 +93,44 @@ public class PrintingProjectStatisticServiceImpl implements PrintingProjectStati
                 statistic = new ProjectStatistic();
                 statistic.setProjectId(project.getProjectId());
             }
-            //todo
-
             //人科次
+            int totalStudent = this.calculateTotalStudent(project.getOrgId(), project.getExamId());
+
             //课程数量
+            int totalCourse = this.calculateTotalCourse(project.getOrgId(), project.getExamId());
+
             //试卷数量
+            int totalPaper = this.calculateTotalPaper(project.getOrgId(), project.getExamId());
+
             //试卷袋数量
+            int totalPkg = this.calculateTotalPkg(project.getOrgId(), project.getExamId());
 
             //常规-A3数量
-            //备份-A3数量
-            //合计-A3数量
 
             //常规-A4数量
-            //备份-A4数量
-            //合计-A4数量
 
-            //常规-总数(A3)
-            //备份-总数(A3
-            //合计-总数(A3
+            //projectBackupSettingService
+            //备份-A3数量
+
+            //备份-A4数量
+            //Double ceil = Math.ceil(getNormalA4() / 2.0);
         }
     }
 
+    private int calculateTotalStudent(Long orgId, Long examId) {
+        return 0;
+    }
+
+    private int calculateTotalCourse(Long orgId, Long examId) {
+        return 0;
+    }
+
+    private int calculateTotalPaper(Long orgId, Long examId) {
+        return 0;
+    }
+
+    private int calculateTotalPkg(Long orgId, Long examId) {
+        return 0;
+    }
+
 }

+ 13 - 7
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/impl/ProjectBackupSettingServiceImpl.java

@@ -48,13 +48,19 @@ public class ProjectBackupSettingServiceImpl implements ProjectBackupSettingServ
     public void saveProjectBackupSetting(ProjectBackupSetting info) {
         Check.isNull(info, "备份设置的信息不能为空!");
         Check.isNull(info.getProjectId(), "备份设置的项目ID不能为空!");
-        Check.isNull(info.getPkgPercent(), "每袋备份比例不能为空!");
-        Check.isNull(info.getPkgMax(), "每袋备份最大值不能为空!");
-        Check.isNull(info.getPkgMin(), "每袋备份最小值不能为空!");
-        Check.isNull(info.getGroupType(), "单独备份归集类型不能为空!");
-        Check.isNull(info.getPkgSinglePercent(), "单独备份比例不能为空!");
-        Check.isNull(info.getPkgSingleMax(), "单独备份最大值不能为空!");
-        Check.isNull(info.getPkgSingleMin(), "单独备份最小值不能为空!");
+
+        if (info.getNeedEachPkg()) {
+            Check.isNull(info.getEachPkgPercent(), "每袋备份比例不能为空!");
+            Check.isNull(info.getEachPkgMax(), "每袋备份最大值不能为空!");
+            Check.isNull(info.getEachPkgMin(), "每袋备份最小值不能为空!");
+        }
+
+        if (info.getNeedAlonePkg()) {
+            Check.isNull(info.getGroupType(), "单独备份归集类型不能为空!");
+            Check.isNull(info.getAlonePkgPercent(), "单独备份比例不能为空!");
+            Check.isNull(info.getAlonePkgMax(), "单独备份最大值不能为空!");
+            Check.isNull(info.getAlonePkgMin(), "单独备份最小值不能为空!");
+        }
 
         Specification<ProjectBackupSetting> spec = SearchBuilder.EQ("projectId", info.getProjectId());
         ProjectBackupSetting setting = projectBackupSettingRepository.findOne(spec);

+ 10 - 6
examcloud-core-print-starter/src/test/java/cn/com/qmth/examcloud/core/print/test/ProjectSettingServiceTest.java

@@ -32,13 +32,17 @@ public class ProjectSettingServiceTest extends BaseTest {
     public void saveProjectBackupSettingTest() throws Exception {
         ProjectBackupSetting setting = new ProjectBackupSetting();
         setting.setProjectId(projectId);
-        setting.setPkgPercent(0.5D);
-        setting.setPkgMax(0.5D);
-        setting.setPkgMin(0.5D);
+
+        setting.setNeedEachPkg(true);
+        setting.setEachPkgPercent(0.5D);
+        setting.setEachPkgMax(0.5D);
+        setting.setEachPkgMin(0.5D);
+
+        setting.setNeedAlonePkg(true);
         setting.setGroupType(BackupGroupType.EXAM_SITE);
-        setting.setPkgSinglePercent(0.5D);
-        setting.setPkgSingleMax(0.5D);
-        setting.setPkgSingleMin(0.5D);
+        setting.setAlonePkgPercent(0.5D);
+        setting.setAlonePkgMax(0.5D);
+        setting.setAlonePkgMin(0.5D);
         projectBackupSettingService.saveProjectBackupSetting(setting);
     }
 

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

@@ -8,6 +8,7 @@
 package cn.com.qmth.examcloud.core.print.test;
 
 import cn.com.qmth.examcloud.core.print.service.PrintingProjectStatisticService;
+import cn.com.qmth.examcloud.core.print.service.bean.printingprojectstatistic.PrintingProjectStatisticInfo;
 import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 
@@ -23,7 +24,8 @@ public class ProjectStatisticServiceTest extends BaseTest {
     public void getPrintingProjectStatisticTest() throws Exception {
         Long orgId = 1L;
         Long examId = 1L;
-        printingProjectStatisticService.getPrintingProjectStatistic(orgId, examId);
+        PrintingProjectStatisticInfo info = printingProjectStatisticService.getPrintingProjectStatistic(orgId, examId);
+        System.out.println(jsonMapper.toJson(info));
     }
 
     @Test