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