|
@@ -1,85 +0,0 @@
|
|
|
-package com.fs.statis.cache.impl;
|
|
|
-
|
|
|
-import com.fs.statis.cache.IStatisticsCacheService;
|
|
|
-import com.fs.statis.dto.*;
|
|
|
-import com.fs.statis.service.IStatisticsService;
|
|
|
-import com.github.benmanes.caffeine.cache.Cache;
|
|
|
-import com.github.benmanes.caffeine.cache.Caffeine;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-
|
|
|
-import java.util.Collections;
|
|
|
-import java.util.List;
|
|
|
-import java.util.concurrent.TimeUnit;
|
|
|
-
|
|
|
-@Service
|
|
|
-public class StatisticsCacheServiceImpl implements IStatisticsCacheService {
|
|
|
- @Autowired
|
|
|
- private IStatisticsService statisticsService;
|
|
|
-
|
|
|
- private static final Cache<Integer, DealerAggregatedDTO> DEALER_AGGREGATED_DTO_CACHE = Caffeine.newBuilder()
|
|
|
- .maximumSize(1000)
|
|
|
- .expireAfterWrite(10, TimeUnit.MINUTES)
|
|
|
- .build();
|
|
|
-
|
|
|
- private static final Cache<Integer, ConsumptionBalanceDataDTO> RECHARGE_CONSUMPTION = Caffeine.newBuilder()
|
|
|
- .maximumSize(1000)
|
|
|
- .expireAfterWrite(10, TimeUnit.MINUTES)
|
|
|
- .build();
|
|
|
-
|
|
|
- private static final Cache<Integer, AnalysisPreviewDTO> ANALYSIS_PREVIEW_CONSUMPTION = Caffeine.newBuilder()
|
|
|
- .maximumSize(1000)
|
|
|
- .expireAfterWrite(10, TimeUnit.MINUTES)
|
|
|
- .build();
|
|
|
-
|
|
|
- private static final Cache<Integer, List<WatchEndPlayTrendDTO>> WATCH_END_PLAY_TREND = Caffeine.newBuilder()
|
|
|
- .maximumSize(1000)
|
|
|
- .build();
|
|
|
-
|
|
|
- private static final Cache<Integer, List<DeaMemberTopTenDTO>> DEA_MEMBER_TOP_TEN = Caffeine.newBuilder()
|
|
|
- .maximumSize(1000)
|
|
|
- .expireAfterWrite(10, TimeUnit.MINUTES)
|
|
|
- .build();
|
|
|
-
|
|
|
- @Override
|
|
|
- public DealerAggregatedDTO dealerAggregated() {
|
|
|
- return DEALER_AGGREGATED_DTO_CACHE.get(1,e->{
|
|
|
- return statisticsService.dealerAggregated();
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public ConsumptionBalanceDataDTO rechargeConsumption() {
|
|
|
- return RECHARGE_CONSUMPTION.get(1,e->{
|
|
|
- return statisticsService.rechargeConsumption();
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public AnalysisPreviewDTO analysisPreview(AnalysisPreviewQueryDTO param) {
|
|
|
- return ANALYSIS_PREVIEW_CONSUMPTION.get(1,e->{
|
|
|
- return statisticsService.analysisPreview(param);
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public List<WatchEndPlayTrendDTO> watchEndPlayTrend(AnalysisPreviewQueryDTO param) {
|
|
|
- return WATCH_END_PLAY_TREND.get(param.getType(),e->{
|
|
|
- return statisticsService.watchEndPlayTrend(param);
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void setWatchEndPlayTrend(Integer type,List<WatchEndPlayTrendDTO> data) {
|
|
|
- WATCH_END_PLAY_TREND.put(type,data);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @Override
|
|
|
- public List<DeaMemberTopTenDTO> deaMemberTopTen(AnalysisPreviewQueryDTO param) {
|
|
|
- return DEA_MEMBER_TOP_TEN.get(param.getType(),e->{
|
|
|
- return statisticsService.deaMemberTopTen(param);
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
-}
|