mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-10-31 18:28:43 +08:00 
			
		
		
		
	统计:交易统计Review修改
This commit is contained in:
		| @@ -1,14 +1,14 @@ | ||||
| package cn.iocoder.yudao.module.statistics.convert.trade; | ||||
|  | ||||
| import cn.iocoder.yudao.module.pay.api.wallet.dto.WalletSummaryRespDTO; | ||||
| import cn.iocoder.yudao.module.statistics.service.trade.bo.WalletSummaryRespBO; | ||||
| import cn.iocoder.yudao.module.statistics.controller.admin.trade.vo.TradeStatisticsComparisonRespVO; | ||||
| import cn.iocoder.yudao.module.statistics.controller.admin.trade.vo.TradeSummaryRespVO; | ||||
| import cn.iocoder.yudao.module.statistics.controller.admin.trade.vo.TradeTrendSummaryExcelVO; | ||||
| import cn.iocoder.yudao.module.statistics.controller.admin.trade.vo.TradeTrendSummaryRespVO; | ||||
| import cn.iocoder.yudao.module.statistics.dal.dataobject.trade.TradeStatisticsDO; | ||||
| import cn.iocoder.yudao.module.statistics.service.trade.bo.TradeOrderSummaryRespBO; | ||||
| import cn.iocoder.yudao.module.statistics.service.trade.bo.TradeSummaryRespBO; | ||||
| import cn.iocoder.yudao.module.trade.api.aftersale.dto.AfterSaleSummaryRespDTO; | ||||
| import cn.iocoder.yudao.module.trade.api.order.dto.TradeOrderSummaryRespDTO; | ||||
| import cn.iocoder.yudao.module.statistics.service.trade.bo.AfterSaleSummaryRespBO; | ||||
| import org.mapstruct.Mapper; | ||||
| import org.mapstruct.factory.Mappers; | ||||
|  | ||||
| @@ -46,8 +46,8 @@ public interface TradeStatisticsConvert { | ||||
|  | ||||
|     List<TradeTrendSummaryExcelVO> convertList02(List<TradeTrendSummaryRespVO> list); | ||||
|  | ||||
|     TradeStatisticsDO convert(LocalDateTime time, TradeOrderSummaryRespDTO orderSummary, | ||||
|                               AfterSaleSummaryRespDTO afterSaleSummary, Integer brokerageSettlementPrice, | ||||
|                               WalletSummaryRespDTO walletSummary); | ||||
|     TradeStatisticsDO convert(LocalDateTime time, TradeOrderSummaryRespBO orderSummary, | ||||
|                               AfterSaleSummaryRespBO afterSaleSummary, Integer brokerageSettlementPrice, | ||||
|                               WalletSummaryRespBO walletSummary); | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -0,0 +1,22 @@ | ||||
| package cn.iocoder.yudao.module.statistics.dal.mysql.trade; | ||||
|  | ||||
| import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | ||||
| import cn.iocoder.yudao.module.statistics.dal.dataobject.trade.TradeStatisticsDO; | ||||
| import cn.iocoder.yudao.module.statistics.service.trade.bo.AfterSaleSummaryRespBO; | ||||
| import org.apache.ibatis.annotations.Mapper; | ||||
| import org.apache.ibatis.annotations.Param; | ||||
|  | ||||
| import java.time.LocalDateTime; | ||||
|  | ||||
| /** | ||||
|  * 交易统计 Mapper | ||||
|  * | ||||
|  * @author owen | ||||
|  */ | ||||
| @Mapper | ||||
| public interface AfterSaleStatisticsMapper extends BaseMapperX<TradeStatisticsDO> { | ||||
|  | ||||
|     AfterSaleSummaryRespBO selectSummaryByRefundTimeBetween(@Param("beginTime") LocalDateTime beginTime, | ||||
|                                                             @Param("endTime") LocalDateTime endTime); | ||||
|  | ||||
| } | ||||
| @@ -0,0 +1,23 @@ | ||||
| package cn.iocoder.yudao.module.statistics.dal.mysql.trade; | ||||
|  | ||||
| import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | ||||
| import cn.iocoder.yudao.module.statistics.dal.dataobject.trade.TradeStatisticsDO; | ||||
| import org.apache.ibatis.annotations.Mapper; | ||||
| import org.apache.ibatis.annotations.Param; | ||||
|  | ||||
| import java.time.LocalDateTime; | ||||
|  | ||||
| /** | ||||
|  * 交易统计 Mapper | ||||
|  * | ||||
|  * @author owen | ||||
|  */ | ||||
| @Mapper | ||||
| public interface BrokerageStatisticsMapper extends BaseMapperX<TradeStatisticsDO> { | ||||
|  | ||||
|     Integer selectSummaryPriceByStatusAndUnfreezeTimeBetween(@Param("bizType") Integer bizType, | ||||
|                                                              @Param("status") Integer status, | ||||
|                                                              @Param("beginTime") LocalDateTime beginTime, | ||||
|                                                              @Param("endTime") LocalDateTime endTime); | ||||
|  | ||||
| } | ||||
| @@ -0,0 +1,30 @@ | ||||
| package cn.iocoder.yudao.module.statistics.dal.mysql.trade; | ||||
|  | ||||
| import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | ||||
| import cn.iocoder.yudao.module.statistics.service.trade.bo.WalletSummaryRespBO; | ||||
| import cn.iocoder.yudao.module.statistics.dal.dataobject.trade.TradeStatisticsDO; | ||||
| import org.apache.ibatis.annotations.Mapper; | ||||
| import org.apache.ibatis.annotations.Param; | ||||
|  | ||||
| import java.time.LocalDateTime; | ||||
|  | ||||
| /** | ||||
|  * 交易统计 Mapper | ||||
|  * | ||||
|  * @author owen | ||||
|  */ | ||||
| @Mapper | ||||
| public interface PayWalletStatisticsMapper extends BaseMapperX<TradeStatisticsDO> { | ||||
|  | ||||
|     WalletSummaryRespBO selectRechargeSummaryByPayTimeBetween(@Param("beginTime") LocalDateTime beginTime, | ||||
|                                                               @Param("endTime") LocalDateTime endTime, | ||||
|                                                               @Param("payStatus") Boolean payStatus); | ||||
|  | ||||
|     WalletSummaryRespBO selectRechargeSummaryByRefundTimeBetween(@Param("beginTime") LocalDateTime beginTime, | ||||
|                                                                  @Param("endTime") LocalDateTime endTime, | ||||
|                                                                  @Param("refundStatus") Integer refundStatus); | ||||
|  | ||||
|     Integer selectPriceSummaryByBizTypeAndCreateTimeBetween(@Param("beginTime") LocalDateTime beginTime, | ||||
|                                                             @Param("endTime") LocalDateTime endTime, | ||||
|                                                             @Param("bizType") Integer bizType); | ||||
| } | ||||
| @@ -0,0 +1,22 @@ | ||||
| package cn.iocoder.yudao.module.statistics.dal.mysql.trade; | ||||
|  | ||||
| import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | ||||
| import cn.iocoder.yudao.module.statistics.dal.dataobject.trade.TradeStatisticsDO; | ||||
| import cn.iocoder.yudao.module.statistics.service.trade.bo.TradeOrderSummaryRespBO; | ||||
| import org.apache.ibatis.annotations.Mapper; | ||||
| import org.apache.ibatis.annotations.Param; | ||||
|  | ||||
| import java.time.LocalDateTime; | ||||
|  | ||||
| /** | ||||
|  * 交易统计 Mapper | ||||
|  * | ||||
|  * @author owen | ||||
|  */ | ||||
| @Mapper | ||||
| public interface TradeOrderStatisticsMapper extends BaseMapperX<TradeStatisticsDO> { | ||||
|  | ||||
|     TradeOrderSummaryRespBO selectSummaryByPayTimeBetween(@Param("beginTime") LocalDateTime beginTime, | ||||
|                                                           @Param("endTime") LocalDateTime endTime); | ||||
|  | ||||
| } | ||||
| @@ -0,0 +1,23 @@ | ||||
| package cn.iocoder.yudao.module.statistics.service.trade; | ||||
|  | ||||
| import cn.iocoder.yudao.module.statistics.service.trade.bo.AfterSaleSummaryRespBO; | ||||
|  | ||||
| import java.time.LocalDateTime; | ||||
|  | ||||
| /** | ||||
|  * 售后统计 Service 接口 | ||||
|  * | ||||
|  * @author owen | ||||
|  */ | ||||
| public interface AfterSaleStatisticsService { | ||||
|  | ||||
|     /** | ||||
|      * 获取售后单统计 | ||||
|      * | ||||
|      * @param beginTime 起始时间 | ||||
|      * @param endTime   截止时间 | ||||
|      * @return 售后统计结果 | ||||
|      */ | ||||
|     AfterSaleSummaryRespBO getAfterSaleSummary(LocalDateTime beginTime, LocalDateTime endTime); | ||||
|  | ||||
| } | ||||
| @@ -0,0 +1,28 @@ | ||||
| package cn.iocoder.yudao.module.statistics.service.trade; | ||||
|  | ||||
| import cn.iocoder.yudao.module.statistics.dal.mysql.trade.AfterSaleStatisticsMapper; | ||||
| import cn.iocoder.yudao.module.statistics.service.trade.bo.AfterSaleSummaryRespBO; | ||||
| import org.springframework.stereotype.Service; | ||||
| import org.springframework.validation.annotation.Validated; | ||||
|  | ||||
| import javax.annotation.Resource; | ||||
| import java.time.LocalDateTime; | ||||
|  | ||||
| /** | ||||
|  * 售后统计 Service 实现类 | ||||
|  * | ||||
|  * @author owen | ||||
|  */ | ||||
| @Service | ||||
| @Validated | ||||
| public class AfterSaleStatisticsServiceImpl implements AfterSaleStatisticsService { | ||||
|  | ||||
|     @Resource | ||||
|     private AfterSaleStatisticsMapper afterSaleStatisticsMapper; | ||||
|  | ||||
|     @Override | ||||
|     public AfterSaleSummaryRespBO getAfterSaleSummary(LocalDateTime beginTime, LocalDateTime endTime) { | ||||
|         return afterSaleStatisticsMapper.selectSummaryByRefundTimeBetween(beginTime, endTime); | ||||
|     } | ||||
|  | ||||
| } | ||||
| @@ -0,0 +1,21 @@ | ||||
| package cn.iocoder.yudao.module.statistics.service.trade; | ||||
|  | ||||
| import java.time.LocalDateTime; | ||||
|  | ||||
| /** | ||||
|  * 分销统计 Service 接口 | ||||
|  * | ||||
|  * @author owen | ||||
|  */ | ||||
| public interface BrokerageStatisticsService { | ||||
|  | ||||
|     /** | ||||
|      * 获取已结算的佣金金额 | ||||
|      * | ||||
|      * @param beginTime 起始时间 | ||||
|      * @param endTime   截止时间 | ||||
|      * @return 已结算的佣金金额 | ||||
|      */ | ||||
|     Integer getBrokerageSettlementPriceSummary(LocalDateTime beginTime, LocalDateTime endTime); | ||||
|  | ||||
| } | ||||
| @@ -0,0 +1,31 @@ | ||||
| package cn.iocoder.yudao.module.statistics.service.trade; | ||||
|  | ||||
| import cn.iocoder.yudao.module.statistics.dal.mysql.trade.BrokerageStatisticsMapper; | ||||
| import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageRecordBizTypeEnum; | ||||
| import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageRecordStatusEnum; | ||||
| import org.springframework.stereotype.Service; | ||||
| import org.springframework.validation.annotation.Validated; | ||||
|  | ||||
| import javax.annotation.Resource; | ||||
| import java.time.LocalDateTime; | ||||
|  | ||||
| /** | ||||
|  * 分销统计 Service 实现类 | ||||
|  * | ||||
|  * @author owen | ||||
|  */ | ||||
| @Service | ||||
| @Validated | ||||
| public class BrokerageStatisticsServiceImpl implements BrokerageStatisticsService { | ||||
|  | ||||
|     @Resource | ||||
|     private BrokerageStatisticsMapper brokerageStatisticsMapper; | ||||
|  | ||||
|     @Override | ||||
|     public Integer getBrokerageSettlementPriceSummary(LocalDateTime beginTime, LocalDateTime endTime) { | ||||
|         return brokerageStatisticsMapper.selectSummaryPriceByStatusAndUnfreezeTimeBetween( | ||||
|                 BrokerageRecordBizTypeEnum.ORDER.getType(), BrokerageRecordStatusEnum.SETTLEMENT.getStatus(), | ||||
|                 beginTime, endTime); | ||||
|     } | ||||
|  | ||||
| } | ||||
| @@ -0,0 +1,23 @@ | ||||
| package cn.iocoder.yudao.module.statistics.service.trade; | ||||
|  | ||||
| import cn.iocoder.yudao.module.statistics.service.trade.bo.WalletSummaryRespBO; | ||||
|  | ||||
| import java.time.LocalDateTime; | ||||
|  | ||||
| /** | ||||
|  * 钱包统计 Service 接口 | ||||
|  * | ||||
|  * @author owen | ||||
|  */ | ||||
| public interface PayWalletStatisticsService { | ||||
|  | ||||
|     /** | ||||
|      * 获取钱包统计 | ||||
|      * | ||||
|      * @param beginTime 起始时间 | ||||
|      * @param endTime   截止时间 | ||||
|      * @return 钱包统计 | ||||
|      */ | ||||
|     WalletSummaryRespBO getWalletSummary(LocalDateTime beginTime, LocalDateTime endTime); | ||||
|  | ||||
| } | ||||
| @@ -0,0 +1,41 @@ | ||||
| package cn.iocoder.yudao.module.statistics.service.trade; | ||||
|  | ||||
| import cn.iocoder.yudao.module.statistics.service.trade.bo.WalletSummaryRespBO; | ||||
| import cn.iocoder.yudao.module.pay.enums.member.PayWalletBizTypeEnum; | ||||
| import cn.iocoder.yudao.module.pay.enums.refund.PayRefundStatusEnum; | ||||
| import cn.iocoder.yudao.module.statistics.dal.mysql.trade.PayWalletStatisticsMapper; | ||||
| import org.springframework.stereotype.Service; | ||||
| import org.springframework.validation.annotation.Validated; | ||||
|  | ||||
| import javax.annotation.Resource; | ||||
| import java.time.LocalDateTime; | ||||
|  | ||||
| /** | ||||
|  * 钱包统计 Service 实现类 | ||||
|  * | ||||
|  * @author owen | ||||
|  */ | ||||
| @Service | ||||
| @Validated | ||||
| public class PayWalletStatisticsServiceImpl implements PayWalletStatisticsService { | ||||
|  | ||||
|     @Resource | ||||
|     private PayWalletStatisticsMapper payWalletStatisticsMapper; | ||||
|  | ||||
|     @Override | ||||
|     public WalletSummaryRespBO getWalletSummary(LocalDateTime beginTime, LocalDateTime endTime) { | ||||
|         WalletSummaryRespBO paySummary = payWalletStatisticsMapper.selectRechargeSummaryByPayTimeBetween( | ||||
|                 beginTime, endTime, true); | ||||
|         WalletSummaryRespBO refundSummary = payWalletStatisticsMapper.selectRechargeSummaryByRefundTimeBetween( | ||||
|                 beginTime, endTime, PayRefundStatusEnum.SUCCESS.getStatus()); | ||||
|         Integer walletPayPrice = payWalletStatisticsMapper.selectPriceSummaryByBizTypeAndCreateTimeBetween( | ||||
|                 beginTime, endTime, PayWalletBizTypeEnum.PAYMENT.getType()); | ||||
|  | ||||
|         paySummary.setOrderWalletPayPrice(walletPayPrice); | ||||
|         paySummary.setRechargeRefundCount(refundSummary.getRechargeRefundCount()); | ||||
|         paySummary.setRechargeRefundPrice(refundSummary.getRechargeRefundPrice()); | ||||
|  | ||||
|         return paySummary; | ||||
|     } | ||||
|  | ||||
| } | ||||
| @@ -0,0 +1,23 @@ | ||||
| package cn.iocoder.yudao.module.statistics.service.trade; | ||||
|  | ||||
| import cn.iocoder.yudao.module.statistics.service.trade.bo.TradeOrderSummaryRespBO; | ||||
|  | ||||
| import java.time.LocalDateTime; | ||||
|  | ||||
| /** | ||||
|  * 交易订单统计 Service 接口 | ||||
|  * | ||||
|  * @author owen | ||||
|  */ | ||||
| public interface TradeOrderStatisticsService { | ||||
|  | ||||
|     /** | ||||
|      * 获取订单统计 | ||||
|      * | ||||
|      * @param beginTime 起始时间 | ||||
|      * @param endTime   截止时间 | ||||
|      * @return 订单统计结果 | ||||
|      */ | ||||
|     TradeOrderSummaryRespBO getOrderSummary(LocalDateTime beginTime, LocalDateTime endTime); | ||||
|  | ||||
| } | ||||
| @@ -0,0 +1,28 @@ | ||||
| package cn.iocoder.yudao.module.statistics.service.trade; | ||||
|  | ||||
| import cn.iocoder.yudao.module.statistics.dal.mysql.trade.TradeOrderStatisticsMapper; | ||||
| import cn.iocoder.yudao.module.statistics.service.trade.bo.TradeOrderSummaryRespBO; | ||||
| import org.springframework.stereotype.Service; | ||||
| import org.springframework.validation.annotation.Validated; | ||||
|  | ||||
| import javax.annotation.Resource; | ||||
| import java.time.LocalDateTime; | ||||
|  | ||||
| /** | ||||
|  * 交易订单统计 Service 实现类 | ||||
|  * | ||||
|  * @author owen | ||||
|  */ | ||||
| @Service | ||||
| @Validated | ||||
| public class TradeOrderStatisticsServiceImpl implements TradeOrderStatisticsService { | ||||
|  | ||||
|     @Resource | ||||
|     private TradeOrderStatisticsMapper tradeOrderStatisticsMapper; | ||||
|  | ||||
|     @Override | ||||
|     public TradeOrderSummaryRespBO getOrderSummary(LocalDateTime beginTime, LocalDateTime endTime) { | ||||
|         return tradeOrderStatisticsMapper.selectSummaryByPayTimeBetween(beginTime, endTime); | ||||
|     } | ||||
|  | ||||
| } | ||||
| @@ -2,8 +2,7 @@ package cn.iocoder.yudao.module.statistics.service.trade; | ||||
|  | ||||
| import cn.hutool.core.date.LocalDateTimeUtil; | ||||
| import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils; | ||||
| import cn.iocoder.yudao.module.pay.api.wallet.PayWalletApi; | ||||
| import cn.iocoder.yudao.module.pay.api.wallet.dto.WalletSummaryRespDTO; | ||||
| import cn.iocoder.yudao.module.statistics.service.trade.bo.WalletSummaryRespBO; | ||||
| import cn.iocoder.yudao.module.statistics.controller.admin.trade.vo.TradeStatisticsComparisonRespVO; | ||||
| import cn.iocoder.yudao.module.statistics.controller.admin.trade.vo.TradeSummaryRespVO; | ||||
| import cn.iocoder.yudao.module.statistics.controller.admin.trade.vo.TradeTrendSummaryRespVO; | ||||
| @@ -11,11 +10,8 @@ import cn.iocoder.yudao.module.statistics.convert.trade.TradeStatisticsConvert; | ||||
| import cn.iocoder.yudao.module.statistics.dal.dataobject.trade.TradeStatisticsDO; | ||||
| import cn.iocoder.yudao.module.statistics.dal.mysql.trade.TradeStatisticsMapper; | ||||
| import cn.iocoder.yudao.module.statistics.service.trade.bo.TradeSummaryRespBO; | ||||
| import cn.iocoder.yudao.module.trade.api.aftersale.TradeAfterSaleApi; | ||||
| import cn.iocoder.yudao.module.trade.api.aftersale.dto.AfterSaleSummaryRespDTO; | ||||
| import cn.iocoder.yudao.module.trade.api.brokerage.TradeBrokerageApi; | ||||
| import cn.iocoder.yudao.module.trade.api.order.TradeOrderApi; | ||||
| import cn.iocoder.yudao.module.trade.api.order.dto.TradeOrderSummaryRespDTO; | ||||
| import cn.iocoder.yudao.module.statistics.service.trade.bo.AfterSaleSummaryRespBO; | ||||
| import cn.iocoder.yudao.module.statistics.service.trade.bo.TradeOrderSummaryRespBO; | ||||
| import org.springframework.stereotype.Service; | ||||
| import org.springframework.util.StopWatch; | ||||
| import org.springframework.validation.annotation.Validated; | ||||
| @@ -37,18 +33,14 @@ public class TradeStatisticsServiceImpl implements TradeStatisticsService { | ||||
|     @Resource | ||||
|     private TradeStatisticsMapper tradeStatisticsMapper; | ||||
|  | ||||
|     // TODO @疯狂:统计逻辑,自己服务 mapper 去统计,不要调用其它服务 API; | ||||
|     // 主要的考虑点,其它服务是在线的业务,统计是离线业务,尽量不占用他们的 db 资源; | ||||
|     // 统计服务,从建议使用从库,或者从 mysql 抽取到单独的 clickhouse 或者其它的大数据组件; | ||||
|  | ||||
|     @Resource | ||||
|     private TradeOrderApi tradeOrderApi; | ||||
|     private TradeOrderStatisticsService tradeOrderStatisticsService; | ||||
|     @Resource | ||||
|     private TradeAfterSaleApi tradeAfterSaleApi; | ||||
|     private AfterSaleStatisticsService afterSaleStatisticsService; | ||||
|     @Resource | ||||
|     private TradeBrokerageApi tradeBrokerageApi; | ||||
|     private BrokerageStatisticsService brokerageStatisticsService; | ||||
|     @Resource | ||||
|     private PayWalletApi payWalletApi; | ||||
|     private PayWalletStatisticsService payWalletStatisticsService; | ||||
|  | ||||
|     @Override | ||||
|     public TradeStatisticsComparisonRespVO<TradeSummaryRespVO> getTradeSummaryComparison() { | ||||
| @@ -90,19 +82,19 @@ public class TradeStatisticsServiceImpl implements TradeStatisticsService { | ||||
|         // 统计 | ||||
|         StopWatch stopWatch = new StopWatch("交易统计"); | ||||
|         stopWatch.start("统计订单"); | ||||
|         TradeOrderSummaryRespDTO orderSummary = tradeOrderApi.getOrderSummary(beginTime, endTime); | ||||
|         TradeOrderSummaryRespBO orderSummary = tradeOrderStatisticsService.getOrderSummary(beginTime, endTime); | ||||
|         stopWatch.stop(); | ||||
|  | ||||
|         stopWatch.start("统计售后"); | ||||
|         AfterSaleSummaryRespDTO afterSaleSummary = tradeAfterSaleApi.getAfterSaleSummary(beginTime, endTime); | ||||
|         AfterSaleSummaryRespBO afterSaleSummary = afterSaleStatisticsService.getAfterSaleSummary(beginTime, endTime); | ||||
|         stopWatch.stop(); | ||||
|  | ||||
|         stopWatch.start("统计佣金"); | ||||
|         Integer brokerageSettlementPrice = tradeBrokerageApi.getBrokerageSettlementPriceSummary(beginTime, endTime); | ||||
|         Integer brokerageSettlementPrice = brokerageStatisticsService.getBrokerageSettlementPriceSummary(beginTime, endTime); | ||||
|         stopWatch.stop(); | ||||
|  | ||||
|         stopWatch.start("统计充值"); | ||||
|         WalletSummaryRespDTO walletSummary = payWalletApi.getWalletSummary(beginTime, endTime); | ||||
|         WalletSummaryRespBO walletSummary = payWalletStatisticsService.getWalletSummary(beginTime, endTime); | ||||
|         stopWatch.stop(); | ||||
|         // 插入数据 | ||||
|         TradeStatisticsDO entity = TradeStatisticsConvert.INSTANCE.convert(yesterday, orderSummary, afterSaleSummary, brokerageSettlementPrice, walletSummary); | ||||
|   | ||||
| @@ -0,0 +1,22 @@ | ||||
| package cn.iocoder.yudao.module.statistics.service.trade.bo; | ||||
|  | ||||
| import lombok.Data; | ||||
|  | ||||
| /** | ||||
|  * 售后统计 Response DTO | ||||
|  * | ||||
|  * @author owen | ||||
|  */ | ||||
| @Data | ||||
| public class AfterSaleSummaryRespBO { | ||||
|  | ||||
|     /** | ||||
|      * 退款订单数 | ||||
|      */ | ||||
|     private Integer afterSaleCount; | ||||
|     /** | ||||
|      * 总退款金额,单位:分 | ||||
|      */ | ||||
|     private Integer afterSaleRefundPrice; | ||||
|  | ||||
| } | ||||
| @@ -0,0 +1,26 @@ | ||||
| package cn.iocoder.yudao.module.statistics.service.trade.bo; | ||||
|  | ||||
| import lombok.Data; | ||||
|  | ||||
| /** | ||||
|  * 订单统计 Response BO | ||||
|  * | ||||
|  * @author owen | ||||
|  */ | ||||
| @Data | ||||
| public class TradeOrderSummaryRespBO { | ||||
|  | ||||
|     /** | ||||
|      * 创建订单数 | ||||
|      */ | ||||
|     private Long orderCreateCount; | ||||
|     /** | ||||
|      * 支付订单商品数 | ||||
|      */ | ||||
|     private Integer orderPayCount; | ||||
|     /** | ||||
|      * 总支付金额,单位:分 | ||||
|      */ | ||||
|     private Integer orderPayPrice; | ||||
|  | ||||
| } | ||||
| @@ -0,0 +1,34 @@ | ||||
| package cn.iocoder.yudao.module.statistics.service.trade.bo; | ||||
|  | ||||
| import lombok.Data; | ||||
|  | ||||
| /** | ||||
|  * 钱包统计 Response DTO | ||||
|  * | ||||
|  * @author owen | ||||
|  */ | ||||
| @Data | ||||
| public class WalletSummaryRespBO { | ||||
|     /** | ||||
|      * 总支付金额(余额),单位:分 | ||||
|      */ | ||||
|     private Integer orderWalletPayPrice; | ||||
|  | ||||
|     /** | ||||
|      * 充值订单数 | ||||
|      */ | ||||
|     private Integer rechargePayCount; | ||||
|     /** | ||||
|      * 充值金额,单位:分 | ||||
|      */ | ||||
|     private Integer rechargePayPrice; | ||||
|     /** | ||||
|      * 充值退款订单数 | ||||
|      */ | ||||
|     private Integer rechargeRefundCount; | ||||
|     /** | ||||
|      * 充值退款金额,单位:分 | ||||
|      */ | ||||
|     private Integer rechargeRefundPrice; | ||||
|  | ||||
| } | ||||
| @@ -0,0 +1,12 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||||
| <mapper namespace="cn.iocoder.yudao.module.statistics.dal.mysql.trade.AfterSaleStatisticsMapper"> | ||||
|     <select id="selectSummaryByRefundTimeBetween" | ||||
|             resultType="cn.iocoder.yudao.module.statistics.service.trade.bo.AfterSaleSummaryRespBO"> | ||||
|         SELECT COUNT(1)          AS afterSaleCount, | ||||
|                SUM(refund_price) AS afterSaleRefundPrice | ||||
|         FROM trade_after_sale | ||||
|         WHERE deleted = FALSE | ||||
|           AND refund_time BETWEEN #{beginTime} AND #{endTime} | ||||
|     </select> | ||||
| </mapper> | ||||
| @@ -0,0 +1,12 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||||
| <mapper namespace="cn.iocoder.yudao.module.statistics.dal.mysql.trade.BrokerageStatisticsMapper"> | ||||
|     <select id="selectSummaryPriceByStatusAndUnfreezeTimeBetween" resultType="java.lang.Integer"> | ||||
|         SELECT SUM(price) | ||||
|         FROM trade_brokerage_record | ||||
|         WHERE biz_type = #{bizType} | ||||
|           AND status = #{status} | ||||
|           AND deleted = FALSE | ||||
|           AND unfreeze_time BETWEEN #{beginTime} AND #{endTime} | ||||
|     </select> | ||||
| </mapper> | ||||
| @@ -0,0 +1,31 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||||
| <mapper namespace="cn.iocoder.yudao.module.statistics.dal.mysql.trade.PayWalletStatisticsMapper"> | ||||
|     <select id="selectRechargeSummaryByPayTimeBetween" | ||||
|             resultType="cn.iocoder.yudao.module.statistics.service.trade.bo.WalletSummaryRespBO"> | ||||
|         SELECT COUNT(1)       AS rechargePayCount, | ||||
|                SUM(pay_price) AS rechargePayPrice | ||||
|         FROM pay_wallet_recharge | ||||
|         WHERE pay_status = #{payStatus} | ||||
|           AND deleted = FALSE | ||||
|           AND pay_time BETWEEN #{beginTime} AND #{endTime} | ||||
|     </select> | ||||
|  | ||||
|     <select id="selectRechargeSummaryByRefundTimeBetween" | ||||
|             resultType="cn.iocoder.yudao.module.statistics.service.trade.bo.WalletSummaryRespBO"> | ||||
|         SELECT COUNT(1)       AS rechargeRefundCount, | ||||
|                SUM(pay_price) AS rechargeRefundPrice | ||||
|         FROM pay_wallet_recharge | ||||
|         WHERE refund_status = #{refundStatus} | ||||
|           AND deleted = FALSE | ||||
|           AND refund_time BETWEEN #{beginTime} AND #{endTime} | ||||
|     </select> | ||||
|  | ||||
|     <select id="selectPriceSummaryByBizTypeAndCreateTimeBetween" resultType="java.lang.Integer"> | ||||
|         SELECT SUM(price) | ||||
|         FROM pay_wallet_transaction | ||||
|         WHERE biz_type = #{bizType} | ||||
|           AND deleted = FALSE | ||||
|           AND create_time BETWEEN #{beginTime} AND #{endTime} | ||||
|     </select> | ||||
| </mapper> | ||||
| @@ -0,0 +1,16 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||||
| <mapper namespace="cn.iocoder.yudao.module.statistics.dal.mysql.trade.TradeOrderStatisticsMapper"> | ||||
|     <select id="selectSummaryByPayTimeBetween" | ||||
|             resultType="cn.iocoder.yudao.module.statistics.service.trade.bo.TradeOrderSummaryRespBO"> | ||||
|         SELECT COUNT(1)                                                AS orderPayCount, | ||||
|                SUM(pay_price)                                          AS orderPayPrice, | ||||
|                (SELECT COUNT(1) | ||||
|                 FROM trade_order | ||||
|                 WHERE deleted = FALSE | ||||
|                   AND create_time BETWEEN #{beginTime} AND #{endTime}) AS orderPayPrice | ||||
|         FROM trade_order | ||||
|         WHERE deleted = FALSE | ||||
|           AND pay_time BETWEEN #{beginTime} AND #{endTime} | ||||
|     </select> | ||||
| </mapper> | ||||
		Reference in New Issue
	
	Block a user
	 owen
					owen