|
|
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Assert; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.hz.pm.api.common.helper.UserInfoHelper; |
|
|
|
import com.hz.pm.api.common.model.constant.BizConst; |
|
|
|
import com.hz.pm.api.common.model.entity.KeyValDTO; |
|
|
@@ -38,6 +39,7 @@ import com.hz.pm.api.user.helper.MhUnitCache; |
|
|
|
import com.hz.pm.api.user.security.model.UserFullInfoDTO; |
|
|
|
import com.hz.pm.api.user.util.LoginUserUtil; |
|
|
|
import com.hz.pm.api.workbench.converter.WorkbenchConverter; |
|
|
|
import com.hz.pm.api.workbench.model.WorkbenchProjectLibReq; |
|
|
|
import com.hz.pm.api.workbench.model.WorkbenchReq; |
|
|
|
import com.hz.pm.api.workbench.model.vo.ProjectProcessStageStatisticsVO; |
|
|
|
import com.hz.pm.api.workbench.model.vo.ProjectTotalViewVO; |
|
|
@@ -303,4 +305,99 @@ public class WorkbenchManage { |
|
|
|
return retData; |
|
|
|
} |
|
|
|
|
|
|
|
public PageVo<ProjectLibListItemVO> pageProjectLib(WorkbenchProjectLibReq req) { |
|
|
|
Assert.notNull(req.getProcessNode(), "节点不能为空"); |
|
|
|
Long unitId; |
|
|
|
if (req.getUnitId() != null) { |
|
|
|
unitId = req.getUnitId(); |
|
|
|
} else { |
|
|
|
unitId = LoginUserUtil.loginUserDetail().getMhUnitId(); |
|
|
|
} |
|
|
|
List<Long> viewUnitIds = mhUnitCache.getViewChildIdsRecursion(unitId); |
|
|
|
LambdaQueryWrapper<Project> query = Wrappers.lambdaQuery(Project.class) |
|
|
|
.eq(req.getProjectYear() != null, Project::getProjectYear, req.getProjectYear()) |
|
|
|
.like(StrUtil.isNotBlank(req.getBuildOrg()), Project::getBuildOrgName, req.getBuildOrg()) |
|
|
|
.like(StrUtil.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()) |
|
|
|
.in(Project::getBuildOrgCode, CollUtils.convert(viewUnitIds, String::valueOf)) |
|
|
|
.eq(Project::getNewest, Boolean.TRUE) |
|
|
|
.orderByDesc(Project::getUpdateOn); |
|
|
|
switch (req.getProcessNode()) { |
|
|
|
case PROJECT_DECLARED: |
|
|
|
projectQueryByProjectStatusChange(query, ProjectStateChangeEvent.COMPLIANCE_REVIEW_PASS); |
|
|
|
break; |
|
|
|
case PROJECT_REVIEW: |
|
|
|
projectQueryByProjectStatusChange(query, ProjectStateChangeEvent.PROJECT_REVIEW_PASS); |
|
|
|
break; |
|
|
|
case APPROVAL_AMOUNT: |
|
|
|
query.isNotNull(Project::getApprovalAmount).gt(Project::getApprovalAmount, BigDecimal.ZERO); |
|
|
|
break; |
|
|
|
case PROJECT_APPROVAL: |
|
|
|
projectQueryByProjectStatusChange(query, ProjectStateChangeEvent.DECLARED_RECORD_PASS); |
|
|
|
break; |
|
|
|
case PROJECT_PURCHASE: |
|
|
|
projectQueryByProjectStatusChange(query, ProjectStateChangeEvent.SUBMIT_PURCHASE_NOTICE); |
|
|
|
break; |
|
|
|
case PROJECT_ADAPTION: |
|
|
|
projectQueryByPurchaseStatusChange(query, AdaptStateChangeEvent.ADAPT_INFO_PASSED); |
|
|
|
break; |
|
|
|
case SYSTEM_SELF_TEST: |
|
|
|
projectQueryByPurchaseStatusChange(query, SelfTestStateChangeEvent.SELF_TEST_PASSED); |
|
|
|
break; |
|
|
|
case SYSTEM_TEST_VALID: |
|
|
|
projectQueryByPurchaseStatusChange(query, TestValidStateChangeEvent.TEST_VALID_INFO_PASSED); |
|
|
|
break; |
|
|
|
case FIRST_INSPECTED: |
|
|
|
case PILOT_RUNNING: |
|
|
|
projectQueryByPurchaseStatusChange(query, TenderStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES); |
|
|
|
break; |
|
|
|
case XCFHX_REVIEW: |
|
|
|
projectQueryByPurchaseStatusChange(query, XcfhxStateChangeEvent.XCFHX_APPLY_PASSED); |
|
|
|
break; |
|
|
|
case FINAL_INSPECTED: |
|
|
|
projectQueryByPurchaseStatusChange(query, TenderStateChangeEvent.FINALLY_INSPECTED_PASSED); |
|
|
|
break; |
|
|
|
default: |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
|
Page<Project> page = projectService.page(req.page(), query); |
|
|
|
if (page.getTotal() == 0) { |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
|
List<ProjectLibListItemVO> records = CollUtils.convert(page.getRecords(), w -> { |
|
|
|
ProjectLibListItemVO item = new ProjectLibListItemVO(); |
|
|
|
item.setId(w.getId()); |
|
|
|
item.setProjectName(w.getProjectName()); |
|
|
|
item.setProjectCode(w.getProjectCode()); |
|
|
|
item.setArea(w.getArea()); |
|
|
|
item.setAreaCode(w.getAreaCode()); |
|
|
|
item.setCreateOn(w.getCreateOn()); |
|
|
|
item.setDeclaredAmount(w.getDeclareAmount()); |
|
|
|
item.setStage(w.getStage()); |
|
|
|
item.setStatus(w.getStatus()); |
|
|
|
item.setProjectType(w.getProjectType()); |
|
|
|
item.setProjectYear(w.getProjectYear()); |
|
|
|
item.setBuildOrg(w.getBuildOrgName()); |
|
|
|
item.setBizDomain(w.getBizDomain()); |
|
|
|
item.setProcessStatus(w.getProcessStatus()); |
|
|
|
item.setInstCode(w.getInstCode()); |
|
|
|
item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); |
|
|
|
item.setApprovedAmount(w.getApprovalAmount()); |
|
|
|
item.setPrePlanProjectId(w.getPrePlanProjectId()); |
|
|
|
return item; |
|
|
|
}); |
|
|
|
return PageVo.of(records, page.getTotal()); |
|
|
|
} |
|
|
|
|
|
|
|
private static void projectQueryByProjectStatusChange(LambdaQueryWrapper<Project> query, AbstractStateChangeEvent event) { |
|
|
|
query.exists("select 1 from nd_project_status_change npsc" + |
|
|
|
" where nd_project.project_code = npsc.project_code" + |
|
|
|
" and npsc.event = {0}", event); |
|
|
|
} |
|
|
|
|
|
|
|
private static void projectQueryByPurchaseStatusChange(LambdaQueryWrapper<Project> query, AbstractStateChangeEvent event) { |
|
|
|
query.exists("select 1 from nd_purchase_status_change npsc" + |
|
|
|
" where nd_project.project_code = npsc.project_code" + |
|
|
|
" and npsc.event ={0}", event.name()); |
|
|
|
} |
|
|
|
|
|
|
|
} |