Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
wangliwen 2022-08-01 10:13:33 +08:00
commit b68daeda1c
8 changed files with 92 additions and 60 deletions

View File

@ -342,40 +342,36 @@ public class CensusControllerV2 {
List<Map<String, Object>> dbAmount = (List<Map<String, Object>>) map.get("total");
return dbAmount.stream().filter(index -> "基础设施".equals(index.get("type").toString()))
.mapToLong(index -> Long.parseLong(index.get("count").toString())).sum();
}).thenAccept(sum -> {
result.add(new HashMap<String, Object>() {
}).thenAccept(sum -> result.add(new HashMap<String, Object>() {
{
put("amount", sum);
put("type", "视频资源数量");
}
});
});
}));
}
break;
case BAOTOU: { // 包头
allAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总基础设施数目
return jdbcTemplate.queryForObject("SELECT COUNT(id) FROM tb_data_resource WHERE type = '基础设施' AND del_flag = 0", Long.class);
}).thenAccept(sum -> {
result.add(new HashMap<String, Object>() {
}).thenAccept(sum -> result.add(new HashMap<String, Object>() {
{
put("amount", sum);
put("type", "视频资源数量");
}
});
});
}));
}
break;
case TSINGTAO_XHA: { // 青岛西海岸
allAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总基础设施数目
List<Long> result_ = new CopyOnWriteArrayList<>();
String url = String.format(tsingtao_xhaProperties.getCloudcam(), "", 1, 10);
String url = tsingtao_xhaProperties.getCamCount();
logger.info(url);
Request request = new Request.Builder().url(url).build();
try (Response response = client.newCall(request).execute()) {
if (response.isSuccessful()) {
JSONObject jsonObject = JSON.parseObject(response.body().string());
if (jsonObject.containsKey("data")) {
result_.add(jsonObject.getJSONObject("data").getLongValue("total"));
if (jsonObject.containsKey("errorNo") && jsonObject.getLongValue("errorNo") == 200) {
result_.add(jsonObject.getLongValue("body"));
}
} else {
logger.error("青岛西海岸获取失败");
@ -383,15 +379,13 @@ public class CensusControllerV2 {
} catch (Exception exception) {
logger.error("青岛西海岸失败", exception);
}
return result_.stream().filter(index -> index != null).findAny().orElse(0l);
}).thenAccept(sum -> {
result.add(new HashMap<String, Object>() {
return result_.stream().filter(Objects::nonNull).findAny().orElse(0L);
}).thenAccept(sum -> result.add(new HashMap<String, Object>() {
{
put("amount", sum);
put("type", "视频资源数量");
}
});
});
}));
}
break;
}
@ -461,19 +455,17 @@ public class CensusControllerV2 {
{
List<Map> lists = (dataResource != null && dataResource.containsKey("data") && dataResource.get("data") != null) ? (List<Map>) dataResource.get("data") : new ArrayList<>();
ArrayList<Map> list = new ArrayList<>();
lists.forEach(item -> {
list.add(new HashMap<String, Object>() {{
lists.forEach(item -> list.add(new HashMap<String, Object>() {{
put("服务名称", item.get("zyname"));
put("申请次数", item.get("syqk"));
}});
});
}}));
put("resourceTop5", list);
}
});
}
break;
case TSINGTAO_XHA: { // 青岛西海岸
Long total = 0L;
Long total;
Request request = new Request.Builder().url(tsingtao_xhaProperties.getResourcecount()).build();
try (Response response = client.newCall(request).execute()) {
if (response.isSuccessful()) {

View File

@ -1,6 +1,5 @@
package io.renren.common.domain;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
@ -21,4 +20,5 @@ public class Tsingtao_xhaProperties {
private String resourcecount;
private String resourceapplyinfo;
private String sjzy;
private String camCount;
}

View File

@ -1,6 +1,5 @@
package io.renren.modules.monitor.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.renren.common.dao.BaseDao;
import io.renren.modules.monitor.entity.CameraOrganization;
import org.apache.ibatis.annotations.Mapper;

View File

@ -538,7 +538,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
List<Long> result = new CopyOnWriteArrayList<>();
CompletableFuture cloud =
CompletableFuture.runAsync(() -> { // 云脑专网
String url = tsingtao_xhaProperties.getCloudcam();
String url = tsingtao_xhaProperties.getCamCount();
logger.info(url);
Request request = new Request.Builder().url(url).build();
try (Response response = client.newCall(request).execute()) {
@ -1874,35 +1874,75 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override
public List<Map> selectDevelopDoc() {
//List<Map> result = new ArrayList<>();
//List<Map<String, Object>> dtoMaps = baseDao.selectDevelopDocResource();
//Map<String, List<Map<String, Object>>> resourceTypeMap = dtoMaps.stream().collect(Collectors.groupingBy(m -> m.get("type").toString()));
//resourceTypeMap.forEach((key, value) -> {
// if (!"组件服务".equals(key)) {
// Map<String, Object> map = new HashMap<>();
// map.put("title", key);
// map.put("children", value);
// result.add(map);
// }
//});
//if (resourceTypeMap.get("组件服务") != null) {
// Map componentMap = new HashMap();
// componentMap.put("title", "组件服务");
// Map<String, List> map = new ConcurrentHashMap<>();
// CompletableFuture.allOf(resourceTypeMap.get("组件服务").stream()
// .map(it -> CompletableFuture.runAsync(() -> selectAttrsByResourceId(Long.parseLong(it.get("id").toString()))
// .stream()
// .filter(temp -> "组件类型".equals(temp.getAttrType()))
// .forEach(attr -> {
// if (map.get(attr.getAttrValue()) != null) {
// map.get(attr.getAttrValue()).add(it);
// } else {
// map.put(attr.getAttrValue(), Collections.synchronizedList(new ArrayList() {{
// add(it);
// }}));
// }
// }), executor))
// .collect(Collectors.toList())
// .toArray(new CompletableFuture[resourceTypeMap.get("组件服务").size()]))
// .join();
// componentMap.put("children", map.entrySet().stream().map(it -> new HashMap() {{
// put("title", it.getKey());
// put("children", it.getValue());
// }}).collect(Collectors.toList()));
// result.add(componentMap);
//}
//return result;
List<Map> result = new ArrayList<>();
List<Map<String, Object>> dtoMaps = baseDao.selectDevelopDocResource();
Map<String, List<Map<String, Object>>> resourceTypeMap = dtoMaps.stream().collect(Collectors.groupingBy(m -> m.get("type").toString()));
resourceTypeMap.forEach((key, value) -> {
if (!"组件服务".equals(key)) {
Map<String, Object> map = new HashMap<>();
map.put("title", key);
map.put("children", value);
resourceTypeMap.entrySet().stream().forEach(temp -> {
if (!"组件服务".equals(temp.getKey())) {
Map map = new HashMap();
map.put("title", temp.getKey());
map.put("children", temp.getValue());
result.add(map);
}
});
if (resourceTypeMap.get("组件服务") != null) {
Map<String, Object> componentMap = new HashMap<>();
Map componentMap = new HashMap();
componentMap.put("title", "组件服务");
Map<String, List> map = new ConcurrentHashMap<>();
CompletableFuture[] completableFutures = resourceTypeMap.get("组件服务").stream().map(it -> CompletableFuture.runAsync(() -> selectAttrsByResourceId(Long.parseLong(it.get("id").toString())).stream()
.filter(temp -> "组件类型".equals(temp.getAttrType())).forEach(attr -> {
List<CompletableFuture> tasks = resourceTypeMap.get("组件服务").stream().map(it -> {
CompletableFuture task = CompletableFuture.runAsync(() -> {
selectAttrsByResourceId(Long.parseLong(it.get("id").toString())).stream().filter(temp -> "组件类型".equals(temp.getAttrType())).forEach(attr -> {
if (map.get(attr.getAttrValue()) != null) {
map.get(attr.getAttrValue()).add(it);
} else {
map.put(attr.getAttrValue(), Collections.synchronizedList(new ArrayList() {{
map.put(attr.getAttrValue(), (List) Collections.synchronizedList(new ArrayList() {{
add(it);
}}));
}
}), executor))
.collect(Collectors.toList())
.toArray(new CompletableFuture[resourceTypeMap.get("组件服务").size()]);
CompletableFuture.allOf(completableFutures).join();
componentMap.put("children", map.entrySet().stream().map(it -> new HashMap<String, Object>() {{
});
}, executor);
return task;
}).collect(Collectors.toList());
CompletableFuture.allOf(tasks.toArray(new CompletableFuture[tasks.size()])).join();
componentMap.put("children", map.entrySet().stream().map(it -> new HashMap() {{
put("title", it.getKey());
put("children", it.getValue());
}}).collect(Collectors.toList()));
@ -1910,6 +1950,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
}
return result;
}
}

View File

@ -6,8 +6,7 @@ spring:
#MySQL
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://15.2.21.238:3310/share_platform?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&useSSL=false
#url: jdbc:mysql://15.2.21.221:3306/share_platform?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&useSSL=false
url: jdbc:mysql://192.168.124.236:3306/share_platform?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&useSSL=false
username: root
password: Hisense2019
#Hisense2019

View File

@ -5,7 +5,7 @@ spring:
druid:
#MySQL
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://15.2.21.238:3310/share_platform_show?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&useSSL=false
url: jdbc:mysql://192.168.124.236:3310/share_platform_show?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&useSSL=false
username: root
password: Hisense2019
# #Oracle

View File

@ -5,9 +5,9 @@ spring:
druid:
#MySQL
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://15.2.21.238:3310/share_platform?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
url: jdbc:mysql://192.168.124.243:3306/share_platform?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
username: root
password: Hisense2019
password: Liwen073898!
initial-size: 10
max-active: 100
min-idle: 10

View File

@ -1,7 +1,8 @@
tsingtao-xha.cloudhls=http://10.10.30.9:8001/hx-weather-warning/camera/getCameraLiveStreamByCode?cameraCode=%s&protocol=hls
tsingtao-xha.localhls=http://10.134.135.9:8001/hx-weather-warning/camera/getCameraLiveStreamByCode?cameraCode=%s&protocol=hls
tsingtao-xha.cloudcam=http://10.10.30.9:8001/data_service/getCamera/getCameraCount
tsingtao-xha.localcam=http://10.10.30.57:9537/data_service/getCamera/getCameraCount
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.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.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.camCount=http://10.10.30.57:9537/data_service/getCamera/getCameraCount