Merge remote-tracking branch '备份/dev' into dev

This commit is contained in:
wangliwen 2022-12-01 14:21:56 +08:00
commit 49d94eda9d
3 changed files with 61 additions and 19 deletions

View File

@ -213,7 +213,7 @@ public class AbilityCenterControllerV2 {
tAbilityApplicationDTO.setEnclosureName(abilityBatchApplicationDTO.getEnclosureName());
tAbilityApplicationDTO.setCreateDate(new Date());
tAbilityApplicationDTO.setExpireDate(abilityBatchApplicationDTO.getExpireDate());
tAbilityApplicationDTO.setResourceOwnerDept(sysDeptService.getByName(index.get("managementUnitName")));
//tAbilityApplicationDTO.setResourceOwnerDept(sysDeptService.getByName(index.get("managementUnitName")));
// 归为同一次申请
@ -233,7 +233,6 @@ public class AbilityCenterControllerV2 {
}).filter(ObjectUtil::isNotNull).collect(Collectors.toList()); // 申请入库
if (!tAbilityApplicationDTOList.isEmpty()) {
codeGenerationUtils.setApplyNumber("NLSY", tAbilityApplicationDTOList.stream().map(TAbilityApplicationDTO::getId).collect(Collectors.toList()), jdbcTemplate);
Map<Long, List<TAbilityApplicationDTO>> temp = tAbilityApplicationDTOList.stream()
.filter(Objects::nonNull)
.filter(index -> StringUtils.isNotEmpty(index.getResourceId()))
@ -262,7 +261,7 @@ public class AbilityCenterControllerV2 {
CompletableFuture.runAsync(() -> {
String[] sqls = dtoList.stream().map(index -> String.format("UPDATE t_ability_application SET resource_owner_dept = '%s' WHERE id = %s", JSON.toJSONString(sysDeptDTO), index.getId())).collect(Collectors.toList()).toArray(new String[dtoList.size()]);
jdbcTemplate.batchUpdate(sqls); // 批量更新资源所属部门信息
jdbcTemplate.batchUpdate(sqls);// 批量更新资源所属部门信息
logger.info("批量更新申请的资源的部门信息完成");
}, executor);

View File

@ -1953,19 +1953,63 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
public Object selectInfrastructureList() {
HashMap<String, Object> resultMap = new HashMap<>();
//云资源
CompletableFuture<Void> yzy = CompletableFuture.runAsync(() -> {
resultMap.put("云资源", resourceDao.selectYzyCount());
}, executor);
CompletableFuture<Void> yzy = CompletableFuture.runAsync(() -> resultMap.put("云资源", resourceDao.selectYzyCount()), executor);
//视频资源
CompletableFuture<Void> jcss = CompletableFuture.runAsync(() -> {
switch (Constant.ProjectPlace.getByFlag(projectPlace)) {
case TSINGTAO_XHA: { // 青岛西海岸
CompletableFuture allAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总基础设施数目
List<Long> result = new CopyOnWriteArrayList<>();
CompletableFuture cloud = CompletableFuture.runAsync(() -> { // 云脑专网
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("errorNo") && jsonObject.getLongValue("errorNo") == 200) {
result.add(jsonObject.getLongValue("body"));
}
} else {
logger.error("青岛西海岸获取失败");
}
} catch (Exception exception) {
logger.error("青岛西海岸失败", exception);
}
}, executor);
CompletableFuture local = CompletableFuture.runAsync(() -> { // 金宏网
String url = tsingtao_xhaProperties.getLocalcam();
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("errorNo") && jsonObject.getLongValue("errorNo") == 200) {
result.add(jsonObject.getLongValue("body"));
}
} else {
logger.error("青岛西海岸获取失败");
}
} catch (Exception exception) {
logger.error("青岛西海岸失败", exception);
}
}, executor);
CompletableFuture all = CompletableFuture.allOf(cloud, local);
all.join();
return result.stream().filter(Objects::nonNull).findAny().orElse(0L);
}).thenAccept(sum -> resultMap.put("视频资源", sum));
allAmount.join();
}
break;
case TSINGTAO: {
QueryWrapper<CameraChannel> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("check_status", 1).ne("gps_x", "").ne("gps_y", "").isNotNull("gps_x").isNotNull("gps_y");
resultMap.put("视频资源", cameraChannelMapper.selectCount(queryWrapper));
}, executor);
}
break;
default:
break;
}
//新增会客厅和视频会议统计
//会客厅
@ -1977,10 +2021,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
}, executor);
//视频会议
CompletableFuture<Void> sphy = CompletableFuture.runAsync(() -> {
resultMap.put("视频会议", enkeService.page(new HashMap<>()).getTotal());
}, executor);
CompletableFuture<Void> all = CompletableFuture.allOf(jcss, hkt, sphy);
CompletableFuture<Void> sphy = CompletableFuture.runAsync(() -> resultMap.put("视频会议", enkeService.page(new HashMap<>()).getTotal()), executor);
CompletableFuture<Void> all = CompletableFuture.allOf(yzy, hkt, sphy);
all.join();
return resultMap;