|
@@ -1,6 +1,7 @@
|
|
|
package com.cyksj.web.controller.manage.statistics;
|
|
package com.cyksj.web.controller.manage.statistics;
|
|
|
|
|
|
|
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.date.DateTime;
|
|
import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
@@ -48,6 +49,7 @@ import java.math.RoundingMode;
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
+import java.util.Optional;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -413,15 +415,94 @@ public class StatisticsDataController {
|
|
|
if (lastDate != null) {
|
|
if (lastDate != null) {
|
|
|
end = DateUtil.format(DateTime.of(lastDate), "yyyy-MM-dd");
|
|
end = DateUtil.format(DateTime.of(lastDate), "yyyy-MM-dd");
|
|
|
}
|
|
}
|
|
|
- BrokenLineObjView brokenLineObjView = orderDonMapper.selectPlatBrokenLineMoney(first, end);
|
|
|
|
|
|
|
+ BrokenLineObjView brokenLineObjView = Optional.ofNullable(orderDonMapper.selectPlatBrokenLineMoney(first, end))
|
|
|
|
|
+ .orElse(new BrokenLineObjView());
|
|
|
|
|
+
|
|
|
if (brokenLineObjView != null) {
|
|
if (brokenLineObjView != null) {
|
|
|
List<PlatOrderDonBrokenLineView> views = beanSearcher.searchAll(PlatOrderDonBrokenLineView.class, MapUtils.builder()
|
|
List<PlatOrderDonBrokenLineView> views = beanSearcher.searchAll(PlatOrderDonBrokenLineView.class, MapUtils.builder()
|
|
|
- .field(PersonDistributeBrokenLineView::getDate, first, end).op(Operator.Between)
|
|
|
|
|
- .orderBy(PersonDistributeBrokenLineView::getDate).asc()
|
|
|
|
|
|
|
+ .field(PlatOrderDonBrokenLineView::getDate, first, end).op(Operator.Between)
|
|
|
|
|
+ .orderBy(PlatOrderDonBrokenLineView::getDate).asc()
|
|
|
.build());
|
|
.build());
|
|
|
Map<Long, List<PlatOrderDonBrokenLineView>> goodsMap = views.stream().collect(Collectors.groupingBy(PlatOrderDonBrokenLineView::getGoodsId));
|
|
Map<Long, List<PlatOrderDonBrokenLineView>> goodsMap = views.stream().collect(Collectors.groupingBy(PlatOrderDonBrokenLineView::getGoodsId));
|
|
|
brokenLineObjView.setGoodsData(goodsMap);
|
|
brokenLineObjView.setGoodsData(goodsMap);
|
|
|
}
|
|
}
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(brokenLineObjView);
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(brokenLineObjView);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 渠道后台数据统计折线图
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @GetMapping("/get/channelStatistics/brokenLine")
|
|
|
|
|
+ public Result<ChannelStatisticsView> getChannelStatisticsView(Long firstDate, Long lastDate) {
|
|
|
|
|
+ String first = null;
|
|
|
|
|
+ String end = null;
|
|
|
|
|
+ if (firstDate != null) {
|
|
|
|
|
+ first = DateUtil.format(DateTime.of(firstDate), "yyyy-MM-dd");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (lastDate != null) {
|
|
|
|
|
+ end = DateUtil.format(DateTime.of(lastDate), "yyyy-MM-dd");
|
|
|
|
|
+ }
|
|
|
|
|
+ ChannelStatisticsView channelStatisticsView = Optional.ofNullable(orderDonMapper.selectChannelStatistics(first, end))
|
|
|
|
|
+ .orElse(new ChannelStatisticsView());
|
|
|
|
|
+
|
|
|
|
|
+ List<ChannelCommonView> natureChannelData = beanSearcher.searchAll(ChannelCommonView.class, MapUtils.builder()
|
|
|
|
|
+ .field(ChannelCommonView::getDate, first, end).op(Operator.Between)
|
|
|
|
|
+ .put("type", "od.is_distribute is false")
|
|
|
|
|
+ .orderBy(PlatOrderDonBrokenLineView::getDate).asc()
|
|
|
|
|
+ .build());
|
|
|
|
|
+ channelStatisticsView.setNatureChannelData(natureChannelData);
|
|
|
|
|
+
|
|
|
|
|
+ List<ChannelCommonView> generalPopularizeChannelData = beanSearcher.searchAll(ChannelCommonView.class, MapUtils.builder()
|
|
|
|
|
+ .field(ChannelCommonView::getDate, first, end).op(Operator.Between)
|
|
|
|
|
+ .put("type", "od.is_distribute is true and od.is_fixed_distribute is false")
|
|
|
|
|
+ .orderBy(PlatOrderDonBrokenLineView::getDate).asc()
|
|
|
|
|
+ .build());
|
|
|
|
|
+ channelStatisticsView.setGeneralPopularizeChannelData(generalPopularizeChannelData);
|
|
|
|
|
+
|
|
|
|
|
+ List<ChannelCommonView> distributeChannelData = beanSearcher.searchAll(ChannelCommonView.class, MapUtils.builder()
|
|
|
|
|
+ .field(ChannelCommonView::getDate, first, end).op(Operator.Between)
|
|
|
|
|
+ .put("type", "od.is_fixed_distribute is true")
|
|
|
|
|
+ .orderBy(PlatOrderDonBrokenLineView::getDate).asc()
|
|
|
|
|
+ .build());
|
|
|
|
|
+ channelStatisticsView.setDistributeChannelData(distributeChannelData);
|
|
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(channelStatisticsView);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 用户新增数据统计折线图
|
|
|
|
|
+ */
|
|
|
|
|
+ @GetMapping("/get/newUserStatistics/brokenLine")
|
|
|
|
|
+ public Result<NewUserStatisticsView> getNewUserStatisticsView(Long firstDate, Long lastDate) {
|
|
|
|
|
+ String first = null;
|
|
|
|
|
+ String end = null;
|
|
|
|
|
+ if (firstDate != null) {
|
|
|
|
|
+ first = DateUtil.format(DateTime.of(firstDate), "yyyy-MM-dd");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (lastDate != null) {
|
|
|
|
|
+ end = DateUtil.format(DateTime.of(lastDate), "yyyy-MM-dd");
|
|
|
|
|
+ }
|
|
|
|
|
+ NewUserStatisticsView newUserStatisticsView = new NewUserStatisticsView();
|
|
|
|
|
+
|
|
|
|
|
+ List<NewAllUserView> newAllUserViews = beanSearcher.searchAll(NewAllUserView.class, MapUtils.builder().field(NewAllUserView::getDate, first, end).build());
|
|
|
|
|
+
|
|
|
|
|
+ if (CollUtil.isNotEmpty(newAllUserViews)) {
|
|
|
|
|
+ newUserStatisticsView.setFirstDate(newAllUserViews.get(0).getDate());
|
|
|
|
|
+ newUserStatisticsView.setLastDate(newAllUserViews.get(newAllUserViews.size() - 1).getDate());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ List<NewUserView> newUserViews = beanSearcher.searchAll(NewUserView.class, MapUtils.builder().field(NewUserView::getDate, first, end).op(Operator.Between).build());
|
|
|
|
|
+ newUserStatisticsView.setNewUserData(newUserViews);
|
|
|
|
|
+
|
|
|
|
|
+ List<NewPcUserView> newPcUserViews = beanSearcher.searchAll(NewPcUserView.class, MapUtils.builder().field(NewPcUserView::getDate, first, end).op(Operator.Between).build());
|
|
|
|
|
+ newUserStatisticsView.setNewPcUserData(newPcUserViews);
|
|
|
|
|
+
|
|
|
|
|
+ List<NewDistributeUserView> newDistributeUserViews = beanSearcher.searchAll(NewDistributeUserView.class, MapUtils.builder().field(NewDistributeUserView::getDate, first, end).op(Operator.Between).build());
|
|
|
|
|
+ newUserStatisticsView.setNewDistributeUserData(newDistributeUserViews);
|
|
|
|
|
+
|
|
|
|
|
+ List<NewCorpUserView> newCorpUserViews = beanSearcher.searchAll(NewCorpUserView.class, MapUtils.builder().field(NewCorpUserView::getDate, first, end).op(Operator.Between).build());
|
|
|
|
|
+ newUserStatisticsView.setNewCorpUserData(newCorpUserViews);
|
|
|
|
|
+
|
|
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(newUserStatisticsView);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|