From 46203ee88249d9a4046f3d453deb41edc562cf6c Mon Sep 17 00:00:00 2001
From: jiazx0107@163.com <jiazx0107@163.com>
Date: 星期二, 12 十二月 2023 12:36:53 +0800
Subject: [PATCH] 提交网关心跳和设备状态

---
 src/main/java/com/fzzy/gateway/GatewayTimerScheduled.java |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/main/java/com/fzzy/gateway/GatewayTimerScheduled.java b/src/main/java/com/fzzy/gateway/GatewayTimerScheduled.java
index 8daf788..a2b54d3 100644
--- a/src/main/java/com/fzzy/gateway/GatewayTimerScheduled.java
+++ b/src/main/java/com/fzzy/gateway/GatewayTimerScheduled.java
@@ -7,6 +7,7 @@
 import com.fzzy.api.service.*;
 import com.fzzy.api.utils.ContextUtil;
 import com.fzzy.api.utils.RedisUtil;
+import com.fzzy.data.ConfigData;
 import com.fzzy.gateway.api.GatewayRemoteManager;
 import com.fzzy.gateway.data.BaseReqData;
 import com.fzzy.gateway.data.WeatherWebDto;
@@ -14,6 +15,7 @@
 import com.fzzy.gateway.entity.GatewayDevice;
 import com.fzzy.gateway.service.GatewayConfService;
 import com.fzzy.gateway.util.GatewayHttpUtil;
+import jdk.nashorn.internal.runtime.regexp.joni.Config;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.time.DateUtils;
@@ -33,7 +35,7 @@
 @Component(GatewayTimerScheduled.BEAN_ID)
 public class GatewayTimerScheduled {
 
-        public static String DEFAULT_URL = "https://v1.yiketianqi.com/api?unescape=1&version=v61&appid={appId}&appsecret={appsecret}&cityid={cityid}";
+    public static String DEFAULT_URL = "https://v1.yiketianqi.com/api?unescape=1&version=v61&appid={appId}&appsecret={appsecret}&cityid={cityid}";
     public static String DEFAULT_APP_ID = "49421971";
     public static String DEFAULT_APP_SECRET = "JmJE48Fv";
     public static String DEFAULT_CITYID = "101270101";//鎴愰兘
@@ -45,13 +47,15 @@
     private GatewayConfService confService;
     @Resource
     private GatewayRemoteManager gatewayRemoteManager;
+    @Resource
+    private ConfigData configData;
 
 
     /**
      * <p>
      * 鍥哄畾鏃堕棿锛氭瘡闂撮殧10鍒嗛挓鎵ц涓�娆�
      */
-    @Scheduled(cron = "0 0/10 * * * ?")
+    @Scheduled(cron = "0 0/1 * * * ?")
     public void scheduled() {
 
         //缃戝叧鐨勫績璺虫墽琛�
@@ -84,12 +88,13 @@
     public void doWeatherExe() {
 
         try {
-            String url = DEFAULT_URL;
+            String url = configData.getWeatherUrl();
+
             url = url.replace("{appId}", DEFAULT_APP_ID).replace("{appsecret}", DEFAULT_APP_SECRET).replace("{cityid}", DEFAULT_CITYID);
 
 
-            log.debug("------姘旇薄URL---{}", url);
-            String result = GatewayHttpUtil.doGet(url, null);
+            log.debug("------姘旇薄璇锋眰淇℃伅URL---{}", url);
+            String result = GatewayHttpUtil.doGet(url);
 
             if (null == result) {
                 log.error("褰撳墠澶栫綉鑾峰彇姘旇薄淇℃伅澶辫触鈥︹��");

--
Gitblit v1.9.3