From 5e6a56e193280f2b5978792710df498efa1f3a3e Mon Sep 17 00:00:00 2001 From: paulGao Date: Thu, 9 Jun 2022 09:15:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E4=B8=AA=E5=8F=AF=E8=83=BD=E5=87=BA?= =?UTF-8?q?=E7=8E=B0=E7=9A=84=E8=8E=B7=E5=8F=96=E5=95=86=E5=93=81=E5=88=86?= =?UTF-8?q?=E7=B1=BB=E7=9A=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../goods/serviceimpl/StoreGoodsLabelServiceImpl.java | 2 +- .../modules/order/cart/render/impl/SkuFreightRender.java | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/StoreGoodsLabelServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/StoreGoodsLabelServiceImpl.java index 6d5a7d8d1..6d5f9a0eb 100644 --- a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/StoreGoodsLabelServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/StoreGoodsLabelServiceImpl.java @@ -56,7 +56,7 @@ public List listByStoreId(String storeId) { StoreGoodsLabelVO storeGoodsLabelVO = new StoreGoodsLabelVO(storeGoodsLabel.getId(), storeGoodsLabel.getLabelName(), storeGoodsLabel.getLevel(), storeGoodsLabel.getSortOrder()); List storeGoodsLabelVOChildList = new ArrayList<>(); list.stream() - .filter(label -> label.getParentId().equals(storeGoodsLabel.getId())) + .filter(label -> label.getParentId() != null && label.getParentId().equals(storeGoodsLabel.getId())) .forEach(storeGoodsLabelChild -> storeGoodsLabelVOChildList.add(new StoreGoodsLabelVO(storeGoodsLabelChild.getId(), storeGoodsLabelChild.getLabelName(), storeGoodsLabelChild.getLevel(), storeGoodsLabelChild.getSortOrder()))); storeGoodsLabelVO.setChildren(storeGoodsLabelVOChildList); storeGoodsLabelVOList.add(storeGoodsLabelVO); diff --git a/framework/src/main/java/cn/lili/modules/order/cart/render/impl/SkuFreightRender.java b/framework/src/main/java/cn/lili/modules/order/cart/render/impl/SkuFreightRender.java index e7e7cc31a..799c62b8d 100644 --- a/framework/src/main/java/cn/lili/modules/order/cart/render/impl/SkuFreightRender.java +++ b/framework/src/main/java/cn/lili/modules/order/cart/render/impl/SkuFreightRender.java @@ -11,7 +11,6 @@ import cn.lili.modules.store.entity.enums.FreightTemplateEnum; import cn.lili.modules.store.entity.vos.FreightTemplateVO; import cn.lili.modules.store.service.FreightTemplateService; -import org.apache.xmlbeans.impl.store.Cur; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -51,16 +50,16 @@ public void render(TradeDTO tradeDTO) { Map> freightGroups = freightTemplateGrouping(cartSkuVOS); //循环运费模版 - for (String freightTemplateId : freightGroups.keySet()) { + for (Map.Entry> freightTemplateGroup : freightGroups.entrySet()) { //商品id列表 - List skuIds = freightGroups.get(freightTemplateId); + List skuIds = freightTemplateGroup.getValue(); //当前购物车商品列表 List currentCartSkus = cartSkuVOS.stream().filter(item -> skuIds.contains(item.getGoodsSku().getId())).collect(Collectors.toList()); //寻找对应对商品运费计算模版 - FreightTemplateVO freightTemplate = freightTemplateService.getFreightTemplate(freightTemplateId); + FreightTemplateVO freightTemplate = freightTemplateService.getFreightTemplate(freightTemplateGroup.getKey()); if (freightTemplate != null && freightTemplate.getFreightTemplateChildList() != null && !freightTemplate.getFreightTemplateChildList().isEmpty()) { @@ -99,7 +98,7 @@ public void render(TradeDTO tradeDTO) { Double count = currentCartSkus.stream().mapToDouble(item -> // 根据计费规则 累加计费基数 freightTemplateChildDTO.getPricingMethod().equals(FreightTemplateEnum.NUM.name()) ? - item.getNum() : + item.getNum().doubleValue() : CurrencyUtil.mul(item.getNum(), item.getGoodsSku().getWeight()) ).sum();