Commit b042f70f by 林永健

fix(business-scene): 修复流失门店统计中的权限门店过滤问题

- 使用未经产值过滤的权限门店 req.merchantIds 替代 curReq.getMerchantIds
- 统一使用 req 对象获取项目组ID和排除ID参数
- 修正了权限门店过滤逻辑,确保正确的门店数据统计
1 parent 543ce95f
......@@ -842,17 +842,18 @@ public class BusinessSceneAnalysisService {
res.setOldStoresRatio(oldStoreRatio);
// 流失门店:以统计周期的开始日期为基准,近30天无产值且近60天存在产值的门店数
List<Integer> queryLostStoreIds = curReq.getMerchantIds();
// 使用未经产值过滤的权限门店 req.merchantIds
List<Integer> queryLostStoreIds = req.getMerchantIds();
// 把权限门店过滤一下项目组的
if (curReq.getProjectGroupId() != null) {
List<Integer> byGroupMerchantId = getMerchantByProjectGroup(curReq.getProjectGroupId());
if (req.getProjectGroupId() != null) {
List<Integer> byGroupMerchantId = getMerchantByProjectGroup(req.getProjectGroupId());
queryLostStoreIds = CollectionUtils.isEmpty(queryLostStoreIds)
? byGroupMerchantId : new ArrayList<>(CollectionUtils.intersection(queryLostStoreIds, byGroupMerchantId));
}
int lostStoreCount = businessIntelligenceMapper.countLostMerchantByBizType(queryLostStoreIds, startDate, biBusinessType, curReq.getExcludeIds());
int lostStoreCount = businessIntelligenceMapper.countLostMerchantByBizType(queryLostStoreIds, startDate, biBusinessType, req.getExcludeIds());
res.setChurnedStores(lostStoreCount);
// 历史总门店数:以统计周期的开始日期为基准,近30-60天间存在产值的门店数;
int totalStoreCount = businessIntelligenceMapper.countHistoryMerchantByBizType(queryLostStoreIds, startDate, biBusinessType, curReq.getExcludeIds());
int totalStoreCount = businessIntelligenceMapper.countHistoryMerchantByBizType(queryLostStoreIds, startDate, biBusinessType, req.getExcludeIds());
// 流失率:(流失门店/历史总门店数)*100%,保留百分比两位小数,其中历史总门店数:以统计周期的开始日期为基准,近30-60天间存在产值的门店数;
if (totalStoreCount != 0) {
BigDecimal churnRate = usedCarDataStatsService.calculateDiv(lostStoreCount, totalStoreCount);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!