|
@ -39,7 +39,7 @@ public class WorkbenchServiceImpl implements WorkbenchService { |
|
|
@Autowired |
|
|
@Autowired |
|
|
private StatisticsMapper statisticsMapper; |
|
|
private StatisticsMapper statisticsMapper; |
|
|
@Override |
|
|
@Override |
|
|
public WorkbenchCard getCard(String token) { |
|
|
|
|
|
|
|
|
public WorkbenchCard getCard( ) { |
|
|
Date date=new Date();//当天 |
|
|
Date date=new Date();//当天 |
|
|
Date yday=generalService.getYesterday(); |
|
|
Date yday=generalService.getYesterday(); |
|
|
// 获取开始时间和结束时间(当天) |
|
|
// 获取开始时间和结束时间(当天) |
|
@ -83,7 +83,7 @@ public class WorkbenchServiceImpl implements WorkbenchService { |
|
|
// 收集并行流结果为列表 |
|
|
// 收集并行流结果为列表 |
|
|
.collect(Collectors.toList()); |
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
return new WorkbenchCard(token, marketCards,new ArrayList<>(), markets, date, date); |
|
|
|
|
|
|
|
|
return new WorkbenchCard( marketCards,new ArrayList<>(), markets, date, date); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
/* |
|
|
/* |
|
@ -97,7 +97,6 @@ public class WorkbenchServiceImpl implements WorkbenchService { |
|
|
if (currentStatistics != null&& ydayStatistics != null) { |
|
|
if (currentStatistics != null&& ydayStatistics != null) { |
|
|
// 一次性获取全年统计数据(从年初到今天) |
|
|
// 一次性获取全年统计数据(从年初到今天) |
|
|
Map<String, Integer> yearlyStats = calculateAllSum(market, yearlyStartDate, date); |
|
|
Map<String, Integer> yearlyStats = calculateAllSum(market, yearlyStartDate, date); |
|
|
|
|
|
|
|
|
// 卡片一:当前金币相关 |
|
|
// 卡片一:当前金币相关 |
|
|
card.setCurrentPermanent(currentStatistics.getCurrentPermanent());//余量-永久金币 |
|
|
card.setCurrentPermanent(currentStatistics.getCurrentPermanent());//余量-永久金币 |
|
|
card.setCurrentFreeJune(currentStatistics.getCurrentFreeJune()); //余量-免费六月金币 |
|
|
card.setCurrentFreeJune(currentStatistics.getCurrentFreeJune()); //余量-免费六月金币 |
|
@ -127,25 +126,24 @@ public class WorkbenchServiceImpl implements WorkbenchService { |
|
|
card.setDailyReduce(totalConsume - totalRefund);//昨日总消耗 |
|
|
card.setDailyReduce(totalConsume - totalRefund);//昨日总消耗 |
|
|
card.setYearlyConsume(yearlyStats.getOrDefault("consume", 0)); // 年累计消费 |
|
|
card.setYearlyConsume(yearlyStats.getOrDefault("consume", 0)); // 年累计消费 |
|
|
card.setYearlyRefund(yearlyStats.getOrDefault("refund", 0)); // 年累计退款 |
|
|
card.setYearlyRefund(yearlyStats.getOrDefault("refund", 0)); // 年累计退款 |
|
|
|
|
|
|
|
|
card.setYearlyReduce(card.getYearlyConsume() - card.getYearlyRefund());//年累计消耗 |
|
|
card.setYearlyReduce(card.getYearlyConsume() - card.getYearlyRefund());//年累计消耗 |
|
|
// 卡片四:人头数相关 |
|
|
// 卡片四:人头数相关 |
|
|
card.setRechargeNum(currentStatistics.getRechargeNum()); |
|
|
card.setRechargeNum(currentStatistics.getRechargeNum()); |
|
|
card.setFirstRecharge(currentStatistics.getFirstRecharge()); |
|
|
card.setFirstRecharge(currentStatistics.getFirstRecharge()); |
|
|
card.setYearlyRechargeNum(yearlyStats.getOrDefault("rechargeNum", 0)); |
|
|
card.setYearlyRechargeNum(yearlyStats.getOrDefault("rechargeNum", 0)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 周环比、日同比 |
|
|
// 周环比、日同比 |
|
|
card.setWow(calculateWeekOverWeek(market, currentDate)); |
|
|
card.setWow(calculateWeekOverWeek(market, currentDate)); |
|
|
card.setSumWow(calculateAllWeekOverWeek(date)); |
|
|
card.setSumWow(calculateAllWeekOverWeek(date)); |
|
|
card.setDaily(calculateDayOverDay(market, currentDate)); |
|
|
card.setDaily(calculateDayOverDay(market, currentDate)); |
|
|
card.setSumDaily(calculateAllDayOverDay(date)); |
|
|
card.setSumDaily(calculateAllDayOverDay(date)); |
|
|
|
|
|
//更新时间 |
|
|
|
|
|
card.setUpdateTime(currentStatistics.getUpdateTime()); |
|
|
} |
|
|
} |
|
|
return card; |
|
|
return card; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public WorkbenchCard getGraph(String token, Date startDate, Date endDate, List<String> markets) { |
|
|
|
|
|
|
|
|
public WorkbenchCard getGraph( Date startDate, Date endDate, List<String> markets) { |
|
|
List<WorkbenchMarketGraph> marketGraphs = new ArrayList<>(); |
|
|
List<WorkbenchMarketGraph> marketGraphs = new ArrayList<>(); |
|
|
|
|
|
|
|
|
for (String market : markets) { |
|
|
for (String market : markets) { |
|
@ -161,7 +159,7 @@ public class WorkbenchServiceImpl implements WorkbenchService { |
|
|
graphs.setSumConsume(sums.get("consume")); |
|
|
graphs.setSumConsume(sums.get("consume")); |
|
|
marketGraphs.add(graphs); |
|
|
marketGraphs.add(graphs); |
|
|
} |
|
|
} |
|
|
return new WorkbenchCard(token, new ArrayList<>(),marketGraphs,markets,startDate,endDate); |
|
|
|
|
|
|
|
|
return new WorkbenchCard(new ArrayList<>(),marketGraphs,markets,startDate,endDate); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/* |
|
|
/* |
|
|