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

main
zhc077 4 months ago
parent 628407e672
commit e816621893
  1. 22
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/service/impl/PersonalCompScoreServiceImpl.java
  2. 49
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/bigScreen/service/CompSystemBigScreenServiceImpl.java

@ -21,6 +21,10 @@ import org.jeecg.modules.demo.awardpersion.entity.AwardPersion;
import org.jeecg.modules.demo.awardpersion.service.IAwardPersionService;
import org.jeecg.modules.demo.comp.entity.Comp;
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.demo.projectlevel.entity.Projectlevel;
import org.jeecg.modules.demo.projectlevel.service.IProjectlevelService;
import org.jeecg.modules.system.entity.SysDepart;
import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.system.service.ISysDepartService;
@ -58,7 +62,7 @@ public class PersonalCompScoreServiceImpl extends ServiceImpl<PersonalCompScoreM
private ITeamManagementService iTeamManagementService;
@Autowired
private ISysDepartService iSysDepartService;
private IProjectlevelService iProjectlevelService;
@Autowired
private ISysUserService iSysUserService;
@ -144,18 +148,24 @@ public class PersonalCompScoreServiceImpl extends ServiceImpl<PersonalCompScoreM
);
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));
//modify 7.12 新需求
//3、计算积分 项目分值*项目级别权得百分比*获奖奖项权重百分比
// log.info("***************年度比赛项目-{},项目分值:{},奖项权重值:{}", annualCompPoint.getObjName(), compweight_val, weightVal);
Projectlevel projectlevel = iProjectlevelService.getById(annualCompPoint.getObjLevel());
double scale_ratio = ComputeUtils.div2(new Double(projectlevel.getScale()), ONE_HUNDRED);
double baseScore = ComputeUtils.mul2(ComputeUtils.mul2(compweight_val, ComputeUtils.div2(new Double(weightVal), ONE_HUNDRED)),scale_ratio);
log.info("***************年度比赛项目-{},项目分值:{}", annualCompPoint.getObjName(), compweight_val);
log.info("***************年度比赛项目-级别权重比值:{}", scale_ratio);
log.info("***************获奖奖项权重百分比:{}", weightVal);
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));
score.set(ComputeUtils.mul2(baseScore, ZERO_POINT_FIVE));
} else {
score.set(ComputeUtils.mul(baseScore, ZERO_POINT_TWO));
score.set(ComputeUtils.mul2(baseScore, ZERO_POINT_TWO));
}
PersonalCompScore bean = new PersonalCompScore();

@ -35,6 +35,8 @@ import org.jeecg.modules.demo.comp.entity.Comp;
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.demo.projectlevel.entity.Projectlevel;
import org.jeecg.modules.demo.projectlevel.service.IProjectlevelService;
import org.jeecg.modules.system.entity.SysDepart;
import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.system.service.ISysDepartService;
@ -109,6 +111,9 @@ public class CompSystemBigScreenServiceImpl implements CompSystemBigScreenServic
@Autowired
private IAnnualService iAnnualService;
@Autowired
private IProjectlevelService iProjectlevelService;
//二级部门id
private final String BASE_PARENT_ID = "1693446350597038081";
@ -325,9 +330,14 @@ public class CompSystemBigScreenServiceImpl implements CompSystemBigScreenServic
);
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));
//3、计算积分 项目分值*项目级别权得百分比*获奖奖项权重百分比
// log.info("***************年度比赛项目-{},项目分值:{},奖项权重值:{}", annualCompPoint.getObjName(), compweight_val, weightVal);
Projectlevel projectlevel = iProjectlevelService.getById(annualCompPoint.getObjLevel());
double scale_ratio = ComputeUtils.div2(new Double(projectlevel.getScale()), ONE_HUNDRED);
double baseScore = ComputeUtils.mul2(ComputeUtils.mul2(compweight_val, ComputeUtils.div2(new Double(weightVal), ONE_HUNDRED)), scale_ratio);
log.info("***************年度比赛项目-{},项目分值:{}", annualCompPoint.getObjName(), compweight_val);
log.info("***************年度比赛项目-级别权重比值:{}", scale_ratio);
log.info("***************获奖奖项权重比值:{}", weightVal);
AtomicReference<Double> score = new AtomicReference<>((double) 0);
if (StringUtils.equals("Y", entryForm)) { //团队赛
Optional.ofNullable(managementList).orElse(new ArrayList<>()).forEach(e -> {
@ -594,26 +604,31 @@ public class CompSystemBigScreenServiceImpl implements CompSystemBigScreenServic
List<Integer> years = DateUtils.getLastxYear(5);
List<Annual> annualList = iAnnualService.list(new LambdaQueryWrapper<Annual>()
.in(Annual::getAnnualName, years)
.eq(Annual::getSysOrgCode, sysDepart.getOrgCode())
// .eq(Annual::getSysOrgCode, sysDepart.getOrgCode())
.orderByAsc(Annual::getAnnualName));
List<Last5YearDataVo> last5YearDataVos = new LinkedList<>();
List<Comp> compList = iCompService.list(new LambdaQueryWrapper<Comp>().eq(Comp::getCompOrgan, departId));
Set<String> compIds = Optional.ofNullable(compList).orElse(new ArrayList<>()).stream().map(bo -> bo.getId()).collect(Collectors.toSet());
Optional.ofNullable(annualList).orElse(new LinkedList<>()).stream().forEach(annual -> {
Last5YearDataVo last5YearDataVo = new Last5YearDataVo();
last5YearDataVo.setYear(annual.getAnnualName());
AtomicReference<BigDecimal> personCount4Comp = new AtomicReference<>(BigDecimal.ZERO);
List<AnnualComp> annualCompList = iAnnualCompService.list(new LambdaQueryWrapper<AnnualComp>().eq(AnnualComp::getAnnualid, annual.getId()));
//比赛数
last5YearDataVo.setCompCount(annualCompList.size());
if (!ObjectUtils.isEmpty(annualCompList)) {
annualCompList.stream().forEach(ac -> {
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)));
}
});
if (ObjectUtils.isEmpty(compIds)) {
List<AnnualComp> annualCompList = iAnnualCompService.list(new LambdaQueryWrapper<AnnualComp>()
.eq(AnnualComp::getAnnualid, annual.getId())
.in(AnnualComp::getCompid, compIds));
//年度比赛数量
last5YearDataVo.setCompCount(annualCompList.size());
if (!ObjectUtils.isEmpty(annualCompList)) {
annualCompList.stream().forEach(ac -> {
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);

Loading…
Cancel
Save