|
|
@ -84,65 +84,7 @@ public class WorkbenchServiceImpl implements WorkbenchService { |
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
return new WorkbenchCard(token, marketCards,new ArrayList<>(), markets, date, date); |
|
|
|
/* List<WorkbenchMarketCard> marketCards = new ArrayList<>(); |
|
|
|
// 遍历每个 marketCard 并填充数据 |
|
|
|
for (String market : markets) { |
|
|
|
if (market == null || market.trim().isEmpty()) continue; |
|
|
|
|
|
|
|
// 查询该地区当天的数据 |
|
|
|
Statistics statistics = statisticsMapper.selectByMarketAndDate( |
|
|
|
market, |
|
|
|
Date.from(startOfDay.atZone(ZoneId.systemDefault()).toInstant()), |
|
|
|
Date.from(endOfDay.atZone(ZoneId.systemDefault()).toInstant()) |
|
|
|
); |
|
|
|
WorkbenchMarketCard card = new WorkbenchMarketCard(); |
|
|
|
card.setMarket(market); |
|
|
|
if (statistics != null){ |
|
|
|
|
|
|
|
// 卡片一:当前金币相关 |
|
|
|
card.setCurrentPermanent(statistics.getCurrentPermanent());//余量-永久金币 |
|
|
|
card.setCurrentFreeJune(statistics.getCurrentFreeJune()); //余量-免费六月金币 |
|
|
|
card.setCurrentFreeDecember(statistics.getCurrentFreeDecember()); //余量-免费十二月金币 |
|
|
|
card.setCurrentTask(statistics.getCurrentTask()); //余量-任务金币 |
|
|
|
card.setCurrentFree(card.getCurrentFreeJune() + card.getCurrentFreeDecember()); //余量-免费金币 |
|
|
|
card.setCurrentGold(card.getCurrentPermanent() + card.getCurrentFree() + card.getCurrentTask()); //余量-总金币 |
|
|
|
card.setDailyChange(statistics.getDailyChange()); //较前一日变化 |
|
|
|
// 卡片二:充值相关 |
|
|
|
card.setRecharge(statistics.getRecharge()); //充值-当日充值 |
|
|
|
card.setMoney(statistics.getMoney()); //充值-当日金额(永久) |
|
|
|
card.setYearlyRecharge(calculateSum(market, "recharge",yearlyStartDate ,date));//充值-全年累计充值 |
|
|
|
card.setYearlyMoney(calculateSum(market, "money",yearlyStartDate ,date)); //充值-全年累计金额(永久) |
|
|
|
// 卡片三:消费与退款 |
|
|
|
card.setConsumePermanent(statistics.getConsumePermanent());//消费-永久金币 |
|
|
|
card.setConsumeFreeJune(statistics.getConsumeFreeJune());//消费-免费六月金币 |
|
|
|
card.setConsumeFreeDecember(statistics.getConsumeFreeDecember());//消费-免费十二月金币 |
|
|
|
card.setConsumeTask(statistics.getConsumeTask());//消费-任务金币 |
|
|
|
card.setRefundPermanent(statistics.getRefundPermanent());//退款-永久金币 |
|
|
|
card.setRefundFreeJune(statistics.getRefundFreeJune());//退款-免费六月金币 |
|
|
|
card.setRefundFreeDecember(statistics.getRefundFreeDecember());//退款-免费十二月金币 |
|
|
|
card.setRefundTask(statistics.getRefundTask());//退款-任务金币 |
|
|
|
//当日总消费 |
|
|
|
int totalConsume = card.getConsumePermanent() + card.getConsumeFreeJune() + card.getConsumeFreeDecember() + card.getConsumeTask(); |
|
|
|
//当日总退款 |
|
|
|
int totalRefund = card.getRefundPermanent() + card.getRefundFreeJune() + card.getRefundFreeDecember() + card.getRefundTask(); |
|
|
|
card.setDailyReduce(totalConsume - totalRefund);//当日总消耗 |
|
|
|
card.setYearlyConsume(calculateSum(market, "consume", yearlyStartDate,date));//年累计消费 |
|
|
|
card.setYearlyRefund(calculateSum(market, "refund",yearlyStartDate ,date));//年累计退款 |
|
|
|
card.setYearlyReduce(card.getYearlyConsume() - card.getYearlyRefund());//年累计消耗 |
|
|
|
// 卡片四:人头数相关 |
|
|
|
card.setRechargeNum(statistics.getRechargeNum()); |
|
|
|
card.setFirstRecharge(statistics.getFirstRecharge()); |
|
|
|
card.setYearlyRechargeNum(calculateSum(market,"rechargeNum",yearlyStartDate,date)); |
|
|
|
|
|
|
|
// 周环比、日同比 |
|
|
|
card.setWow(calculateWeekOverWeek(market, date)); |
|
|
|
card.setDaily(calculateDayOverDay(market, date)); |
|
|
|
|
|
|
|
marketCards.add(card); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
return new WorkbenchCard(token, marketCards,markets,date,date);*/ |
|
|
|
} |
|
|
|
/* |
|
|
|
获取卡片数据 |
|
|
|