西海岸配置文件调整为现场正式配置

This commit is contained in:
wangliwen 2022-06-24 15:55:25 +08:00
parent bb8e2e5759
commit b279459972
2 changed files with 55 additions and 79 deletions

View File

@ -437,93 +437,69 @@ public class CensusControllerV2 {
} }
break; break;
case TSINGTAO_XHA: { // 青岛西海岸 case TSINGTAO_XHA: { // 青岛西海岸
allAmount = CompletableFuture.supplyAsync(() -> { // 获取平台数据资源总数目 OkHttpClient client = new OkHttpClient();
OkHttpClient client = new OkHttpClient(); Long total = 0L;
Long total = 0L; Request request = new Request.Builder().url(tsingtao_xhaProperties.getResourcecount()).build();
Request request = new Request.Builder().url(tsingtao_xhaProperties.getResourcecount()).build(); try (Response response = client.newCall(request).execute()) {
try (Response response = client.newCall(request).execute()) { if (response.isSuccessful()) {
if (response.isSuccessful()) { JSONObject jsonObject = JSON.parseObject(response.body().string());
JSONObject jsonObject = JSON.parseObject(response.body().string()); if (jsonObject.containsKey("data")) {
if (jsonObject.containsKey("data")) { total = jsonObject.getJSONObject("data").getLongValue("total");
total = jsonObject.getJSONObject("data").getLongValue("total"); Long finalTotal = total;
} result.add(new HashMap<String, Object>() {
} else { {
logger.error("青岛西海岸获取失败"); put("amount", finalTotal);
put("type", "总数据量");
}
});
} }
} catch (Exception exception) { } else {
logger.error("青岛西海岸失败", exception); logger.error("青岛西海岸获取失败");
} }
return total; } catch (Exception exception) {
}).thenAccept(sum -> { logger.error("青岛西海岸失败", exception);
result.add(new HashMap<String, Object>() { }
{
put("amount", sum);
put("type", "总数据量");
}
});
}); // 处理总数目
applyInfo = CompletableFuture.runAsync(() -> {
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder().url(tsingtao_xhaProperties.getResourceapplyinfo()).build();
try (Response response = client.newCall(request).execute()) {
if (response.isSuccessful()) {
JSONObject jsonObject = JSON.parseObject(response.body().string());
if (jsonObject.containsKey("data")) {
result.add(new HashMap<String, Object>() {
{
put("amount", jsonObject.getJSONObject("data").getLongValue("requestCount"));
put("type", "总申请次数");
}
});
result.add(new HashMap<String, Object>() {
{
put("amount", jsonObject.getJSONObject("data").getIntValue("satisfactionRate"));
put("type", "满足率");
}
});
result.add(new HashMap<String, Object>() {
{
put("resourceTop5", jsonObject.getJSONObject("data").getJSONArray("resourceTop5").stream().map(index -> (JSONObject) JSON.toJSON(index)).map(index -> new HashMap<String, Object>() {
{
put("服务名称", index.getString("service_name"));
put("申请次数", index.getLongValue("count"));
}
}).collect(Collectors.toList()));
}
});
} OkHttpClient client1 = new OkHttpClient();
} else { Request request1 = new Request.Builder().url(tsingtao_xhaProperties.getResourceapplyinfo()).build();
logger.error("青岛西海岸获取失败"); try (Response response = client1.newCall(request1).execute()) {
if (response.isSuccessful()) {
JSONObject jsonObject = JSON.parseObject(response.body().string());
if (jsonObject.containsKey("data")) {
result.add(new HashMap<String, Object>() {
{
put("amount", jsonObject.getJSONObject("data").getLongValue("requestCount"));
put("type", "总申请次数");
}
});
result.add(new HashMap<String, Object>() {
{
put("amount", jsonObject.getJSONObject("data").getIntValue("satisfactionRate"));
put("type", "满足率");
}
});
result.add(new HashMap<String, Object>() {
{
put("resourceTop5", jsonObject.getJSONObject("data").getJSONArray("resourceTop5").stream().map(index -> (JSONObject) JSON.toJSON(index)).map(index -> new HashMap<String, Object>() {
{
put("服务名称", index.getString("service_name"));
put("申请次数", index.getLongValue("count"));
}
}).collect(Collectors.toList()));
}
});
} }
} catch (Exception exception) { } else {
logger.error("青岛西海岸失败", exception); logger.error("青岛西海岸获取失败");
} }
}); } catch (Exception exception) {
logger.error("青岛西海岸失败", exception);
}
} }
break; break;
} }
if (allAmount == null) {
allAmount = CompletableFuture.runAsync(() -> {
try {
Thread.sleep(100l);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
});
}
if (applyInfo == null) {
applyInfo = CompletableFuture.runAsync(() -> {
try {
Thread.sleep(100l);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
});
}
CompletableFuture<Void> all = CompletableFuture.allOf(allAmount, applyInfo);
all.join();
return new Result().ok(result); return new Result().ok(result);
} }

View File

@ -3,5 +3,5 @@ tsingtao-xha.localhls=http://10.134.135.9:8001/hx-weatherwarning/camera/getCamer
tsingtao-xha.cloudcam=http://10.10.30.9:8001/hx-weather-warning/camera/getCameraListByName?name=%s&pageNo=%d&pageSize=%d tsingtao-xha.cloudcam=http://10.10.30.9:8001/hx-weather-warning/camera/getCameraListByName?name=%s&pageNo=%d&pageSize=%d
tsingtao-xha.localcam=http://10.134.135.9:8001/hx-weather-warning/camera/getCameraListByName?name=%s&pageNo=%d&pageSize=%d tsingtao-xha.localcam=http://10.134.135.9:8001/hx-weather-warning/camera/getCameraListByName?name=%s&pageNo=%d&pageSize=%d
tsingtao-xha.resourcecount=http://10.10.30.24:30090/api/share-portal/platform/catalogue/query?catalogueId=&departmentId=&serviceName=&type=&orderField=requestNum&orderType=desc&pageNum=1&pageSize=10&serviceType=data&rq=1655106309671.43 tsingtao-xha.resourcecount=http://10.10.30.24:30090/api/share-portal/platform/catalogue/query?catalogueId=&departmentId=&serviceName=&type=&orderField=requestNum&orderType=desc&pageNum=1&pageSize=10&serviceType=data&rq=1655106309671.43
tsingtao-xha.resourceapplyinfo=http://10.134.135.24:30058/shareportal/platform/index/abilityMarket/count tsingtao-xha.resourceapplyinfo=http://10.10.30.24:30058/share-portal/platform/index/abilityMarket/count
tsingtao-xha.sjzy=http://10.10.30.24:30090/api/share-portal/platform/catalogue/query?catalogueId=&departmentId=&serviceName=%s&type=&orderField=%s&orderType=%s&pageNum=%s&pageSize=%s&serviceType=data&rq=1655106309671.43 tsingtao-xha.sjzy=http://10.10.30.24:30090/api/share-portal/platform/catalogue/query?catalogueId=&departmentId=&serviceName=%s&type=&orderField=%s&orderType=%s&pageNum=%s&pageSize=%s&serviceType=data&rq=1655106309671.43