Browse Source

modify:

1. 项目统计修改;
tags/24082801
WendyYang 4 months ago
parent
commit
241c5c5304
6 changed files with 130 additions and 20 deletions
  1. +8
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/PurchaseController.java
  2. +88
    -18
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java
  3. +29
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/PurchaseProgressStatVO.java
  4. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/helper/ProjectManageUtil.java
  5. +1
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/TenderMainStatus.java
  6. +3
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectListReq.java

+ 8
- 1
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/PurchaseController.java View File

@@ -37,8 +37,15 @@ import java.util.List;
@Api(value = "PurchaseController", tags = "申报管理-采购结果备案")
@RequiredArgsConstructor
public class PurchaseController {

private final PurchaseManage purchaseManage;

@ApiOperation(value = "招标采购进度统计")
@GetMapping("/purchaseProgressStatistics")
public PurchaseProgressStatVO purchaseProgressStatistics(@ModelAttribute ProjectListReq req) {
return purchaseManage.purchaseProgressStatistics(req);
}

@ApiOperation(value = "待采购结果备案列表", notes = "待采购结果备案列表")
@GetMapping("/project-list")
public PageVo<ProjectLibListItemVO> projectList(@ModelAttribute ProjectListReq req) {
@@ -159,7 +166,7 @@ public class PurchaseController {
@PostMapping("/orgConfirm")
@ApiOperation("单位确认")
@WebLog("单位确认")
public void orgConfirm(@RequestBody @Valid PurchaseOrgConfirmReq req){
public void orgConfirm(@RequestBody @Valid PurchaseOrgConfirmReq req) {
purchaseManage.purchaseOrgConfirm(req);
}



+ 88
- 18
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java View File

@@ -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.ProjectStateChangeEvent;
import com.hz.pm.api.common.statemachine.event.TenderStateChangeEvent;
import com.hz.pm.api.common.statemachine.util.*;
import com.hz.pm.api.common.util.*;
@@ -124,6 +125,38 @@ public class PurchaseManage {
private final MhXchxFileHelper mhXchxFileHelper;
private final IPurchaseStatusChangeService purchaseStatusChangeService;

public PurchaseProgressStatVO purchaseProgressStatistics(ProjectListReq req) {
UserInfoDetails user = LoginUserUtil.loginUserDetail();
LambdaQueryWrapper<Project> query = ProjectManageUtil.projectQuery(req);
//数据权限
permission(query, user);
//待采购状态
query.notIn(Project::getStage, ProjectStatus.STOPPED.getCode(), ProjectStatus.CHANGE.getCode())
.eq(Project::getStage, ProjectStatus.PROJECT_APPROVED.getCode())
.eq(Project::getNewest, Boolean.TRUE)
.exists(ExistsSqlConst.PROJECT_EXISTS_STATUS_CHANGE +
" and npsc.event = {0}", ProjectStateChangeEvent.DECLARED_RECORD_PASS)
.select(Project::getId);
List<Project> projects = projectService.list(query);
if (projects.isEmpty()) {
return null;
}
List<Long> projectIds = CollUtils.fieldList(projects, Project::getId);
List<Purchase> purchases = purchaseService.list(Wrappers.lambdaQuery(Purchase.class)
.in(Purchase::getProjectId, projectIds)
.select(Purchase::getProjectId, Purchase::getStatus));
Map<Long, Collection<Purchase>> projectPurchaseMap = CollUtils.listToMap(projects, Project::getId,
w -> CollUtil.filterNew(purchases, x -> x.getProjectId().equals(w.getId())));
PurchaseProgressStatVO stat = new PurchaseProgressStatVO();
stat.setOnPurchaseCount(CollUtil.count(projectPurchaseMap.values(),
w -> CollUtil.anyMatch(w, x -> TenderMainStatus.TO_BE_SUBMIT_PURCHASE_CONSTRUCTION_INFO.eq(x.getStatus()))));
stat.setToBePurchaseCount(CollUtil.count(projectPurchaseMap.values(), Collection::isEmpty));
stat.setPurchaseFinishedCount(CollUtil.count(projectPurchaseMap.values(),
w -> CollUtil.anyMatch(w, x -> !TenderMainStatus.TO_BE_SUBMIT_PURCHASE_CONSTRUCTION_INFO.eq(x.getStatus()))));
stat.setTotalCount(projects.size());
return stat;
}

/**
* 待采购的-项目列表
*
@@ -137,23 +170,56 @@ public class PurchaseManage {
//数据权限
permission(query, user);
//待采购状态
query.in(Project::getStatus, Lists.newArrayList(ProjectStatus.TO_BE_PURCHASED.getCode(),
ProjectStatus.ON_PURCHASING.getCode()));
query.notIn(Project::getStage, ProjectStatus.STOPPED.getCode(), ProjectStatus.CHANGE.getCode());
query.eq(Project::getStage, ProjectStatus.PROJECT_APPROVED.getCode());
query.eq(Project::getNewest, Boolean.TRUE);
query.orderByAsc(Project::getApprovalDate);
if (req.getBidStatus() != null) {
query.exists(ExistsSqlConst.PROJECT_EXISTS_PURCHASE +
"and (np.status = {0} or np.xcfhx_apply_status = {0})", req.getBidStatus());
ProjectManageUtil.projectBaseQuery(query);
if (req.getTabStatus() != null) {
if (TenderMainStatus.TO_BE_SUBMIT_PURCHASE_CONSTRUCTION_INFO.eq(req.getTabStatus())) {
query.exists(ExistsSqlConst.PROJECT_EXISTS_PURCHASE +
" and np.status = '{0}' ", req.getTabStatus());
} else if (TenderMainStatus.PURCHASE_FINISHED.eq(req.getTabStatus())) {
query.exists(ExistsSqlConst.PROJECT_EXISTS_PURCHASE_STATUS_CHANGE +
" and npsc.event = {0} ", TenderStateChangeEvent.SUBMIT_PURCHASE_CONSTRUCTION_INFO);
} else if (ProjectStatus.TO_BE_PURCHASED.eq(req.getTabStatus())) {
query.eq(Project::getStatus, ProjectStatus.TO_BE_PURCHASED);
} else {
return PageVo.empty();
}
} else {
query.exists(ExistsSqlConst.PROJECT_EXISTS_STATUS_CHANGE +
" and npsc.event = {0}", ProjectStateChangeEvent.DECLARED_RECORD_PASS);
}
Page<Project> page = projectService.page(req.page(), query);
if (page.getTotal() == 0) {
return PageVo.empty();
}
List<Long> projectIds = CollUtils.fieldList(page.getRecords(), Project::getId);
List<Purchase> purchases = purchaseService.listByProjectIds(projectIds);
Map<Long, List<Purchase>> purchaseMap = CollUtils.group(purchases, Purchase::getProjectId);
Map<Long, BigDecimal> contractAmountMap = contractService.listContractAmountByProjectIds(projectIds);
Map<Long, List<Purchase>> purchaseMap;
Map<Long, BigDecimal> contractAmountMap;
if (!ProjectStatus.TO_BE_PURCHASED.eq(req.getTabStatus())) {
List<Long> projectIds = CollUtils.fieldList(page.getRecords(), Project::getId);
LambdaQueryWrapper<Purchase> purchaseQuery = Wrappers.lambdaQuery(Purchase.class)
.in(Purchase::getProjectId, projectIds);
if (req.getTabStatus() != null) {
if (TenderMainStatus.TO_BE_SUBMIT_PURCHASE_CONSTRUCTION_INFO.eq(req.getTabStatus())) {
purchaseQuery.eq(Purchase::getStatus, req.getStatus());
} else if (TenderMainStatus.PURCHASE_FINISHED.eq(req.getTabStatus())) {
purchaseQuery.exists(ExistsSqlConst.PURCHASE_EXISTS_PURCHASE_STATUS_CHANGE +
" and npsc.event = {0} ", TenderStateChangeEvent.SUBMIT_PURCHASE_CONSTRUCTION_INFO);
}
}
List<Purchase> purchases = purchaseService.list(purchaseQuery);
purchaseMap = CollUtils.group(purchases, Purchase::getProjectId);
if (purchaseMap.isEmpty()) {
contractAmountMap = Collections.emptyMap();
} else {
contractAmountMap = contractService.listContractAmountByProjectIds(projectIds);
}
} else {
purchaseMap = Collections.emptyMap();
contractAmountMap = Collections.emptyMap();
}
List<ProjectLibListItemVO> records = CollUtils.convert(page.getRecords(), w -> {
ProjectLibListItemVO item = new ProjectLibListItemVO();
item.setId(w.getId());
@@ -165,24 +231,28 @@ public class PurchaseManage {
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.setReviewAmount(w.getReviewAmount());
item.setApprovalDate(w.getApprovalDate());
List<Purchase> currPurchases = purchaseMap.get(w.getId());
if (currPurchases != null) {
item.setTenders(CollUtils.convert(currPurchases, x -> {
List<TenderListInfoVO> tenders = new ArrayList<>();
for (Purchase x : currPurchases) {
TenderMainStatus tenderMainStatus;
if (!TenderMainStatus.TO_BE_SUBMIT_PURCHASE_CONSTRUCTION_INFO.eq(x.getStatus())) {
tenderMainStatus = TenderMainStatus.PURCHASE_FINISHED;
} else {
tenderMainStatus = TenderMainStatus.TO_BE_SUBMIT_PURCHASE_CONSTRUCTION_INFO;
}
TenderListInfoVO tender = new TenderListInfoVO();
tender.setBidName(x.getBidName());
tender.setBidId(x.getId());
tender.setBidStatus(x.getStatus());
tender.setBidStatusName(TenderMainStatus.getDesc(x.getStatus()));
tender.setBidStatus(tenderMainStatus.getCode());
tender.setBidStatusName(tenderMainStatus.getDesc());
tender.setConstructionAmount(contractAmountMap.get(x.getId()));
return tender;
}));
tenders.add(tender);
item.setTenders(tenders);
}
}
return item;
});


+ 29
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/PurchaseProgressStatVO.java View File

@@ -0,0 +1,29 @@
package com.hz.pm.api.projectdeclared.model.vo;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
* <p>
* PurchaseProgressStatisticsVO
* </p>
*
* @author WendyYang
* @since 11:58 2024/8/27
*/
@Data
public class PurchaseProgressStatVO {

@ApiModelProperty("总数量")
private Integer totalCount;

@ApiModelProperty("待采购数量")
private Integer toBePurchaseCount;

@ApiModelProperty("采购中数量")
private Integer onPurchaseCount;

@ApiModelProperty("已采购数量")
private Integer purchaseFinishedCount;

}

+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/helper/ProjectManageUtil.java View File

@@ -96,7 +96,7 @@ public class ProjectManageUtil {

public static void projectBaseQuery(LambdaQueryWrapper<Project> query) {
query.select(Project::getId, Project::getStage, Project::getStatus, Project::getProjectCode,
Project::getBuildOrgCode, Project::getBuildOrgName, Project::getApprovalAmount,
Project::getBuildOrgCode, Project::getBuildOrgName, Project::getApprovalAmount, Project::getApprovalDate,
Project::getCreateOn, Project::getProjectName, Project::getProjectYear,
Project::getDeclareAmount, Project::getReviewAmount, Project::getUnitStrip);
}


+ 1
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/TenderMainStatus.java View File

@@ -25,6 +25,7 @@ import java.util.stream.Stream;
public enum TenderMainStatus implements ITenderStatus {

TO_BE_SUBMIT_PURCHASE_CONSTRUCTION_INFO(ProjectStatus.ON_PURCHASING, 101, "待填写采购&合同信息"),
PURCHASE_FINISHED(ProjectStatus.ON_PURCHASING, 106, "采购完成"),
TO_BE_SUBMIT_OPERATION_PLAN(ProjectStatus.ON_ADAPTING, 103, "待填写实施计划"),
// 衔接状态
WAIT_ORG_CONFIRM(ProjectStatus.ON_ADAPTING, 104, "待单位确认"),


+ 3
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectListReq.java View File

@@ -127,4 +127,7 @@ public class ProjectListReq extends PagePo {
@ApiModelProperty("标项状态")
private Integer bidStatus;

@ApiModelProperty("tab状态")
private Integer tabStatus;

}

Loading…
Cancel
Save