专家、组委会、学生,首页 以及分析报告增加缓存机制

main
Gitea 3 months ago
parent d77922fd7b
commit e23be1f3da
  1. 20
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualCompPoint/controller/AnnualCompPointController.java
  2. 72
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcompetitionprojectregistration/controller/AnnualCompetitionProjectRegistrationController.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.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.vo.LoginUser; import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.config.JeecgBaseConfig; import org.jeecg.config.JeecgBaseConfig;
import org.jeecg.modules.demo.TongfenComp.entity.TongfenComp; import org.jeecg.modules.demo.TongfenComp.entity.TongfenComp;
import org.jeecg.modules.demo.TongfenComp.service.ITongfenCompService; import org.jeecg.modules.demo.TongfenComp.service.ITongfenCompService;
@ -129,6 +130,9 @@ public class AnnualCompPointController extends JeecgController<AnnualCompPoint,
@Autowired @Autowired
private IUpfilePersionService upfilePersionService; private IUpfilePersionService upfilePersionService;
@Autowired
private RedisUtil redisUtil;
/** /**
* 分页列表查询 * 分页列表查询
@ -1218,10 +1222,13 @@ public class AnnualCompPointController extends JeecgController<AnnualCompPoint,
*/ */
@ApiOperation(value="专家角色首页比赛数据接口", notes="专家角色首页比赛数据接口") @ApiOperation(value="专家角色首页比赛数据接口", notes="专家角色首页比赛数据接口")
@GetMapping(value = "/zjsybsjs") @GetMapping(value = "/zjsybsjs")
public Result<?> zjsybsjs( HttpServletRequest req) { public Result<?> zjsybsjs( HttpServletRequest req,@RequestParam(name = "recreateFlag") boolean recreateFlag) {
final String ZJSYBSJS = "zjsybsjs";
Map<String, Object> map = new HashMap<>();
if (recreateFlag) {
//获取当前登录用户 //获取当前登录用户
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
Map<String, Object> map = new HashMap<>();
QueryWrapper<Expert> exqueryWrapper = new QueryWrapper<>(); QueryWrapper<Expert> exqueryWrapper = new QueryWrapper<>();
exqueryWrapper.eq("user_id", user.getId()); exqueryWrapper.eq("user_id", user.getId());
Expert expert = expertService.getOne(exqueryWrapper); Expert expert = expertService.getOne(exqueryWrapper);
@ -1348,7 +1355,16 @@ public class AnnualCompPointController extends JeecgController<AnnualCompPoint,
} }
} }
redisUtil.set(ZJSYBSJS, map);
return Result.OK(map); return Result.OK(map);
}else {
boolean hasKey = redisUtil.hasKey(ZJSYBSJS);
if (hasKey) {
return Result.OK(redisUtil.get(ZJSYBSJS));
} else {
return this.zjsybsjs(req,true);
}
}
} }

