|  | @@ -7,6 +7,7 @@ import cn.hutool.core.util.StrUtil;
 | 
	
		
			
				|  |  |  import cn.hutool.extra.spring.SpringUtil;
 | 
	
		
			
				|  |  |  import cn.newfeifan.mall.framework.common.pojo.PageResult;
 | 
	
		
			
				|  |  |  import cn.newfeifan.mall.framework.common.pojo.echarts.EChartsResult;
 | 
	
		
			
				|  |  | +import cn.newfeifan.mall.framework.common.util.object.BeanUtils;
 | 
	
		
			
				|  |  |  import cn.newfeifan.mall.module.distri.dal.mysql.ordersettlement.OrderSettlementMapper;
 | 
	
		
			
				|  |  |  import cn.newfeifan.mall.module.distri.mq.message.order.DistriOrderMessage;
 | 
	
		
			
				|  |  |  import cn.newfeifan.mall.module.distri.mq.message.order.OrderCalcMessage;
 | 
	
	
		
			
				|  | @@ -57,13 +58,11 @@ import java.util.*;
 | 
	
		
			
				|  |  |  import java.util.stream.Collectors;
 | 
	
		
			
				|  |  |  import java.util.stream.Stream;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -import static cn.newfeifan.mall.framework.common.enums.SelectTimeEnum.*;
 | 
	
		
			
				|  |  |  import static cn.newfeifan.mall.framework.common.exception.util.ServiceExceptionUtil.exception;
 | 
	
		
			
				|  |  |  import static cn.newfeifan.mall.framework.common.util.collection.CollectionUtils.convertSet;
 | 
	
		
			
				|  |  |  import static cn.newfeifan.mall.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
 | 
	
		
			
				|  |  |  import static cn.newfeifan.mall.module.trade.enums.ErrorCodeConstants.EXPRESS_NOT_EXISTS;
 | 
	
		
			
				|  |  |  import static cn.newfeifan.mall.module.trade.enums.ErrorCodeConstants.ORDER_NOT_FOUND;
 | 
	
		
			
				|  |  | -import static cn.newfeifan.mall.module.trade.enums.order.TradeOrderStatusEnum.*;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  /**
 | 
	
		
			
				|  |  |   * 交易订单【读】 Service 实现类
 | 
	
	
		
			
				|  | @@ -361,57 +360,27 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | -    public EChartsResult getOrderStatusCount(String selectTime) {
 | 
	
		
			
				|  |  | +    public EChartsResult getOrderCountWithMoney(LocalDate startTime, LocalDate endTime) {
 | 
	
		
			
				|  |  |          LocalDate today = LocalDate.now(); // 获取今天的日期
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        // 本周
 | 
	
		
			
				|  |  | -        if(selectTime.equals(WEEK.getType())){
 | 
	
		
			
				|  |  | -            LocalDate weekStart = today.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY)); // 获取本周的开始日期
 | 
	
		
			
				|  |  | -            LocalDate weekEnd = today.with(TemporalAdjusters.nextOrSame(DayOfWeek.SUNDAY)); // 获取本周的结束日期
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            List<LocalDate> weekDates = generateWeekDates(weekStart, weekEnd); // 生成本周的日期数组
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            return EChartsResult.builder()
 | 
	
		
			
				|  |  | -                    .xaxis(new EChartsResult.Axis()
 | 
	
		
			
				|  |  | -                            .setData(weekDates))
 | 
	
		
			
				|  |  | -                    .series(getSeries(weekStart,today))
 | 
	
		
			
				|  |  | -                    .build()
 | 
	
		
			
				|  |  | -            ;
 | 
	
		
			
				|  |  | -        } else if(selectTime.equals(LAST_WEEK.getType())){
 | 
	
		
			
				|  |  | -            // 上周
 | 
	
		
			
				|  |  | -            LocalDate lastWeekStart = today.minusWeeks(1).with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY)); // 获取上周的开始日期
 | 
	
		
			
				|  |  | -            LocalDate lastWeekEnd = today.minusWeeks(1).with(TemporalAdjusters.nextOrSame(DayOfWeek.SUNDAY)); // 获取上周的结束日期
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            List<LocalDate> weekDates = generateWeekDates(lastWeekStart, lastWeekEnd); // 生成上周的日期数组
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            return EChartsResult.builder()
 | 
	
		
			
				|  |  | -                    .xaxis(new EChartsResult.Axis()
 | 
	
		
			
				|  |  | -                            .setData(weekDates))
 | 
	
		
			
				|  |  | -                    .series(getSeries(lastWeekStart,lastWeekEnd))
 | 
	
		
			
				|  |  | -                    .build()
 | 
	
		
			
				|  |  | -                    ;
 | 
	
		
			
				|  |  | -        } else if(selectTime.equals(LAST_MONTH.getType())){
 | 
	
		
			
				|  |  | -            // 上月
 | 
	
		
			
				|  |  | -            LocalDate lastMonthStart = today.minusMonths(1).with(TemporalAdjusters.firstDayOfMonth()); // 获取上个月的开始日期
 | 
	
		
			
				|  |  | -            LocalDate lastMonthEnd = today.minusMonths(1).with(TemporalAdjusters.lastDayOfMonth()); // 获取上个月的结束日期
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            List<LocalDate> weekDates = generateWeekDates(lastMonthStart, lastMonthEnd); // 生成上周的日期数组
 | 
	
		
			
				|  |  | -            return EChartsResult.builder()
 | 
	
		
			
				|  |  | -                    .xaxis(new EChartsResult.Axis()
 | 
	
		
			
				|  |  | -                            .setData(weekDates))
 | 
	
		
			
				|  |  | -                    .series(getSeries(lastMonthStart,lastMonthEnd))
 | 
	
		
			
				|  |  | -                    .build()
 | 
	
		
			
				|  |  | -                    ;
 | 
	
		
			
				|  |  | +        if (startTime == null && endTime == null) {
 | 
	
		
			
				|  |  | +            startTime = today.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY)); // 获取本周的开始日期
 | 
	
		
			
				|  |  | +            endTime = today.with(TemporalAdjusters.nextOrSame(DayOfWeek.SUNDAY)); // 获取本周的结束日期
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        return null;
 | 
	
		
			
				|  |  | +        List<LocalDate> weekDates = generateWeekDates(startTime, endTime); // 生成本周的日期数组
 | 
	
		
			
				|  |  | +        return EChartsResult.builder()
 | 
	
		
			
				|  |  | +                .xaxis(new EChartsResult.Axis()
 | 
	
		
			
				|  |  | +                        .setData(weekDates))
 | 
	
		
			
				|  |  | +                .series(BeanUtils.toBean(tradeOrderMapper.selectOrderCountWithTime(startTime, endTime), EChartsResult.Series.class))
 | 
	
		
			
				|  |  | +                .build()
 | 
	
		
			
				|  |  | +                ;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 生成指定日期范围内的日期数组
 | 
	
		
			
				|  |  | +     *
 | 
	
		
			
				|  |  |       * @param start 开始日期
 | 
	
		
			
				|  |  | -     * @param end 结束日期
 | 
	
		
			
				|  |  | +     * @param end   结束日期
 | 
	
		
			
				|  |  |       * @return 日期数组
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      private static List<LocalDate> generateWeekDates(LocalDate start, LocalDate end) {
 | 
	
	
		
			
				|  | @@ -420,42 +389,6 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
 | 
	
		
			
				|  |  |                  .collect(Collectors.toList());
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    /**
 | 
	
		
			
				|  |  | -     * 根据日期范围获取订单状态数量
 | 
	
		
			
				|  |  | -     * @param start 开始日期
 | 
	
		
			
				|  |  | -     * @param end 结束日期
 | 
	
		
			
				|  |  | -     * @param status 状态
 | 
	
		
			
				|  |  | -     * @param series 系列列表
 | 
	
		
			
				|  |  | -     */
 | 
	
		
			
				|  |  | -    private void selectOrderCountByStatusWithTime(LocalDate start, LocalDate end, Integer status, List<EChartsResult.Series> series) {
 | 
	
		
			
				|  |  | -        List<TradeOrderStatusCount> counts = tradeOrderMapper.selectOrderCountByStatusWithTime(start, end, status);
 | 
	
		
			
				|  |  | -        series.add(new EChartsResult.Series()
 | 
	
		
			
				|  |  | -                .setData(counts.stream().map(TradeOrderStatusCount::getOrderCount).collect(Collectors.toList()))
 | 
	
		
			
				|  |  | -                .setType(status));
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    /**
 | 
	
		
			
				|  |  | -     * 获取系列列表
 | 
	
		
			
				|  |  | -     * @param start 开始日期
 | 
	
		
			
				|  |  | -     * @param end 结束日期
 | 
	
		
			
				|  |  | -     * @return 系列列表
 | 
	
		
			
				|  |  | -     */
 | 
	
		
			
				|  |  | -    private List<EChartsResult.Series> getSeries(LocalDate start, LocalDate end){
 | 
	
		
			
				|  |  | -        List<EChartsResult.Series> series = new ArrayList<>();
 | 
	
		
			
				|  |  | -        // 待支付
 | 
	
		
			
				|  |  | -        selectOrderCountByStatusWithTime(start,end,UNPAID.getStatus(),series);
 | 
	
		
			
				|  |  | -        // 待发货
 | 
	
		
			
				|  |  | -        selectOrderCountByStatusWithTime(start,end,UNDELIVERED.getStatus(), series);
 | 
	
		
			
				|  |  | -        // 已发货
 | 
	
		
			
				|  |  | -        selectOrderCountByStatusWithTime(start,end,DELIVERED.getStatus(), series);
 | 
	
		
			
				|  |  | -        // 已完成
 | 
	
		
			
				|  |  | -        selectOrderCountByStatusWithTime(start,end,COMPLETED.getStatus(), series);
 | 
	
		
			
				|  |  | -        // 已取消
 | 
	
		
			
				|  |  | -        selectOrderCountByStatusWithTime(start, end, CANCELED.getStatus(), series);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        return series;
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |      public static ShopBO getShopBO(StringRedisTemplate stringRedisTemplate, AdminUserMapper userMapper, Logger log) {
 | 
	
		
			
				|  |  |          Long loginUserId = getLoginUserId();
 | 
	
		
			
				|  |  |          String s = stringRedisTemplate.opsForValue().get("shop:" + loginUserId);
 |