Commit 85eb9bf3dc0fe5d05ae6559c3f3fcac783e27129
Merge branch 'main-bug' into 'main'
feature(bug): 排名名次修改 排名名次修改 See merge request !73
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 | 478 | * @return |
479 | 479 | */ |
480 | 480 | public void calcRank(List<KpiIndicatorRankStaffVO> staffs) { |
481 | - | |
482 | 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 | 489 | for (KpiIndicatorRankStaffVO staff : staffs) { |
485 | 490 | if (! staff.getInclusion()) { |
486 | 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 | 495 | continue; |
492 | 496 | } |
493 | 497 | if (lastIndicatorValue.compareTo(staff.getOriginValue()) != 0) { | ... | ... |