From 292ec95d3c02d247ee84b3438db8bb801446b5c8 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Wed, 9 Nov 2022 10:18:49 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E6=BA=90=E6=97=A0=E6=89=80=E5=B1=9E?= =?UTF-8?q?=E9=83=A8=E9=97=A8=E6=97=B6=20=E9=BB=98=E8=AE=A4=E6=89=80?= =?UTF-8?q?=E5=B1=9E=E9=83=A8=E9=97=A8=E4=B8=BA=20=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E5=A4=A7=E6=95=B0=E6=8D=AE=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AbilityCenterControllerV3.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV3.java b/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV3.java index b8ce1948..cec16f03 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV3.java +++ b/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV3.java @@ -216,6 +216,7 @@ public class AbilityCenterControllerV3 { sysNoticeService.save(dto); }, executor); } + logger.info("开始申请流程!"); List tAbilityApplicationDTOList = abilityBatchApplicationDTO.getSystem().stream().map(index -> { if (tAbilityApplicationService.countUserResourceApply(SecurityUser.getUserId(), Long.valueOf(index.get("resourceId"))) > 0) { // 防止重复发起申请 logger.error("重复发起申请"); @@ -283,19 +284,24 @@ public class AbilityCenterControllerV3 { if (deptId == 0L) { // 部门id不存在时 return; } - final SysDeptDTO sysDeptDTO = sysDeptService.get(deptId); + SysDeptDTO sysDeptDTO = sysDeptService.get(deptId); if (sysDeptDTO == null) { // 部门不存在 - return; + logger.info("资源部门不存在时!!!"); + if (!deptDTO.isPresent()) { + return; + } + sysDeptDTO = deptDTO.isPresent() ? deptDTO.get() : null; } List dtoList = temp.get(deptId); + SysDeptDTO finalSysDeptDTO = sysDeptDTO; dtoList = dtoList.stream().map(index -> { - index.setResourceOwnerDept(sysDeptDTO); + index.setResourceOwnerDept(finalSysDeptDTO); return index; }).collect(Collectors.toList()); List finalDtoList = dtoList; CompletableFuture.runAsync(() -> { - String[] sqls = finalDtoList.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[finalDtoList.size()]); + String[] sqls = finalDtoList.stream().map(index -> String.format("UPDATE t_ability_application SET resource_owner_dept = '%s' WHERE id = %s", JSON.toJSONString(finalSysDeptDTO), index.getId())).collect(Collectors.toList()).toArray(new String[finalDtoList.size()]); jdbcTemplate.batchUpdate(sqls); // 批量更新资源所属部门信息 logger.info("批量更新申请的资源的部门信息完成"); }, executor); @@ -362,7 +368,7 @@ public class AbilityCenterControllerV3 { put("city_apply", finalCityApply); // 是否为市级部门发起申请 put("cross_region", finalCrossRegion); // 是否跨区 put("city_apply_city", finalCityApplyCity); // 是否为市区申请市区 - put("resource_dept", sysDeptDTO); // 同一审核单内部门信息 + put("resource_dept", finalSysDeptDTO); // 同一审核单内部门信息 } });