diff --git a/JAVASDK.zip b/JAVASDK.zip
deleted file mode 100644
index 148f434..0000000
Binary files a/JAVASDK.zip and /dev/null differ
diff --git a/module-common/pom.xml b/module-common/pom.xml
index cd45dc1..ecb219c 100644
--- a/module-common/pom.xml
+++ b/module-common/pom.xml
@@ -68,6 +68,22 @@
commons-fileupload
commons-fileupload
+
+
+
+
+
+
+
+
+
+
+
+
+ commons-httpclient
+ commons-httpclient
+ 3.1
+
\ No newline at end of file
diff --git a/module-common/src/main/java/org/jeecg/api/controller/s.js b/module-common/src/main/java/org/jeecg/api/controller/s.js
deleted file mode 100644
index d8e2783..0000000
--- a/module-common/src/main/java/org/jeecg/api/controller/s.js
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-let a = {
- id : 1565465498,//一级订单id
- list : [
- {
- price : 44.1,//价格
- qualifiedNum : 2,//合格数量
- noQualifiedNum : 1,//不合格数量
- unrecyclable : 1,//不可回收数量
- shopId : 123,//商品id,(质量问题、不可回收不填)
- pinId : 123,//品牌id,(质量问题、不可回收不填)
- commonOrderList : [
- {
- testingInstructions : '199168761,654651745,61541684',//检测说明,多个id用逗号分割
- testingImages : 'https://xxxx,https://xxxx',//检测报告图片
- testingStatus : 0,//【质检合格:0】【质量问题:1】【不可回收:2】
- }
- ]
- }
- ]
-}
\ No newline at end of file
diff --git a/module-common/src/main/java/org/jeecg/api/service/impl/AppletOrderServiceImpl.java b/module-common/src/main/java/org/jeecg/api/service/impl/AppletOrderServiceImpl.java
index 857c25f..080934e 100644
--- a/module-common/src/main/java/org/jeecg/api/service/impl/AppletOrderServiceImpl.java
+++ b/module-common/src/main/java/org/jeecg/api/service/impl/AppletOrderServiceImpl.java
@@ -356,7 +356,7 @@ public class AppletOrderServiceImpl implements AppletOrderService {
}
return Result.ok(commonReasonsService.lambdaQuery()
-// .eq(CommonReasons::getClassId, classId)
+// .in(CommonReasons::getClassId, classId)
// .eq(CommonReasons::getType, type)
.list()
);
diff --git a/module-common/src/main/java/org/jeecg/common/logistics/Java版本兼容性说明.md b/module-common/src/main/java/org/jeecg/common/logistics/Java版本兼容性说明.md
new file mode 100644
index 0000000..95f5a1e
--- /dev/null
+++ b/module-common/src/main/java/org/jeecg/common/logistics/Java版本兼容性说明.md
@@ -0,0 +1,152 @@
+# Java 版本兼容性说明
+
+## 📋 概述
+
+本微信物流模块已针对 **Java 8** 进行了兼容性优化,确保在大多数项目环境中都能正常运行。
+
+## 🔧 已解决的兼容性问题
+
+### 1. Map.of() 方法问题
+
+**问题描述:**
+```java
+// Java 9+ 语法 - 在 Java 8 中会报错
+return Result.ok(Map.of(
+ "key1", value1,
+ "key2", value2
+));
+```
+
+**解决方案:**
+```java
+// Java 8 兼容写法
+Map result = new HashMap<>();
+result.put("key1", value1);
+result.put("key2", value2);
+return Result.ok(result);
+```
+
+### 2. 需要添加的 import 语句
+
+确保在使用 Map 和 HashMap 的地方添加以下导入:
+```java
+import java.util.HashMap;
+import java.util.Map;
+```
+
+## 🎯 支持的 Java 版本
+
+| Java 版本 | 支持状态 | 说明 |
+|-----------|----------|------|
+| Java 8 | ✅ 完全支持 | 主要兼容目标 |
+| Java 11 | ✅ 完全支持 | 长期支持版本 |
+| Java 17 | ✅ 完全支持 | 最新长期支持版本 |
+| Java 21 | ✅ 完全支持 | 最新长期支持版本 |
+
+## 💡 最佳实践
+
+### 1. 检查项目 Java 版本
+
+```bash
+# 检查 Java 版本
+java -version
+
+# 检查 Maven 项目的 Java 版本
+mvn -version
+```
+
+### 2. 配置 Maven Java 版本
+
+在 `pom.xml` 中确保 Java 版本配置正确:
+
+```xml
+
+ 8
+ 8
+ 8
+
+```
+
+### 3. IDE 配置
+
+确保你的 IDE (IntelliJ IDEA, Eclipse 等) 项目设置中的 Java 版本与项目一致。
+
+## 🐛 常见错误及解决方案
+
+### 错误1:找不到符号 Map.of()
+
+**错误信息:**
+```
+java: 找不到符号
+ 符号: 方法 of(java.lang.String,...)
+ 位置: 接口 java.util.Map
+```
+
+**解决方案:**
+- 使用 `HashMap` 替代 `Map.of()`
+- 确保已导入 `java.util.HashMap`
+
+### 错误2:Lambda 表达式报错
+
+**错误信息:**
+```
+java: lambda expressions are not supported in -source 7
+```
+
+**解决方案:**
+- 检查 Maven 配置,确保 Java 版本为 8 或以上
+- 更新 `maven-compiler-plugin` 配置
+
+### 错误3:Stream API 不可用
+
+**错误信息:**
+```
+java: cannot find symbol
+ symbol: method stream()
+```
+
+**解决方案:**
+- 确保 Java 版本为 8 或以上
+- Stream API 是 Java 8 引入的特性
+
+## 🛠️ 验证方法
+
+### 1. 编译测试
+
+```bash
+# 编译项目
+mvn clean compile
+
+# 运行测试
+mvn test
+```
+
+### 2. 功能测试
+
+启动项目后,访问以下测试接口:
+
+```bash
+# 快速测试
+GET /applet/logistics/test/quickTest
+
+# 检查是否能正常返回结果
+```
+
+## 📞 技术支持
+
+如果遇到其他兼容性问题,可以:
+
+1. 检查本文档的解决方案
+2. 确认 Java 版本配置是否正确
+3. 查看完整的错误日志
+4. 检查项目依赖是否冲突
+
+## 🎉 总结
+
+本微信物流模块已经过 Java 8 兼容性测试,所有代码都使用了 Java 8 兼容的语法和 API。如果你的项目使用 Java 8 或更高版本,应该能够正常运行。
+
+**主要兼容性改进:**
+- ✅ 替换 `Map.of()` 为 `HashMap` 方式
+- ✅ 添加必要的 import 语句
+- ✅ 确保所有 API 都兼容 Java 8
+- ✅ 提供完整的使用示例
\ No newline at end of file
diff --git a/module-common/src/main/java/org/jeecg/common/logistics/README.md b/module-common/src/main/java/org/jeecg/common/logistics/README.md
new file mode 100644
index 0000000..bcf7216
--- /dev/null
+++ b/module-common/src/main/java/org/jeecg/common/logistics/README.md
@@ -0,0 +1,420 @@
+# 微信物流功能使用说明
+
+## 功能概述
+
+本模块提供了微信小程序物流服务的对接功能,目前支持以下接口:
+
+- 获取所有绑定的物流账号 (`getAllAccount`)
+- 生成运单 (`addOrder`)
+
+## 目录结构
+
+```
+org.jeecg.common.logistics/
+├── config/
+│ └── WeChatLogisticsConfig.java # 配置类
+├── controller/
+│ └── WeChatLogisticsController.java # 控制器
+├── dto/
+│ ├── WeChatLogisticsAccount.java # 物流账号实体类
+│ ├── WeChatLogisticsAccountResponse.java # 账号响应实体类
+│ ├── WeChatLogisticsServiceType.java # 服务类型实体类
+│ ├── WeChatLogisticsAddOrderRequest.java # 下单请求实体类
+│ ├── WeChatLogisticsAddOrderResponse.java # 下单响应实体类
+│ ├── WeChatLogisticsPersonInfo.java # 发收件人信息实体类
+│ ├── WeChatLogisticsCargo.java # 包裹信息实体类
+│ ├── WeChatLogisticsCargoDetail.java # 货物详情实体类
+│ ├── WeChatLogisticsShop.java # 商品信息实体类
+│ ├── WeChatLogisticsShopDetail.java # 商品详情实体类
+│ ├── WeChatLogisticsInsured.java # 保价信息实体类
+│ ├── WeChatLogisticsServiceInfo.java # 服务信息实体类
+│ └── WeChatLogisticsWaybillData.java # 运单数据实体类
+├── service/
+│ └── WeChatLogisticsService.java # 服务类
+├── util/
+│ └── WeChatLogisticsRequestBuilder.java # 请求构建工具类
+└── README.md # 使用说明
+```
+
+## 配置说明
+
+### 1. 配置文件
+
+请在 `application.yml` 中添加以下配置:
+
+```yaml
+wechat:
+ enabled: true
+ mp-app-id: "your_app_id"
+ mp-app-secret: "your_app_secret"
+ connect-timeout: 30000
+ read-timeout: 30000
+```
+
+### 2. 获取微信小程序凭证
+
+1. 登录微信公众平台:https://mp.weixin.qq.com
+2. 申请小程序并获取 `AppID` 和 `AppSecret`
+3. 在小程序管理后台开通物流服务功能
+
+## API 接口
+
+### 获取所有绑定的物流账号
+
+**接口地址:** `GET /applet/logistics/getAllAccount`
+
+**接口描述:** 获取微信小程序绑定的所有物流账号信息
+
+**请求参数:** 无
+
+**响应参数:**
+
+```json
+{
+ "success": true,
+ "message": "操作成功",
+ "code": 200,
+ "result": {
+ "errcode": 0,
+ "errmsg": "ok",
+ "count": 2,
+ "list": [
+ {
+ "biz_id": "customer_code_123",
+ "delivery_id": "SF",
+ "create_time": 1640995200,
+ "update_time": 1640995200,
+ "status_code": 1,
+ "alias": "顺丰快递",
+ "remark_wrong_msg": "",
+ "remark_content": "测试账号",
+ "quota_num": 1000,
+ "quota_update_time": 1640995200,
+ "service_type": [
+ {
+ "service_type": 1,
+ "service_name": "标准快递"
+ }
+ ]
+ }
+ ]
+ }
+}
+```
+
+**字段说明:**
+
+| 字段 | 类型 | 说明 |
+|------|------|------|
+| biz_id | String | 快递公司客户编码 |
+| delivery_id | String | 快递公司ID |
+| create_time | Long | 账号绑定时间(时间戳) |
+| update_time | Long | 账号更新时间(时间戳) |
+| status_code | Integer | 绑定状态 |
+| alias | String | 账号别名 |
+| remark_wrong_msg | String | 账号绑定失败的错误信息 |
+| remark_content | String | 账号绑定时的备注内容 |
+| quota_num | Long | 电子面单余额 |
+| quota_update_time | Long | 电子面单余额更新时间 |
+| service_type | Array | 该绑定账号支持的服务类型 |
+
+### 生成运单(下单)
+
+**接口地址:** `POST /applet/logistics/addOrder`
+
+**接口描述:** 生成微信物流运单
+
+**请求参数:**
+
+| 字段 | 类型 | 必填 | 说明 |
+|------|------|------|------|
+| order_id | String | 是 | 订单ID,须保证全局唯一 |
+| openid | String | 是 | 用户openid |
+| delivery_id | String | 是 | 快递公司ID |
+| biz_id | String | 是 | 快递客户编码 |
+| custom_remark | String | 否 | 快递备注信息 |
+| add_source | Integer | 是 | 订单来源,0为小程序订单,2为App或H5订单 |
+| sender | Object | 是 | 发件人信息 |
+| receiver | Object | 是 | 收件人信息 |
+| cargo | Object | 是 | 包裹信息 |
+| shop | Object | 是 | 商品信息 |
+| insured | Object | 是 | 保价信息 |
+| service | Object | 是 | 服务类型 |
+
+**响应参数:**
+
+```json
+{
+ "success": true,
+ "message": "操作成功",
+ "code": 200,
+ "result": {
+ "errcode": 0,
+ "errmsg": "ok",
+ "order_id": "order_123456",
+ "waybill_id": "SF123456789",
+ "waybill_data": [
+ {
+ "key": "SF_bagAddr",
+ "value": "广州"
+ }
+ ],
+ "is_correct_sender": 1,
+ "is_correct_receiver": 1
+ }
+}
+```
+
+**响应字段说明:**
+
+- `errcode`: 微信侧错误码,0表示成功
+- `errmsg`: 微信侧错误信息
+- `order_id`: 订单ID
+- `waybill_id`: 运单ID(快递单号)
+- `waybill_data`: 运单信息数组,包含运单模板等信息
+- `is_correct_sender`: 发件人信息是否正确,1-正确,0-错误
+- `is_correct_receiver`: 收件人信息是否正确,1-正确,0-错误
+
+### 查询运单轨迹响应字段说明
+
+- `openid`: 用户openid
+- `waybill_id_status`: 运单状态码,0-未处理,1-已处理
+- `path_item_num`: 轨迹节点数量
+- `path_item_list`: 轨迹节点列表
+- `contact_list`: 联系人列表(快递员信息)
+
+**完整请求示例:**
+
+```json
+{
+ "order_id": "order_123456",
+ "openid": "oUpF8uMuAJOM2pxb1Q9zNjWeS6o",
+ "delivery_id": "SF",
+ "biz_id": "customer_code_123",
+ "custom_remark": "易碎物品",
+ "add_source": 0,
+ "sender": {
+ "name": "张三",
+ "mobile": "13800138000",
+ "company": "发件公司",
+ "province": "广东省",
+ "city": "广州市",
+ "area": "天河区",
+ "address": "天河路123号"
+ },
+ "receiver": {
+ "name": "李四",
+ "mobile": "13900139000",
+ "company": "收件公司",
+ "province": "上海市",
+ "city": "上海市",
+ "area": "浦东新区",
+ "address": "张江路456号"
+ },
+ "cargo": {
+ "count": 1,
+ "weight": 1.2,
+ "space_x": 20.0,
+ "space_y": 15.0,
+ "space_z": 10.0,
+ "detail_list": [
+ {
+ "name": "手机",
+ "count": 1
+ }
+ ]
+ },
+ "shop": {
+ "wxa_path": "pages/order/detail?id=123",
+ "img_url": "https://example.com/image.jpg",
+ "goods_name": "苹果手机",
+ "goods_count": 1
+ },
+ "insured": {
+ "use_insured": 1,
+ "insured_value": 500000
+ },
+ "service": {
+ "service_type": 1,
+ "service_name": "标准快递",
+ "expect_time": 1640995200
+ }
+}
+```
+
+## 使用示例
+
+### 1. 在 Controller 中使用
+
+```java
+@RestController
+@RequestMapping("/api/logistics")
+public class LogisticsController {
+
+ @Autowired
+ private WeChatLogisticsService weChatLogisticsService;
+
+ @GetMapping("/accounts")
+ public Result getLogisticsAccounts() {
+ try {
+ WeChatLogisticsAccountResponse response = weChatLogisticsService.getAllAccount();
+ return Result.ok(response);
+ } catch (Exception e) {
+ return Result.error("获取物流账号失败:" + e.getMessage());
+ }
+ }
+}
+```
+
+### 2. 在 Service 中使用
+
+```java
+@Service
+public class OrderService {
+
+ @Autowired
+ private WeChatLogisticsService weChatLogisticsService;
+
+ public void processOrder() {
+ try {
+ // 获取可用的物流账号
+ WeChatLogisticsAccountResponse response = weChatLogisticsService.getAllAccount();
+ List accounts = response.getList();
+
+ // 创建下单请求
+ WeChatLogisticsAddOrderRequest request = new WeChatLogisticsAddOrderRequest();
+ request.setOrderId("order_" + System.currentTimeMillis());
+ request.setOpenid("oUpF8uMuAJOM2pxb1Q9zNjWeS6o");
+ request.setDeliveryId("SF");
+ request.setBizId("customer_code_123");
+ request.setAddSource(0);
+
+ // 设置发件人信息
+ WeChatLogisticsPersonInfo sender = new WeChatLogisticsPersonInfo();
+ sender.setName("张三");
+ sender.setMobile("13800138000");
+ sender.setProvince("广东省");
+ sender.setCity("广州市");
+ sender.setArea("天河区");
+ sender.setAddress("天河路123号");
+ request.setSender(sender);
+
+ // 设置收件人信息
+ WeChatLogisticsPersonInfo receiver = new WeChatLogisticsPersonInfo();
+ receiver.setName("李四");
+ receiver.setMobile("13900139000");
+ receiver.setProvince("上海市");
+ receiver.setCity("上海市");
+ receiver.setArea("浦东新区");
+ receiver.setAddress("张江路456号");
+ request.setReceiver(receiver);
+
+ // 设置包裹信息
+ WeChatLogisticsCargo cargo = new WeChatLogisticsCargo();
+ cargo.setCount(1);
+ cargo.setWeight(1.2);
+ cargo.setSpaceX(20.0);
+ cargo.setSpaceY(15.0);
+ cargo.setSpaceZ(10.0);
+ request.setCargo(cargo);
+
+ // 设置商品信息
+ WeChatLogisticsShop shop = new WeChatLogisticsShop();
+ shop.setGoodsName("苹果手机");
+ shop.setGoodsCount(1);
+ request.setShop(shop);
+
+ // 设置保价信息
+ WeChatLogisticsInsured insured = new WeChatLogisticsInsured();
+ insured.setUseInsured(1);
+ insured.setInsuredValue(500000);
+ request.setInsured(insured);
+
+ // 设置服务类型
+ WeChatLogisticsServiceInfo service = new WeChatLogisticsServiceInfo();
+ service.setServiceType(1);
+ service.setServiceName("标准快递");
+ request.setService(service);
+
+ // 生成运单
+ WeChatLogisticsAddOrderResponse orderResponse = weChatLogisticsService.addOrder(request);
+ String waybillId = orderResponse.getWaybillId();
+
+ // 处理订单逻辑
+ // ...
+ } catch (Exception e) {
+ log.error("处理订单失败", e);
+ }
+ }
+}
+```
+
+### 3. 使用工具类构建请求(推荐)
+
+```java
+@Service
+public class OrderService {
+
+ @Autowired
+ private WeChatLogisticsService weChatLogisticsService;
+
+ public void createLogisticsOrder() {
+ try {
+ // 使用工具类构建请求
+ WeChatLogisticsAddOrderRequest request = WeChatLogisticsRequestBuilder.createOrderRequest()
+ .orderId("order_" + System.currentTimeMillis())
+ .openid("oUpF8uMuAJOM2pxb1Q9zNjWeS6o")
+ .deliveryId("SF")
+ .bizId("customer_code_123")
+ .customRemark("易碎物品")
+ .addSource(0)
+ .sender("张三", "13800138000", "广东省", "广州市", "天河区", "天河路123号")
+ .receiver("李四", "13900139000", "上海市", "上海市", "浦东新区", "张江路456号")
+ .cargo(1, 1.2, 20.0, 15.0, 10.0)
+ .cargoDetail("手机", 1)
+ .shop("pages/order/detail?id=123", "https://example.com/image.jpg", "苹果手机", 1)
+ .insured(1, 500000)
+ .service(1, "标准快递")
+ .build();
+
+ // 生成运单
+ WeChatLogisticsAddOrderResponse response = weChatLogisticsService.addOrder(request);
+
+ log.info("运单生成成功,运单号:{}", response.getWaybillId());
+
+ } catch (Exception e) {
+ log.error("生成运单失败", e);
+ }
+ }
+}
+```
+
+## 注意事项
+
+1. **权限要求**:需要小程序开通物流服务功能
+2. **频率限制**:微信API有调用频率限制,请避免高频调用
+3. **错误处理**:请妥善处理接口返回的错误信息
+4. **安全性**:生产环境中请将 `app-secret` 配置在环境变量中
+5. **日志记录**:建议开启日志记录以便调试和监控
+
+## 扩展功能
+
+### 已实现的接口
+
+- ✅ 获取所有绑定的物流账号 (`getAllAccount`)
+- ✅ 生成运单 (`addOrder`)
+
+### 后续可扩展的接口
+
+后续可以根据需求添加更多微信物流接口,如:
+- 绑定物流账号
+- 解绑物流账号
+- 查询运单状态
+- 取消运单
+- 获取支持的快递公司列表
+- 获取打印员列表
+- 获取电子面单模板
+
+## 技术支持
+
+如遇到问题,请查看日志文件或联系技术支持。
\ No newline at end of file
diff --git a/module-common/src/main/java/org/jeecg/common/logistics/config/WeChatLogisticsConfig.java b/module-common/src/main/java/org/jeecg/common/logistics/config/WeChatLogisticsConfig.java
new file mode 100644
index 0000000..d61dcab
--- /dev/null
+++ b/module-common/src/main/java/org/jeecg/common/logistics/config/WeChatLogisticsConfig.java
@@ -0,0 +1,59 @@
+package org.jeecg.common.logistics.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+/**
+ * 微信物流配置类
+ */
+@Data
+@Component
+@ConfigurationProperties(prefix = "wechat")
+public class WeChatLogisticsConfig {
+
+ /**
+ * 微信小程序AppID
+ */
+ private String mpAppId;
+
+ /**
+ * 微信小程序AppSecret
+ */
+ private String mpAppSecret;
+
+ /**
+ * 是否启用微信物流服务
+ */
+ private boolean enabled = true;
+
+ /**
+ * 连接超时时间(毫秒)
+ */
+ private int connectTimeout = 30000;
+
+ /**
+ * 读取超时时间(毫秒)
+ */
+ private int readTimeout = 30000;
+
+ /**
+ * 获取Access Token的URL
+ */
+ private String accessTokenUrl = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s";
+
+ /**
+ * 获取所有物流账号的URL
+ */
+ private String getAllAccountUrl = "https://api.weixin.qq.com/cgi-bin/express/business/account/getall?access_token=%s";
+
+ /**
+ * 生成运单(下单)的URL
+ */
+ private String addOrderUrl = "https://api.weixin.qq.com/cgi-bin/express/business/order/add?access_token=%s";
+
+ /**
+ * 查询运单轨迹的URL
+ */
+ private String getPathUrl = "https://api.weixin.qq.com/cgi-bin/express/business/path/get?access_token=%s";
+}
\ No newline at end of file
diff --git a/module-common/src/main/java/org/jeecg/common/logistics/controller/WeChatLogisticsController.java b/module-common/src/main/java/org/jeecg/common/logistics/controller/WeChatLogisticsController.java
new file mode 100644
index 0000000..5d129f5
--- /dev/null
+++ b/module-common/src/main/java/org/jeecg/common/logistics/controller/WeChatLogisticsController.java
@@ -0,0 +1,74 @@
+package org.jeecg.common.logistics.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.logistics.dto.WeChatLogisticsAccountResponse;
+import org.jeecg.common.logistics.dto.WeChatLogisticsAddOrderRequest;
+import org.jeecg.common.logistics.dto.WeChatLogisticsAddOrderResponse;
+import org.jeecg.common.logistics.dto.WeChatLogisticsPathRequest;
+import org.jeecg.common.logistics.dto.WeChatLogisticsPathResponse;
+import org.jeecg.common.logistics.service.WeChatLogisticsService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+
+/**
+ * 微信物流控制器
+ */
+@Api(tags = "微信物流管理")
+@RestController
+@RequestMapping("/applet/logistics")
+@Slf4j
+public class WeChatLogisticsController {
+
+ @Autowired
+ private WeChatLogisticsService weChatLogisticsService;
+
+ /**
+ * 获取所有绑定的物流账号
+ */
+ @ApiOperation(value = "获取所有绑定的物流账号", notes = "获取微信小程序绑定的所有物流账号")
+ @GetMapping("/getAllAccount")
+ public Result getAllAccount() {
+ try {
+ WeChatLogisticsAccountResponse response = weChatLogisticsService.getAllAccount();
+ return Result.ok(response);
+ } catch (Exception e) {
+ log.error("获取物流账号失败", e);
+ return Result.error("获取物流账号失败:" + e.getMessage());
+ }
+ }
+
+ /**
+ * 生成运单(下单)
+ */
+ @ApiOperation(value = "生成运单", notes = "生成微信物流运单")
+ @PostMapping("/addOrder")
+ public Result addOrder(@Valid @RequestBody WeChatLogisticsAddOrderRequest request) {
+ try {
+ WeChatLogisticsAddOrderResponse response = weChatLogisticsService.addOrder(request);
+ return Result.ok(response);
+ } catch (Exception e) {
+ log.error("生成运单失败", e);
+ return Result.error("生成运单失败:" + e.getMessage());
+ }
+ }
+
+ /**
+ * 查询运单轨迹(获取快递员手机号)
+ */
+ @ApiOperation(value = "查询运单轨迹", notes = "查询运单轨迹信息,包含快递员手机号")
+ @PostMapping("/getPath")
+ public Result getPath(@Valid @RequestBody WeChatLogisticsPathRequest request) {
+ try {
+ WeChatLogisticsPathResponse response = weChatLogisticsService.getPath(request);
+ return Result.ok(response);
+ } catch (Exception e) {
+ log.error("查询运单轨迹失败", e);
+ return Result.error("查询运单轨迹失败:" + e.getMessage());
+ }
+ }
+}
\ No newline at end of file
diff --git a/module-common/src/main/java/org/jeecg/common/logistics/controller/WeChatLogisticsTestController.java b/module-common/src/main/java/org/jeecg/common/logistics/controller/WeChatLogisticsTestController.java
new file mode 100644
index 0000000..e962f5a
--- /dev/null
+++ b/module-common/src/main/java/org/jeecg/common/logistics/controller/WeChatLogisticsTestController.java
@@ -0,0 +1,206 @@
+package org.jeecg.common.logistics.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.logistics.dto.WeChatLogisticsAddOrderRequest;
+import org.jeecg.common.logistics.dto.WeChatLogisticsAddOrderResponse;
+import org.jeecg.common.logistics.dto.WeChatLogisticsPathRequest;
+import org.jeecg.common.logistics.dto.WeChatLogisticsPathResponse;
+import org.jeecg.common.logistics.service.WeChatLogisticsService;
+import org.jeecg.common.logistics.util.WeChatLogisticsRequestBuilder;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 微信物流测试控制器
+ */
+@Api(tags = "微信物流测试")
+@RestController
+@RequestMapping("/applet/logistics/test")
+@Slf4j
+public class WeChatLogisticsTestController {
+
+ @Autowired
+ private WeChatLogisticsService weChatLogisticsService;
+
+ /**
+ * 测试生成运单
+ */
+ @ApiOperation(value = "测试生成运单", notes = "使用模拟数据测试生成微信物流运单")
+ @PostMapping("/addOrder")
+ public Result testAddOrder(
+ @RequestParam(required = false, defaultValue = "otvnw62EqdpKnCvDQYUjCeNG99XY") String openid,
+ @RequestParam(required = false, defaultValue = "DB") String deliveryId,
+ @RequestParam(required = false, defaultValue = "1102311359") String bizId) {
+ try {
+ // 使用工具类构建测试请求
+ WeChatLogisticsAddOrderRequest request = WeChatLogisticsRequestBuilder.createOrderRequest()
+ .orderId("TEST_ORDER_" + System.currentTimeMillis())
+ .openid(openid)
+ .deliveryId(deliveryId)
+ .bizId(bizId)
+ .customRemark("测试订单-易碎物品")
+ .addSource(0) // 小程序订单
+
+ // 发件人信息(测试数据)
+ .sender("张三", "13800138000", "广东省", "广州市", "天河区", "天河路123号科技大厦A座15楼")
+
+ // 收件人信息(测试数据)
+ .receiver("李四", "13900139000", "上海市", "上海市", "浦东新区", "张江高科技园区科苑路399号")
+
+ // 包裹信息
+ .cargo(1, 1.5, 25.0, 20.0, 15.0)
+ .cargoDetail("测试商品", 1)
+
+ // 商品信息
+ .shop("pages/order/detail?id=test123", "https://example.com/test.jpg", "测试商品", 1)
+
+ // 保价信息(保价100元)
+ .insured(1, 10000)
+
+ // 服务类型(需要根据实际快递公司支持的服务类型设置)
+ .serviceWithExpectTime(1, "标准快递", System.currentTimeMillis() / 1000 + 3600) // 1小时后上门取件
+ .build();
+
+ log.info("测试下单请求:{}", request);
+
+ // 调用下单服务
+ WeChatLogisticsAddOrderResponse response = weChatLogisticsService.addOrder(request);
+
+ log.info("测试下单成功,运单号:{}", response.getWaybillId());
+
+ // 输出地址验证信息
+ if (response.getIsCorrectSender() != null) {
+ log.info("发件人信息验证:{}", response.getIsCorrectSender() == 1 ? "正确" : "错误");
+ }
+ if (response.getIsCorrectReceiver() != null) {
+ log.info("收件人信息验证:{}", response.getIsCorrectReceiver() == 1 ? "正确" : "错误");
+ }
+
+ return Result.ok(response);
+
+ } catch (Exception e) {
+ log.error("测试下单失败", e);
+ return Result.error("测试下单失败:" + e.getMessage());
+ }
+ }
+
+ /**
+ * 测试查询运单轨迹(获取快递员手机号)
+ */
+ @ApiOperation(value = "测试查询运单轨迹", notes = "测试查询运单轨迹,获取快递员手机号")
+ @PostMapping("/getPath")
+ public Result testGetPath(
+ @RequestParam(required = false, defaultValue = "TEST_ORDER_1751711179674") String orderId,
+ @RequestParam(required = false, defaultValue = "DPK364740295014") String waybillId,
+ @RequestParam(required = false, defaultValue = "DB") String deliveryId,
+ @RequestParam(required = false, defaultValue = "otvnw62EqdpKnCvDQYUjCeNG99XY") String openid) {
+ try {
+ WeChatLogisticsPathRequest request = new WeChatLogisticsPathRequest();
+ request.setOrderId(orderId);
+ request.setWaybillId(waybillId);
+ request.setDeliveryId(deliveryId);
+ request.setOpenid(openid);
+
+ log.info("查询运单轨迹请求:{}", request);
+
+ WeChatLogisticsPathResponse response = weChatLogisticsService.getPath(request);
+
+ // 输出运单状态信息
+ log.info("===== 运单状态信息 =====");
+ log.info("运单状态码:{}", response.getWaybillIdStatus());
+ log.info("轨迹节点数量:{}", response.getPathItemNum());
+
+ // 检查是否有轨迹信息
+ if (response.getPathItemNum() == null || response.getPathItemNum() == 0) {
+ log.info("暂无运单轨迹信息,可能原因:");
+ log.info("1. 刚下单,快递公司还未处理");
+ log.info("2. 快递公司系统更新有延迟");
+ log.info("3. 建议等待几分钟后再查询");
+ }
+
+ // 输出快递员信息
+ if (response.getContactList() != null && !response.getContactList().isEmpty()) {
+ response.getContactList().forEach(contact -> {
+ if (contact.getType() == 1) {
+ log.info("===== 快递员信息 =====");
+ log.info("快递员姓名:{}", contact.getName());
+ log.info("快递员手机:{}", contact.getPhone());
+ log.info("==================");
+ }
+ });
+ } else {
+ log.info("暂无快递员信息,可能原因:");
+ log.info("1. 快递员尚未分配");
+ log.info("2. 快递公司未提供快递员信息");
+ log.info("3. 需要等待快递员接单");
+ }
+
+ log.info("====================");
+
+ return Result.ok(response);
+
+ } catch (Exception e) {
+ log.error("测试查询运单轨迹失败", e);
+ return Result.error("测试查询运单轨迹失败:" + e.getMessage());
+ }
+ }
+
+ /**
+ * 完整流程测试:下单 -> 查询轨迹
+ */
+ @ApiOperation(value = "完整流程测试", notes = "测试下单后查询轨迹获取快递员信息")
+ @PostMapping("/fullTest")
+ public Result