河南机电职业学院-大屏数据统计

main
zhc077 5 months ago
parent 654bc246d6
commit 60325b3db4
  1. 12
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/bigScreen/controller/CompSystemBigScreenController.java
  2. 5
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/bigScreen/service/CompSystemBigScreenService.java
  3. 83
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/bigScreen/service/CompSystemBigScreenServiceImpl.java
  4. 3
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/bigScreen/vo/CompVo.java

@ -59,4 +59,16 @@ public class CompSystemBigScreenController /*extends JeecgController*/ {
return Result.ok(result);
}
@ApiOperation(value = "河南机电-院系参赛大屏数据", notes = "河南机电-院系参赛大屏数据")
@GetMapping(value = "/canSai")
public Result canSai() {
return Result.ok(compSystemBigScreenService.canSai());
}
@ApiOperation(value = "河南机电-院系能力大屏数据", notes = "河南机电-院系能力大屏数据")
@GetMapping(value = "/nengLi")
public Result nengLi() {
return Result.ok(compSystemBigScreenService.nengLi());
}
}

@ -2,6 +2,7 @@ package org.jeecg.modules.demo.bigScreen.service;
import org.jeecg.modules.demo.abilityEvaluation.entity.PersonalAbilityEvaluation;
import java.util.List;
import java.util.Map;
public interface CompSystemBigScreenService {
@ -12,4 +13,8 @@ public interface CompSystemBigScreenService {
Map<String, Object> composite();
Map<String, Object> singleComp(String compId);
List<Map<String, Object>> canSai();
Object nengLi();
}

@ -96,6 +96,78 @@ public class CompSystemBigScreenServiceImpl implements CompSystemBigScreenServic
@Autowired
private IAnnualService iAnnualService;
//二级部门id
private final String BASE_PARENT_ID = "1693446350597038081";
@Override
public List<Map<String, Object>> canSai() {
List<Map<String, Object>> resultList = new LinkedList<>();
//二级部门
List<SysDepart> departList = iSysDepartService.list(new LambdaQueryWrapper<SysDepart>().eq(SysDepart::getParentId, BASE_PARENT_ID));
Optional.ofNullable(departList).orElse(new LinkedList<>()).stream().forEach(depart -> {
Map<String, Object> resultMap = new LinkedHashMap<>();
List<CompVo> vos = new LinkedList<>();
CompVo vo = new CompVo();
//部门id
vo.setCompOrganId(depart.getId());
//部门名称
vo.setCompOrganName(depart.getDepartName());
List<AnnualCompetitionProjectRegistration> registrationList = iAnnualCompetitionProjectRegistrationService.list(new LambdaQueryWrapper<AnnualCompetitionProjectRegistration>()
.eq(AnnualCompetitionProjectRegistration::getSysOrgCode, depart.getOrgCode()));
Map<String, List<AnnualCompetitionProjectRegistration>> annualCompIdListMap = Optional.ofNullable(registrationList).orElse(new LinkedList<>()).stream()
.collect(Collectors.groupingBy(AnnualCompetitionProjectRegistration::getAnnualCompid));
Optional.ofNullable(annualCompIdListMap).orElse(new LinkedHashMap<>()).forEach((key, obj) -> {
vo.setNumber(obj.size());
AnnualCompPoint annualCompPoint = iAnnualCompPointService.getById(key);
if (!ObjectUtils.isEmpty(annualCompPoint)) {
vo.setCompName(annualCompPoint.getObjName());
}
Long awardCount = iAwardPersionService.count(new LambdaQueryWrapper<AwardPersion>()
.in(AwardPersion::getAnnalComp, key));
vo.setAwardNumber(awardCount.intValue());
vos.add(vo);
});
resultMap.put(depart.getDepartName(), vos);
resultList.add(resultMap);
});
return resultList;
}
@Override
public List<Map<String, Object>> nengLi() {
List<Map<String, Object>> resultList = new LinkedList<>();
//二级部门
List<SysDepart> departList = iSysDepartService.list(new LambdaQueryWrapper<SysDepart>().eq(SysDepart::getParentId, BASE_PARENT_ID));
Optional.ofNullable(departList).orElse(new LinkedList<>()).stream().forEach(depart -> {
Map<String, Object> resultMap = new LinkedHashMap<>();
List<DepartAbilityEvaluation> departAbilityEvaluations = iDepartAbilityEvaluationService.list(new LambdaQueryWrapper<DepartAbilityEvaluation>()
.eq(DepartAbilityEvaluation::getDepetId, depart.getId()));
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(depart.getId());
vo.setValue(val);
vo.setCapacityId(key);
vo.setCapacityName(departAbilityEvaluationList.get(0).getCapacityName());
vos.add(vo);
});
resultMap.put(depart.getDepartName(), vos);
resultList.add(resultMap);
});
return resultList;
}
/**
* @description: 单项比赛数据展示
* 使用大数据页面的形式全面展示某项比赛的各种综合数据包括年度比赛列表比赛项目数参赛人数统计多维度能力评价分析数据近五年比赛人数对比比赛获奖列表参赛人员积分列表需要提供功能截图
@ -144,10 +216,13 @@ public class CompSystemBigScreenServiceImpl implements CompSystemBigScreenServic
List<PersonalCompScore> personalCompScoreList = iPersonalCompScoreService.list(new LambdaQueryWrapper<PersonalCompScore>().in(PersonalCompScore::getAnnualCompId, annualCompIds));
//参加该比赛的所有学生学号
Set<String> workNos = Optional.ofNullable(personalCompScoreList).orElse(new ArrayList<>()).stream().map(personalCompScore -> personalCompScore.getWorkOn()).collect(Collectors.toSet());
List<PersonalCompTotalScore> personalCompTotalScoreList = iPersonalCompTotalScoreService.list(new LambdaQueryWrapper<PersonalCompTotalScore>()
.in(PersonalCompTotalScore::getWorkOn, workNos)
.orderByDesc(PersonalCompTotalScore::getScore)
.last("limit 50"));
List<PersonalCompTotalScore> personalCompTotalScoreList = null;
if (!ObjectUtils.isEmpty(workNos)) {
personalCompTotalScoreList = iPersonalCompTotalScoreService.list(new LambdaQueryWrapper<PersonalCompTotalScore>()
.in(PersonalCompTotalScore::getWorkOn, workNos)
.orderByDesc(PersonalCompTotalScore::getScore)
.last("limit 50"));
}
//学生积分排名
resultMap.put("studentScore", personalCompTotalScoreList);

@ -41,6 +41,9 @@ public class CompVo implements Serializable {
@ApiModelProperty(value = "年度比赛项目数")
private Integer annualCompPointNumber;
@ApiModelProperty(value = "获取人数")
private Integer awardNumber;
@ApiModelProperty(value = "年度比赛状态")
private String status;
}

Loading…
Cancel
Save