校级管理员,分析报告 添加缓存

main
zhc077 4 months ago
parent 212119ee51
commit c2945b16e8
  1. 4
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/homepage/controller/UserHomePageController.java
  2. 3
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/homepage/service/UserHomePageService.java
  3. 19
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/homepage/service/UserHomePageServiceImpl.java

@ -48,8 +48,8 @@ public class UserHomePageController {
@AutoLog(value = "学校管理员-分析报告") @AutoLog(value = "学校管理员-分析报告")
@ApiOperation(value = "河南机电-学校综合报告", notes = "河南机电-学校综合报告") @ApiOperation(value = "河南机电-学校综合报告", notes = "河南机电-学校综合报告")
@GetMapping(value = "/report4School") @GetMapping(value = "/report4School")
public Result report4School(HttpServletRequest req) { public Result report4School(boolean recreateFlag) {
Map<String, Object> result = homePageService.report4School(); Object result = homePageService.report4School(recreateFlag);
return Result.ok(result); return Result.ok(result);
} }

@ -9,6 +9,7 @@ public interface UserHomePageService {
Map<String, Object> homePage4School(); Map<String, Object> homePage4School();
Map<String, Object> report4School(); Object report4School(boolean recreateFlag);
Map<String, Object> report4Depart(String orgCode); Map<String, Object> report4Depart(String orgCode);
} }

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.jeecg.common.exception.JeecgBootException; import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.util.ComputeUtils; import org.jeecg.common.util.ComputeUtils;
import org.jeecg.common.util.DateUtils; 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.DepartAbilityEvaluation;
import org.jeecg.modules.demo.abilityEvaluation.entity.PersonalAbilityEvaluationCollect; import org.jeecg.modules.demo.abilityEvaluation.entity.PersonalAbilityEvaluationCollect;
import org.jeecg.modules.demo.abilityEvaluation.service.IDepartAbilityEvaluationService; import org.jeecg.modules.demo.abilityEvaluation.service.IDepartAbilityEvaluationService;
@ -108,6 +109,9 @@ public class UserHomePageServiceImpl implements UserHomePageService {
final String BASE_PARENT_ID = "1693446350597038081"; final String BASE_PARENT_ID = "1693446350597038081";
@Autowired
private RedisUtil redisUtil;
@Override @Override
public Map<String, Object> homePage4Depart(String orgCode) { public Map<String, Object> homePage4Depart(String orgCode) {
@ -358,9 +362,12 @@ public class UserHomePageServiceImpl implements UserHomePageService {
} }
@Override @Override
public Map<String, Object> report4School() { public Object report4School(boolean recreateFlag) {
final String REPORT4SCHOOL = "report4School";
Map<String, Object> resultMap = new LinkedHashMap<>(); Map<String, Object> resultMap = new LinkedHashMap<>();
if (recreateFlag) {
int currentYear = DateUtils.getCurrentYear(); int currentYear = DateUtils.getCurrentYear();
//当前年度 //当前年度
Annual annual = iAnnualService.getOne(new LambdaQueryWrapper<Annual>().eq(Annual::getAnnualName, currentYear + "")); Annual annual = iAnnualService.getOne(new LambdaQueryWrapper<Annual>().eq(Annual::getAnnualName, currentYear + ""));
@ -579,8 +586,16 @@ public class UserHomePageServiceImpl implements UserHomePageService {
}); });
scoreList4Point.stream().sorted(Comparator.comparing(HomePageCompVo::getTotalScore)).collect(Collectors.toList()); scoreList4Point.stream().sorted(Comparator.comparing(HomePageCompVo::getTotalScore)).collect(Collectors.toList());
resultMap.put("比赛学生积分况分析", scoreList4Point); resultMap.put("比赛学生积分况分析", scoreList4Point);
redisUtil.set(REPORT4SCHOOL, resultMap.toString());
return resultMap; return resultMap;
} else {
boolean hasKey = redisUtil.hasKey(REPORT4SCHOOL);
if (hasKey) {
return redisUtil.get(REPORT4SCHOOL);
} else {
return this.report4School(true);
}
}
} }
private List<AnnualCompPoint> convertPoint4Depart(SysDepart depart) { private List<AnnualCompPoint> convertPoint4Depart(SysDepart depart) {

Loading…
Cancel
Save