|
|
@ -92,8 +92,9 @@ public class WorkbenchServiceImpl implements WorkbenchService { |
|
|
|
.collect(Collectors.toList()); |
|
|
|
Integer sumWow= calculateAllWeekOverWeek(date); |
|
|
|
Integer sumDaily=calculateAllDayOverDay(date); |
|
|
|
Date updateTime = findLatestUpdateTime(currentStatsList); |
|
|
|
|
|
|
|
return new WorkbenchCard(marketCards, new ArrayList<>(), markets, new Date(), new Date(),sumWow,sumDaily); |
|
|
|
return new WorkbenchCard(marketCards, new ArrayList<>(), markets, new Date(), new Date(),sumWow,sumDaily,updateTime); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
@ -163,14 +164,15 @@ public class WorkbenchServiceImpl implements WorkbenchService { |
|
|
|
card.setYearlyReduce(card.getYearlyConsume() - card.getYearlyRefund());//年累计消耗 |
|
|
|
// 卡片四:人头数相关 |
|
|
|
card.setRechargeNum(currentStatistics.getRechargeNum()); |
|
|
|
card.setYdayRechargeNum(ydayStatistics.getRechargeNum()); |
|
|
|
card.setFirstRecharge(currentStatistics.getFirstRecharge()); |
|
|
|
card.setYearlyRechargeNum(currentStatistics.getYearlyRechargeNum()); |
|
|
|
// 周环比、日同比 |
|
|
|
card.setWow(calculateWeekOverWeek(market, currentDate)); |
|
|
|
card.setDaily(calculateDayOverDay(market, currentDate)); |
|
|
|
|
|
|
|
/* //更新时间 |
|
|
|
card.setUpdateTime(currentStatistics.getUpdateTime());*/ |
|
|
|
//更新时间 |
|
|
|
card.setUpdateTime(currentStatistics.getUpdateTime()); |
|
|
|
} |
|
|
|
return card; |
|
|
|
} |
|
|
@ -178,7 +180,7 @@ public class WorkbenchServiceImpl implements WorkbenchService { |
|
|
|
@Override |
|
|
|
public WorkbenchCard getGraph( Date startDate, Date endDate, List<String> markets) { |
|
|
|
if (markets == null || markets.isEmpty()) { |
|
|
|
return new WorkbenchCard(new ArrayList<>(), new ArrayList<>(), markets, startDate, endDate,0,0); |
|
|
|
return new WorkbenchCard(new ArrayList<>(), new ArrayList<>(), markets, startDate, endDate,0,0,new Date()); |
|
|
|
} |
|
|
|
|
|
|
|
// 单次批量查询 |
|
|
@ -216,7 +218,7 @@ public class WorkbenchServiceImpl implements WorkbenchService { |
|
|
|
marketGraphs.add(graph); |
|
|
|
} |
|
|
|
|
|
|
|
return new WorkbenchCard(new ArrayList<>(), marketGraphs, markets, startDate, endDate,0,0); |
|
|
|
return new WorkbenchCard(new ArrayList<>(), marketGraphs, markets, startDate, endDate,0,0,new Date()); |
|
|
|
} |
|
|
|
|
|
|
|
/* |
|
|
@ -365,6 +367,16 @@ public class WorkbenchServiceImpl implements WorkbenchService { |
|
|
|
.atStartOfDay(ZoneId.systemDefault()) |
|
|
|
.toInstant()); |
|
|
|
} |
|
|
|
//获取最近的更新时间 |
|
|
|
private Date findLatestUpdateTime(List<Statistics> statsList) { |
|
|
|
// 使用流式处理来找到最新的 updateTime |
|
|
|
Optional<Date> latestUpdateTime = statsList.stream() |
|
|
|
.map(Statistics::getUpdateTime) |
|
|
|
.filter(Objects::nonNull) |
|
|
|
.max(Date::compareTo); |
|
|
|
|
|
|
|
return latestUpdateTime.orElse(new Date(0)); // 如果没有找到,则返回一个较早的时间点 |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |