Compare commits

..

3 Commits

Author SHA1 Message Date
wangliwen d41c642108 Merge remote-tracking branch 'origin/master' 2022-06-24 15:55:53 +08:00
wangliwen b279459972 西海岸配置文件调整为现场正式配置 2022-06-24 15:55:25 +08:00
dinggang 08423a1f89 市局对接数据资源修改 2022-06-24 15:19:09 +08:00
4 changed files with 76 additions and 85 deletions

View File

@ -69,7 +69,8 @@ public class CensusControllerV2 {
private String[] censusTypes; // 需要进行统计的资源类型 private String[] censusTypes; // 需要进行统计的资源类型
@GetMapping(value = "/whole_amount") @GetMapping(value = "/whole_amount")
@ApiOperation("平台概览") @ApiOperation("能力云图-平台概览")
@LogOperation("能力云图-平台概览")
public Result<List<Map<String, Object>>> wholeAmount() { public Result<List<Map<String, Object>>> wholeAmount() {
List<Map<String, Object>> result = new CopyOnWriteArrayList<>(); List<Map<String, Object>> result = new CopyOnWriteArrayList<>();
@ -406,9 +407,7 @@ public class CensusControllerV2 {
break; break;
case TSINGTAO: { // TODO 青岛大数据局 case TSINGTAO: { // TODO 青岛大数据局
TsingtaoDataResourceService tsingtaoDataResourceService = new TsingtaoDataResourceService(); TsingtaoDataResourceService tsingtaoDataResourceService = new TsingtaoDataResourceService();
GetDataResourceListDto getDataResourceListDto = new GetDataResourceListDto(); GetDataResourceListDto getDataResourceListDto = new GetDataResourceListDto().setPageNum(1).setPageSize(5);
getDataResourceListDto.setPageNum(1);
getDataResourceListDto.setPageSize(5);
HashMap dataResource = (HashMap) tsingtaoDataResourceService.getDataResource(getDataResourceListDto); HashMap dataResource = (HashMap) tsingtaoDataResourceService.getDataResource(getDataResourceListDto);
JSONObject data = JSON.parseObject(JSON.toJSONString(dataResource.get("data"))); JSONObject data = JSON.parseObject(JSON.toJSONString(dataResource.get("data")));
result.add(new HashMap<String, Object>() { result.add(new HashMap<String, Object>() {
@ -431,99 +430,84 @@ public class CensusControllerV2 {
}); });
result.add(new HashMap<String, Object>() { result.add(new HashMap<String, Object>() {
{ {
put("resourceTop5", data.get("data")); String ja = data.getString("data");
List<Map> lists = JSON.parseArray(ja, Map.class);
ArrayList<Map> list = new ArrayList<>();
lists.forEach(item -> {
list.add(new HashMap<String, Object>(){{
put("服务名称", item.get("zyname"));
put("申请次数", item.get("syqk"));
}});
});
put("resourceTop5", list);
} }
}); });
} }
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

@ -130,7 +130,8 @@ public class ResourceController {
} }
@GetMapping("/{id}") @GetMapping("/{id}")
@ApiOperation("信息") @ApiOperation("查询能力资源详细信息")
@LogOperation("查询能力资源详细信息")
public Result<ResourceDTO> get(@PathVariable("id") Long id) { public Result<ResourceDTO> get(@PathVariable("id") Long id) {
ResourceDTO data = resourceService.get(id); ResourceDTO data = resourceService.get(id);
return new Result<ResourceDTO>().ok(data); return new Result<ResourceDTO>().ok(data);
@ -276,6 +277,7 @@ public class ResourceController {
@GetMapping("ZywMessage") @GetMapping("ZywMessage")
@ApiOperation("资源转发") @ApiOperation("资源转发")
@LogOperation("资源转发")
public Result ZywMessage() { public Result ZywMessage() {
String url = "http://15.72.158.81/zyjk/ZywMessage.asmx"; String url = "http://15.72.158.81/zyjk/ZywMessage.asmx";
String parame = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + String parame = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
@ -303,6 +305,7 @@ public class ResourceController {
@GetMapping("ZywMessage/list") @GetMapping("ZywMessage/list")
@ApiOperation("资源列表转发") @ApiOperation("资源列表转发")
@LogOperation("资源列表转发")
public Result ZywMessageList(@ApiParam("页数") Integer page, public Result ZywMessageList(@ApiParam("页数") Integer page,
@ApiParam("页大小") Integer size, @ApiParam("页大小") Integer size,
@ApiParam("排序字段fbrq发布日期syqk申请数量") String pxcol, @ApiParam("排序字段fbrq发布日期syqk申请数量") String pxcol,
@ -355,6 +358,7 @@ public class ResourceController {
@GetMapping("qdyjjWeather") @GetMapping("qdyjjWeather")
@ApiOperation("青岛应急局-查询青岛市地区天气信息") @ApiOperation("青岛应急局-查询青岛市地区天气信息")
@LogOperation("青岛应急局-查询青岛市地区天气信息")
public Result qdyjjWeather(String cityName) { public Result qdyjjWeather(String cityName) {
String loginUrl = "http://" + ipAndPort + "/service-oauth/login"; String loginUrl = "http://" + ipAndPort + "/service-oauth/login";
String weatherUrl = "http://" + ipAndPort + "/service-map/qxWeather/getTodayWeatherInfo"; String weatherUrl = "http://" + ipAndPort + "/service-map/qxWeather/getTodayWeatherInfo";
@ -384,6 +388,7 @@ public class ResourceController {
@GetMapping("knowledgeBase") @GetMapping("knowledgeBase")
@ApiOperation("对接知识库数据") @ApiOperation("对接知识库数据")
@LogOperation("对接知识库数据")
public Result<String> knowledgeBase() { public Result<String> knowledgeBase() {
resourceService.KnowledgeBase(); resourceService.KnowledgeBase();
return new Result().ok("任务开启成功!"); return new Result().ok("任务开启成功!");

View File

@ -1,11 +1,13 @@
package io.renren.modules.resource.dto; package io.renren.modules.resource.dto;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors;
/** /**
* 数据资源查询参数对象 * 数据资源查询参数对象
*/ */
@Data @Data
@Accessors(chain=true)
public class GetDataResourceListDto { public class GetDataResourceListDto {
//名称模糊查询 //名称模糊查询

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