From 212119ee5175fa4bbce3c9faa77cf5eb79bf18dd Mon Sep 17 00:00:00 2001 From: Gitea Date: Mon, 5 Aug 2024 17:33:20 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=A5=96=E9=A1=B9=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=A1=B9=E7=9B=AE=E5=B1=82=E6=AC=A1=E5=92=8C?= =?UTF-8?q?=E6=AF=94=E8=B5=9B=E7=B1=BB=E5=9E=8B=E6=9F=A5=E8=AF=A2=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AwardPersionController.java | 50 +++++++++++++++++-- .../awardpersion/entity/AwardPersion.java | 8 +++ .../views/awardpersion/AwardPersionList.vue | 12 +++++ 3 files changed, 67 insertions(+), 3 deletions(-) diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/awardpersion/controller/AwardPersionController.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/awardpersion/controller/AwardPersionController.java index 2cb7b065..b23edd3a 100644 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/awardpersion/controller/AwardPersionController.java +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/awardpersion/controller/AwardPersionController.java @@ -131,16 +131,25 @@ public class AwardPersionController extends JeecgController queryWrappercomp = QueryGenerator.initQueryWrapper(comp, req.getParameterMap()); queryWrappercomp.eq("comp_admin",user.getUsername()); + if(awardPersion.getComType()!=null){ + queryWrappercomp.eq("comp_type_id",awardPersion.getComType()); + } List list = compService.list(queryWrappercomp); if(list.size()==0){ - return Result.error("未绑定比赛"); + return Result.OK(null); +/* if(awardPersion.getComType()==null){ + return Result.error("未绑定比赛"); + }else { + return Result.error("未绑定该比赛类型的比赛"); + }*/ } List ids = list.stream().map(Comp::getId).collect(Collectors.toList()); QueryWrapper queryWrapperAnnual = new QueryWrapper<>(); queryWrapperAnnual.in("compid",ids); List listAnnual = annualCompService.list(queryWrapperAnnual); if(listAnnual.size()==0){ - return Result.error("未创建年度比赛"); + /*return Result.error("未创建年度比赛");*/ + return Result.OK(null); } List annualIds = listAnnual.stream().map(AnnualComp::getId).collect(Collectors.toList()); QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(awardPersion, req.getParameterMap()); @@ -150,9 +159,17 @@ public class AwardPersionController extends JeecgController queryWrapperacp = QueryGenerator.initQueryWrapper(annualCompPoint, req.getParameterMap()); queryWrapperacp.in("annual_comp_id",annualIds); queryWrapperacp.eq("annual_comp_switch","Y"); // 比赛必须是开启的 + if(awardPersion.getObjLevel()!=null){ + queryWrapperacp.eq("obj_level",awardPersion.getObjLevel()); + } List listacp = annualCompPointService.list(queryWrapperacp); if(listacp.size()==0){ - return Result.error("未创建年度比赛项目"); + /*if(awardPersion.getObjLevel()==null){ + return Result.error("未创建年度比赛项目"); + }else { + return Result.error("未创建该项目层次的年度比赛项目"); + }*/ + return Result.OK(null); } List acpIds = listacp.stream().map(AnnualCompPoint::getId).collect(Collectors.toList()); queryWrapper.in("annual_comp_p",acpIds); @@ -171,6 +188,33 @@ public class AwardPersionController extends JeecgController page = new Page(pageNo, pageSize); QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(awardPersion, req.getParameterMap()); + if(awardPersion.getComType()!=null){ + QueryWrapper queryWrappercomp = new QueryWrapper<>(); + queryWrappercomp.eq("comp_type_id",awardPersion.getComType()); + List list = compService.list(queryWrappercomp); + if(list.size()==0){ + return Result.OK(null); + } + List ids = list.stream().map(Comp::getId).collect(Collectors.toList()); + QueryWrapper queryWrapperAnnual = new QueryWrapper<>(); + queryWrapperAnnual.in("compid",ids); + List listAnnual = annualCompService.list(queryWrapperAnnual); + if(listAnnual.size()==0){ + return Result.OK(null); + } + List annualIds = listAnnual.stream().map(AnnualComp::getId).collect(Collectors.toList()); + queryWrapper.in("annal_comp",annualIds); + } + if(awardPersion.getObjLevel()!=null){ + QueryWrapper queryWrapperacp = new QueryWrapper<>(); + queryWrapperacp.eq("obj_level",awardPersion.getObjLevel()); + List listacp = annualCompPointService.list(queryWrapperacp); + if(listacp.size()==0){ + return Result.OK(null); + } + List acpIds = listacp.stream().map(AnnualCompPoint::getId).collect(Collectors.toList()); + queryWrapper.in("annual_comp_p",acpIds); + } IPage pageList = awardPersionService.page(page, queryWrapper); return Result.OK(pageList); } diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/awardpersion/entity/AwardPersion.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/awardpersion/entity/AwardPersion.java index 6c9d1a4d..b16e7b15 100644 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/awardpersion/entity/AwardPersion.java +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/awardpersion/entity/AwardPersion.java @@ -123,4 +123,12 @@ public class AwardPersion implements Serializable { @ApiModelProperty(value = "推荐") private String tj; + @TableField(exist = false) + @ApiModelProperty(value = "比赛类型") + private String comType; + + @TableField(exist = false) + @ApiModelProperty(value = "项目层次") + private String objLevel; + } diff --git a/jeecgboot-vue3-master/src/views/awardpersion/AwardPersionList.vue b/jeecgboot-vue3-master/src/views/awardpersion/AwardPersionList.vue index 6063b520..869c9ce4 100644 --- a/jeecgboot-vue3-master/src/views/awardpersion/AwardPersionList.vue +++ b/jeecgboot-vue3-master/src/views/awardpersion/AwardPersionList.vue @@ -39,6 +39,18 @@ dictCode="sys_depart,depart_name,id" /> + + + + + + + + + + From c2945b16e8862e485df53939bf18e9b2cdb07755 Mon Sep 17 00:00:00 2001 From: zhc077 <565291854@qq.com> Date: Mon, 5 Aug 2024 18:31:48 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=A0=A1=E7=BA=A7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=EF=BC=8C=E5=88=86=E6=9E=90=E6=8A=A5=E5=91=8A=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/UserHomePageController.java | 4 +- .../homepage/service/UserHomePageService.java | 3 +- .../service/UserHomePageServiceImpl.java | 395 +++++++++--------- 3 files changed, 209 insertions(+), 193 deletions(-) diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/homepage/controller/UserHomePageController.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/homepage/controller/UserHomePageController.java index f2b2bb02..3773067e 100644 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/homepage/controller/UserHomePageController.java +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/homepage/controller/UserHomePageController.java @@ -48,8 +48,8 @@ public class UserHomePageController { @AutoLog(value = "学校管理员-分析报告") @ApiOperation(value = "河南机电-学校综合报告", notes = "河南机电-学校综合报告") @GetMapping(value = "/report4School") - public Result report4School(HttpServletRequest req) { - Map result = homePageService.report4School(); + public Result report4School(boolean recreateFlag) { + Object result = homePageService.report4School(recreateFlag); return Result.ok(result); } diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/homepage/service/UserHomePageService.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/homepage/service/UserHomePageService.java index d32a32e1..dbbf9648 100644 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/homepage/service/UserHomePageService.java +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/homepage/service/UserHomePageService.java @@ -9,6 +9,7 @@ public interface UserHomePageService { Map homePage4School(); - Map report4School(); + Object report4School(boolean recreateFlag); + Map report4Depart(String orgCode); } diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/homepage/service/UserHomePageServiceImpl.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/homepage/service/UserHomePageServiceImpl.java index f4a88e44..dec4d139 100644 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/homepage/service/UserHomePageServiceImpl.java +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/homepage/service/UserHomePageServiceImpl.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import org.jeecg.common.exception.JeecgBootException; import org.jeecg.common.util.ComputeUtils; import org.jeecg.common.util.DateUtils; +import org.jeecg.common.util.RedisUtil; import org.jeecg.modules.demo.abilityEvaluation.entity.DepartAbilityEvaluation; import org.jeecg.modules.demo.abilityEvaluation.entity.PersonalAbilityEvaluationCollect; import org.jeecg.modules.demo.abilityEvaluation.service.IDepartAbilityEvaluationService; @@ -108,6 +109,9 @@ public class UserHomePageServiceImpl implements UserHomePageService { final String BASE_PARENT_ID = "1693446350597038081"; + @Autowired + private RedisUtil redisUtil; + @Override public Map homePage4Depart(String orgCode) { @@ -358,189 +362,192 @@ public class UserHomePageServiceImpl implements UserHomePageService { } @Override - public Map report4School() { - - Map resultMap = new LinkedHashMap<>(); - int currentYear = DateUtils.getCurrentYear(); - //当前年度 - Annual annual = iAnnualService.getOne(new LambdaQueryWrapper().eq(Annual::getAnnualName, currentYear + "")); - - List annualCompList = iAnnualCompService.list(new LambdaQueryWrapper() - .eq(AnnualComp::getAnnualid, annual.getId())); + public Object report4School(boolean recreateFlag) { - Set compIds = Optional.ofNullable(annualCompList).orElse(new LinkedList<>()).stream().map(obj -> obj.getId()).collect(Collectors.toSet()); - List annualCompPointList = iAnnualCompPointService.list(new LambdaQueryWrapper().in(!ObjectUtils.isEmpty(compIds), AnnualCompPoint::getAnnualCompId, compIds)); - //当前年,所有项目id - Set annualCompPointIds = Optional.ofNullable(annualCompPointList).orElse(new ArrayList<>()).stream().map(annualCompPoint -> annualCompPoint.getId()).collect(Collectors.toSet()); + final String REPORT4SCHOOL = "report4School"; - //未评奖的项目为进行中 - List pj0PointList = Optional.ofNullable(annualCompPointList).orElse(new LinkedList<>()).stream().filter(bo -> "0".equals(bo.getIsPj())).collect(Collectors.toList()); - Map countMap = this.convertProjectLevel(annualCompPointList); - countMap.put("本年度已开展比赛项目数", annualCompPointList.size()); - countMap.put("本年度参加比赛队伍数", 0); - countMap.put("正在进行的比赛数", pj0PointList.size()); - int donePointCount = annualCompPointList.size() - pj0PointList.size(); - countMap.put("已完成的比赛", donePointCount); - countMap.put("未完成的比赛", pj0PointList.size()); - if (donePointCount > 0) { - DecimalFormat decimalFormat = new DecimalFormat(); - decimalFormat.setMaximumFractionDigits(2); // 保留两位小数 - decimalFormat.setRoundingMode(RoundingMode.HALF_UP); // 设置具体的进位机制 - double val = ComputeUtils.div2(donePointCount, annualCompPointList.size()); - countMap.put("已完成比赛比率", val); - } else { - countMap.put("已完成比赛比率", 0); - } - resultMap.putAll(countMap); + Map resultMap = new LinkedHashMap<>(); + if (recreateFlag) { + int currentYear = DateUtils.getCurrentYear(); + //当前年度 + Annual annual = iAnnualService.getOne(new LambdaQueryWrapper().eq(Annual::getAnnualName, currentYear + "")); + + List annualCompList = iAnnualCompService.list(new LambdaQueryWrapper() + .eq(AnnualComp::getAnnualid, annual.getId())); + + Set compIds = Optional.ofNullable(annualCompList).orElse(new LinkedList<>()).stream().map(obj -> obj.getId()).collect(Collectors.toSet()); + List annualCompPointList = iAnnualCompPointService.list(new LambdaQueryWrapper().in(!ObjectUtils.isEmpty(compIds), AnnualCompPoint::getAnnualCompId, compIds)); + //当前年,所有项目id + Set annualCompPointIds = Optional.ofNullable(annualCompPointList).orElse(new ArrayList<>()).stream().map(annualCompPoint -> annualCompPoint.getId()).collect(Collectors.toSet()); + + //未评奖的项目为进行中 + List pj0PointList = Optional.ofNullable(annualCompPointList).orElse(new LinkedList<>()).stream().filter(bo -> "0".equals(bo.getIsPj())).collect(Collectors.toList()); + Map countMap = this.convertProjectLevel(annualCompPointList); + countMap.put("本年度已开展比赛项目数", annualCompPointList.size()); + countMap.put("本年度参加比赛队伍数", 0); + countMap.put("正在进行的比赛数", pj0PointList.size()); + int donePointCount = annualCompPointList.size() - pj0PointList.size(); + countMap.put("已完成的比赛", donePointCount); + countMap.put("未完成的比赛", pj0PointList.size()); + if (donePointCount > 0) { + DecimalFormat decimalFormat = new DecimalFormat(); + decimalFormat.setMaximumFractionDigits(2); // 保留两位小数 + decimalFormat.setRoundingMode(RoundingMode.HALF_UP); // 设置具体的进位机制 + double val = ComputeUtils.div2(donePointCount, annualCompPointList.size()); + countMap.put("已完成比赛比率", val); + } else { + countMap.put("已完成比赛比率", 0); + } + resultMap.putAll(countMap); - List evaluationCollects = iPersonalAbilityEvaluationCollectService - .list(new LambdaQueryWrapper()); + List evaluationCollects = iPersonalAbilityEvaluationCollectService + .list(new LambdaQueryWrapper()); // resultMap.put("前60名学生能力值", evaluationCollects); - List vos = new LinkedList<>(); - Map> capacityIdListMap = Optional.ofNullable(evaluationCollects).orElse(new LinkedList<>()).stream() - .collect(Collectors.groupingBy(PersonalAbilityEvaluationCollect::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()); - PersonalAbilityEvaluationCollect vo = new PersonalAbilityEvaluationCollect(); - vo.setValue(val); - vo.setCapacityId(key); - vo.setCapacityName(departAbilityEvaluationList.get(0).getCapacityName()); - vos.add(vo); - }); - resultMap.put("学生能力平均值", vos); - - List> abilityList = new LinkedList<>(); - List years = DateUtils.getLastxYear(2); - List annualList = iAnnualService.list(new LambdaQueryWrapper().in(Annual::getAnnualName, years).orderByAsc(Annual::getAnnualName)); - Optional.ofNullable(annualList).orElse(new LinkedList<>()).stream().forEach(bo -> { - Map abilityResultMap = new LinkedHashMap<>(); - List departAbilityEvaluations = iDepartAbilityEvaluationService.list(new LambdaQueryWrapper() - .eq(DepartAbilityEvaluation::getAnnualId, bo.getId())); - List voList = new LinkedList<>(); - Map> capacityIdListMap2 = Optional.ofNullable(departAbilityEvaluations).orElse(new LinkedList<>()).stream() - .collect(Collectors.groupingBy(DepartAbilityEvaluation::getCapacityId)); + List vos = new LinkedList<>(); + Map> capacityIdListMap = Optional.ofNullable(evaluationCollects).orElse(new LinkedList<>()).stream() + .collect(Collectors.groupingBy(PersonalAbilityEvaluationCollect::getCapacityId)); //遍历分组后的结果 - Optional.ofNullable(capacityIdListMap2).orElse(new LinkedHashMap<>()).forEach((key, value) -> { - List departAbilityEvaluationList = value; + 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.setAnnualId(bo.getId()); + PersonalAbilityEvaluationCollect vo = new PersonalAbilityEvaluationCollect(); vo.setValue(val); vo.setCapacityId(key); vo.setCapacityName(departAbilityEvaluationList.get(0).getCapacityName()); - voList.add(vo); + vos.add(vo); }); - abilityResultMap.put(bo.getAnnualName(), voList); - abilityList.add(abilityResultMap); - }); - resultMap.put("近2年能力分析", abilityList); - - resultMap.put("比赛类型占比", convertCompType(iCompService.list())); - - List pointList = iAnnualCompPointService.list(new LambdaQueryWrapper() - .eq(AnnualCompPoint::getRequireApply, "Y")); - List compVoList = new LinkedList<>(); - Optional.ofNullable(pointList).orElse(new LinkedList<>()).stream().forEach(p -> { - ReportCompVo compVo = new ReportCompVo(); - BeanUtils.copyProperties(p, compVo); - compVo.setPointName(p.getObjName()); - - AnnualComp annualComp = iAnnualCompService.getById(p.getAnnualCompId()); - if (!ObjectUtils.isEmpty(annualComp)) { - Comp comp = iCompService.getById(annualComp.getCompid()); - compVo.setCompName(comp.getCompName()); - CompType compType = iCompTypeService.getById(comp.getCompTypeId()); - compVo.setTypeName(compType.getTypeName()); - Projectlevel projectlevel = iProjectlevelService.getById(p.getObjLevel()); - compVo.setProjectLevel(projectlevel.getName()); - } - List list = iAnnualCompetitionProjectRegistrationService.list(new LambdaQueryWrapper() - .eq(AnnualCompetitionProjectRegistration::getAnnualCompid, p.getId())); - if (!ObjectUtils.isEmpty(list)) { - Set entryFormats = list.stream().map(bo -> bo.getEnrollCode()).collect(Collectors.toSet()); - Long count = iTeamManagementService.count(new LambdaQueryWrapper().in(TeamManagement::getEnrollCode, entryFormats)); - compVo.setNumber(count.intValue()); - } - compVoList.add(compVo); - }); - resultMap.put("学生参赛情况", compVoList); - - List awardPersionList = iAwardPersionService.list(); - Map> awardIdListMap = Optional.ofNullable(awardPersionList).orElse(new LinkedList<>()).stream() - .collect(Collectors.groupingBy(AwardPersion::getAwardname)); - Map awardTypeMap = new LinkedHashMap<>(); - - //遍历分组后的结果 - Optional.ofNullable(awardIdListMap).orElse(new LinkedHashMap<>()).forEach((key, value) -> { - Map awardIdMap = new LinkedHashMap<>(); - awardIdMap.put(key, value.size()); - awardTypeMap.putAll(awardIdMap); - }); - resultMap.put("比赛获奖占比", awardTypeMap); - - - List awareVos = new ArrayList<>(); - Optional.ofNullable(awardPersionList).orElse(new LinkedList<>()).stream().forEach(p -> { - ReportCompVo compVo = new ReportCompVo(); - compVo.setStuName(p.getStudentname()); - compVo.setAwardName(p.getAwardname()); - AnnualCompPoint point = iAnnualCompPointService.getById(p.getAnnualCompP()); - if (!ObjectUtils.isEmpty(point)) { - compVo.setPointName(point.getObjName()); - Projectlevel projectlevel = iProjectlevelService.getById(point.getObjLevel()); - compVo.setProjectLevel(projectlevel.getName()); - } - AnnualComp annualComp = iAnnualCompService.getById(p.getAnnalComp()); - if (!ObjectUtils.isEmpty(annualComp)) { - Comp comp = iCompService.getById(annualComp.getCompid()); - compVo.setCompName(comp.getCompName()); - CompType compType = iCompTypeService.getById(comp.getCompTypeId()); - compVo.setTypeName(compType.getTypeName()); - } - awareVos.add(compVo); - }); - resultMap.put("比赛获奖情况列表", awareVos); + resultMap.put("学生能力平均值", vos); + + List> abilityList = new LinkedList<>(); + List years = DateUtils.getLastxYear(2); + List annualList = iAnnualService.list(new LambdaQueryWrapper().in(Annual::getAnnualName, years).orderByAsc(Annual::getAnnualName)); + Optional.ofNullable(annualList).orElse(new LinkedList<>()).stream().forEach(bo -> { + Map abilityResultMap = new LinkedHashMap<>(); + List departAbilityEvaluations = iDepartAbilityEvaluationService.list(new LambdaQueryWrapper() + .eq(DepartAbilityEvaluation::getAnnualId, bo.getId())); + List voList = new LinkedList<>(); + Map> capacityIdListMap2 = Optional.ofNullable(departAbilityEvaluations).orElse(new LinkedList<>()).stream() + .collect(Collectors.groupingBy(DepartAbilityEvaluation::getCapacityId)); + //遍历分组后的结果 + Optional.ofNullable(capacityIdListMap2).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.setAnnualId(bo.getId()); + vo.setValue(val); + vo.setCapacityId(key); + vo.setCapacityName(departAbilityEvaluationList.get(0).getCapacityName()); + voList.add(vo); + }); + abilityResultMap.put(bo.getAnnualName(), voList); + abilityList.add(abilityResultMap); + }); + resultMap.put("近2年能力分析", abilityList); + + resultMap.put("比赛类型占比", convertCompType(iCompService.list())); + + List pointList = iAnnualCompPointService.list(new LambdaQueryWrapper() + .eq(AnnualCompPoint::getRequireApply, "Y")); + List compVoList = new LinkedList<>(); + Optional.ofNullable(pointList).orElse(new LinkedList<>()).stream().forEach(p -> { + ReportCompVo compVo = new ReportCompVo(); + BeanUtils.copyProperties(p, compVo); + compVo.setPointName(p.getObjName()); + + AnnualComp annualComp = iAnnualCompService.getById(p.getAnnualCompId()); + if (!ObjectUtils.isEmpty(annualComp)) { + Comp comp = iCompService.getById(annualComp.getCompid()); + compVo.setCompName(comp.getCompName()); + CompType compType = iCompTypeService.getById(comp.getCompTypeId()); + compVo.setTypeName(compType.getTypeName()); + Projectlevel projectlevel = iProjectlevelService.getById(p.getObjLevel()); + compVo.setProjectLevel(projectlevel.getName()); + } + List list = iAnnualCompetitionProjectRegistrationService.list(new LambdaQueryWrapper() + .eq(AnnualCompetitionProjectRegistration::getAnnualCompid, p.getId())); + if (!ObjectUtils.isEmpty(list)) { + Set entryFormats = list.stream().map(bo -> bo.getEnrollCode()).collect(Collectors.toSet()); + Long count = iTeamManagementService.count(new LambdaQueryWrapper().in(TeamManagement::getEnrollCode, entryFormats)); + compVo.setNumber(count.intValue()); + } + compVoList.add(compVo); + }); + resultMap.put("学生参赛情况", compVoList); + List awardPersionList = iAwardPersionService.list(); + Map> awardIdListMap = Optional.ofNullable(awardPersionList).orElse(new LinkedList<>()).stream() + .collect(Collectors.groupingBy(AwardPersion::getAwardname)); + Map awardTypeMap = new LinkedHashMap<>(); - List> canSaiList = new LinkedList<>(); - List> huoJiangList = new LinkedList<>(); - //二级部门 - List departList = iSysDepartService.list(new LambdaQueryWrapper().eq(SysDepart::getParentId, BASE_PARENT_ID)); - Optional.ofNullable(departList).orElse(new LinkedList<>()).stream().forEach(depart -> { - List pointList4Depart = convertPoint4Depart(depart); - Set pointIds4Depart = Optional.ofNullable(pointList4Depart).orElse(new ArrayList<>()).stream().map(obj -> obj.getId()).collect(Collectors.toSet()); - Map departMap = new LinkedHashMap<>(); - departMap.put("部门名称", depart.getDepartName()); - //报名列表 - if (!ObjectUtils.isEmpty(pointIds4Depart)) { - List registrationList = iAnnualCompetitionProjectRegistrationService.list(new LambdaQueryWrapper() - .in(AnnualCompetitionProjectRegistration::getAnnualCompid, pointIds4Depart)); - if (!ObjectUtils.isEmpty(registrationList)) { - //报名编号 - Set enrollCodes = Optional.ofNullable(registrationList).orElse(new LinkedList<>()).stream().map(bo -> bo.getEnrollCode()).collect(Collectors.toSet()); - Long count = iTeamManagementService.count(new LambdaQueryWrapper().in(TeamManagement::getEnrollCode, enrollCodes)); - departMap.put("比赛总人数", count); - //个人赛报名数 - List registrationList4Stu = registrationList.stream().filter(b -> b.getEntryFormat().equals("0")).collect(Collectors.toList()); - Set enrollCodes4Stu = Optional.ofNullable(registrationList4Stu).orElse(new LinkedList<>()).stream().map(bo -> bo.getEnrollCode()).collect(Collectors.toSet()); - Long count4Stu = iTeamManagementService.count(new LambdaQueryWrapper().in(!ObjectUtils.isEmpty(enrollCodes4Stu), TeamManagement::getEnrollCode, enrollCodes4Stu)); - //学生人数 - departMap.put("个人赛人数", count4Stu); - departMap.put("团队赛人数", count - count4Stu); + //遍历分组后的结果 + Optional.ofNullable(awardIdListMap).orElse(new LinkedHashMap<>()).forEach((key, value) -> { + Map awardIdMap = new LinkedHashMap<>(); + awardIdMap.put(key, value.size()); + awardTypeMap.putAll(awardIdMap); + }); + resultMap.put("比赛获奖占比", awardTypeMap); + + + List awareVos = new ArrayList<>(); + Optional.ofNullable(awardPersionList).orElse(new LinkedList<>()).stream().forEach(p -> { + ReportCompVo compVo = new ReportCompVo(); + compVo.setStuName(p.getStudentname()); + compVo.setAwardName(p.getAwardname()); + AnnualCompPoint point = iAnnualCompPointService.getById(p.getAnnualCompP()); + if (!ObjectUtils.isEmpty(point)) { + compVo.setPointName(point.getObjName()); + Projectlevel projectlevel = iProjectlevelService.getById(point.getObjLevel()); + compVo.setProjectLevel(projectlevel.getName()); } - } - canSaiList.add(departMap); + AnnualComp annualComp = iAnnualCompService.getById(p.getAnnalComp()); + if (!ObjectUtils.isEmpty(annualComp)) { + Comp comp = iCompService.getById(annualComp.getCompid()); + compVo.setCompName(comp.getCompName()); + CompType compType = iCompTypeService.getById(comp.getCompTypeId()); + compVo.setTypeName(compType.getTypeName()); + } + awareVos.add(compVo); + }); + resultMap.put("比赛获奖情况列表", awareVos); + + + List> canSaiList = new LinkedList<>(); + List> huoJiangList = new LinkedList<>(); + //二级部门 + List departList = iSysDepartService.list(new LambdaQueryWrapper().eq(SysDepart::getParentId, BASE_PARENT_ID)); + Optional.ofNullable(departList).orElse(new LinkedList<>()).stream().forEach(depart -> { + List pointList4Depart = convertPoint4Depart(depart); + Set pointIds4Depart = Optional.ofNullable(pointList4Depart).orElse(new ArrayList<>()).stream().map(obj -> obj.getId()).collect(Collectors.toSet()); + Map departMap = new LinkedHashMap<>(); + departMap.put("部门名称", depart.getDepartName()); + //报名列表 + if (!ObjectUtils.isEmpty(pointIds4Depart)) { + List registrationList = iAnnualCompetitionProjectRegistrationService.list(new LambdaQueryWrapper() + .in(AnnualCompetitionProjectRegistration::getAnnualCompid, pointIds4Depart)); + if (!ObjectUtils.isEmpty(registrationList)) { + //报名编号 + Set enrollCodes = Optional.ofNullable(registrationList).orElse(new LinkedList<>()).stream().map(bo -> bo.getEnrollCode()).collect(Collectors.toSet()); + Long count = iTeamManagementService.count(new LambdaQueryWrapper().in(TeamManagement::getEnrollCode, enrollCodes)); + departMap.put("比赛总人数", count); + //个人赛报名数 + List registrationList4Stu = registrationList.stream().filter(b -> b.getEntryFormat().equals("0")).collect(Collectors.toList()); + Set enrollCodes4Stu = Optional.ofNullable(registrationList4Stu).orElse(new LinkedList<>()).stream().map(bo -> bo.getEnrollCode()).collect(Collectors.toSet()); + Long count4Stu = iTeamManagementService.count(new LambdaQueryWrapper().in(!ObjectUtils.isEmpty(enrollCodes4Stu), TeamManagement::getEnrollCode, enrollCodes4Stu)); + //学生人数 + departMap.put("个人赛人数", count4Stu); + departMap.put("团队赛人数", count - count4Stu); + } + } + canSaiList.add(departMap); /*List awardPersionList4Depart = iAwardPersionService.list(new LambdaQueryWrapper().eq(AwardPersion::getAnnualCompP, pointIds4Depart)); Map departHuoJiangMap = new LinkedHashMap<>(); @@ -553,34 +560,42 @@ public class UserHomePageServiceImpl implements UserHomePageService { departHuoJiangMap.put(depart.getDepartName() + "-" + key, value.size()); }); huoJiangList.add(departHuoJiangMap);*/ - }); - resultMap.put("部门参赛情况列表", canSaiList); + }); + resultMap.put("部门参赛情况列表", canSaiList); // resultMap.put("部门获奖情况列表", huoJiangList); - List scoreList4Point = new LinkedList<>(); - List personalCompScores = iPersonalCompScoreService.list(new LambdaQueryWrapper().eq(PersonalCompScore::getAnnualCompP, annualCompPointIds)); - Map> AnnualCompPointIdsMap = Optional.ofNullable(personalCompScores).orElse(new LinkedList<>()).stream() - .collect(Collectors.groupingBy(PersonalCompScore::getAnnualCompP)); - Optional.ofNullable(AnnualCompPointIdsMap).orElse(new LinkedHashMap<>()).forEach((key, value) -> { - double sum = value.stream().mapToDouble(obj -> obj.getScore()).sum(); - HomePageCompVo vo = new HomePageCompVo(); - AnnualCompPoint point = iAnnualCompPointService.getById(key); - vo.setAnnualCompPointName(point.getObjName()); - vo.setAnnualCompPointId(key); - AnnualComp annualComp = iAnnualCompService.getById(point.getAnnualCompId()); - if (!ObjectUtils.isEmpty(annualComp)) { - Comp comp = iCompService.getById(annualComp.getCompid()); - if (!ObjectUtils.isEmpty(comp)) { - vo.setCompName(comp.getCompName()); + List scoreList4Point = new LinkedList<>(); + List personalCompScores = iPersonalCompScoreService.list(new LambdaQueryWrapper().eq(PersonalCompScore::getAnnualCompP, annualCompPointIds)); + Map> AnnualCompPointIdsMap = Optional.ofNullable(personalCompScores).orElse(new LinkedList<>()).stream() + .collect(Collectors.groupingBy(PersonalCompScore::getAnnualCompP)); + Optional.ofNullable(AnnualCompPointIdsMap).orElse(new LinkedHashMap<>()).forEach((key, value) -> { + double sum = value.stream().mapToDouble(obj -> obj.getScore()).sum(); + HomePageCompVo vo = new HomePageCompVo(); + AnnualCompPoint point = iAnnualCompPointService.getById(key); + vo.setAnnualCompPointName(point.getObjName()); + vo.setAnnualCompPointId(key); + AnnualComp annualComp = iAnnualCompService.getById(point.getAnnualCompId()); + if (!ObjectUtils.isEmpty(annualComp)) { + Comp comp = iCompService.getById(annualComp.getCompid()); + if (!ObjectUtils.isEmpty(comp)) { + vo.setCompName(comp.getCompName()); + } } + vo.setTotalScore(sum); + scoreList4Point.add(vo); + }); + scoreList4Point.stream().sorted(Comparator.comparing(HomePageCompVo::getTotalScore)).collect(Collectors.toList()); + resultMap.put("比赛学生积分况分析", scoreList4Point); + redisUtil.set(REPORT4SCHOOL, resultMap.toString()); + return resultMap; + } else { + boolean hasKey = redisUtil.hasKey(REPORT4SCHOOL); + if (hasKey) { + return redisUtil.get(REPORT4SCHOOL); + } else { + return this.report4School(true); } - vo.setTotalScore(sum); - scoreList4Point.add(vo); - }); - scoreList4Point.stream().sorted(Comparator.comparing(HomePageCompVo::getTotalScore)).collect(Collectors.toList()); - resultMap.put("比赛学生积分况分析", scoreList4Point); - - return resultMap; + } } private List convertPoint4Depart(SysDepart depart) { @@ -616,7 +631,7 @@ public class UserHomePageServiceImpl implements UserHomePageService { List annualCompList = iAnnualCompService.list(new LambdaQueryWrapper() .eq(AnnualComp::getAnnualid, annual.getId()) - .in(!ObjectUtils.isEmpty(compIds),AnnualComp::getCompid, compIds)); + .in(!ObjectUtils.isEmpty(compIds), AnnualComp::getCompid, compIds)); Set annualCompIds = Optional.ofNullable(annualCompList).orElse(new LinkedList<>()).stream().map(obj -> obj.getId()).collect(Collectors.toSet()); List annualCompPointList = iAnnualCompPointService.list(new LambdaQueryWrapper().in(AnnualCompPoint::getAnnualCompId, annualCompIds)); From d903b1ceaf80ef0dafc6292a30bf81c48f750601 Mon Sep 17 00:00:00 2001 From: JayChou <2064936853@qq.com> Date: Tue, 6 Aug 2024 10:27:59 +0800 Subject: [PATCH 3/3] =?UTF-8?q?'=E5=AD=A6=E6=A0=A1=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E5=A2=9E=E5=8A=A0=E5=86=B2=E6=B4=97=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jeecgboot-vue3-master/src/api/common/api.ts | 5 +++-- .../comprehensiveReport.vue | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/jeecgboot-vue3-master/src/api/common/api.ts b/jeecgboot-vue3-master/src/api/common/api.ts index 70fc989c..0144e6f2 100644 --- a/jeecgboot-vue3-master/src/api/common/api.ts +++ b/jeecgboot-vue3-master/src/api/common/api.ts @@ -191,9 +191,10 @@ export const getOrganizingCommitteeReport = () => { } // /user/login/homepage/report4School // 学校综合报告 -export const getComprehensiveReport = () => { +export const getComprehensiveReport = (params={}) => { return defHttp.get({ - url:'/user/login/homepage/report4School' + url:'/user/login/homepage/report4School', + params }) } // 部门 diff --git a/jeecgboot-vue3-master/src/views/comprehensiveEvaluation/comprehensiveReport.vue b/jeecgboot-vue3-master/src/views/comprehensiveEvaluation/comprehensiveReport.vue index e2baa114..287f93bb 100644 --- a/jeecgboot-vue3-master/src/views/comprehensiveEvaluation/comprehensiveReport.vue +++ b/jeecgboot-vue3-master/src/views/comprehensiveEvaluation/comprehensiveReport.vue @@ -1,6 +1,7 @@