From b44d70863538ff76e71f7428fd4532211b2dbe41 Mon Sep 17 00:00:00 2001 From: zhc077 <565291854@qq.com> Date: Mon, 2 Sep 2024 09:19:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=A2=E9=98=9F=E8=B5=9B=E9=98=9F=E5=91=98?= =?UTF-8?q?=E4=BD=8D=E6=AC=A1=E6=AF=94=E5=80=BC=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/UserHomePageController.java | 8 +++--- .../homepage/service/UserHomePageService.java | 4 +-- .../service/UserHomePageServiceImpl.java | 25 ++++++++++--------- 3 files changed, 19 insertions(+), 18 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 8b6cc28a..15c5fe99 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,15 +48,15 @@ public class UserHomePageController { @AutoLog(value = "学校管理员-分析报告") @ApiOperation(value = "河南机电-学校综合报告", notes = "河南机电-学校综合报告") @GetMapping(value = "/report4School") - public Result report4School(String annualId, boolean recreateFlag) { - Object result = homePageService.report4School(annualId,recreateFlag); + public Result report4School(String annualid, boolean recreateFlag) { + Object result = homePageService.report4School(annualid,recreateFlag); return Result.ok(result); } @AutoLog(value = "部门管理员-分析报告") @ApiOperation(value = "河南机电-部门综合报告", notes = "河南机电-部门综合报告") @GetMapping(value = "/report4Depart") - public Result report4Depart(String annualId,String orgCode, boolean recreateFlag) { - return Result.ok(homePageService.report4Depart(annualId,orgCode, recreateFlag)); + public Result report4Depart(String annualid,String orgCode, boolean recreateFlag) { + return Result.ok(homePageService.report4Depart(annualid,orgCode, recreateFlag)); } } 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 62815f20..b2cdd97f 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 @@ -8,7 +8,7 @@ public interface UserHomePageService { Map homePage4School(); - Object report4School(String annualId,boolean recreateFlag); + Object report4School(String year,boolean recreateFlag); - Object report4Depart(String annualId,String orgCode, boolean recreateFlag); + Object report4Depart(String year,String orgCode, boolean recreateFlag); } 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 fcaad6d1..423f76c0 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 @@ -369,11 +369,15 @@ public class UserHomePageServiceImpl implements UserHomePageService { if (StringUtils.isNotBlank(annualId)) { Annual annual = iAnnualService.getById(annualId); currentYear = annual.getAnnualName(); - }else { + } else { currentYear = DateUtils.getCurrentYear() + ""; } final String REPORT4SCHOOL = "report4School-" + currentYear; Map resultMap = new LinkedHashMap<>(); + boolean hasKey = redisUtil.hasKey(REPORT4SCHOOL); + if (hasKey && !recreateFlag) { + return redisUtil.get(REPORT4SCHOOL); + } if (recreateFlag) { //年度 Annual annual = iAnnualService.getOne(new LambdaQueryWrapper().eq(Annual::getAnnualName, currentYear + "")); @@ -593,15 +597,15 @@ public class UserHomePageServiceImpl implements UserHomePageService { scoreList4Point.stream().sorted(Comparator.comparing(HomePageCompVo::getTotalScore)).collect(Collectors.toList()); resultMap.put("比赛学生积分况分析", scoreList4Point); redisUtil.set(REPORT4SCHOOL, resultMap); - return resultMap; - } else { + }/* else { boolean hasKey = redisUtil.hasKey(REPORT4SCHOOL); if (hasKey) { return redisUtil.get(REPORT4SCHOOL); } else { return this.report4School(annualId, true); } - } + }*/ + return resultMap; } private List convertPoint4Depart(SysDepart depart) { @@ -631,6 +635,10 @@ public class UserHomePageServiceImpl implements UserHomePageService { currentYear = DateUtils.getCurrentYear() + ""; } final String REPORT4DEPART = "report4Depart-" + currentYear; + boolean hasKey = redisUtil.hasKey(REPORT4DEPART); + if (hasKey && !recreateFlag) { + return redisUtil.get(REPORT4DEPART); + } if (recreateFlag) { SysDepart sysDepart = iSysDepartService.getOne(new LambdaQueryWrapper().eq(SysDepart::getOrgCode, orgCode)); if (ObjectUtil.isNull(sysDepart)) { @@ -821,15 +829,8 @@ public class UserHomePageServiceImpl implements UserHomePageService { } canSaiList.add(departMap); redisUtil.set(REPORT4DEPART, resultMap); - return resultMap; - } else { - boolean hasKey = redisUtil.hasKey(REPORT4DEPART); - if (hasKey) { - return redisUtil.get(REPORT4DEPART); - } else { - return this.report4Depart(annualId, orgCode, true); - } } + return resultMap; } Map convertProjectLevel(List annualCompPointList) {