@@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
import com.ningdatech.basic.model.PageVo; | import com.ningdatech.basic.model.PageVo; | ||||
import com.hz.pm.api.common.enumeration.CommonEnum; | import com.hz.pm.api.common.enumeration.CommonEnum; | ||||
import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus; | |||||
import com.hz.pm.api.projectlib.model.entity.Project; | import com.hz.pm.api.projectlib.model.entity.Project; | ||||
import com.hz.pm.api.projectlib.model.req.ProjectListReq; | import com.hz.pm.api.projectlib.model.req.ProjectListReq; | ||||
import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; | import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; | ||||
@@ -72,7 +71,7 @@ public class IrsProjectManage { | |||||
} | } | ||||
private void buildPermission(LambdaQueryWrapper<Project> wrapper, UserInfoDetails user) { | private void buildPermission(LambdaQueryWrapper<Project> wrapper, UserInfoDetails user) { | ||||
if (user.getSuperAdmin() || user.getRegionAdmin()) { | |||||
if (user.hasSuperAdmin() || user.hasRegionAdmin()) { | |||||
log.info("超管 都可看 项目档案列表"); | log.info("超管 都可看 项目档案列表"); | ||||
} else { | } else { | ||||
wrapper.eq(Project::getBuildOrgCode, user.getMhUnitIdStr()); | wrapper.eq(Project::getBuildOrgCode, user.getMhUnitIdStr()); | ||||
@@ -87,7 +87,7 @@ public class TagManage { | |||||
*/ | */ | ||||
private void checkAuth(LambdaQueryWrapper<Tag> query, UserInfoDetails user) { | private void checkAuth(LambdaQueryWrapper<Tag> query, UserInfoDetails user) { | ||||
//如果是超管 | //如果是超管 | ||||
if (user.getSuperAdmin() || user.getRegionAdmin()) { | |||||
if (user.hasSuperAdmin() || user.hasRegionAdmin()) { | |||||
log.info(user.getUsername() + " 是超管,可以看所有标签"); | log.info(user.getUsername() + " 是超管,可以看所有标签"); | ||||
} else { | } else { | ||||
//其它角色全都看不见 | //其它角色全都看不见 | ||||
@@ -310,7 +310,7 @@ public class ConstructionManage { | |||||
query.eq(Project::getStage, ProjectStatus.PROJECT_APPROVED.getCode()); | query.eq(Project::getStage, ProjectStatus.PROJECT_APPROVED.getCode()); | ||||
query.eq(Project::getNewest, Boolean.TRUE); | query.eq(Project::getNewest, Boolean.TRUE); | ||||
//只能看自己单位的 | //只能看自己单位的 | ||||
if (!user.getSuperAdmin()) { | |||||
if (!user.hasSuperAdmin()) { | |||||
query.eq(Project::getBuildOrgCode, user.getMhUnitIdStr()); | query.eq(Project::getBuildOrgCode, user.getMhUnitIdStr()); | ||||
} | } | ||||
query.orderByAsc(Project::getDeliveryTime); | query.orderByAsc(Project::getDeliveryTime); | ||||
@@ -36,7 +36,6 @@ import com.hz.pm.api.projectlib.service.IProjectAnnualPaymentPlanService; | |||||
import com.hz.pm.api.projectlib.service.IProjectInstService; | import com.hz.pm.api.projectlib.service.IProjectInstService; | ||||
import com.hz.pm.api.projectlib.service.IProjectService; | import com.hz.pm.api.projectlib.service.IProjectService; | ||||
import com.hz.pm.api.sys.manage.ProcessModelManage; | import com.hz.pm.api.sys.manage.ProcessModelManage; | ||||
import com.hz.pm.api.todocenter.manage.HandlerManage; | |||||
import com.hz.pm.api.user.security.model.UserFullInfoDTO; | import com.hz.pm.api.user.security.model.UserFullInfoDTO; | ||||
import com.hz.pm.api.user.security.model.UserInfoDetails; | import com.hz.pm.api.user.security.model.UserInfoDetails; | ||||
import com.hz.pm.api.user.util.LoginUserUtil; | import com.hz.pm.api.user.util.LoginUserUtil; | ||||
@@ -59,7 +58,6 @@ import javax.servlet.http.HttpServletResponse; | |||||
import java.math.BigDecimal; | import java.math.BigDecimal; | ||||
import java.util.*; | import java.util.*; | ||||
import java.util.concurrent.atomic.AtomicInteger; | import java.util.concurrent.atomic.AtomicInteger; | ||||
import java.util.stream.Collectors; | |||||
/** | /** | ||||
* @Classname FinalAcceptanceManage | * @Classname FinalAcceptanceManage | ||||
@@ -113,7 +111,7 @@ public class FinalAcceptanceManage { | |||||
if (projectIds.isEmpty()) { | if (projectIds.isEmpty()) { | ||||
return PageVo.empty(); | return PageVo.empty(); | ||||
} | } | ||||
if (!user.getSuperAdmin()) { | |||||
if (!user.hasSuperAdmin()) { | |||||
query.eq(Project::getBuildOrgCode, user.getMhUnitIdStr()); | query.eq(Project::getBuildOrgCode, user.getMhUnitIdStr()); | ||||
} | } | ||||
query.in(Project::getId, projectIds); | query.in(Project::getId, projectIds); | ||||
@@ -207,7 +207,7 @@ public class PurchaseManage { | |||||
*/ | */ | ||||
private void permission(LambdaQueryWrapper<Project> query, UserInfoDetails user) { | private void permission(LambdaQueryWrapper<Project> query, UserInfoDetails user) { | ||||
//超管看所有 | //超管看所有 | ||||
if (user.getSuperAdmin()) { | |||||
if (user.hasSuperAdmin()) { | |||||
log.info("超管查看所有采购信息 :{}", user.getUsername()); | log.info("超管查看所有采购信息 :{}", user.getUsername()); | ||||
} else { | } else { | ||||
//其他情况 只能看自己单位 | //其他情况 只能看自己单位 | ||||
@@ -177,7 +177,7 @@ public class ProjectChangeManage { | |||||
LambdaQueryWrapper<Project> wrapper = ProjectManageUtil.projectQuery(req) | LambdaQueryWrapper<Project> wrapper = ProjectManageUtil.projectQuery(req) | ||||
.eq(Project::getNewest, Boolean.TRUE); | .eq(Project::getNewest, Boolean.TRUE); | ||||
UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); | UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); | ||||
if (!userDetail.getSuperAdmin()) { | |||||
if (!userDetail.hasSuperAdmin()) { | |||||
wrapper.eq(Project::getBuildOrgCode, userDetail.getMhUnitIdStr()); | wrapper.eq(Project::getBuildOrgCode, userDetail.getMhUnitIdStr()); | ||||
} | } | ||||
Page<ProjectChangeListDTO> page = projectService.pageChangeList(wrapper, req.page()); | Page<ProjectChangeListDTO> page = projectService.pageChangeList(wrapper, req.page()); | ||||
@@ -233,7 +233,7 @@ public class ProjectChangeManage { | |||||
ProjectStatus.ON_STOPPED_APPLY.getCode(), | ProjectStatus.ON_STOPPED_APPLY.getCode(), | ||||
ProjectStatus.ON_CHANGE_APPLY.getCode()); | ProjectStatus.ON_CHANGE_APPLY.getCode()); | ||||
UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); | UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); | ||||
if (!userDetail.getSuperAdmin()) { | |||||
if (!userDetail.hasSuperAdmin()) { | |||||
query.eq(Project::getBuildOrgCode, userDetail.getMhUnitIdStr()); | query.eq(Project::getBuildOrgCode, userDetail.getMhUnitIdStr()); | ||||
} | } | ||||
List<Project> projects = projectService.list(query); | List<Project> projects = projectService.list(query); | ||||
@@ -55,7 +55,7 @@ public class ProjectCollectionManage { | |||||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | UserInfoDetails user = LoginUserUtil.loginUserDetail(); | ||||
String buildOrgCode = req.getBuildOrgCode(); | String buildOrgCode = req.getBuildOrgCode(); | ||||
//如果是超管 可以看所有 | //如果是超管 可以看所有 | ||||
if (user.getSuperAdmin()) { | |||||
if (user.hasSuperAdmin()) { | |||||
buildOrgCode = null; | buildOrgCode = null; | ||||
} | } | ||||
@@ -140,7 +140,7 @@ public class ProjectStoppedManage { | |||||
.notIn(Project::getStatus, ProjectStatus.STOPPED_PASSED.getCode(), | .notIn(Project::getStatus, ProjectStatus.STOPPED_PASSED.getCode(), | ||||
ProjectStatus.ON_STOPPED_APPLY.getCode()); | ProjectStatus.ON_STOPPED_APPLY.getCode()); | ||||
UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); | UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); | ||||
if (!userDetail.getSuperAdmin()) { | |||||
if (!userDetail.hasSuperAdmin()) { | |||||
query.eq(Project::getBuildOrgCode, userDetail.getMhUnitIdStr()); | query.eq(Project::getBuildOrgCode, userDetail.getMhUnitIdStr()); | ||||
} | } | ||||
List<Project> projects = projectService.list(query); | List<Project> projects = projectService.list(query); | ||||
@@ -8,7 +8,6 @@ import com.baomidou.mybatisplus.core.toolkit.Assert; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
import com.hz.pm.api.common.model.constant.BizConst; | import com.hz.pm.api.common.model.constant.BizConst; | ||||
import com.hz.pm.api.common.model.constant.RegionConst; | |||||
import com.hz.pm.api.projectlib.model.entity.Project; | import com.hz.pm.api.projectlib.model.entity.Project; | ||||
import com.hz.pm.api.projectlib.model.entity.ProjectApplication; | import com.hz.pm.api.projectlib.model.entity.ProjectApplication; | ||||
import com.hz.pm.api.projectlib.model.req.ProjectListReq; | import com.hz.pm.api.projectlib.model.req.ProjectListReq; | ||||
@@ -87,9 +86,9 @@ public class SafetyRiskManage { | |||||
*/ | */ | ||||
private void checkAuth(LambdaQueryWrapper<Project> query, UserInfoDetails user) { | private void checkAuth(LambdaQueryWrapper<Project> query, UserInfoDetails user) { | ||||
//如果是超管 | //如果是超管 | ||||
if (user.getSuperAdmin() || user.getRegionAdmin()) { | |||||
if (user.hasSuperAdmin() || user.hasRegionAdmin()) { | |||||
log.info(user.getUsername() + " 是超管,可以看所有项目"); | log.info(user.getUsername() + " 是超管,可以看所有项目"); | ||||
} else if (user.getIsOrgAdmin()) { | |||||
} else if (user.hasOrgAdmin()) { | |||||
//单位管理员 | //单位管理员 | ||||
log.info(user.getUsername() + " 是单位管理员,可以看单位 " + user.getMhUnitId() + " 项目"); | log.info(user.getUsername() + " 是单位管理员,可以看单位 " + user.getMhUnitId() + " 项目"); | ||||
query.eq(Project::getBuildOrgCode, user.getMhUnitId()); | query.eq(Project::getBuildOrgCode, user.getMhUnitId()); | ||||
@@ -15,7 +15,6 @@ import com.hz.pm.api.organization.service.IDingEmployeeInfoService; | |||||
import com.hz.pm.api.organization.service.IDingOrganizationService; | import com.hz.pm.api.organization.service.IDingOrganizationService; | ||||
import com.hz.pm.api.projectlib.model.entity.Project; | import com.hz.pm.api.projectlib.model.entity.Project; | ||||
import com.hz.pm.api.staging.enums.MsgTypeEnum; | import com.hz.pm.api.staging.enums.MsgTypeEnum; | ||||
import com.hz.pm.api.staging.service.INdWorkNoticeStagingService; | |||||
import com.hz.pm.api.sys.enumeration.NoticePermissionsEnum; | import com.hz.pm.api.sys.enumeration.NoticePermissionsEnum; | ||||
import com.hz.pm.api.sys.enumeration.NoticeTypeEnum; | import com.hz.pm.api.sys.enumeration.NoticeTypeEnum; | ||||
import com.hz.pm.api.sys.model.entity.Notice; | import com.hz.pm.api.sys.model.entity.Notice; | ||||
@@ -318,10 +317,10 @@ public class NoticeManage { | |||||
notice.setPermissionsValue(user.getMhUnitIdStr()); | notice.setPermissionsValue(user.getMhUnitIdStr()); | ||||
return; | return; | ||||
} | } | ||||
if (user.getSuperAdmin()) { | |||||
if (user.hasSuperAdmin()) { | |||||
notice.setPermissions(NoticePermissionsEnum.SUPER.getCode()); | notice.setPermissions(NoticePermissionsEnum.SUPER.getCode()); | ||||
return; | return; | ||||
} else if (user.getIsOrgAdmin()) { | |||||
} else if (user.hasOrgAdmin()) { | |||||
notice.setPermissions(NoticePermissionsEnum.ORG.getCode()); | notice.setPermissions(NoticePermissionsEnum.ORG.getCode()); | ||||
notice.setPermissionsValue(user.getMhUnitIdStr()); | notice.setPermissionsValue(user.getMhUnitIdStr()); | ||||
return; | return; | ||||
@@ -20,9 +20,9 @@ public class EarlyWarningUtil { | |||||
public static void buildPermissionWrapper(LambdaQueryWrapper<WflowEarlyWarningRecords> wrapper, | public static void buildPermissionWrapper(LambdaQueryWrapper<WflowEarlyWarningRecords> wrapper, | ||||
UserInfoDetails user) { | UserInfoDetails user) { | ||||
//如果是超管的话 | //如果是超管的话 | ||||
if (user.getSuperAdmin() || user.getRegionAdmin()) { | |||||
if (user.hasSuperAdmin() || user.hasRegionAdmin()) { | |||||
// 可以看所有 | // 可以看所有 | ||||
} else if (user.getIsOrgAdmin()) { | |||||
} else if (user.hasOrgAdmin()) { | |||||
wrapper.eq(WflowEarlyWarningRecords::getBuildOrgCode, user.getMhUnitIdStr()); | wrapper.eq(WflowEarlyWarningRecords::getBuildOrgCode, user.getMhUnitIdStr()); | ||||
} else { | } else { | ||||
//否则都只能看自己单位的 | //否则都只能看自己单位的 | ||||
@@ -131,15 +131,15 @@ public class UserInfoDetails extends AbstractLoginUser implements UserDetails { | |||||
return null; | return null; | ||||
} | } | ||||
public boolean getIsOrgAdmin() { | |||||
public boolean hasOrgAdmin() { | |||||
return containsRole(RoleEnum.COMPANY_MANAGER); | return containsRole(RoleEnum.COMPANY_MANAGER); | ||||
} | } | ||||
public boolean getSuperAdmin() { | |||||
public boolean hasSuperAdmin() { | |||||
return containsRole(RoleEnum.SUPER_ADMIN); | return containsRole(RoleEnum.SUPER_ADMIN); | ||||
} | } | ||||
public boolean getRegionAdmin() { | |||||
public boolean hasRegionAdmin() { | |||||
return containsRole(RoleEnum.REGION_MANAGER); | return containsRole(RoleEnum.REGION_MANAGER); | ||||
} | } | ||||