Ver Fonte

Merge branch 'dev/2024/0509/update-business-Y' of feifan/mall-backend-business into master

修改商品订单售后订单的数量显示异常问题
Yangzw há 10 meses atrás
pai
commit
44cc3ff786
14 ficheiros alterados com 158 adições e 40 exclusões
  1. 2 2
      feifan-module-mall/feifan-module-product-biz/src/main/java/cn/newfeifan/mall/module/product/controller/admin/spu/ProductSpuController.java
  2. 32 1
      feifan-module-mall/feifan-module-product-biz/src/main/java/cn/newfeifan/mall/module/product/dal/mysql/spu/ProductSpuMapper.java
  3. 2 2
      feifan-module-mall/feifan-module-product-biz/src/main/java/cn/newfeifan/mall/module/product/service/spu/ProductSpuService.java
  4. 11 6
      feifan-module-mall/feifan-module-product-biz/src/main/java/cn/newfeifan/mall/module/product/service/spu/ProductSpuServiceImpl.java
  5. 6 0
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/aftersale/AfterSaleController.java
  6. 8 2
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/aftersale/vo/AfterSalePageReqVO.java
  7. 9 8
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/order/TradeOrderController.java
  8. 1 1
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/app/order/AppTradeOrderController.java
  9. 26 4
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/dal/mysql/aftersale/AfterSaleMapper.java
  10. 13 4
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/dal/mysql/order/TradeOrderMapper.java
  11. 6 1
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/service/aftersale/AfterSaleService.java
  12. 33 2
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/service/aftersale/AfterSaleServiceImpl.java
  13. 5 4
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/service/order/TradeOrderQueryService.java
  14. 4 3
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/service/order/TradeOrderQueryServiceImpl.java

+ 2 - 2
feifan-module-mall/feifan-module-product-biz/src/main/java/cn/newfeifan/mall/module/product/controller/admin/spu/ProductSpuController.java

