@@ -1,6 +1,6 @@ | |||
package com.hz.pm.api.projectdeclared.controller; | |||
import com.hz.pm.api.expert.model.vo.ProjectReviewDetailVO; | |||
import com.hz.pm.api.meeting.entity.dto.ProjectReviewResultDTO; | |||
import com.hz.pm.api.projectdeclared.manage.ProjectReviewManage; | |||
import com.hz.pm.api.projectdeclared.model.req.ProjectReviewApplyReq; | |||
import com.hz.pm.api.projectlib.model.req.ProjectListReq; | |||
@@ -35,7 +35,7 @@ public class ProjectReviewController { | |||
@ApiOperation("项目评审详情") | |||
@GetMapping("/detail/{projectId}") | |||
public ProjectReviewDetailVO projectReviewDetail(@PathVariable Long projectId) { | |||
public ProjectReviewResultDTO projectReviewDetail(@PathVariable Long projectId) { | |||
return projectReviewManage.projectReviewDetail(projectId); | |||
} | |||
@@ -10,7 +10,7 @@ import com.hz.pm.api.common.model.constant.BizConst; | |||
import com.hz.pm.api.common.statemachine.util.ProjectStateMachineUtil; | |||
import com.hz.pm.api.datascope.model.DataScopeDTO; | |||
import com.hz.pm.api.datascope.utils.DataScopeUtil; | |||
import com.hz.pm.api.expert.model.vo.ProjectReviewDetailVO; | |||
import com.hz.pm.api.meeting.entity.dto.ProjectReviewResultDTO; | |||
import com.hz.pm.api.projectdeclared.model.entity.ProjectReview; | |||
import com.hz.pm.api.projectdeclared.model.req.ProjectReviewApplyReq; | |||
import com.hz.pm.api.projectdeclared.service.IProjectReviewService; | |||
@@ -39,7 +39,10 @@ import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.stereotype.Component; | |||
import org.springframework.transaction.annotation.Transactional; | |||
import java.util.*; | |||
import java.util.Collections; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.Optional; | |||
/** | |||
* <p> | |||
@@ -105,13 +108,13 @@ public class ProjectReviewManage { | |||
log.info("项目评审提交成功 【{}】", instanceId); | |||
} | |||
public ProjectReviewDetailVO projectReviewDetail(Long projectId) { | |||
public ProjectReviewResultDTO projectReviewDetail(Long projectId) { | |||
ProjectReview projReview = projectReviewService.getOne(Wrappers | |||
.lambdaQuery(ProjectReview.class) | |||
.eq(ProjectReview::getProjectId, projectId) | |||
.orderByDesc(ProjectReview::getId) | |||
.last(BizConst.LIMIT_1)); | |||
return BeanUtil.copyProperties(projReview, ProjectReviewDetailVO.class); | |||
return BeanUtil.copyProperties(projReview, ProjectReviewResultDTO.class); | |||
} | |||
/** | |||
@@ -127,7 +130,7 @@ public class ProjectReviewManage { | |||
return PageVo.empty(); | |||
} | |||
ProjectManageUtil.projectQuery(query, req); | |||
query.in(Project::getProcessStatus, | |||
query.in(Project::getStatus, | |||
ProjectStatus.WITHOUT_PROJECT_REVIEW.getCode(), | |||
ProjectStatus.ON_PROJECT_REVIEW.getCode(), | |||
ProjectStatus.PROJECT_REVIEW_FAILED.getCode()) | |||
@@ -1,12 +1,15 @@ | |||
package com.hz.pm.api.projectlib.manage; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import com.baomidou.mybatisplus.core.conditions.Wrapper; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.hz.pm.api.common.enumeration.CommonEnum; | |||
import com.hz.pm.api.common.helper.UserInfoHelper; | |||
import com.hz.pm.api.common.model.constant.CommonConst; | |||
import com.hz.pm.api.common.model.entity.ExcelExportWriter; | |||
import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent; | |||
import com.hz.pm.api.common.statemachine.util.ProjectStateMachineUtil; | |||
import com.hz.pm.api.common.util.BizUtils; | |||
import com.hz.pm.api.common.util.ExcelDownUtil; | |||
@@ -15,6 +18,7 @@ import com.hz.pm.api.datascope.utils.DataScopeUtil; | |||
import com.hz.pm.api.projectlib.helper.ProjectManageUtil; | |||
import com.hz.pm.api.projectlib.model.dto.ProjectDTO; | |||
import com.hz.pm.api.projectlib.model.entity.Project; | |||
import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; | |||
import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus; | |||
import com.hz.pm.api.projectlib.model.req.ProjectApprovedReq; | |||
import com.hz.pm.api.projectlib.model.req.ProjectIdReq; | |||
@@ -23,6 +27,7 @@ import com.hz.pm.api.projectlib.model.req.StartProjectDeclareReq; | |||
import com.hz.pm.api.projectlib.model.vo.AnnualPlanListItemVO; | |||
import com.hz.pm.api.projectlib.service.IProjectApplicationService; | |||
import com.hz.pm.api.projectlib.service.IProjectService; | |||
import com.hz.pm.api.projectlib.service.IProjectStatusChangeService; | |||
import com.hz.pm.api.todocenter.constant.TodoCenterConst; | |||
import com.hz.pm.api.user.helper.MhUnitCache; | |||
import com.hz.pm.api.user.security.model.UserFullInfoDTO; | |||
@@ -37,9 +42,12 @@ import org.springframework.transaction.annotation.Transactional; | |||
import javax.servlet.http.HttpServletResponse; | |||
import java.time.LocalDateTime; | |||
import java.util.*; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import java.util.Objects; | |||
import java.util.Optional; | |||
import static com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus.*; | |||
import static com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus.ON_ANNUAL_PLAN; | |||
/** | |||
* <p> | |||
@@ -59,35 +67,33 @@ public class AnnualPlanLibManage { | |||
private final IProjectApplicationService applicationService; | |||
private final ProjectStateMachineUtil stateMachine; | |||
private final UserInfoHelper userInfoHelper; | |||
/** | |||
* 年度计划查询状态 | |||
*/ | |||
private static final List<ProjectStatus> ANNUAL_PLAN_LIST_STATUS = | |||
Arrays.asList(ON_ANNUAL_PLAN, TO_BE_DECLARED, | |||
PROJECT_APPROVED, TO_BE_PURCHASED, ON_PILOT_RUNNING, ARCHIVED); | |||
private final IProjectStatusChangeService projectStatusChangeService; | |||
public PageVo<AnnualPlanListItemVO> annulPlanLibList(ProjectListReq req) { | |||
LambdaQueryWrapper<Project> query = ProjectManageUtil.projectQuery(req); | |||
Integer isTemporaryAugment = req.getIsTemporaryAugment(); | |||
if (Objects.isNull(isTemporaryAugment)) { | |||
throw new BizException("请传入是否临时增补标志!"); | |||
} | |||
query.eq(Project::getIsTemporaryAugment, isTemporaryAugment); | |||
query.eq(Project::getNewest, Boolean.TRUE); | |||
query.orderByDesc(Project::getAnnualPlanAddTime); | |||
query.in(Project::getStatus, CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatus::getCode)); | |||
// 数据权限 | |||
if (!buildProjectLibPermission(query)) { | |||
LambdaQueryWrapper<Project> query = ProjectManageUtil.initQuery(); | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
if (!projectQueryPermission(query, user)) { | |||
return PageVo.empty(); | |||
} | |||
ProjectManageUtil.projectQuery(query, req); | |||
query.eq(Project::getNewest, Boolean.TRUE); | |||
query.and(q1 -> q1.in(Project::getStatus, ON_ANNUAL_PLAN.getCode()) | |||
.or(q2 -> q2.exists("select 1 from nd_project_status_change npsc" + | |||
" where npsc.project_code = nd_project.project_code and event = {0}", | |||
ProjectStateChangeEvent.ANNUAL_PLAN_PASS))); | |||
Page<Project> page = projectService.page(req.page(), query); | |||
long total; | |||
if ((total = page.getTotal()) == 0) { | |||
long total = page.getTotal(); | |||
if (total == 0) { | |||
return PageVo.empty(); | |||
} | |||
PageVo<AnnualPlanListItemVO> result = PageVo.of(new ArrayList<>(), total); | |||
page.getRecords().forEach(w -> { | |||
List<String> projCodes = CollUtils.fieldList(page.getRecords(), Project::getProjectCode); | |||
Wrapper<ProjectStatusChange> pscQuery = Wrappers.lambdaQuery(ProjectStatusChange.class) | |||
.select(ProjectStatusChange::getProjectCode) | |||
.eq(ProjectStatusChange::getEvent, ProjectStateChangeEvent.ANNUAL_PLAN_PASS) | |||
.in(ProjectStatusChange::getProjectCode, projCodes); | |||
List<ProjectStatusChange> changes = projectStatusChangeService.list(pscQuery); | |||
List<String> annualPlanProjCodes = CollUtils.fieldList(changes, ProjectStatusChange::getProjectCode); | |||
List<AnnualPlanListItemVO> records = CollUtils.convert(page.getRecords(), w -> { | |||
AnnualPlanListItemVO item = new AnnualPlanListItemVO(); | |||
item.setProjectId(w.getId()); | |||
item.setProjectId(w.getId()); | |||
@@ -100,27 +106,21 @@ public class AnnualPlanLibManage { | |||
item.setBuildOrg(w.getBuildOrgName()); | |||
item.setCreateOn(w.getCreateOn()); | |||
item.setApprovalAmount(w.getApprovalAmount()); | |||
item.setIsStartDeclaredProject(!ON_ANNUAL_PLAN.eq(w.getStatus())); | |||
result.getRecords().add(item); | |||
item.setIsStartDeclaredProject(annualPlanProjCodes.contains(w.getProjectCode())); | |||
return item; | |||
}); | |||
return result; | |||
return PageVo.of(records, total); | |||
} | |||
@Transactional(rollbackFor = Exception.class) | |||
public void startProjectDeclared(StartProjectDeclareReq req) { | |||
public synchronized void startProjectDeclared(StartProjectDeclareReq req) { | |||
List<Project> projects = projectService.listByIds(req.getProjectIds()); | |||
projects.forEach(w -> { | |||
if (!ON_ANNUAL_PLAN.eq(w.getStatus())) { | |||
throw BizException.wrap("开启方案申报失败"); | |||
} | |||
}); | |||
projects.forEach(project -> { | |||
try { | |||
stateMachine.pass(project); | |||
} catch (Exception e) { | |||
throw new BizException("开启方案申报失败"); | |||
} | |||
}); | |||
projects.forEach(stateMachine::pass); | |||
projectService.updateBatchById(projects); | |||
} | |||
@@ -184,7 +184,6 @@ public class AnnualPlanLibManage { | |||
throw new BizException("请传入是否临时增补标志!"); | |||
} | |||
param.setIsTemporaryAugment(isTemporaryAugment); | |||
param.setStatusList(CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatus::getCode)); | |||
LambdaQueryWrapper<Project> query = ProjectManageUtil.projectQuery(param); | |||
query.eq(Project::getNewest, Boolean.TRUE); | |||
query.orderByDesc(Project::getAnnualPlanAddTime); | |||
@@ -218,36 +217,41 @@ public class AnnualPlanLibManage { | |||
* | |||
* @param query \ | |||
*/ | |||
public boolean buildProjectLibPermission(LambdaQueryWrapper<Project> query) { | |||
boolean queryState = Boolean.TRUE; | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
Optional<DataScopeDTO> currentUserDataScope = DataScopeUtil.getCurrentUserDataScope(user); | |||
if (!currentUserDataScope.isPresent()) { | |||
private boolean projectQueryPermission(LambdaQueryWrapper<Project> query, UserFullInfoDTO user) { | |||
boolean queryState = true; | |||
Optional<DataScopeDTO> currDs = DataScopeUtil.getCurrentUserDataScopeHasUserId(user); | |||
if (!currDs.isPresent()) { | |||
log.warn("没有取到权限信息 当前查询 没有权限条件"); | |||
queryState = Boolean.FALSE; | |||
queryState = false; | |||
} else { | |||
switch (currentUserDataScope.get().getRole()) { | |||
switch (currDs.get().getRole()) { | |||
case NORMAL_MEMBER: | |||
// 普通用户 只能看到自己单位去申报的 | |||
//普通用户 只能看到自己单位去申报的 | |||
query.eq(Project::getBuildOrgCode, user.getMhUnitIdStr()); | |||
break; | |||
case COMPANY_MANAGER: | |||
// 单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 | |||
List<Long> childUnitIds = mhUnitCache.getViewChildIdsRecursion(user.getMhUnitId()); | |||
List<String> viewUnitIdList = CollUtils.convert(childUnitIds, String::valueOf); | |||
query.in(Project::getBuildOrgCode, viewUnitIdList); | |||
//单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 | |||
query.and(q1 -> q1.in(Project::getBuildOrgCode, viewUnitIdList) | |||
.or(q2 -> q2.eq(Project::getStage, ProjectStatus.NOT_APPROVED.getCode()) | |||
.in(Project::getSuperOrgCode, viewUnitIdList))); | |||
break; | |||
case SUPER_ADMIN: | |||
// 超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员 | |||
//超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员 | |||
break; | |||
case VISITOR: | |||
//访客可以看全市的 | |||
break; | |||
case DASHBOARD: | |||
break; | |||
default: | |||
// 没有权限的话 就让它查不到 | |||
queryState = Boolean.FALSE; | |||
//没有权限的话 就让它查不到 | |||
queryState = false; | |||
break; | |||
} | |||
} | |||
return queryState; | |||
} | |||
} |
@@ -31,6 +31,7 @@ import com.hz.pm.api.expert.model.vo.ProjectReviewDetailVO; | |||
import com.hz.pm.api.expert.service.IExpertReviewService; | |||
import com.hz.pm.api.filemanage.model.entity.ProjectApplyBorrow; | |||
import com.hz.pm.api.filemanage.service.INdProjectApplyBorrowService; | |||
import com.hz.pm.api.meeting.entity.dto.ProjectReviewResultDTO; | |||
import com.hz.pm.api.performance.model.dto.ProjectCoreBusinessDTO; | |||
import com.hz.pm.api.performance.model.entity.ProjectCoreBusinessIndicators; | |||
import com.hz.pm.api.performance.service.IProjectCoreBusinessIndicatorsService; | |||
@@ -778,7 +779,7 @@ public class ProjectLibManage { | |||
} | |||
// 评审详情 | |||
ProjectReviewDetailVO projectReviewDetail = projectReviewManage.projectReviewDetail(project.getId()); | |||
ProjectReviewResultDTO projectReviewDetail = projectReviewManage.projectReviewDetail(project.getId()); | |||
retProjectDetail.setReviewDetail(projectReviewDetail); | |||
return retProjectDetail; | |||
@@ -164,6 +164,17 @@ public class ProjectDTO { | |||
@ApiModelProperty("其它资金(万元)") | |||
private BigDecimal declareOtherAmount; | |||
@ApiModelProperty("申报资金-分配情况-软件开发(万元)") | |||
private BigDecimal declareSoftwareDevelopmentAmount; | |||
@ApiModelProperty("申报资金-分配情况-云资源、硬件购置(万元)") | |||
private BigDecimal declareCloudHardwarePurchaseAmount; | |||
@ApiModelProperty("申报资金-分配情况-第三方服务(万元)") | |||
private BigDecimal declareThirdPartyAmount; | |||
//================================================================================================================== | |||
@ApiModelProperty("资金分配情况-软件开发(万元)") | |||
private BigDecimal softwareDevelopmentAmount; | |||
@@ -189,24 +189,35 @@ public class Project implements Serializable { | |||
@Compare("资金申报情况-政府投资-上级补助资金") | |||
private BigDecimal declareGovSuperiorFinanceAmount; | |||
@ApiModelProperty("银行贷款(万元)") | |||
@ApiModelProperty("申报资金-银行贷款(万元)") | |||
@Compare("银行贷款") | |||
private BigDecimal declareBankLendingAmount; | |||
@ApiModelProperty("其它资金(万元)") | |||
@ApiModelProperty("申报资金-其它资金(万元)") | |||
@Compare("其它资金") | |||
private BigDecimal declareOtherAmount; | |||
@ApiModelProperty("资金分配情况-软件开发(万元)") | |||
@Compare("资金分配情况-软件开发") | |||
@ApiModelProperty("申报资金-分配情况-软件开发(万元)") | |||
private BigDecimal declareSoftwareDevelopmentAmount; | |||
@ApiModelProperty("申报资金-分配情况-云资源、硬件购置(万元)") | |||
private BigDecimal declareCloudHardwarePurchaseAmount; | |||
@ApiModelProperty("申报资金-分配情况-第三方服务(万元)") | |||
private BigDecimal declareThirdPartyAmount; | |||
//================================================================================================================== | |||
@ApiModelProperty("批复-软件开发(万元)") | |||
@Compare("批复-软件开发") | |||
private BigDecimal softwareDevelopmentAmount; | |||
@ApiModelProperty("资金分配情况-云资源、硬件购置(万元)") | |||
@Compare("资金分配情况-云资源、硬件购置") | |||
@ApiModelProperty("批复-云资源、硬件购置(万元)") | |||
@Compare("批复-云资源、硬件购置") | |||
private BigDecimal cloudHardwarePurchaseAmount; | |||
@ApiModelProperty("资金分配情况-第三方服务(万元)") | |||
@Compare("资金分配情况-第三方服务") | |||
@ApiModelProperty("批复-第三方服务(万元)") | |||
@Compare("批复-第三方服务") | |||
private BigDecimal thirdPartyAmount; | |||
@ApiModelProperty("评审金额") | |||
@@ -6,6 +6,7 @@ import com.alibaba.fastjson.annotation.JSONField; | |||
import com.hz.pm.api.common.compare.Compare; | |||
import com.hz.pm.api.dashboard.model.vo.PortraitProjectOutputVO; | |||
import com.hz.pm.api.expert.model.vo.ProjectReviewDetailVO; | |||
import com.hz.pm.api.meeting.entity.dto.ProjectReviewResultDTO; | |||
import com.hz.pm.api.portrait.model.vo.TagVO; | |||
import com.hz.pm.api.projectdeclared.model.vo.PurchaseFullInfoVO; | |||
import com.hz.pm.api.projectlib.model.dto.GovSystemReplaceInfoDTO; | |||
@@ -179,6 +180,17 @@ public class ProjectDetailVO { | |||
@ApiModelProperty("其它资金(万元)") | |||
private BigDecimal declareOtherAmount; | |||
@ApiModelProperty("申报资金-分配情况-软件开发(万元)") | |||
private BigDecimal declareSoftwareDevelopmentAmount; | |||
@ApiModelProperty("申报资金-分配情况-云资源、硬件购置(万元)") | |||
private BigDecimal declareCloudHardwarePurchaseAmount; | |||
@ApiModelProperty("申报资金-分配情况-第三方服务(万元)") | |||
private BigDecimal declareThirdPartyAmount; | |||
//================================================================================================================== | |||
@ApiModelProperty("资金分配情况-软件开发(万元)") | |||
private BigDecimal softwareDevelopmentAmount; | |||
@@ -401,7 +413,7 @@ public class ProjectDetailVO { | |||
private List<PurchaseFullInfoVO> purchaseDetails; | |||
@ApiModelProperty("项目评审详情") | |||
private ProjectReviewDetailVO reviewDetail; | |||
private ProjectReviewResultDTO reviewDetail; | |||
@ApiModelProperty("版本号str") | |||
private String versionStr; | |||
@@ -6,9 +6,12 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
import com.hz.pm.api.common.model.constant.BizConst; | |||
import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent; | |||
import com.hz.pm.api.common.util.BizUtils; | |||
import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; | |||
import java.util.Collection; | |||
import java.util.Comparator; | |||
import java.util.Map; | |||
/** | |||
* <p> | |||
@@ -56,4 +59,14 @@ public interface IProjectStatusChangeService extends IService<ProjectStatusChang | |||
return getOne(pscQuery); | |||
} | |||
default Map<ProjectStateChangeEvent, ProjectStatusChange> listLastEventMap(String projectCode) { | |||
Wrapper<ProjectStatusChange> query = Wrappers.lambdaQuery(ProjectStatusChange.class) | |||
.eq(ProjectStatusChange::getProjectCode, projectCode) | |||
.orderByDesc(ProjectStatusChange::getCreateOn) | |||
.last(BizConst.LIMIT_1); | |||
return BizUtils.groupFirstMap(list(query), | |||
w -> ProjectStateChangeEvent.valueOf(w.getEvent()), | |||
Comparator.comparing(ProjectStatusChange::getCreateOn).reversed()); | |||
} | |||
} |