资源无所属部门时 默认所属部门为 平台设置大数据局

This commit is contained in:
wangliwen 2022-11-09 10:18:49 +08:00
parent 8a4e11430e
commit 292ec95d3c
1 changed files with 11 additions and 5 deletions

View File

@ -216,6 +216,7 @@ public class AbilityCenterControllerV3 {
sysNoticeService.save(dto); sysNoticeService.save(dto);
}, executor); }, executor);
} }
logger.info("开始申请流程!");
List<TAbilityApplicationDTO> tAbilityApplicationDTOList = abilityBatchApplicationDTO.getSystem().stream().map(index -> { List<TAbilityApplicationDTO> tAbilityApplicationDTOList = abilityBatchApplicationDTO.getSystem().stream().map(index -> {
if (tAbilityApplicationService.countUserResourceApply(SecurityUser.getUserId(), Long.valueOf(index.get("resourceId"))) > 0) { // 防止重复发起申请 if (tAbilityApplicationService.countUserResourceApply(SecurityUser.getUserId(), Long.valueOf(index.get("resourceId"))) > 0) { // 防止重复发起申请
logger.error("重复发起申请"); logger.error("重复发起申请");
@ -283,19 +284,24 @@ public class AbilityCenterControllerV3 {
if (deptId == 0L) { // 部门id不存在时 if (deptId == 0L) { // 部门id不存在时
return; return;
} }
final SysDeptDTO sysDeptDTO = sysDeptService.get(deptId); SysDeptDTO sysDeptDTO = sysDeptService.get(deptId);
if (sysDeptDTO == null) { // 部门不存在 if (sysDeptDTO == null) { // 部门不存在
logger.info("资源部门不存在时!!!");
if (!deptDTO.isPresent()) {
return; return;
} }
sysDeptDTO = deptDTO.isPresent() ? deptDTO.get() : null;
}
List<TAbilityApplicationDTO> dtoList = temp.get(deptId); List<TAbilityApplicationDTO> dtoList = temp.get(deptId);
SysDeptDTO finalSysDeptDTO = sysDeptDTO;
dtoList = dtoList.stream().map(index -> { dtoList = dtoList.stream().map(index -> {
index.setResourceOwnerDept(sysDeptDTO); index.setResourceOwnerDept(finalSysDeptDTO);
return index; return index;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
List<TAbilityApplicationDTO> finalDtoList = dtoList; List<TAbilityApplicationDTO> finalDtoList = dtoList;
CompletableFuture.runAsync(() -> { 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); // 批量更新资源所属部门信息 jdbcTemplate.batchUpdate(sqls); // 批量更新资源所属部门信息
logger.info("批量更新申请的资源的部门信息完成"); logger.info("批量更新申请的资源的部门信息完成");
}, executor); }, executor);
@ -362,7 +368,7 @@ public class AbilityCenterControllerV3 {
put("city_apply", finalCityApply); // 是否为市级部门发起申请 put("city_apply", finalCityApply); // 是否为市级部门发起申请
put("cross_region", finalCrossRegion); // 是否跨区 put("cross_region", finalCrossRegion); // 是否跨区
put("city_apply_city", finalCityApplyCity); // 是否为市区申请市区 put("city_apply_city", finalCityApplyCity); // 是否为市区申请市区
put("resource_dept", sysDeptDTO); // 同一审核单内部门信息 put("resource_dept", finalSysDeptDTO); // 同一审核单内部门信息
} }
}); });