Bladeren bron

添加积分商城所需的参数

Yangzw 10 maanden geleden
bovenliggende
commit
9eb288bbb8
13 gewijzigde bestanden met toevoegingen van 79 en 13 verwijderingen
  1. 4 0
      feifan-module-mall/feifan-module-product-biz/src/main/java/cn/newfeifan/mall/module/product/controller/admin/spu/vo/ProductSpuSaveReqVO.java
  2. 4 0
      feifan-module-mall/feifan-module-product-biz/src/main/java/cn/newfeifan/mall/module/product/dal/dataobject/spu/ProductSpuDO.java
  3. 2 0
      feifan-module-mall/feifan-module-trade-api/src/main/java/cn/newfeifan/mall/module/trade/enums/ErrorCodeConstants.java
  4. 3 1
      feifan-module-mall/feifan-module-trade-api/src/main/java/cn/newfeifan/mall/module/trade/enums/delivery/DeliveryTypeEnum.java
  5. 8 2
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/order/TradeOrderController.java
  6. 3 0
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/order/vo/TradeOrderBaseVO.java
  7. 4 2
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/order/vo/TradeOrderDeliveryReqVO.java
  8. 4 4
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/order/vo/TradeOrderDetailRespVO.java
  9. 9 0
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/dal/dataobject/order/TradeOrderDO.java
  10. 7 0
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/service/order/TradeOrderQueryService.java
  11. 16 0
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/service/order/TradeOrderQueryServiceImpl.java
  12. 12 4
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/service/order/TradeOrderUpdateServiceImpl.java
  13. 3 0
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/service/price/calculator/TradeDeliveryPriceCalculator.java

+ 4 - 0
feifan-module-mall/feifan-module-product-biz/src/main/java/cn/newfeifan/mall/module/product/controller/admin/spu/vo/ProductSpuSaveReqVO.java

