工地实时环境接口获取调整

This commit is contained in:
wangliwen 2022-11-29 14:47:27 +08:00
parent bf6038a5ef
commit 0e96fbeafd
3 changed files with 11 additions and 4 deletions

View File

@ -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<Map> getRecords() {
String url = "http://scxjsw.qingdao.gov.cn/monitorData/real-time";
String url = monitorDataUrl;
Map<String, String> 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<Map> maps = this.getRecords();
boolean result = false;

View File

@ -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

View File

@ -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