新增菜谱

This commit is contained in:
sxu 2025-05-27 23:17:51 +08:00
parent 127a8c6c11
commit abb944ab32
1 changed files with 7 additions and 3 deletions

View File

@ -98,8 +98,8 @@ public class CookRecipeServiceImpl implements ICookRecipeService {
return null; return null;
} }
List<CookRecipeDateDTO> recipeDateListNew = new ArrayList<>(); List<CookRecipeDateDTO> recipeDateListNew = new ArrayList<>();
if (2 == cookRecipeDTO.getRecipeType()) { //每日循环 if (2 == cookRecipeDTO.getRecipeType() && Objects.nonNull(recipeDateList.get(0))) { //每日循环
List<CookRecipeDetailDTO> recipeDetailList = cookRecipeDTO.getRecipeDateList().get(0).getDetailList(); List<CookRecipeDetailDTO> recipeDetailList = recipeDateList.get(0).getDetailList();
//新增详情 //新增详情
CookRecipeDateDTO cookRecipeDateDTO = new CookRecipeDateDTO(); CookRecipeDateDTO cookRecipeDateDTO = new CookRecipeDateDTO();
cookRecipeDateDTO.setDetailList(recipeDetailList); cookRecipeDateDTO.setDetailList(recipeDetailList);
@ -109,7 +109,6 @@ public class CookRecipeServiceImpl implements ICookRecipeService {
} }
recipeDateListNew.add(cookRecipeDateDTO); recipeDateListNew.add(cookRecipeDateDTO);
} else if (3 == cookRecipeDTO.getRecipeType()) { //每周循环 } else if (3 == cookRecipeDTO.getRecipeType()) { //每周循环
List<CookRecipeDateDTO> recipeDateList1 = cookRecipeDTO.getRecipeDateList();
LocalDate now = LocalDate.now(); LocalDate now = LocalDate.now();
HashMap<Integer, LocalDate> dateHashMap = new HashMap<>(); HashMap<Integer, LocalDate> dateHashMap = new HashMap<>();
for (int i = 0; i < 7; ++i) { for (int i = 0; i < 7; ++i) {
@ -123,6 +122,11 @@ public class CookRecipeServiceImpl implements ICookRecipeService {
CookRecipeDateDTO cookRecipeDateDTO = new CookRecipeDateDTO(); CookRecipeDateDTO cookRecipeDateDTO = new CookRecipeDateDTO();
cookRecipeDateDTO.setApplyWeek(Long.valueOf(entry.getKey())); cookRecipeDateDTO.setApplyWeek(Long.valueOf(entry.getKey()));
cookRecipeDateDTO.setApplyDate(entry.getValue()); cookRecipeDateDTO.setApplyDate(entry.getValue());
for (CookRecipeDateDTO recipeDateDTO : recipeDateList) {
if (Long.valueOf(entry.getKey()).equals(recipeDateDTO.getApplyWeek())) {
cookRecipeDateDTO.setDetailList(recipeDateDTO.getDetailList());
}
}
recipeDateListNew.add(cookRecipeDateDTO); recipeDateListNew.add(cookRecipeDateDTO);
} }
} }