@ -14,6 +14,7 @@ import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.vo.LoginUser; import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.common.util.oConvertUtils; import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.demo.annual.service.IAnnualService; import org.jeecg.modules.demo.annual.service.IAnnualService;
import org.jeecg.modules.demo.annualCompPoint.entity.AnnualCompPoint; import org.jeecg.modules.demo.annualCompPoint.entity.AnnualCompPoint;
@ -96,6 +97,8 @@ public class AnnualCompetitionProjectRegistrationController {
private IAwardPersionService awardPersionService; private IAwardPersionService awardPersionService;
@Autowired @Autowired
private IPersonalCompScoreService personalCompScoreService; private IPersonalCompScoreService personalCompScoreService;
@Autowired
private RedisUtil redisUtil;
/** /**
@ -1215,14 +1218,17 @@ public class AnnualCompetitionProjectRegistrationController {
*/ */
@ApiOperation(value="组委会角色首页比赛数据接口", notes="组委会角色首页比赛数据接口") @ApiOperation(value="组委会角色首页比赛数据接口", notes="组委会角色首页比赛数据接口")
@GetMapping(value = "/zwhsybsjs") @GetMapping(value = "/zwhsybsjs")
public Result<?> zwhsybsjs( HttpServletRequest req) { public Result<?> zwhsybsjs( HttpServletRequest req,@RequestParam(name = "recreateFlag") boolean recreateFlag) {
final String ZWHSYBSJS = "zwhsybsjs";
Map<String, Object> map = new HashMap<>();
if (recreateFlag) {
//获取当前登录用户 最新的年度比赛记录 //获取当前登录用户 最新的年度比赛记录
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
Comp comp = new Comp(); Comp comp = new Comp();
QueryWrapper<Comp> queryWrappercomp = QueryGenerator.initQueryWrapper(comp, req.getParameterMap()); QueryWrapper<Comp> queryWrappercomp = QueryGenerator.initQueryWrapper(comp, req.getParameterMap());
queryWrappercomp.eq("comp_admin", user.getUsername()); queryWrappercomp.eq("comp_admin", user.getUsername());
List<Comp> list = compService.list(queryWrappercomp); List<Comp> list = compService.list(queryWrappercomp);
Map<String, Object> map = new HashMap<>();
if (list.size() > 0) { if (list.size() > 0) {
List<String> ids = list.stream().map(Comp::getId).collect(Collectors.toList()); List<String> ids = list.stream().map(Comp::getId).collect(Collectors.toList());
QueryWrapper<AnnualComp> queryWrapperAnnual = new QueryWrapper<>(); QueryWrapper<AnnualComp> queryWrapperAnnual = new QueryWrapper<>();
@ -1443,8 +1449,16 @@ public class AnnualCompetitionProjectRegistrationController {
} }
} }
} }
redisUtil.set(ZWHSYBSJS, map);
return Result.OK(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="学生角色首页比赛数据接口") @ApiOperation(value="学生角色首页比赛数据接口", notes="学生角色首页比赛数据接口")
@GetMapping(value = "/xssybsjs") @GetMapping(value = "/xssybsjs")
public Result<?> xssybsjs( HttpServletRequest req) { public Result<?> xssybsjs( HttpServletRequest req,@RequestParam(name = "recreateFlag") boolean recreateFlag) {
final String XSSYBSJS = "xssybsjs";
Map<String, Object> map = new HashMap<>();
if (recreateFlag) {
//获取当前登录用户 //获取当前登录用户
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
String wonk = sysUserService.getById(user.getId()).getWorkNo(); String wonk = sysUserService.getById(user.getId()).getWorkNo();
@ -1464,7 +1482,7 @@ public class AnnualCompetitionProjectRegistrationController {
QueryWrapper<TeamManagement> queryWrappertm = QueryGenerator.initQueryWrapper(teamManagement, req.getParameterMap()); QueryWrapper<TeamManagement> queryWrappertm = QueryGenerator.initQueryWrapper(teamManagement, req.getParameterMap());
queryWrappertm.eq("user_id",user.getId()); queryWrappertm.eq("user_id",user.getId());
List<TeamManagement> listtm = teamManagementService.list(queryWrappertm); List<TeamManagement> listtm = teamManagementService.list(queryWrappertm);
Map<String, Object> map = new HashMap<>();
if(listtm.size()!=0){ if(listtm.size()!=0){
//学生参加比赛的所有报名编号 //学生参加比赛的所有报名编号
List<String> bmbhs = listtm.stream().map(TeamManagement::getEnrollCode).collect(Collectors.toList()); List<String> bmbhs = listtm.stream().map(TeamManagement::getEnrollCode).collect(Collectors.toList());
@ -1702,8 +1720,17 @@ public class AnnualCompetitionProjectRegistrationController {
map.put("allApList",allApListMap); map.put("allApList",allApListMap);
} }
redisUtil.set(XSSYBSJS, map);
return Result.OK(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="学生角色分析报告数据接口") @ApiOperation(value="学生角色分析报告数据接口", notes="学生角色分析报告数据接口")
@GetMapping(value = "/xsfxbg") @GetMapping(value = "/xsfxbg")
public Result<?> xsfxbg( HttpServletRequest req) { public Result<?> xsfxbg( HttpServletRequest req,@RequestParam(name = "recreateFlag") boolean recreateFlag) {
final String XSFXBG = "xsfxbg";
Map<String, Object> map = new HashMap<>();
if (recreateFlag) {
//获取当前登录用户 //获取当前登录用户
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
String wonk = sysUserService.getById(user.getId()).getWorkNo(); String wonk = sysUserService.getById(user.getId()).getWorkNo();
@ -1722,7 +1753,7 @@ public class AnnualCompetitionProjectRegistrationController {
QueryWrapper<TeamManagement> queryWrappertm = QueryGenerator.initQueryWrapper(teamManagement, req.getParameterMap()); QueryWrapper<TeamManagement> queryWrappertm = QueryGenerator.initQueryWrapper(teamManagement, req.getParameterMap());
queryWrappertm.eq("user_id",user.getId()); queryWrappertm.eq("user_id",user.getId());
List<TeamManagement> listtm = teamManagementService.list(queryWrappertm); List<TeamManagement> listtm = teamManagementService.list(queryWrappertm);
Map<String, Object> map = new HashMap<>();
if(listtm.size()!=0){ if(listtm.size()!=0){
//学生参加比赛的所有报名编号 //学生参加比赛的所有报名编号
List<String> bmbhs = listtm.stream().map(TeamManagement::getEnrollCode).collect(Collectors.toList()); List<String> bmbhs = listtm.stream().map(TeamManagement::getEnrollCode).collect(Collectors.toList());
@ -1981,8 +2012,16 @@ public class AnnualCompetitionProjectRegistrationController {
map.put("allApList",allApListMap); map.put("allApList",allApListMap);
} }
redisUtil.set(XSFXBG, map);
return Result.OK(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="组委会角色分析报告比赛数据接口") @ApiOperation(value="组委会角色分析报告比赛数据接口", notes="组委会角色分析报告比赛数据接口")
@GetMapping(value = "/zwhfxbg") @GetMapping(value = "/zwhfxbg")
public Result<?> zwhfxbg( HttpServletRequest req) { public Result<?> zwhfxbg( HttpServletRequest req,@RequestParam(name = "recreateFlag") boolean recreateFlag) {
final String ZWHFXBG = "zwhfxbg";
Map<String, Object> map = new HashMap<>();
if (recreateFlag) {
//获取当前登录用户 最新的年度比赛记录 //获取当前登录用户 最新的年度比赛记录
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
Comp comp = new Comp(); Comp comp = new Comp();
QueryWrapper<Comp> queryWrappercomp = QueryGenerator.initQueryWrapper(comp, req.getParameterMap()); QueryWrapper<Comp> queryWrappercomp = QueryGenerator.initQueryWrapper(comp, req.getParameterMap());
queryWrappercomp.eq("comp_admin", user.getUsername()); queryWrappercomp.eq("comp_admin", user.getUsername());
List<Comp> list = compService.list(queryWrappercomp); List<Comp> list = compService.list(queryWrappercomp);
Map<String, Object> map = new HashMap<>();
if (list.size() > 0) { if (list.size() > 0) {
List<String> ids = list.stream().map(Comp::getId).collect(Collectors.toList()); List<String> ids = list.stream().map(Comp::getId).collect(Collectors.toList());
QueryWrapper<AnnualComp> queryWrapperAnnual = new QueryWrapper<>(); QueryWrapper<AnnualComp> queryWrapperAnnual = new QueryWrapper<>();
@ -2345,7 +2387,17 @@ public class AnnualCompetitionProjectRegistrationController {
} }
} }
redisUtil.set(ZWHFXBG, map);
return Result.OK(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);
}
}
} }

Loading…
Cancel
Save