@@ -120,8 +120,8 @@ public class ProductSpuController {
     @GetMapping("/get-count")
     @Operation(summary = "获得商品 SPU 分页 tab count")
     @PreAuthorize("@ss.hasPermission('product:spu:query')")
-    public CommonResult<Map<Integer, Long>> getSpuCount() {
-        return success(productSpuService.getTabsCount());
+    public CommonResult<Map<Integer, Long>> getSpuCount(@Valid ProductSpuPageReqVO pageVO) {
+        return success(productSpuService.getTabsCount(pageVO));
     }
 
     @GetMapping("/get-count-by-mer")

+ 32 - 1
feifan-module-mall/feifan-module-product-biz/src/main/java/cn/newfeifan/mall/module/product/dal/mysql/spu/ProductSpuMapper.java

@@ -9,7 +9,6 @@ import cn.newfeifan.mall.module.product.controller.app.spu.vo.AppProductSpuPageR
 import cn.newfeifan.mall.module.product.dal.dataobject.spu.ProductSpuDO;
 import cn.newfeifan.mall.module.product.enums.ProductConstants;
 import cn.newfeifan.mall.module.product.enums.spu.ProductSpuStatusEnum;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
 import org.apache.ibatis.annotations.Mapper;
@@ -76,6 +75,38 @@ public interface ProductSpuMapper extends BaseMapperX<ProductSpuDO> {
                 .notIn(ProductSpuDO::getStatus, ProductSpuStatusEnum.RECYCLE.getStatus()));
     }
 
+    /**
+     * 查询触发警戒库存的 SPU 数量
+     *
+     * @return 触发警戒库存的 SPU 数量
+     */
+    default Long selectCount(ProductSpuPageReqVO pageVO) {
+        LambdaQueryWrapperX<ProductSpuDO> queryWrapper = new LambdaQueryWrapperX<>();
+        // 库存小于等于警戒库存
+        queryWrapper
+                .likeIfPresent(ProductSpuDO::getName, pageVO.getName())
+                .eqIfPresent(ProductSpuDO::getShopId, pageVO.getShopId())
+                .eqIfPresent(ProductSpuDO::getCategoryId, pageVO.getCategoryId())
+                .eqIfPresent(ProductSpuDO::getMerchantId, pageVO.getMerchantId())
+                .betweenIfPresent(ProductSpuDO::getCreateTime, pageVO.getCreateTime())
+                .le(ProductSpuDO::getStock, ProductConstants.ALERT_STOCK)
+                // 如果库存触发警戒库存且状态为回收站的话则不计入触发警戒库存的个数
+                .notIn(ProductSpuDO::getStatus, ProductSpuStatusEnum.RECYCLE.getStatus())
+        ;
+        return selectCount(queryWrapper);
+    }
+
+    default Long selectCount(SFunction<ProductSpuDO, ?> field, Object value,ProductSpuPageReqVO pageVO) {
+        return selectCount(new LambdaQueryWrapperX<ProductSpuDO>()
+                .eq(field, value)
+                .likeIfPresent(ProductSpuDO::getName, pageVO.getName())
+                .eqIfPresent(ProductSpuDO::getShopId, pageVO.getShopId())
+                .eqIfPresent(ProductSpuDO::getCategoryId, pageVO.getCategoryId())
+                .eqIfPresent(ProductSpuDO::getMerchantId, pageVO.getMerchantId())
+                .betweenIfPresent(ProductSpuDO::getCreateTime, pageVO.getCreateTime())
+        );
+    }
+
     /**
      * 获得商品 SPU 分页,提供给用户 App 使用
      */

+ 2 - 2
feifan-module-mall/feifan-module-product-biz/src/main/java/cn/newfeifan/mall/module/product/service/spu/ProductSpuService.java

@@ -98,10 +98,10 @@ public interface ProductSpuService {
 
     /**
      * 获取 SPU 列表标签对应的 Count 数量
-     *
+     * @param pageVO 条件查询
      * @return Count 数量
      */
-    Map<Integer, Long> getTabsCount();
+    Map<Integer, Long> getTabsCount(ProductSpuPageReqVO pageVO);
 
 
     /**

+ 11 - 6
feifan-module-mall/feifan-module-product-biz/src/main/java/cn/newfeifan/mall/module/product/service/spu/ProductSpuServiceImpl.java

@@ -270,23 +270,28 @@ public class ProductSpuServiceImpl implements ProductSpuService {
     }
 
     @Override
-    public Map<Integer, Long> getTabsCount() {
+    public Map<Integer, Long> getTabsCount(ProductSpuPageReqVO pageVO) {
+        UserShopDetailsVO userShopDetails = userService.getUserShopDetails();
+        pageVO.setShopId(userShopDetails.getShopId());
+        pageVO.setMerchantId(userShopDetails.getMerId());
+
         Map<Integer, Long> counts = Maps.newLinkedHashMapWithExpectedSize(5);
+
         // 查询销售中的商品数量
         counts.put(ProductSpuPageReqVO.FOR_SALE,
-                productSpuMapper.selectCount(ProductSpuDO::getStatus, ProductSpuStatusEnum.ENABLE.getStatus()));
+                productSpuMapper.selectCount(ProductSpuDO::getStatus, ProductSpuStatusEnum.ENABLE.getStatus(),pageVO));
         // 查询仓库中的商品数量
         counts.put(ProductSpuPageReqVO.IN_WAREHOUSE,
-                productSpuMapper.selectCount(ProductSpuDO::getStatus, ProductSpuStatusEnum.DISABLE.getStatus()));
+                productSpuMapper.selectCount(ProductSpuDO::getStatus, ProductSpuStatusEnum.DISABLE.getStatus(),pageVO));
         // 查询售空的商品数量
         counts.put(ProductSpuPageReqVO.SOLD_OUT,
-                productSpuMapper.selectCount(ProductSpuDO::getStock, 0));
+                productSpuMapper.selectCount(ProductSpuDO::getStock, 0,pageVO));
         // 查询触发警戒库存的商品数量
         counts.put(ProductSpuPageReqVO.ALERT_STOCK,
-                productSpuMapper.selectCount());
+                productSpuMapper.selectCount(pageVO));
         // 查询回收站中的商品数量
         counts.put(ProductSpuPageReqVO.RECYCLE_BIN,
-                productSpuMapper.selectCount(ProductSpuDO::getStatus, ProductSpuStatusEnum.RECYCLE.getStatus()));
+                productSpuMapper.selectCount(ProductSpuDO::getStatus, ProductSpuStatusEnum.RECYCLE.getStatus(),pageVO));
         return counts;
     }
 

+ 6 - 0
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/aftersale/AfterSaleController.java

@@ -67,6 +67,12 @@ public class AfterSaleController {
         return success(AfterSaleConvert.INSTANCE.convertPage(pageResult, memberUsers));
     }
 
+    @GetMapping("/get-count")
+    @Operation(summary = "获得售后交易订单数量")
+    public CommonResult<Map<Integer, Long>> getAfterSaleCount(@Valid AfterSalePageReqVO pageVO) {
+        return success(afterSaleService.getTabsCount(pageVO));
+    }
+
     @GetMapping("/get-detail")
     @Operation(summary = "获得售后订单详情")
     @Parameter(name = "id", description = "售后编号", required = true, example = "1")

+ 8 - 2
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/aftersale/vo/AfterSalePageReqVO.java

@@ -42,13 +42,19 @@ public class AfterSalePageReqVO extends PageParam {
     @Schema(description = "商品 SPU 名称", example = "李四")
     private String spuName;
 
+    @Schema(description = "商品 SPU ID", example = "1")
+    private String spuId;
+
     @Schema(description = "创建时间")
     @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
     private LocalDateTime[] createTime;
 
-    @Schema(description = "店铺id", example = "1")
+    @Schema(description = "店铺id", example = "17019")
     private Long shopId;
 
-    @Schema(description = "商户id", example = "1")
+    @Schema(description = "商户id", example = "27067")
     private Long merchantId;
+
+    @Schema(description = "用户id", example = "1")
+    private Long userId;
 }

+ 9 - 8
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/order/TradeOrderController.java

@@ -268,15 +268,16 @@ public class TradeOrderController {
 
     @GetMapping("/get-count")
     @Operation(summary = "获得交易订单数量")
-    public CommonResult<Map<Integer, Long>> getOrderCount() {
+    public CommonResult<Map<Integer, Long>> getOrderCount(TradeOrderPageReqVO reqVO) {
         Map<Integer, Long> orderCount = Maps.newLinkedHashMapWithExpectedSize(6);
-        orderCount.put(-1, tradeOrderQueryService.getOrderCount(null));
-        orderCount.put(TradeOrderStatusEnum.AFTER_SALE.getStatus(), afterSaleService.getApplyingAfterSaleCount(null));
-        orderCount.put(TradeOrderStatusEnum.UNPAID.getStatus(), tradeOrderQueryService.getOrderCount(TradeOrderStatusEnum.UNPAID.getStatus()));
-        orderCount.put(TradeOrderStatusEnum.UNDELIVERED.getStatus(), tradeOrderQueryService.getOrderCount(TradeOrderStatusEnum.UNDELIVERED.getStatus()));
-        orderCount.put(TradeOrderStatusEnum.DELIVERED.getStatus(), tradeOrderQueryService.getOrderCount(TradeOrderStatusEnum.DELIVERED.getStatus()));
-        orderCount.put(TradeOrderStatusEnum.COMPLETED.getStatus(), tradeOrderQueryService.getOrderCount(TradeOrderStatusEnum.COMPLETED.getStatus()));
-        orderCount.put(TradeOrderStatusEnum.CANCELED.getStatus(), tradeOrderQueryService.getOrderCount(TradeOrderStatusEnum.CANCELED.getStatus()));
+
+        orderCount.put(-1, tradeOrderQueryService.getOrderCount(null, reqVO));
+        orderCount.put(TradeOrderStatusEnum.AFTER_SALE.getStatus(), afterSaleService.getApplyingAfterSaleCount(null, reqVO));
+        orderCount.put(TradeOrderStatusEnum.UNPAID.getStatus(), tradeOrderQueryService.getOrderCount(TradeOrderStatusEnum.UNPAID.getStatus(), reqVO));
+        orderCount.put(TradeOrderStatusEnum.UNDELIVERED.getStatus(), tradeOrderQueryService.getOrderCount(TradeOrderStatusEnum.UNDELIVERED.getStatus(), reqVO));
+        orderCount.put(TradeOrderStatusEnum.DELIVERED.getStatus(), tradeOrderQueryService.getOrderCount(TradeOrderStatusEnum.DELIVERED.getStatus(), reqVO));
+        orderCount.put(TradeOrderStatusEnum.COMPLETED.getStatus(), tradeOrderQueryService.getOrderCount(TradeOrderStatusEnum.COMPLETED.getStatus(), reqVO));
+        orderCount.put(TradeOrderStatusEnum.CANCELED.getStatus(), tradeOrderQueryService.getOrderCount(TradeOrderStatusEnum.CANCELED.getStatus(), reqVO));
         return success(orderCount);
     }
 

+ 1 - 1
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/app/order/AppTradeOrderController.java

@@ -135,7 +135,7 @@ public class AppTradeOrderController {
         orderCount.put("uncommentedCount", tradeOrderQueryService.getOrderCount(getLoginUserId(),
                 TradeOrderStatusEnum.COMPLETED.getStatus(), false));
         // 售后数量
-        orderCount.put("afterSaleCount", afterSaleService.getApplyingAfterSaleCount(getLoginUserId()));
+        orderCount.put("afterSaleCount", afterSaleService.getApplyingAfterSaleCount(getLoginUserId(),null));
         return success(orderCount);
     }
 

+ 26 - 4
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/dal/mysql/aftersale/AfterSaleMapper.java

@@ -5,6 +5,7 @@ import cn.newfeifan.mall.framework.common.pojo.PageResult;
 import cn.newfeifan.mall.framework.mybatis.core.mapper.BaseMapperX;
 import cn.newfeifan.mall.framework.mybatis.core.query.LambdaQueryWrapperX;
 import cn.newfeifan.mall.module.trade.controller.admin.aftersale.vo.AfterSalePageReqVO;
+import cn.newfeifan.mall.module.trade.controller.admin.order.vo.TradeOrderPageReqVO;
 import cn.newfeifan.mall.module.trade.dal.dataobject.aftersale.AfterSaleDO;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import org.apache.ibatis.annotations.Mapper;
@@ -49,12 +50,33 @@ public interface AfterSaleMapper extends BaseMapperX<AfterSaleDO> {
                 .eqIfPresent(AfterSaleDO::getUserId, userId)
                 .in(AfterSaleDO::getStatus, statuses));
     }
-    default Long selectCountByUserIdAndStatus(Long userId, Long shopId, Long merId, Collection<Integer> statuses) {
+    default Long selectCountByUserIdAndStatus(Long userId, Collection<Integer> statuses, TradeOrderPageReqVO reqVO) {
         return selectCount(new LambdaQueryWrapperX<AfterSaleDO>()
                 .eqIfPresent(AfterSaleDO::getUserId, userId)
-                .eqIfPresent(AfterSaleDO::getShopId, shopId)
-                .eqIfPresent(AfterSaleDO::getMerchantId, merId)
-                .in(AfterSaleDO::getStatus, statuses));
+                .in(AfterSaleDO::getStatus, statuses)
+                .likeIfPresent(AfterSaleDO::getNo, reqVO.getNo())
+                .eqIfPresent(AfterSaleDO::getType, reqVO.getType())
+                .eqIfPresent(AfterSaleDO::getShopId,reqVO.getShopId())
+                .eqIfPresent(AfterSaleDO::getMerchantId,reqVO.getMerchantId())
+                .eqIfPresent(AfterSaleDO::getUserId, reqVO.getUserId())
+                .betweenIfPresent(AfterSaleDO::getCreateTime, reqVO.getCreateTime())
+        );
+    }
+
+    default Long selectCount(Integer status,AfterSalePageReqVO reqVO){
+        return selectCount(new LambdaQueryWrapperX<AfterSaleDO>()
+                .eq(AfterSaleDO::getStatus, status)
+                .likeIfPresent(AfterSaleDO::getNo, reqVO.getNo())
+                .eqIfPresent(AfterSaleDO::getSpuId, reqVO.getSpuId())
+                .eqIfPresent(AfterSaleDO::getType, reqVO.getType())
+                .eqIfPresent(AfterSaleDO::getShopId,reqVO.getShopId())
+                .eqIfPresent(AfterSaleDO::getMerchantId,reqVO.getMerchantId())
+                .eqIfPresent(AfterSaleDO::getWay, reqVO.getWay())
+                .eqIfPresent(AfterSaleDO::getUserId, reqVO.getUserId())
+                .likeIfPresent(AfterSaleDO::getOrderNo, reqVO.getOrderNo())
+                .likeIfPresent(AfterSaleDO::getSpuName, reqVO.getSpuName())
+                .betweenIfPresent(AfterSaleDO::getCreateTime, reqVO.getCreateTime())
+        );
     }
 
 }

+ 13 - 4
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/dal/mysql/order/TradeOrderMapper.java

@@ -88,14 +88,24 @@ public interface TradeOrderMapper extends BaseMapperX<TradeOrderDO> {
                 .eqIfPresent(TradeOrderDO::getStatus, status));
     }
 
-    default Long selectCountByStatus(Integer status, Long shopId, Long merId) {
+    default Long selectCountByStatus(Integer status, Long shopId, Long merId, TradeOrderPageReqVO reqVO) {
         return selectCount(new LambdaQueryWrapperX<TradeOrderDO>()
                 .eqIfPresent(TradeOrderDO::getStatus, status)
+                .likeIfPresent(TradeOrderDO::getNo, reqVO.getNo())
+                .eqIfPresent(TradeOrderDO::getUserId, reqVO.getUserId())
+                .eqIfPresent(TradeOrderDO::getDeliveryType, reqVO.getDeliveryType())
+                .eqIfPresent(TradeOrderDO::getType, reqVO.getType())
+                .eqIfPresent(TradeOrderDO::getPayChannelCode, reqVO.getPayChannelCode())
+                .eqIfPresent(TradeOrderDO::getTerminal, reqVO.getTerminal())
+                .eqIfPresent(TradeOrderDO::getLogisticsId, reqVO.getLogisticsId())
+                .inIfPresent(TradeOrderDO::getPickUpStoreId, reqVO.getPickUpStoreIds())
+                .likeIfPresent(TradeOrderDO::getPickUpVerifyCode, reqVO.getPickUpVerifyCode())
+                .betweenIfPresent(TradeOrderDO::getCreateTime, reqVO.getCreateTime())
                 .eqIfPresent(TradeOrderDO::getShopId, shopId)
-                .eqIfPresent(TradeOrderDO::getMerchantId, merId));
+                .eqIfPresent(TradeOrderDO::getMerchantId, merId)
+        );
     }
 
-    ;
 
     default TradeOrderDO selectOrderByIdAndUserId(Long orderId, Long loginUserId) {
         return selectOne(new LambdaQueryWrapperX<TradeOrderDO>()
@@ -155,5 +165,4 @@ public interface TradeOrderMapper extends BaseMapperX<TradeOrderDO> {
         );
     }
 
-    ;
 }

+ 6 - 1
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/service/aftersale/AfterSaleService.java

@@ -5,11 +5,13 @@ import cn.newfeifan.mall.framework.common.pojo.PageResult;
 import cn.newfeifan.mall.module.trade.controller.admin.aftersale.vo.AfterSaleDisagreeReqVO;
 import cn.newfeifan.mall.module.trade.controller.admin.aftersale.vo.AfterSalePageReqVO;
 import cn.newfeifan.mall.module.trade.controller.admin.aftersale.vo.AfterSaleRefuseReqVO;
+import cn.newfeifan.mall.module.trade.controller.admin.order.vo.TradeOrderPageReqVO;
 import cn.newfeifan.mall.module.trade.controller.app.aftersale.vo.AppAfterSaleCreateReqVO;
 import cn.newfeifan.mall.module.trade.controller.app.aftersale.vo.AppAfterSaleDeliveryReqVO;
 import cn.newfeifan.mall.module.trade.dal.dataobject.aftersale.AfterSaleDO;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * 售后订单 Service 接口
@@ -129,9 +131,10 @@ public interface AfterSaleService {
      * 【会员】获得正在进行中的售后订单数量
      *
      * @param userId 用户编号
+     * @param reqVO  条件
      * @return 数量
      */
-    Long getApplyingAfterSaleCount(Long userId);
+    Long getApplyingAfterSaleCount(Long userId, TradeOrderPageReqVO reqVO);
 
     /**
      * 【商户】获取售后订单
@@ -152,4 +155,6 @@ public interface AfterSaleService {
      * @return       售后订单
      */
     List<AfterSaleDO> getAfterSaleByMerAndShop();
+
+    Map<Integer, Long> getTabsCount(AfterSalePageReqVO pageVO);
 }

+ 33 - 2
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/service/aftersale/AfterSaleServiceImpl.java

@@ -16,6 +16,7 @@ import cn.newfeifan.mall.module.system.service.user.AdminUserService;
 import cn.newfeifan.mall.module.trade.controller.admin.aftersale.vo.AfterSaleDisagreeReqVO;
 import cn.newfeifan.mall.module.trade.controller.admin.aftersale.vo.AfterSalePageReqVO;
 import cn.newfeifan.mall.module.trade.controller.admin.aftersale.vo.AfterSaleRefuseReqVO;
+import cn.newfeifan.mall.module.trade.controller.admin.order.vo.TradeOrderPageReqVO;
 import cn.newfeifan.mall.module.trade.controller.app.aftersale.vo.AppAfterSaleCreateReqVO;
 import cn.newfeifan.mall.module.trade.controller.app.aftersale.vo.AppAfterSaleDeliveryReqVO;
 import cn.newfeifan.mall.module.trade.convert.aftersale.AfterSaleConvert;
@@ -40,6 +41,7 @@ import cn.newfeifan.mall.module.trade.service.delivery.DeliveryExpressService;
 import cn.newfeifan.mall.module.trade.service.order.TradeOrderQueryService;
 import cn.newfeifan.mall.module.trade.service.order.TradeOrderUpdateService;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.google.common.collect.Maps;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -50,6 +52,7 @@ import org.springframework.validation.annotation.Validated;
 import javax.annotation.Resource;
 import java.time.LocalDateTime;
 import java.util.List;
+import java.util.Map;
 
 import static cn.newfeifan.mall.framework.common.exception.util.ServiceExceptionUtil.exception;
 import static cn.newfeifan.mall.module.trade.enums.ErrorCodeConstants.*;
@@ -461,9 +464,11 @@ public class AfterSaleServiceImpl implements AfterSaleService {
     }
 
     @Override
-    public Long getApplyingAfterSaleCount(Long userId) {
+    public Long getApplyingAfterSaleCount(Long userId, TradeOrderPageReqVO reqVO) {
         UserShopDetailsVO userShopDetails = userService.getUserShopDetails();
-        return tradeAfterSaleMapper.selectCountByUserIdAndStatus(userId, userShopDetails.getShopId(),userShopDetails.getMerId(), AfterSaleStatusEnum.APPLYING_STATUSES);
+        reqVO.setShopId(userShopDetails.getShopId());
+        reqVO.setMerchantId(userShopDetails.getMerId());
+        return tradeAfterSaleMapper.selectCountByUserIdAndStatus(userId, AfterSaleStatusEnum.APPLYING_STATUSES,reqVO);
     }
 
     @Override
@@ -491,5 +496,31 @@ public class AfterSaleServiceImpl implements AfterSaleService {
                 .eq(AfterSaleDO::getMerchantId, userShopDetails.getMerId()));
     }
 
+    @Override
+    public Map<Integer, Long> getTabsCount(AfterSalePageReqVO pageVO) {
+        UserShopDetailsVO userShopDetails = userService.getUserShopDetails();
+        pageVO.setShopId(userShopDetails.getShopId());
+        pageVO.setMerchantId(userShopDetails.getMerId());
+
+        Map<Integer, Long> counts = Maps.newLinkedHashMapWithExpectedSize(8);
+        // 查询申请售后的售后订单
+        counts.put(AfterSaleStatusEnum.APPLY.getStatus(),tradeAfterSaleMapper.selectCount(AfterSaleStatusEnum.APPLY.getStatus(),pageVO));
+        // 查询商品待退货的售后订单
+        counts.put(AfterSaleStatusEnum.SELLER_AGREE.getStatus(),tradeAfterSaleMapper.selectCount(AfterSaleStatusEnum.SELLER_AGREE.getStatus(),pageVO));
+        // 查询商家待收货的售后订单
+        counts.put(AfterSaleStatusEnum.BUYER_DELIVERY.getStatus(),tradeAfterSaleMapper.selectCount(AfterSaleStatusEnum.BUYER_DELIVERY.getStatus(),pageVO));
+        // 查询等待退款的售后订单
+        counts.put(AfterSaleStatusEnum.WAIT_REFUND.getStatus(),tradeAfterSaleMapper.selectCount(AfterSaleStatusEnum.WAIT_REFUND.getStatus(),pageVO));
+        // 查询退款成功的售后订单
+        counts.put(AfterSaleStatusEnum.COMPLETE.getStatus(),tradeAfterSaleMapper.selectCount(AfterSaleStatusEnum.COMPLETE.getStatus(),pageVO));
+        // 查询买家取消的售后订单
+        counts.put(AfterSaleStatusEnum.BUYER_CANCEL.getStatus(),tradeAfterSaleMapper.selectCount(AfterSaleStatusEnum.BUYER_CANCEL.getStatus(),pageVO));
+        // 查询商家拒绝的售后订单
+        counts.put(AfterSaleStatusEnum.SELLER_DISAGREE.getStatus(),tradeAfterSaleMapper.selectCount(AfterSaleStatusEnum.SELLER_DISAGREE.getStatus(),pageVO));
+        // 查询商家拒收货的售后订单
+        counts.put(AfterSaleStatusEnum.SELLER_REFUSE.getStatus(),tradeAfterSaleMapper.selectCount(AfterSaleStatusEnum.SELLER_REFUSE.getStatus(),pageVO));
+        return counts;
+    }
+
 
 }

