|
|
|
@ -2,6 +2,7 @@ package org.jeecg.modules.demo.homepage.service; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
import org.jeecg.common.exception.JeecgBootException; |
|
|
|
|
import org.jeecg.common.util.ComputeUtils; |
|
|
|
|
import org.jeecg.common.util.DateUtils; |
|
|
|
@ -362,24 +363,34 @@ public class UserHomePageServiceImpl implements UserHomePageService { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Object report4School(boolean recreateFlag) { |
|
|
|
|
|
|
|
|
|
final String REPORT4SCHOOL = "report4School"; |
|
|
|
|
public Object report4School(String annualId, boolean recreateFlag) { |
|
|
|
|
|
|
|
|
|
String currentYear; |
|
|
|
|
if (StringUtils.isNotBlank(annualId)) { |
|
|
|
|
Annual annual = iAnnualService.getById(annualId); |
|
|
|
|
currentYear = annual.getAnnualName(); |
|
|
|
|
} else { |
|
|
|
|
currentYear = DateUtils.getCurrentYear() + ""; |
|
|
|
|
} |
|
|
|
|
final String REPORT4SCHOOL = "report4School-" + currentYear; |
|
|
|
|
Map<String, Object> resultMap = new LinkedHashMap<>(); |
|
|
|
|
boolean hasKey = redisUtil.hasKey(REPORT4SCHOOL); |
|
|
|
|
if (hasKey && !recreateFlag) { |
|
|
|
|
return redisUtil.get(REPORT4SCHOOL); |
|
|
|
|
} |
|
|
|
|
if (recreateFlag) { |
|
|
|
|
int currentYear = DateUtils.getCurrentYear(); |
|
|
|
|
//当前年度
|
|
|
|
|
//年度
|
|
|
|
|
Annual annual = iAnnualService.getOne(new LambdaQueryWrapper<Annual>().eq(Annual::getAnnualName, currentYear + "")); |
|
|
|
|
|
|
|
|
|
if (ObjectUtils.isEmpty(annual)) return resultMap; |
|
|
|
|
List<AnnualComp> annualCompList = iAnnualCompService.list(new LambdaQueryWrapper<AnnualComp>() |
|
|
|
|
.eq(AnnualComp::getAnnualid, annual.getId())); |
|
|
|
|
|
|
|
|
|
Set<String> compIds = Optional.ofNullable(annualCompList).orElse(new LinkedList<>()).stream().map(obj -> obj.getId()).collect(Collectors.toSet()); |
|
|
|
|
List<AnnualCompPoint> annualCompPointList = iAnnualCompPointService.list(new LambdaQueryWrapper<AnnualCompPoint>().in(!ObjectUtils.isEmpty(compIds), AnnualCompPoint::getAnnualCompId, compIds)); |
|
|
|
|
if(ObjectUtil.isEmpty(annualCompPointList)) return resultMap; |
|
|
|
|
//当前年,所有项目id
|
|
|
|
|
Set<String> annualCompPointIds = Optional.ofNullable(annualCompPointList).orElse(new ArrayList<>()).stream().map(annualCompPoint -> annualCompPoint.getId()).collect(Collectors.toSet()); |
|
|
|
|
|
|
|
|
|
if(ObjectUtil.isEmpty(annualCompPointIds)) return resultMap; |
|
|
|
|
//未评奖的项目为进行中
|
|
|
|
|
List<AnnualCompPoint> pj0PointList = Optional.ofNullable(annualCompPointList).orElse(new LinkedList<>()).stream().filter(bo -> "0".equals(bo.getIsPj())).collect(Collectors.toList()); |
|
|
|
|
Map<String, Object> countMap = this.convertProjectLevel(annualCompPointList); |
|
|
|
@ -587,15 +598,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(true); |
|
|
|
|
} |
|
|
|
|
return this.report4School(annualId, true); |
|
|
|
|
} |
|
|
|
|
}*/ |
|
|
|
|
return resultMap; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private List<AnnualCompPoint> convertPoint4Depart(SysDepart depart) { |
|
|
|
@ -613,11 +624,22 @@ public class UserHomePageServiceImpl implements UserHomePageService { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Object report4Depart(String orgCode, boolean recreateFlag) { |
|
|
|
|
public Object report4Depart(String annualId, String orgCode, boolean recreateFlag) { |
|
|
|
|
|
|
|
|
|
Assert.notNull(orgCode, "部门编号不能为空"); |
|
|
|
|
final String REPORT4DEPART = "report4Depart"; |
|
|
|
|
Map<String, Object> resultMap = new LinkedHashMap<>(); |
|
|
|
|
String currentYear; |
|
|
|
|
if (StringUtils.isNotBlank(annualId)) { |
|
|
|
|
Annual annual = iAnnualService.getById(annualId); |
|
|
|
|
currentYear = annual.getAnnualName(); |
|
|
|
|
} else { |
|
|
|
|
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<SysDepart>().eq(SysDepart::getOrgCode, orgCode)); |
|
|
|
|
if (ObjectUtil.isNull(sysDepart)) { |
|
|
|
@ -625,9 +647,10 @@ public class UserHomePageServiceImpl implements UserHomePageService { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String departId = sysDepart.getParentId(); |
|
|
|
|
int currentYear = DateUtils.getCurrentYear(); |
|
|
|
|
//当前年度
|
|
|
|
|
Annual annual = iAnnualService.getOne(new LambdaQueryWrapper<Annual>().eq(Annual::getAnnualName, currentYear + "")); |
|
|
|
|
if (ObjectUtils.isEmpty(annual)) return resultMap; |
|
|
|
|
|
|
|
|
|
List<Comp> compList = iCompService.list(new LambdaQueryWrapper<Comp>().eq(Comp::getCompOrgan, departId)); |
|
|
|
|
Set<String> compIds = Optional.ofNullable(compList).orElse(new LinkedList<>()).stream().map(obj -> obj.getId()).collect(Collectors.toSet()); |
|
|
|
|
|
|
|
|
@ -636,10 +659,13 @@ public class UserHomePageServiceImpl implements UserHomePageService { |
|
|
|
|
.in(!ObjectUtils.isEmpty(compIds), AnnualComp::getCompid, compIds)); |
|
|
|
|
|
|
|
|
|
Set<String> annualCompIds = Optional.ofNullable(annualCompList).orElse(new LinkedList<>()).stream().map(obj -> obj.getId()).collect(Collectors.toSet()); |
|
|
|
|
if(ObjectUtil.isEmpty(annualCompIds)) return resultMap; |
|
|
|
|
List<AnnualCompPoint> annualCompPointList = iAnnualCompPointService.list(new LambdaQueryWrapper<AnnualCompPoint>().in(AnnualCompPoint::getAnnualCompId, annualCompIds)); |
|
|
|
|
if(ObjectUtil.isEmpty(annualCompPointList)) return resultMap; |
|
|
|
|
|
|
|
|
|
//该部门,当前年,所有项目id
|
|
|
|
|
Set<String> annualCompPointIds = Optional.ofNullable(annualCompPointList).orElse(new ArrayList<>()).stream().map(annualCompPoint -> annualCompPoint.getId()).collect(Collectors.toSet()); |
|
|
|
|
|
|
|
|
|
if(ObjectUtil.isEmpty(annualCompPointIds)) return resultMap; |
|
|
|
|
//未评奖的项目为进行中
|
|
|
|
|
List<AnnualCompPoint> pj0PointList = Optional.ofNullable(annualCompPointList).orElse(new LinkedList<>()).stream().filter(bo -> "0".equals(bo.getIsPj())).collect(Collectors.toList()); |
|
|
|
|
Map<String, Object> countMap = this.convertProjectLevel(annualCompPointList); |
|
|
|
@ -807,15 +833,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(orgCode, true); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return resultMap; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Map<String, Object> convertProjectLevel(List<AnnualCompPoint> annualCompPointList) { |
|
|
|
|