From 9e90022fedbcbc8bf82a7671adee7fdcd954bc5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E9=B9=8F=E9=A3=9E?= Date: Fri, 15 May 2026 10:39:33 +0800 Subject: [PATCH] =?UTF-8?q?refactor(quotation):=20=E4=BC=98=E5=8C=96PlanSe?= =?UTF-8?q?archItemVO=E5=AF=B9=E8=B1=A1=E6=9E=84=E9=80=A0=E5=8F=8A?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 替换多区域字典代码为DirectSalesCategory以准确获取分类ID - 在分页数据中设置总数以支持分页展示 - 修改循环中对象处理,避免直接修改原有对象,改为构建新的PlanSearchItemVO对象 - 新建PlanSearchItemVO实例时链式调用设置属性,保证数据完整性和代码简洁 - 在PlanSearchItemVO类上添加@Accessors(chain = true)注解支持链式调用 --- .../common/pojo/vo/PlanSearchItemVO.java | 3 ++ .../controller/app/PlanController.java | 29 +++++++++++++++---- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/PlanSearchItemVO.java b/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/PlanSearchItemVO.java index 6743ffb4..acf626f7 100644 --- a/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/PlanSearchItemVO.java +++ b/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/PlanSearchItemVO.java @@ -2,6 +2,8 @@ package com.nflg.mobilebroken.common.pojo.vo; import com.nflg.mobilebroken.common.util.NumberUtil; import lombok.Data; +import lombok.experimental.Accessors; +import org.springframework.data.annotation.AccessType; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; @@ -9,6 +11,7 @@ import java.math.BigDecimal; import java.util.Objects; @Data +@Accessors(chain = true) public class PlanSearchItemVO { private Long id; diff --git a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/app/PlanController.java b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/app/PlanController.java index 0625e552..f3d6ed34 100644 --- a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/app/PlanController.java +++ b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/app/PlanController.java @@ -137,7 +137,7 @@ public class PlanController extends ControllerBase { boolean multiRegionQuotations = isMultiRegionQuotationsUser(); List categoryIds = new ArrayList<>(); if (multiRegionQuotations) { - categoryIds = dictionaryItemService.getListByDictionaryCode("MultiRegionQuotationsSupplier") + categoryIds = dictionaryItemService.getListByDictionaryCode("DirectSalesCategory") .stream() .map(DictionaryItem::getId) .collect(Collectors.toList()); @@ -146,6 +146,7 @@ public class PlanController extends ControllerBase { } List prices = priceService.getAllModelPrice(); Map> fgroup = items.stream().collect(Collectors.groupingBy(PlanSearchItemVO::getModelId)); + pageData.setTotal(fgroup.size()); for (Map.Entry> entry : fgroup.entrySet()) { if (index >= startIndex && index < endIndex) { categoryIds.forEach(categoryId -> { @@ -156,14 +157,30 @@ public class PlanController extends ControllerBase { .collect(Collectors.toList()); if (CollectionUtil.isEmpty(vos)) { entry.getValue().forEach(item -> { - item.setStandardPrice(salePrice); - item.setAreaId(categoryId); - datas.add(item); + datas.add(new PlanSearchItemVO() + .setPlanId(item.getPlanId()) + .setIsDefault(item.getIsDefault()) + .setModelId(item.getModelId()) + .setModelNo(item.getModelNo()) + .setName(item.getName()) + .setRatio(item.getRatio()) + .setAreaId(categoryId) + .setStandardPrice(salePrice) + ); }); } else { vos.forEach(item -> { - item.setStandardPrice(salePrice); - datas.add(item); + datas.add(new PlanSearchItemVO() + .setId(item.getId()) + .setPlanId(item.getPlanId()) + .setIsDefault(item.getIsDefault()) + .setModelId(item.getModelId()) + .setModelNo(item.getModelNo()) + .setName(item.getName()) + .setRatio(item.getRatio()) + .setAreaId(categoryId) + .setStandardPrice(salePrice) + ); }); } });