Commit 330355f0 by 春觉晓

优化存量门店统计逻辑

1 parent 67773d40
...@@ -304,6 +304,7 @@ public class BusinessSceneAnalysisService { ...@@ -304,6 +304,7 @@ public class BusinessSceneAnalysisService {
List<Integer> merchantIds = new ArrayList<>(); List<Integer> merchantIds = new ArrayList<>();
if (!CollectionUtils.isEmpty(trendOutputList)) { if (!CollectionUtils.isEmpty(trendOutputList)) {
merchantIds = trendOutputList.stream().map(DataBusinessDTO::getMerchantId).distinct().collect(Collectors.toList()); merchantIds = trendOutputList.stream().map(DataBusinessDTO::getMerchantId).distinct().collect(Collectors.toList());
trendOutputList.clear();
} }
//设置总开单门店数 //设置总开单门店数
res.setTotalStores(merchantIds.size()); res.setTotalStores(merchantIds.size());
...@@ -366,8 +367,9 @@ public class BusinessSceneAnalysisService { ...@@ -366,8 +367,9 @@ public class BusinessSceneAnalysisService {
List<DataBusinessDTO> preOutputList = getTotalOutputGroupByMerchant(queryParams); List<DataBusinessDTO> preOutputList = getTotalOutputGroupByMerchant(queryParams);
if (!CollectionUtils.isEmpty(preOutputList)) { if (!CollectionUtils.isEmpty(preOutputList)) {
List<Integer> preMerchantIds = preOutputList.stream().map(DataBusinessDTO::getMerchantId).distinct().collect(Collectors.toList()); List<Integer> preMerchantIds = preOutputList.stream().map(DataBusinessDTO::getMerchantId).distinct().collect(Collectors.toList());
preOutputList.clear();
//计算环比:((本周期开单门店数量-上周期开单门店数量)/上周期开单门店数量)*100% //计算环比:((本周期开单门店数量-上周期开单门店数量)/上周期开单门店数量)*100%
int preStoreCount = preOutputList.size(); int preStoreCount = preMerchantIds.size();
BigDecimal countRatio = usedCarDataStatsService.calculateDiv(res.getTotalStores() - preStoreCount, preStoreCount); BigDecimal countRatio = usedCarDataStatsService.calculateDiv(res.getTotalStores() - preStoreCount, preStoreCount);
res.setTotalStoresMom(countRatio); res.setTotalStoresMom(countRatio);
List<BiRecord> biRecords = businessIntelligenceMapper.getBiRecords(biBusinessType, preMerchantIds, req.getPreStartDate(), req.getPreEndDate()); List<BiRecord> biRecords = businessIntelligenceMapper.getBiRecords(biBusinessType, preMerchantIds, req.getPreStartDate(), req.getPreEndDate());
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!