|
@@ -12,6 +12,7 @@ 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.ProjectBackupSetting;
|
|
|
import cn.com.qmth.examcloud.core.print.entity.ProjectStatistic;
|
|
|
+import cn.com.qmth.examcloud.core.print.enums.BackupGroupType;
|
|
|
import cn.com.qmth.examcloud.core.print.repository.ProjectBackupSettingRepository;
|
|
|
import cn.com.qmth.examcloud.core.print.repository.ProjectStatisticRepository;
|
|
|
import cn.com.qmth.examcloud.core.print.service.CourseStatisticService;
|
|
@@ -116,10 +117,10 @@ public class PrintingProjectStatisticServiceImpl implements PrintingProjectStati
|
|
|
ProjectBackupSetting backupSetting = projectBackupSettingRepository.findByProjectId(project.getProjectId());
|
|
|
|
|
|
//人科次(考生的数量)
|
|
|
- final int totalStudent = statisticService.findExamTotalStudent(project.getOrgId(), project.getExamId());
|
|
|
+ final int totalStudent = statisticService.countExamTotalStudent(project.getExamId());
|
|
|
|
|
|
//课程数量(课程代码的数量)
|
|
|
- final int totalCourse = statisticService.parseExamTotalCourse(coursePaperTypes);
|
|
|
+ final int totalCourse = statisticService.countExamTotalCourse(coursePaperTypes);
|
|
|
|
|
|
//试卷数量(课程代码 + 试卷类型的数量)
|
|
|
final int totalPaper = coursePaperTypes.size();
|
|
@@ -134,7 +135,7 @@ public class PrintingProjectStatisticServiceImpl implements PrintingProjectStati
|
|
|
final int normalA4 = totalPkg * 4;
|
|
|
|
|
|
//备份-A3数量(每袋冗余数 + 单独备份袋数)
|
|
|
- final int backupA3 = this.parseBackupA3(backupSetting);
|
|
|
+ final int backupA3 = this.parseBackupA3(backupSetting, packageCodes, project.getExamId());
|
|
|
|
|
|
//备份-A4数量(试卷袋数 * 2)
|
|
|
final int backupA4 = totalPkg * 2;
|
|
@@ -165,7 +166,7 @@ public class PrintingProjectStatisticServiceImpl implements PrintingProjectStati
|
|
|
return sumPaperA3 + (totalStudent * 2);
|
|
|
}
|
|
|
|
|
|
- private int parseBackupA3(ProjectBackupSetting backupSetting) {
|
|
|
+ private int parseBackupA3(ProjectBackupSetting backupSetting, List<String> packageCodes, Long examId) {
|
|
|
if (backupSetting == null) {
|
|
|
return 0;
|
|
|
}
|
|
@@ -178,15 +179,55 @@ public class PrintingProjectStatisticServiceImpl implements PrintingProjectStati
|
|
|
|
|
|
if (backupSetting.getNeedEachPkg()) {
|
|
|
//备份A3 = ∑n 试卷袋(X考生 * P%备份比例) * 2
|
|
|
-
|
|
|
+ int eachTotal = 0;
|
|
|
+ for (String packageCode : packageCodes) {
|
|
|
+ eachTotal += statisticService.countExamTotalStudentByPackageCode(examId, packageCode);
|
|
|
+ }
|
|
|
+ sumA3 += (eachTotal * 2);
|
|
|
}
|
|
|
|
|
|
if (backupSetting.getNeedAlonePkg()) {
|
|
|
//备份A3 = ∑n 学习中心或考点(X考生 * P%备份比例) * 2
|
|
|
+ int aloneTotal = 0;
|
|
|
+
|
|
|
+ if (BackupGroupType.isLeanCenter(backupSetting.getGroupType())) {
|
|
|
+ //备份比例:高于最大取最大;低于最小则取最小
|
|
|
+ Double percent = backupSetting.getEachPkgPercent();
|
|
|
+ if (percent > backupSetting.getEachPkgMax()) {
|
|
|
+ percent = backupSetting.getEachPkgMax();
|
|
|
+ }
|
|
|
+ if (percent < backupSetting.getEachPkgMin()) {
|
|
|
+ percent = backupSetting.getEachPkgMin();
|
|
|
+ }
|
|
|
+
|
|
|
+ //计算每个学习中心的备份数
|
|
|
+ List<Long> learnCenters = statisticService.findExamLearnCenters(examId);
|
|
|
+ for (Long learnCenterId : learnCenters) {
|
|
|
+ int count = statisticService.countExamTotalStudentByLearnCenter(examId, learnCenterId);
|
|
|
+ aloneTotal += Math.ceil((count * percent) / 100);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //备份比例:高于最大取最大;低于最小则取最小
|
|
|
+ Double percent = backupSetting.getAlonePkgPercent();
|
|
|
+ if (percent > backupSetting.getAlonePkgMax()) {
|
|
|
+ percent = backupSetting.getAlonePkgMax();
|
|
|
+ }
|
|
|
+ if (percent < backupSetting.getAlonePkgMin()) {
|
|
|
+ percent = backupSetting.getAlonePkgMin();
|
|
|
+ }
|
|
|
+
|
|
|
+ //计算每个考点的备份数
|
|
|
+ List<String> siteIds = statisticService.findExamSites(examId);
|
|
|
+ for (String siteId : siteIds) {
|
|
|
+ int count = statisticService.countExamTotalStudentBySite(examId, siteId);
|
|
|
+ aloneTotal += Math.ceil((count * percent) / 100);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ sumA3 += (aloneTotal * 2);
|
|
|
}
|
|
|
|
|
|
- return 0;
|
|
|
+ return sumA3;
|
|
|
}
|
|
|
|
|
|
}
|