| | |
| | | Long totalCount = serviceSubtaskDetailTargets.stream().filter(target -> target.getMatchedtext() == null || target.getMatchedtext().isEmpty()).mapToLong(target -> target.getCount() != null ? target.getCount() : 0) // 确保 count 为 0 如果为 null |
| | | .sum(); |
| | | |
| | | |
| | | Long allShowCount = 0L; |
| | | |
| | | // 遍历列表,将 matchedText 为""赋值给 null |
| | |
| | | target.setTargetShowCount(allShowCount.toString()); |
| | | BigDecimal count = new BigDecimal(target.getCount() != null ? target.getCount().toString() : "0"); |
| | | BigDecimal allCount = new BigDecimal(allShowCount.toString()); |
| | | target.setPercentage(count.divide(allCount, 2, RoundingMode.HALF_UP).toString()); |
| | | if (allCount.compareTo(BigDecimal.ZERO) == 0) |
| | | target.setPercentage(count.divide(allCount, 2, RoundingMode.HALF_UP).toString()); |
| | | } |
| | | } |
| | | |