统计:交易统计Review修改
This commit is contained in:
parent
5f57cc6247
commit
4f33a0c9c0
|
@ -1,14 +1,14 @@
|
||||||
package cn.iocoder.yudao.module.statistics.convert.trade;
|
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.TradeStatisticsComparisonRespVO;
|
||||||
import cn.iocoder.yudao.module.statistics.controller.admin.trade.vo.TradeSummaryRespVO;
|
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.TradeTrendSummaryExcelVO;
|
||||||
import cn.iocoder.yudao.module.statistics.controller.admin.trade.vo.TradeTrendSummaryRespVO;
|
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.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.statistics.service.trade.bo.TradeSummaryRespBO;
|
||||||
import cn.iocoder.yudao.module.trade.api.aftersale.dto.AfterSaleSummaryRespDTO;
|
import cn.iocoder.yudao.module.statistics.service.trade.bo.AfterSaleSummaryRespBO;
|
||||||
import cn.iocoder.yudao.module.trade.api.order.dto.TradeOrderSummaryRespDTO;
|
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
@ -46,8 +46,8 @@ public interface TradeStatisticsConvert {
|
||||||
|
|
||||||
List<TradeTrendSummaryExcelVO> convertList02(List<TradeTrendSummaryRespVO> list);
|
List<TradeTrendSummaryExcelVO> convertList02(List<TradeTrendSummaryRespVO> list);
|
||||||
|
|
||||||
TradeStatisticsDO convert(LocalDateTime time, TradeOrderSummaryRespDTO orderSummary,
|
TradeStatisticsDO convert(LocalDateTime time, TradeOrderSummaryRespBO orderSummary,
|
||||||
AfterSaleSummaryRespDTO afterSaleSummary, Integer brokerageSettlementPrice,
|
AfterSaleSummaryRespBO afterSaleSummary, Integer brokerageSettlementPrice,
|
||||||
WalletSummaryRespDTO walletSummary);
|
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.hutool.core.date.LocalDateTimeUtil;
|
||||||
import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils;
|
import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils;
|
||||||
import cn.iocoder.yudao.module.pay.api.wallet.PayWalletApi;
|
import cn.iocoder.yudao.module.statistics.service.trade.bo.WalletSummaryRespBO;
|
||||||
import cn.iocoder.yudao.module.pay.api.wallet.dto.WalletSummaryRespDTO;
|
|
||||||
import cn.iocoder.yudao.module.statistics.controller.admin.trade.vo.TradeStatisticsComparisonRespVO;
|
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.TradeSummaryRespVO;
|
||||||
import cn.iocoder.yudao.module.statistics.controller.admin.trade.vo.TradeTrendSummaryRespVO;
|
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.dataobject.trade.TradeStatisticsDO;
|
||||||
import cn.iocoder.yudao.module.statistics.dal.mysql.trade.TradeStatisticsMapper;
|
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.statistics.service.trade.bo.TradeSummaryRespBO;
|
||||||
import cn.iocoder.yudao.module.trade.api.aftersale.TradeAfterSaleApi;
|
import cn.iocoder.yudao.module.statistics.service.trade.bo.AfterSaleSummaryRespBO;
|
||||||
import cn.iocoder.yudao.module.trade.api.aftersale.dto.AfterSaleSummaryRespDTO;
|
import cn.iocoder.yudao.module.statistics.service.trade.bo.TradeOrderSummaryRespBO;
|
||||||
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 org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.StopWatch;
|
import org.springframework.util.StopWatch;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
@ -37,18 +33,14 @@ public class TradeStatisticsServiceImpl implements TradeStatisticsService {
|
||||||
@Resource
|
@Resource
|
||||||
private TradeStatisticsMapper tradeStatisticsMapper;
|
private TradeStatisticsMapper tradeStatisticsMapper;
|
||||||
|
|
||||||
// TODO @疯狂:统计逻辑,自己服务 mapper 去统计,不要调用其它服务 API;
|
|
||||||
// 主要的考虑点,其它服务是在线的业务,统计是离线业务,尽量不占用他们的 db 资源;
|
|
||||||
// 统计服务,从建议使用从库,或者从 mysql 抽取到单独的 clickhouse 或者其它的大数据组件;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private TradeOrderApi tradeOrderApi;
|
private TradeOrderStatisticsService tradeOrderStatisticsService;
|
||||||
@Resource
|
@Resource
|
||||||
private TradeAfterSaleApi tradeAfterSaleApi;
|
private AfterSaleStatisticsService afterSaleStatisticsService;
|
||||||
@Resource
|
@Resource
|
||||||
private TradeBrokerageApi tradeBrokerageApi;
|
private BrokerageStatisticsService brokerageStatisticsService;
|
||||||
@Resource
|
@Resource
|
||||||
private PayWalletApi payWalletApi;
|
private PayWalletStatisticsService payWalletStatisticsService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TradeStatisticsComparisonRespVO<TradeSummaryRespVO> getTradeSummaryComparison() {
|
public TradeStatisticsComparisonRespVO<TradeSummaryRespVO> getTradeSummaryComparison() {
|
||||||
|
@ -90,19 +82,19 @@ public class TradeStatisticsServiceImpl implements TradeStatisticsService {
|
||||||
// 统计
|
// 统计
|
||||||
StopWatch stopWatch = new StopWatch("交易统计");
|
StopWatch stopWatch = new StopWatch("交易统计");
|
||||||
stopWatch.start("统计订单");
|
stopWatch.start("统计订单");
|
||||||
TradeOrderSummaryRespDTO orderSummary = tradeOrderApi.getOrderSummary(beginTime, endTime);
|
TradeOrderSummaryRespBO orderSummary = tradeOrderStatisticsService.getOrderSummary(beginTime, endTime);
|
||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
|
|
||||||
stopWatch.start("统计售后");
|
stopWatch.start("统计售后");
|
||||||
AfterSaleSummaryRespDTO afterSaleSummary = tradeAfterSaleApi.getAfterSaleSummary(beginTime, endTime);
|
AfterSaleSummaryRespBO afterSaleSummary = afterSaleStatisticsService.getAfterSaleSummary(beginTime, endTime);
|
||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
|
|
||||||
stopWatch.start("统计佣金");
|
stopWatch.start("统计佣金");
|
||||||
Integer brokerageSettlementPrice = tradeBrokerageApi.getBrokerageSettlementPriceSummary(beginTime, endTime);
|
Integer brokerageSettlementPrice = brokerageStatisticsService.getBrokerageSettlementPriceSummary(beginTime, endTime);
|
||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
|
|
||||||
stopWatch.start("统计充值");
|
stopWatch.start("统计充值");
|
||||||
WalletSummaryRespDTO walletSummary = payWalletApi.getWalletSummary(beginTime, endTime);
|
WalletSummaryRespBO walletSummary = payWalletStatisticsService.getWalletSummary(beginTime, endTime);
|
||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
// 插入数据
|
// 插入数据
|
||||||
TradeStatisticsDO entity = TradeStatisticsConvert.INSTANCE.convert(yesterday, orderSummary, afterSaleSummary, brokerageSettlementPrice, walletSummary);
|
TradeStatisticsDO entity = TradeStatisticsConvert.INSTANCE.convert(yesterday, orderSummary, afterSaleSummary, brokerageSettlementPrice, walletSummary);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package cn.iocoder.yudao.module.trade.api.aftersale.dto;
|
package cn.iocoder.yudao.module.statistics.service.trade.bo;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import lombok.Data;
|
||||||
* @author owen
|
* @author owen
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class AfterSaleSummaryRespDTO {
|
public class AfterSaleSummaryRespBO {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 退款订单数
|
* 退款订单数
|
|
@ -1,14 +1,14 @@
|
||||||
package cn.iocoder.yudao.module.trade.api.order.dto;
|
package cn.iocoder.yudao.module.statistics.service.trade.bo;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单统计 Response DTO
|
* 订单统计 Response BO
|
||||||
*
|
*
|
||||||
* @author owen
|
* @author owen
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class TradeOrderSummaryRespDTO {
|
public class TradeOrderSummaryRespBO {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建订单数
|
* 创建订单数
|
|
@ -1,4 +1,4 @@
|
||||||
package cn.iocoder.yudao.module.pay.api.wallet.dto;
|
package cn.iocoder.yudao.module.statistics.service.trade.bo;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import lombok.Data;
|
||||||
* @author owen
|
* @author owen
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class WalletSummaryRespDTO {
|
public class WalletSummaryRespBO {
|
||||||
/**
|
/**
|
||||||
* 总支付金额(余额),单位:分
|
* 总支付金额(余额),单位:分
|
||||||
*/
|
*/
|
|
@ -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>
|
|
@ -1,9 +1,5 @@
|
||||||
package cn.iocoder.yudao.module.trade.api.aftersale;
|
package cn.iocoder.yudao.module.trade.api.aftersale;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.trade.api.aftersale.dto.AfterSaleSummaryRespDTO;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 售后 API 接口
|
* 售后 API 接口
|
||||||
*
|
*
|
||||||
|
@ -11,13 +7,4 @@ import java.time.LocalDateTime;
|
||||||
*/
|
*/
|
||||||
public interface TradeAfterSaleApi {
|
public interface TradeAfterSaleApi {
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取售后单统计
|
|
||||||
*
|
|
||||||
* @param beginTime 起始时间
|
|
||||||
* @param endTime 截止时间
|
|
||||||
* @return 售后统计结果
|
|
||||||
*/
|
|
||||||
AfterSaleSummaryRespDTO getAfterSaleSummary(LocalDateTime beginTime, LocalDateTime endTime);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package cn.iocoder.yudao.module.trade.api.brokerage;
|
package cn.iocoder.yudao.module.trade.api.brokerage;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分销 API 接口
|
* 分销 API 接口
|
||||||
*
|
*
|
||||||
|
@ -9,13 +7,4 @@ import java.time.LocalDateTime;
|
||||||
*/
|
*/
|
||||||
public interface TradeBrokerageApi {
|
public interface TradeBrokerageApi {
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取已结算的佣金金额
|
|
||||||
*
|
|
||||||
* @param beginTime 起始时间
|
|
||||||
* @param endTime 截止时间
|
|
||||||
* @return 已结算的佣金金额
|
|
||||||
*/
|
|
||||||
Integer getBrokerageSettlementPriceSummary(LocalDateTime beginTime, LocalDateTime endTime);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
package cn.iocoder.yudao.module.trade.api.order;
|
package cn.iocoder.yudao.module.trade.api.order;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.trade.api.order.dto.TradeOrderRespDTO;
|
import cn.iocoder.yudao.module.trade.api.order.dto.TradeOrderRespDTO;
|
||||||
import cn.iocoder.yudao.module.trade.api.order.dto.TradeOrderSummaryRespDTO;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -31,13 +29,4 @@ public interface TradeOrderApi {
|
||||||
*/
|
*/
|
||||||
Integer getOrderStatus(Long id);
|
Integer getOrderStatus(Long id);
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取订单统计
|
|
||||||
*
|
|
||||||
* @param beginTime 起始时间
|
|
||||||
* @param endTime 截止时间
|
|
||||||
* @return 订单统计结果
|
|
||||||
*/
|
|
||||||
TradeOrderSummaryRespDTO getOrderSummary(LocalDateTime beginTime, LocalDateTime endTime);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
package cn.iocoder.yudao.module.trade.api.aftersale;
|
package cn.iocoder.yudao.module.trade.api.aftersale;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.trade.api.aftersale.dto.AfterSaleSummaryRespDTO;
|
|
||||||
import cn.iocoder.yudao.module.trade.service.aftersale.AfterSaleService;
|
import cn.iocoder.yudao.module.trade.service.aftersale.AfterSaleService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 售后 API 接口实现类
|
* 售后 API 接口实现类
|
||||||
|
@ -20,9 +18,4 @@ public class TradeAfterSaleApiImpl implements TradeAfterSaleApi {
|
||||||
@Resource
|
@Resource
|
||||||
private AfterSaleService afterSaleService;
|
private AfterSaleService afterSaleService;
|
||||||
|
|
||||||
@Override
|
|
||||||
public AfterSaleSummaryRespDTO getAfterSaleSummary(LocalDateTime beginTime, LocalDateTime endTime) {
|
|
||||||
return afterSaleService.getAfterSaleSummary(beginTime, endTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ import org.springframework.stereotype.Service;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单 API 接口实现类
|
* 订单 API 接口实现类
|
||||||
|
@ -19,9 +18,4 @@ public class TradeBrokerageApiImpl implements TradeBrokerageApi {
|
||||||
@Resource
|
@Resource
|
||||||
private BrokerageRecordService brokerageRecordService;
|
private BrokerageRecordService brokerageRecordService;
|
||||||
|
|
||||||
@Override
|
|
||||||
public Integer getBrokerageSettlementPriceSummary(LocalDateTime beginTime, LocalDateTime endTime) {
|
|
||||||
return brokerageRecordService.getBrokerageSettlementPriceSummary(beginTime, endTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package cn.iocoder.yudao.module.trade.api.order;
|
package cn.iocoder.yudao.module.trade.api.order;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.trade.api.order.dto.TradeOrderRespDTO;
|
import cn.iocoder.yudao.module.trade.api.order.dto.TradeOrderRespDTO;
|
||||||
import cn.iocoder.yudao.module.trade.api.order.dto.TradeOrderSummaryRespDTO;
|
|
||||||
import cn.iocoder.yudao.module.trade.convert.order.TradeOrderConvert;
|
import cn.iocoder.yudao.module.trade.convert.order.TradeOrderConvert;
|
||||||
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
|
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
|
||||||
import cn.iocoder.yudao.module.trade.service.order.TradeOrderQueryService;
|
import cn.iocoder.yudao.module.trade.service.order.TradeOrderQueryService;
|
||||||
|
@ -9,8 +8,6 @@ import org.springframework.stereotype.Service;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -43,9 +40,4 @@ public class TradeOrderApiImpl implements TradeOrderApi {
|
||||||
return order.getStatus();
|
return order.getStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TradeOrderSummaryRespDTO getOrderSummary(LocalDateTime beginTime, LocalDateTime endTime) {
|
|
||||||
return tradeOrderQueryService.getOrderSummary(beginTime, endTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,14 @@
|
||||||
package cn.iocoder.yudao.module.trade.dal.mysql.aftersale;
|
package cn.iocoder.yudao.module.trade.dal.mysql.aftersale;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import cn.iocoder.yudao.module.trade.api.aftersale.dto.AfterSaleSummaryRespDTO;
|
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.AfterSalePageReqVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.AfterSalePageReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.dal.dataobject.aftersale.AfterSaleDO;
|
import cn.iocoder.yudao.module.trade.dal.dataobject.aftersale.AfterSaleDO;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.github.yulichang.toolkit.MPJWrappers;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
|
@ -53,12 +48,4 @@ public interface AfterSaleMapper extends BaseMapperX<AfterSaleDO> {
|
||||||
.in(AfterSaleDO::getStatus, statuses));
|
.in(AfterSaleDO::getStatus, statuses));
|
||||||
}
|
}
|
||||||
|
|
||||||
default AfterSaleSummaryRespDTO selectSummaryByRefundTimeBetween(LocalDateTime beginTime, LocalDateTime endTime) {
|
|
||||||
return BeanUtil.copyProperties(CollUtil.get(selectMaps(MPJWrappers.<AfterSaleDO>lambdaJoin()
|
|
||||||
.selectCount(AfterSaleDO::getId, AfterSaleSummaryRespDTO::getAfterSaleCount)
|
|
||||||
.selectSum(AfterSaleDO::getRefundPrice, AfterSaleSummaryRespDTO::getAfterSaleRefundPrice)
|
|
||||||
.between(AfterSaleDO::getRefundTime, beginTime, endTime)), 0),
|
|
||||||
AfterSaleSummaryRespDTO.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package cn.iocoder.yudao.module.trade.dal.mysql.brokerage;
|
package cn.iocoder.yudao.module.trade.dal.mysql.brokerage;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import cn.hutool.core.convert.Convert;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
@ -111,13 +109,4 @@ public interface BrokerageRecordMapper extends BaseMapperX<BrokerageRecordDO> {
|
||||||
@Param("beginTime") LocalDateTime beginTime,
|
@Param("beginTime") LocalDateTime beginTime,
|
||||||
@Param("endTime") LocalDateTime endTime);
|
@Param("endTime") LocalDateTime endTime);
|
||||||
|
|
||||||
default Integer selectSummaryPriceByStatusAndUnfreezeTimeBetween(Integer bizType, Integer status,
|
|
||||||
LocalDateTime beginTime, LocalDateTime endTime) {
|
|
||||||
return Convert.toInt(CollUtil.getFirst(selectObjs(MPJWrappers.<BrokerageRecordDO>lambdaJoin()
|
|
||||||
.selectSum(BrokerageRecordDO::getPrice)
|
|
||||||
.eq(BrokerageRecordDO::getBizType, bizType)
|
|
||||||
.eq(BrokerageRecordDO::getStatus, status)
|
|
||||||
.between(BrokerageRecordDO::getUnfreezeTime, beginTime, endTime))), 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,12 @@
|
||||||
package cn.iocoder.yudao.module.trade.dal.mysql.order;
|
package cn.iocoder.yudao.module.trade.dal.mysql.order;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import cn.iocoder.yudao.module.trade.api.order.dto.TradeOrderSummaryRespDTO;
|
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderPageReqVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderPageReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderPageReqVO;
|
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderPageReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
|
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.github.yulichang.toolkit.MPJWrappers;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
@ -93,19 +89,6 @@ public interface TradeOrderMapper extends BaseMapperX<TradeOrderDO> {
|
||||||
.eq(TradeOrderDO::getSeckillActivityId, seckillActivityId));
|
.eq(TradeOrderDO::getSeckillActivityId, seckillActivityId));
|
||||||
}
|
}
|
||||||
|
|
||||||
default TradeOrderSummaryRespDTO selectSummaryByPayTimeBetween(LocalDateTime beginTime, LocalDateTime endTime) {
|
|
||||||
return BeanUtil.copyProperties(CollUtil.get(selectMaps(MPJWrappers.<TradeOrderDO>lambdaJoin()
|
|
||||||
.selectCount(TradeOrderDO::getId, TradeOrderSummaryRespDTO::getOrderPayCount)
|
|
||||||
.selectSum(TradeOrderDO::getPayPrice, TradeOrderSummaryRespDTO::getOrderPayPrice)
|
|
||||||
.between(TradeOrderDO::getPayTime, beginTime, endTime)), 0),
|
|
||||||
TradeOrderSummaryRespDTO.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
default Long selectCountByCreateTimeBetween(LocalDateTime beginTime, LocalDateTime endTime) {
|
|
||||||
return selectCount(new LambdaQueryWrapperX<TradeOrderDO>()
|
|
||||||
.between(TradeOrderDO::getCreateTime, beginTime, endTime));
|
|
||||||
}
|
|
||||||
|
|
||||||
default TradeOrderDO selectOneByPickUpVerifyCode(String pickUpVerifyCode) {
|
default TradeOrderDO selectOneByPickUpVerifyCode(String pickUpVerifyCode) {
|
||||||
return selectOne(TradeOrderDO::getPickUpVerifyCode, pickUpVerifyCode);
|
return selectOne(TradeOrderDO::getPickUpVerifyCode, pickUpVerifyCode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.trade.service.aftersale;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.module.trade.api.aftersale.dto.AfterSaleSummaryRespDTO;
|
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.AfterSaleDisagreeReqVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.AfterSaleDisagreeReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.AfterSalePageReqVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.AfterSalePageReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.AfterSaleRefuseReqVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.AfterSaleRefuseReqVO;
|
||||||
|
@ -10,8 +9,6 @@ import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppAfterSaleCre
|
||||||
import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppAfterSaleDeliveryReqVO;
|
import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppAfterSaleDeliveryReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.dal.dataobject.aftersale.AfterSaleDO;
|
import cn.iocoder.yudao.module.trade.dal.dataobject.aftersale.AfterSaleDO;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 售后订单 Service 接口
|
* 售后订单 Service 接口
|
||||||
*
|
*
|
||||||
|
@ -127,13 +124,4 @@ public interface AfterSaleService {
|
||||||
*/
|
*/
|
||||||
Long getApplyingAfterSaleCount(Long userId);
|
Long getApplyingAfterSaleCount(Long userId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取售后单统计
|
|
||||||
*
|
|
||||||
* @param beginTime 起始时间
|
|
||||||
* @param endTime 截止时间
|
|
||||||
* @return 售后统计结果
|
|
||||||
*/
|
|
||||||
AfterSaleSummaryRespDTO getAfterSaleSummary(LocalDateTime beginTime, LocalDateTime endTime);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
|
import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
|
||||||
import cn.iocoder.yudao.module.pay.api.refund.PayRefundApi;
|
import cn.iocoder.yudao.module.pay.api.refund.PayRefundApi;
|
||||||
import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundCreateReqDTO;
|
import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundCreateReqDTO;
|
||||||
import cn.iocoder.yudao.module.trade.api.aftersale.dto.AfterSaleSummaryRespDTO;
|
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.AfterSaleDisagreeReqVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.AfterSaleDisagreeReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.AfterSalePageReqVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.AfterSalePageReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.AfterSaleRefuseReqVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.AfterSaleRefuseReqVO;
|
||||||
|
@ -411,9 +410,4 @@ public class AfterSaleServiceImpl implements AfterSaleService {
|
||||||
return tradeAfterSaleMapper.selectCountByUserIdAndStatus(userId, AfterSaleStatusEnum.APPLYING_STATUSES);
|
return tradeAfterSaleMapper.selectCountByUserIdAndStatus(userId, AfterSaleStatusEnum.APPLYING_STATUSES);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public AfterSaleSummaryRespDTO getAfterSaleSummary(LocalDateTime beginTime, LocalDateTime endTime) {
|
|
||||||
return tradeAfterSaleMapper.selectSummaryByRefundTimeBetween(beginTime,endTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,13 +156,4 @@ public interface BrokerageRecordService {
|
||||||
*/
|
*/
|
||||||
AppBrokerageProductPriceRespVO calculateProductBrokeragePrice(Long userId, Long spuId);
|
AppBrokerageProductPriceRespVO calculateProductBrokeragePrice(Long userId, Long spuId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取已结算的佣金金额
|
|
||||||
*
|
|
||||||
* @param beginTime 起始时间
|
|
||||||
* @param endTime 截止时间
|
|
||||||
* @return 已结算的佣金金额
|
|
||||||
*/
|
|
||||||
Integer getBrokerageSettlementPriceSummary(LocalDateTime beginTime, LocalDateTime endTime);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -356,13 +356,6 @@ public class BrokerageRecordServiceImpl implements BrokerageRecordService {
|
||||||
return respVO;
|
return respVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Integer getBrokerageSettlementPriceSummary(LocalDateTime beginTime, LocalDateTime endTime) {
|
|
||||||
return brokerageRecordMapper.selectSummaryPriceByStatusAndUnfreezeTimeBetween(
|
|
||||||
BrokerageRecordBizTypeEnum.ORDER.getType(), BrokerageRecordStatusEnum.SETTLEMENT.getStatus(),
|
|
||||||
beginTime, endTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得自身的代理对象,解决 AOP 生效问题
|
* 获得自身的代理对象,解决 AOP 生效问题
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
package cn.iocoder.yudao.module.trade.service.order;
|
package cn.iocoder.yudao.module.trade.service.order;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.module.trade.api.order.dto.TradeOrderSummaryRespDTO;
|
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderPageReqVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderPageReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderPageReqVO;
|
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderPageReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
|
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
|
||||||
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO;
|
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO;
|
||||||
import cn.iocoder.yudao.module.trade.framework.delivery.core.client.dto.ExpressTrackRespDTO;
|
import cn.iocoder.yudao.module.trade.framework.delivery.core.client.dto.ExpressTrackRespDTO;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -95,7 +93,7 @@ public interface TradeOrderQueryService {
|
||||||
/**
|
/**
|
||||||
* 【会员】在指定秒杀活动下,用户购买的商品数量
|
* 【会员】在指定秒杀活动下,用户购买的商品数量
|
||||||
*
|
*
|
||||||
* @param userId 用户编号
|
* @param userId 用户编号
|
||||||
* @param activityId 活动编号
|
* @param activityId 活动编号
|
||||||
* @return 秒杀商品数量
|
* @return 秒杀商品数量
|
||||||
*/
|
*/
|
||||||
|
@ -138,13 +136,4 @@ public interface TradeOrderQueryService {
|
||||||
*/
|
*/
|
||||||
List<TradeOrderItemDO> getOrderItemListByOrderId(Collection<Long> orderIds);
|
List<TradeOrderItemDO> getOrderItemListByOrderId(Collection<Long> orderIds);
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取订单统计
|
|
||||||
*
|
|
||||||
* @param beginTime 起始时间
|
|
||||||
* @param endTime 截止时间
|
|
||||||
* @return 订单统计结果
|
|
||||||
*/
|
|
||||||
TradeOrderSummaryRespDTO getOrderSummary(LocalDateTime beginTime, LocalDateTime endTime);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ import cn.hutool.core.util.StrUtil;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
||||||
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
||||||
import cn.iocoder.yudao.module.trade.api.order.dto.TradeOrderSummaryRespDTO;
|
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderPageReqVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderPageReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderPageReqVO;
|
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderPageReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressDO;
|
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressDO;
|
||||||
|
@ -22,7 +21,6 @@ import cn.iocoder.yudao.module.trade.service.delivery.DeliveryExpressService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
@ -166,13 +164,6 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
|
||||||
.setPhone(order.getReceiverMobile()));
|
.setPhone(order.getReceiverMobile()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TradeOrderSummaryRespDTO getOrderSummary(LocalDateTime beginTime, LocalDateTime endTime) {
|
|
||||||
TradeOrderSummaryRespDTO dto = tradeOrderMapper.selectSummaryByPayTimeBetween(beginTime, endTime);
|
|
||||||
dto.setOrderCreateCount(tradeOrderMapper.selectCountByCreateTimeBetween(beginTime, endTime));
|
|
||||||
return dto;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// =================== Order Item ===================
|
// =================== Order Item ===================
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
package cn.iocoder.yudao.module.pay.api.wallet;
|
package cn.iocoder.yudao.module.pay.api.wallet;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.pay.api.wallet.dto.WalletSummaryRespDTO;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 钱包 API 接口
|
* 钱包 API 接口
|
||||||
*
|
*
|
||||||
|
@ -11,13 +7,4 @@ import java.time.LocalDateTime;
|
||||||
*/
|
*/
|
||||||
public interface PayWalletApi {
|
public interface PayWalletApi {
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取钱包统计
|
|
||||||
*
|
|
||||||
* @param beginTime 起始时间
|
|
||||||
* @param endTime 截止时间
|
|
||||||
* @return 钱包统计
|
|
||||||
*/
|
|
||||||
WalletSummaryRespDTO getWalletSummary(LocalDateTime beginTime, LocalDateTime endTime);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
package cn.iocoder.yudao.module.pay.api.wallet;
|
package cn.iocoder.yudao.module.pay.api.wallet;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.pay.api.wallet.dto.WalletSummaryRespDTO;
|
|
||||||
import cn.iocoder.yudao.module.pay.enums.member.PayWalletBizTypeEnum;
|
|
||||||
import cn.iocoder.yudao.module.pay.service.wallet.PayWalletRechargeService;
|
import cn.iocoder.yudao.module.pay.service.wallet.PayWalletRechargeService;
|
||||||
import cn.iocoder.yudao.module.pay.service.wallet.PayWalletTransactionService;
|
import cn.iocoder.yudao.module.pay.service.wallet.PayWalletTransactionService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 钱包 API 接口实现类
|
* 钱包 API 接口实现类
|
||||||
|
@ -24,11 +21,4 @@ public class PayWalletApiImpl implements PayWalletApi {
|
||||||
@Resource
|
@Resource
|
||||||
private PayWalletTransactionService payWalletTransactionService;
|
private PayWalletTransactionService payWalletTransactionService;
|
||||||
|
|
||||||
@Override
|
|
||||||
public WalletSummaryRespDTO getWalletSummary(LocalDateTime beginTime, LocalDateTime endTime) {
|
|
||||||
WalletSummaryRespDTO walletSummary = payWalletRechargeService.getWalletSummary(beginTime, endTime);
|
|
||||||
walletSummary.setOrderWalletPayPrice(payWalletTransactionService.getPriceSummary(PayWalletBizTypeEnum.PAYMENT, beginTime, endTime));
|
|
||||||
return walletSummary;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,10 @@
|
||||||
package cn.iocoder.yudao.module.pay.dal.mysql.wallet;
|
package cn.iocoder.yudao.module.pay.dal.mysql.wallet;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import cn.iocoder.yudao.module.pay.api.wallet.dto.WalletSummaryRespDTO;
|
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargeDO;
|
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargeDO;
|
||||||
import cn.iocoder.yudao.module.pay.enums.refund.PayRefundStatusEnum;
|
|
||||||
import com.github.yulichang.toolkit.MPJWrappers;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface PayWalletRechargeMapper extends BaseMapperX<PayWalletRechargeDO> {
|
public interface PayWalletRechargeMapper extends BaseMapperX<PayWalletRechargeDO> {
|
||||||
|
|
||||||
|
@ -25,24 +18,6 @@ public interface PayWalletRechargeMapper extends BaseMapperX<PayWalletRechargeDO
|
||||||
.eq(PayWalletRechargeDO::getId, id).eq(PayWalletRechargeDO::getRefundStatus, whereRefundStatus));
|
.eq(PayWalletRechargeDO::getId, id).eq(PayWalletRechargeDO::getRefundStatus, whereRefundStatus));
|
||||||
}
|
}
|
||||||
|
|
||||||
default WalletSummaryRespDTO selectRechargeSummaryByPayTimeBetween(LocalDateTime beginTime, LocalDateTime endTime) {
|
|
||||||
return BeanUtil.copyProperties(CollUtil.get(selectMaps(MPJWrappers.<PayWalletRechargeDO>lambdaJoin()
|
|
||||||
.selectCount(PayWalletRechargeDO::getId, WalletSummaryRespDTO::getRechargePayCount)
|
|
||||||
.selectSum(PayWalletRechargeDO::getPayPrice, WalletSummaryRespDTO::getRechargePayPrice)
|
|
||||||
.eq(PayWalletRechargeDO::getPayStatus, true)
|
|
||||||
.between(PayWalletRechargeDO::getPayTime, beginTime, endTime)), 0),
|
|
||||||
WalletSummaryRespDTO.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
default WalletSummaryRespDTO selectRechargeSummaryByRefundTimeBetween(LocalDateTime beginTime, LocalDateTime endTime) {
|
|
||||||
return BeanUtil.copyProperties(CollUtil.get(selectMaps(MPJWrappers.<PayWalletRechargeDO>lambdaJoin()
|
|
||||||
.selectCount(PayWalletRechargeDO::getId, WalletSummaryRespDTO::getRechargeRefundCount)
|
|
||||||
.selectSum(PayWalletRechargeDO::getRefundPayPrice, WalletSummaryRespDTO::getRechargeRefundPrice)
|
|
||||||
.eq(PayWalletRechargeDO::getRefundStatus, PayRefundStatusEnum.SUCCESS.getStatus())
|
|
||||||
.between(PayWalletRechargeDO::getRefundTime, beginTime, endTime)), 0),
|
|
||||||
WalletSummaryRespDTO.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,12 +6,9 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO;
|
import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO;
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO;
|
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO;
|
||||||
import com.github.yulichang.toolkit.MPJWrappers;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface PayWalletTransactionMapper extends BaseMapperX<PayWalletTransactionDO> {
|
public interface PayWalletTransactionMapper extends BaseMapperX<PayWalletTransactionDO> {
|
||||||
|
@ -38,15 +35,6 @@ public interface PayWalletTransactionMapper extends BaseMapperX<PayWalletTransac
|
||||||
PayWalletTransactionDO::getBizType, bizType);
|
PayWalletTransactionDO::getBizType, bizType);
|
||||||
}
|
}
|
||||||
|
|
||||||
default Integer selectSummaryByBizTypeAndCreateTimeBetween(Integer type, LocalDateTime beginTime, LocalDateTime endTime) {
|
|
||||||
return Optional.ofNullable(selectOne(MPJWrappers.<PayWalletTransactionDO>lambdaJoin()
|
|
||||||
.selectSum(PayWalletTransactionDO::getPrice)
|
|
||||||
.eq(PayWalletTransactionDO::getBizType, type)
|
|
||||||
.between(PayWalletTransactionDO::getCreateTime, beginTime, endTime)))
|
|
||||||
.map(PayWalletTransactionDO::getPrice)
|
|
||||||
.orElse(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
package cn.iocoder.yudao.module.pay.service.wallet;
|
package cn.iocoder.yudao.module.pay.service.wallet;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.pay.api.wallet.dto.WalletSummaryRespDTO;
|
|
||||||
import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge.AppPayWalletRechargeCreateReqVO;
|
import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge.AppPayWalletRechargeCreateReqVO;
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargeDO;
|
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargeDO;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 钱包充值 Service 接口
|
* 钱包充值 Service 接口
|
||||||
*
|
*
|
||||||
|
@ -16,8 +13,8 @@ public interface PayWalletRechargeService {
|
||||||
/**
|
/**
|
||||||
* 创建钱包充值记录(发起充值)
|
* 创建钱包充值记录(发起充值)
|
||||||
*
|
*
|
||||||
* @param userId 用户 id
|
* @param userId 用户 id
|
||||||
* @param userType 用户类型
|
* @param userType 用户类型
|
||||||
* @param createReqVO 钱包充值请求 VO
|
* @param createReqVO 钱包充值请求 VO
|
||||||
* @return 钱包充值记录
|
* @return 钱包充值记录
|
||||||
*/
|
*/
|
||||||
|
@ -27,32 +24,25 @@ public interface PayWalletRechargeService {
|
||||||
/**
|
/**
|
||||||
* 更新钱包充值成功
|
* 更新钱包充值成功
|
||||||
*
|
*
|
||||||
* @param id 钱包充值记录 id
|
* @param id 钱包充值记录 id
|
||||||
* @param payOrderId 支付订单 id
|
* @param payOrderId 支付订单 id
|
||||||
*/
|
*/
|
||||||
void updateWalletRechargerPaid(Long id, Long payOrderId);
|
void updateWalletRechargerPaid(Long id, Long payOrderId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发起钱包充值退款
|
* 发起钱包充值退款
|
||||||
* @param id 钱包充值编号
|
*
|
||||||
|
* @param id 钱包充值编号
|
||||||
* @param userIp 用户 ip 地址
|
* @param userIp 用户 ip 地址
|
||||||
*/
|
*/
|
||||||
void refundWalletRecharge(Long id, String userIp);
|
void refundWalletRecharge(Long id, String userIp);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新钱包充值记录为已退款
|
* 更新钱包充值记录为已退款
|
||||||
* @param id 钱包充值 id
|
*
|
||||||
|
* @param id 钱包充值 id
|
||||||
* @param payRefundId 退款单id
|
* @param payRefundId 退款单id
|
||||||
*/
|
*/
|
||||||
void updateWalletRechargeRefunded(Long id, Long payRefundId);
|
void updateWalletRechargeRefunded(Long id, Long payRefundId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取钱包统计
|
|
||||||
*
|
|
||||||
* @param beginTime 起始时间
|
|
||||||
* @param endTime 截止时间
|
|
||||||
* @return 钱包统计
|
|
||||||
*/
|
|
||||||
WalletSummaryRespDTO getWalletSummary(LocalDateTime beginTime, LocalDateTime endTime);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ import cn.hutool.core.lang.Assert;
|
||||||
import cn.iocoder.yudao.framework.pay.core.enums.refund.PayRefundStatusRespEnum;
|
import cn.iocoder.yudao.framework.pay.core.enums.refund.PayRefundStatusRespEnum;
|
||||||
import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderCreateReqDTO;
|
import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderCreateReqDTO;
|
||||||
import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundCreateReqDTO;
|
import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundCreateReqDTO;
|
||||||
import cn.iocoder.yudao.module.pay.api.wallet.dto.WalletSummaryRespDTO;
|
|
||||||
import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge.AppPayWalletRechargeCreateReqVO;
|
import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge.AppPayWalletRechargeCreateReqVO;
|
||||||
import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletRechargeConvert;
|
import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletRechargeConvert;
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO;
|
import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO;
|
||||||
|
@ -258,15 +257,4 @@ public class PayWalletRechargeServiceImpl implements PayWalletRechargeService {
|
||||||
return payOrder;
|
return payOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public WalletSummaryRespDTO getWalletSummary(LocalDateTime beginTime, LocalDateTime endTime) {
|
|
||||||
WalletSummaryRespDTO paySummary = walletRechargeMapper.selectRechargeSummaryByPayTimeBetween(beginTime, endTime);
|
|
||||||
WalletSummaryRespDTO refundSummary = walletRechargeMapper.selectRechargeSummaryByRefundTimeBetween(beginTime, endTime);
|
|
||||||
|
|
||||||
paySummary.setRechargeRefundCount(refundSummary.getRechargeRefundCount());
|
|
||||||
paySummary.setRechargeRefundPrice(refundSummary.getRechargeRefundPrice());
|
|
||||||
|
|
||||||
return paySummary;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
package cn.iocoder.yudao.module.pay.service.wallet;
|
package cn.iocoder.yudao.module.pay.service.wallet;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.pay.api.wallet.dto.WalletSummaryRespDTO;
|
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO;
|
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO;
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO;
|
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO;
|
||||||
import cn.iocoder.yudao.module.pay.enums.member.PayWalletBizTypeEnum;
|
import cn.iocoder.yudao.module.pay.enums.member.PayWalletBizTypeEnum;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 钱包 Service 接口
|
* 钱包 Service 接口
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package cn.iocoder.yudao.module.pay.service.wallet;
|
package cn.iocoder.yudao.module.pay.service.wallet;
|
||||||
|
|
||||||
import cn.hutool.core.lang.Assert;
|
import cn.hutool.core.lang.Assert;
|
||||||
import cn.iocoder.yudao.module.pay.api.wallet.dto.WalletSummaryRespDTO;
|
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderExtensionDO;
|
import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderExtensionDO;
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO;
|
import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO;
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO;
|
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO;
|
||||||
|
|
|
@ -7,7 +7,6 @@ import cn.iocoder.yudao.module.pay.enums.member.PayWalletBizTypeEnum;
|
||||||
import cn.iocoder.yudao.module.pay.service.wallet.bo.WalletTransactionCreateReqBO;
|
import cn.iocoder.yudao.module.pay.service.wallet.bo.WalletTransactionCreateReqBO;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 钱包余额流水 Service 接口
|
* 钱包余额流水 Service 接口
|
||||||
|
@ -50,14 +49,4 @@ public interface PayWalletTransactionService {
|
||||||
*/
|
*/
|
||||||
PayWalletTransactionDO getWalletTransaction(String bizId, PayWalletBizTypeEnum type);
|
PayWalletTransactionDO getWalletTransaction(String bizId, PayWalletBizTypeEnum type);
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取支付金额合计
|
|
||||||
*
|
|
||||||
* @param bizType 业务类型
|
|
||||||
* @param beginTime 开始时间
|
|
||||||
* @param endTime 结束时间
|
|
||||||
* @return 支付金额合计
|
|
||||||
*/
|
|
||||||
Integer getPriceSummary(PayWalletBizTypeEnum bizType, LocalDateTime beginTime, LocalDateTime endTime);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 钱包流水 Service 实现类
|
* 钱包流水 Service 实现类
|
||||||
|
@ -61,9 +60,4 @@ public class PayWalletTransactionServiceImpl implements PayWalletTransactionServ
|
||||||
return payWalletTransactionMapper.selectByBiz(bizId, type.getType());
|
return payWalletTransactionMapper.selectByBiz(bizId, type.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Integer getPriceSummary(PayWalletBizTypeEnum bizType, LocalDateTime beginTime, LocalDateTime endTime) {
|
|
||||||
return payWalletTransactionMapper.selectSummaryByBizTypeAndCreateTimeBetween(bizType.getType(), beginTime, endTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue