From d5b046339f71ec5d3d0a36e54b2f407a6ddda19b Mon Sep 17 00:00:00 2001 From: WendyYang Date: Wed, 18 Dec 2024 17:16:45 +0800 Subject: [PATCH] =?UTF-8?q?feat:=201.=20=E5=A2=9E=E5=8A=A0=E5=90=88?= =?UTF-8?q?=E8=A7=84=E6=80=A7=E5=AE=A1=E6=9F=A5=E4=B8=8D=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=88=A0=E9=99=A4=E5=8A=9F=E8=83=BD=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../event/ProjectStateChangeEvent.java | 7 +++- .../hz/pm/api/meeting/manage/MeetingManage.java | 3 +- .../api/open/manage/OpenApiProjectLibManage.java | 37 +++++++++---------- .../controller/DeclaredProjectController.java | 9 +++++ .../projectdeclared/manage/ConstructionManage.java | 5 +-- .../manage/DeclaredProjectHelper.java | 3 +- .../manage/DeclaredProjectManage.java | 42 ++++++++++++++++++---- .../manage/ProjectReviewManage.java | 9 ++--- .../api/projectdeclared/manage/PurchaseManage.java | 13 +++---- .../projectlib/manage/AmountApprovalManage.java | 5 +-- .../api/projectlib/manage/AnnualPlanLibManage.java | 5 +-- .../projectlib/manage/DeclaredRecordManage.java | 3 +- .../pm/api/projectlib/manage/ProjectLibManage.java | 3 +- .../model/constant/ProjectStatusConstant.java | 27 ++++++++++++++ .../model/enumeration/status/ProjectStatus.java | 11 +++--- .../pm/api/workbench/manage/WorkbenchManage.java | 15 ++++---- 16 files changed, 138 insertions(+), 59 deletions(-) create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/constant/ProjectStatusConstant.java diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/event/ProjectStateChangeEvent.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/event/ProjectStateChangeEvent.java index 59b5f30..331d8ab 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/event/ProjectStateChangeEvent.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/event/ProjectStateChangeEvent.java @@ -188,9 +188,14 @@ public enum ProjectStateChangeEvent implements AbstractStateChangeEvent { CHANGE_APPLY_SUBMIT(null, null, null), CHANGE_APPLY_PASS(null, null, null), - CHANGE_APPLY_FAILED(null, null, null); + CHANGE_APPLY_FAILED(null, null, null), + /** + * 项目删除 + */ + DELETED_APPLY_PASSED(null, null, null); + private final Integer passStatusCode; private final Integer rejectStatusCode; private final Integer withdrawStatusCode; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java index 6b9620e..bdbc0d5 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java @@ -49,6 +49,7 @@ import com.hz.pm.api.open.model.vo.MeetingExpertToMhDTO; import com.hz.pm.api.organization.service.IDingOrganizationService; import com.hz.pm.api.projectdeclared.utils.ProjectIdCodeCacheUtil; import com.hz.pm.api.projectlib.helper.ProjectManageUtil; +import com.hz.pm.api.projectlib.model.constant.ProjectStatusConstant; import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus; import com.hz.pm.api.projectlib.service.IProjectService; @@ -1089,7 +1090,7 @@ public class MeetingManage { } String meetingType = req.getMeetingType(); LambdaQueryWrapper query = Wrappers.lambdaQuery(Project.class) - .notIn(Project::getStage, ProjectStatus.STOP_CHANGE_STAGE_CODES) + .notIn(Project::getStage, ProjectStatusConstant.CHANGE_STOP_DELETE_STAGE) .eq(Project::getNewest, Boolean.TRUE); BizUtils.notEmpty(unitQueryState.getUnitIds(), w -> { List unitIdStrList = CollUtils.convert(w, String::valueOf); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/open/manage/OpenApiProjectLibManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/open/manage/OpenApiProjectLibManage.java index 13709c5..e75ab91 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/open/manage/OpenApiProjectLibManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/open/manage/OpenApiProjectLibManage.java @@ -26,6 +26,7 @@ import com.hz.pm.api.projectdeclared.service.IPurchaseService; import com.hz.pm.api.projectdeclared.utils.ProjectIdCodeCacheUtil; import com.hz.pm.api.projectlib.entity.MhSystemReplaceInfo; import com.hz.pm.api.projectlib.entity.ProjectGovSystemReplaceInfos; +import com.hz.pm.api.projectlib.model.constant.ProjectStatusConstant; import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.model.enumeration.GovSystemReplaceTypeEnum; import com.hz.pm.api.projectlib.service.IMhSystemReplaceInfoService; @@ -81,6 +82,7 @@ public class OpenApiProjectLibManage { .select(Project::getId, Project::getProjectCode, Project::getProjectName, Project::getBuildOrgCode, Project::getStatus, Project::getReviewAmount, Project::getDeclareAmount, Project::getProjectYear, Project::getCreateOn, Project::getBuildOrgName) + .notIn(Project::getStatus, ProjectStatusConstant.CHANGE_DELETE_PASSED) .eq(Project::getNewest, Boolean.TRUE) .exists(sql.toString()) .eq(po.getProjectYear() != null, Project::getProjectYear, po.getProjectYear()) @@ -195,26 +197,25 @@ public class OpenApiProjectLibManage { public List listTenders(TenderListReq req) { openApiCheckSignUtil.checkSign(req.getKey()); - LambdaQueryWrapper purQuery = Wrappers.lambdaQuery(Purchase.class) + Wrapper projQuery = Wrappers.lambdaQuery(Project.class) + .select(Project::getId, Project::getProjectCode) + .eq(req.getProjectYear() != null, Project::getProjectYear, req.getProjectYear()) + .eq(req.getBuildOrgCode() != null, Project::getBuildOrgCode, req.getBuildOrgCode()) + .eq(req.getProjectCode() != null, Project::getProjectCode, req.getProjectCode()) + .notIn(Project::getStatus, ProjectStatusConstant.CHANGE_DELETE_PASSED) + .eq(Project::getNewest, Boolean.TRUE); + List projects = projectService.list(projQuery); + if (projects.isEmpty()) { + return Collections.emptyList(); + } + List projectIds = projects.stream() + .map(w -> ProjectIdCodeCacheUtil.get(w.getProjectCode())) + .flatMap(Collection::stream) + .collect(Collectors.toList()); + Wrapper purQuery = Wrappers.lambdaQuery(Purchase.class) + .in(Purchase::getProjectId, projectIds) .orderByDesc(Purchase::getCreateOn) .orderByDesc(Purchase::getId); - if (req.hasProjectQuery()) { - Wrapper projQuery = Wrappers.lambdaQuery(Project.class) - .select(Project::getId, Project::getProjectCode) - .eq(req.getProjectYear() != null, Project::getProjectYear, req.getProjectYear()) - .eq(req.getBuildOrgCode() != null, Project::getBuildOrgCode, req.getBuildOrgCode()) - .eq(req.getProjectCode() != null, Project::getProjectCode, req.getProjectCode()) - .eq(Project::getNewest, Boolean.TRUE); - List projects = projectService.list(projQuery); - if (projects.isEmpty()) { - return Collections.emptyList(); - } - List projectIds = projects.stream() - .map(w -> ProjectIdCodeCacheUtil.get(w.getProjectCode())) - .flatMap(Collection::stream) - .collect(Collectors.toList()); - purQuery.in(Purchase::getProjectId, projectIds); - } List purchases = purchaseService.list(purQuery); if (purchases.isEmpty()) { return Collections.emptyList(); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/DeclaredProjectController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/DeclaredProjectController.java index 7334082..29d9660 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/DeclaredProjectController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/DeclaredProjectController.java @@ -8,6 +8,7 @@ import com.hz.pm.api.projectdeclared.model.dto.ProjectDraftSaveDTO; import com.hz.pm.api.projectdeclared.model.enumerization.ProjectDraftTypeEnum; import com.hz.pm.api.projectdeclared.model.vo.DeclaredProgressStatisticsVO; import com.hz.pm.api.projectdeclared.model.vo.ProjectDraftVO; +import com.hz.pm.api.projectlib.model.req.ProjectIdReq; import com.hz.pm.api.projectlib.model.req.ProjectListReq; import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; import com.ningdatech.basic.model.PageVo; @@ -20,6 +21,7 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; /** *

@@ -112,4 +114,11 @@ public class DeclaredProjectController { ExcelDownUtil.downXls(response, req, declaredProjectManage::exportList); } + @PostMapping("/delete") + @ApiOperation("删除项目") + @WebLog("删除项目") + public void deleteProjectLogic(@RequestBody @Valid ProjectIdReq req) { + declaredProjectManage.deleteProjectLogic(req.getProjectId()); + } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java index b7c0f79..054519e 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java @@ -32,6 +32,7 @@ import com.hz.pm.api.projectdeclared.model.req.XcfhxApplyReq; import com.hz.pm.api.projectdeclared.model.vo.*; import com.hz.pm.api.projectdeclared.service.*; import com.hz.pm.api.projectlib.helper.ProjectManageUtil; +import com.hz.pm.api.projectlib.model.constant.ProjectStatusConstant; import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.model.entity.ProjectAnnualPaymentPlan; import com.hz.pm.api.projectlib.model.entity.ProjectInst; @@ -313,7 +314,7 @@ public class ConstructionManage { .select(Project::getId) .eq(Project::getNewest, Boolean.TRUE) .ne(Project::getStage, ProjectStatus.STOPPED.getCode()) - .ne(Project::getStatus, ProjectStatus.CHANGE_APPLY_PASSED.getCode()) + .notIn(Project::getStatus, ProjectStatusConstant.CHANGE_DELETE_PASSED) .and(q1 -> q1.exists(ExistsSqlConst.PROJECT_EXISTS_PURCHASE + " and np.status = {0} ", TenderMainStatus.TO_BE_SUBMIT_FIRST_INSPECTED_INFO.getCode()) .or(q2 -> q2.exists(ExistsSqlConst.PROJECT_EXISTS_PURCHASE_STATUS_CHANGE @@ -370,7 +371,7 @@ public class ConstructionManage { + " and npsc.event = '%s'", TenderStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES); LambdaQueryWrapper query = ProjectManageUtil.projectQuery(req) .ne(Project::getStage, ProjectStatus.STOPPED.getCode()) - .ne(Project::getStatus, ProjectStatus.CHANGE_APPLY_PASSED.getCode()) + .notIn(Project::getStatus, ProjectStatusConstant.CHANGE_DELETE_PASSED) .eq(Project::getNewest, Boolean.TRUE) .orderByAsc(Project::getDeliveryTime); if (req.getTabStatus() != null) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectHelper.java index 957073e..e1fab7c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectHelper.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectHelper.java @@ -15,6 +15,7 @@ import com.hz.pm.api.common.model.constant.RegionConst; import com.hz.pm.api.common.model.constant.TypeReferenceConst; import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; import com.hz.pm.api.projectdeclared.model.dto.ProjectConditionDTO; +import com.hz.pm.api.projectlib.model.constant.ProjectStatusConstant; import com.hz.pm.api.projectlib.model.dto.ProjectDTO; import com.hz.pm.api.projectlib.model.dto.ProjectPaymentPlanDTO; import com.hz.pm.api.projectlib.model.entity.Project; @@ -66,7 +67,7 @@ public class DeclaredProjectHelper { LambdaQueryWrapper query = Wrappers.lambdaQuery(Project.class) .eq(Project::getProjectName, project.getProjectName()) .eq(Project::getNewest, Boolean.TRUE) - .ne(Project::getStatus, ProjectStatus.CHANGE_APPLY_PASSED.getCode()) + .notIn(Project::getStatus, ProjectStatusConstant.CHANGE_DELETE_PASSED) .ne(StrUtil.isNotBlank(projectCode), Project::getProjectCode, projectCode) .eq(StrUtil.isNotBlank(hisProjectCode), Project::getHisProjectCode, hisProjectCode) .last(BizConst.LIMIT_1); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java index 3b28581..69ff7c7 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java @@ -14,6 +14,7 @@ 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.enumeration.ProjectProcessType; +import com.hz.pm.api.common.exception.ReturnException; 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.MhUnitConst; @@ -32,11 +33,13 @@ import com.hz.pm.api.projectdeclared.model.vo.ProjectDraftVO; import com.hz.pm.api.projectdeclared.service.IProjectDraftService; import com.hz.pm.api.projectlib.helper.ProjectManageUtil; import com.hz.pm.api.projectlib.manage.ProjectLibManage; +import com.hz.pm.api.projectlib.model.constant.ProjectStatusConstant; import com.hz.pm.api.projectlib.model.dto.GovSystemReplaceInfoDTO; import com.hz.pm.api.projectlib.model.dto.ProjectDTO; import com.hz.pm.api.projectlib.model.dto.ProjectPaymentPlanDTO; import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.model.entity.ProjectApplication; +import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus; import com.hz.pm.api.projectlib.model.req.ProjectListReq; @@ -105,11 +108,10 @@ public class DeclaredProjectManage { * 新项目 启动实例 * * @param req \ - * @return \ */ @Transactional(rollbackFor = Exception.class) public synchronized void store(DefaultDeclaredDTO req) { - UserInfoDetails user = LoginUserUtil.userDetail(); + UserInfoDetails user = LoginUserUtil.userDetailNotNull(); ProjectDTO reqProj = req.getProjectInfo(); reqProj.setBuildOrgCode(user.getMhUnitIdStr()); reqProj.setBuildOrgName(user.getMhUnitName()); @@ -138,7 +140,7 @@ public class DeclaredProjectManage { */ @Transactional(rollbackFor = Exception.class) public synchronized String startTheProcess(DefaultDeclaredDTO req) { - UserInfoDetails user = LoginUserUtil.userDetail(); + UserInfoDetails user = LoginUserUtil.userDetailNotNull(); WflowModels model = processModelManage.getWflowModelsNoNull(ProjectProcessType.COMPLIANCE_REVIEW, user.getMhUnitId()); @@ -206,7 +208,7 @@ public class DeclaredProjectManage { public synchronized String reStartTheProcess(DefaultDeclaredDTO req) { ProjectDTO reqProj = req.getProjectInfo(); Assert.notNull(reqProj.getId(), "提交失败,缺少项目ID!"); - UserInfoDetails user = LoginUserUtil.userDetail(); + UserInfoDetails user = LoginUserUtil.userDetailNotNull(); reqProj.setBuildOrgCode(user.getMhUnitIdStr()); reqProj.setBuildOrgName(user.getMhUnitName()); @@ -376,7 +378,7 @@ public class DeclaredProjectManage { return null; } query.ne(Project::getStage, ProjectStatus.STOPPED.getCode()) - .ne(Project::getStatus, ProjectStatus.CHANGE_APPLY_PASSED.getCode()) + .notIn(Project::getStatus, ProjectStatusConstant.CHANGE_DELETE_PASSED) .eq(Project::getNewest, Boolean.TRUE) .select(Project::getStatus, Project::getProjectCode, Project::getStage); List projects = projectService.list(query); @@ -419,8 +421,8 @@ public class DeclaredProjectManage { } } query.ne(Project::getStage, ProjectStatus.STOPPED.getCode()) - .ne(Project::getStatus, ProjectStatus.CHANGE_APPLY_PASSED.getCode()); - query.eq(Project::getNewest, Boolean.TRUE); + .notIn(Project::getStatus, ProjectStatusConstant.CHANGE_DELETE_PASSED) + .eq(Project::getNewest, Boolean.TRUE); Page page = projectService.page(req.page(), query); if (page.getTotal() == 0) { return PageVo.empty(); @@ -542,4 +544,30 @@ public class DeclaredProjectManage { } } + @Transactional(rollbackFor = Exception.class) + public synchronized void deleteProjectLogic(Long projectId) { + Project project = projectService.getNewestNoNull(projectId); + if (!ProjectStatus.COMPLIANCE_REVIEW_FAILED.eq(project.getStatus())) { + throw ReturnException.wrap("当前项目不可删除"); + } + UserInfoDetails user = LoginUserUtil.userDetailNotNull(); + if (!StrUtil.equals(project.getBuildOrgCode(), user.getMhUnitIdStr()) + && !user.getUserId().equals(project.getCreateBy()) + && !user.hasSuperAdmin()) { + throw ReturnException.wrap("暂无权限删除此项目"); + } + ProjectStatusChange change = new ProjectStatusChange(); + change.setProjectId(project.getId()); + change.setBeforeStatus(project.getStatus()); + change.setAfterStatus(ProjectStatus.DELETED_PASSED.getCode()); + change.setEvent(ProjectStateChangeEvent.DELETED_APPLY_PASSED.name()); + change.setProjectCode(project.getProjectCode()); + change.setCreateOn(LocalDateTime.now()); + projectStatusChangeService.save(change); + // 修改项目状态为已删除 + project.setStage(ProjectStatus.DELETED.getCode()); + project.setStatus(ProjectStatus.DELETED_PASSED.getCode()); + projectService.updateById(project); + } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ProjectReviewManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ProjectReviewManage.java index 245e5cc..d641071 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ProjectReviewManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ProjectReviewManage.java @@ -33,6 +33,7 @@ import com.hz.pm.api.projectdeclared.utils.ProjectIdCodeCacheUtil; import com.hz.pm.api.projectlib.helper.ProjectManageUtil; import com.hz.pm.api.projectlib.helper.ProjectSaveHelper; import com.hz.pm.api.projectlib.manage.ProjectLibManage; +import com.hz.pm.api.projectlib.model.constant.ProjectStatusConstant; 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.ProjectInst; @@ -156,7 +157,7 @@ public class ProjectReviewManage { query.exists(ExistsSqlConst.PROJECT_EXISTS_STATUS_CHANGE + " and npsc.event = {0}", ProjectStateChangeEvent.EXPERT_REVIEW_PASS) .ne(Project::getStage, ProjectStatus.STOPPED.getCode()) - .ne(Project::getStatus, ProjectStatus.CHANGE_APPLY_PASSED.getCode()) + .notIn(Project::getStatus, ProjectStatusConstant.CHANGE_DELETE_PASSED) .eq(Project::getNewest, Boolean.TRUE) .select(Project::getStatus, Project::getId); List projects = projectService.list(query); @@ -207,7 +208,7 @@ public class ProjectReviewManage { ProjectManageUtil.projectQuery(query, req); query.eq(Project::getNewest, Boolean.TRUE) .ne(Project::getStage, ProjectStatus.STOPPED.getCode()) - .ne(Project::getStatus, ProjectStatus.CHANGE_APPLY_PASSED.getCode()); + .notIn(Project::getStatus, ProjectStatusConstant.CHANGE_DELETE_PASSED); Page page = projectService.page(req.page(), query); if (page.getTotal() == 0) { return PageVo.empty(); @@ -237,7 +238,7 @@ public class ProjectReviewManage { query.exists(ExistsSqlConst.PROJECT_EXISTS_STATUS_CHANGE + " and npsc.event = {0}", ProjectStateChangeEvent.COMPLIANCE_REVIEW_PASS) .ne(Project::getStage, ProjectStatus.STOPPED.getCode()) - .ne(Project::getStatus, ProjectStatus.CHANGE_APPLY_PASSED.getCode()) + .notIn(Project::getStatus, ProjectStatusConstant.CHANGE_DELETE_PASSED) .eq(Project::getNewest, Boolean.TRUE) .select(Project::getStatus, Project::getId, Project::getConstructionPlanSealFile); List projects = projectService.list(query); @@ -298,7 +299,7 @@ public class ProjectReviewManage { ProjectManageUtil.projectBaseQuery(query); query.eq(Project::getNewest, Boolean.TRUE) .ne(Project::getStage, ProjectStatus.STOPPED.getCode()) - .ne(Project::getStatus, ProjectStatus.CHANGE_APPLY_PASSED.getCode()); + .notIn(Project::getStatus, ProjectStatusConstant.CHANGE_DELETE_PASSED); Page page = projectService.page(req.page(), query); if (page.getTotal() == 0) { return PageVo.empty(); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java index 0a6c724..92087dd 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java @@ -48,6 +48,7 @@ import com.hz.pm.api.projectdeclared.service.*; import com.hz.pm.api.projectlib.entity.ProjectGovSystemReplaceInfos; import com.hz.pm.api.projectlib.entity.PurchaseStatusChange; import com.hz.pm.api.projectlib.helper.ProjectManageUtil; +import com.hz.pm.api.projectlib.model.constant.ProjectStatusConstant; import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.model.entity.ProjectInst; import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; @@ -154,7 +155,7 @@ public class PurchaseManage { } //待采购状态 query.ne(Project::getStage, ProjectStatus.STOPPED.getCode()) - .ne(Project::getStatus, ProjectStatus.CHANGE_APPLY_PASSED.getCode()) + .notIn(Project::getStatus, ProjectStatusConstant.CHANGE_DELETE_PASSED) .eq(Project::getNewest, Boolean.TRUE) .exists(ExistsSqlConst.PROJECT_EXISTS_STATUS_CHANGE + " and npsc.event = {0}", ProjectStateChangeEvent.DECLARED_RECORD_PASS) @@ -204,7 +205,7 @@ public class PurchaseManage { } //待采购状态 query.ne(Project::getStage, ProjectStatus.STOPPED.getCode()) - .ne(Project::getStatus, ProjectStatus.CHANGE_APPLY_PASSED.getCode()); + .notIn(Project::getStatus, ProjectStatusConstant.CHANGE_DELETE_PASSED); query.eq(Project::getNewest, Boolean.TRUE); query.orderByAsc(Project::getApprovalDate); ProjectManageUtil.projectBaseQuery(query); @@ -725,8 +726,8 @@ public class PurchaseManage { .exists(ExistsSqlConst.PURCHASE_EXISTS_STATUS_CHANGE + " and npsc.event = {0}", TenderStateChangeEvent.SUBMIT_PURCHASE_CONSTRUCTION_INFO) .notExists(ExistsSqlConst.PURCHASE_EXISTS_PROJECT - + "and (np.stage = {0} or np.status = {1})", ProjectStatus.STOPPED.getCode(), - ProjectStatus.CHANGE_APPLY_PASSED.getCode()) + + "and (np.stage = {0} or np.status in ({1}),{2}))", ProjectStatus.STOPPED.getCode(), + ProjectStatus.CHANGE_APPLY_PASSED.getCode(), ProjectStatus.DELETED_PASSED.getCode()) .orderByDesc(Purchase::getCreateOn); UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); if (!purchaseService.buildPurchaseQueryPermission(query, user)) { @@ -786,8 +787,8 @@ public class PurchaseManage { .exists(ExistsSqlConst.PURCHASE_EXISTS_STATUS_CHANGE + " and npsc.event = {0}", TenderStateChangeEvent.SUBMIT_PURCHASE_CONSTRUCTION_INFO) .notExists(ExistsSqlConst.PURCHASE_EXISTS_PROJECT - + "and (np.stage = {0} or np.status = {1})", ProjectStatus.STOPPED.getCode(), - ProjectStatus.CHANGE_APPLY_PASSED.getCode()) + + "and (np.stage = {0} or np.status in ({1},{2}))", ProjectStatus.STOPPED.getCode(), + ProjectStatus.CHANGE_APPLY_PASSED.getCode(), ProjectStatus.DELETED_PASSED.getCode()) .orderByDesc(Purchase::getCreateOn); UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); if (!purchaseService.buildPurchaseQueryPermission(query, user)) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AmountApprovalManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AmountApprovalManage.java index 05ff606..59b649e 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AmountApprovalManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AmountApprovalManage.java @@ -19,6 +19,7 @@ import com.hz.pm.api.external.model.enumeration.MhUnitStripEnum; import com.hz.pm.api.external.todo.enumerization.MHTodoTypeEnum; import com.hz.pm.api.projectlib.entity.ProjectApprovalAmount; import com.hz.pm.api.projectlib.helper.ProjectManageUtil; +import com.hz.pm.api.projectlib.model.constant.ProjectStatusConstant; import com.hz.pm.api.projectlib.model.dto.ProjectApprovalAmountDTO; import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus; @@ -111,7 +112,7 @@ public class AmountApprovalManage { query.eq(Project::getAnnualPlanOpened, Boolean.TRUE) .eq(Project::getNewest, Boolean.TRUE) .ne(Project::getStage, ProjectStatus.STOPPED.getCode()) - .ne(Project::getStatus, ProjectStatus.CHANGE_APPLY_PASSED.getCode()); + .notIn(Project::getStatus, ProjectStatusConstant.CHANGE_DELETE_PASSED); buildAmountApprovalFilter(req.getIsAmountApproval(), query); Page page = projectService.page(req.page(), query); long total = page.getTotal(); @@ -162,7 +163,7 @@ public class AmountApprovalManage { query.eq(Project::getAnnualPlanOpened, Boolean.TRUE) .eq(Project::getNewest, Boolean.TRUE) .ne(Project::getStage, ProjectStatus.STOPPED.getCode()) - .ne(Project::getStatus, ProjectStatus.CHANGE_APPLY_PASSED.getCode()); + .notIn(Project::getStatus, ProjectStatusConstant.CHANGE_DELETE_PASSED); buildAmountApprovalFilter(req.getIsAmountApproval(), query); List page = projectService.list(query); AmountApprovalProgressStatisticsVO stat = new AmountApprovalProgressStatisticsVO(); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java index a3e92be..53be16c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java @@ -14,6 +14,7 @@ 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; import com.hz.pm.api.projectlib.helper.ProjectManageUtil; +import com.hz.pm.api.projectlib.model.constant.ProjectStatusConstant; 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.enumeration.status.ProjectStatus; @@ -75,7 +76,7 @@ public class AnnualPlanLibManage { .and(q1 -> q1.in(Project::getStatus, ON_ANNUAL_PLAN.getCode()) .or(q2 -> q2.exists(ExistsSqlConst.PROJECT_EXISTS_STATUS_CHANGE + " and event = {0}", ProjectStateChangeEvent.ANNUAL_PLAN_PASS))) - .ne(Project::getStatus, ProjectStatus.CHANGE_APPLY_PASSED.getCode()) + .notIn(Project::getStatus, ProjectStatusConstant.CHANGE_DELETE_PASSED) .ne(Project::getStage, ProjectStatus.STOPPED.getCode()); List projects = projectService.list(query); AnnualPlanProgressStatisticsVO stat = new AnnualPlanProgressStatisticsVO(); @@ -95,7 +96,7 @@ public class AnnualPlanLibManage { query.and(q1 -> q1.in(Project::getStatus, ON_ANNUAL_PLAN.getCode()) .or(q2 -> q2.exists(ExistsSqlConst.PROJECT_EXISTS_STATUS_CHANGE + " and event = {0}", ProjectStateChangeEvent.ANNUAL_PLAN_PASS))) - .ne(Project::getStatus, ProjectStatus.CHANGE_APPLY_PASSED.getCode()) + .notIn(Project::getStatus, ProjectStatusConstant.CHANGE_DELETE_PASSED) .ne(Project::getStage, ProjectStatus.STOPPED.getCode()); Page page = projectService.page(req.page(), query); long total = page.getTotal(); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/DeclaredRecordManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/DeclaredRecordManage.java index cd1002f..cfcc38f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/DeclaredRecordManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/DeclaredRecordManage.java @@ -29,6 +29,7 @@ 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.constant.ProjectStatusConstant; 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; @@ -195,7 +196,7 @@ public class DeclaredRecordManage { .eq(req.getUnitStrip() != null, Project::getUnitStrip, req.getUnitStrip()) .ge(req.getCreateDateMin() != null, Project::getCreateOn, req.getCreateDateMin()) .eq(Project::getNewest, Boolean.TRUE) - .ne(Project::getStatus, ProjectStatus.CHANGE_APPLY_PASSED.getCode()) + .notIn(Project::getStatus, ProjectStatusConstant.CHANGE_DELETE_PASSED) .ne(Project::getStage, ProjectStatus.STOPPED.getCode()) .orderByDesc(Project::getUpdateOn); BizUtils.notNull(req.getCreateDateMax(), w -> query.lt(Project::getCreateOn, w.plusDays(1))); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java index 857844c..ef115a1 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java @@ -62,6 +62,7 @@ import com.hz.pm.api.projectlib.handle.ProcessProgressHelper; import com.hz.pm.api.projectlib.helper.ProjectManageUtil; import com.hz.pm.api.projectlib.helper.ProjectSaveHelper; import com.hz.pm.api.projectlib.model.constant.ProjectConstant; +import com.hz.pm.api.projectlib.model.constant.ProjectStatusConstant; import com.hz.pm.api.projectlib.model.dto.GovSystemReplaceInfoDTO; import com.hz.pm.api.projectlib.model.dto.GovSystemReplaceInfoUpgradeContentDTO; import com.hz.pm.api.projectlib.model.dto.ProjectDTO; @@ -454,7 +455,7 @@ public class ProjectLibManage { List viewUnitIds = mhUnitCache.getViewChildIdsRecursion(req.getDeclaredUnitId()); req.setDeclaredUnitIds(viewUnitIds); } - req.setNotInStatusList(Collections.singletonList(ProjectStatus.CHANGE_APPLY_PASSED.getCode())); + req.setNotInStatusList(ProjectStatusConstant.CHANGE_DELETE_PASSED); Page page = projectService.pageLibWithPermission(req.page(), req); if (CollUtil.isEmpty(page.getRecords())) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/constant/ProjectStatusConstant.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/constant/ProjectStatusConstant.java new file mode 100644 index 0000000..3676367 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/constant/ProjectStatusConstant.java @@ -0,0 +1,27 @@ +package com.hz.pm.api.projectlib.model.constant; + +import java.util.Arrays; +import java.util.List; + +import static com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus.*; + +/** + *

+ * ProjectStatusConstant + *

+ * + * @author WendyYang + * @since 16:21 2024/12/18 + */ +public class ProjectStatusConstant { + + private ProjectStatusConstant() { + } + + public static final List CHANGE_STOP_DELETE_STAGE = Arrays.asList(CHANGE.getCode(), STOPPED.getCode(), DELETED.getCode()); + + public static final List CHANGE_DELETE_PASSED = Arrays.asList(CHANGE_APPLY_PASSED.getCode(), DELETED_PASSED.getCode()); + + public static final List CHANGE_STOP_DELETE_PASSED = Arrays.asList(CHANGE_APPLY_PASSED.getCode(), STOPPED_PASSED.getCode(), DELETED_PASSED.getCode()); + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/ProjectStatus.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/ProjectStatus.java index e19eee6..06e9e4d 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/ProjectStatus.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/ProjectStatus.java @@ -6,7 +6,6 @@ import lombok.AllArgsConstructor; import lombok.Getter; import java.util.Arrays; -import java.util.List; import java.util.Optional; /** @@ -94,7 +93,13 @@ public enum ProjectStatus implements IStatus { * 项目阶段:已归档 */ ARCHIVED(30000, "已归档", 30000), - ACCEPTED(30001, "已验收", 30000); + ACCEPTED(30001, "已验收", 30000), + + /** + * 增加项目删除字段 + */ + DELETED(90000, "项目删除", 90000), + DELETED_PASSED(90002, "项目已删除", 90000); private final Integer code; private final String desc; @@ -116,6 +121,4 @@ public enum ProjectStatus implements IStatus { return get(code).orElseThrow(() -> BizException.wrap("项目状态无效:%s", code)); } - public static final List STOP_CHANGE_STAGE_CODES = Arrays.asList(CHANGE.getCode(), STOPPED.getCode()); - } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java index 4301a5b..e86fef9 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java @@ -31,6 +31,7 @@ import com.hz.pm.api.projectlib.entity.ProjectGovSystemReplaceInfos; import com.hz.pm.api.projectlib.entity.PurchaseStatusChange; import com.hz.pm.api.projectlib.helper.ProjectManageUtil; import com.hz.pm.api.projectlib.manage.ProjectLibManage; +import com.hz.pm.api.projectlib.model.constant.ProjectStatusConstant; import com.hz.pm.api.projectlib.model.dto.GovSystemReplaceInfoDTO; import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; @@ -217,7 +218,7 @@ public class WorkbenchManage { Project::getDeclareAmount) .eq(Project::getProjectYear, req.getProjectYear()) .eq(req.getUnitStrip() != null, Project::getUnitStrip, req.getUnitStrip()) - .ne(Project::getStatus, ProjectStatus.CHANGE_APPLY_PASSED.getCode()) + .notIn(Project::getStatus, ProjectStatusConstant.CHANGE_DELETE_PASSED) .exists(ExistsSqlConst.PROJECT_EXISTS_STATUS_CHANGE + "and npsc.event = {0}", ProjectStateChangeEvent.COMPLIANCE_REVIEW_PASS) .eq(Project::getNewest, Boolean.TRUE); @@ -366,8 +367,7 @@ public class WorkbenchManage { .eq(Project::getProjectYear, req.getProjectYear()) .eq(req.getUnitStrip() != null, Project::getUnitStrip, req.getUnitStrip()) .eq(Project::getNewest, Boolean.TRUE) - .notIn(Project::getStatus, ProjectStatus.CHANGE_APPLY_PASSED.getCode(), - ProjectStatus.STOPPED_PASSED.getCode()) + .notIn(Project::getStatus, ProjectStatusConstant.CHANGE_STOP_DELETE_PASSED) .exists(ExistsSqlConst.PROJECT_EXISTS_STATUS_CHANGE + " and npsc.event = {0}", ProjectStateChangeEvent.PROJECT_APPLICATION_SUBMIT) .in(Project::getBuildOrgCode, CollUtils.convert(viewUnitIds, String::valueOf)); @@ -600,8 +600,7 @@ public class WorkbenchManage { return PageVo.empty(); } ProjectManageUtil.projectBaseQuery(query); - query.notIn(Project::getStatus, ProjectStatus.CHANGE_APPLY_PASSED.getCode(), - ProjectStatus.STOPPED_PASSED.getCode()); + query.notIn(Project::getStatus, ProjectStatusConstant.CHANGE_STOP_DELETE_PASSED); projectQueryByProjectStatusChange(query, ProjectStateChangeEvent.PROJECT_APPLICATION_SUBMIT); switch (req.getProcessNode()) { case PROJECT_DECLARED: @@ -721,8 +720,7 @@ public class WorkbenchManage { if (query == null) { return null; } - query.notIn(Project::getStatus, ProjectStatus.CHANGE_APPLY_PASSED.getCode() - , ProjectStatus.STOPPED_PASSED.getCode()) + query.notIn(Project::getStatus, ProjectStatusConstant.CHANGE_STOP_DELETE_PASSED) .select(Project::getProjectCode, Project::getProjectName, Project::getId, Project::getBuildOrgCode, Project::getBuildOrgName); projectQueryByProjectStatusChange(query, ProjectStateChangeEvent.PROJECT_APPLICATION_SUBMIT); @@ -1039,8 +1037,7 @@ public class WorkbenchManage { .eq(Project::getNewest, Boolean.TRUE) .eq(req.getProjectYear() != null, Project::getProjectYear, req.getProjectYear()) .eq(req.getUnitStrip() != null, Project::getUnitStrip, req.getUnitStrip()) - .notIn(Project::getStatus, ProjectStatus.CHANGE_APPLY_PASSED.getCode(), - ProjectStatus.STOPPED_PASSED.getCode()) + .notIn(Project::getStatus, ProjectStatusConstant.CHANGE_STOP_DELETE_PASSED) .eq(Project::getIsMajorProject, Boolean.TRUE) .orderByDesc(Project::getUpdateOn); UnitQueryState state = mhUnitQueryAuthHelper.listCanViewUnitIds(req.getUnitId());