@@ -104,4 +104,8 @@ public class ProductSpuSaveReqVO {
 
     @Schema(description = "商户id", example = "8240")
     private Long merchantId;
+
+    @Schema(description = "商品支付类别", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
+    @NotNull(message = "商品支付类别不能为空")
+    private Integer spuPayType;
 }

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

@@ -192,5 +192,9 @@ public class ProductSpuDO extends BaseDO {
      */
     private Long merchantId;
 
+    /**
+     * 商品支付类别
+     */
+    private Integer spuPayType;
 
 }

+ 2 - 0
feifan-module-mall/feifan-module-trade-api/src/main/java/cn/newfeifan/mall/module/trade/enums/ErrorCodeConstants.java

@@ -35,6 +35,8 @@ public interface ErrorCodeConstants {
     ErrorCode ORDER_RECEIVE_FAIL_DELIVERY_TYPE_NOT_PICK_UP = new ErrorCode(1_011_000_030, "交易订单自提失败,收货方式不是【用户自提】");
     ErrorCode ORDER_UPDATE_ADDRESS_FAIL_STATUS_NOT_DELIVERED = new ErrorCode(1_011_000_031, "交易订单修改收货地址失败,原因:订单不是【待发货】状态");
     ErrorCode ORDER_CREATE_FAIL_EXIST_UNPAID = new ErrorCode(1_011_000_032, "交易订单创建失败,原因:存在未付款订单");
+    ErrorCode ORDER_DELIVERY_DETAILS_IS_NULL = new ErrorCode(1_011_000_033, "交易订单发货失败,请填写完整信息");
+
 
     // ========== After Sale 模块 1-011-000-100 ==========
     ErrorCode AFTER_SALE_NOT_FOUND = new ErrorCode(1_011_000_100, "售后单不存在");

+ 3 - 1
feifan-module-mall/feifan-module-trade-api/src/main/java/cn/newfeifan/mall/module/trade/enums/delivery/DeliveryTypeEnum.java

@@ -17,7 +17,9 @@ import java.util.HashMap;
 public enum DeliveryTypeEnum implements IntArrayValuable {
 
     EXPRESS(1, "快递发货"),
-    PICK_UP(2, "用户自提"),;
+    PICK_UP(2, "用户自提"),
+    VIRTUAL_PRODUCT(3,"虚拟商品收货")
+    ;
 
     public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(DeliveryTypeEnum::getType).toArray();
 

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

@@ -96,7 +96,11 @@ public class TradeOrderController {
         List<TradeOrderItemDO> orderItems = tradeOrderQueryService.getOrderItemListByOrderId(
                 convertSet(pageResult.getList(), TradeOrderDO::getId));
         // 最终组合
-        return success(TradeOrderConvert.INSTANCE.convertPage(pageResult, orderItems, userMap));
+        PageResult<TradeOrderPageItemRespVO> data = TradeOrderConvert.INSTANCE.convertPage(pageResult, orderItems, userMap);
+        for (TradeOrderPageItemRespVO tradeOrderPageItemRespVO : data.getList()) {
+            tradeOrderPageItemRespVO.setSpuType(tradeOrderQueryService.getSpuType(orderItems));
+        }
+        return success(data);
     }
 
     @GetMapping("/get-backlog")
@@ -140,7 +144,9 @@ public class TradeOrderController {
         MemberUserRespDTO brokerageUser = order.getBrokerageUserId() != null ?
                 memberUserApi.getUser(order.getBrokerageUserId()) : null;
         List<TradeOrderLogDO> orderLogs = tradeOrderLogService.getOrderLogListByOrderId(id);
-        return success(TradeOrderConvert.INSTANCE.convert(order, orderItems, orderLogs, user, brokerageUser));
+        TradeOrderDetailRespVO convert = TradeOrderConvert.INSTANCE.convert(order, orderItems, orderLogs, user, brokerageUser);
+        convert.setSpuType(tradeOrderQueryService.getSpuType(orderItems));
+        return success(convert);
     }
 
     @GetMapping("/get-express-track-list")

+ 3 - 0
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/order/vo/TradeOrderBaseVO.java

@@ -150,4 +150,7 @@ public class TradeOrderBaseVO {
 
     @Schema(description = "店铺id", example = "20588")
     private Long shopId;
+
+    @Schema(description = "商品类型,只有购买的商品是虚拟商品的时候才会有返回")
+    private Integer spuType;
 }

+ 4 - 2
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/order/vo/TradeOrderDeliveryReqVO.java

@@ -1,7 +1,5 @@
 package cn.newfeifan.mall.module.trade.controller.admin.order.vo;
 
-import cn.newfeifan.mall.framework.common.validation.InEnum;
-import cn.newfeifan.mall.module.trade.enums.delivery.DeliveryTypeEnum;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 
@@ -22,6 +20,10 @@ public class TradeOrderDeliveryReqVO {
     @Schema(description = "发货物流单号", example = "SF123456789")
     private String logisticsNo;
 
+    @Schema(description = "发货备注", example = "备注")
+    private String deliveryRemark;
 
+    @Schema(description = "发货信息附件", requiredMode = Schema.RequiredMode.REQUIRED)
+    private String attachment;
 
 }

+ 4 - 4
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/order/vo/TradeOrderDetailRespVO.java

@@ -1,15 +1,11 @@
 package cn.newfeifan.mall.module.trade.controller.admin.order.vo;
 
-import cn.newfeifan.mall.module.product.api.comment.dto.ProductCommentCreateReqDTO;
-import cn.newfeifan.mall.module.trade.controller.admin.aftersale.vo.AfterSaleBaseVO;
 import cn.newfeifan.mall.module.trade.controller.admin.base.member.user.MemberUserRespVO;
 import cn.newfeifan.mall.module.trade.controller.admin.base.product.property.ProductPropertyValueDetailRespVO;
-import cn.newfeifan.mall.module.trade.controller.app.order.vo.AppTradeOrderDetailRespVO;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 
 import java.time.LocalDateTime;
-import java.util.Date;
 import java.util.List;
 
 @Schema(description = "管理后台 - 交易订单的详情 Response VO")
@@ -104,5 +100,9 @@ public class TradeOrderDetailRespVO extends TradeOrderBaseVO {
 
     }
 
+    @Schema(description = "发货备注", example = "备注")
+    private String deliveryRemark;
 
+    @Schema(description = "发货信息附件")
+    private String attachment;
 }

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

@@ -348,4 +348,13 @@ public class TradeOrderDO extends BaseDO {
      * 物流签收时间
      */
     private LocalDateTime receivingTime;
+
+    /**
+     * 发货备注
+     */
+    private String deliveryRemark;
+    /**
+     * 发货信息附件
+     */
+    private String attachment;
 }

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

@@ -206,4 +206,11 @@ public interface TradeOrderQueryService {
      * @return 集合
      */
     Map<String, Long> getBacklog();
+
+    /**
+     * 用来判断当前的这个订单中的商品是不是虚拟商品
+     * @param orderItems 订单项
+     * @return 0 是虚拟商品
+     */
+    Integer getSpuType(List<TradeOrderItemDO> orderItems);
 }

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

@@ -10,6 +10,8 @@ import cn.newfeifan.mall.module.member.api.user.MemberUserApi;
 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.product.api.sku.ProductSkuApi;
+import cn.newfeifan.mall.module.product.dal.dataobject.spu.ProductSpuDO;
+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.service.user.AdminUserService;
 import cn.newfeifan.mall.module.trade.controller.admin.order.vo.TradeOrderPageReqVO;
@@ -76,6 +78,9 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
     @Lazy
     private AfterSaleService afterSaleService;
 
+    @Resource
+    private ProductSpuService productSpuService;
+
 
     // =================== Order ===================
 
@@ -234,6 +239,17 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
         return backMap;
     }
 
+    @Override
+    public Integer getSpuType(List<TradeOrderItemDO> orderItems) {
+        for (TradeOrderItemDO orderItem : orderItems) {
+            ProductSpuDO spu = productSpuService.getSpu(orderItem.getSpuId());
+            if(spu.getSpuType() == 0){
+                return 0;
+            }
+        }
+        return null;
+    }
+
     @Override
     public List<ExpressTrackRespDTO> getExpressTrackList(Long id, Long userId) {
         // 查询订单

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

@@ -80,7 +80,6 @@ import static cn.newfeifan.mall.framework.common.util.date.LocalDateTimeUtils.mi
 import static cn.newfeifan.mall.framework.common.util.servlet.ServletUtils.getClientIP;
 import static cn.newfeifan.mall.framework.web.core.util.WebFrameworkUtils.getTerminal;
 import static cn.newfeifan.mall.module.trade.enums.ErrorCodeConstants.*;
-import static cn.newfeifan.mall.module.trade.enums.ErrorCodeConstants.NOT_SUFFICIENT_FUNDS;
 
 /**
  * 交易订单【写】Service 实现类
@@ -353,12 +352,19 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
     @Transactional(rollbackFor = Exception.class)
     @TradeOrderLog(operateType = TradeOrderOperateTypeEnum.ADMIN_DELIVERY)
     public void deliveryOrder(TradeOrderDeliveryReqVO deliveryReqVO) {
+        //校验发货信息不能都为空
+        if(deliveryReqVO.getLogisticsNo() == null && deliveryReqVO.getDeliveryRemark() == null){
+            throw exception(ORDER_DELIVERY_DETAILS_IS_NULL);
+        }
+
         // 1.1 校验并获得交易订单(可发货)
         TradeOrderDO order = validateOrderDeliverable(deliveryReqVO.getId());
         order.setLogisticsId(deliveryReqVO.getLogisticsId());
         order.setLogisticsNo(deliveryReqVO.getLogisticsNo());
+        order.setAttachment(deliveryReqVO.getAttachment());
+        order.setDeliveryRemark(deliveryReqVO.getDeliveryRemark());
         // 1.2 校验 deliveryType 是否为快递,是快递才可以发货
-        if (ObjectUtil.notEqual(order.getDeliveryType(), DeliveryTypeEnum.EXPRESS.getType())) {
+        if (ObjectUtil.notEqual(order.getDeliveryType(), DeliveryTypeEnum.EXPRESS.getType()) || ObjectUtil.notEqual(order.getDeliveryType(), DeliveryTypeEnum.VIRTUAL_PRODUCT.getType())) {
             throw exception(ORDER_DELIVERY_FAIL_DELIVERY_TYPE_NOT_EXPRESS);
         }
 
@@ -366,7 +372,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
         TradeOrderDO updateOrderObj = new TradeOrderDO();
         // 2.1 快递发货
         DeliveryExpressDO express = null;
-        if (ObjectUtil.notEqual(deliveryReqVO.getLogisticsId(), TradeOrderDO.LOGISTICS_ID_NULL)) {
+        if (ObjectUtil.notEqual(deliveryReqVO.getLogisticsId(), TradeOrderDO.LOGISTICS_ID_NULL) && deliveryReqVO.getLogisticsId() != null) {
             express = deliveryExpressService.validateDeliveryExpress(deliveryReqVO.getLogisticsId());
             updateOrderObj.setLogisticsId(deliveryReqVO.getLogisticsId()).setLogisticsNo(deliveryReqVO.getLogisticsNo());
         } else {
@@ -376,7 +382,9 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
 
         try {
             //发送订单订阅
-            subscribe(order);
+            if (deliveryReqVO.getLogisticsId() != null && deliveryReqVO.getLogisticsNo() != null) {
+                subscribe(order);
+            }
         } catch (Exception e) {
             throw new RuntimeException(e);
         }

+ 3 - 0
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/service/price/calculator/TradeDeliveryPriceCalculator.java

@@ -59,6 +59,9 @@ public class TradeDeliveryPriceCalculator implements TradePriceCalculator {
             calculateByPickUp(param);
         } else if (DeliveryTypeEnum.EXPRESS.getType().equals(param.getDeliveryType())) {
             calculateExpress(param, result);
+        } else if (DeliveryTypeEnum.VIRTUAL_PRODUCT.getType().equals(param.getDeliveryType())) {
+            // 虚拟商品不需要计算运费
+            calculateByPickUp(param);
         }
     }