From 1fe9a1c594c40324b64f2822b2381e741fa231fc Mon Sep 17 00:00:00 2001
From: 陶杰 <1378534974@qq.com>
Date: 星期四, 09 一月 2025 09:00:45 +0800
Subject: [PATCH] 1.花材报表-把下架和强制下架状态分开

---
 src/main/java/com/mzl/flower/service/payment/WxDeliveryGoodService.java |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/mzl/flower/service/payment/WxDeliveryGoodService.java b/src/main/java/com/mzl/flower/service/payment/WxDeliveryGoodService.java
index bd48266..c915d58 100644
--- a/src/main/java/com/mzl/flower/service/payment/WxDeliveryGoodService.java
+++ b/src/main/java/com/mzl/flower/service/payment/WxDeliveryGoodService.java
@@ -8,6 +8,7 @@
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.StringUtils;
 
 import java.time.ZonedDateTime;
 import java.time.format.DateTimeFormatter;
@@ -19,7 +20,7 @@
 public class WxDeliveryGoodService {
 
     public JSONObject wxDeliveryGood(String orderId, String openid, String transactionId,
-                                  String itemDesc, String merchantId,String accessToken) throws Exception {
+                                  String itemDesc, String merchantId,String accessToken, Long partnerID,String deliveryNo) throws Exception {
         String requestPath = "https://api.weixin.qq.com/wxa/sec/order/upload_shipping_info?access_token="+accessToken;
         Map<String, Object> headers = new HashMap<>();
         headers.put("Accept", MediaType.APPLICATION_JSON.getValue());
@@ -31,13 +32,23 @@
         orderKey.put("mchid",merchantId);//支付下单商户的商户号,由微信支付生成并下发。
         orderKey.put("out_trade_no",orderId);//商户系统内部订单号
         body.put("order_key",orderKey);
-        body.put("logistics_type",2);//物流模式,发货方式枚举值:1、实体物流配送采用快递公司进行实体物流配送形式 2、同城配送 3、虚拟商品,虚拟商品,例如话费充值,点卡等,无实体配送形式 4、用户自提
         body.put("delivery_mode",1);//发货模式,发货模式枚举值:1、UNIFIED_DELIVERY(统一发货)2、SPLIT_DELIVERY(分拆发货) 示例值: UNIFIED_DELIVERY
+        if (StringUtils.isEmpty(partnerID) && !StringUtils.isEmpty(deliveryNo)) {
+            // 如果是散户的情况下保存订单号
+            body.put("logistics_type", 1);//物流模式,发货方式枚举值:1、实体物流配送采用快递公司进行实体物流配送形式 2、同城配送 3、虚拟商品,虚拟商品,例如话费充值,点卡等,无实体配送形式 4、用户自提
+        } else {
+            body.put("logistics_type", 2);//物流模式,发货方式枚举值:1、实体物流配送采用快递公司进行实体物流配送形式 2、同城配送 3、虚拟商品,虚拟商品,例如话费充值,点卡等,无实体配送形式 4、用户自提
+        }
+
+
 
         //商品信息
         List<Map<String,Object>> shippingList = new ArrayList<>();
         Map<String,Object> itemMap = new HashMap<>();
         itemMap.put("item_desc",itemDesc);//商品描述
+        if (StringUtils.isEmpty(partnerID) && !StringUtils.isEmpty(deliveryNo)) {
+            itemMap.put("tracking_no", deliveryNo);//物流单号,物流快递发货时必填,示例值: 323244567777 字符字节限制: [1, 128]
+        }
         shippingList.add(itemMap);
         body.put("shipping_list",shippingList);
 

--
Gitblit v1.9.3