From 8c182b3ba68aa74befe624697cb842e1b53034eb Mon Sep 17 00:00:00 2001
From: xin <1099200748@qq.com>
Date: Thu, 07 Aug 2025 16:47:01 +0800
Subject: [PATCH] 订单-打包费

---
 oying-system/src/main/resources/mapper/sh/OrderMapper.xml                          |    3 ++-
 oying-system/src/main/java/com/oying/modules/sh/service/impl/OrderServiceImpl.java |    4 ++++
 oying-system/src/main/java/com/oying/modules/sh/domain/Order.java                  |    4 ++++
 oying-system/src/main/resources/mapper/sh/OrderReturnMapper.xml                    |    3 ++-
 oying-system/src/main/java/com/oying/modules/sh/domain/OrderReturn.java            |    4 ++++
 oying-system/src/main/java/com/oying/modules/sh/domain/vo/OrderInfo.java           |    8 ++++----
 6 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/oying-system/src/main/java/com/oying/modules/sh/domain/Order.java b/oying-system/src/main/java/com/oying/modules/sh/domain/Order.java
index c899502..fde0f9d 100644
--- a/oying-system/src/main/java/com/oying/modules/sh/domain/Order.java
+++ b/oying-system/src/main/java/com/oying/modules/sh/domain/Order.java
@@ -60,6 +60,10 @@
     private String orderTime;
 
     @NotNull
+    @ApiModelProperty(value = "打包费")
+    private BigDecimal packagingPrice;
+
+    @NotNull
     @ApiModelProperty(value = "配送费")
     private BigDecimal sendPrice;
 
diff --git a/oying-system/src/main/java/com/oying/modules/sh/domain/OrderReturn.java b/oying-system/src/main/java/com/oying/modules/sh/domain/OrderReturn.java
index 988d692..4186ac7 100644
--- a/oying-system/src/main/java/com/oying/modules/sh/domain/OrderReturn.java
+++ b/oying-system/src/main/java/com/oying/modules/sh/domain/OrderReturn.java
@@ -59,6 +59,10 @@
     private String orderStoreNum;
 
     @NotNull
+    @ApiModelProperty(value = "打包费")
+    private BigDecimal packagingPrice;
+
+    @NotNull
     @ApiModelProperty(value = "配送费")
     private BigDecimal sendPrice;
 
diff --git a/oying-system/src/main/java/com/oying/modules/sh/domain/vo/OrderInfo.java b/oying-system/src/main/java/com/oying/modules/sh/domain/vo/OrderInfo.java
index 028d5cf..a6270c2 100644
--- a/oying-system/src/main/java/com/oying/modules/sh/domain/vo/OrderInfo.java
+++ b/oying-system/src/main/java/com/oying/modules/sh/domain/vo/OrderInfo.java
@@ -32,8 +32,8 @@
     private BigDecimal promotionAmount = BigDecimal.ZERO;
     @ApiModelProperty(value = "优惠卷待定")
     private Object coupon;
-    @ApiModelProperty(value = "运费待定")
-    private Object shippingFee;
-    @ApiModelProperty(value = "打包费待定")
-    private Object packingCharges;
+    @ApiModelProperty(value = "配送费")
+    private BigDecimal deliveryPrice = BigDecimal.ZERO;
+    @ApiModelProperty(value = "打包费")
+    private BigDecimal packagingPrice = BigDecimal.ZERO;
 }
diff --git a/oying-system/src/main/java/com/oying/modules/sh/service/impl/OrderServiceImpl.java b/oying-system/src/main/java/com/oying/modules/sh/service/impl/OrderServiceImpl.java
index 7a4cefa..b5b96a4 100644
--- a/oying-system/src/main/java/com/oying/modules/sh/service/impl/OrderServiceImpl.java
+++ b/oying-system/src/main/java/com/oying/modules/sh/service/impl/OrderServiceImpl.java
@@ -212,6 +212,7 @@
         }
         List<ProductInfo> products = new ArrayList<>();
         BigDecimal amount = BigDecimal.ZERO;
