|
|
@ -1,6 +1,8 @@ |
|
|
|
package org.jeecg.modules.demo.bigScreen.service; |
|
|
|
package org.jeecg.modules.demo.bigScreen.service; |
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.jeecg.common.util.ComputeUtils; |
|
|
|
import org.jeecg.common.util.ComputeUtils; |
|
|
|
import org.jeecg.common.util.DateUtils; |
|
|
|
import org.jeecg.common.util.DateUtils; |
|
|
|
import org.jeecg.modules.demo.abilityEvaluation.entity.DepartAbilityEvaluation; |
|
|
|
import org.jeecg.modules.demo.abilityEvaluation.entity.DepartAbilityEvaluation; |
|
|
@ -15,11 +17,12 @@ import org.jeecg.modules.demo.annualCompPoint.entity.AnnualCompPoint; |
|
|
|
import org.jeecg.modules.demo.annualCompPoint.service.IAnnualCompPointService; |
|
|
|
import org.jeecg.modules.demo.annualCompPoint.service.IAnnualCompPointService; |
|
|
|
import org.jeecg.modules.demo.annualScore.entity.PersonalCompScore; |
|
|
|
import org.jeecg.modules.demo.annualScore.entity.PersonalCompScore; |
|
|
|
import org.jeecg.modules.demo.annualScore.entity.PersonalCompTotalScore; |
|
|
|
import org.jeecg.modules.demo.annualScore.entity.PersonalCompTotalScore; |
|
|
|
import org.jeecg.modules.demo.annualScore.service.IDepartCompTotalScoreService; |
|
|
|
|
|
|
|
import org.jeecg.modules.demo.annualScore.service.IPersonalCompScoreService; |
|
|
|
import org.jeecg.modules.demo.annualScore.service.IPersonalCompScoreService; |
|
|
|
import org.jeecg.modules.demo.annualScore.service.IPersonalCompTotalScoreService; |
|
|
|
import org.jeecg.modules.demo.annualScore.service.IPersonalCompTotalScoreService; |
|
|
|
import org.jeecg.modules.demo.annualcomp.entity.AnnualComp; |
|
|
|
import org.jeecg.modules.demo.annualcomp.entity.AnnualComp; |
|
|
|
import org.jeecg.modules.demo.annualcomp.service.IAnnualCompService; |
|
|
|
import org.jeecg.modules.demo.annualcomp.service.IAnnualCompService; |
|
|
|
|
|
|
|
import org.jeecg.modules.demo.annualcompaward.entity.AnnualCompAward; |
|
|
|
|
|
|
|
import org.jeecg.modules.demo.annualcompaward.service.IAnnualCompAwardService; |
|
|
|
import org.jeecg.modules.demo.annualcompetitionprojectregistration.entity.AnnualCompetitionProjectRegistration; |
|
|
|
import org.jeecg.modules.demo.annualcompetitionprojectregistration.entity.AnnualCompetitionProjectRegistration; |
|
|
|
import org.jeecg.modules.demo.annualcompetitionprojectregistration.entity.TeamManagement; |
|
|
|
import org.jeecg.modules.demo.annualcompetitionprojectregistration.entity.TeamManagement; |
|
|
|
import org.jeecg.modules.demo.annualcompetitionprojectregistration.service.IAnnualCompetitionProjectRegistrationService; |
|
|
|
import org.jeecg.modules.demo.annualcompetitionprojectregistration.service.IAnnualCompetitionProjectRegistrationService; |
|
|
@ -30,6 +33,8 @@ import org.jeecg.modules.demo.bigScreen.vo.CompVo; |
|
|
|
import org.jeecg.modules.demo.bigScreen.vo.Last5YearDataVo; |
|
|
|
import org.jeecg.modules.demo.bigScreen.vo.Last5YearDataVo; |
|
|
|
import org.jeecg.modules.demo.comp.entity.Comp; |
|
|
|
import org.jeecg.modules.demo.comp.entity.Comp; |
|
|
|
import org.jeecg.modules.demo.comp.service.ICompService; |
|
|
|
import org.jeecg.modules.demo.comp.service.ICompService; |
|
|
|
|
|
|
|
import org.jeecg.modules.demo.comptype.entity.CompType; |
|
|
|
|
|
|
|
import org.jeecg.modules.demo.comptype.service.ICompTypeService; |
|
|
|
import org.jeecg.modules.system.entity.SysDepart; |
|
|
|
import org.jeecg.modules.system.entity.SysDepart; |
|
|
|
import org.jeecg.modules.system.entity.SysUser; |
|
|
|
import org.jeecg.modules.system.entity.SysUser; |
|
|
|
import org.jeecg.modules.system.service.ISysDepartService; |
|
|
|
import org.jeecg.modules.system.service.ISysDepartService; |
|
|
@ -54,6 +59,7 @@ import java.util.stream.Collectors; |
|
|
|
* @Version: 1.0 |
|
|
|
* @Version: 1.0 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Service |
|
|
|
@Service |
|
|
|
|
|
|
|
@Slf4j |
|
|
|
public class CompSystemBigScreenServiceImpl implements CompSystemBigScreenService { |
|
|
|
public class CompSystemBigScreenServiceImpl implements CompSystemBigScreenService { |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
@ -65,11 +71,14 @@ public class CompSystemBigScreenServiceImpl implements CompSystemBigScreenServic |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private ICompService iCompService; |
|
|
|
private ICompService iCompService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private ICompTypeService iCompTypeService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private ISysDepartService iSysDepartService; |
|
|
|
private ISysDepartService iSysDepartService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private IDepartCompTotalScoreService iDepartCompTotalScoreService; |
|
|
|
private IAnnualCompAwardService iAnnualCompAwardService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private IAnnualCompetitionProjectRegistrationService iAnnualCompetitionProjectRegistrationService; |
|
|
|
private IAnnualCompetitionProjectRegistrationService iAnnualCompetitionProjectRegistrationService; |
|
|
@ -104,6 +113,10 @@ public class CompSystemBigScreenServiceImpl implements CompSystemBigScreenServic |
|
|
|
//二级部门id
|
|
|
|
//二级部门id
|
|
|
|
private final String BASE_PARENT_ID = "1693446350597038081"; |
|
|
|
private final String BASE_PARENT_ID = "1693446350597038081"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static final Integer ONE_HUNDRED = 100; |
|
|
|
|
|
|
|
private static final Double ZERO_POINT_FIVE = 0.5; |
|
|
|
|
|
|
|
private static final Double ZERO_POINT_TWO = 0.2; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<Map<String, Object>> canSai() { |
|
|
|
public List<Map<String, Object>> canSai() { |
|
|
@ -231,35 +244,112 @@ public class CompSystemBigScreenServiceImpl implements CompSystemBigScreenServic |
|
|
|
List<SysDepart> departList = iSysDepartService.list(new LambdaQueryWrapper<SysDepart>().eq(SysDepart::getParentId, BASE_PARENT_ID)); |
|
|
|
List<SysDepart> departList = iSysDepartService.list(new LambdaQueryWrapper<SysDepart>().eq(SysDepart::getParentId, BASE_PARENT_ID)); |
|
|
|
Optional.ofNullable(departList).orElse(new LinkedList<>()).stream().forEach(depart -> { |
|
|
|
Optional.ofNullable(departList).orElse(new LinkedList<>()).stream().forEach(depart -> { |
|
|
|
Map<String, Object> resultMap = new LinkedHashMap<>(); |
|
|
|
Map<String, Object> resultMap = new LinkedHashMap<>(); |
|
|
|
List<Comp> compList = iCompService.list(new LambdaQueryWrapper<Comp>().eq(Comp::getCompOrgan, depart.getParentId())); |
|
|
|
List<Comp> compList = iCompService.list(new LambdaQueryWrapper<Comp>().eq(Comp::getCompOrgan, depart.getId())); |
|
|
|
//比赛类型
|
|
|
|
//比赛类型
|
|
|
|
Map<String, List<Comp>> compTypeListMap = Optional.ofNullable(compList).orElse(new LinkedList<>()).stream() |
|
|
|
Map<String, List<Comp>> compTypeListMap = Optional.ofNullable(compList).orElse(new LinkedList<>()).stream() |
|
|
|
.collect(Collectors.groupingBy(Comp::getCompTypeId)); |
|
|
|
.collect(Collectors.groupingBy(Comp::getCompTypeId)); |
|
|
|
|
|
|
|
|
|
|
|
//TODO
|
|
|
|
List<Map<String, Object>> vos = new ArrayList<>(); |
|
|
|
//遍历分组后的结果
|
|
|
|
Optional.ofNullable(compTypeListMap).orElse(new LinkedHashMap<>()).forEach((key, comps) -> { |
|
|
|
// DecimalFormat decimalFormat = new DecimalFormat();
|
|
|
|
AtomicReference<BigDecimal> score4CompType = new AtomicReference<>(new BigDecimal(0)); |
|
|
|
// decimalFormat.setMaximumFractionDigits(2); // 保留两位小数
|
|
|
|
CompType compType = iCompTypeService.getById(key.toString()); |
|
|
|
// decimalFormat.setRoundingMode(RoundingMode.HALF_UP); // 设置具体的进位机制
|
|
|
|
Optional.ofNullable(comps).orElse(new ArrayList<>()).stream().forEach(comp -> { |
|
|
|
// List<CompVo> vos = new ArrayList<>();
|
|
|
|
List<AnnualComp> annualComps = iAnnualCompService.list(new LambdaQueryWrapper<AnnualComp>().eq(AnnualComp::getCompid, comp.getId())); |
|
|
|
// Optional.ofNullable(compTypeListMap).orElse(new LinkedHashMap<>()).forEach((key, value) -> {
|
|
|
|
Set<String> annualCompIds = Optional.ofNullable(annualComps).orElse(new ArrayList<>()).stream().map(bo -> bo.getAnnualid()).collect(Collectors.toSet()); |
|
|
|
//
|
|
|
|
if (!ObjectUtils.isEmpty(annualCompIds)) { |
|
|
|
// double ratio = ComputeUtils.div2(value.size(), registrationList.size());
|
|
|
|
List<AnnualCompPoint> annualCompPointList = iAnnualCompPointService.list(new LambdaQueryWrapper<AnnualCompPoint>().in(AnnualCompPoint::getAnnualCompId, annualCompIds)); |
|
|
|
// CompVo vo = new CompVo();
|
|
|
|
Optional.ofNullable(annualCompPointList).orElse(new ArrayList<>()).stream().forEach(annualCompPoint -> { |
|
|
|
// vo.setCompOrganId(depart.getId());
|
|
|
|
BigDecimal score = convertScore(annualCompPoint, comp); |
|
|
|
// vo.setCompOrganName(depart.getDepartName());
|
|
|
|
score4CompType.getAndUpdate(val -> val.add(new BigDecimal(score.toString()))); |
|
|
|
// vo.setNumber(registrationList.size());
|
|
|
|
}); |
|
|
|
// vo.setAwardName(key);
|
|
|
|
} |
|
|
|
// vo.setAwardNumber(value.size());
|
|
|
|
}); |
|
|
|
// vo.setAwardRatio(ratio + "");
|
|
|
|
Map<String, Object> typeMap = new LinkedHashMap<>(); |
|
|
|
// vos.add(vo);
|
|
|
|
typeMap.put(compType.getTypeName(), score4CompType.get()); |
|
|
|
// });
|
|
|
|
vos.add(typeMap); |
|
|
|
resultMap.put(depart.getDepartName(), null); |
|
|
|
}); |
|
|
|
|
|
|
|
resultMap.put(depart.getDepartName(), vos); |
|
|
|
resultList.add(resultMap); |
|
|
|
resultList.add(resultMap); |
|
|
|
}); |
|
|
|
}); |
|
|
|
return resultList; |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BigDecimal convertScore(AnnualCompPoint annualCompPoint, Comp comp) { |
|
|
|
|
|
|
|
AtomicReference<BigDecimal> score4Point = new AtomicReference<>(new BigDecimal(0)); |
|
|
|
|
|
|
|
if (!ObjectUtils.isEmpty(annualCompPoint) && !ObjectUtils.isEmpty(comp)) { |
|
|
|
|
|
|
|
//年度比赛项目 奖项设置
|
|
|
|
|
|
|
|
AnnualCompAward annualCompAward = iAnnualCompAwardService.getOne(new LambdaQueryWrapper<AnnualCompAward>() |
|
|
|
|
|
|
|
.eq(AnnualCompAward::getAnnucompid, annualCompPoint.getId())); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ObjectUtils.isEmpty(annualCompAward)) return score4Point.get(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//1、根据年度比赛项目id,查询获取管理(award_persion)列表,即参赛人员及获取奖项顺序号
|
|
|
|
|
|
|
|
List<AwardPersion> awardPersionList = iAwardPersionService.list(new LambdaQueryWrapper<AwardPersion>() |
|
|
|
|
|
|
|
.eq(AwardPersion::getAnnualCompP, annualCompPoint.getId())); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//项目分值
|
|
|
|
|
|
|
|
double compweight_val = comp.getCompweight().doubleValue(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//2、遍历获奖管理(award_persion)列表,根据奖项id查询比赛奖项设置表(annual_comp_award)
|
|
|
|
|
|
|
|
Optional.ofNullable(awardPersionList).orElse(new LinkedList<>()).forEach(en -> { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//2.1、比赛奖项设置 根据awardsort奖项顺序,获取对应的奖项权重值
|
|
|
|
|
|
|
|
//奖项顺序与奖项权重值映射关系: wardsort(1:first_weight,2:second_weight,3:third_weight,4:fourth_weight,5:fifth_weight)
|
|
|
|
|
|
|
|
//奖项权重值 百分比
|
|
|
|
|
|
|
|
String weightVal; |
|
|
|
|
|
|
|
switch (en.getAwardsort()) { |
|
|
|
|
|
|
|
case 1: |
|
|
|
|
|
|
|
weightVal = annualCompAward.getFirstWeight(); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 2: |
|
|
|
|
|
|
|
weightVal = annualCompAward.getSecondWeight(); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 3: |
|
|
|
|
|
|
|
weightVal = annualCompAward.getThirdWeight(); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 4: |
|
|
|
|
|
|
|
weightVal = annualCompAward.getFourthWeight(); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 5: |
|
|
|
|
|
|
|
weightVal = annualCompAward.getFifthWeight(); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
weightVal = "100"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//参与形式 个人、团队,键值对 N-个人 Y-团队
|
|
|
|
|
|
|
|
String entryForm = annualCompPoint.getEntryForm(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//2.2 根据报名编号查询参赛者信息
|
|
|
|
|
|
|
|
List<TeamManagement> managementList = iTeamManagementService.list(new LambdaQueryWrapper<TeamManagement>() |
|
|
|
|
|
|
|
.eq(TeamManagement::getEnrollCode, en.getEnrollCode()) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
if (ObjectUtils.isEmpty(managementList)) return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//3、计算积分 项目分值*项目奖项权重值/100
|
|
|
|
|
|
|
|
log.info("***************年度比赛项目-{},项目分值:{},奖项权重值:{}", annualCompPoint.getObjName(), compweight_val, weightVal); |
|
|
|
|
|
|
|
double baseScore = ComputeUtils.mul(compweight_val, ComputeUtils.div2(new Double(weightVal), ONE_HUNDRED)); |
|
|
|
|
|
|
|
AtomicReference<Double> score = new AtomicReference<>((double) 0); |
|
|
|
|
|
|
|
if (StringUtils.equals("Y", entryForm)) { //团队赛
|
|
|
|
|
|
|
|
Optional.ofNullable(managementList).orElse(new ArrayList<>()).forEach(e -> { |
|
|
|
|
|
|
|
// 参与形式是团队时,队长积分*0.5,职员积分*0.2
|
|
|
|
|
|
|
|
//captain 是否队长
|
|
|
|
|
|
|
|
if (StringUtils.equals("0", e.getCaptain())) { |
|
|
|
|
|
|
|
// score.set(ComputeUtils.mul(baseScore, ZERO_POINT_FIVE));
|
|
|
|
|
|
|
|
score4Point.getAndUpdate(val -> val.add(new BigDecimal(ComputeUtils.mul(baseScore, ZERO_POINT_FIVE)))); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// score.set(ComputeUtils.mul(baseScore, ZERO_POINT_TWO));
|
|
|
|
|
|
|
|
score4Point.getAndUpdate(val -> val.add(new BigDecimal(ComputeUtils.mul(baseScore, ZERO_POINT_TWO)))); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} else { //个人赛
|
|
|
|
|
|
|
|
// score.set(baseScore);
|
|
|
|
|
|
|
|
score4Point.getAndUpdate(val -> val.add(new BigDecimal(baseScore))); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return score4Point.get(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @description: 单项比赛数据展示 |
|
|
|
* @description: 单项比赛数据展示 |
|
|
|
* 使用大数据页面的形式全面展示某项比赛的各种综合数据,包括年度比赛列表、比赛项目数、参赛人数统计、多维度能力评价分析数据、近五年比赛人数对比,比赛获奖列表,参赛人员积分列表。需要提供功能截图。 |
|
|
|
* 使用大数据页面的形式全面展示某项比赛的各种综合数据,包括年度比赛列表、比赛项目数、参赛人数统计、多维度能力评价分析数据、近五年比赛人数对比,比赛获奖列表,参赛人员积分列表。需要提供功能截图。 |
|
|
@ -459,7 +549,7 @@ public class CompSystemBigScreenServiceImpl implements CompSystemBigScreenServic |
|
|
|
// compCounts.put("pointCount", pointCount);
|
|
|
|
// compCounts.put("pointCount", pointCount);
|
|
|
|
//总报名数
|
|
|
|
//总报名数
|
|
|
|
long count = Optional.ofNullable(compVoList).orElse(new LinkedList<>()).stream().mapToInt(vo -> vo.getNumber()).sum(); |
|
|
|
long count = Optional.ofNullable(compVoList).orElse(new LinkedList<>()).stream().mapToInt(vo -> vo.getNumber()).sum(); |
|
|
|
//总报名数
|
|
|
|
//总报名人数
|
|
|
|
compCounts.put("count", count); |
|
|
|
compCounts.put("count", count); |
|
|
|
Long personCount = iAnnualCompetitionProjectRegistrationService.count(new LambdaQueryWrapper<AnnualCompetitionProjectRegistration>() |
|
|
|
Long personCount = iAnnualCompetitionProjectRegistrationService.count(new LambdaQueryWrapper<AnnualCompetitionProjectRegistration>() |
|
|
|
.eq(AnnualCompetitionProjectRegistration::getEntryFormat, "0") |
|
|
|
.eq(AnnualCompetitionProjectRegistration::getEntryFormat, "0") |
|
|
@ -467,8 +557,12 @@ public class CompSystemBigScreenServiceImpl implements CompSystemBigScreenServic |
|
|
|
//学生人数
|
|
|
|
//学生人数
|
|
|
|
compCounts.put("personCompCount", personCount); |
|
|
|
compCounts.put("personCompCount", personCount); |
|
|
|
Long teamCount = count - personCount; |
|
|
|
Long teamCount = count - personCount; |
|
|
|
|
|
|
|
if (count < personCount) { |
|
|
|
|
|
|
|
compCounts.put("teamCompCount", 0);//队伍数
|
|
|
|
|
|
|
|
} else { |
|
|
|
//队伍数
|
|
|
|
//队伍数
|
|
|
|
compCounts.put("teamCompCount", teamCount); |
|
|
|
compCounts.put("teamCompCount", teamCount); |
|
|
|
|
|
|
|
} |
|
|
|
//比赛统计
|
|
|
|
//比赛统计
|
|
|
|
resultMap.put("compCounts", compCounts); |
|
|
|
resultMap.put("compCounts", compCounts); |
|
|
|
|
|
|
|
|
|
|
|