Browse Source

modify:

1. 修复bug;
tags/24082201
WendyYang 4 months ago
parent
commit
a98da4b888
2 changed files with 15 additions and 10 deletions
  1. +11
    -4
      hz-pm-api/src/main/java/com/hz/pm/api/common/handler/GlobalResponseHandler.java
  2. +4
    -6
      hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java

+ 11
- 4
hz-pm-api/src/main/java/com/hz/pm/api/common/handler/GlobalResponseHandler.java View File

@@ -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<Object> {

private static final String SWAGGER_CLASS_PREFIX = "springfox.documentation";

@Override
public boolean supports(MethodParameter methodParameter, Class<? extends HttpMessageConverter<?>> aClass) {
public boolean supports(@NonNull MethodParameter methodParameter, @NonNull Class<? extends HttpMessageConverter<?>> aClass) {
return filter(methodParameter);
}

@Override
public Object beforeBodyWrite(Object o, MethodParameter methodParameter, MediaType mediaType,
Class<? extends HttpMessageConverter<?>> aClass, ServerHttpRequest serverHttpRequest,
ServerHttpResponse serverHttpResponse) {
public Object beforeBodyWrite(Object o, @NonNull MethodParameter methodParameter, @NonNull MediaType mediaType,
@NonNull Class<? extends HttpMessageConverter<?>> aClass, @NonNull ServerHttpRequest serverHttpRequest,
@NonNull ServerHttpResponse serverHttpResponse) {
if (o instanceof String) {
return JSONUtil.toJsonStr(ApiResponse.ofSuccess(o));
}
return ApiResponse.ofSuccess(o);
}



+ 4
- 6
hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java View File

@@ -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;

/**
* <p>
@@ -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<Long> 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<String, List<ProjectStatusChange>> projectStatusChangeMap = new HashMap<>();
for (WorkbenchProcessNode node : WorkbenchProcessNode.ALL) {
if (!projects.isEmpty()) {
ProjectProcessStatVO currStat = builder()
ProjectProcessStatVO currStat = ProjectProcessStatVO.builder()
.stageName(node.getName())
.stage(node)
.build();


Loading…
Cancel
Save