喻忠伟 4 months ago
commit d7b2e4676f
  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.awardpersion.service.IAwardPersionService;
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.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.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;
@ -58,7 +62,7 @@ public class PersonalCompScoreServiceImpl extends ServiceImpl<PersonalCompScoreM
private ITeamManagementService iTeamManagementService; private ITeamManagementService iTeamManagementService;
@Autowired @Autowired
private ISysDepartService iSysDepartService; private IProjectlevelService iProjectlevelService;
@Autowired @Autowired
private ISysUserService iSysUserService; private ISysUserService iSysUserService;
@ -144,18 +148,24 @@ public class PersonalCompScoreServiceImpl extends ServiceImpl<PersonalCompScoreM
); );
if (ObjectUtils.isEmpty(managementList)) return; if (ObjectUtils.isEmpty(managementList)) return;
//3、计算积分 项目分值*项目奖项权重值/100 //modify 7.12 新需求
log.info("***************年度比赛项目-{},项目分值:{},奖项权重值:{}", annualCompPoint.getObjName(), compweight_val, weightVal); //3、计算积分 项目分值*项目级别权得百分比*获奖奖项权重百分比
double baseScore = ComputeUtils.mul(compweight_val, ComputeUtils.div2(new Double(weightVal), ONE_HUNDRED)); // 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); AtomicReference<Double> score = new AtomicReference<>((double) 0);
if (StringUtils.equals("Y", entryForm)) { //团队赛 if (StringUtils.equals("Y", entryForm)) { //团队赛
Optional.ofNullable(managementList).orElse(new ArrayList<>()).forEach(e -> { Optional.ofNullable(managementList).orElse(new ArrayList<>()).forEach(e -> {
// 参与形式是团队时,队长积分*0.5,职员积分*0.2 // 参与形式是团队时,队长积分*0.5,职员积分*0.2
//captain 是否队长 //captain 是否队长
if (StringUtils.equals("0", e.getCaptain())) { if (StringUtils.equals("0", e.getCaptain())) {
score.set(ComputeUtils.mul(baseScore, ZERO_POINT_FIVE)); score.set(ComputeUtils.mul2(baseScore, ZERO_POINT_FIVE));
} else { } else {
score.set(ComputeUtils.mul(baseScore, ZERO_POINT_TWO)); score.set(ComputeUtils.mul2(baseScore, ZERO_POINT_TWO));
} }
PersonalCompScore bean = new PersonalCompScore(); 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.comp.service.ICompService;
import org.jeecg.modules.demo.comptype.entity.CompType; import org.jeecg.modules.demo.comptype.entity.CompType;
import org.jeecg.modules.demo.comptype.service.ICompTypeService; 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.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;
@ -109,6 +111,9 @@ public class CompSystemBigScreenServiceImpl implements CompSystemBigScreenServic
@Autowired @Autowired
private IAnnualService iAnnualService; private IAnnualService iAnnualService;
@Autowired
private IProjectlevelService iProjectlevelService;
//二级部门id //二级部门id
private final String BASE_PARENT_ID = "1693446350597038081"; private final String BASE_PARENT_ID = "1693446350597038081";
@ -325,9 +330,14 @@ public class CompSystemBigScreenServiceImpl implements CompSystemBigScreenServic
); );
if (ObjectUtils.isEmpty(managementList)) return; if (ObjectUtils.isEmpty(managementList)) return;
//3、计算积分 项目分值*项目奖项权重值/100 //3、计算积分 项目分值*项目级别权得百分比*获奖奖项权重百分比
log.info("***************年度比赛项目-{},项目分值:{},奖项权重值:{}", annualCompPoint.getObjName(), compweight_val, weightVal); // log.info("***************年度比赛项目-{},项目分值:{},奖项权重值:{}", annualCompPoint.getObjName(), compweight_val, weightVal);
double baseScore = ComputeUtils.mul(compweight_val, ComputeUtils.div2(new Double(weightVal), ONE_HUNDRED)); 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); AtomicReference<Double> score = new AtomicReference<>((double) 0);
if (StringUtils.equals("Y", entryForm)) { //团队赛 if (StringUtils.equals("Y", entryForm)) { //团队赛
Optional.ofNullable(managementList).orElse(new ArrayList<>()).forEach(e -> { Optional.ofNullable(managementList).orElse(new ArrayList<>()).forEach(e -> {
@ -594,26 +604,31 @@ public class CompSystemBigScreenServiceImpl implements CompSystemBigScreenServic
List<Integer> years = DateUtils.getLastxYear(5); List<Integer> years = DateUtils.getLastxYear(5);
List<Annual> annualList = iAnnualService.list(new LambdaQueryWrapper<Annual>() List<Annual> annualList = iAnnualService.list(new LambdaQueryWrapper<Annual>()
.in(Annual::getAnnualName, years) .in(Annual::getAnnualName, years)
.eq(Annual::getSysOrgCode, sysDepart.getOrgCode()) // .eq(Annual::getSysOrgCode, sysDepart.getOrgCode())
.orderByAsc(Annual::getAnnualName)); .orderByAsc(Annual::getAnnualName));
List<Last5YearDataVo> last5YearDataVos = new LinkedList<>(); 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 -> { Optional.ofNullable(annualList).orElse(new LinkedList<>()).stream().forEach(annual -> {
Last5YearDataVo last5YearDataVo = new Last5YearDataVo(); Last5YearDataVo last5YearDataVo = new Last5YearDataVo();
last5YearDataVo.setYear(annual.getAnnualName()); last5YearDataVo.setYear(annual.getAnnualName());
AtomicReference<BigDecimal> personCount4Comp = new AtomicReference<>(BigDecimal.ZERO); AtomicReference<BigDecimal> personCount4Comp = new AtomicReference<>(BigDecimal.ZERO);
if (ObjectUtils.isEmpty(compIds)) {
List<AnnualComp> annualCompList = iAnnualCompService.list(new LambdaQueryWrapper<AnnualComp>().eq(AnnualComp::getAnnualid, annual.getId())); List<AnnualComp> annualCompList = iAnnualCompService.list(new LambdaQueryWrapper<AnnualComp>()
//比赛数 .eq(AnnualComp::getAnnualid, annual.getId())
last5YearDataVo.setCompCount(annualCompList.size()); .in(AnnualComp::getCompid, compIds));
if (!ObjectUtils.isEmpty(annualCompList)) { //年度比赛数量
annualCompList.stream().forEach(ac -> { last5YearDataVo.setCompCount(annualCompList.size());
AnnualCompPoint annualCompPoint = iAnnualCompPointService.getOne(new LambdaQueryWrapper<AnnualCompPoint>().eq(AnnualCompPoint::getAnnualCompId, ac.getId())); if (!ObjectUtils.isEmpty(annualCompList)) {
if (!ObjectUtils.isEmpty(annualCompPoint)) { annualCompList.stream().forEach(ac -> {
long personCount4CompTemp = iAnnualCompetitionProjectRegistrationService.count(new LambdaQueryWrapper<AnnualCompetitionProjectRegistration>(). AnnualCompPoint annualCompPoint = iAnnualCompPointService.getOne(new LambdaQueryWrapper<AnnualCompPoint>().eq(AnnualCompPoint::getAnnualCompId, ac.getId()));
eq(AnnualCompetitionProjectRegistration::getAnnualCompid, annualCompPoint.getId())); if (!ObjectUtils.isEmpty(annualCompPoint)) {
personCount4Comp.getAndUpdate(val -> val.add(new BigDecimal(personCount4CompTemp))); 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()); last5YearDataVo.setPersonCount(personCount4Comp.get().intValue());
last5YearDataVos.add(last5YearDataVo); last5YearDataVos.add(last5YearDataVo);

Loading…
Cancel
Save