From cda3c4968a7c2822b1d5012f63df5c2816b4bf2e Mon Sep 17 00:00:00 2001 From: wangliwen Date: Fri, 16 Sep 2022 14:35:30 +0800 Subject: [PATCH] ... --- .../controller/AbilityCenterControllerV3.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 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 77a49a96..4bcc919f 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 @@ -24,7 +24,9 @@ import io.renren.modules.resource.service.ResourceService; import io.renren.modules.security.user.SecurityUser; import io.renren.modules.security.user.UserDetail; import io.renren.modules.sys.dto.SysDeptDTO; +import io.renren.modules.sys.dto.SysUserDTO; import io.renren.modules.sys.service.SysDeptService; +import io.renren.modules.sys.service.SysUserService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; @@ -82,6 +84,9 @@ public class AbilityCenterControllerV3 { @Autowired private SysDeptService sysDeptService; + @Autowired + private SysUserService sysUserService; + private static final String KEY = "abilityprocess_v3"; private static final Map params = new HashMap() { @@ -175,6 +180,7 @@ public class AbilityCenterControllerV3 { */ // TODO 拆单进行审核 abilityprocess_v3 private void deal(TAbilityBatchApplicationDTO abilityBatchApplicationDTO, Optional deptDTO, String applyFlag, UserDetail user) { + SysUserDTO sysUserDTO = sysUserService.get(user.getId()); List tAbilityApplicationDTOList = abilityBatchApplicationDTO.getSystem().stream().map(index -> { if (tAbilityApplicationService.countUserResourceApply(SecurityUser.getUserId(), Long.valueOf(index.get("resourceId"))) > 0) { // 防止重复发起申请 logger.error("重复发起申请"); @@ -285,8 +291,8 @@ public class AbilityCenterControllerV3 { Boolean cityApplyCity = Boolean.FALSE; // 是否为市区申请市区 // TODO - if (user.getDeptId() != null) { - SysDeptDTO applyUserDeptDTO = sysDeptService.get(user.getDeptId()); // 发起人的部门 + if (sysUserDTO.getDeptId() != null) { + SysDeptDTO applyUserDeptDTO = sysDeptService.get(sysUserDTO.getDeptId()); // 发起人的部门 Integer applyUserDeptType = applyUserDeptDTO.getType(); // 发起人 Integer resourceDeptType = sysDeptDTO.getType(); // 资源所属部门 if (applyUserDeptType != null && applyUserDeptType == 2) { @@ -295,7 +301,7 @@ public class AbilityCenterControllerV3 { if (resourceDeptType != null && resourceDeptType == 2) { cityApplyCity = Boolean.TRUE; // 市区申请市区 } - SysDeptDTO userDept = sysDeptService.get(user.getDeptId()); + SysDeptDTO userDept = sysDeptService.get(sysUserDTO.getDeptId()); if (!cityApply && !userDept.getDistrict().equals(sysDeptDTO.getDistrict()) && userDept.getDistrict() != null) { // 非市申请且发起人与资源所属区县不一致 crossRegion = Boolean.TRUE; // 跨区 } @@ -314,7 +320,7 @@ public class AbilityCenterControllerV3 { put("_id", applyFlag); //申请id put("creator", user == null ? null : user.getId().toString()); // 创建人 put("userId", user == null ? null : user.getId().toString()); // 创建人 - put("userDeptId", user == null ? null : (user.getDeptId() == null ? abilityBatchApplicationDTO.getDeptId().toString() : user.getDeptId().toString())); // 发起人部门id + put("userDeptId", sysUserDTO == null ? null : sysUserDTO.getDeptId().toString()); // 发起人部门id put("basic_facilities", basicFacilities); // 是否为基础设施 // 以下为V3增加 put("city_apply", finalCityApply); // 是否为市级部门发起申请