From 0e96fbeafdf2e08af2f5564eaccf291e244be171 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Tue, 29 Nov 2022 14:47:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E5=9C=B0=E5=AE=9E=E6=97=B6=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E6=8E=A5=E5=8F=A3=E8=8E=B7=E5=8F=96=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/BuildingRecordsService.java | 12 +++++++++--- src/main/resources/application-pro.properties | 1 + src/main/resources/application.properties | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/hisense/monitormanage/service/BuildingRecordsService.java b/src/main/java/com/hisense/monitormanage/service/BuildingRecordsService.java index 7276a33..1c0aae3 100644 --- a/src/main/java/com/hisense/monitormanage/service/BuildingRecordsService.java +++ b/src/main/java/com/hisense/monitormanage/service/BuildingRecordsService.java @@ -13,6 +13,7 @@ import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.http.ResponseEntity; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; @@ -20,7 +21,10 @@ import org.springframework.web.client.RestTemplate; import java.io.FileOutputStream; import java.lang.reflect.Field; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; /** * @author admin @@ -38,9 +42,11 @@ public class BuildingRecordsService { @Autowired private RestTemplate restTemplate; + @Value("${monitorData.url}") + private String monitorDataUrl; public List getRecords() { - String url = "http://scxjsw.qingdao.gov.cn/monitorData/real-time"; + String url = monitorDataUrl; Map map = new HashMap<>(); map.put("appid", ""); map.put("timestamp", ""); @@ -66,7 +72,7 @@ public class BuildingRecordsService { return maps; } - //@Scheduled(cron = "0 0 8/1 * * ?") + @Scheduled(cron = "0 0 */8 * * ?") public boolean getAndSaveRecords() { List maps = this.getRecords(); boolean result = false; diff --git a/src/main/resources/application-pro.properties b/src/main/resources/application-pro.properties index dd4bcdc..02977ff 100644 --- a/src/main/resources/application-pro.properties +++ b/src/main/resources/application-pro.properties @@ -21,3 +21,4 @@ scheduled.enable=true gaode.url=http://15.72.191.145:8111/amap +monitorData.url= http://15.72.191.145:8111/monitorData/real-time diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 1a7cba3..8921b11 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -21,7 +21,7 @@ mybatis-plus.mapper-locations=classpath*:/mapper/*.xml #??????swagger,true???false?? swagger.enable=true scheduled.enable=false - gaode.url=http://restapi.amap.com +monitorData.url=http://scxjsw.qingdao.gov.cn/monitorData/real-time