|
|
@@ -4,18 +4,23 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
-import com.izouma.wenlvju.domain.GradingOrganization;
|
|
|
-import com.izouma.wenlvju.domain.Organization;
|
|
|
-import com.izouma.wenlvju.domain.Record;
|
|
|
-import com.izouma.wenlvju.domain.RecordSpecialty;
|
|
|
+import com.izouma.wenlvju.domain.*;
|
|
|
+import com.izouma.wenlvju.domain.performance.Participant;
|
|
|
+import com.izouma.wenlvju.domain.performance.Performance;
|
|
|
+import com.izouma.wenlvju.domain.performance.Programme;
|
|
|
import com.izouma.wenlvju.domain.regulation.*;
|
|
|
import com.izouma.wenlvju.dto.ChartItem;
|
|
|
import com.izouma.wenlvju.dto.PageQuery;
|
|
|
+import com.izouma.wenlvju.dto.PerformanceStatistic;
|
|
|
import com.izouma.wenlvju.dto.ReportDTO;
|
|
|
+import com.izouma.wenlvju.enums.ProgrammeStatus;
|
|
|
import com.izouma.wenlvju.enums.ReportType;
|
|
|
import com.izouma.wenlvju.enums.UnitType;
|
|
|
import com.izouma.wenlvju.exception.BusinessException;
|
|
|
import com.izouma.wenlvju.repo.*;
|
|
|
+import com.izouma.wenlvju.repo.performance.ParticipantRepo;
|
|
|
+import com.izouma.wenlvju.repo.performance.PerformanceRepo;
|
|
|
+import com.izouma.wenlvju.repo.performance.ProgrammeRepo;
|
|
|
import com.izouma.wenlvju.repo.regulation.ComplainRepo;
|
|
|
import com.izouma.wenlvju.repo.regulation.RecordExpertAuditRepo;
|
|
|
import com.izouma.wenlvju.repo.regulation.ReportRepo;
|
|
|
@@ -25,6 +30,7 @@ import com.izouma.wenlvju.service.storage.StorageService;
|
|
|
import com.izouma.wenlvju.utils.ChartUtils;
|
|
|
import com.izouma.wenlvju.utils.JpaUtils;
|
|
|
import com.izouma.wenlvju.utils.ObjUtils;
|
|
|
+import com.sun.tools.doclint.Entity;
|
|
|
import freemarker.template.Configuration;
|
|
|
import freemarker.template.Template;
|
|
|
import freemarker.template.TemplateException;
|
|
|
@@ -47,6 +53,8 @@ import java.time.LocalTime;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+import static com.sun.tools.doclint.Entity.sum;
|
|
|
+
|
|
|
@Slf4j
|
|
|
@Service
|
|
|
@AllArgsConstructor
|
|
|
@@ -62,6 +70,10 @@ public class ReportService {
|
|
|
private StorageService storageService;
|
|
|
private ReportStatisticRepo reportStatisticRepo;
|
|
|
private RateRepo rateRepo;
|
|
|
+ private PerformanceRepo performanceRepo;
|
|
|
+ private ProgrammeRepo programmeRepo;
|
|
|
+ private ParticipantRepo participantRepo;
|
|
|
+ private ArtTypeRepo artTypeRepo;
|
|
|
|
|
|
public Page<Report> all(PageQuery pageQuery) {
|
|
|
return reportRepo.findAll(JpaUtils.toSpecification(pageQuery, Report.class), JpaUtils.toPageRequest(pageQuery));
|
|
|
@@ -255,11 +267,6 @@ public class ReportService {
|
|
|
// 备案
|
|
|
int examCenterQuantity = value.stream().mapToInt(Record::getExamCenterQuantity).sum();
|
|
|
int examQuantity = value.stream().mapToInt(Record::getExamQuantity).sum();
|
|
|
-// // 备案检查
|
|
|
-// List<Long> rids = recordList.stream().map(Record::getId).collect(Collectors.toList());
|
|
|
-// Map<String, Long> type = recordAudits.stream()
|
|
|
-// .filter(ra -> ids.contains(ra.getRecordId()) && !ra.isValue())
|
|
|
-// .collect(Collectors.groupingBy(RecordExpertAudit::getType, Collectors.counting()));
|
|
|
|
|
|
reportDTOS.add(ReportStatistic.builder()
|
|
|
.unitType(UnitType.GRADING_ORGANIZATION)
|
|
|
@@ -921,4 +928,46 @@ public class ReportService {
|
|
|
rateRepo.countAllByYearAndRejectedAtIsNull(String.valueOf(year));
|
|
|
}
|
|
|
|
|
|
+ /*
|
|
|
+ 展演
|
|
|
+ */
|
|
|
+ public List<PerformanceStatistic> performanceStatistics() {
|
|
|
+ List<Programme> programmes = programmeRepo.findAllByProgrammeStatusIsNot(ProgrammeStatus.INITIAL);
|
|
|
+ List<Performance> performances = performanceRepo.findAll();
|
|
|
+ Map<Long, List<Programme>> programmeMap = programmes.stream()
|
|
|
+ .collect(Collectors.groupingBy(Programme::getPerformanceId));
|
|
|
+ Map<Long, Long> participantMap = participantRepo.findAll()
|
|
|
+ .stream()
|
|
|
+ .collect(Collectors.groupingBy(Participant::getProgrammeId, Collectors.counting()));
|
|
|
+ Map<Long, String> artMap = artTypeRepo.findAllByParentIsNull()
|
|
|
+ .stream()
|
|
|
+ .collect(Collectors.toMap(ArtType::getId, ArtType::getName));
|
|
|
+
|
|
|
+ List<PerformanceStatistic> statistics = new ArrayList<>();
|
|
|
+ List<NumOfReport> programmeNum = new ArrayList<>();
|
|
|
+ List<NumOfReport> participantNum = new ArrayList<>();
|
|
|
+ performances.forEach(performance -> {
|
|
|
+ PerformanceStatistic performanceStatistic = new PerformanceStatistic();
|
|
|
+ performanceStatistic.setYear(Integer.parseInt(performance.getYear()));
|
|
|
+
|
|
|
+ List<Programme> programmeList = programmeMap.get(performance.getId());
|
|
|
+ Map<Long, List<Programme>> specialty = programmeList.stream()
|
|
|
+ .collect(Collectors.groupingBy(Programme::getParentSpecialtyId));
|
|
|
+ specialty.forEach((key, value) -> {
|
|
|
+ String name = artMap.get(key);
|
|
|
+ programmeNum.add(new NumOfReport(name, value.size()));
|
|
|
+ long sum = value.stream()
|
|
|
+ .mapToLong(programme -> ObjectUtil.isNull(participantMap.get(programme.getId())) ? 0L : participantMap.get(programme.getId()))
|
|
|
+ .sum();
|
|
|
+ participantNum.add(new NumOfReport(name, (int) sum));
|
|
|
+ });
|
|
|
+ performanceStatistic.setParticipantNum(participantNum);
|
|
|
+ performanceStatistic.setProgrammeNum(programmeNum);
|
|
|
+
|
|
|
+ statistics.add(performanceStatistic);
|
|
|
+ });
|
|
|
+
|
|
|
+ return statistics;
|
|
|
+ }
|
|
|
+
|
|
|
}
|