|
@@ -12,19 +12,18 @@ import cn.com.qmth.examcloud.core.print.common.utils.Check;
|
|
|
import cn.com.qmth.examcloud.core.print.entity.PrintingProject;
|
|
|
import cn.com.qmth.examcloud.core.print.entity.ProjectStatistic;
|
|
|
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.*;
|
|
|
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 cn.com.qmth.examcloud.examwork.api.bean.ExamPaperTypeRelation;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
import static cn.com.qmth.examcloud.core.print.common.Constants.PRT_CODE_500;
|
|
@@ -44,6 +43,8 @@ public class PrintingProjectStatisticServiceImpl implements PrintingProjectStati
|
|
|
private CourseStatisticService courseStatisticService;
|
|
|
@Autowired
|
|
|
private ProjectBackupSettingService projectBackupSettingService;
|
|
|
+ @Autowired
|
|
|
+ private StatisticService statisticService;
|
|
|
|
|
|
@Override
|
|
|
public PrintingProjectStatisticInfo getPrintingProjectStatistic(Long orgId, Long examId) {
|
|
@@ -87,50 +88,55 @@ public class PrintingProjectStatisticServiceImpl implements PrintingProjectStati
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ List<ProjectStatistic> statistics = new ArrayList<>();
|
|
|
for (PrintingProjectLessInfo project : projects) {
|
|
|
ProjectStatistic statistic = projectStatisticRepository.getProjectStatisticByProjectId(project.getProjectId());
|
|
|
if (statistic == null) {
|
|
|
statistic = new ProjectStatistic();
|
|
|
statistic.setProjectId(project.getProjectId());
|
|
|
}
|
|
|
- //人科次
|
|
|
- int totalStudent = this.calculateTotalStudent(project.getOrgId(), project.getExamId());
|
|
|
-
|
|
|
- //课程数量
|
|
|
- int totalCourse = this.calculateTotalCourse(project.getOrgId(), project.getExamId());
|
|
|
|
|
|
- //试卷数量
|
|
|
- int totalPaper = this.calculateTotalPaper(project.getOrgId(), project.getExamId());
|
|
|
+ //获取某考试的课程和试卷类型列表
|
|
|
+ List<ExamPaperTypeRelation> coursePaperTypes = statisticService.findExamCourseAndPaperTypes(project.getOrgId(), project.getExamId());
|
|
|
|
|
|
- //试卷袋数量
|
|
|
- int totalPkg = this.calculateTotalPkg(project.getOrgId(), project.getExamId());
|
|
|
+ //获取试卷袋列表
|
|
|
+ List<String> packageCodes = statisticService.findExamPackageCodes(project.getOrgId(), project.getExamId());
|
|
|
|
|
|
- //常规-A3数量
|
|
|
+ //人科次(考生的数量)
|
|
|
+ final int totalStudent = statisticService.getTotalStudent(project.getOrgId(), project.getExamId());
|
|
|
|
|
|
- //常规-A4数量
|
|
|
+ //课程数量(课程代码的数量)
|
|
|
+ final int totalCourse = statisticService.getTotalCourse(coursePaperTypes);
|
|
|
|
|
|
- //projectBackupSettingService
|
|
|
- //备份-A3数量
|
|
|
-
|
|
|
- //备份-A4数量
|
|
|
- //Double ceil = Math.ceil(getNormalA4() / 2.0);
|
|
|
- }
|
|
|
- }
|
|
|
+ //试卷数量(课程代码 + 试卷类型的数量)
|
|
|
+ final int totalPaper = coursePaperTypes.size();
|
|
|
|
|
|
- private int calculateTotalStudent(Long orgId, Long examId) {
|
|
|
- return 0;
|
|
|
- }
|
|
|
+ //试卷袋数量
|
|
|
+ final int totalPkg = packageCodes.size();
|
|
|
|
|
|
- private int calculateTotalCourse(Long orgId, Long examId) {
|
|
|
- return 0;
|
|
|
- }
|
|
|
+ //常规-A3数量(总试卷A3数 + 总答题卡A3数)
|
|
|
+ final int normalA3 = 0;//todo
|
|
|
|
|
|
- private int calculateTotalPaper(Long orgId, Long examId) {
|
|
|
- return 0;
|
|
|
- }
|
|
|
+ //常规-A4数量(试卷袋数 * 4)
|
|
|
+ final int normalA4 = totalPkg * 4;
|
|
|
|
|
|
- private int calculateTotalPkg(Long orgId, Long examId) {
|
|
|
- return 0;
|
|
|
+ //备份-A3数量
|
|
|
+ final int backupA3 = 0;//todo
|
|
|
+
|
|
|
+ //备份-A4数量(试卷袋数 * 2)
|
|
|
+ final int backupA4 = totalPkg * 2;
|
|
|
+
|
|
|
+ statistic.setTotalStudent(totalStudent);
|
|
|
+ statistic.setTotalCourse(totalCourse);
|
|
|
+ statistic.setTotalPaper(totalPaper);
|
|
|
+ statistic.setTotalPkg(totalPkg);
|
|
|
+ statistic.setNormalA3(normalA3);
|
|
|
+ statistic.setNormalA4(normalA4);
|
|
|
+ statistic.setBackupA3(backupA3);
|
|
|
+ statistic.setBackupA4(backupA4);
|
|
|
+ statistics.add(statistic);
|
|
|
+ }
|
|
|
+ projectStatisticRepository.save(statistics);
|
|
|
}
|
|
|
|
|
|
}
|