|
|
@@ -13,7 +13,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.hz.pm.api.common.enumeration.CommonEnum; |
|
|
|
import com.hz.pm.api.common.enumeration.ProjectProcessType; |
|
|
|
import com.hz.pm.api.common.helper.UserInfoHelper; |
|
|
|
import com.hz.pm.api.common.model.constant.ExistsSqlConst; |
|
|
|
import com.hz.pm.api.common.model.constant.TypeReferenceConst; |
|
|
|
import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent; |
|
|
|
import com.hz.pm.api.common.util.BizUtils; |
|
|
|
import com.hz.pm.api.datascope.model.DataScopeDTO; |
|
|
|
import com.hz.pm.api.datascope.utils.DataScopeUtil; |
|
|
|
import com.hz.pm.api.external.model.enumeration.MhUnitStripEnum; |
|
|
@@ -26,6 +29,7 @@ import com.hz.pm.api.projectdeclared.model.dto.ProjectConditionDTO; |
|
|
|
import com.hz.pm.api.projectdeclared.service.IProjectDraftService; |
|
|
|
import com.hz.pm.api.projectdeclared.utils.ProjectCodeGenUtil; |
|
|
|
import com.hz.pm.api.projectlib.entity.ProjectGovSystemReplaceInfos; |
|
|
|
import com.hz.pm.api.projectlib.helper.ProjectManageUtil; |
|
|
|
import com.hz.pm.api.projectlib.model.dto.ImportProjectFinanceInfosDTO; |
|
|
|
import com.hz.pm.api.projectlib.model.dto.ImportReplaceSystemInfosDTO; |
|
|
|
import com.hz.pm.api.projectlib.model.dto.ProjectDTO; |
|
|
@@ -36,11 +40,9 @@ import com.hz.pm.api.projectlib.model.enumeration.GovSystemReplaceTypeEnum; |
|
|
|
import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus; |
|
|
|
import com.hz.pm.api.projectlib.model.req.DeclaredProjectListReq; |
|
|
|
import com.hz.pm.api.projectlib.model.vo.DeclaredProjectListVO; |
|
|
|
import com.hz.pm.api.projectlib.model.vo.DeclaredRecordProgressStatVO; |
|
|
|
import com.hz.pm.api.projectlib.model.vo.MhProjectBaseInfoVO; |
|
|
|
import com.hz.pm.api.projectlib.service.IMhProjectSchemaTargetDataService; |
|
|
|
import com.hz.pm.api.projectlib.service.IMhProjectService; |
|
|
|
import com.hz.pm.api.projectlib.service.IProjectGovSystemReplaceInfosService; |
|
|
|
import com.hz.pm.api.projectlib.service.IProjectService; |
|
|
|
import com.hz.pm.api.projectlib.service.*; |
|
|
|
import com.hz.pm.api.staging.enums.MsgTypeEnum; |
|
|
|
import com.hz.pm.api.sys.manage.NoticeManage; |
|
|
|
import com.hz.pm.api.sys.manage.ProcessModelManage; |
|
|
@@ -74,6 +76,8 @@ import java.util.*; |
|
|
|
import java.util.concurrent.atomic.AtomicInteger; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
import static com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent.DECLARED_RECORD_PASS; |
|
|
|
|
|
|
|
/** |
|
|
|
* <p> |
|
|
|
* MhProjectManage |
|
|
@@ -103,20 +107,6 @@ public class DeclaredRecordManage { |
|
|
|
private final IProjectGovSystemReplaceInfosService systemReplaceInfosService; |
|
|
|
private final MHTodoClient mhTodoClient; |
|
|
|
|
|
|
|
private LambdaQueryWrapper<Project> buildQuery(DeclaredProjectListReq req) { |
|
|
|
LambdaQueryWrapper<Project> query = Wrappers.lambdaQuery(Project.class) |
|
|
|
.like(StrUtil.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()) |
|
|
|
.like(StrUtil.isNotBlank(req.getDeclaredUnit()), Project::getBuildOrgName, req.getDeclaredUnit()) |
|
|
|
.eq(req.getUnitStrip() != null, Project::getUnitStrip, req.getUnitStrip()); |
|
|
|
if (req.getCreateDateMin() != null) { |
|
|
|
query.ge(Project::getCreateOn, req.getCreateDateMin()); |
|
|
|
} |
|
|
|
if (req.getCreateDateMax() != null) { |
|
|
|
query.lt(Project::getCreateOn, req.getCreateDateMax().minusDays(1)); |
|
|
|
} |
|
|
|
return query; |
|
|
|
} |
|
|
|
|
|
|
|
private boolean buildProjectLibPermission(LambdaQueryWrapper<Project> query, UserFullInfoDTO user, Long declaredUnitId) { |
|
|
|
boolean queryState = true; |
|
|
|
Optional<DataScopeDTO> currentUserDataScope = DataScopeUtil.getCurrentUserDataScopeHasUserId(user); |
|
|
@@ -162,18 +152,79 @@ public class DeclaredRecordManage { |
|
|
|
return queryState; |
|
|
|
} |
|
|
|
|
|
|
|
public PageVo<DeclaredProjectListVO> pageDeclaredProject(DeclaredProjectListReq req) { |
|
|
|
LambdaQueryWrapper<Project> query = buildQuery(req); |
|
|
|
|
|
|
|
public DeclaredRecordProgressStatVO declaredRecordProgressStatistics(DeclaredProjectListReq req) { |
|
|
|
req.setStatus(null); |
|
|
|
LambdaQueryWrapper<Project> query = buildDeclaredRecordQuery(req); |
|
|
|
if (query == null) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
query.select(Project::getStatus, Project::getProjectCode); |
|
|
|
List<Project> projects = projectService.list(query); |
|
|
|
Map<ProjectStatus, Long> countMap = CollUtils.groupCount(projects, |
|
|
|
w -> getDeclaredRecordStatus(w.getStatus())); |
|
|
|
DeclaredRecordProgressStatVO stat = new DeclaredRecordProgressStatVO(); |
|
|
|
stat.setTodoCount(countMap.getOrDefault(ProjectStatus.DECLARED_APPROVED_TO_BE_RECORD, 0L)); |
|
|
|
stat.setAuditingCount(countMap.getOrDefault(ProjectStatus.DECLARED_APPROVED_RECORD_AUDITING, 0L)); |
|
|
|
stat.setPassedCount(countMap.getOrDefault(ProjectStatus.DECLARED_APPROVED_RECORD_PASSED, 0L)); |
|
|
|
stat.setFailedCount(countMap.getOrDefault(ProjectStatus.DECLARED_APPROVED_RECORD_FAILED, 0L)); |
|
|
|
stat.setTotalCount((long) projects.size()); |
|
|
|
return stat; |
|
|
|
} |
|
|
|
|
|
|
|
private ProjectStatus getDeclaredRecordStatus(Integer statusCode) { |
|
|
|
ProjectStatus status = ProjectStatus.getNoNull(statusCode); |
|
|
|
switch (status) { |
|
|
|
case DECLARED_APPROVED_TO_BE_RECORD: |
|
|
|
case DECLARED_APPROVED_RECORD_AUDITING: |
|
|
|
case DECLARED_APPROVED_RECORD_FAILED: |
|
|
|
return status; |
|
|
|
default: |
|
|
|
return ProjectStatus.DECLARED_APPROVED_RECORD_PASSED; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private LambdaQueryWrapper<Project> buildDeclaredRecordQuery(DeclaredProjectListReq req) { |
|
|
|
LambdaQueryWrapper<Project> query = Wrappers.lambdaQuery(Project.class) |
|
|
|
.like(StrUtil.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()) |
|
|
|
.like(StrUtil.isNotBlank(req.getDeclaredUnit()), Project::getBuildOrgName, req.getDeclaredUnit()) |
|
|
|
.eq(req.getUnitStrip() != null, Project::getUnitStrip, req.getUnitStrip()) |
|
|
|
.ge(req.getCreateDateMin() != null, Project::getCreateOn, req.getCreateDateMin()) |
|
|
|
.eq(Project::getNewest, Boolean.TRUE) |
|
|
|
.orderByDesc(Project::getUpdateOn); |
|
|
|
BizUtils.notNull(req.getCreateDateMax(), w -> query.lt(Project::getCreateOn, w.plusDays(1))); |
|
|
|
if (req.getStatus() == null) { |
|
|
|
query.and(q1 -> q1.in(Project::getStatus, ProjectStatus.DECLARED_APPROVED_RECORD_FAILED.getCode(), |
|
|
|
ProjectStatus.DECLARED_APPROVED_TO_BE_RECORD.getCode(), |
|
|
|
ProjectStatus.DECLARED_APPROVED_RECORD_AUDITING.getCode()) |
|
|
|
.or(q2 -> q2.exists(ExistsSqlConst.PROJECT_EXISTS_STATUS_CHANGE |
|
|
|
+ " and npsc.event = {0}", DECLARED_RECORD_PASS))); |
|
|
|
} else if (ProjectStatus.DECLARED_APPROVED_RECORD_PASSED.eq(req.getStatus())) { |
|
|
|
query.exists(ExistsSqlConst.PROJECT_EXISTS_STATUS_CHANGE |
|
|
|
+ " and npsc.event = {0}", DECLARED_RECORD_PASS); |
|
|
|
} else if (ProjectStatus.DECLARED_APPROVED_RECORD_FAILED.eq(req.getStatus())) { |
|
|
|
query.eq(Project::getStatus, ProjectStatus.DECLARED_APPROVED_RECORD_FAILED.getCode()); |
|
|
|
} else if (ProjectStatus.DECLARED_APPROVED_TO_BE_RECORD.eq(req.getStatus())) { |
|
|
|
query.eq(Project::getStatus, ProjectStatus.DECLARED_APPROVED_TO_BE_RECORD.getCode()); |
|
|
|
} else if (ProjectStatus.DECLARED_APPROVED_RECORD_AUDITING.eq(req.getStatus())) { |
|
|
|
query.eq(Project::getStatus, ProjectStatus.DECLARED_APPROVED_RECORD_AUDITING.getCode()); |
|
|
|
} else { |
|
|
|
return null; |
|
|
|
} |
|
|
|
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); |
|
|
|
// 查询审核中、失败、待立项备案的项目信息 |
|
|
|
if (!buildProjectLibPermission(query, user, req.getDeclaredUnitId())) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
return query; |
|
|
|
} |
|
|
|
|
|
|
|
public PageVo<DeclaredProjectListVO> pageDeclaredProject(DeclaredProjectListReq req) { |
|
|
|
LambdaQueryWrapper<Project> query = buildDeclaredRecordQuery(req); |
|
|
|
if (query == null) { |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
|
query.in(Project::getStatus, ProjectStatus.DECLARED_APPROVED_RECORD_FAILED.getCode(), |
|
|
|
ProjectStatus.DECLARED_APPROVED_TO_BE_RECORD.getCode(), |
|
|
|
ProjectStatus.DECLARED_APPROVED_RECORD_AUDITING.getCode()) |
|
|
|
.eq(Project::getNewest, Boolean.TRUE) |
|
|
|
.orderByDesc(Project::getUpdateOn); |
|
|
|
ProjectManageUtil.projectBaseQuery(query); |
|
|
|
Page<Project> page = projectService.page(req.page(), query); |
|
|
|
if (page.getTotal() == 0) { |
|
|
|
return PageVo.empty(); |
|
|
@@ -187,8 +238,6 @@ public class DeclaredRecordManage { |
|
|
|
if (mhProj != null) { |
|
|
|
item.setMhProjectId(mhProj.getId()); |
|
|
|
} |
|
|
|
item.setStatus(w.getStatus()); |
|
|
|
item.setStage(w.getStage()); |
|
|
|
item.setProjectId(w.getId()); |
|
|
|
item.setUnitStrip(w.getUnitStrip()); |
|
|
|
item.setUnitStripName(MhUnitStripEnum.getVal(w.getUnitStrip())); |
|
|
@@ -199,6 +248,9 @@ public class DeclaredRecordManage { |
|
|
|
item.setReviewAmount(w.getReviewAmount()); |
|
|
|
item.setApprovedAmount(w.getApprovalAmount()); |
|
|
|
item.setCreateTime(w.getCreateOn()); |
|
|
|
ProjectStatus projectStatus = getDeclaredRecordStatus(w.getStatus()); |
|
|
|
item.setStatus(projectStatus.getCode()); |
|
|
|
item.setStage(projectStatus.getStageCode()); |
|
|
|
return item; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
return PageVo.of(data, page.getTotal()); |
|
|
|