|
|
@@ -11,7 +11,9 @@ 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.statemachine.event.ProjectStatusChangeEvent; |
|
|
|
import com.ningdatech.pmapi.common.util.ExcelDownUtil; |
|
|
|
import com.ningdatech.pmapi.common.util.StrUtils; |
|
|
|
import com.ningdatech.pmapi.datascope.model.DataScopeDTO; |
|
|
|
import com.ningdatech.pmapi.datascope.utils.DataScopeUtil; |
|
|
|
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; |
|
|
@@ -20,15 +22,16 @@ import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; |
|
|
|
import com.ningdatech.pmapi.projectlib.model.entity.Project; |
|
|
|
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; |
|
|
|
import com.ningdatech.pmapi.projectlib.model.entity.ProjectRenewalFundDeclaration; |
|
|
|
import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; |
|
|
|
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; |
|
|
|
import com.ningdatech.pmapi.projectlib.model.vo.AnnualAmountVO; |
|
|
|
import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO; |
|
|
|
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; |
|
|
|
import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; |
|
|
|
import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService; |
|
|
|
import com.ningdatech.pmapi.projectlib.service.IProjectRenewalFundDeclarationService; |
|
|
|
import com.ningdatech.pmapi.projectlib.service.IProjectService; |
|
|
|
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; |
|
|
|
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; |
|
|
|
import com.ningdatech.pmapi.user.util.LoginUserUtil; |
|
|
|
import com.wflow.workflow.bean.vo.ProcessDetailVO; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
@@ -57,7 +60,7 @@ public class ProjectLibManage { |
|
|
|
private final IProjectApplicationService applicationService; |
|
|
|
private final IProjectRenewalFundDeclarationService renewalFundDeclarationService; |
|
|
|
private final ProcessExecuteChainHandle processExecuteHandle; |
|
|
|
|
|
|
|
private final INdProjectStatusChangeService projectStatusChangeService; |
|
|
|
private final RegionCacheHelper regionCacheHelper; |
|
|
|
|
|
|
|
private final UserInfoHelper userInfoHelper; |
|
|
@@ -112,10 +115,10 @@ public class ProjectLibManage { |
|
|
|
item.setProcessStatus(w.getProcessStatus()); |
|
|
|
item.setInstCode(w.getInstCode()); |
|
|
|
item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); |
|
|
|
if(user.getIsOrgAdmin() && |
|
|
|
if (user.getIsOrgAdmin() && |
|
|
|
ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) |
|
|
|
&& StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(user.getOrganizationCode()) |
|
|
|
&& w.getSuperOrgCode().equals(user.getOrganizationCode())){ |
|
|
|
&& w.getSuperOrgCode().equals(user.getOrganizationCode())) { |
|
|
|
item.setCanPreDeclared(Boolean.TRUE); |
|
|
|
} |
|
|
|
return item; |
|
|
@@ -173,6 +176,10 @@ public class ProjectLibManage { |
|
|
|
); |
|
|
|
vo.setAnnualAccumulateAmountList(annualAmounts); |
|
|
|
} |
|
|
|
if (StrUtils.isNotBlank(vo.getApprovedConstructionPlanFile())) { |
|
|
|
ProjectStatusChange approved = projectStatusChangeService.getByProjectStatus(ProjectStatusChangeEvent.PROJECT_APPROVAL, projectId); |
|
|
|
vo.setApprovedTime(approved.getCreateOn()); |
|
|
|
} |
|
|
|
return vo; |
|
|
|
} |
|
|
|
|
|
|
@@ -209,39 +216,40 @@ public class ProjectLibManage { |
|
|
|
|
|
|
|
/** |
|
|
|
* build 项目的角色权限到req |
|
|
|
* |
|
|
|
* @param query |
|
|
|
*/ |
|
|
|
public UserFullInfoDTO buildProjectLibPermission(LambdaQueryWrapper<Project> query){ |
|
|
|
public UserFullInfoDTO buildProjectLibPermission(LambdaQueryWrapper<Project> query) { |
|
|
|
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); |
|
|
|
Optional<DataScopeDTO> currentUserDataScope = DataScopeUtil.getCurrentUserDataScope(user); |
|
|
|
if(!currentUserDataScope.isPresent()){ |
|
|
|
if (!currentUserDataScope.isPresent()) { |
|
|
|
log.warn("没有取到权限信息 当前查询 没有权限条件"); |
|
|
|
return user; |
|
|
|
} |
|
|
|
|
|
|
|
switch (currentUserDataScope.get().getRole()){ |
|
|
|
switch (currentUserDataScope.get().getRole()) { |
|
|
|
case NORMAL_MEMBER: |
|
|
|
//普通用户 只能看到自己单位去申报的 |
|
|
|
query.eq(Project::getBuildOrgCode ,user.getOrganizationCode()); |
|
|
|
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()))); |
|
|
|
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; |
|
|
|
case SUPER_ADMIN: |
|
|
|
//超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员 |
|
|
|
break; |
|
|
|
case REGION_MANAGER: |
|
|
|
//区域管理员 看到自己区域的项目 如果是市本级 就看全市的 |
|
|
|
if(RegionConst.RC_LS.equals(user.getRegionCode())){ |
|
|
|
Collection <String> regionCodes = regionCacheHelper.listChildRegionCodeList(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()); |
|
|
|
query.in(Project::getAreaCode, regionCodes); |
|
|
|
} else { |
|
|
|
query.eq(Project::getAreaCode, user.getRegionCode()); |
|
|
|
} |
|
|
|
break; |
|
|
|
case VISITOR: |
|
|
@@ -251,7 +259,7 @@ public class ProjectLibManage { |
|
|
|
break; |
|
|
|
default: |
|
|
|
//没有权限的话 就让它查不到 |
|
|
|
query.eq(Project::getId,0L); |
|
|
|
query.eq(Project::getId, 0L); |
|
|
|
break; |
|
|
|
} |
|
|
|
return user; |
|
|
|