Jelajahi Sumber

feat:京东物流api配置

hanchaolong 2 minggu lalu
induk
melakukan
0660a7738f

+ 12 - 0
jd-logistics-common/ruoyi-common-core/pom.xml

@@ -128,6 +128,18 @@
             <artifactId>lombok</artifactId>
             <version>1.18.26</version>
         </dependency>
+
+        <!-- 京东物流 Java SDK -->
+        <dependency>
+            <groupId>com.jd</groupId>
+            <artifactId>lop-opensdk-support</artifactId>
+            <version>1.0.30</version>
+        </dependency>
+        <dependency>
+            <groupId>com.jd</groupId>
+            <artifactId>ECAP</artifactId>
+            <version>6.9</version>
+        </dependency>
     </dependencies>
 
 </project>

+ 1 - 1
jd-logistics-gateway/src/main/java/com/ruoyi/gateway/JdLogisticsGatewayApplication.java

@@ -15,7 +15,7 @@ public class JdLogisticsGatewayApplication
     public static void main(String[] args)
     {
         SpringApplication.run(JdLogisticsGatewayApplication.class, args);
-        System.out.println("(♥◠‿◠)ノ゙  京东物流网关启动成功   ლ(´ڡ`ლ)゙  \n" +
+        System.out.println("(♥◠‿◠)ノ゙  瑞鲸速达网关启动成功   ლ(´ڡ`ლ)゙  \n" +
                 " .-------.       ____     __        \n" +
                 " |  _ _   \\      \\   \\   /  /    \n" +
                 " | ( ' )  |       \\  _. /  '       \n" +

+ 56 - 0
jd-logistics-modules/jd-logistics-system/src/main/java/com/ruoyi/logistics/config/JDExpressConfig.java

@@ -0,0 +1,56 @@
+package com.ruoyi.logistics.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+@Data
+@Component
+@ConfigurationProperties(prefix = "jd.express")
+public class JDExpressConfig {
+
+    /**
+     * 应用编码
+     */
+    private String appKey;
+
+    /**
+     * 应用密钥
+     */
+    private String appSecret;
+
+    /**
+     * 访问令牌
+     */
+    private String accessToken;
+
+    /**
+     * 刷新令牌
+     */
+    private String refreshToken;
+
+    /**
+     * UAT环境API地址
+     */
+    private String uatServerUrl;
+
+    /**
+     * 生产环境API地址
+     */
+    private String prodServerUrl;
+
+    private Environment environment;
+
+    // 环境枚举
+    public enum Environment {
+        UAT, PROD
+    }
+
+    /**
+     * 获取当前环境的API地址
+     */
+    public String getCurrentApiUrl() {
+        return environment == Environment.UAT ? uatServerUrl : prodServerUrl;
+    }
+}
+