From 11363ccc42ade671da1398106906dad48531e905 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Thu, 29 May 2025 17:52:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AA=E7=8E=AF=E8=8F=9C=E8=B0=B1=E8=AF=A6?= =?UTF-8?q?=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../canteen/core/cook/service/impl/CookRecipeServiceImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookRecipeServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookRecipeServiceImpl.java index f461f5d..57dd60e 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookRecipeServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookRecipeServiceImpl.java @@ -315,7 +315,9 @@ public class CookRecipeServiceImpl implements ICookRecipeService { CookRecipeDishes cookRecipeDishes = new CookRecipeDishes(); BeanUtils.copyProperties(dishesDTO, cookRecipeDishes); cookRecipeDishes.setCreateTime(DateUtils.getNowDate()); - cookRecipeDishes.setRemanentNum((int) (cookRecipeDishes.getSupplyNum() - cookRecipeDishes.getSaleNum())); + long supplyNum = Objects.isNull(cookRecipeDishes.getSupplyNum()) ? 0 : cookRecipeDishes.getSupplyNum(); + long saleNum = Objects.isNull(cookRecipeDishes.getSaleNum()) ? 0 : cookRecipeDishes.getSaleNum(); + cookRecipeDishes.setRemanentNum((int) (supplyNum - saleNum)); cookRecipeDishes.setRecipeDetailId(cookRecipeDetail.getRecipeDetailId()); cookRecipeDishesMapper.insertCookRecipeDishes(cookRecipeDishes); //插入菜谱之菜品详情 }