单项比赛问题修改 7.31

main
zhc077 4 months ago
parent 039f5bd70b
commit 1d938aec08
  1. 12
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/bigScreen/service/CompSystemBigScreenServiceImpl.java

@ -489,10 +489,11 @@ public class CompSystemBigScreenServiceImpl implements CompSystemBigScreenServic
//比赛数
last5YearDataVo.setCompCount(1);
AnnualCompPoint annualCompPoint = iAnnualCompPointService.getOne(new LambdaQueryWrapper<AnnualCompPoint>().eq(AnnualCompPoint::getAnnualCompId, ac.getId()));
if (!ObjectUtils.isEmpty(annualCompPoint)) {
List<AnnualCompPoint> annualCompPoints = iAnnualCompPointService.list(new LambdaQueryWrapper<AnnualCompPoint>().eq(AnnualCompPoint::getAnnualCompId, ac.getId()));
if (!ObjectUtils.isEmpty(annualCompPoints)) {
Set<String> pids = annualCompPoints.stream().map(e -> e.getId()).collect(Collectors.toSet());
long personCount4CompTemp = iAnnualCompetitionProjectRegistrationService.count(new LambdaQueryWrapper<AnnualCompetitionProjectRegistration>().
eq(AnnualCompetitionProjectRegistration::getAnnualCompid, annualCompPoint.getId()));
in(AnnualCompetitionProjectRegistration::getAnnualCompid, pids));
personCount4Comp.getAndUpdate(val -> val.add(new BigDecimal(personCount4CompTemp)));
last5YearDataVo.setPersonCount(personCount4Comp.get().intValue());
}
@ -667,6 +668,9 @@ public class CompSystemBigScreenServiceImpl implements CompSystemBigScreenServic
List<Map<String, Object>> last4YearData = new LinkedList<>();
List<Integer> years = DateUtils.getLastxYear(4);
List<Annual> annualList = iAnnualService.list(new LambdaQueryWrapper<Annual>().in(Annual::getAnnualName, years).orderByAsc(Annual::getAnnualName));
DecimalFormat decimalFormat = new DecimalFormat();
decimalFormat.setMaximumFractionDigits(2); // 保留两位小数
decimalFormat.setRoundingMode(RoundingMode.HALF_UP); // 设置具体的进位机制
annualList.forEach(annual -> {
AtomicReference<BigDecimal> baseScore = new AtomicReference<>(BigDecimal.ZERO);
Map<String, Object> yearData = new LinkedHashMap<>();
@ -678,7 +682,7 @@ public class CompSystemBigScreenServiceImpl implements CompSystemBigScreenServic
double sum = compScoreList.stream().mapToDouble(PersonalCompScore::getScore).sum();
baseScore.getAndUpdate(val -> val.add(new BigDecimal(sum)));
}
yearData.put("score", baseScore);
yearData.put("score", decimalFormat.format(baseScore.get()));
last4YearData.add(yearData);
});
studentInfoMap.put("last4YearData", last4YearData);

Loading…
Cancel
Save