From a9098372191b3c51995d41ee28404d1b71244d98 Mon Sep 17 00:00:00 2001 From: jiazx0107@163.com <jiazx0107@163.com> Date: 星期二, 12 十二月 2023 18:41:04 +0800 Subject: [PATCH] 提交网关心跳和设备状态2 --- src/main/java/com/fzzy/gateway/GatewayTimerScheduled.java | 24 ++++++++++++------------ 1 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/fzzy/gateway/GatewayTimerScheduled.java b/src/main/java/com/fzzy/gateway/GatewayTimerScheduled.java index a2b54d3..b29de93 100644 --- a/src/main/java/com/fzzy/gateway/GatewayTimerScheduled.java +++ b/src/main/java/com/fzzy/gateway/GatewayTimerScheduled.java @@ -1,12 +1,7 @@ package com.fzzy.gateway; import com.alibaba.fastjson.JSON; -import com.fzzy.api.data.ApiParam; import com.fzzy.api.data.GatewayDeviceProtocol; -import com.fzzy.api.entity.ApiConfs; -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; @@ -15,17 +10,13 @@ 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; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import javax.annotation.Resource; import java.util.Collection; -import java.util.Date; import java.util.List; /** @@ -55,7 +46,7 @@ * <p> * 鍥哄畾鏃堕棿锛氭瘡闂撮殧10鍒嗛挓鎵ц涓�娆� */ - @Scheduled(cron = "0 0/1 * * * ?") + @Scheduled(cron = "0 0/10 * * * ?") public void scheduled() { //缃戝叧鐨勫績璺虫墽琛� @@ -88,10 +79,19 @@ public void doWeatherExe() { try { - String url = configData.getWeatherUrl(); + String url = configData.getWeatherPath(); - url = url.replace("{appId}", DEFAULT_APP_ID).replace("{appsecret}", DEFAULT_APP_SECRET).replace("{cityid}", DEFAULT_CITYID); + if (null == url) { + url = DEFAULT_URL; + } + url = url.replace("{appId}", DEFAULT_APP_ID).replace("{appsecret}", DEFAULT_APP_SECRET); + + if (StringUtils.isNotEmpty(configData.getCityId())) { + url = url.replace("{cityid}", configData.getCityId()); + } else { + url = url.replace("{cityid}", DEFAULT_CITYID); + } log.debug("------姘旇薄璇锋眰淇℃伅URL---{}", url); String result = GatewayHttpUtil.doGet(url); -- Gitblit v1.9.3