|
|
|
@ -1,11 +1,9 @@ |
|
|
|
|
package org.jeecg.modules.demo.bigScreen.service; |
|
|
|
|
|
|
|
|
|
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.modules.demo.abilityEvaluation.entity.DepartAbilityEvaluation; |
|
|
|
|
import org.jeecg.modules.demo.abilityEvaluation.entity.PersonalAbilityEvaluation; |
|
|
|
|
import org.jeecg.modules.demo.abilityEvaluation.entity.PersonalAbilityEvaluationCollect; |
|
|
|
|
import org.jeecg.modules.demo.abilityEvaluation.service.IDepartAbilityEvaluationService; |
|
|
|
|
import org.jeecg.modules.demo.abilityEvaluation.service.IPersonalAbilityEvaluationCollectService; |
|
|
|
@ -93,6 +91,143 @@ public class CompSystemBigScreenServiceImpl implements CompSystemBigScreenServic |
|
|
|
|
@Autowired |
|
|
|
|
private IAnnualService iAnnualService; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @description: 单项比赛数据展示 |
|
|
|
|
* 使用大数据页面的形式全面展示某项比赛的各种综合数据,包括年度比赛列表、比赛项目数、参赛人数统计、多维度能力评价分析数据、近五年比赛人数对比,比赛获奖列表,参赛人员积分列表。需要提供功能截图。 |
|
|
|
|
* @param: [compId] |
|
|
|
|
* @return: java.util.Map<java.lang.String, java.lang.Object> |
|
|
|
|
* @author: z.h.c |
|
|
|
|
* @date: 24/7/6 11:51 |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Map<String, Object> singleComp(String compId) { |
|
|
|
|
|
|
|
|
|
Assert.notNull(compId, "比赛id不能为空"); |
|
|
|
|
Map<String, Object> resultMap = new LinkedHashMap<>(); |
|
|
|
|
Comp comp = iCompService.getById(compId); |
|
|
|
|
if (ObjectUtils.isEmpty(comp)) { |
|
|
|
|
return resultMap; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//比赛列表
|
|
|
|
|
List<CompVo> annualCompList = this.getAnnualCompList(comp); |
|
|
|
|
//年度比赛列表
|
|
|
|
|
resultMap.put("annualCompList", annualCompList); |
|
|
|
|
// List<AnnualComp> annualCompList = iAnnualCompService.list(new LambdaQueryWrapper<AnnualComp>().eq(AnnualComp::getCompid, compId));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//年度比赛ids
|
|
|
|
|
Set<String> annualCompIds = Optional.ofNullable(annualCompList).orElse(new ArrayList<>()).stream().map(annualComp -> annualComp.getCompId()).collect(Collectors.toSet()); |
|
|
|
|
List<AwardPersion> awardPersionList = iAwardPersionService.list(new LambdaQueryWrapper<AwardPersion>() |
|
|
|
|
.in(AwardPersion::getAnnalComp, annualCompIds) |
|
|
|
|
.orderByAsc(AwardPersion::getAwardname) |
|
|
|
|
.last("limit 30")); |
|
|
|
|
Optional.ofNullable(awardPersionList).orElse(new LinkedList<>()).forEach(award -> { |
|
|
|
|
// 根据报名编号查询参赛者信息,都是个人赛场景
|
|
|
|
|
TeamManagement management = iTeamManagementService.getOne(new LambdaQueryWrapper<TeamManagement>() |
|
|
|
|
.eq(TeamManagement::getEnrollCode, award.getEnrollCode()).last("limit 1")); |
|
|
|
|
if (ObjectUtils.isEmpty(management)) return; |
|
|
|
|
SysUser sysUser = iSysUserService.getById(management.getUserId()); |
|
|
|
|
award.setStudentname(sysUser.getRealname()); |
|
|
|
|
AnnualCompPoint annualCompPoint = iAnnualCompPointService.getById(award.getAnnualCompP()); |
|
|
|
|
award.setAnnualCompPname(annualCompPoint.getObjName()); |
|
|
|
|
}); |
|
|
|
|
//获奖列表
|
|
|
|
|
resultMap.put("awardList", awardPersionList); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<PersonalCompTotalScore> personalCompScoreList = iPersonalCompTotalScoreService.list(new LambdaQueryWrapper<PersonalCompTotalScore>() |
|
|
|
|
// .eq(PersonalCompTotalScore::getDepet, departId)
|
|
|
|
|
.orderByDesc(PersonalCompTotalScore::getScore) |
|
|
|
|
.last("limit 50")); |
|
|
|
|
//学生积分排名
|
|
|
|
|
resultMap.put("studentScore", personalCompScoreList); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> compCounts = new LinkedHashMap<>(); |
|
|
|
|
long pointCount = iAnnualCompPointService.count(new LambdaQueryWrapper<AnnualCompPoint>().in(AnnualCompPoint::getAnnualCompId, annualCompIds)); |
|
|
|
|
//比赛数
|
|
|
|
|
// compCounts.put("compCount", annualCompIds.size());
|
|
|
|
|
//年度项目比赛数
|
|
|
|
|
compCounts.put("pointCount", pointCount); |
|
|
|
|
//总报名数
|
|
|
|
|
long count = iAnnualCompetitionProjectRegistrationService.count(new LambdaQueryWrapper<AnnualCompetitionProjectRegistration>() |
|
|
|
|
.in(AnnualCompetitionProjectRegistration::getAnnualCompid, annualCompIds) |
|
|
|
|
); |
|
|
|
|
//总报名数
|
|
|
|
|
compCounts.put("count", count); |
|
|
|
|
Long personCount = iAnnualCompetitionProjectRegistrationService.count(new LambdaQueryWrapper<AnnualCompetitionProjectRegistration>() |
|
|
|
|
.eq(AnnualCompetitionProjectRegistration::getEntryFormat, "0") |
|
|
|
|
.in(AnnualCompetitionProjectRegistration::getAnnualCompid, annualCompIds)); |
|
|
|
|
//学生人数
|
|
|
|
|
compCounts.put("personCompCount", personCount); |
|
|
|
|
Long teamCount = count - personCount; |
|
|
|
|
//队伍数
|
|
|
|
|
compCounts.put("teamCompCount", teamCount); |
|
|
|
|
//比赛统计
|
|
|
|
|
resultMap.put("compCounts", compCounts); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// List<DepartAbilityEvaluation> departAbilityEvaluations = iDepartAbilityEvaluationService.list(new LambdaQueryWrapper<DepartAbilityEvaluation>()
|
|
|
|
|
// .eq(DepartAbilityEvaluation::getDepetId, departId));
|
|
|
|
|
// List<DepartAbilityEvaluation> vos = new LinkedList<>();
|
|
|
|
|
// Map<String, List<DepartAbilityEvaluation>> capacityIdListMap = Optional.ofNullable(departAbilityEvaluations).orElse(new LinkedList<>()).stream()
|
|
|
|
|
// .collect(Collectors.groupingBy(DepartAbilityEvaluation::getCapacityId));
|
|
|
|
|
// //遍历分组后的结果
|
|
|
|
|
// Optional.ofNullable(capacityIdListMap).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.setDepetId(departId);
|
|
|
|
|
// vo.setValue(val);
|
|
|
|
|
// vo.setCapacityId(key);
|
|
|
|
|
// vo.setCapacityName(departAbilityEvaluationList.get(0).getCapacityName());
|
|
|
|
|
// vos.add(vo);
|
|
|
|
|
// });
|
|
|
|
|
// //能力评估
|
|
|
|
|
// resultMap.put("departAbilityEvaluation", vos);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Integer> years = DateUtils.getLastxYear(5); |
|
|
|
|
List<Annual> annualList = iAnnualService.list(new LambdaQueryWrapper<Annual>() |
|
|
|
|
.in(Annual::getAnnualName, years)); |
|
|
|
|
List<Last5YearDataVo> last5YearDataVos = new LinkedList<>(); |
|
|
|
|
Set<String> annualIds = Optional.ofNullable(annualList).orElse(new LinkedList<>()).stream().map(obj -> obj.getId()).collect(Collectors.toSet()); |
|
|
|
|
//该项目5年的比赛
|
|
|
|
|
List<AnnualComp> annualCompList5Year = iAnnualCompService.list(new LambdaQueryWrapper<AnnualComp>() |
|
|
|
|
.eq(AnnualComp::getCompid, compId) |
|
|
|
|
.in(AnnualComp::getAnnualid, annualIds)); |
|
|
|
|
Optional.ofNullable(annualCompList5Year).orElse(new LinkedList<>()).stream().forEach(ac -> { |
|
|
|
|
Last5YearDataVo last5YearDataVo = new Last5YearDataVo(); |
|
|
|
|
annualList.stream().forEach(a -> { |
|
|
|
|
if (a.getId().equals(ac.getAnnualid())) { |
|
|
|
|
last5YearDataVo.setYear(a.getAnnualName()); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
AtomicReference<BigDecimal> personCount4Comp = new AtomicReference<>(BigDecimal.ZERO); |
|
|
|
|
|
|
|
|
|
//比赛数
|
|
|
|
|
last5YearDataVo.setCompCount(1); |
|
|
|
|
AnnualCompPoint annualCompPoint = iAnnualCompPointService.getOne(new LambdaQueryWrapper<AnnualCompPoint>().eq(AnnualCompPoint::getAnnualCompId, ac.getId())); |
|
|
|
|
if (!ObjectUtils.isEmpty(annualCompPoint)) { |
|
|
|
|
long personCount4CompTemp = iAnnualCompetitionProjectRegistrationService.count(new LambdaQueryWrapper<AnnualCompetitionProjectRegistration>(). |
|
|
|
|
eq(AnnualCompetitionProjectRegistration::getAnnualCompid, annualCompPoint.getId())); |
|
|
|
|
personCount4Comp.getAndUpdate(val -> val.add(new BigDecimal(personCount4CompTemp))); |
|
|
|
|
last5YearDataVo.setPersonCount(personCount4Comp.get().intValue()); |
|
|
|
|
} |
|
|
|
|
last5YearDataVos.add(last5YearDataVo); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
resultMap.put("last5YearData", last5YearDataVos); |
|
|
|
|
return resultMap; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @description: 部门比赛数据展示 |
|
|
|
|
* 使用大数据页面的形式全面展示各部门参加比赛的数据,可以用多幅大数据页面分别展示,展示内容包括:多维度能力评价数据、获奖情况、得分情况、参赛情况。需要提供功能截图。 |
|
|
|
@ -106,10 +241,10 @@ public class CompSystemBigScreenServiceImpl implements CompSystemBigScreenServic |
|
|
|
|
|
|
|
|
|
Assert.notNull(departId, "部门id不能为空"); |
|
|
|
|
SysDepart sysDepart = iSysDepartService.getById(departId); |
|
|
|
|
Map<String, Object> resultMap = new LinkedHashMap<>(); |
|
|
|
|
if (ObjectUtils.isEmpty(sysDepart)) { |
|
|
|
|
throw new JeecgBootException("部门不存在"); |
|
|
|
|
return resultMap; |
|
|
|
|
} |
|
|
|
|
Map<String, Object> resultMap = new LinkedHashMap<>(); |
|
|
|
|
|
|
|
|
|
//比赛列表
|
|
|
|
|
List<CompVo> compVoList = this.getCompList4Depart(sysDepart); |
|
|
|
@ -220,24 +355,24 @@ public class CompSystemBigScreenServiceImpl implements CompSystemBigScreenServic |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Map<String, Object> bigScreen4Student(PersonalAbilityEvaluation person) { |
|
|
|
|
public Map<String, Object> bigScreen4Student(String workNo) { |
|
|
|
|
|
|
|
|
|
Assert.notNull(person.getWorkOn(), "学号不能为空"); |
|
|
|
|
Assert.notNull(workNo, "学号不能为空"); |
|
|
|
|
|
|
|
|
|
Map<String, Object> resultMap = new LinkedHashMap<>(); |
|
|
|
|
List<PersonalAbilityEvaluationCollect> personalAbilityEvaluationList = iPersonalAbilityEvaluationCollectService.list(new LambdaQueryWrapper<PersonalAbilityEvaluationCollect>() |
|
|
|
|
.eq(PersonalAbilityEvaluationCollect::getWorkOn, person.getWorkOn())); |
|
|
|
|
.eq(PersonalAbilityEvaluationCollect::getWorkOn, workNo)); |
|
|
|
|
resultMap.put("studentAbilityEvaluation", personalAbilityEvaluationList); |
|
|
|
|
|
|
|
|
|
Map<String, Object> studentInfoMap = new LinkedHashMap<>(); |
|
|
|
|
PersonalCompTotalScore compTotalScore = iPersonalCompTotalScoreService.getOne(new LambdaQueryWrapper<PersonalCompTotalScore>() |
|
|
|
|
.eq(PersonalCompTotalScore::getWorkOn, person.getWorkOn())); |
|
|
|
|
.eq(PersonalCompTotalScore::getWorkOn, workNo)); |
|
|
|
|
studentInfoMap.put("score", compTotalScore); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SysUser sysUser = iSysUserService.getOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getWorkNo, person.getWorkOn())); |
|
|
|
|
SysUser sysUser = iSysUserService.getOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getWorkNo, workNo)); |
|
|
|
|
List<AwardPersion> awardPersions = iAwardPersionService.list(new LambdaQueryWrapper<AwardPersion>() |
|
|
|
|
.eq(AwardPersion::getStudentcode, person.getWorkOn())); |
|
|
|
|
.eq(AwardPersion::getStudentcode, workNo)); |
|
|
|
|
Optional.ofNullable(awardPersions).orElse(new LinkedList<>()).forEach(award -> { |
|
|
|
|
AnnualCompPoint annualCompPoint = iAnnualCompPointService.getById(award.getAnnualCompP()); |
|
|
|
|
award.setAnnualCompPname(annualCompPoint.getObjName()); |
|
|
|
@ -252,7 +387,7 @@ public class CompSystemBigScreenServiceImpl implements CompSystemBigScreenServic |
|
|
|
|
Map<String, Object> yearData = new LinkedHashMap<>(); |
|
|
|
|
yearData.put("year", annual.getAnnualName()); |
|
|
|
|
List<PersonalCompScore> compScoreList = iPersonalCompScoreService.list(new LambdaQueryWrapper<PersonalCompScore>() |
|
|
|
|
.eq(PersonalCompScore::getWorkOn, person.getWorkOn()) |
|
|
|
|
.eq(PersonalCompScore::getWorkOn, workNo) |
|
|
|
|
.eq(PersonalCompScore::getAnnualId, annual.getId())); |
|
|
|
|
if (!ObjectUtils.isEmpty(compScoreList)) { |
|
|
|
|
double sum = compScoreList.stream().mapToDouble(PersonalCompScore::getScore).sum(); |
|
|
|
@ -262,7 +397,7 @@ public class CompSystemBigScreenServiceImpl implements CompSystemBigScreenServic |
|
|
|
|
last4YearData.add(yearData); |
|
|
|
|
}); |
|
|
|
|
studentInfoMap.put("last4YearData", last4YearData); |
|
|
|
|
studentInfoMap.put("workNo", person.getWorkOn()); |
|
|
|
|
studentInfoMap.put("workNo", workNo); |
|
|
|
|
studentInfoMap.put("name", sysUser.getRealname()); |
|
|
|
|
studentInfoMap.put("major", "软件工程"); |
|
|
|
|
studentInfoMap.put("grade", "202*级"); |
|
|
|
@ -407,6 +542,7 @@ public class CompSystemBigScreenServiceImpl implements CompSystemBigScreenServic |
|
|
|
|
return resultMap; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<CompVo> getCompList() { |
|
|
|
|
List<AnnualCompPoint> annualCompPointList = iAnnualCompPointService.list(new LambdaQueryWrapper<AnnualCompPoint>() |
|
|
|
|
.eq(AnnualCompPoint::getRequireApply, "Y")); |
|
|
|
@ -468,4 +604,38 @@ public class CompSystemBigScreenServiceImpl implements CompSystemBigScreenServic |
|
|
|
|
}); |
|
|
|
|
return compVoList; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private List<CompVo> getAnnualCompList(Comp comp) { |
|
|
|
|
List<CompVo> compVoList = new LinkedList<>(); |
|
|
|
|
//年度比赛表
|
|
|
|
|
List<AnnualComp> annualCompList = iAnnualCompService.list(new LambdaQueryWrapper<AnnualComp>().eq(AnnualComp::getCompid, comp.getId())); |
|
|
|
|
Optional.ofNullable(annualCompList).orElse(new LinkedList<>()).stream().forEach(ac -> { |
|
|
|
|
CompVo compVo = new CompVo(); |
|
|
|
|
//年度比赛id
|
|
|
|
|
compVo.setCompId(ac.getId()); |
|
|
|
|
//年度比赛名称
|
|
|
|
|
compVo.setCompName(ac.getName()); |
|
|
|
|
// compVo.setCompOrganId(sysDepart.getId());
|
|
|
|
|
// compVo.setCompOrganName(sysDepart.getDepartName());
|
|
|
|
|
compVo.setNumber(0); |
|
|
|
|
// compVo.setAnnualCompPointNumber(0);
|
|
|
|
|
compVo.setStatus(ac.getState()); |
|
|
|
|
//年度比赛表
|
|
|
|
|
// List<AnnualComp> annualCompList = iAnnualCompService.list(new LambdaQueryWrapper<AnnualComp>().in(AnnualComp::getCompid, c.getId()));
|
|
|
|
|
// Set<String> annualCompIds = Optional.ofNullable(ac).orElse(new ArrayList<>()).stream().map(annualComp -> annualComp.getId()).collect(Collectors.toSet());
|
|
|
|
|
//年度比赛项目表
|
|
|
|
|
List<AnnualCompPoint> annualCompPointList = iAnnualCompPointService.list(new LambdaQueryWrapper<AnnualCompPoint>() |
|
|
|
|
.in(AnnualCompPoint::getAnnualCompId, ac.getId())); |
|
|
|
|
// compVo.setAnnualCompPointNumber(annualCompPointList.size());
|
|
|
|
|
Set<String> annualCompPointIds = Optional.ofNullable(annualCompPointList).orElse(new ArrayList<>()).stream().map(annualCompPoint -> annualCompPoint.getId()).collect(Collectors.toSet()); |
|
|
|
|
if (!ObjectUtils.isEmpty(annualCompPointIds)) { |
|
|
|
|
//报名表
|
|
|
|
|
List<AnnualCompetitionProjectRegistration> list = iAnnualCompetitionProjectRegistrationService.list(new LambdaQueryWrapper<AnnualCompetitionProjectRegistration>() |
|
|
|
|
.in(AnnualCompetitionProjectRegistration::getAnnualCompid, annualCompPointIds)); |
|
|
|
|
compVo.setNumber(list.size()); |
|
|
|
|
} |
|
|
|
|
compVoList.add(compVo); |
|
|
|
|
}); |
|
|
|
|
return compVoList; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|