From 705d15794c29b603e9cb6c19aad395ea827d3b2e Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Sun, 8 Jun 2025 12:21:19 +0800 Subject: [PATCH] =?UTF-8?q?h5=E5=91=A8=E8=8F=9C=E8=B0=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../canteen/core/cook/mapper/CookRecipeDetailMapper.java | 2 +- .../core/cook/service/impl/CookRecipeServiceImpl.java | 5 ++++- .../main/resources/mapper/cook/CookRecipeDetailMapper.xml | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookRecipeDetailMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookRecipeDetailMapper.java index 87f84bb..23de8e0 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookRecipeDetailMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookRecipeDetailMapper.java @@ -78,7 +78,7 @@ public interface CookRecipeDetailMapper { List getByRecipeIdAndDatesAndIntervalId(@Param("recipeId") Long recipeId, @Param("dateList") Set dateList, @Param("mealtimeType") Long mealtimeType); - List getCookRecipeDetailsByApplyDateAndRecipeIds(@Param("recipeIdList") List recipeIdList, @Param("applyDate") LocalDate applyDate); + List getCookRecipeDetailsByApplyDateAndRecipeIds(@Param("recipeIdList") List recipeIdList, @Param("applyDate") String applyDate); List getCookRecipeDetailsByDetailTypeAndRecipeIds(@Param("recipeIdList") List recipeIdList); } 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 89ee7c1..c4237b2 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 @@ -1,5 +1,6 @@ package com.bonus.canteen.core.cook.service.impl; +import java.text.SimpleDateFormat; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; @@ -54,6 +55,7 @@ import org.springframework.web.multipart.MultipartFile; */ @Service public class CookRecipeServiceImpl implements ICookRecipeService { + private static final String YYYY_MM_DD = "yyyy-MM-dd"; @Autowired private CookRecipeMapper cookRecipeMapper; @Autowired @@ -527,7 +529,8 @@ public class CookRecipeServiceImpl implements ICookRecipeService { public synchronized void generateRecipe(List inputRecipeIdList, LocalDate applyDate) { if (!ObjectUtil.isEmpty(inputRecipeIdList) && !ObjectUtil.isEmpty(applyDate)) { List recipeIdList = new ArrayList(inputRecipeIdList); - List cookRecipeDetails = cookRecipeDetailMapper.getCookRecipeDetailsByApplyDateAndRecipeIds(recipeIdList, applyDate); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern(YYYY_MM_DD); + List cookRecipeDetails = cookRecipeDetailMapper.getCookRecipeDetailsByApplyDateAndRecipeIds(recipeIdList, applyDate.format(formatter)); Map recipeDetailContMap = cookRecipeDetails.stream().collect(Collectors.groupingBy(CookRecipeDetail::getRecipeId, Collectors.counting())); recipeIdList.removeAll(recipeDetailContMap.keySet()); if (!ObjectUtil.isEmpty(recipeIdList)) { diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookRecipeDetailMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookRecipeDetailMapper.xml index a971097..17d98bb 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookRecipeDetailMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookRecipeDetailMapper.xml @@ -172,7 +172,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"