From e816621893448f93815791a484f3b0432df1b0b2 Mon Sep 17 00:00:00 2001 From: zhc077 <565291854@qq.com> Date: Fri, 12 Jul 2024 17:36:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B2=B3=E5=8D=97=E6=9C=BA=E7=94=B5=E8=81=8C?= =?UTF-8?q?=E4=B8=9A=E5=AD=A6=E9=99=A2-=E5=A4=A7=E5=B1=8F=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/PersonalCompScoreServiceImpl.java | 22 ++++++--- .../CompSystemBigScreenServiceImpl.java | 49 ++++++++++++------- 2 files changed, 48 insertions(+), 23 deletions(-) diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/service/impl/PersonalCompScoreServiceImpl.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/service/impl/PersonalCompScoreServiceImpl.java index 37a27945..6bed29f0 100644 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/service/impl/PersonalCompScoreServiceImpl.java +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/service/impl/PersonalCompScoreServiceImpl.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 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(); diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/bigScreen/service/CompSystemBigScreenServiceImpl.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/bigScreen/service/CompSystemBigScreenServiceImpl.java index feb158b2..2bec6008 100644 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/bigScreen/service/CompSystemBigScreenServiceImpl.java +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/bigScreen/service/CompSystemBigScreenServiceImpl.java @@ -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 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 years = DateUtils.getLastxYear(5); List annualList = iAnnualService.list(new LambdaQueryWrapper() .in(Annual::getAnnualName, years) - .eq(Annual::getSysOrgCode, sysDepart.getOrgCode()) +// .eq(Annual::getSysOrgCode, sysDepart.getOrgCode()) .orderByAsc(Annual::getAnnualName)); List last5YearDataVos = new LinkedList<>(); + List compList = iCompService.list(new LambdaQueryWrapper().eq(Comp::getCompOrgan, departId)); + Set 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 personCount4Comp = new AtomicReference<>(BigDecimal.ZERO); - - List annualCompList = iAnnualCompService.list(new LambdaQueryWrapper().eq(AnnualComp::getAnnualid, annual.getId())); - //比赛数 - last5YearDataVo.setCompCount(annualCompList.size()); - if (!ObjectUtils.isEmpty(annualCompList)) { - annualCompList.stream().forEach(ac -> { - AnnualCompPoint annualCompPoint = iAnnualCompPointService.getOne(new LambdaQueryWrapper().eq(AnnualCompPoint::getAnnualCompId, ac.getId())); - if (!ObjectUtils.isEmpty(annualCompPoint)) { - long personCount4CompTemp = iAnnualCompetitionProjectRegistrationService.count(new LambdaQueryWrapper(). - eq(AnnualCompetitionProjectRegistration::getAnnualCompid, annualCompPoint.getId())); - personCount4Comp.getAndUpdate(val -> val.add(new BigDecimal(personCount4CompTemp))); - } - }); + if (ObjectUtils.isEmpty(compIds)) { + List annualCompList = iAnnualCompService.list(new LambdaQueryWrapper() + .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().eq(AnnualCompPoint::getAnnualCompId, ac.getId())); + if (!ObjectUtils.isEmpty(annualCompPoint)) { + long personCount4CompTemp = iAnnualCompetitionProjectRegistrationService.count(new LambdaQueryWrapper(). + eq(AnnualCompetitionProjectRegistration::getAnnualCompid, annualCompPoint.getId())); + personCount4Comp.getAndUpdate(val -> val.add(new BigDecimal(personCount4CompTemp))); + } + }); + } } last5YearDataVo.setPersonCount(personCount4Comp.get().intValue()); last5YearDataVos.add(last5YearDataVo);