|
|
@@ -560,8 +560,9 @@ public class StatsController {
|
|
|
hotArticleList.sort((x, y) -> Long.compare(
|
|
|
((Number) y.get("viewCount")).longValue(),
|
|
|
((Number) x.get("viewCount")).longValue()));
|
|
|
- if (hotArticleList.size() > 10) hotArticleList = hotArticleList.subList(0, 10);
|
|
|
- data.put("hotArticleList", hotArticleList);
|
|
|
+ List<Map<String, Object>> hotArticleTop = hotArticleList;
|
|
|
+ if (hotArticleList.size() > 10) hotArticleTop = new ArrayList<>(hotArticleList.subList(0, 10));
|
|
|
+ data.put("hotArticleList", hotArticleTop);
|
|
|
|
|
|
// 5. 购买热点(商品销量 Top 10,近30天已支付订单)
|
|
|
List<ProductOrder> recentOrders = productOrderMapper.selectList(
|
|
|
@@ -644,8 +645,9 @@ public class StatsController {
|
|
|
articleDwellList.sort((x, y) -> Long.compare(
|
|
|
((Number) y.get("avgDurationSeconds")).longValue(),
|
|
|
((Number) x.get("avgDurationSeconds")).longValue()));
|
|
|
- if (articleDwellList.size() > 10) articleDwellList = articleDwellList.subList(0, 10);
|
|
|
- data.put("articleDwellList", articleDwellList);
|
|
|
+ List<Map<String, Object>> articleDwellTop = articleDwellList;
|
|
|
+ if (articleDwellList.size() > 10) articleDwellTop = new ArrayList<>(articleDwellList.subList(0, 10));
|
|
|
+ data.put("articleDwellList", articleDwellTop);
|
|
|
|
|
|
// 8. 用户停留时长 Top(文章阅读 + 分享阅读,近30天累计)
|
|
|
Map<Long, Long> userDwellMap = new HashMap<>();
|
|
|
@@ -681,8 +683,9 @@ public class StatsController {
|
|
|
userDwellList.sort((x, y) -> Long.compare(
|
|
|
((Number) y.get("totalDurationSeconds")).longValue(),
|
|
|
((Number) x.get("totalDurationSeconds")).longValue()));
|
|
|
- if (userDwellList.size() > 10) userDwellList = userDwellList.subList(0, 10);
|
|
|
- data.put("userDwellList", userDwellList);
|
|
|
+ List<Map<String, Object>> userDwellTop = userDwellList;
|
|
|
+ if (userDwellList.size() > 10) userDwellTop = new ArrayList<>(userDwellList.subList(0, 10));
|
|
|
+ data.put("userDwellList", userDwellTop);
|
|
|
|
|
|
// 9. 商品停留时长 Top(近30天,依赖商品详情页埋点上报)
|
|
|
List<ProductViewRecord> productViews = productViewRecordMapper.selectList(
|
|
|
@@ -711,8 +714,9 @@ public class StatsController {
|
|
|
productDwellList.sort((x, y) -> Long.compare(
|
|
|
((Number) y.get("totalDurationSeconds")).longValue(),
|
|
|
((Number) x.get("totalDurationSeconds")).longValue()));
|
|
|
- if (productDwellList.size() > 10) productDwellList = productDwellList.subList(0, 10);
|
|
|
- data.put("productDwellList", productDwellList);
|
|
|
+ List<Map<String, Object>> productDwellTop = productDwellList;
|
|
|
+ if (productDwellList.size() > 10) productDwellTop = new ArrayList<>(productDwellList.subList(0, 10));
|
|
|
+ data.put("productDwellList", productDwellTop);
|
|
|
|
|
|
// 10. 停留时长 · 时段分布(近30天真实停留,按小时聚合 0-23 点)
|
|
|
// 复用已预取的 articleReads / productViews,避免额外查询
|