From abb944ab322c4c08254723c335b6e85e4d9bee49 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Tue, 27 May 2025 23:17:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=8F=9C=E8=B0=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/cook/service/impl/CookRecipeServiceImpl.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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 0abc915..a5d7293 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 @@ -98,8 +98,8 @@ public class CookRecipeServiceImpl implements ICookRecipeService { return null; } List recipeDateListNew = new ArrayList<>(); - if (2 == cookRecipeDTO.getRecipeType()) { //每日循环 - List recipeDetailList = cookRecipeDTO.getRecipeDateList().get(0).getDetailList(); + if (2 == cookRecipeDTO.getRecipeType() && Objects.nonNull(recipeDateList.get(0))) { //每日循环 + List recipeDetailList = recipeDateList.get(0).getDetailList(); //新增详情 CookRecipeDateDTO cookRecipeDateDTO = new CookRecipeDateDTO(); cookRecipeDateDTO.setDetailList(recipeDetailList); @@ -109,7 +109,6 @@ public class CookRecipeServiceImpl implements ICookRecipeService { } recipeDateListNew.add(cookRecipeDateDTO); } else if (3 == cookRecipeDTO.getRecipeType()) { //每周循环 - List recipeDateList1 = cookRecipeDTO.getRecipeDateList(); LocalDate now = LocalDate.now(); HashMap dateHashMap = new HashMap<>(); for (int i = 0; i < 7; ++i) { @@ -123,6 +122,11 @@ public class CookRecipeServiceImpl implements ICookRecipeService { CookRecipeDateDTO cookRecipeDateDTO = new CookRecipeDateDTO(); cookRecipeDateDTO.setApplyWeek(Long.valueOf(entry.getKey())); cookRecipeDateDTO.setApplyDate(entry.getValue()); + for (CookRecipeDateDTO recipeDateDTO : recipeDateList) { + if (Long.valueOf(entry.getKey()).equals(recipeDateDTO.getApplyWeek())) { + cookRecipeDateDTO.setDetailList(recipeDateDTO.getDetailList()); + } + } recipeDateListNew.add(cookRecipeDateDTO); } }