diff --git a/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV2.java b/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV2.java index 2ccf3a58..1d417e6a 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV2.java +++ b/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV2.java @@ -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> 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); diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java index 2b919cfb..3daf1549 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java @@ -1953,19 +1953,63 @@ public class ResourceServiceImpl extends CrudServiceImpl resultMap = new HashMap<>(); //云资源 - CompletableFuture yzy = CompletableFuture.runAsync(() -> { - resultMap.put("云资源", resourceDao.selectYzyCount()); - }, executor); + CompletableFuture yzy = CompletableFuture.runAsync(() -> resultMap.put("云资源", resourceDao.selectYzyCount()), executor); //视频资源 - CompletableFuture jcss = CompletableFuture.runAsync(() -> { - - QueryWrapper 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); + switch (Constant.ProjectPlace.getByFlag(projectPlace)) { + case TSINGTAO_XHA: { // 青岛西海岸 + CompletableFuture allAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总基础设施数目 + List 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 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)); + } + break; + default: + break; + } //新增会客厅和视频会议统计 //会客厅 @@ -1977,10 +2021,9 @@ public class ResourceServiceImpl extends CrudServiceImpl sphy = CompletableFuture.runAsync(() -> { - resultMap.put("视频会议", enkeService.page(new HashMap<>()).getTotal()); - }, executor); - CompletableFuture all = CompletableFuture.allOf(jcss, hkt, sphy); + CompletableFuture sphy = CompletableFuture.runAsync(() -> resultMap.put("视频会议", enkeService.page(new HashMap<>()).getTotal()), executor); + + CompletableFuture all = CompletableFuture.allOf(yzy, hkt, sphy); all.join(); return resultMap; diff --git a/renren-admin/src/main/java/io/renren/modules/security/user/SecurityUser.java b/renren-admin/src/main/java/io/renren/modules/security/user/SecurityUser.java index da5b6222..585fb824 100644 --- a/renren-admin/src/main/java/io/renren/modules/security/user/SecurityUser.java +++ b/renren-admin/src/main/java/io/renren/modules/security/user/SecurityUser.java @@ -38,7 +38,7 @@ public class SecurityUser { logger.error("————————————————————————————user为null,返回空对象————————————————————————————"); return new UserDetail(); } - + return user; } diff --git a/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysRoleUserServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysRoleUserServiceImpl.java index 2af22b32..2e46727b 100644 --- a/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysRoleUserServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysRoleUserServiceImpl.java @@ -1,6 +1,5 @@ package io.renren.modules.sys.service.impl; -import cn.hutool.core.collection.CollUtil; import io.renren.common.service.impl.BaseServiceImpl; import io.renren.modules.security.user.SecurityUser; import io.renren.modules.sys.controller.SysUserController;