From 82faf95effef5184b29f227963f0019f6fa337c8 Mon Sep 17 00:00:00 2001 From: dinggang <2498628697@qq.com> Date: Thu, 1 Dec 2022 09:12:54 +0800 Subject: [PATCH] =?UTF-8?q?1.=E8=A5=BF=E6=B5=B7=E5=B2=B8=E5=AE=A1=E6=89=B9?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9=202.=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E6=B1=87=E8=81=9A=E6=80=BB=E9=87=8F=E7=BB=9F=E8=AE=A1=E5=8C=BA?= =?UTF-8?q?=E5=88=86=E8=A5=BF=E6=B5=B7=E5=B2=B8=E5=92=8C=E5=B8=82=E5=B1=80?= =?UTF-8?q?=E7=8E=AF=E5=A2=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AbilityCenterControllerV2.java | 5 +- .../service/impl/ResourceServiceImpl.java | 73 +++++++++++++++---- .../modules/security/user/SecurityUser.java | 2 +- .../service/impl/SysRoleUserServiceImpl.java | 1 - 4 files changed, 61 insertions(+), 20 deletions(-) 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;