From 60325b3db4d5c870e967796ff5fd114970ebb022 Mon Sep 17 00:00:00 2001 From: zhc077 <565291854@qq.com> Date: Tue, 9 Jul 2024 16:36:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B2=B3=E5=8D=97=E6=9C=BA=E7=94=B5=E8=81=8C?= =?UTF-8?q?=E4=B8=9A=E5=AD=A6=E9=99=A2-=E5=A4=A7=E5=B1=8F=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CompSystemBigScreenController.java | 12 +++ .../service/CompSystemBigScreenService.java | 5 ++ .../CompSystemBigScreenServiceImpl.java | 83 ++++++++++++++++++- .../modules/demo/bigScreen/vo/CompVo.java | 3 + 4 files changed, 99 insertions(+), 4 deletions(-) diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/bigScreen/controller/CompSystemBigScreenController.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/bigScreen/controller/CompSystemBigScreenController.java index a12edd08..89271860 100644 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/bigScreen/controller/CompSystemBigScreenController.java +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/bigScreen/controller/CompSystemBigScreenController.java @@ -59,4 +59,16 @@ public class CompSystemBigScreenController /*extends JeecgController*/ { return Result.ok(result); } + @ApiOperation(value = "河南机电-院系参赛大屏数据", notes = "河南机电-院系参赛大屏数据") + @GetMapping(value = "/canSai") + public Result canSai() { + return Result.ok(compSystemBigScreenService.canSai()); + } + + @ApiOperation(value = "河南机电-院系能力大屏数据", notes = "河南机电-院系能力大屏数据") + @GetMapping(value = "/nengLi") + public Result nengLi() { + return Result.ok(compSystemBigScreenService.nengLi()); + } + } diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/bigScreen/service/CompSystemBigScreenService.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/bigScreen/service/CompSystemBigScreenService.java index 86bdec12..dc457fbd 100644 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/bigScreen/service/CompSystemBigScreenService.java +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/bigScreen/service/CompSystemBigScreenService.java @@ -2,6 +2,7 @@ package org.jeecg.modules.demo.bigScreen.service; import org.jeecg.modules.demo.abilityEvaluation.entity.PersonalAbilityEvaluation; +import java.util.List; import java.util.Map; public interface CompSystemBigScreenService { @@ -12,4 +13,8 @@ public interface CompSystemBigScreenService { Map composite(); Map singleComp(String compId); + + List> canSai(); + + Object nengLi(); } diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/bigScreen/service/CompSystemBigScreenServiceImpl.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/bigScreen/service/CompSystemBigScreenServiceImpl.java index 8541f866..0f38e926 100644 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/bigScreen/service/CompSystemBigScreenServiceImpl.java +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/bigScreen/service/CompSystemBigScreenServiceImpl.java @@ -96,6 +96,78 @@ public class CompSystemBigScreenServiceImpl implements CompSystemBigScreenServic @Autowired private IAnnualService iAnnualService; + + //二级部门id + private final String BASE_PARENT_ID = "1693446350597038081"; + + + @Override + public List> canSai() { + List> resultList = new LinkedList<>(); + //二级部门 + List departList = iSysDepartService.list(new LambdaQueryWrapper().eq(SysDepart::getParentId, BASE_PARENT_ID)); + Optional.ofNullable(departList).orElse(new LinkedList<>()).stream().forEach(depart -> { + Map resultMap = new LinkedHashMap<>(); + List vos = new LinkedList<>(); + CompVo vo = new CompVo(); + //部门id + vo.setCompOrganId(depart.getId()); + //部门名称 + vo.setCompOrganName(depart.getDepartName()); + List registrationList = iAnnualCompetitionProjectRegistrationService.list(new LambdaQueryWrapper() + .eq(AnnualCompetitionProjectRegistration::getSysOrgCode, depart.getOrgCode())); + Map> annualCompIdListMap = Optional.ofNullable(registrationList).orElse(new LinkedList<>()).stream() + .collect(Collectors.groupingBy(AnnualCompetitionProjectRegistration::getAnnualCompid)); + Optional.ofNullable(annualCompIdListMap).orElse(new LinkedHashMap<>()).forEach((key, obj) -> { + vo.setNumber(obj.size()); + AnnualCompPoint annualCompPoint = iAnnualCompPointService.getById(key); + if (!ObjectUtils.isEmpty(annualCompPoint)) { + vo.setCompName(annualCompPoint.getObjName()); + } + Long awardCount = iAwardPersionService.count(new LambdaQueryWrapper() + .in(AwardPersion::getAnnalComp, key)); + vo.setAwardNumber(awardCount.intValue()); + vos.add(vo); + }); + resultMap.put(depart.getDepartName(), vos); + resultList.add(resultMap); + }); + return resultList; + } + + @Override + public List> nengLi() { + List> resultList = new LinkedList<>(); + //二级部门 + List departList = iSysDepartService.list(new LambdaQueryWrapper().eq(SysDepart::getParentId, BASE_PARENT_ID)); + Optional.ofNullable(departList).orElse(new LinkedList<>()).stream().forEach(depart -> { + Map resultMap = new LinkedHashMap<>(); + List departAbilityEvaluations = iDepartAbilityEvaluationService.list(new LambdaQueryWrapper() + .eq(DepartAbilityEvaluation::getDepetId, depart.getId())); + List vos = new LinkedList<>(); + Map> capacityIdListMap = Optional.ofNullable(departAbilityEvaluations).orElse(new LinkedList<>()).stream() + .collect(Collectors.groupingBy(DepartAbilityEvaluation::getCapacityId)); + //遍历分组后的结果 + Optional.ofNullable(capacityIdListMap).orElse(new LinkedHashMap<>()).forEach((key, value) -> { + List departAbilityEvaluationList = value; + double sum = departAbilityEvaluationList.stream().mapToDouble(obj -> obj.getValue()).sum(); + DecimalFormat decimalFormat = new DecimalFormat(); + decimalFormat.setMaximumFractionDigits(2); // 保留两位小数 + decimalFormat.setRoundingMode(RoundingMode.HALF_UP); // 设置具体的进位机制 + double val = ComputeUtils.div2(sum, departAbilityEvaluationList.size()); + DepartAbilityEvaluation vo = new DepartAbilityEvaluation(); + vo.setDepetId(depart.getId()); + vo.setValue(val); + vo.setCapacityId(key); + vo.setCapacityName(departAbilityEvaluationList.get(0).getCapacityName()); + vos.add(vo); + }); + resultMap.put(depart.getDepartName(), vos); + resultList.add(resultMap); + }); + return resultList; + } + /** * @description: 单项比赛数据展示 * 使用大数据页面的形式全面展示某项比赛的各种综合数据,包括年度比赛列表、比赛项目数、参赛人数统计、多维度能力评价分析数据、近五年比赛人数对比,比赛获奖列表,参赛人员积分列表。需要提供功能截图。 @@ -144,10 +216,13 @@ public class CompSystemBigScreenServiceImpl implements CompSystemBigScreenServic List personalCompScoreList = iPersonalCompScoreService.list(new LambdaQueryWrapper().in(PersonalCompScore::getAnnualCompId, annualCompIds)); //参加该比赛的所有学生学号 Set workNos = Optional.ofNullable(personalCompScoreList).orElse(new ArrayList<>()).stream().map(personalCompScore -> personalCompScore.getWorkOn()).collect(Collectors.toSet()); - List personalCompTotalScoreList = iPersonalCompTotalScoreService.list(new LambdaQueryWrapper() - .in(PersonalCompTotalScore::getWorkOn, workNos) - .orderByDesc(PersonalCompTotalScore::getScore) - .last("limit 50")); + List personalCompTotalScoreList = null; + if (!ObjectUtils.isEmpty(workNos)) { + personalCompTotalScoreList = iPersonalCompTotalScoreService.list(new LambdaQueryWrapper() + .in(PersonalCompTotalScore::getWorkOn, workNos) + .orderByDesc(PersonalCompTotalScore::getScore) + .last("limit 50")); + } //学生积分排名 resultMap.put("studentScore", personalCompTotalScoreList); diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/bigScreen/vo/CompVo.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/bigScreen/vo/CompVo.java index bf26e7ce..58ac57ec 100644 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/bigScreen/vo/CompVo.java +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/bigScreen/vo/CompVo.java @@ -41,6 +41,9 @@ public class CompVo implements Serializable { @ApiModelProperty(value = "年度比赛项目数") private Integer annualCompPointNumber; + @ApiModelProperty(value = "获取人数") + private Integer awardNumber; + @ApiModelProperty(value = "年度比赛状态") private String status; }