From 4a676c7cf8f93ff9b3342181ba5f6e4b62d78300 Mon Sep 17 00:00:00 2001 From: "kuang.yife" Date: Thu, 9 Feb 2023 21:19:09 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=84=E6=A0=BC=E4=B8=AD=E4=BD=A3=E9=87=91?= =?UTF-8?q?=E9=87=91=E9=A2=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/goods/GoodsController.java | 17 +++++++++++++++++ .../com/ghy/goods/domain/GoodsStandard.java | 2 ++ 2 files changed, 19 insertions(+) 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 e610de5d..3291b06e 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 @@ -19,6 +19,7 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.math.BigDecimal; import java.util.*; import java.util.stream.Collectors; @@ -202,6 +203,22 @@ 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); } }); result.setGoodsStandardList(goodsStandards); diff --git a/ghy-goods/src/main/java/com/ghy/goods/domain/GoodsStandard.java b/ghy-goods/src/main/java/com/ghy/goods/domain/GoodsStandard.java index 9ac3f747..d5c703f6 100644 --- a/ghy-goods/src/main/java/com/ghy/goods/domain/GoodsStandard.java +++ b/ghy-goods/src/main/java/com/ghy/goods/domain/GoodsStandard.java @@ -41,4 +41,6 @@ public class GoodsStandard extends BaseEntity { private Integer status; + private BigDecimal finalPrice; + }