比赛大屏-学生个人、院系综合大屏接口 12.7

main
zhc077 12 months ago
parent af05ca57ef
commit fe0e4e41b2
  1. 6
      jeecg-boot-master/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/DateUtils.java
  2. 31
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/bigScreen/service/CompSystemBigScreenServiceImpl.java

@ -780,12 +780,12 @@ public class DateUtils extends PropertyEditorSupport {
* @author: z.h.c
* @date: 23/11/30 15:38
*/
public static List<Integer> getLast4Year() {
public static List<Integer> getLastxYear(int lastYear) {
Calendar calendar = Calendar.getInstance(); // 创建Calendar对象并初始化为当前时间
int currentYear = calendar.get(Calendar.YEAR);
List<Integer> years = new LinkedList<>();
years.add(currentYear);
for (int i = 0; i < 4; i++) {
for (int i = 0; i < lastYear-1; i++) {
calendar.add(Calendar.YEAR, -1); // 将日期向前移动一年
int previousYear = calendar.get(Calendar.YEAR); // 获取上一年的年份
years.add(previousYear);
@ -795,7 +795,7 @@ public class DateUtils extends PropertyEditorSupport {
public static void main(String[] args) {
List<Integer> last4Year = getLast4Year();
List<Integer> last4Year = getLastxYear(1);
last4Year.forEach(y->{
System.out.println(y);
});

@ -11,7 +11,9 @@ import org.jeecg.modules.demo.annual.entity.Annual;
import org.jeecg.modules.demo.annual.service.IAnnualService;
import org.jeecg.modules.demo.annualCompPoint.entity.AnnualCompPoint;
import org.jeecg.modules.demo.annualCompPoint.service.IAnnualCompPointService;
import org.jeecg.modules.demo.annualScore.entity.PersonalCompScore;
import org.jeecg.modules.demo.annualScore.entity.PersonalCompTotalScore;
import org.jeecg.modules.demo.annualScore.service.IPersonalCompScoreService;
import org.jeecg.modules.demo.annualScore.service.IPersonalCompTotalScoreService;
import org.jeecg.modules.demo.annualcomp.entity.AnnualComp;
import org.jeecg.modules.demo.annualcomp.service.IAnnualCompService;
@ -75,6 +77,9 @@ public class CompSystemBigScreenServiceImpl implements CompSystemBigScreenServic
@Autowired
private IPersonalCompTotalScoreService iPersonalCompTotalScoreService;
@Autowired
private IPersonalCompScoreService iPersonalCompScoreService;
@Autowired
private IDepartAbilityEvaluationService iDepartAbilityEvaluationService;
@ -118,19 +123,19 @@ public class CompSystemBigScreenServiceImpl implements CompSystemBigScreenServic
compCounts.put("pointCount", pointCount);
//总报名数数
Long count = iAnnualCompetitionProjectRegistrationService.count();
//学生人数
Long personCount = iAnnualCompetitionProjectRegistrationService.count(new LambdaQueryWrapper<AnnualCompetitionProjectRegistration>()
.eq(AnnualCompetitionProjectRegistration::getEntryFormat, "0"));
//学生人数
compCounts.put("personCompCount", personCount);
//队伍数
Long teamCount = count - personCount;
//队伍数
compCounts.put("teamCompCount", teamCount);
resultMap.put("compCounts", compCounts);
List<DepartAbilityEvaluation> departAbilityEvaluations = iDepartAbilityEvaluationService.list();
resultMap.put("departAbilityEvaluation", departAbilityEvaluations);
List<Integer> years = DateUtils.getLast4Year();
List<Integer> years = DateUtils.getLastxYear(5);
List<Annual> annualList = iAnnualService.list(new LambdaQueryWrapper<Annual>().in(Annual::getAnnualName, years).orderByAsc(Annual::getAnnualName));
List<Last5YearDataVo> last5YearDataVos = new LinkedList<>();
Optional.ofNullable(annualList).orElse(new LinkedList<>()).stream().forEach(annual -> {
@ -182,8 +187,26 @@ public class CompSystemBigScreenServiceImpl implements CompSystemBigScreenServic
AnnualCompPoint annualCompPoint = iAnnualCompPointService.getById(award.getAnnualCompP());
award.setAnnualCompPname(annualCompPoint.getObjName());
});
studentInfoMap.put("awardList", awardPersions);
studentInfoMap.put("studentAwardList", awardPersions);
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));
annualList.forEach(annual -> {
AtomicReference<BigDecimal> baseScore = new AtomicReference<>(BigDecimal.ZERO);
Map<String, Object> yearData = new LinkedHashMap<>();
yearData.put("year", annual.getAnnualName());
List<PersonalCompScore> compScoreList = iPersonalCompScoreService.list(new LambdaQueryWrapper<PersonalCompScore>()
.eq(PersonalCompScore::getWorkOn, person.getWorkOn())
.eq(PersonalCompScore::getAnnualId, annual.getId()));
if (!ObjectUtils.isEmpty(compScoreList)) {
double sum = compScoreList.stream().mapToDouble(PersonalCompScore::getScore).sum();
baseScore.getAndUpdate(val -> val.add(new BigDecimal(sum)));
}
yearData.put("score", baseScore);
last4YearData.add(yearData);
});
studentInfoMap.put("last4YearData", last4YearData);
studentInfoMap.put("workNo", person.getWorkOn());
studentInfoMap.put("name", sysUser.getRealname());
studentInfoMap.put("major", "软件工程");

Loading…
Cancel
Save