From 94f62d3fe235da09a883f29da36f6e72273391f3 Mon Sep 17 00:00:00 2001 From: "kuang.yife" Date: Mon, 13 Feb 2023 00:08:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=A3=E7=82=B9=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/goods/GoodsController.java | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/goods/GoodsController.java b/ghy-admin/src/main/java/com/ghy/web/controller/goods/GoodsController.java index f1843f03..d74ed7e1 100644 --- a/ghy-admin/src/main/java/com/ghy/web/controller/goods/GoodsController.java +++ b/ghy-admin/src/main/java/com/ghy/web/controller/goods/GoodsController.java @@ -286,23 +286,23 @@ public class GoodsController extends BaseController { goodsStandards.stream().forEach(goodsStandard -> { if (StringUtils.isEmpty(goodsStandard.getGoodsUnit())) { goodsStandard.setGoodsUnit(result.getGoodsUnit()); - BigDecimal finalPrice = BigDecimal.ZERO; - // 获取规格的扣点 - DeptGoodsCategory deptGoodsCategory = deptGoodsCategoryService.get(goodsStandard.getDeptGoodsCategoryId()); - if(deptGoodsCategory.getOneRate() != null){ - finalPrice = finalPrice.add(BigDecimal.valueOf(Double.parseDouble(deptGoodsCategory.getOneRate())).multiply(goodsStandard.getGoodsPrice())); - } - if(deptGoodsCategory.getTwoRate() != null){ - finalPrice = finalPrice.add(BigDecimal.valueOf(Double.parseDouble(deptGoodsCategory.getTwoRate())).multiply(goodsStandard.getGoodsPrice())); - } - if(deptGoodsCategory.getThreeRate() != null){ - finalPrice = finalPrice.add(BigDecimal.valueOf(Double.parseDouble(deptGoodsCategory.getThreeRate())).multiply(goodsStandard.getGoodsPrice())); - } - if(goodsStandard.getExtMoney() != null){ - finalPrice = finalPrice.add(goodsStandard.getExtMoney()); - } - goodsStandard.setFinalPrice(finalPrice); } + BigDecimal finalPrice = BigDecimal.ZERO; + // 获取规格的扣点 + DeptGoodsCategory deptGoodsCategory = deptGoodsCategoryService.get(goodsStandard.getDeptGoodsCategoryId()); + if(deptGoodsCategory.getOneRate() != null){ + finalPrice = finalPrice.add(BigDecimal.valueOf(Double.parseDouble(deptGoodsCategory.getOneRate())).multiply(goodsStandard.getGoodsPrice())); + } + if(deptGoodsCategory.getTwoRate() != null){ + finalPrice = finalPrice.add(BigDecimal.valueOf(Double.parseDouble(deptGoodsCategory.getTwoRate())).multiply(goodsStandard.getGoodsPrice())); + } + if(deptGoodsCategory.getThreeRate() != null){ + finalPrice = finalPrice.add(BigDecimal.valueOf(Double.parseDouble(deptGoodsCategory.getThreeRate())).multiply(goodsStandard.getGoodsPrice())); + } + if(goodsStandard.getExtMoney() != null){ + finalPrice = finalPrice.add(goodsStandard.getExtMoney()); + } + goodsStandard.setFinalPrice(finalPrice); }); result.setGoodsStandardList(goodsStandards);