Переглянути джерело

更新商户端商品及售后查询接口

Yangzw 11 місяців тому
батько
коміт
634b9ef5ed

+ 3 - 3
feifan-module-mall/feifan-module-product-biz/src/main/java/cn/newfeifan/mall/module/product/controller/admin/comment/ProductCommentController.java

@@ -27,9 +27,9 @@ public class ProductCommentController {
     @Resource
     private ProductCommentService productCommentService;
 
-    @GetMapping("/page")
-    @Operation(summary = "获得商品评价分页")
-    @PreAuthorize("@ss.hasPermission('product:comment:query')")
+    @GetMapping("/page_spu")
+    @Operation(summary = "获得商品评价 - 商品")
+    @PreAuthorize("@ss.hasPermission('product:comment:query-sh')")
     public CommonResult<PageResult<ProductCommentRespVO>> getCommentPage(@Valid ProductCommentPageReqVO pageVO) {
         PageResult<ProductCommentDO> pageResult = productCommentService.getCommentPage(pageVO);
         return success(BeanUtils.toBean(pageResult, ProductCommentRespVO.class));

+ 0 - 1
feifan-module-mall/feifan-module-product-biz/src/main/java/cn/newfeifan/mall/module/product/controller/admin/comment/vo/ProductCommentPageReqVO.java

@@ -24,7 +24,6 @@ public class ProductCommentPageReqVO extends PageParam {
     private String userNickname;
 
     @Schema(description = "交易订单编号", example = "24428")
-    @NotNull
     private Long orderId;
 
     @Schema(description = "商品SPU编号", example = "29502")

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

@@ -54,10 +54,10 @@ public interface ProductSpuMapper extends BaseMapperX<ProductSpuDO> {
     }
 
     default Long selectCount(SFunction<ProductSpuDO, ?> field, Object value,Long merId,Long shopId){
-        return selectCount(new LambdaQueryWrapper<ProductSpuDO>()
+        return selectCount(new LambdaQueryWrapperX<ProductSpuDO>()
                 .eq(field, value)
-                .eq(ProductSpuDO::getMerchantId, merId)
-                .eq(ProductSpuDO::getShopId, shopId));
+                .eqIfPresent(ProductSpuDO::getMerchantId, merId)
+                .eqIfPresent(ProductSpuDO::getShopId, shopId));
     }
 
     /**

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

@@ -204,16 +204,15 @@ public class TradeOrderController {
 
     @GetMapping("/get-count")
     @Operation(summary = "获得交易订单数量")
-    public CommonResult<Map<Integer, Long>> getOrderCount(@RequestParam(value = "shopId", required = false) Long shopId,
-                                                          @RequestParam(value = "merId", required = false) Long merId) {
+    public CommonResult<Map<Integer, Long>> getOrderCount() {
         Map<Integer, Long> orderCount = Maps.newLinkedHashMapWithExpectedSize(6);
-        orderCount.put(-1, tradeOrderQueryService.getOrderCount(null, shopId, merId));
-        orderCount.put(TradeOrderStatusEnum.AFTER_SALE.getStatus(), afterSaleService.getApplyingAfterSaleCount(null, shopId, merId));
-        orderCount.put(TradeOrderStatusEnum.UNPAID.getStatus(), tradeOrderQueryService.getOrderCount(TradeOrderStatusEnum.UNPAID.getStatus(), shopId, merId));
-        orderCount.put(TradeOrderStatusEnum.UNDELIVERED.getStatus(), tradeOrderQueryService.getOrderCount(TradeOrderStatusEnum.UNDELIVERED.getStatus(), shopId, merId));
-        orderCount.put(TradeOrderStatusEnum.DELIVERED.getStatus(), tradeOrderQueryService.getOrderCount(TradeOrderStatusEnum.DELIVERED.getStatus(), shopId, merId));
-        orderCount.put(TradeOrderStatusEnum.COMPLETED.getStatus(), tradeOrderQueryService.getOrderCount(TradeOrderStatusEnum.COMPLETED.getStatus(), shopId, merId));
-        orderCount.put(TradeOrderStatusEnum.CANCELED.getStatus(), tradeOrderQueryService.getOrderCount(TradeOrderStatusEnum.CANCELED.getStatus(), shopId, merId));
+        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()));
         return success(orderCount);
     }
 

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

@@ -133,16 +133,6 @@ public interface AfterSaleService {
      */
     Long getApplyingAfterSaleCount(Long userId);
 
-    /**
-     * 【会员】获得正在进行中的售后订单数量
-     *
-     * @param userId 用户编号
-     * @param shopId 店铺编号
-     * @param merId  商户编号
-     * @return 数量
-     */
-    Long getApplyingAfterSaleCount(Long userId,Long shopId, Long merId);
-
     /**
      * 【商户】获取售后订单
      * @param orderIds  订单ID集

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

@@ -6,6 +6,7 @@ import cn.hutool.core.util.StrUtil;
 import cn.newfeifan.mall.framework.common.pojo.PageParam;
 import cn.newfeifan.mall.framework.common.pojo.PageResult;
 import cn.newfeifan.mall.framework.common.util.object.ObjectUtils;
+import cn.newfeifan.mall.framework.mybatis.core.query.LambdaQueryWrapperX;
 import cn.newfeifan.mall.module.pay.api.refund.PayRefundApi;
 import cn.newfeifan.mall.module.pay.api.refund.dto.PayRefundCreateReqDTO;
 import cn.newfeifan.mall.module.system.dal.dataobject.user.AdminUserDO;
@@ -37,7 +38,6 @@ import cn.newfeifan.mall.module.trade.service.order.TradeOrderQueryService;
 import cn.newfeifan.mall.module.trade.service.order.TradeOrderUpdateService;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
@@ -430,12 +430,8 @@ public class AfterSaleServiceImpl implements AfterSaleService {
 
     @Override
     public Long getApplyingAfterSaleCount(Long userId) {
-        return tradeAfterSaleMapper.selectCountByUserIdAndStatus(userId, AfterSaleStatusEnum.APPLYING_STATUSES);
-    }
-
-    @Override
-    public Long getApplyingAfterSaleCount(Long userId, Long shopId, Long merId) {
-        return tradeAfterSaleMapper.selectCountByUserIdAndStatus(userId, shopId, merId, AfterSaleStatusEnum.APPLYING_STATUSES);
+        ShopBO shop = getShop();
+        return tradeAfterSaleMapper.selectCountByUserIdAndStatus(userId, shop.getShopId(),shop.getMerId(), AfterSaleStatusEnum.APPLYING_STATUSES);
     }
 
     @Override
@@ -446,16 +442,20 @@ public class AfterSaleServiceImpl implements AfterSaleService {
 
     @Override
     public List<AfterSaleDO> getAfterSaleByProId(Long spuId) {
-        return tradeAfterSaleMapper.selectList(new LambdaQueryWrapper<AfterSaleDO>()
-                .eq(AfterSaleDO::getSpuId, spuId));
+        ShopBO shop = getShop();
+        return tradeAfterSaleMapper.selectList(new LambdaQueryWrapperX<AfterSaleDO>()
+                .eq(AfterSaleDO::getSpuId, spuId)
+                .eqIfPresent(AfterSaleDO::getShopId, shop.getShopId())
+                .eqIfPresent(AfterSaleDO::getMerchantId,shop.getMerId())
+        );
     }
 
     @Override
     public List<AfterSaleDO> getAfterSaleByMerAndShop() {
         ShopBO shop = getShop();
 
-        return tradeAfterSaleMapper.selectList(new LambdaQueryWrapper<AfterSaleDO>()
-                .eq(AfterSaleDO::getShopId, shop.getShopId())
+        return tradeAfterSaleMapper.selectList(new LambdaQueryWrapperX<AfterSaleDO>()
+                .eqIfPresent(AfterSaleDO::getShopId, shop.getShopId())
                 .eq(AfterSaleDO::getMerchantId, shop.getMerId()));
     }
 

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

@@ -182,7 +182,8 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
 
     @Override
     public Long getOrderCount(Integer status) {
-        return tradeOrderMapper.selectCountByStatus(status);
+        ShopBO shop = getShop();
+        return tradeOrderMapper.selectCountByStatus(status,shop.getShopId(),shop.getMerId());
     }
 
     @Override