From a98da4b88850204cbe2e956882e2aa44195051ea Mon Sep 17 00:00:00 2001 From: WendyYang Date: Wed, 21 Aug 2024 21:49:30 +0800 Subject: [PATCH] =?UTF-8?q?modify:=201.=20=E4=BF=AE=E5=A4=8Dbug=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hz/pm/api/common/handler/GlobalResponseHandler.java | 15 +++++++++++---- .../com/hz/pm/api/workbench/manage/WorkbenchManage.java | 10 ++++------ 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/handler/GlobalResponseHandler.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/handler/GlobalResponseHandler.java index 54967fa..f536cfc 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/handler/GlobalResponseHandler.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/handler/GlobalResponseHandler.java @@ -1,11 +1,14 @@ package com.hz.pm.api.common.handler; +import cn.hutool.json.JSONUtil; import com.ningdatech.basic.model.ApiResponse; +import lombok.RequiredArgsConstructor; import org.springframework.core.MethodParameter; import org.springframework.http.MediaType; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.server.ServerHttpRequest; import org.springframework.http.server.ServerHttpResponse; +import org.springframework.lang.NonNull; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice; @@ -44,19 +47,23 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice; "com.hz.pm.api.gov.controller", "com.hz.pm.api.open.controller" }) +@RequiredArgsConstructor public class GlobalResponseHandler implements ResponseBodyAdvice { private static final String SWAGGER_CLASS_PREFIX = "springfox.documentation"; @Override - public boolean supports(MethodParameter methodParameter, Class> aClass) { + public boolean supports(@NonNull MethodParameter methodParameter, @NonNull Class> aClass) { return filter(methodParameter); } @Override - public Object beforeBodyWrite(Object o, MethodParameter methodParameter, MediaType mediaType, - Class> aClass, ServerHttpRequest serverHttpRequest, - ServerHttpResponse serverHttpResponse) { + public Object beforeBodyWrite(Object o, @NonNull MethodParameter methodParameter, @NonNull MediaType mediaType, + @NonNull Class> aClass, @NonNull ServerHttpRequest serverHttpRequest, + @NonNull ServerHttpResponse serverHttpResponse) { + if (o instanceof String) { + return JSONUtil.toJsonStr(ApiResponse.ofSuccess(o)); + } return ApiResponse.ofSuccess(o); } 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 617d564..8d2a0c1 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 @@ -13,11 +13,9 @@ import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.common.model.constant.ExistsSqlConst; import com.hz.pm.api.common.statemachine.event.*; import com.hz.pm.api.common.util.DecimalUtil; -import com.hz.pm.api.projectdeclared.manage.PurchaseManage; import com.hz.pm.api.projectdeclared.model.entity.Contract; import com.hz.pm.api.projectdeclared.model.entity.Purchase; import com.hz.pm.api.projectdeclared.model.enumerization.BidTypeEnum; -import com.hz.pm.api.projectdeclared.model.vo.AdaptionProgressStatVO; import com.hz.pm.api.projectdeclared.service.IContractService; import com.hz.pm.api.projectdeclared.service.IPurchaseService; import com.hz.pm.api.projectdeclared.utils.ProjectIdCodeCacheUtil; @@ -73,7 +71,7 @@ import java.util.function.BiFunction; import java.util.function.Predicate; import java.util.stream.Collectors; -import static com.hz.pm.api.workbench.model.vo.ProjectProcessStatVO.*; +import static com.hz.pm.api.workbench.model.vo.ProjectProcessStatVO.TenderAdaptFinishStatVO; /** *

@@ -101,7 +99,6 @@ public class WorkbenchManage { private final MhUnitCache mhUnitCache; private final IProjectGovSystemReplaceInfosService systemReplaceInfosService; private final IPurchaseStatusChangeService purchaseStatusChangeService; - private final PurchaseManage purchaseManage; public WorkbenchVO getWorkbenchData(Integer year) { WorkbenchVO res = new WorkbenchVO(); @@ -191,6 +188,7 @@ public class WorkbenchManage { .ne(Project::getStatus, ProjectStatus.STOPPED_PASSED.getCode()) .select(Project::getReviewAmount, Project::getApprovalGovOwnFinanceAmount, Project::getId) .eq(Project::getProjectYear, req.getProjectYear()) + .eq(req.getUnitStrip() != null, Project::getUnitStrip, req.getUnitStrip()) .eq(Project::getNewest, Boolean.TRUE); List viewUnitIds = mhUnitCache.getViewChildIdsRecursion(req.getUnitId()); projectQuery.in(Project::getBuildOrgCode, CollUtils.convert(viewUnitIds, String::valueOf)); @@ -198,7 +196,7 @@ public class WorkbenchManage { if (projects.isEmpty()) { return retDetail; } - BigDecimal approvalAmount = DecimalUtil.sum(projects, Project::getApprovalGovOwnFinanceAmount); + BigDecimal approvalAmount = DecimalUtil.sum(projects, Project::getApprovalAmount); BigDecimal reviewAmount = DecimalUtil.sum(projects, Project::getReviewAmount); retDetail.setTotalApprovalAmount(approvalAmount); retDetail.setTotalReviewAmount(reviewAmount); @@ -338,7 +336,7 @@ public class WorkbenchManage { Map> projectStatusChangeMap = new HashMap<>(); for (WorkbenchProcessNode node : WorkbenchProcessNode.ALL) { if (!projects.isEmpty()) { - ProjectProcessStatVO currStat = builder() + ProjectProcessStatVO currStat = ProjectProcessStatVO.builder() .stageName(node.getName()) .stage(node) .build();