mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-25 16:35:06 +08:00
统计:交易统计定时任务
This commit is contained in:
@ -43,6 +43,11 @@
|
||||
<artifactId>yudao-module-member-api</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-module-pay-api</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 业务组件 -->
|
||||
<dependency>
|
||||
|
@ -1,13 +1,18 @@
|
||||
package cn.iocoder.yudao.module.statistics.convert.trade;
|
||||
|
||||
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.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.TradeSummaryRespBO;
|
||||
import cn.iocoder.yudao.module.trade.api.aftersale.dto.AfterSaleSummaryRespDTO;
|
||||
import cn.iocoder.yudao.module.trade.api.order.dto.TradeOrderSummaryRespDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -21,9 +26,9 @@ public interface TradeStatisticsConvert {
|
||||
TradeStatisticsConvert INSTANCE = Mappers.getMapper(TradeStatisticsConvert.class);
|
||||
|
||||
default TradeStatisticsComparisonRespVO<TradeSummaryRespVO> convert(TradeSummaryRespBO yesterdayData,
|
||||
TradeSummaryRespBO beforeYesterdayData,
|
||||
TradeSummaryRespBO monthData,
|
||||
TradeSummaryRespBO lastMonthData) {
|
||||
TradeSummaryRespBO beforeYesterdayData,
|
||||
TradeSummaryRespBO monthData,
|
||||
TradeSummaryRespBO lastMonthData) {
|
||||
return convert(convert(yesterdayData, monthData), convert(beforeYesterdayData, lastMonthData));
|
||||
}
|
||||
|
||||
@ -36,7 +41,13 @@ public interface TradeStatisticsConvert {
|
||||
|
||||
TradeStatisticsComparisonRespVO<TradeSummaryRespVO> convert(TradeSummaryRespVO value, TradeSummaryRespVO reference);
|
||||
|
||||
TradeStatisticsComparisonRespVO<TradeTrendSummaryRespVO> convert(TradeTrendSummaryRespVO value, TradeTrendSummaryRespVO reference);
|
||||
TradeStatisticsComparisonRespVO<TradeTrendSummaryRespVO> convert(TradeTrendSummaryRespVO value,
|
||||
TradeTrendSummaryRespVO reference);
|
||||
|
||||
List<TradeTrendSummaryExcelVO> convertList02(List<TradeTrendSummaryRespVO> list);
|
||||
|
||||
TradeStatisticsDO convert(LocalDateTime time, TradeOrderSummaryRespDTO orderSummary,
|
||||
AfterSaleSummaryRespDTO afterSaleSummary, Integer brokerageSettlementPrice,
|
||||
WalletSummaryRespDTO walletSummary);
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,29 @@
|
||||
package cn.iocoder.yudao.module.statistics.job.trade;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
|
||||
import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
|
||||
import cn.iocoder.yudao.module.statistics.service.trade.TradeStatisticsService;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 交易统计 Job
|
||||
*
|
||||
* @author owen
|
||||
*/
|
||||
@Component
|
||||
public class TradeStatisticsJob implements JobHandler {
|
||||
|
||||
@Resource
|
||||
private TradeStatisticsService tradeStatisticsService;
|
||||
|
||||
@Override
|
||||
@TenantJob
|
||||
public String execute(String param) {
|
||||
String times = tradeStatisticsService.statisticsYesterdayTrade();
|
||||
return StrUtil.format("交易统计耗时: {}", times);
|
||||
}
|
||||
|
||||
}
|
@ -36,4 +36,11 @@ public interface TradeStatisticsService {
|
||||
*/
|
||||
List<TradeTrendSummaryRespVO> getTradeStatisticsList(LocalDateTime beginTime, LocalDateTime endTime);
|
||||
|
||||
/**
|
||||
* 统计昨日交易
|
||||
*
|
||||
* @return 耗时
|
||||
*/
|
||||
String statisticsYesterdayTrade();
|
||||
|
||||
}
|
||||
|
@ -2,13 +2,22 @@ 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.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;
|
||||
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 org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StopWatch;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@ -28,6 +37,15 @@ public class TradeStatisticsServiceImpl implements TradeStatisticsService {
|
||||
@Resource
|
||||
private TradeStatisticsMapper tradeStatisticsMapper;
|
||||
|
||||
@Resource
|
||||
private TradeOrderApi tradeOrderApi;
|
||||
@Resource
|
||||
private TradeAfterSaleApi tradeAfterSaleApi;
|
||||
@Resource
|
||||
private TradeBrokerageApi tradeBrokerageApi;
|
||||
@Resource
|
||||
private PayWalletApi payWalletApi;
|
||||
|
||||
@Override
|
||||
public TradeStatisticsComparisonRespVO<TradeSummaryRespVO> getTradeSummaryComparison() {
|
||||
// 昨天的数据
|
||||
@ -59,6 +77,36 @@ public class TradeStatisticsServiceImpl implements TradeStatisticsService {
|
||||
return tradeStatisticsMapper.selectListByTimeBetween(beginTime, endTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String statisticsYesterdayTrade() {
|
||||
// 处理统计参数
|
||||
LocalDateTime yesterday = LocalDateTime.now().minusDays(1);
|
||||
LocalDateTime beginTime = LocalDateTimeUtil.beginOfDay(yesterday);
|
||||
LocalDateTime endTime = LocalDateTimeUtil.endOfDay(yesterday);
|
||||
// 统计
|
||||
StopWatch stopWatch = new StopWatch("交易统计");
|
||||
stopWatch.start("统计订单");
|
||||
TradeOrderSummaryRespDTO orderSummary = tradeOrderApi.getOrderSummary(beginTime, endTime);
|
||||
stopWatch.stop();
|
||||
|
||||
stopWatch.start("统计售后");
|
||||
AfterSaleSummaryRespDTO afterSaleSummary = tradeAfterSaleApi.getAfterSaleSummary(beginTime, endTime);
|
||||
stopWatch.stop();
|
||||
|
||||
stopWatch.start("统计佣金");
|
||||
Integer brokerageSettlementPrice = tradeBrokerageApi.getBrokerageSettlementPriceSummary(beginTime, endTime);
|
||||
stopWatch.stop();
|
||||
|
||||
stopWatch.start("统计充值");
|
||||
WalletSummaryRespDTO walletSummary = payWalletApi.getWalletSummary(beginTime, endTime);
|
||||
stopWatch.stop();
|
||||
// 插入数据
|
||||
TradeStatisticsDO entity = TradeStatisticsConvert.INSTANCE.convert(yesterday, orderSummary, afterSaleSummary, brokerageSettlementPrice, walletSummary);
|
||||
tradeStatisticsMapper.insert(entity);
|
||||
// 返回计时结果
|
||||
return stopWatch.prettyPrint();
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计指定日期的交易数据
|
||||
*
|
||||
|
@ -0,0 +1,23 @@
|
||||
package cn.iocoder.yudao.module.trade.api.aftersale;
|
||||
|
||||
import cn.iocoder.yudao.module.trade.api.aftersale.dto.AfterSaleSummaryRespDTO;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 售后 API 接口
|
||||
*
|
||||
* @author owen
|
||||
*/
|
||||
public interface TradeAfterSaleApi {
|
||||
|
||||
/**
|
||||
* 获取售后单统计
|
||||
*
|
||||
* @param beginTime 起始时间
|
||||
* @param endTime 截止时间
|
||||
* @return 售后统计结果
|
||||
*/
|
||||
AfterSaleSummaryRespDTO getAfterSaleSummary(LocalDateTime beginTime, LocalDateTime endTime);
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package cn.iocoder.yudao.module.trade.api.aftersale.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 售后统计 Response DTO
|
||||
*
|
||||
* @author owen
|
||||
*/
|
||||
@Data
|
||||
public class AfterSaleSummaryRespDTO {
|
||||
|
||||
/**
|
||||
* 退款订单数
|
||||
*/
|
||||
private Integer afterSaleCount;
|
||||
/**
|
||||
* 总退款金额,单位:分
|
||||
*/
|
||||
private Integer afterSaleRefundPrice;
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package cn.iocoder.yudao.module.trade.api.brokerage;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 分销 API 接口
|
||||
*
|
||||
* @author owen
|
||||
*/
|
||||
public interface TradeBrokerageApi {
|
||||
|
||||
/**
|
||||
* 获取已结算的佣金金额
|
||||
*
|
||||
* @param beginTime 起始时间
|
||||
* @param endTime 截止时间
|
||||
* @return 已结算的佣金金额
|
||||
*/
|
||||
Integer getBrokerageSettlementPriceSummary(LocalDateTime beginTime, LocalDateTime endTime);
|
||||
|
||||
}
|
@ -1,5 +1,9 @@
|
||||
package cn.iocoder.yudao.module.trade.api.order;
|
||||
|
||||
import cn.iocoder.yudao.module.trade.api.order.dto.TradeOrderSummaryRespDTO;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 订单 API 接口
|
||||
*
|
||||
@ -15,4 +19,13 @@ public interface TradeOrderApi {
|
||||
*/
|
||||
Integer getOrderStatus(Long id);
|
||||
|
||||
/**
|
||||
* 获取订单统计
|
||||
*
|
||||
* @param beginTime 起始时间
|
||||
* @param endTime 截止时间
|
||||
* @return 订单统计结果
|
||||
*/
|
||||
TradeOrderSummaryRespDTO getOrderSummary(LocalDateTime beginTime, LocalDateTime endTime);
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,26 @@
|
||||
package cn.iocoder.yudao.module.trade.api.order.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 订单统计 Response DTO
|
||||
*
|
||||
* @author owen
|
||||
*/
|
||||
@Data
|
||||
public class TradeOrderSummaryRespDTO {
|
||||
|
||||
/**
|
||||
* 创建订单数
|
||||
*/
|
||||
private Long orderCreateCount;
|
||||
/**
|
||||
* 支付订单商品数
|
||||
*/
|
||||
private Integer orderPayCount;
|
||||
/**
|
||||
* 总支付金额,单位:分
|
||||
*/
|
||||
private Integer orderPayPrice;
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
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 org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 售后 API 接口实现类
|
||||
*
|
||||
* @author owen
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class TradeAfterSaleApiImpl implements TradeAfterSaleApi {
|
||||
|
||||
@Resource
|
||||
private AfterSaleService afterSaleService;
|
||||
|
||||
@Override
|
||||
public AfterSaleSummaryRespDTO getAfterSaleSummary(LocalDateTime beginTime, LocalDateTime endTime) {
|
||||
return afterSaleService.getAfterSaleSummary(beginTime, endTime);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.trade.api.brokerage;
|
||||
|
||||
import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageRecordService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 订单 API 接口实现类
|
||||
*
|
||||
* @author HUIHUI
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class TradeBrokerageApiImpl implements TradeBrokerageApi {
|
||||
|
||||
@Resource
|
||||
private BrokerageRecordService brokerageRecordService;
|
||||
|
||||
@Override
|
||||
public Integer getBrokerageSettlementPriceSummary(LocalDateTime beginTime, LocalDateTime endTime) {
|
||||
return brokerageRecordService.getBrokerageSettlementPriceSummary(beginTime, endTime);
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.trade.api.order;
|
||||
|
||||
import cn.iocoder.yudao.module.trade.api.order.dto.TradeOrderSummaryRespDTO;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
|
||||
import cn.iocoder.yudao.module.trade.service.order.TradeOrderQueryService;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -7,6 +8,8 @@ import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.ORDER_NOT_FOUND;
|
||||
|
||||
@ -31,4 +34,9 @@ public class TradeOrderApiImpl implements TradeOrderApi {
|
||||
return order.getStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TradeOrderSummaryRespDTO getOrderSummary(LocalDateTime beginTime, LocalDateTime endTime) {
|
||||
return tradeOrderQueryService.getOrderSummary(beginTime, endTime);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,14 +1,19 @@
|
||||
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.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
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.dal.dataobject.aftersale.AfterSaleDO;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.github.yulichang.toolkit.MPJWrappers;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
|
||||
@Mapper
|
||||
@ -48,4 +53,12 @@ public interface AfterSaleMapper extends BaseMapperX<AfterSaleDO> {
|
||||
.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,6 +1,8 @@
|
||||
package cn.iocoder.yudao.module.trade.dal.mysql.brokerage;
|
||||
|
||||
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.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
@ -108,4 +110,14 @@ public interface BrokerageRecordMapper extends BaseMapperX<BrokerageRecordDO> {
|
||||
@Param("status") Integer status,
|
||||
@Param("beginTime") LocalDateTime beginTime,
|
||||
@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,12 +1,16 @@
|
||||
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.mybatis.core.mapper.BaseMapperX;
|
||||
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.app.order.vo.AppTradeOrderPageReqVO;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.github.yulichang.toolkit.MPJWrappers;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
@ -82,4 +86,17 @@ public interface TradeOrderMapper extends BaseMapperX<TradeOrderDO> {
|
||||
.eq(TradeOrderDO::getCommentStatus, commentStatus));
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.trade.service.aftersale;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
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.AfterSalePageReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.AfterSaleRefuseReqVO;
|
||||
@ -9,6 +10,8 @@ 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.dal.dataobject.aftersale.AfterSaleDO;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 售后订单 Service 接口
|
||||
*
|
||||
@ -27,7 +30,7 @@ public interface AfterSaleService {
|
||||
/**
|
||||
* 【会员】获得售后订单分页
|
||||
*
|
||||
* @param userId 用户编号
|
||||
* @param userId 用户编号
|
||||
* @param pageParam 分页参数
|
||||
* @return 售后订单分页
|
||||
*/
|
||||
@ -37,7 +40,7 @@ public interface AfterSaleService {
|
||||
* 【会员】获得售后单
|
||||
*
|
||||
* @param userId 用户编号
|
||||
* @param id 售后编号
|
||||
* @param id 售后编号
|
||||
* @return 售后订单
|
||||
*/
|
||||
AfterSaleDO getAfterSale(Long userId, Long id);
|
||||
@ -53,7 +56,7 @@ public interface AfterSaleService {
|
||||
/**
|
||||
* 【会员】创建售后订单
|
||||
*
|
||||
* @param userId 会员用户编号
|
||||
* @param userId 会员用户编号
|
||||
* @param createReqVO 创建 Request 信息
|
||||
* @return 售后编号
|
||||
*/
|
||||
@ -63,14 +66,14 @@ public interface AfterSaleService {
|
||||
* 【管理员】同意售后订单
|
||||
*
|
||||
* @param userId 管理员用户编号
|
||||
* @param id 售后编号
|
||||
* @param id 售后编号
|
||||
*/
|
||||
void agreeAfterSale(Long userId, Long id);
|
||||
|
||||
/**
|
||||
* 【管理员】拒绝售后订单
|
||||
*
|
||||
* @param userId 管理员用户编号
|
||||
* @param userId 管理员用户编号
|
||||
* @param auditReqVO 审批 Request 信息
|
||||
*/
|
||||
void disagreeAfterSale(Long userId, AfterSaleDisagreeReqVO auditReqVO);
|
||||
@ -78,7 +81,7 @@ public interface AfterSaleService {
|
||||
/**
|
||||
* 【会员】退回货物
|
||||
*
|
||||
* @param userId 会员用户编号
|
||||
* @param userId 会员用户编号
|
||||
* @param deliveryReqVO 退货 Request 信息
|
||||
*/
|
||||
void deliveryAfterSale(Long userId, AppAfterSaleDeliveryReqVO deliveryReqVO);
|
||||
@ -87,14 +90,14 @@ public interface AfterSaleService {
|
||||
* 【管理员】确认收货
|
||||
*
|
||||
* @param userId 管理员编号
|
||||
* @param id 售后编号
|
||||
* @param id 售后编号
|
||||
*/
|
||||
void receiveAfterSale(Long userId, Long id);
|
||||
|
||||
/**
|
||||
* 【管理员】拒绝收货
|
||||
*
|
||||
* @param userId 管理员用户编号
|
||||
* @param userId 管理员用户编号
|
||||
* @param refuseReqVO 拒绝收货 Request 信息
|
||||
*/
|
||||
void refuseAfterSale(Long userId, AfterSaleRefuseReqVO refuseReqVO);
|
||||
@ -104,7 +107,7 @@ public interface AfterSaleService {
|
||||
*
|
||||
* @param userId 管理员用户编号
|
||||
* @param userIp 管理员用户 IP
|
||||
* @param id 售后编号
|
||||
* @param id 售后编号
|
||||
*/
|
||||
void refundAfterSale(Long userId, String userIp, Long id);
|
||||
|
||||
@ -112,7 +115,7 @@ public interface AfterSaleService {
|
||||
* 【会员】取消售后
|
||||
*
|
||||
* @param userId 会员用户编号
|
||||
* @param id 售后编号
|
||||
* @param id 售后编号
|
||||
*/
|
||||
void cancelAfterSale(Long userId, Long id);
|
||||
|
||||
@ -124,4 +127,13 @@ public interface AfterSaleService {
|
||||
*/
|
||||
Long getApplyingAfterSaleCount(Long userId);
|
||||
|
||||
/**
|
||||
* 获取售后单统计
|
||||
*
|
||||
* @param beginTime 起始时间
|
||||
* @param endTime 截止时间
|
||||
* @return 售后统计结果
|
||||
*/
|
||||
AfterSaleSummaryRespDTO getAfterSaleSummary(LocalDateTime beginTime, LocalDateTime endTime);
|
||||
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
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.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.AfterSalePageReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.AfterSaleRefuseReqVO;
|
||||
@ -410,4 +411,9 @@ public class AfterSaleServiceImpl implements AfterSaleService {
|
||||
return tradeAfterSaleMapper.selectCountByUserIdAndStatus(userId, AfterSaleStatusEnum.APPLYING_STATUSES);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AfterSaleSummaryRespDTO getAfterSaleSummary(LocalDateTime beginTime, LocalDateTime endTime) {
|
||||
return tradeAfterSaleMapper.selectSummaryByRefundTimeBetween(beginTime,endTime);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -156,4 +156,13 @@ public interface BrokerageRecordService {
|
||||
*/
|
||||
AppBrokerageProductPriceRespVO calculateProductBrokeragePrice(Long userId, Long spuId);
|
||||
|
||||
/**
|
||||
* 获取已结算的佣金金额
|
||||
*
|
||||
* @param beginTime 起始时间
|
||||
* @param endTime 截止时间
|
||||
* @return 已结算的佣金金额
|
||||
*/
|
||||
Integer getBrokerageSettlementPriceSummary(LocalDateTime beginTime, LocalDateTime endTime);
|
||||
|
||||
}
|
||||
|
@ -356,6 +356,13 @@ public class BrokerageRecordServiceImpl implements BrokerageRecordService {
|
||||
return respVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getBrokerageSettlementPriceSummary(LocalDateTime beginTime, LocalDateTime endTime) {
|
||||
return brokerageRecordMapper.selectSummaryPriceByStatusAndUnfreezeTimeBetween(
|
||||
BrokerageRecordBizTypeEnum.ORDER.getType(), BrokerageRecordStatusEnum.SETTLEMENT.getStatus(),
|
||||
beginTime, endTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得自身的代理对象,解决 AOP 生效问题
|
||||
*
|
||||
|
@ -1,12 +1,14 @@
|
||||
package cn.iocoder.yudao.module.trade.service.order;
|
||||
|
||||
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.app.order.vo.AppTradeOrderPageReqVO;
|
||||
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.framework.delivery.core.client.dto.ExpressTrackRespDTO;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@ -33,7 +35,7 @@ public interface TradeOrderQueryService {
|
||||
* 获得指定用户,指定的交易订单
|
||||
*
|
||||
* @param userId 用户编号
|
||||
* @param id 交易订单编号
|
||||
* @param id 交易订单编号
|
||||
* @return 交易订单
|
||||
*/
|
||||
TradeOrderDO getOrder(Long userId, Long id);
|
||||
@ -50,7 +52,7 @@ public interface TradeOrderQueryService {
|
||||
* 【会员】获得交易订单分页
|
||||
*
|
||||
* @param userId 用户编号
|
||||
* @param reqVO 分页请求
|
||||
* @param reqVO 分页请求
|
||||
* @return 交易订单
|
||||
*/
|
||||
PageResult<TradeOrderDO> getOrderPage(Long userId, AppTradeOrderPageReqVO reqVO);
|
||||
@ -68,7 +70,7 @@ public interface TradeOrderQueryService {
|
||||
/**
|
||||
* 【前台】获得订单的物流轨迹
|
||||
*
|
||||
* @param id 订单编号
|
||||
* @param id 订单编号
|
||||
* @param userId 用户编号
|
||||
* @return 物流轨迹数组
|
||||
*/
|
||||
@ -119,4 +121,13 @@ public interface TradeOrderQueryService {
|
||||
*/
|
||||
List<TradeOrderItemDO> getOrderItemListByOrderId(Collection<Long> orderIds);
|
||||
|
||||
/**
|
||||
* 获取订单统计
|
||||
*
|
||||
* @param beginTime 起始时间
|
||||
* @param endTime 截止时间
|
||||
* @return 订单统计结果
|
||||
*/
|
||||
TradeOrderSummaryRespDTO getOrderSummary(LocalDateTime beginTime, LocalDateTime endTime);
|
||||
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import cn.hutool.core.util.StrUtil;
|
||||
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.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.app.order.vo.AppTradeOrderPageReqVO;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressDO;
|
||||
@ -20,6 +21,7 @@ import cn.iocoder.yudao.module.trade.service.delivery.DeliveryExpressService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
@ -143,6 +145,14 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
|
||||
.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 ===================
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user