...
|
...
|
@@ -44,7 +44,9 @@ public class BuyerPenaltyRuleSelector { |
|
|
throw new UfoServiceException(501, "buyer penalty order status is null");
|
|
|
}
|
|
|
Collection<BuyerPenalty.Fee> fees = getFeesByOrderAttributesAndStatus();
|
|
|
// 没有时间限制的规则
|
|
|
Supplier<BuyerPenalty.Fee> nonTimeRangeFeeSupplier = () -> fees.stream().filter(fee -> Objects.isNull(fee.getTimeRange())).findFirst().orElse(null);
|
|
|
// 是否时间限制范围内的规则
|
|
|
Predicate<BuyerPenalty.Fee> timeRangeFeePredicate = fee -> {
|
|
|
BuyerPenalty.Range timeRange = fee.getTimeRange();
|
|
|
BigDecimal min = timeRange.getMin();
|
...
|
...
|
@@ -54,6 +56,7 @@ public class BuyerPenaltyRuleSelector { |
|
|
boolean ltMax = Objects.isNull(max) || diffTime <= max.intValue();
|
|
|
return gtMin && ltMax;
|
|
|
};
|
|
|
// 选取合适的匹配规则
|
|
|
BuyerPenalty.Fee fixFee = fees.stream()
|
|
|
.filter(e -> Objects.nonNull(e.getTimeRange()))
|
|
|
// sort by index
|
...
|
...
|
|