Browse Source

Merge branch 'dev/2024/0408/update-product' of Harper/feifan-backend-zx-app into master

在评论和售后订单中加入商户、店铺编号
Yangzw 11 months ago
parent
commit
cca30d0285

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

@@ -0,0 +1,22 @@
+package cn.newfeifan.mall.module.product.controller.admin.comment.vo;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 商户、店铺 BO
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class ShopBO {
+    /**
+     * 店铺id
+     */
+    private Long shopId;
+    /**
+     * 商户id
+     */
+    private Long merchantId;
+}

+ 8 - 0
feifan-module-mall/feifan-module-product-biz/src/main/java/cn/newfeifan/mall/module/product/dal/dataobject/comment/ProductCommentDO.java

@@ -155,5 +155,13 @@ public class ProductCommentDO extends BaseDO {
      * 商家回复时间
      */
     private LocalDateTime replyTime;
+    /**
+     * 店铺id
+     */
+    private Long shopId;
+    /**
+     * 商户id
+     */
+    private Long merchantId;
 
 }

+ 8 - 0
feifan-module-mall/feifan-module-product-biz/src/main/java/cn/newfeifan/mall/module/product/dal/dataobject/spu/ProductSpuDO.java

@@ -168,4 +168,12 @@ public class ProductSpuDO extends BaseDO {
      * 浏览量
      */
     private Integer browseCount;
+    /**
+     * 店铺id
+     */
+    private Long shopId;
+    /**
+     * 商户id
+     */
+    private Long merchantId;
 }

+ 14 - 4
feifan-module-mall/feifan-module-product-biz/src/main/java/cn/newfeifan/mall/module/product/service/comment/ProductCommentServiceImpl.java

@@ -4,10 +4,7 @@ import cn.newfeifan.mall.framework.common.pojo.PageResult;
 import cn.newfeifan.mall.module.member.api.user.MemberUserApi;
 import cn.newfeifan.mall.module.member.api.user.dto.MemberUserRespDTO;
 import cn.newfeifan.mall.module.product.api.comment.dto.ProductCommentCreateReqDTO;
-import cn.newfeifan.mall.module.product.controller.admin.comment.vo.ProductCommentCreateReqVO;
-import cn.newfeifan.mall.module.product.controller.admin.comment.vo.ProductCommentPageReqVO;
-import cn.newfeifan.mall.module.product.controller.admin.comment.vo.ProductCommentReplyReqVO;
-import cn.newfeifan.mall.module.product.controller.admin.comment.vo.ProductCommentUpdateVisibleReqVO;
+import cn.newfeifan.mall.module.product.controller.admin.comment.vo.*;
 import cn.newfeifan.mall.module.product.controller.app.comment.vo.AppCommentPageReqVO;
 import cn.newfeifan.mall.module.product.convert.comment.ProductCommentConvert;
 import cn.newfeifan.mall.module.product.dal.dataobject.comment.ProductCommentDO;
@@ -57,6 +54,11 @@ public class ProductCommentServiceImpl implements ProductCommentService {
 
         // 创建评论
         ProductCommentDO comment = ProductCommentConvert.INSTANCE.convert(createReqVO, spu, sku);
+
+        ShopBO shop = getShop(sku.getSpuId());
+        comment.setShopId(shop.getShopId());
+        comment.setMerchantId(shop.getMerchantId());
+
         productCommentMapper.insert(comment);
     }
 
@@ -106,6 +108,14 @@ public class ProductCommentServiceImpl implements ProductCommentService {
         return spu;
     }
 
+    private ShopBO getShop(Long spuId){
+        ProductSpuDO spu = productSpuService.getSpu(spuId);
+        if (null == spu) {
+            throw exception(SPU_NOT_EXISTS);
+        }
+        return new ShopBO(spu.getShopId(),spu.getMerchantId());
+    }
+
     @Override
     public void updateCommentVisible(ProductCommentUpdateVisibleReqVO updateReqVO) {
         // 校验评论是否存在

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

@@ -19,8 +19,8 @@ public class AppAfterSaleCreateReqVO {
 
     @Schema(description = "售后方式", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
     @NotNull(message = "售后方式不能为空")
-    @InEnum(value = AfterSaleWayEnum.class, message = "售后方式必须是 {value}")
-    private Integer way;
+    private Integer way;    @InEnum(value = AfterSaleWayEnum.class, message = "售后方式必须是 {value}")
+
 
     @Schema(description = "退款金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
     @NotNull(message = "退款金额不能为空")
@@ -37,4 +37,10 @@ public class AppAfterSaleCreateReqVO {
     @Schema(description = "补充凭证图片", example = "https://www.zhongxing.cn/1.png, https://www.zhongxing.cn/2.png")
     private List<String> applyPicUrls;
 
+    @Schema(description = "店铺id")
+    private Long shopId;
+
+    @Schema(description = "商户id")
+    private Long merchantId;
+
 }

+ 8 - 0
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/dal/dataobject/aftersale/AfterSaleDO.java

@@ -197,5 +197,13 @@ public class AfterSaleDO extends BaseDO {
      * 注意,只有拒绝收货才会填写
      */
     private String receiveReason;
+    /**
+     * 店铺id
+     */
+    private Long shopId;
+    /**
+     * 商户id
+     */
+    private Long merchantId;
 
 }

+ 8 - 0
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/dal/dataobject/order/TradeOrderDO.java

@@ -329,5 +329,13 @@ public class TradeOrderDO extends BaseDO {
      * 关联 CombinationRecordDO 的 id 字段
      */
     private Long combinationRecordId;
+    /**
+     * 店铺id
+     */
+    private Long shopId;
+    /**
+     * 商户id
+     */
+    private Long merchantId;
 
 }

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

@@ -8,6 +8,7 @@ import cn.newfeifan.mall.framework.common.pojo.PageResult;
 import cn.newfeifan.mall.framework.common.util.object.ObjectUtils;
 import cn.newfeifan.mall.module.pay.api.refund.PayRefundApi;
 import cn.newfeifan.mall.module.pay.api.refund.dto.PayRefundCreateReqDTO;
+import cn.newfeifan.mall.module.product.controller.admin.comment.vo.ShopBO;
 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;
@@ -160,6 +161,12 @@ public class AfterSaleServiceImpl implements AfterSaleService {
         afterSale.setOrderNo(order.getNo()); // 记录 orderNo 订单流水,方便后续检索
         afterSale.setType(TradeOrderStatusEnum.isCompleted(order.getStatus())
                 ? AfterSaleTypeEnum.AFTER_SALE.getType() : AfterSaleTypeEnum.IN_SALE.getType());
+
+        //插入店铺信息及商户信息
+        ShopBO shop = getShop(afterSale.getOrderId());
+        afterSale.setShopId(shop.getShopId());
+        afterSale.setMerchantId(shop.getMerchantId());
+
         tradeAfterSaleMapper.insert(afterSale);
 
         // 更新交易订单项的售后状态
@@ -173,6 +180,16 @@ public class AfterSaleServiceImpl implements AfterSaleService {
         return afterSale;
     }
 
+    /**
+     * 获取商户、店铺信息
+     * @param orderId 订单编号
+     * @return 商铺信息
+     */
+    private ShopBO getShop(Long orderId){
+        TradeOrderDO order = tradeOrderQueryService.getOrder(orderId);
+        return new ShopBO(order.getShopId(),order.getMerchantId());
+    }
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     @AfterSaleLog(operateType = AfterSaleOperateTypeEnum.ADMIN_AGREE_APPLY)