+        int count = 0;
         for (ProductOrder productOrder : criteria.getProducts()) {
             Product product = productService.getById(productOrder.getProductId());
             if (product == null) {
@@ -236,6 +237,7 @@
             info.setCount(productOrder.getCount());
             products.add(info);
             amount = BigDecimalUtils.add(amount, BigDecimalUtils.multiply(product.getPrice(), productOrder.getCount()));
+            count += productOrder.getCount();
         }
         if (!(amount.compareTo(store.getDeliveryMinimum()) >= 0)) {
             throw new BadRequestException("起送金额:" + store.getDeliveryMinimum());
@@ -246,6 +248,8 @@
         info.setAmount(amount);
         info.setPayAmount(amount);
         info.setPromotionAmount(BigDecimal.ZERO);
+        info.setDeliveryPrice(store.getDeliveryFee());
+        info.setPackagingPrice(BigDecimalUtils.multiply(store.getPackagingFee(), count));
         info.setUserAddresses(userAddressService.queryUserAddress(store.getLongitude(), store.getLatitude()));
         return info;
     }
diff --git a/oying-system/src/main/resources/mapper/sh/OrderMapper.xml b/oying-system/src/main/resources/mapper/sh/OrderMapper.xml
index 4ec5aec..8e86e97 100644
--- a/oying-system/src/main/resources/mapper/sh/OrderMapper.xml
+++ b/oying-system/src/main/resources/mapper/sh/OrderMapper.xml
@@ -9,6 +9,7 @@
         <result column="order_status_describe" property="orderStatusDescribe"/>
         <result column="order_remark" property="orderRemark"/>
         <result column="order_time" property="orderTime"/>
+        <result column="packaging_price" property="packagingPrice"/>
         <result column="send_price" property="sendPrice"/>
         <result column="send_type" property="sendType"/>
         <result column="user_id" property="userId"/>
@@ -63,7 +64,7 @@
 
     <sql id="Base_Column_List">
         o.order_id, o.order_num, o.order_store_num, o.order_status, o.order_status_describe,
-        o.order_remark, o.order_time, o.send_price, o.send_type, o.user_id, o.username, o.store_id,
+        o.order_remark, o.order_time, o.packaging_price, o.send_price, o.send_type, o.user_id, o.username, o.store_id,
         o.store_name, o.store_logo, o.store_address, o.store_longitude, o.store_latitude,
         o.order_describe, o.original_price order_original_price, o.paid_price order_paid_price,
         o.actually_pay_price order_actually_pay_price, o.pay_state order_pay_state, o.pay_message, o.pay_type, o.pay_time, o.expire_time,
diff --git a/oying-system/src/main/resources/mapper/sh/OrderReturnMapper.xml b/oying-system/src/main/resources/mapper/sh/OrderReturnMapper.xml
index 53e1556..26c2cf1 100644
--- a/oying-system/src/main/resources/mapper/sh/OrderReturnMapper.xml
+++ b/oying-system/src/main/resources/mapper/sh/OrderReturnMapper.xml
@@ -9,6 +9,7 @@
         <result column="order_num" property="orderNum"/>
         <result column="order_store_num" property="orderStoreNum"/>
         <result column="order_time" property="orderTime"/>
+        <result column="packaging_price" property="packagingPrice"/>
         <result column="send_price" property="sendPrice"/>
         <result column="send_type" property="sendType"/>
         <result column="pay_type" property="payType"/>
@@ -58,7 +59,7 @@
 
     <sql id="Base_Column_List">
         o.return_id, o.return_num, o.return_status, o.return_status_describe, o.order_num, o.order_store_num,
-        o.order_time, o.send_price, o.send_type, o.pay_type, o.user_id, o.username, o.store_id, o.store_name, o.store_logo,
+        o.order_time, o.packaging_price, o.send_price, o.send_type, o.pay_type, o.user_id, o.username, o.store_id, o.store_name, o.store_logo,
         o.original_price order_original_price, o.paid_price order_paid_price, o.actually_pay_price order_actually_pay_price,
         o.refund_price, o.refund_status, o.success_time, o.channel, o.reason, o.remark, o.photos, o.audit_status,
         o.audit_user, o.audit_time, o.audit_message, o.rider_id, o.rider_phone, o.rider_name,

--
Gitblit v1.9.3