diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java index 9026916..ab7cb14 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java @@ -29,6 +29,7 @@ import com.ningdatech.pmapi.projectlib.model.req.ProjectIdReq; import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; import com.ningdatech.pmapi.projectlib.model.req.StartProjectDeclareReq; import com.ningdatech.pmapi.projectlib.model.vo.AnnualPlanListItemVO; +import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; import com.ningdatech.pmapi.projectlib.service.IProjectService; import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; import com.ningdatech.pmapi.user.util.LoginUserUtil; @@ -60,7 +61,7 @@ public class AnnualPlanLibManage { private final IProjectService projectService; private final StateMachineUtils stateMachine; - + private final INdProjectStatusChangeService statusChangeService; private final UserInfoHelper userInfoHelper; /** diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java index db00266..ae09bc6 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java @@ -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 query){ + public UserFullInfoDTO buildProjectLibPermission(LambdaQueryWrapper query) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); Optional 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 regionCodes = regionCacheHelper.listChildRegionCodeList(user.getRegionCode(), + if (RegionConst.RC_LS.equals(user.getRegionCode())) { + Collection 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; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java index 4d94636..b852ba8 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java @@ -250,9 +250,15 @@ public class ProjectDetailVO { @ApiModelProperty("建设方案文件") private String constructionPlanFile; + @ApiModelProperty("立项批复建设方案文件") + private String approvedConstructionPlanFile; + @ApiModelProperty("立项批复文件") private String approvedFile; + @ApiModelProperty("立项批复时间") + private LocalDateTime approvedTime; + @ApiModelProperty("批复金额") private BigDecimal approvedTotalInvestmentIncrease; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/INdProjectStatusChangeService.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/INdProjectStatusChangeService.java index ebe223f..9732a35 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/INdProjectStatusChangeService.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/INdProjectStatusChangeService.java @@ -1,11 +1,12 @@ package com.ningdatech.pmapi.projectlib.service; +import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; import com.baomidou.mybatisplus.extension.service.IService; /** *

- * 服务类 + * 服务类 *

* * @author CMM @@ -13,4 +14,6 @@ import com.baomidou.mybatisplus.extension.service.IService; */ public interface INdProjectStatusChangeService extends IService { + ProjectStatusChange getByProjectStatus(ProjectStatusChangeEvent event, Long projectId); + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/NdProjectStatusChangeServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/NdProjectStatusChangeServiceImpl.java index f052b8c..1923018 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/NdProjectStatusChangeServiceImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/NdProjectStatusChangeServiceImpl.java @@ -1,5 +1,9 @@ package com.ningdatech.pmapi.projectlib.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.pmapi.common.constant.BizConst; +import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; import com.ningdatech.pmapi.projectlib.mapper.NdProjectStatusChangeMapper; import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; @@ -8,7 +12,7 @@ import org.springframework.stereotype.Service; /** *

- * 服务实现类 + * 服务实现类 *

* * @author CMM @@ -17,4 +21,14 @@ import org.springframework.stereotype.Service; @Service public class NdProjectStatusChangeServiceImpl extends ServiceImpl implements INdProjectStatusChangeService { + @Override + public ProjectStatusChange getByProjectStatus(ProjectStatusChangeEvent event, Long projectId) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(ProjectStatusChange.class) + .eq(ProjectStatusChange::getEvent, event) + .eq(ProjectStatusChange::getProjectId, projectId) + .orderByDesc(ProjectStatusChange::getCreateOn) + .last(BizConst.LIMIT_1); + return getOne(query); + } + }