This commit is contained in:
wangliwen 2022-09-16 14:35:30 +08:00
parent a0508e76ff
commit cda3c4968a
1 changed files with 10 additions and 4 deletions

View File

@ -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<String, Object> params = new HashMap<String, Object>() {
@ -175,6 +180,7 @@ public class AbilityCenterControllerV3 {
*/
// TODO 拆单进行审核 abilityprocess_v3
private void deal(TAbilityBatchApplicationDTO abilityBatchApplicationDTO, Optional<SysDeptDTO> deptDTO, String applyFlag, UserDetail user) {
SysUserDTO sysUserDTO = sysUserService.get(user.getId());
List<TAbilityApplicationDTO> 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); // 是否为市级部门发起申请