You've already forked FrameTour-BE
refactor(statistics): 切换数据查询服务并优化扫码统计功能
- 将 BrokerBiz 和 OrderBiz 中的数据查询从 StatisticsMapper 切换到 StatsQueryService - 更新 StatisticsServiceImpl 使用 StatsQueryService 进行数据查询 - 添加订单数据合并功能到扫码统计图表中 - 重构扫码统计查询逻辑以支持统计数据和订单数据的合并显示 - 新增按小时和按日期统计订单数据的查询方法 - 优化 SQL 查询以分离统计数据和订单数据的查询逻辑
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.ycwl.basic.biz;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.ycwl.basic.clickhouse.service.StatsQueryService;
|
||||
import com.ycwl.basic.mapper.BrokerMapper;
|
||||
import com.ycwl.basic.mapper.BrokerRecordMapper;
|
||||
import com.ycwl.basic.mapper.StatisticsMapper;
|
||||
@@ -34,7 +35,7 @@ public class BrokerBiz {
|
||||
@Autowired
|
||||
private ScenicRepository scenicRepository;
|
||||
@Autowired
|
||||
private StatisticsMapper statisticsMapper;
|
||||
private StatsQueryService statsQueryService;
|
||||
|
||||
public void processOrder(Long orderId) {
|
||||
log.info("开始处理订单分佣,订单ID:{}", orderId);
|
||||
@@ -52,7 +53,7 @@ public class BrokerBiz {
|
||||
if (scenicConfig.getInteger("sample_store_day") != null) {
|
||||
expireDay = scenicConfig.getInteger("sample_store_day");
|
||||
}
|
||||
List<Long> brokerIdList = statisticsMapper.getBrokerIdListForUser(order.getMemberId(), DateUtil.offsetDay(DateUtil.beginOfDay(order.getCreateAt()), -expireDay), order.getCreateAt());
|
||||
List<Long> brokerIdList = statsQueryService.getBrokerIdListForUser(order.getMemberId(), DateUtil.offsetDay(DateUtil.beginOfDay(order.getCreateAt()), -expireDay), order.getCreateAt());
|
||||
if (brokerIdList == null || brokerIdList.isEmpty()) {
|
||||
log.info("用户与推客无关,订单ID:{}", orderId);
|
||||
return;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.ycwl.basic.biz;
|
||||
|
||||
import com.ycwl.basic.clickhouse.service.StatsQueryService;
|
||||
import com.ycwl.basic.enums.StatisticEnum;
|
||||
import com.ycwl.basic.integration.common.manager.ScenicConfigManager;
|
||||
import com.ycwl.basic.mapper.OrderMapper;
|
||||
@@ -66,6 +67,8 @@ public class OrderBiz {
|
||||
private PrinterService printerService;
|
||||
@Autowired
|
||||
private IPriceCalculationService iPriceCalculationService;
|
||||
@Autowired
|
||||
private StatsQueryService statsQueryService;
|
||||
|
||||
public PriceObj queryPrice(Long scenicId, Long memberId, int goodsType, Long goodsId) {
|
||||
PriceObj priceObj = new PriceObj();
|
||||
@@ -254,7 +257,7 @@ public class OrderBiz {
|
||||
orderRepository.clearOrderCache(orderId); // 更新完了,清理下
|
||||
StatisticsRecordAddReq statisticsRecordAddReq = new StatisticsRecordAddReq();
|
||||
statisticsRecordAddReq.setMemberId(order.getMemberId());
|
||||
Long enterType = statisticsMapper.getUserRecentEnterType(order.getMemberId(), order.getCreateAt());
|
||||
Long enterType = statsQueryService.getUserRecentEnterType(order.getMemberId(), order.getCreateAt());
|
||||
if(!Long.valueOf(1014).equals(enterType)){//
|
||||
statisticsRecordAddReq.setType(StatisticEnum.ON_SITE_PAYMENT.code);
|
||||
}else {
|
||||
|
||||
Reference in New Issue
Block a user