Commit 916a0611b705bb774babff3f1db0dde757be1165
Merge branch 'main' into test
Showing
1 changed file
with
9 additions
and
5 deletions
fw-morax-service/src/main/java/cn/fw/morax/service/biz/kpi/KpiGroupIndicatorBizService.java
@@ -478,16 +478,20 @@ public class KpiGroupIndicatorBizService { | @@ -478,16 +478,20 @@ public class KpiGroupIndicatorBizService { | ||
478 | * @return | 478 | * @return |
479 | */ | 479 | */ |
480 | public void calcRank(List<KpiIndicatorRankStaffVO> staffs) { | 480 | public void calcRank(List<KpiIndicatorRankStaffVO> staffs) { |
481 | - | ||
482 | int rank = 1; | 481 | int rank = 1; |
483 | - BigDecimal lastIndicatorValue = null; | 482 | + Optional<BigDecimal> lastIndicatorValueOp = staffs.stream() |
483 | + .filter(staff -> Boolean.TRUE.equals(staff.getInclusion())) | ||
484 | + .findFirst().map(KpiIndicatorRankStaffVO::getOriginValue); | ||
485 | + if (Boolean.FALSE.equals(lastIndicatorValueOp.isPresent())) { | ||
486 | + return; | ||
487 | + } | ||
488 | + BigDecimal lastIndicatorValue = lastIndicatorValueOp.get(); | ||
484 | for (KpiIndicatorRankStaffVO staff : staffs) { | 489 | for (KpiIndicatorRankStaffVO staff : staffs) { |
485 | if (! staff.getInclusion()) { | 490 | if (! staff.getInclusion()) { |
486 | continue; | 491 | continue; |
487 | } | 492 | } |
488 | - if (PublicUtil.isEmpty(lastIndicatorValue) || PublicUtil.isEmpty(staff.getOriginValue()) ) { | ||
489 | - staff.setIndicatorRank(rank); | ||
490 | - lastIndicatorValue = staff.getOriginValue(); | 493 | + //原始值为空,无排名 |
494 | + if (PublicUtil.isEmpty(staff.getOriginValue())) { | ||
491 | continue; | 495 | continue; |
492 | } | 496 | } |
493 | if (lastIndicatorValue.compareTo(staff.getOriginValue()) != 0) { | 497 | if (lastIndicatorValue.compareTo(staff.getOriginValue()) != 0) { |