From 48a6628acbc7d03e96a12e5531de50c5a8bc73f5 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Wed, 14 Aug 2024 16:07:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=20=E5=8F=AF=E5=94=AE?= =?UTF-8?q?=E6=97=B6=E9=97=B4=20=E5=A4=84=E7=90=86=20=E5=95=86=E5=93=81?= =?UTF-8?q?=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/cashierservice/service/ProductService.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 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 f16e026..252048f 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java @@ -141,14 +141,14 @@ public class ProductService { Integer id = ObjectUtil.isNotEmpty(productGroupId) ? Integer.valueOf(productGroupId) : null; //招牌菜 List tbProducts = tbProductMapper.selectIsSpecialty(Integer.valueOf(shopId)); - concurrentMap.put("hots", handleDate(tbProducts,true)); + concurrentMap.put("hots", handleDate(tbProducts,true,1)); List groupList = tbProductGroupMapper.selectByShopId(shopId, id); if (ObjectUtil.isNotEmpty(groupList) && groupList.size() > 0) { //热销 TbProductGroup hot = new TbProductGroup(); hot.setName("热销"); List hots = tbProductMapper.selectHot(shopId); - hot.setProducts(handleDate(hots,true)); + hot.setProducts(handleDate(hots,true,1)); //商品 groupList.parallelStream().forEach(g -> { if (g.getUseTime()==1) g.setIsSale(getIsSale(g.getSaleStartTime(),g.getSaleEndTime())); @@ -156,7 +156,7 @@ public class ProductService { if (ObjectUtil.isNotEmpty(in) && ObjectUtil.isNotNull(in)) { // List products = tbProductMapper.selectByIdIn(in); List products = tbProductMapper.selectByIdInAndCheck(in); - g.setProducts(handleDate(products,false)); + g.setProducts(handleDate(products,false,g.getIsSale())); } else { g.setProducts(new ArrayList<>()); } @@ -347,7 +347,7 @@ public class ProductService { * @param check 是否校验可售 * @return */ - public List handleDate(List products,boolean check){ + public List handleDate(List products,boolean check,Integer isSale){ if (!CollectionUtils.isEmpty(products)) { products.parallelStream().forEach(it -> { if(check){ @@ -360,6 +360,8 @@ public class ProductService { } } } + }else { + it.setIsSale(isSale); } TbShopUnit tbShopUnit = unitMapper.selectByPrimaryKey(Integer.valueOf(it.getUnitId())); it.setUnitSnap(tbShopUnit != null ? tbShopUnit.getName() : "");