@@ -231,9 +231,6 @@ public class PrequalificationDeclaredProjectManage { | |||
public PageVo<ProjectLibListItemVO> pageInfo(PrequalificationDeclaredListReq preReq) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); | |||
if(!user.getIsOrgAdmin()){ | |||
return PageVo.empty(); | |||
} | |||
//限定参数 复制bean | |||
ProjectListReq req = new ProjectListReq(); | |||
BeanUtils.copyProperties(preReq,req); | |||
@@ -278,33 +275,14 @@ public class PrequalificationDeclaredProjectManage { | |||
* @param query | |||
*/ | |||
public UserFullInfoDTO buildPermission(LambdaQueryWrapper<Project> query,UserFullInfoDTO user){ | |||
Optional<DataScopeDTO> currentUserDataScope = DataScopeUtil.getCurrentUserDataScope(user); | |||
if(!currentUserDataScope.isPresent()){ | |||
log.warn("没有取到权限信息 当前查询 没有权限条件"); | |||
return user; | |||
} | |||
switch (currentUserDataScope.get().getRole()){ | |||
//其它角色 只看自己单位 | |||
case SUPER_ADMIN: | |||
case REGION_MANAGER: | |||
case VISITOR: | |||
case DASHBOARD: | |||
case NORMAL_MEMBER: | |||
//普通用户 只能看到自己单位去申报的 | |||
query.eq(Project::getBuildOrgCode ,user.getOrganizationCode()); | |||
break; | |||
//单位管理角色看 自己单位申报 + 需要本单位来申报的 | |||
case COMPANY_MANAGER: | |||
//单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 | |||
query.and(q1 -> q1.eq(Project::getBuildOrgCode ,user.getOrganizationCode()).or(q2 -> | |||
q2.eq(Project::getStage,ProjectStatusEnum.NOT_APPROVED.getCode()) | |||
.eq(Project::getStatus,ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()) | |||
.eq(Project::getSuperOrgCode,user.getOrganizationCode()))); | |||
break; | |||
default: | |||
//没有权限的话 就让它查不到 | |||
query.eq(Project::getId,0L); | |||
break; | |||
if(user.getIsOrgAdmin()){ | |||
//单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 | |||
query.and(q1 -> q1.eq(Project::getBuildOrgCode ,user.getOrganizationCode()).or(q2 -> | |||
q2.eq(Project::getStage,ProjectStatusEnum.NOT_APPROVED.getCode()) | |||
.eq(Project::getStatus,ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()) | |||
.eq(Project::getSuperOrgCode,user.getOrganizationCode()))); | |||
}else{ | |||
query.eq(Project::getBuildOrgCode ,user.getOrganizationCode()); | |||
} | |||
return user; | |||
} | |||
@@ -7,6 +7,8 @@ import com.google.common.collect.Lists; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.basic.util.CollUtils; | |||
import com.ningdatech.pmapi.common.constant.CommonConst; | |||
import com.ningdatech.pmapi.common.constant.RegionConst; | |||
import com.ningdatech.pmapi.common.helper.RegionCacheHelper; | |||
import com.ningdatech.pmapi.common.helper.UserInfoHelper; | |||
import com.ningdatech.pmapi.common.model.entity.ExcelExportWriter; | |||
import com.ningdatech.pmapi.common.util.ExcelDownUtil; | |||
@@ -36,10 +38,7 @@ import org.springframework.beans.BeanUtils; | |||
import org.springframework.stereotype.Component; | |||
import javax.servlet.http.HttpServletResponse; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import java.util.Objects; | |||
import java.util.Optional; | |||
import java.util.*; | |||
/** | |||
* <p> | |||
@@ -59,6 +58,8 @@ public class ProjectLibManage { | |||
private final IProjectRenewalFundDeclarationService renewalFundDeclarationService; | |||
private final ProcessExecuteChainHandle processExecuteHandle; | |||
private final RegionCacheHelper regionCacheHelper; | |||
private final UserInfoHelper userInfoHelper; | |||
public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) { | |||
@@ -234,8 +235,14 @@ public class ProjectLibManage { | |||
//超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员 | |||
break; | |||
case REGION_MANAGER: | |||
//区域管理员 看到自己区域的项目 | |||
query.eq(Project::getAreaCode,user.getRegionCode()); | |||
//区域管理员 看到自己区域的项目 如果是市本级 就看全市的 | |||
if(RegionConst.RC_LS.equals(user.getRegionCode())){ | |||
Collection <String> regionCodes = regionCacheHelper.listChildRegionCodeList(user.getRegionCode(), | |||
RegionConst.RL_CITY); | |||
query.in(Project::getAreaCode,regionCodes); | |||
}else{ | |||
query.eq(Project::getAreaCode,user.getRegionCode()); | |||
} | |||
break; | |||
case VISITOR: | |||
//访客可以看全市的 | |||
@@ -5,6 +5,7 @@ import com.ningdatech.pmapi.AppTests; | |||
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||
import org.junit.jupiter.api.Test; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
@@ -21,13 +22,14 @@ public class StateMachineTest extends AppTests { | |||
@Autowired | |||
private StateMachineUtils stateMachineUtils; | |||
@Autowired | |||
private IProjectService projectService; | |||
@Test | |||
public void stateMachineTest() { | |||
Project project = new Project(); | |||
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); | |||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); | |||
project.setDeclareAmount(BigDecimal.valueOf(2000)); | |||
stateMachineUtils.withDraw(project); | |||
Project project = projectService.getById(292); | |||
stateMachineUtils.pass(project); | |||
System.out.println(String.format("project:%s", JSON.toJSONString(project))); | |||
projectService.updateById(project); | |||
} | |||
} |