diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/scheduler/DailyTask.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/scheduler/DailyTask.java index e749e19f..d9ef38fb 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/scheduler/DailyTask.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/scheduler/DailyTask.java @@ -338,12 +338,12 @@ public class DailyTask { // 分离购买记录和扣除记录 List purchasingRecords = allRecords.stream() - .filter(record -> "PURCHASING_GOLD_PROPS".equals(record.getOrigin())) + .filter(DailyTask::validType) .collect(Collectors.toList()); // 检查非PURCHASING_GOLD_PROPS类型的扣除天数记录 List deductionRecords = allRecords.stream() - .filter(record -> !"PURCHASING_GOLD_PROPS".equals(record.getOrigin()) && record.getDays() != null && record.getDays() < 0) + .filter(record -> !validType(record) && record.getDays() != null && record.getDays() < 0) .collect(Collectors.toList()); if (CollectionUtils.isEmpty(purchasingRecords)) { @@ -373,6 +373,10 @@ public class DailyTask { } } + private static boolean validType(RunningWaterUserProps record) { + return Arrays.asList("COUPON_EXCHANGE", "PURCHASING_GOLD_PROPS").contains(record.getOrigin()); + } + /** * 计算用户的有效期截止时间 * 根据购买记录和扣除记录,结合时间顺序累计计算有效期