1、修改启迪中台对接接口
This commit is contained in:
parent
0fef3344ec
commit
aac56928dd
|
@ -230,16 +230,8 @@ public class Controller {
|
|||
|
||||
//道路统计数据与排名
|
||||
@RequestMapping("roadData")
|
||||
public List<Map> roadData(
|
||||
@RequestParam(value="groupId") String groupId,
|
||||
@RequestParam(value="timeType") String timeType,
|
||||
@RequestParam(value="dt") String dt
|
||||
){
|
||||
Map<String,String> map = new HashMap<>();
|
||||
map.put("groupId",groupId);
|
||||
map.put("timeType",timeType);
|
||||
map.put("dt",dt);
|
||||
return monitorService.roadData(map);
|
||||
public List<Map> roadData(){
|
||||
return monitorService.roadData();
|
||||
}
|
||||
//启迪中台
|
||||
//登录
|
||||
|
|
|
@ -30,6 +30,9 @@ import java.awt.image.BufferedImage;
|
|||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -74,7 +77,7 @@ public class MonitorService {
|
|||
|
||||
static int keepaliveCount = 16;
|
||||
|
||||
@PostConstruct
|
||||
// @PostConstruct
|
||||
public void init(){
|
||||
|
||||
String loginUrl = monitorDomain + "/videoService/accounts/authorize";
|
||||
|
@ -447,9 +450,16 @@ public class MonitorService {
|
|||
|
||||
}
|
||||
|
||||
public List<Map> roadData(Map<String,String> map){
|
||||
//道路统计数据与排名
|
||||
public List<Map> roadData(){
|
||||
String url = "http://outerdata.novaecs.com/api/qingdaoData/roadData?groupId={groupId}&timeType={timeType}&dt={dt}";
|
||||
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
|
||||
map.put("dt",this.dateTimeStr());
|
||||
map.put("groupId",1);
|
||||
map.put("timeType","日");
|
||||
|
||||
ResponseEntity<JSONObject> responseEntity;
|
||||
List<Map> list = new ArrayList<>();
|
||||
try {
|
||||
|
@ -505,16 +515,30 @@ public class MonitorService {
|
|||
//渣土车轨迹数据
|
||||
public List<Map> resCatalogApplyZTYS () {
|
||||
String token = this.qidiToken();
|
||||
String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_ZTYS_307013600000000022_2";
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.add("Authorization", "Bearer " + token);
|
||||
|
||||
HttpEntity<MultiValueMap<String, String>> httpEntity = new HttpEntity<>(null, headers);
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
JSONObject search = new JSONObject();
|
||||
search.put("opt","LIKE");
|
||||
search.put("key","UPLOADTIME");
|
||||
search.put("val",this.dateStr());
|
||||
|
||||
// search.put("opt","EQ");
|
||||
// search.put("key","SPEED");
|
||||
// search.put("val","0");
|
||||
map.put("json",search);
|
||||
|
||||
String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_ZTYS_307013600000000022_2?search=[{json}]";
|
||||
|
||||
HttpEntity<Map> httpEntity = new HttpEntity<>(null, headers);
|
||||
ResponseEntity<JSONObject> responseEntity;
|
||||
try {
|
||||
responseEntity = restTemplate.exchange(url, HttpMethod.GET, httpEntity, JSONObject.class);
|
||||
responseEntity = restTemplate.exchange(url, HttpMethod.GET, httpEntity, JSONObject.class,map);
|
||||
|
||||
JSONObject jsonObject = responseEntity.getBody();
|
||||
JSONArray jsonArray = jsonObject.getJSONArray("list");
|
||||
log.info("[resCatalogApplyZTYS] 返回数据的数量:{}",jsonArray.size());
|
||||
return JSONObject.parseArray(JSONObject.toJSONString(jsonArray), Map.class);
|
||||
} catch (Exception e) {
|
||||
log.info("[resCatalogApplyZTYS] exception:{}", e.getMessage());
|
||||
|
@ -525,14 +549,24 @@ public class MonitorService {
|
|||
//环卫车轨迹数据
|
||||
public List<Map> resCatalogApplyHJWS () {
|
||||
String token = this.qidiToken();
|
||||
String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_HJWS_307013400000000442_1";
|
||||
String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_HJWS_307013400000000442_1?search=[{json}]";
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.add("Authorization", "Bearer " + token);
|
||||
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
JSONObject search = new JSONObject();
|
||||
search.put("opt","LIKE");
|
||||
search.put("key","updatetime");
|
||||
search.put("val",this.dateStr());
|
||||
// search.put("opt","EQ");
|
||||
// search.put("key","SIMKH");
|
||||
// search.put("val","13302959786");
|
||||
map.put("json",search);
|
||||
|
||||
HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(null, headers);
|
||||
ResponseEntity<JSONObject> responseEntity;
|
||||
try {
|
||||
responseEntity = restTemplate.exchange(url, HttpMethod.GET, request, JSONObject.class);
|
||||
responseEntity = restTemplate.exchange(url, HttpMethod.GET, request, JSONObject.class,map);
|
||||
JSONObject jsonObject = responseEntity.getBody();
|
||||
JSONArray jsonArray = jsonObject.getJSONArray("list");
|
||||
return JSONObject.parseArray(JSONObject.toJSONString(jsonArray), Map.class);
|
||||
|
@ -545,13 +579,25 @@ public class MonitorService {
|
|||
//工地信息
|
||||
public List<Map> resCatalogApplyGDYS () {
|
||||
String token = this.qidiToken();
|
||||
//String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_ZTYS_307013600000000025_1?search=[{json}]";
|
||||
String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_ZTYS_307013600000000025_1";
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.add("Authorization", "Bearer " + token);
|
||||
|
||||
// Map<String,Object> map = new HashMap<>();
|
||||
// JSONObject search = new JSONObject();
|
||||
// search.put("opt","LIKE");
|
||||
// search.put("key","updatetime");
|
||||
// search.put("val",this.dateStr());
|
||||
// search.put("opt","EQ");
|
||||
// search.put("key","SSDQ");
|
||||
// search.put("val","西海岸新区");
|
||||
// map.put("json",search);
|
||||
|
||||
HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(null, headers);
|
||||
ResponseEntity<JSONObject> responseEntity;
|
||||
try {
|
||||
//responseEntity = restTemplate.exchange(url, HttpMethod.GET, request, JSONObject.class,map);
|
||||
responseEntity = restTemplate.exchange(url, HttpMethod.GET, request, JSONObject.class);
|
||||
JSONObject jsonObject = responseEntity.getBody();
|
||||
JSONArray jsonArray = jsonObject.getJSONArray("list");
|
||||
|
@ -565,14 +611,24 @@ public class MonitorService {
|
|||
//环卫车辆数据1,基础
|
||||
public List<Map> resCatalogApplyHJWSBase () {
|
||||
String token = this.qidiToken();
|
||||
String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_HJWS_307013400000000365_1";
|
||||
String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_HJWS_307013400000000365_1?search=[{json}]";
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.add("Authorization", "Bearer " + token);
|
||||
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
JSONObject search = new JSONObject();
|
||||
search.put("opt","LIKE");
|
||||
search.put("key","updatetime");
|
||||
search.put("val",this.dateStr());
|
||||
// search.put("opt","EQ");
|
||||
// search.put("key","SSQY");
|
||||
// search.put("val","胶州市");
|
||||
map.put("json",search);
|
||||
|
||||
HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(null, headers);
|
||||
ResponseEntity<JSONObject> responseEntity;
|
||||
try {
|
||||
responseEntity = restTemplate.exchange(url, HttpMethod.GET, request, JSONObject.class);
|
||||
responseEntity = restTemplate.exchange(url, HttpMethod.GET, request, JSONObject.class,map);
|
||||
JSONObject jsonObject = responseEntity.getBody();
|
||||
JSONArray jsonArray = jsonObject.getJSONArray("list");
|
||||
return JSONObject.parseArray(JSONObject.toJSONString(jsonArray), Map.class);
|
||||
|
@ -585,36 +641,29 @@ public class MonitorService {
|
|||
//环卫车辆数据2,作业
|
||||
public List<Map> resCatalogApplyHJWSZY () {
|
||||
String token = this.qidiToken();
|
||||
String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_HJWS_307013400000000363_1";
|
||||
String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_HJWS_307013400000000363_1?search=[{json}]";
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.add("Authorization", "Bearer " + token);
|
||||
|
||||
MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
|
||||
map.add("pageNo", "1");
|
||||
map.add("pageSize", "1000");
|
||||
HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(map, headers);
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
JSONObject search = new JSONObject();
|
||||
search.put("opt","LIKE");
|
||||
search.put("key","ZYRQ");
|
||||
search.put("val",this.dateStr());
|
||||
// search.put("opt","EQ");
|
||||
// search.put("key","CPH");
|
||||
// search.put("val","鲁BW7681");
|
||||
map.put("json",search);
|
||||
|
||||
HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(null, headers);
|
||||
ResponseEntity<JSONObject> responseEntity;
|
||||
List<Map> result;
|
||||
try {
|
||||
responseEntity = restTemplate.exchange(url, HttpMethod.GET, request, JSONObject.class);
|
||||
responseEntity = restTemplate.exchange(url, HttpMethod.GET, request, JSONObject.class,map);
|
||||
JSONObject jsonObject = responseEntity.getBody();
|
||||
int count = jsonObject.getIntValue("count");
|
||||
result = new ArrayList<>(count);
|
||||
JSONArray jsonArray = jsonObject.getJSONArray("list");
|
||||
result.addAll(JSONObject.parseArray(JSONObject.toJSONString(jsonArray), Map.class));
|
||||
if (count > 1000) {
|
||||
int i = count / 1000;
|
||||
for (int j = 2; j <= i + 1; j++) {
|
||||
map.add("pageNo", String.valueOf(j));
|
||||
responseEntity = restTemplate.exchange(url, HttpMethod.GET, request, JSONObject.class);
|
||||
JSONObject jsonObject1 = responseEntity.getBody();
|
||||
JSONArray jsonArray1 = jsonObject.getJSONArray("list");
|
||||
result.addAll(JSONObject.parseArray(JSONObject.toJSONString(jsonArray1), Map.class));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return JSONObject.parseArray(JSONObject.toJSONString(jsonArray), Map.class);
|
||||
} catch (Exception e) {
|
||||
log.info("[resCatalogApplyHJWSZY] exception:{}", e.getMessage());
|
||||
log.info("[resCatalogApplyHJWSBase] exception:{}", e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -622,14 +671,24 @@ public class MonitorService {
|
|||
//环卫道路明细数据
|
||||
public List<Map> resCatalogApplyHJWSRoad () {
|
||||
String token = this.qidiToken();
|
||||
String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_HJWS_307013400000000370_2";
|
||||
String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_HJWS_307013400000000370_2?search=[{json}]";
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.add("Authorization", "Bearer " + token);
|
||||
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
JSONObject search = new JSONObject();
|
||||
search.put("opt","LIKE");
|
||||
search.put("key","updatetime");
|
||||
search.put("val",this.dateStr());
|
||||
// search.put("opt","EQ");
|
||||
// search.put("key","QDLKDLMC");
|
||||
// search.put("val","宜昌路");
|
||||
map.put("json",search);
|
||||
|
||||
HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(null, headers);
|
||||
ResponseEntity<JSONObject> responseEntity;
|
||||
try {
|
||||
responseEntity = restTemplate.exchange(url, HttpMethod.GET, request, JSONObject.class);
|
||||
responseEntity = restTemplate.exchange(url, HttpMethod.GET, request, JSONObject.class,map);
|
||||
JSONObject jsonObject = responseEntity.getBody();
|
||||
JSONArray jsonArray = jsonObject.getJSONArray("list");
|
||||
return JSONObject.parseArray(JSONObject.toJSONString(jsonArray), Map.class);
|
||||
|
@ -638,7 +697,22 @@ public class MonitorService {
|
|||
return null;
|
||||
}
|
||||
}
|
||||
//获取当前日期的时间串,2022-05-08 00:00:00
|
||||
private String dateTimeStr(){
|
||||
LocalDate localDate = LocalDate.now();
|
||||
LocalDate yestDay = localDate.minusDays(1);
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
LocalDateTime dateTime = LocalDateTime.of(yestDay.getYear(),yestDay.getMonth(),yestDay.getDayOfMonth(),0,0,0);
|
||||
return dateTime.format(formatter);
|
||||
}
|
||||
//获取当前日期的时间串,2022-05-08
|
||||
private String dateStr(){
|
||||
LocalDate localDate = LocalDate.now();
|
||||
LocalDate yestDay = localDate.minusDays(1);
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
|
||||
return yestDay.format(formatter);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue