From bc0bcf67a8e9af7f525f4be719da5ee24b0698e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9D=BE?= <8605635+zhang3064194730@user.noreply.gitee.com> Date: Thu, 7 Nov 2024 15:56:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=95=86=E5=93=81=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E4=BC=9A=E5=91=98=E4=BB=B7=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/cashierservice/service/ProductService.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java index 635d0b3..ed1ac43 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java @@ -21,6 +21,7 @@ import com.chaozhanggui.system.cashierservice.entity.vo.*; import com.chaozhanggui.system.cashierservice.exception.MsgException; import com.chaozhanggui.system.cashierservice.mapper.MpCashierCartMapper; import com.chaozhanggui.system.cashierservice.mapper.MpOrderInfoMapper; +import com.chaozhanggui.system.cashierservice.mapper.MpShopInfoMapper; import com.chaozhanggui.system.cashierservice.mapper.MpShopTableMapper; import com.chaozhanggui.system.cashierservice.redis.RedisCst; import com.chaozhanggui.system.cashierservice.redis.RedisUtil; @@ -108,6 +109,8 @@ public class ProductService { @Autowired private StringRedisTemplate stringRedisTemplate; private final TbFreeDineConfigService freeDineConfigService; + @Autowired + private MpShopInfoMapper mpShopInfoMapper; public ProductService(ShopUtils shopUtils, TbFreeDineConfigService freeDineConfigService) { this.shopUtils = shopUtils; @@ -224,6 +227,7 @@ public class ProductService { List tbProducts = tbProductMapper.selectIsSpecialty(Integer.valueOf(shopId)); concurrentMap.put("hots", handleDate(tbProducts,true,1,false)); List groupList = tbProductGroupMapper.selectByShopId(shopId, id); + TbShopInfo shopInfo = mpShopInfoMapper.selectById(shopId); if (ObjectUtil.isNotEmpty(groupList) && groupList.size() > 0) { //热销 TbProductGroup hot = new TbProductGroup(); @@ -236,7 +240,7 @@ public class ProductService { String in = g.getProductIds().substring(1, g.getProductIds().length() - 1); if (ObjectUtil.isNotEmpty(in) && ObjectUtil.isNotNull(in)) { List products = tbProductMapper.selectByIdInAndCheck(in); - g.setProducts(handleDate(products,false,g.getIsSale(),false)); + g.setProducts(handleDate(products,false,g.getIsSale(),false, shopInfo)); } else { g.setProducts(new ArrayList<>()); } @@ -450,7 +454,8 @@ public class ProductService { * @param check 是否校验可售 * @return */ - public List handleDate(List products,boolean check,Integer isSale,boolean isVip){ + public List handleDate(List products,boolean check,Integer isSale,boolean isVip, TbShopInfo shopInfo){ + boolean isMemberPrice = shopInfo.getIsMemberPrice() != null && shopInfo.getIsMemberPrice() == 1; if (!CollectionUtils.isEmpty(products)) { products.parallelStream().forEach(it -> { TbShopUnit tbShopUnit = unitMapper.selectByPrimaryKey(Integer.valueOf(it.getUnitId())); @@ -504,7 +509,7 @@ public class ProductService { it.setLowPrice(lowerPrice); // 会员价 - if (lowMemberPrice == null) { + if (lowMemberPrice == null || !isMemberPrice) { lowMemberPrice = BigDecimal.ZERO; } it.setLowMemberPrice(lowMemberPrice);