+ 5 - 4
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/service/order/TradeOrderQueryService.java

@@ -157,11 +157,12 @@ public interface TradeOrderQueryService {
     List<TradeOrderItemDO> getOrderItemListByOrderId(Collection<Long> orderIds);
 
     /**
-     * 根据状态获取订单数量, 不通过用户ID信息
-     * @param status
-     * @return
+     * 根据条件获取订单数量
+     * @param reqVO 条件
+     * @param status 订单状态
+     * @return 数量
      */
-    Long getOrderCount(Integer status);
+    Long getOrderCount(Integer status, TradeOrderPageReqVO reqVO);
 
 
     /**

+ 4 - 3
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/service/order/TradeOrderQueryServiceImpl.java

@@ -172,15 +172,16 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
     }
 
     @Override
-    public Long getOrderCount(Integer status) {
+    public Long getOrderCount(Integer status, TradeOrderPageReqVO reqVO) {
         UserShopDetailsVO userShopDetails = userService.getUserShopDetails();
 
-        return tradeOrderMapper.selectCountByStatus(status, userShopDetails.getShopId(), userShopDetails.getMerId());
+        return tradeOrderMapper.selectCountByStatus(status, userShopDetails.getShopId(), userShopDetails.getMerId(),reqVO);
     }
 
     @Override
     public Long getOrderCount(Integer status, Long shopId, Long merId) {
-        return tradeOrderMapper.selectCountByStatus(status, shopId, merId);
+//        return tradeOrderMapper.selectCountByStatus(status, shopId, merId);
+        return null;
     }
 
     @Override