diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualCompPoint/controller/AnnualCompPointController.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualCompPoint/controller/AnnualCompPointController.java index 82853457..b9adf14e 100644 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualCompPoint/controller/AnnualCompPointController.java +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualCompPoint/controller/AnnualCompPointController.java @@ -16,6 +16,7 @@ import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.common.util.RedisUtil; import org.jeecg.config.JeecgBaseConfig; import org.jeecg.modules.demo.TongfenComp.entity.TongfenComp; import org.jeecg.modules.demo.TongfenComp.service.ITongfenCompService; @@ -129,6 +130,9 @@ public class AnnualCompPointController extends JeecgController zjsybsjs( HttpServletRequest req) { + public Result zjsybsjs( HttpServletRequest req,@RequestParam(name = "recreateFlag") boolean recreateFlag) { + final String ZJSYBSJS = "zjsybsjs"; + Map map = new HashMap<>(); + if (recreateFlag) { //获取当前登录用户 LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - Map map = new HashMap<>(); + QueryWrapper exqueryWrapper = new QueryWrapper<>(); exqueryWrapper.eq("user_id", user.getId()); Expert expert = expertService.getOne(exqueryWrapper); @@ -1348,7 +1355,16 @@ public class AnnualCompPointController extends JeecgController zwhsybsjs( HttpServletRequest req) { + public Result zwhsybsjs( HttpServletRequest req,@RequestParam(name = "recreateFlag") boolean recreateFlag) { + final String ZWHSYBSJS = "zwhsybsjs"; + Map map = new HashMap<>(); + if (recreateFlag) { //获取当前登录用户 最新的年度比赛记录 LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); Comp comp = new Comp(); QueryWrapper queryWrappercomp = QueryGenerator.initQueryWrapper(comp, req.getParameterMap()); queryWrappercomp.eq("comp_admin", user.getUsername()); List list = compService.list(queryWrappercomp); - Map map = new HashMap<>(); + if (list.size() > 0) { List ids = list.stream().map(Comp::getId).collect(Collectors.toList()); QueryWrapper queryWrapperAnnual = new QueryWrapper<>(); @@ -1443,8 +1449,16 @@ public class AnnualCompetitionProjectRegistrationController { } } } - + redisUtil.set(ZWHSYBSJS, map); return Result.OK(map); + }else { + boolean hasKey = redisUtil.hasKey(ZWHSYBSJS); + if (hasKey) { + return Result.OK(redisUtil.get(ZWHSYBSJS)); + } else { + return this.zwhsybsjs(req,true); + } + } } @@ -1456,7 +1470,11 @@ public class AnnualCompetitionProjectRegistrationController { */ @ApiOperation(value="学生角色首页比赛数据接口", notes="学生角色首页比赛数据接口") @GetMapping(value = "/xssybsjs") - public Result xssybsjs( HttpServletRequest req) { + public Result xssybsjs( HttpServletRequest req,@RequestParam(name = "recreateFlag") boolean recreateFlag) { + + final String XSSYBSJS = "xssybsjs"; + Map map = new HashMap<>(); + if (recreateFlag) { //获取当前登录用户 LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); String wonk = sysUserService.getById(user.getId()).getWorkNo(); @@ -1464,7 +1482,7 @@ public class AnnualCompetitionProjectRegistrationController { QueryWrapper queryWrappertm = QueryGenerator.initQueryWrapper(teamManagement, req.getParameterMap()); queryWrappertm.eq("user_id",user.getId()); List listtm = teamManagementService.list(queryWrappertm); - Map map = new HashMap<>(); + if(listtm.size()!=0){ //学生参加比赛的所有报名编号 List bmbhs = listtm.stream().map(TeamManagement::getEnrollCode).collect(Collectors.toList()); @@ -1702,8 +1720,17 @@ public class AnnualCompetitionProjectRegistrationController { map.put("allApList",allApListMap); } + redisUtil.set(XSSYBSJS, map); return Result.OK(map); + }else { + boolean hasKey = redisUtil.hasKey(XSSYBSJS); + if (hasKey) { + return Result.OK(redisUtil.get(XSSYBSJS)); + } else { + return this.xssybsjs(req,true); + } + } } /** @@ -1714,7 +1741,11 @@ public class AnnualCompetitionProjectRegistrationController { */ @ApiOperation(value="学生角色分析报告数据接口", notes="学生角色分析报告数据接口") @GetMapping(value = "/xsfxbg") - public Result xsfxbg( HttpServletRequest req) { + public Result xsfxbg( HttpServletRequest req,@RequestParam(name = "recreateFlag") boolean recreateFlag) { + + final String XSFXBG = "xsfxbg"; + Map map = new HashMap<>(); + if (recreateFlag) { //获取当前登录用户 LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); String wonk = sysUserService.getById(user.getId()).getWorkNo(); @@ -1722,7 +1753,7 @@ public class AnnualCompetitionProjectRegistrationController { QueryWrapper queryWrappertm = QueryGenerator.initQueryWrapper(teamManagement, req.getParameterMap()); queryWrappertm.eq("user_id",user.getId()); List listtm = teamManagementService.list(queryWrappertm); - Map map = new HashMap<>(); + if(listtm.size()!=0){ //学生参加比赛的所有报名编号 List bmbhs = listtm.stream().map(TeamManagement::getEnrollCode).collect(Collectors.toList()); @@ -1981,8 +2012,16 @@ public class AnnualCompetitionProjectRegistrationController { map.put("allApList",allApListMap); } - + redisUtil.set(XSFXBG, map); return Result.OK(map); + }else { + boolean hasKey = redisUtil.hasKey(XSFXBG); + if (hasKey) { + return Result.OK(redisUtil.get(XSFXBG)); + } else { + return this.xsfxbg(req,true); + } + } } @@ -1994,14 +2033,17 @@ public class AnnualCompetitionProjectRegistrationController { */ @ApiOperation(value="组委会角色分析报告比赛数据接口", notes="组委会角色分析报告比赛数据接口") @GetMapping(value = "/zwhfxbg") - public Result zwhfxbg( HttpServletRequest req) { + public Result zwhfxbg( HttpServletRequest req,@RequestParam(name = "recreateFlag") boolean recreateFlag) { + final String ZWHFXBG = "zwhfxbg"; + Map map = new HashMap<>(); + if (recreateFlag) { //获取当前登录用户 最新的年度比赛记录 LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); Comp comp = new Comp(); QueryWrapper queryWrappercomp = QueryGenerator.initQueryWrapper(comp, req.getParameterMap()); queryWrappercomp.eq("comp_admin", user.getUsername()); List list = compService.list(queryWrappercomp); - Map map = new HashMap<>(); + if (list.size() > 0) { List ids = list.stream().map(Comp::getId).collect(Collectors.toList()); QueryWrapper queryWrapperAnnual = new QueryWrapper<>(); @@ -2345,7 +2387,17 @@ public class AnnualCompetitionProjectRegistrationController { } } + redisUtil.set(ZWHFXBG, map); return Result.OK(map); + + }else { + boolean hasKey = redisUtil.hasKey(ZWHFXBG); + if (hasKey) { + return Result.OK(redisUtil.get(ZWHFXBG)); + } else { + return this.zwhfxbg(req,true); + } + } }