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

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. 21
      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 = "学校管理员-分析报告")
@ApiOperation(value = "河南机电-学校综合报告", notes = "河南机电-学校综合报告")
@GetMapping(value = "/report4School")
public Result report4School(HttpServletRequest req) {
Map<String, Object> result = homePageService.report4School();
public Result report4School(boolean recreateFlag) {
Object result = homePageService.report4School(recreateFlag);
return Result.ok(result);
}

@ -9,6 +9,7 @@ public interface UserHomePageService {
Map<String, Object> homePage4School();
Map<String, Object> report4School();
Object report4School(boolean recreateFlag);
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.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<String, Object> homePage4Depart(String orgCode) {
@ -358,9 +362,12 @@ public class UserHomePageServiceImpl implements UserHomePageService {
}
@Override
public Map<String, Object> report4School() {
public Object report4School(boolean recreateFlag) {
final String REPORT4SCHOOL = "report4School";
Map<String, Object> resultMap = new LinkedHashMap<>();
if (recreateFlag) {
int currentYear = DateUtils.getCurrentYear();
//当前年度
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());
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);
}
}
}
private List<AnnualCompPoint> convertPoint4Depart(SysDepart depart) {
@ -616,7 +631,7 @@ public class UserHomePageServiceImpl implements UserHomePageService {
List<AnnualComp> annualCompList = iAnnualCompService.list(new LambdaQueryWrapper<AnnualComp>()
.eq(AnnualComp::getAnnualid, annual.getId())
.in(!ObjectUtils.isEmpty(compIds),AnnualComp::getCompid, compIds));
.in(!ObjectUtils.isEmpty(compIds), AnnualComp::getCompid, compIds));
Set<String> annualCompIds = Optional.ofNullable(annualCompList).orElse(new LinkedList<>()).stream().map(obj -> obj.getId()).collect(Collectors.toSet());
List<AnnualCompPoint> annualCompPointList = iAnnualCompPointService.list(new LambdaQueryWrapper<AnnualCompPoint>().in(AnnualCompPoint::getAnnualCompId, annualCompIds));

Loading…
Cancel
Save