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); // 同一审核单内部门信息 } });