Browse Source

modify:

1. 会议列表增加数据权限;
2. 创建会议选择项目增加数据权限
tags/24080901
WendyYang 4 months ago
parent
commit
f5279b236b
5 changed files with 41 additions and 6 deletions
  1. +2
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/datascope/utils/DataScopeUtil.java
  2. +35
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java
  3. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/user/model/enumeration/RoleEnum.java
  4. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserFullInfoDTO.java
  5. +2
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserInfoDetails.java

+ 2
- 2
hz-pm-api/src/main/java/com/hz/pm/api/datascope/utils/DataScopeUtil.java View File

@@ -36,10 +36,10 @@ public class DataScopeUtil {

public static Optional<DataScopeDTO> getCurrentUserDataScope() {
UserInfoDetails loginUser = LoginUserUtil.loginUserDetail();
if (Objects.isNull(loginUser) || Objects.isNull(loginUser.getRoleCode())) {
if (Objects.isNull(loginUser) || Objects.isNull(loginUser.maxAuthRole())) {
return Optional.empty();
}
return DataScopeContext.getDataScope(loginUser.getRoleCode().name());
return DataScopeContext.getDataScope(loginUser.maxAuthRole().name());
}

}

+ 35
- 0
hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java View File

@@ -46,7 +46,9 @@ import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus;
import com.hz.pm.api.projectlib.service.IProjectService;
import com.hz.pm.api.sys.model.dto.RegionDTO;
import com.hz.pm.api.user.helper.MhUnitCache;
import com.hz.pm.api.user.model.entity.UserInfo;
import com.hz.pm.api.user.model.enumeration.RoleEnum;
import com.hz.pm.api.user.security.model.UserInfoDetails;
import com.hz.pm.api.user.service.IUserInfoService;
import com.hz.pm.api.user.util.LoginUserUtil;
@@ -105,6 +107,7 @@ public class MeetingManage {
private final MhApiClient mhApiClient;
private final IUserInfoService userInfoService;
private final EnvironmentUtil environmentUtil;
private final MhUnitCache mhUnitCache;

private static final String INVITED_RULE_CREATE = "INVITED_RULE_CREATE:";

@@ -409,6 +412,23 @@ public class MeetingManage {
.eq(req.getStatus() != null, Meeting::getStatus, req.getStatus())
.orderByDesc(Meeting::getCreateOn);
meetingManageHelper.buildMeetingQuery(query, req);
UserInfoDetails userDetail = LoginUserUtil.loginUserDetail();
RoleEnum maxRoleAuth = userDetail.maxAuthRole();
switch (maxRoleAuth) {
case SUPER_ADMIN:
// 超管看所有
break;
case COMPANY_MANAGER:
List<Long> viewOrgIds = mhUnitCache.getViewChildIdsRecursion(userDetail.getMhUnitId());
if (viewOrgIds.isEmpty()) {
return PageVo.empty();
}
query.in(Meeting::getHoldOrgCode, viewOrgIds);
break;
default:
query.eq(Meeting::getHoldOrgCode, userDetail.getMhUnitIdStr());
break;
}
Page<Meeting> page = meetingService.page(req.page(), query);
if (page.getTotal() == 0) {
return PageVo.empty();
@@ -929,6 +949,21 @@ public class MeetingManage {
String meetingType = req.getMeetingType();
LambdaQueryWrapper<Project> query = Wrappers.lambdaQuery(Project.class)
.eq(Project::getNewest, Boolean.TRUE);
UserInfoDetails userDetail = LoginUserUtil.loginUserDetail();
switch (userDetail.maxAuthRole()) {
case SUPER_ADMIN:
break;
case COMPANY_MANAGER:
List<Long> viewUnitIds = mhUnitCache.getViewChildIdsRecursion(userDetail.getMhUnitId());
if (CollUtil.isEmpty(viewUnitIds)) {
return PageVo.empty();
}
query.in(Project::getBuildOrgCode, viewUnitIds);
break;
default:
query.eq(Project::getBuildOrgCode, userDetail.getMhUnitIdStr());
break;
}
switch (MeetingReviewTypeEnum.getByCode(meetingType)) {
case PRELIMINARY_SCHEME_REVIEW:
case CONSTRUCTION_SCHEME_REVIEW:


+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/user/model/enumeration/RoleEnum.java View File

@@ -65,7 +65,7 @@ public enum RoleEnum {
return null;
}

public static RoleEnum checkHigherRole(List<String> roleCodes) {
public static RoleEnum maxAuthRole(List<String> roleCodes) {
RoleEnum res = null;
for (String roleCode : roleCodes) {
RoleEnum roleEnum = mathByName(roleCode);


+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserFullInfoDTO.java View File

@@ -59,7 +59,7 @@ public class UserFullInfoDTO {
*/
public RoleEnum getRoleCode() {
if (CollUtil.isNotEmpty(this.userRoleList)) {
return RoleEnum.checkHigherRole(this.userRoleList.stream()
return RoleEnum.maxAuthRole(this.userRoleList.stream()
.map(Role::getCode).collect(Collectors.toList()));
}
return null;


+ 2
- 2
hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserInfoDetails.java View File

@@ -123,9 +123,9 @@ public class UserInfoDetails extends AbstractLoginUser implements UserDetails {
*
* @return \
*/
public RoleEnum getRoleCode() {
public RoleEnum maxAuthRole() {
if (CollUtil.isNotEmpty(this.userRoleList)) {
return RoleEnum.checkHigherRole(this.userRoleList.stream()
return RoleEnum.maxAuthRole(this.userRoleList.stream()
.map(Role::getCode).collect(Collectors.toList()));
}
return null;


Loading…
Cancel
Save