|
|
@@ -978,6 +978,7 @@ public class StoreOperationalStatisticsServiceImpl implements StoreOperationalSt
|
|
|
// business_section = 1 表示美食,查询美食价目表
|
|
|
LambdaQueryWrapper<StoreCuisine> cuisineWrapper = new LambdaQueryWrapper<>();
|
|
|
cuisineWrapper.in(StoreCuisine::getId, needQueryPriceIds)
|
|
|
+ .eq(StoreCuisine::getStoreId, storeId)
|
|
|
.eq(StoreCuisine::getDeleteFlag, 0);
|
|
|
List<StoreCuisine> cuisines = storeCuisineMapper.selectList(cuisineWrapper);
|
|
|
for (StoreCuisine cuisine : cuisines) {
|
|
|
@@ -989,6 +990,7 @@ public class StoreOperationalStatisticsServiceImpl implements StoreOperationalSt
|
|
|
// 其他情况查询通用价目表
|
|
|
LambdaQueryWrapper<StorePrice> priceWrapper = new LambdaQueryWrapper<>();
|
|
|
priceWrapper.in(StorePrice::getId, needQueryPriceIds)
|
|
|
+ .eq(StorePrice::getStoreId, storeId)
|
|
|
.eq(StorePrice::getDeleteFlag, 0);
|
|
|
List<StorePrice> prices = storePriceMapper.selectList(priceWrapper);
|
|
|
for (StorePrice price : prices) {
|
|
|
@@ -1006,12 +1008,15 @@ public class StoreOperationalStatisticsServiceImpl implements StoreOperationalSt
|
|
|
|
|
|
comparison.setPriceId(curr.getPriceId());
|
|
|
|
|
|
- // 设置价目表名称,如果为空则从查询结果中获取
|
|
|
+ // 设置价目表名称,如果为空则从查询结果中获取(与 convert 一致:有 storeId 时不展示无有效名称的条目)
|
|
|
String priceListItemName = curr.getPriceListItemName();
|
|
|
if (priceListItemName == null || priceListItemName.trim().isEmpty()) {
|
|
|
priceListItemName = priceNameMap.get(curr.getPriceId());
|
|
|
}
|
|
|
- comparison.setPriceListItemName(priceListItemName);
|
|
|
+ if (storeId != null && (priceListItemName == null || priceListItemName.trim().isEmpty())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ comparison.setPriceListItemName(priceListItemName != null ? priceListItemName.trim() : null);
|
|
|
|
|
|
// 获取上期对应的价目表数据
|
|
|
StoreOperationalStatisticsVo.PriceListRanking prev = previousMap.get(curr.getPriceId());
|
|
|
@@ -1831,6 +1836,7 @@ public class StoreOperationalStatisticsServiceImpl implements StoreOperationalSt
|
|
|
// business_section = 1 表示美食,查询美食价目表
|
|
|
LambdaQueryWrapper<StoreCuisine> cuisineWrapper = new LambdaQueryWrapper<>();
|
|
|
cuisineWrapper.in(StoreCuisine::getId, priceIds)
|
|
|
+ .eq(StoreCuisine::getStoreId, storeId)
|
|
|
.eq(StoreCuisine::getDeleteFlag, 0);
|
|
|
List<StoreCuisine> cuisines = storeCuisineMapper.selectList(cuisineWrapper);
|
|
|
for (StoreCuisine cuisine : cuisines) {
|
|
|
@@ -1842,6 +1848,7 @@ public class StoreOperationalStatisticsServiceImpl implements StoreOperationalSt
|
|
|
// 其他情况查询通用价目表
|
|
|
LambdaQueryWrapper<StorePrice> priceWrapper = new LambdaQueryWrapper<>();
|
|
|
priceWrapper.in(StorePrice::getId, priceIds)
|
|
|
+ .eq(StorePrice::getStoreId, storeId)
|
|
|
.eq(StorePrice::getDeleteFlag, 0);
|
|
|
List<StorePrice> prices = storePriceMapper.selectList(priceWrapper);
|
|
|
for (StorePrice price : prices) {
|
|
|
@@ -1852,18 +1859,27 @@ public class StoreOperationalStatisticsServiceImpl implements StoreOperationalSt
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 转换为列表并按浏览量降序排序
|
|
|
+ // 转换为列表:有 storeId 时仅保留本店未删除且能解析到名称的价目/菜品
|
|
|
for (Map.Entry<Integer, Map<String, Long>> entry : accumulator.entrySet()) {
|
|
|
+ Integer priceId = entry.getKey();
|
|
|
+ if (priceId == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ String itemName = priceNameMap.get(priceId);
|
|
|
+ if (storeId != null) {
|
|
|
+ if (itemName == null || itemName.trim().isEmpty()) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
StoreOperationalStatisticsVo.PriceListRanking ranking = new StoreOperationalStatisticsVo.PriceListRanking();
|
|
|
- ranking.setPriceId(entry.getKey());
|
|
|
+ ranking.setPriceId(priceId);
|
|
|
Map<String, Long> data = entry.getValue();
|
|
|
ranking.setPageViews(data.getOrDefault("viewCount", 0L));
|
|
|
ranking.setVisitors(data.getOrDefault("visitorCount", 0L));
|
|
|
ranking.setShares(data.getOrDefault("shareCount", 0L));
|
|
|
-
|
|
|
- // 根据id查询价目表名称
|
|
|
- ranking.setPriceListItemName(priceNameMap.getOrDefault(entry.getKey(), null));
|
|
|
-
|
|
|
+ ranking.setPriceListItemName(itemName != null ? itemName.trim() : null);
|
|
|
+
|
|
|
result.add(ranking);
|
|
|
}
|
|
|
|
|
|
@@ -2316,6 +2332,7 @@ public class StoreOperationalStatisticsServiceImpl implements StoreOperationalSt
|
|
|
// business_section = 1 表示美食,查询美食价目表
|
|
|
LambdaQueryWrapper<StoreCuisine> cuisineWrapper = new LambdaQueryWrapper<>();
|
|
|
cuisineWrapper.in(StoreCuisine::getId, priceIds)
|
|
|
+ .eq(StoreCuisine::getStoreId, storeId)
|
|
|
.eq(StoreCuisine::getDeleteFlag, 0);
|
|
|
List<StoreCuisine> cuisines = storeCuisineMapper.selectList(cuisineWrapper);
|
|
|
for (StoreCuisine cuisine : cuisines) {
|
|
|
@@ -2327,6 +2344,7 @@ public class StoreOperationalStatisticsServiceImpl implements StoreOperationalSt
|
|
|
// 其他情况查询通用价目表
|
|
|
LambdaQueryWrapper<StorePrice> priceWrapper = new LambdaQueryWrapper<>();
|
|
|
priceWrapper.in(StorePrice::getId, priceIds)
|
|
|
+ .eq(StorePrice::getStoreId, storeId)
|
|
|
.eq(StorePrice::getDeleteFlag, 0);
|
|
|
List<StorePrice> prices = storePriceMapper.selectList(priceWrapper);
|
|
|
for (StorePrice price : prices) {
|
|
|
@@ -2337,19 +2355,26 @@ public class StoreOperationalStatisticsServiceImpl implements StoreOperationalSt
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 转换为VO列表
|
|
|
+ // 转换为VO列表(能按店铺查库时:仅保留仍有效的价目/菜品;已删除或查无此条的不展示)
|
|
|
for (Map<String, Object> item : dataList) {
|
|
|
- StoreOperationalStatisticsVo.PriceListRanking ranking = new StoreOperationalStatisticsVo.PriceListRanking();
|
|
|
Integer priceId = getIntegerValue(item, "priceId");
|
|
|
+ if (priceId == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ String priceListItemName = priceNameMap.get(priceId);
|
|
|
+ if (storeId != null) {
|
|
|
+ if (priceListItemName == null || priceListItemName.trim().isEmpty()) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ StoreOperationalStatisticsVo.PriceListRanking ranking = new StoreOperationalStatisticsVo.PriceListRanking();
|
|
|
ranking.setPriceId(priceId);
|
|
|
ranking.setPageViews(getLongValue(item, "viewCount"));
|
|
|
ranking.setVisitors(getLongValue(item, "visitorCount"));
|
|
|
ranking.setShares(getLongValue(item, "shareCount"));
|
|
|
-
|
|
|
- if (priceId != null) {
|
|
|
- ranking.setPriceListItemName(priceNameMap.get(priceId));
|
|
|
- }
|
|
|
-
|
|
|
+ ranking.setPriceListItemName(priceListItemName != null ? priceListItemName.trim() : null);
|
|
|
+
|
|
|
result.add(ranking);
|
|
|
}
|
|
|
|