|
@@ -6,11 +6,12 @@ import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.extra.spring.SpringUtil;
|
|
import cn.hutool.extra.spring.SpringUtil;
|
|
import cn.newfeifan.mall.framework.common.pojo.PageResult;
|
|
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.dal.mysql.ordersettlement.OrderSettlementMapper;
|
|
import cn.newfeifan.mall.module.member.api.user.MemberUserApi;
|
|
import cn.newfeifan.mall.module.member.api.user.MemberUserApi;
|
|
import cn.newfeifan.mall.module.member.api.user.dto.MemberUserRespDTO;
|
|
import cn.newfeifan.mall.module.member.api.user.dto.MemberUserRespDTO;
|
|
import cn.newfeifan.mall.module.pay.controller.admin.order.vo.PayOrderPageItemRespVO;
|
|
import cn.newfeifan.mall.module.pay.controller.admin.order.vo.PayOrderPageItemRespVO;
|
|
-import cn.newfeifan.mall.module.product.api.sku.ProductSkuApi;
|
|
|
|
import cn.newfeifan.mall.module.product.dal.dataobject.spu.ProductSpuDO;
|
|
import cn.newfeifan.mall.module.product.dal.dataobject.spu.ProductSpuDO;
|
|
import cn.newfeifan.mall.module.product.service.spu.ProductSpuService;
|
|
import cn.newfeifan.mall.module.product.service.spu.ProductSpuService;
|
|
import cn.newfeifan.mall.module.system.controller.admin.user.vo.user.UserShopDetailsVO;
|
|
import cn.newfeifan.mall.module.system.controller.admin.user.vo.user.UserShopDetailsVO;
|
|
@@ -40,7 +41,12 @@ import org.springframework.context.annotation.Lazy;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
+import java.time.DayOfWeek;
|
|
|
|
+import java.time.LocalDate;
|
|
|
|
+import java.time.temporal.TemporalAdjusters;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
+import java.util.stream.Stream;
|
|
|
|
|
|
import static cn.newfeifan.mall.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
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.common.util.collection.CollectionUtils.convertSet;
|
|
@@ -82,6 +88,8 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
private OrderSettlementMapper orderSettlementMapper;
|
|
private OrderSettlementMapper orderSettlementMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ private AdminUserService adminUserService;
|
|
|
|
|
|
|
|
|
|
// =================== Order ===================
|
|
// =================== Order ===================
|
|
@@ -279,6 +287,39 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
|
|
return tradeOrderMapper.selectCountByRefundStatus(refundStatus, reqVO);
|
|
return tradeOrderMapper.selectCountByRefundStatus(refundStatus, reqVO);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public EChartsResult getOrderCountWithMoney(LocalDate startTime, LocalDate endTime) {
|
|
|
|
+
|
|
|
|
+ UserShopDetailsVO userShopDetails = adminUserService.getUserShopDetails();
|
|
|
|
+
|
|
|
|
+ LocalDate today = LocalDate.now(); // 获取今天的日期
|
|
|
|
+
|
|
|
|
+ if (startTime == null && endTime == null) {
|
|
|
|
+ startTime = today.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY)); // 获取本周的开始日期
|
|
|
|
+ endTime = today.with(TemporalAdjusters.nextOrSame(DayOfWeek.SUNDAY)); // 获取本周的结束日期
|
|
|
|
+ }
|
|
|
|
+ List<LocalDate> weekDates = generateWeekDates(startTime, endTime); // 生成本周的日期数组
|
|
|
|
+ return EChartsResult.builder()
|
|
|
|
+ .xaxis(new EChartsResult.Axis()
|
|
|
|
+ .setData(weekDates))
|
|
|
|
+ .series(BeanUtils.toBean(tradeOrderMapper.selectOrderCountWithTime(startTime, endTime, userShopDetails.getMerId(), userShopDetails.getShopId()), EChartsResult.Series.class))
|
|
|
|
+ .build()
|
|
|
|
+ ;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 生成指定日期范围内的日期数组
|
|
|
|
+ *
|
|
|
|
+ * @param start 开始日期
|
|
|
|
+ * @param end 结束日期
|
|
|
|
+ * @return 日期数组
|
|
|
|
+ */
|
|
|
|
+ private static List<LocalDate> generateWeekDates(LocalDate start, LocalDate end) {
|
|
|
|
+ return Stream.iterate(start, date -> date.plusDays(1))
|
|
|
|
+ .limit(end.toEpochDay() - start.toEpochDay() + 1)
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public List<ExpressTrackRespDTO> getExpressTrackList(Long id, Long userId) {
|
|
public List<ExpressTrackRespDTO> getExpressTrackList(Long id, Long userId) {
|
|
// 查询订单
|
|
// 查询订单
|