chenxiaofei 3 месяцев назад
Родитель
Сommit
2f677c57de

+ 4 - 1
sckw-modules/sckw-fleet/src/main/resources/bootstrap-test.yml

@@ -21,9 +21,12 @@ spring:
           - data-id: sckw-common.yml
             group: sckw-common
             refresh: true
+          - data-id: amap-config.yaml
+            group: sckw-common
+            refresh: true
 
         #可以读多个配置文件 需要在同一个命名空间下面可以是不同的组
         extension-configs:
           - dataId: sckw-common.yml
             group: sckw-service-platform
-            refresh: true
+            refresh: true

+ 14 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/common/config/AmapProperties.java

@@ -0,0 +1,14 @@
+package com.sckw.transport.common.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+@Component
+@ConfigurationProperties(prefix = "amap")
+@Data
+public class AmapProperties {
+
+    private String key;
+
+}

+ 7 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/controller/KwfTaskController.java

@@ -32,5 +32,12 @@ public class KwfTaskController {
         return BaseResult.success(truckInfoVo);
     }
 
+    /**
+     * 获取高德地图apiKey
+     */
+    @GetMapping("/getMapApikey")
+    public BaseResult<String> getMapApikey()  {
+        return BaseResult.success(kwfTaskService.getMapApikey());
+    }
 
 }

+ 9 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/KwfTaskService.java

@@ -2,6 +2,7 @@ package com.sckw.transport.service;
 
 
 import com.sckw.core.model.enums.CarWaybillEnum;
+import com.sckw.transport.common.config.AmapProperties;
 import com.sckw.transport.model.KwtWaybillOrder;
 import com.sckw.transport.model.TaskStatisticsVo;
 import com.sckw.transport.repository.KwtWaybillOrderRepository;
@@ -22,6 +23,7 @@ import java.util.Objects;
 @Slf4j
 public class KwfTaskService {
     private final KwtWaybillOrderRepository kwtWaybillOrderRepository;
+    private final AmapProperties amapProperties;
     public TaskStatisticsVo getTaskStatistics() {
         log.info("开始获取任务统计信息请求参数");
         List<KwtWaybillOrder> waybillOrder= kwtWaybillOrderRepository.findAll();
@@ -47,4 +49,11 @@ public class KwfTaskService {
         return taskStatisticsVo;
     }
 
+    /**
+     * 获取高德地图apiKey
+     * @return apiKey
+     */
+    public String getMapApikey() {
+        return amapProperties.getKey();
+    }
 }