|
|
@@ -215,10 +215,17 @@ public class DailyStatServiceImpl extends MyBaseServiceImpl<DailyStatMapper, Dai
|
|
|
var totalConsumption = list.stream().filter(s -> s.getConsumption() != null).mapToInt(DailyStat::getConsumption).sum();
|
|
|
var ordersCount = list.stream().filter(s -> s.getOrdersCount() != null).mapToInt(DailyStat::getOrdersCount).sum();
|
|
|
var registrations = list.stream().filter(s -> s.getRegistrations() != null).mapToInt(DailyStat::getRegistrations).sum();
|
|
|
- var activeUserCount = list.stream().filter(s -> s.getActiveUserCount() != null).mapToInt(DailyStat::getActiveUserCount).sum();
|
|
|
var rechargeCount = list.stream().filter(s -> s.getRechargeCount() != null).mapToInt(DailyStat::getRechargeCount).sum();
|
|
|
var refundCount = list.stream().filter(s -> s.getRefundCount() != null).mapToInt(DailyStat::getRefundCount).sum();
|
|
|
|
|
|
+ // 活跃用户:跨天需要去重,不能简单 SUM 日统计值,改为从订单源表 GROUP BY station_id, user_id 后计数
|
|
|
+ var activeStartDate = params.getStartDate() != null ? params.getStartDate() : LocalDate.of(2020, 1, 1);
|
|
|
+ var activeEndDate = params.getEndDate() != null ? params.getEndDate() : LocalDate.now();
|
|
|
+ var activeUserMap = washOrderService.countDistinctActiveUsers(activeStartDate, activeEndDate);
|
|
|
+ var activeUserCount = CommUtil.isNotEmptyAndNull(params.getStationId())
|
|
|
+ ? activeUserMap.getOrDefault(params.getStationId(), 0)
|
|
|
+ : activeUserMap.values().stream().mapToInt(Integer::intValue).sum();
|
|
|
+
|
|
|
return new DailyStatSummaryVo()
|
|
|
.setTotalIncome(totalIncome)
|
|
|
.setTotalConsumption(totalConsumption)
|