From 099e629f3fcc935e532c246ddb4701f56eb6f9ea Mon Sep 17 00:00:00 2001 From: WendyYang Date: Tue, 20 Aug 2024 17:19:27 +0800 Subject: [PATCH] =?UTF-8?q?modify:=201.=20=E5=A2=9E=E5=8A=A0=E9=80=82?= =?UTF-8?q?=E9=85=8D=E6=94=B9=E9=80=A0=E8=BF=9B=E5=BA=A6=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/common/model/constant/ExistsSqlConst.java | 2 + .../controller/PurchaseController.java | 11 ++-- .../api/projectdeclared/manage/PurchaseManage.java | 59 ++++++++++++++++++++-- .../model/vo/AdaptionProgressStatVO.java | 43 ++++++++++++++++ 4 files changed, 106 insertions(+), 9 deletions(-) create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/AdaptionProgressStatVO.java diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/model/constant/ExistsSqlConst.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/constant/ExistsSqlConst.java index 2cec068..a270002 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/model/constant/ExistsSqlConst.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/constant/ExistsSqlConst.java @@ -23,4 +23,6 @@ public class ExistsSqlConst { public static final String PROJECT_EXISTS_PURCHASE_STATUS_CHANGE = "select 1 from nd_purchase_status_change npsc where npsc.project_code = nd_project.project_code "; + public static final String PURCHASE_EXISTS_PURCHASE_STATUS_CHANGE = "select 1 from nd_purchase_status_change npsc where npsc.bid_id = nd_purchase.id "; + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/PurchaseController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/PurchaseController.java index 302e358..7b5510e 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/PurchaseController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/PurchaseController.java @@ -7,10 +7,7 @@ import com.hz.pm.api.projectdeclared.model.dto.XcfhxApplyEditDTO; import com.hz.pm.api.projectdeclared.model.dto.XcfhxApplySaveDTO; import com.hz.pm.api.projectdeclared.model.req.*; import com.hz.pm.api.projectdeclared.model.req.SubmitPurchaseNoticeReq.PurchaseNoticeTenderDTO; -import com.hz.pm.api.projectdeclared.model.vo.PurchaseVO; -import com.hz.pm.api.projectdeclared.model.vo.PurchaseAdaptionListVO; -import com.hz.pm.api.projectdeclared.model.vo.XcfhxApplyListVO; -import com.hz.pm.api.projectdeclared.model.vo.XinchuangVO; +import com.hz.pm.api.projectdeclared.model.vo.*; import com.hz.pm.api.projectlib.model.req.ProjectListReq; import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; import com.ningdatech.basic.model.PageVo; @@ -82,6 +79,12 @@ public class PurchaseController { purchaseManage.submitPurchaseRecord(req); } + @GetMapping("/adaptionProgressStatistics") + @ApiOperation("获取采购进度统计") + public AdaptionProgressStatVO adaptionProgressStatistics() { + return purchaseManage.adaptionProgressStatistics(); + } + @GetMapping("/pageAdaption") @ApiOperation("获取适配改造列表") public PageVo pageAdaption(PurchaseAdaptionListReq req) { 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 35d6802..c067bf4 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 @@ -18,6 +18,7 @@ import com.google.common.collect.Lists; 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.statemachine.event.TenderStateChangeEvent; import com.hz.pm.api.common.statemachine.util.*; import com.hz.pm.api.common.util.*; import com.hz.pm.api.external.MhApiClient; @@ -36,10 +37,7 @@ import com.hz.pm.api.projectdeclared.model.enumerization.PurchaseScopeEnum; import com.hz.pm.api.projectdeclared.model.enumerization.PurchaseSourceTypeEnum; import com.hz.pm.api.projectdeclared.model.req.*; import com.hz.pm.api.projectdeclared.model.req.SubmitPurchaseNoticeReq.PurchaseNoticeTenderDTO; -import com.hz.pm.api.projectdeclared.model.vo.PurchaseAdaptionListVO; -import com.hz.pm.api.projectdeclared.model.vo.PurchaseVO; -import com.hz.pm.api.projectdeclared.model.vo.XcfhxApplyListVO; -import com.hz.pm.api.projectdeclared.model.vo.XinchuangVO; +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.entity.Project; @@ -462,11 +460,62 @@ public class PurchaseManage { projectService.updateById(project); } + public AdaptionProgressStatVO adaptionProgressStatistics() { + LambdaQueryWrapper query = Wrappers.lambdaQuery(Purchase.class) + .select(Purchase::getStatus, Purchase::getId) + .eq(Purchase::getBidType, BidTypeEnum.BUILD_APP.getCode()) + .exists(ExistsSqlConst.PURCHASE_EXISTS_PURCHASE_STATUS_CHANGE + + " and npsc.event = {0}", TenderStateChangeEvent.SUBMIT_PURCHASE_CONSTRUCTION_INFO) + .notExists(ExistsSqlConst.PURCHASE_EXISTS_PROJECT + + "and np.stage in ({0}, {1})", ProjectStatus.STOPPED.getCode(), + ProjectStatus.CHANGE.getCode()) + .orderByDesc(Purchase::getCreateOn); + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + if (!purchaseService.buildPurchaseQueryPermission(query, user)) { + return null; + } + List purchases = purchaseService.list(query); + Map statusCountMap = CollUtils.groupCount(purchases, + w -> { + ITenderStatus status = TenderMainStatus.getNoNull(w.getStatus()); + if (TenderMainStatus.TO_BE_SUBMIT_OPERATION_PLAN.eq(status)) { + return TenderMainStatus.TO_BE_SUBMIT_OPERATION_PLAN; + } else if (TenderMainStatus.WAIT_ORG_CONFIRM.eq(status)) { + return TenderMainStatus.WAIT_ORG_CONFIRM; + } else if (TenderAdaptStatus.WITHOUT_ADAPT_INFO.eq(status) + || TenderAdaptStatus.ADAPT_INFO_AUDIT.eq(status) + || TenderAdaptStatus.ADAPT_INFO_FAILED.eq(status)) { + return TenderAdaptStatus.WITHOUT_ADAPT_INFO; + } else if (TenderSelfTestStatus.WITHOUT_SELF_TEST_INFO.eq(status) + || TenderSelfTestStatus.SELF_TEST_INFO_AUDIT.eq(status) + || TenderSelfTestStatus.SELF_TEST_INFO_FAILED.eq(status)) { + return TenderSelfTestStatus.WITHOUT_SELF_TEST_INFO; + } else if (TenderTestValidStatus.WITHOUT_TEST_VALID_INFO.eq(status) + || TenderTestValidStatus.TEST_VALID_INFO_AUDIT.eq(status) + || TenderTestValidStatus.TEST_VALID_INFO_FAILED.eq(status)) { + return TenderTestValidStatus.WITHOUT_TEST_VALID_INFO; + } else { + return status; + } + }); + return AdaptionProgressStatVO.builder() + .withoutAdaptionInfo(statusCountMap.getOrDefault(TenderAdaptStatus.WITHOUT_ADAPT_INFO, 0L)) + .withoutOperationCount(statusCountMap.getOrDefault(TenderMainStatus.TO_BE_SUBMIT_OPERATION_PLAN, 0L)) + .withoutOrgConfirmCount(statusCountMap.getOrDefault(TenderMainStatus.WAIT_ORG_CONFIRM, 0L)) + .withoutSelfTestCount(statusCountMap.getOrDefault(TenderSelfTestStatus.WITHOUT_SELF_TEST_INFO, 0L)) + .withoutTestValidCount(statusCountMap.getOrDefault(TenderTestValidStatus.WITHOUT_TEST_VALID_INFO, 0L)) + .totalCount(purchases.size()) + .build(); + } + private PageVo queryData(PurchaseAdaptionListReq req) { LambdaQueryWrapper query = Wrappers.lambdaQuery(Purchase.class) .eq(Purchase::getBidType, BidTypeEnum.BUILD_APP.getCode()) + .exists(ExistsSqlConst.PURCHASE_EXISTS_PURCHASE_STATUS_CHANGE + + " npsc.event = {0}", TenderStateChangeEvent.SUBMIT_PURCHASE_CONSTRUCTION_INFO) .notExists(ExistsSqlConst.PURCHASE_EXISTS_PROJECT - + "and np.stage = {0}", ProjectStatus.STOPPED.getCode()) + + "and np.stage in ({0}, {1})", ProjectStatus.STOPPED.getCode(), + ProjectStatus.CHANGE.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/projectdeclared/model/vo/AdaptionProgressStatVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/AdaptionProgressStatVO.java new file mode 100644 index 0000000..5f41f0a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/AdaptionProgressStatVO.java @@ -0,0 +1,43 @@ +package com.hz.pm.api.projectdeclared.model.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; +import lombok.experimental.Tolerate; + +/** + *

+ * AdaptionProgressStatVO + *

+ * + * @author WendyYang + * @since 16:46 2024/8/20 + */ +@Data +@Builder +public class AdaptionProgressStatVO { + + @Tolerate + public AdaptionProgressStatVO() { + // 默认构造方法 + } + + @ApiModelProperty("总数") + private Integer totalCount; + + @ApiModelProperty("待填写实施计划") + private Long withoutOperationCount; + + @ApiModelProperty("待上传开工文件") + private Long withoutAdaptionInfo; + + @ApiModelProperty("待上传自测材料") + private Long withoutSelfTestCount; + + @ApiModelProperty("待上传测试验证材料") + private Long withoutTestValidCount; + + @ApiModelProperty("待单位确认") + private Long withoutOrgConfirmCount; + +}