院系管理员,分析报告 添加缓存

main
zhc077 4 months ago
parent b81bdfcac8
commit d77922fd7b
  1. 5
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/homepage/controller/UserHomePageController.java
  2. 5
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/homepage/service/UserHomePageService.java
  3. 358
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/homepage/service/UserHomePageServiceImpl.java

@ -56,8 +56,7 @@ public class UserHomePageController {
@AutoLog(value = "部门管理员-分析报告") @AutoLog(value = "部门管理员-分析报告")
@ApiOperation(value = "河南机电-部门综合报告", notes = "河南机电-部门综合报告") @ApiOperation(value = "河南机电-部门综合报告", notes = "河南机电-部门综合报告")
@GetMapping(value = "/report4Depart") @GetMapping(value = "/report4Depart")
public Result report4Depart(String orgCode) { public Result report4Depart(String orgCode,boolean recreateFlag) {
Map<String, Object> result = homePageService.report4Depart(orgCode); return Result.ok(homePageService.report4Depart(orgCode, recreateFlag));
return Result.ok(result);
} }
} }

@ -1,6 +1,5 @@
package org.jeecg.modules.demo.homepage.service; package org.jeecg.modules.demo.homepage.service;
import java.util.List;
import java.util.Map; import java.util.Map;
public interface UserHomePageService { public interface UserHomePageService {
@ -9,7 +8,7 @@ public interface UserHomePageService {
Map<String, Object> homePage4School(); Map<String, Object> homePage4School();
Object report4School(boolean recreateFlag); Object report4School(boolean recreateFlag);
Map<String, Object> report4Depart(String orgCode); Object report4Depart(String orgCode, boolean recreateFlag);
} }

@ -613,217 +613,209 @@ public class UserHomePageServiceImpl implements UserHomePageService {
} }
@Override @Override
public Map<String, Object> report4Depart(String orgCode) { public Object report4Depart(String orgCode, boolean recreateFlag) {
Assert.notNull(orgCode, "部门编号不能为空"); Assert.notNull(orgCode, "部门编号不能为空");
final String REPORT4DEPART = "report4Depart";
Map<String, Object> resultMap = new LinkedHashMap<>(); Map<String, Object> resultMap = new LinkedHashMap<>();
SysDepart sysDepart = iSysDepartService.getOne(new LambdaQueryWrapper<SysDepart>().eq(SysDepart::getOrgCode, orgCode)); if (recreateFlag) {
if (ObjectUtil.isNull(sysDepart)) { SysDepart sysDepart = iSysDepartService.getOne(new LambdaQueryWrapper<SysDepart>().eq(SysDepart::getOrgCode, orgCode));
throw new JeecgBootException("部门不存在"); if (ObjectUtil.isNull(sysDepart)) {
} throw new JeecgBootException("部门不存在");
}
String departId = sysDepart.getParentId(); String departId = sysDepart.getParentId();
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 + ""));
List<Comp> compList = iCompService.list(new LambdaQueryWrapper<Comp>().eq(Comp::getCompOrgan, departId)); 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()); Set<String> compIds = Optional.ofNullable(compList).orElse(new LinkedList<>()).stream().map(obj -> obj.getId()).collect(Collectors.toSet());
List<AnnualComp> annualCompList = iAnnualCompService.list(new LambdaQueryWrapper<AnnualComp>() List<AnnualComp> annualCompList = iAnnualCompService.list(new LambdaQueryWrapper<AnnualComp>()
.eq(AnnualComp::getAnnualid, annual.getId()) .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()); 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)); List<AnnualCompPoint> annualCompPointList = iAnnualCompPointService.list(new LambdaQueryWrapper<AnnualCompPoint>().in(AnnualCompPoint::getAnnualCompId, annualCompIds));
//该部门,当前年,所有项目id //该部门,当前年,所有项目id
Set<String> annualCompPointIds = Optional.ofNullable(annualCompPointList).orElse(new ArrayList<>()).stream().map(annualCompPoint -> annualCompPoint.getId()).collect(Collectors.toSet()); Set<String> annualCompPointIds = Optional.ofNullable(annualCompPointList).orElse(new ArrayList<>()).stream().map(annualCompPoint -> annualCompPoint.getId()).collect(Collectors.toSet());
//未评奖的项目为进行中 //未评奖的项目为进行中
List<AnnualCompPoint> pj0PointList = Optional.ofNullable(annualCompPointList).orElse(new LinkedList<>()).stream().filter(bo -> "0".equals(bo.getIsPj())).collect(Collectors.toList()); 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); Map<String, Object> countMap = this.convertProjectLevel(annualCompPointList);
countMap.put("本年度已开展比赛项目数", annualCompPointList.size()); countMap.put("本年度已开展比赛项目数", annualCompPointList.size());
countMap.put("本年度参加比赛队伍数", 0); countMap.put("本年度参加比赛队伍数", 0);
countMap.put("正在进行的比赛数", pj0PointList.size()); countMap.put("正在进行的比赛数", pj0PointList.size());
int donePointCount = annualCompPointList.size() - pj0PointList.size(); int donePointCount = annualCompPointList.size() - pj0PointList.size();
countMap.put("已完成的比赛", donePointCount); countMap.put("已完成的比赛", donePointCount);
countMap.put("未完成的比赛", pj0PointList.size()); countMap.put("未完成的比赛", pj0PointList.size());
if (donePointCount > 0) { if (donePointCount > 0) {
DecimalFormat decimalFormat = new DecimalFormat(); DecimalFormat decimalFormat = new DecimalFormat();
decimalFormat.setMaximumFractionDigits(2); // 保留两位小数 decimalFormat.setMaximumFractionDigits(2); // 保留两位小数
decimalFormat.setRoundingMode(RoundingMode.HALF_UP); // 设置具体的进位机制 decimalFormat.setRoundingMode(RoundingMode.HALF_UP); // 设置具体的进位机制
double val = ComputeUtils.div2(donePointCount, annualCompPointList.size()); double val = ComputeUtils.div2(donePointCount, annualCompPointList.size());
countMap.put("已完成比赛比率", val); countMap.put("已完成比赛比率", val);
} else { } else {
countMap.put("已完成比赛比率", 0); countMap.put("已完成比赛比率", 0);
} }
resultMap.putAll(countMap); resultMap.putAll(countMap);
List<PersonalAbilityEvaluationCollect> evaluationCollects = iPersonalAbilityEvaluationCollectService List<PersonalAbilityEvaluationCollect> evaluationCollects = iPersonalAbilityEvaluationCollectService
.list(new LambdaQueryWrapper<PersonalAbilityEvaluationCollect>() .list(new LambdaQueryWrapper<PersonalAbilityEvaluationCollect>()
.eq(PersonalAbilityEvaluationCollect::getDepetId, departId)); .eq(PersonalAbilityEvaluationCollect::getDepetId, departId));
// resultMap.put("学生综合能力值分析", evaluationCollects); // resultMap.put("学生综合能力值分析", evaluationCollects);
List<PersonalAbilityEvaluationCollect> vos = new LinkedList<>(); List<PersonalAbilityEvaluationCollect> vos = new LinkedList<>();
Map<String, List<PersonalAbilityEvaluationCollect>> capacityIdListMap = Optional.ofNullable(evaluationCollects).orElse(new LinkedList<>()).stream() Map<String, List<PersonalAbilityEvaluationCollect>> capacityIdListMap = Optional.ofNullable(evaluationCollects).orElse(new LinkedList<>()).stream()
.collect(Collectors.groupingBy(PersonalAbilityEvaluationCollect::getCapacityId)); .collect(Collectors.groupingBy(PersonalAbilityEvaluationCollect::getCapacityId));
//遍历分组后的结果
Optional.ofNullable(capacityIdListMap).orElse(new LinkedHashMap<>()).forEach((key, value) -> {
List<PersonalAbilityEvaluationCollect> departAbilityEvaluationList = value;
double sum = departAbilityEvaluationList.stream().mapToDouble(obj -> obj.getValue()).sum();
DecimalFormat decimalFormat = new DecimalFormat();
decimalFormat.setMaximumFractionDigits(2); // 保留两位小数
decimalFormat.setRoundingMode(RoundingMode.HALF_UP); // 设置具体的进位机制
double val = ComputeUtils.div2(sum, departAbilityEvaluationList.size());
PersonalAbilityEvaluationCollect vo = new PersonalAbilityEvaluationCollect();
vo.setValue(val);
vo.setCapacityId(key);
vo.setCapacityName(departAbilityEvaluationList.get(0).getCapacityName());
vos.add(vo);
});
resultMap.put("学生能力平均值", vos);
List<Map<String, Object>> abilityList = new LinkedList<>();
List<Integer> years = DateUtils.getLastxYear(2);
List<Annual> annualList = iAnnualService.list(new LambdaQueryWrapper<Annual>().in(Annual::getAnnualName, years).orderByAsc(Annual::getAnnualName));
Optional.ofNullable(annualList).orElse(new LinkedList<>()).stream().forEach(bo -> {
Map<String, Object> abilityResultMap = new LinkedHashMap<>();
List<DepartAbilityEvaluation> departAbilityEvaluations = iDepartAbilityEvaluationService.list(new LambdaQueryWrapper<DepartAbilityEvaluation>()
.eq(DepartAbilityEvaluation::getAnnualId, bo.getId())
.eq(DepartAbilityEvaluation::getDepetId, departId));
List<DepartAbilityEvaluation> voList = new LinkedList<>();
Map<String, List<DepartAbilityEvaluation>> capacityIdListMap2 = Optional.ofNullable(departAbilityEvaluations).orElse(new LinkedList<>()).stream()
.collect(Collectors.groupingBy(DepartAbilityEvaluation::getCapacityId));
//遍历分组后的结果 //遍历分组后的结果
Optional.ofNullable(capacityIdListMap2).orElse(new LinkedHashMap<>()).forEach((key, value) -> { Optional.ofNullable(capacityIdListMap).orElse(new LinkedHashMap<>()).forEach((key, value) -> {
List<DepartAbilityEvaluation> departAbilityEvaluationList = value; List<PersonalAbilityEvaluationCollect> departAbilityEvaluationList = value;
double sum = departAbilityEvaluationList.stream().mapToDouble(obj -> obj.getValue()).sum(); double sum = departAbilityEvaluationList.stream().mapToDouble(obj -> obj.getValue()).sum();
DecimalFormat decimalFormat = new DecimalFormat(); DecimalFormat decimalFormat = new DecimalFormat();
decimalFormat.setMaximumFractionDigits(2); // 保留两位小数 decimalFormat.setMaximumFractionDigits(2); // 保留两位小数
decimalFormat.setRoundingMode(RoundingMode.HALF_UP); // 设置具体的进位机制 decimalFormat.setRoundingMode(RoundingMode.HALF_UP); // 设置具体的进位机制
double val = ComputeUtils.div2(sum, departAbilityEvaluationList.size()); double val = ComputeUtils.div2(sum, departAbilityEvaluationList.size());
DepartAbilityEvaluation vo = new DepartAbilityEvaluation(); PersonalAbilityEvaluationCollect vo = new PersonalAbilityEvaluationCollect();
vo.setAnnualId(bo.getId());
vo.setValue(val); vo.setValue(val);
vo.setCapacityId(key); vo.setCapacityId(key);
vo.setCapacityName(departAbilityEvaluationList.get(0).getCapacityName()); vo.setCapacityName(departAbilityEvaluationList.get(0).getCapacityName());
voList.add(vo); vos.add(vo);
}); });
abilityResultMap.put(bo.getAnnualName(), voList); resultMap.put("学生能力平均值", vos);
abilityList.add(abilityResultMap);
});
resultMap.put("近2年能力分析", abilityList);
resultMap.put("部门比赛类型占比", convertCompType(compList)); List<Map<String, Object>> abilityList = new LinkedList<>();
List<Integer> years = DateUtils.getLastxYear(2);
List<Annual> annualList = iAnnualService.list(new LambdaQueryWrapper<Annual>().in(Annual::getAnnualName, years).orderByAsc(Annual::getAnnualName));
Optional.ofNullable(annualList).orElse(new LinkedList<>()).stream().forEach(bo -> {
Map<String, Object> abilityResultMap = new LinkedHashMap<>();
List<DepartAbilityEvaluation> departAbilityEvaluations = iDepartAbilityEvaluationService.list(new LambdaQueryWrapper<DepartAbilityEvaluation>()
.eq(DepartAbilityEvaluation::getAnnualId, bo.getId())
.eq(DepartAbilityEvaluation::getDepetId, departId));
List<DepartAbilityEvaluation> voList = new LinkedList<>();
Map<String, List<DepartAbilityEvaluation>> capacityIdListMap2 = Optional.ofNullable(departAbilityEvaluations).orElse(new LinkedList<>()).stream()
.collect(Collectors.groupingBy(DepartAbilityEvaluation::getCapacityId));
//遍历分组后的结果
Optional.ofNullable(capacityIdListMap2).orElse(new LinkedHashMap<>()).forEach((key, value) -> {
List<DepartAbilityEvaluation> departAbilityEvaluationList = value;
double sum = departAbilityEvaluationList.stream().mapToDouble(obj -> obj.getValue()).sum();
DecimalFormat decimalFormat = new DecimalFormat();
decimalFormat.setMaximumFractionDigits(2); // 保留两位小数
decimalFormat.setRoundingMode(RoundingMode.HALF_UP); // 设置具体的进位机制
double val = ComputeUtils.div2(sum, departAbilityEvaluationList.size());
DepartAbilityEvaluation vo = new DepartAbilityEvaluation();
vo.setAnnualId(bo.getId());
vo.setValue(val);
vo.setCapacityId(key);
vo.setCapacityName(departAbilityEvaluationList.get(0).getCapacityName());
voList.add(vo);
});
abilityResultMap.put(bo.getAnnualName(), voList);
abilityList.add(abilityResultMap);
});
resultMap.put("近2年能力分析", abilityList);
List<AnnualCompPoint> pointList = iAnnualCompPointService.list(new LambdaQueryWrapper<AnnualCompPoint>() resultMap.put("部门比赛类型占比", convertCompType(compList));
.eq(AnnualCompPoint::getRequireApply, "Y")
.in(AnnualCompPoint::getAnnualCompId, annualCompPointIds));
List<ReportCompVo> compVoList = new LinkedList<>();
Optional.ofNullable(pointList).orElse(new LinkedList<>()).stream().forEach(p -> {
ReportCompVo compVo = new ReportCompVo();
BeanUtils.copyProperties(p, compVo);
compVo.setPointName(p.getObjName());
AnnualComp annualComp = iAnnualCompService.getById(p.getAnnualCompId()); List<AnnualCompPoint> pointList = iAnnualCompPointService.list(new LambdaQueryWrapper<AnnualCompPoint>()
if (!ObjectUtils.isEmpty(annualComp)) { .eq(AnnualCompPoint::getRequireApply, "Y")
Comp comp = iCompService.getById(annualComp.getCompid()); .in(AnnualCompPoint::getAnnualCompId, annualCompPointIds));
compVo.setCompName(comp.getCompName()); List<ReportCompVo> compVoList = new LinkedList<>();
CompType compType = iCompTypeService.getById(comp.getCompTypeId()); Optional.ofNullable(pointList).orElse(new LinkedList<>()).stream().forEach(p -> {
compVo.setTypeName(compType.getTypeName()); ReportCompVo compVo = new ReportCompVo();
Projectlevel projectlevel = iProjectlevelService.getById(p.getObjLevel()); BeanUtils.copyProperties(p, compVo);
compVo.setProjectLevel(projectlevel.getName()); compVo.setPointName(p.getObjName());
}
List<AnnualCompetitionProjectRegistration> list = iAnnualCompetitionProjectRegistrationService.list(new LambdaQueryWrapper<AnnualCompetitionProjectRegistration>()
.eq(AnnualCompetitionProjectRegistration::getAnnualCompid, p.getId()));
if (!ObjectUtils.isEmpty(list)) {
Set<String> entryFormats = list.stream().map(bo -> bo.getEnrollCode()).collect(Collectors.toSet());
Long count = iTeamManagementService.count(new LambdaQueryWrapper<TeamManagement>().in(TeamManagement::getEnrollCode, entryFormats));
compVo.setNumber(count.intValue());
}
compVoList.add(compVo);
});
resultMap.put("学生参赛情况", compVoList);
List<AwardPersion> awardPersionList = iAwardPersionService.list(new LambdaQueryWrapper<AwardPersion>().in(AwardPersion::getAnnualCompP, annualCompPointIds)); AnnualComp annualComp = iAnnualCompService.getById(p.getAnnualCompId());
Map<String, List<AwardPersion>> awardIdListMap = Optional.ofNullable(awardPersionList).orElse(new LinkedList<>()).stream() if (!ObjectUtils.isEmpty(annualComp)) {
.collect(Collectors.groupingBy(AwardPersion::getAwardname)); Comp comp = iCompService.getById(annualComp.getCompid());
Map<String, Object> awardTypeMap = new LinkedHashMap<>(); compVo.setCompName(comp.getCompName());
CompType compType = iCompTypeService.getById(comp.getCompTypeId());
compVo.setTypeName(compType.getTypeName());
Projectlevel projectlevel = iProjectlevelService.getById(p.getObjLevel());
compVo.setProjectLevel(projectlevel.getName());
}
List<AnnualCompetitionProjectRegistration> list = iAnnualCompetitionProjectRegistrationService.list(new LambdaQueryWrapper<AnnualCompetitionProjectRegistration>()
.eq(AnnualCompetitionProjectRegistration::getAnnualCompid, p.getId()));
if (!ObjectUtils.isEmpty(list)) {
Set<String> entryFormats = list.stream().map(bo -> bo.getEnrollCode()).collect(Collectors.toSet());
Long count = iTeamManagementService.count(new LambdaQueryWrapper<TeamManagement>().in(TeamManagement::getEnrollCode, entryFormats));
compVo.setNumber(count.intValue());
}
compVoList.add(compVo);
});
resultMap.put("学生参赛情况", compVoList);
//遍历分组后的结果 List<AwardPersion> awardPersionList = iAwardPersionService.list(new LambdaQueryWrapper<AwardPersion>().in(AwardPersion::getAnnualCompP, annualCompPointIds));
Optional.ofNullable(awardIdListMap).orElse(new LinkedHashMap<>()).forEach((key, value) -> { Map<String, List<AwardPersion>> awardIdListMap = Optional.ofNullable(awardPersionList).orElse(new LinkedList<>()).stream()
awardTypeMap.put(key, value.size()); .collect(Collectors.groupingBy(AwardPersion::getAwardname));
}); Map<String, Object> awardTypeMap = new LinkedHashMap<>();
resultMap.put("比赛获奖占比", awardTypeMap);
//遍历分组后的结果
Optional.ofNullable(awardIdListMap).orElse(new LinkedHashMap<>()).forEach((key, value) -> {
List<ReportCompVo> awareVos = new ArrayList<>(); awardTypeMap.put(key, value.size());
Optional.ofNullable(awardPersionList).orElse(new LinkedList<>()).stream().forEach(p -> { });
ReportCompVo compVo = new ReportCompVo(); resultMap.put("比赛获奖占比", awardTypeMap);
compVo.setStuName(p.getStudentname());
compVo.setAwardName(p.getAwardname());
AnnualCompPoint point = iAnnualCompPointService.getById(p.getAnnualCompP()); List<ReportCompVo> awareVos = new ArrayList<>();
if (!ObjectUtils.isEmpty(point)) { Optional.ofNullable(awardPersionList).orElse(new LinkedList<>()).stream().forEach(p -> {
compVo.setPointName(point.getObjName()); ReportCompVo compVo = new ReportCompVo();
Projectlevel projectlevel = iProjectlevelService.getById(point.getObjLevel()); compVo.setStuName(p.getStudentname());
compVo.setProjectLevel(projectlevel.getName()); compVo.setAwardName(p.getAwardname());
} AnnualCompPoint point = iAnnualCompPointService.getById(p.getAnnualCompP());
AnnualComp annualComp = iAnnualCompService.getById(p.getAnnalComp()); if (!ObjectUtils.isEmpty(point)) {
if (!ObjectUtils.isEmpty(annualComp)) { compVo.setPointName(point.getObjName());
Comp comp = iCompService.getById(annualComp.getCompid()); Projectlevel projectlevel = iProjectlevelService.getById(point.getObjLevel());
compVo.setCompName(comp.getCompName()); compVo.setProjectLevel(projectlevel.getName());
CompType compType = iCompTypeService.getById(comp.getCompTypeId()); }
compVo.setTypeName(compType.getTypeName()); AnnualComp annualComp = iAnnualCompService.getById(p.getAnnalComp());
if (!ObjectUtils.isEmpty(annualComp)) {
Comp comp = iCompService.getById(annualComp.getCompid());
compVo.setCompName(comp.getCompName());
CompType compType = iCompTypeService.getById(comp.getCompTypeId());
compVo.setTypeName(compType.getTypeName());
}
awareVos.add(compVo);
});
resultMap.put("比赛获奖情况列表", awareVos);
List<Map<String, Object>> canSaiList = new LinkedList<>();
List<Map<String, Object>> huoJiangList = new LinkedList<>();
List<AnnualCompPoint> pointList4Depart = convertPoint4Depart(sysDepart);
Set<String> pointIds4Depart = Optional.ofNullable(pointList4Depart).orElse(new ArrayList<>()).stream().map(obj -> obj.getId()).collect(Collectors.toSet());
Map<String, Object> departMap = new LinkedHashMap<>();
departMap.put("部门名称", sysDepart.getDepartName());
if (!ObjectUtils.isEmpty(pointIds4Depart)) {
//报名列表
List<AnnualCompetitionProjectRegistration> registrationList = iAnnualCompetitionProjectRegistrationService.list(new LambdaQueryWrapper<AnnualCompetitionProjectRegistration>()
.in(AnnualCompetitionProjectRegistration::getAnnualCompid, pointIds4Depart));
if (!ObjectUtils.isEmpty(registrationList)) {
//报名编号
Set<String> enrollCodes = Optional.ofNullable(registrationList).orElse(new LinkedList<>()).stream().map(bo -> bo.getEnrollCode()).collect(Collectors.toSet());
Long count = iTeamManagementService.count(new LambdaQueryWrapper<TeamManagement>().in(TeamManagement::getEnrollCode, enrollCodes));
departMap.put("比赛总人数", count);
//个人赛报名数
List<AnnualCompetitionProjectRegistration> registrationList4Stu = registrationList.stream().filter(b -> b.getEntryFormat().equals("0")).collect(Collectors.toList());
Set<String> enrollCodes4Stu = Optional.ofNullable(registrationList4Stu).orElse(new LinkedList<>()).stream().map(bo -> bo.getEnrollCode()).collect(Collectors.toSet());
Long count4Stu = iTeamManagementService.count(new LambdaQueryWrapper<TeamManagement>().in(!ObjectUtils.isEmpty(enrollCodes4Stu), TeamManagement::getEnrollCode, enrollCodes4Stu));
//学生人数
departMap.put("个人赛人数", count4Stu);
departMap.put("团队赛人数", count - count4Stu);
}
} }
awareVos.add(compVo); canSaiList.add(departMap);
}); redisUtil.set(REPORT4DEPART, resultMap);
resultMap.put("比赛获奖情况列表", awareVos); return resultMap;
} else {
boolean hasKey = redisUtil.hasKey(REPORT4DEPART);
List<Map<String, Object>> canSaiList = new LinkedList<>(); if (hasKey) {
List<Map<String, Object>> huoJiangList = new LinkedList<>(); return redisUtil.get(REPORT4DEPART);
List<AnnualCompPoint> pointList4Depart = convertPoint4Depart(sysDepart); } else {
Set<String> pointIds4Depart = Optional.ofNullable(pointList4Depart).orElse(new ArrayList<>()).stream().map(obj -> obj.getId()).collect(Collectors.toSet()); return this.report4Depart(orgCode, true);
Map<String, Object> departMap = new LinkedHashMap<>();
departMap.put("部门名称", sysDepart.getDepartName());
if (!ObjectUtils.isEmpty(pointIds4Depart)) {
//报名列表
List<AnnualCompetitionProjectRegistration> registrationList = iAnnualCompetitionProjectRegistrationService.list(new LambdaQueryWrapper<AnnualCompetitionProjectRegistration>()
.in(AnnualCompetitionProjectRegistration::getAnnualCompid, pointIds4Depart));
if (!ObjectUtils.isEmpty(registrationList)) {
//报名编号
Set<String> enrollCodes = Optional.ofNullable(registrationList).orElse(new LinkedList<>()).stream().map(bo -> bo.getEnrollCode()).collect(Collectors.toSet());
Long count = iTeamManagementService.count(new LambdaQueryWrapper<TeamManagement>().in(TeamManagement::getEnrollCode, enrollCodes));
departMap.put("比赛总人数", count);
//个人赛报名数
List<AnnualCompetitionProjectRegistration> registrationList4Stu = registrationList.stream().filter(b -> b.getEntryFormat().equals("0")).collect(Collectors.toList());
Set<String> enrollCodes4Stu = Optional.ofNullable(registrationList4Stu).orElse(new LinkedList<>()).stream().map(bo -> bo.getEnrollCode()).collect(Collectors.toSet());
Long count4Stu = iTeamManagementService.count(new LambdaQueryWrapper<TeamManagement>().in(!ObjectUtils.isEmpty(enrollCodes4Stu), TeamManagement::getEnrollCode, enrollCodes4Stu));
//学生人数
departMap.put("个人赛人数", count4Stu);
departMap.put("团队赛人数", count - count4Stu);
} }
} }
canSaiList.add(departMap);
resultMap.put("部门参赛情况列表", canSaiList);
/* List<AwardPersion> awardPersionList4Depart = iAwardPersionService.list(new LambdaQueryWrapper<AwardPersion>().eq(AwardPersion::getAnnualCompP, pointIds4Depart));
Map<String, Object> departHuoJiangMap = new LinkedHashMap<>();
departHuoJiangMap.put("部门名称", sysDepart.getDepartName());
departHuoJiangMap.put("获取人数", awardPersionList4Depart.size());
Map<String, List<AwardPersion>> awardNameMap = Optional.ofNullable(awardPersionList4Depart).orElse(new LinkedList<>()).stream()
.collect(Collectors.groupingBy(AwardPersion::getAwardname));
//遍历分组后的结果
Map<String, Object> awardTypeMap2 = new HashMap<>();
// AtomicInteger huoJiangCount = new AtomicInteger();
Optional.ofNullable(awardNameMap).orElse(new LinkedHashMap<>()).forEach((key, value) -> {
departHuoJiangMap.put(key, value.size());
// huoJiangCount.addAndGet(value.size());
});
// awardTypeMap2.put("获奖人数", huoJiangCount.get());
// huoJiangList.add(awardTypeMap2);
resultMap.put("部门获奖情况列表", departHuoJiangMap);*/
return resultMap;
} }
Map<String, Object> convertProjectLevel(List<AnnualCompPoint> annualCompPointList) { Map<String, Object> convertProjectLevel(List<AnnualCompPoint> annualCompPointList) {

Loading…
Cancel
Save