diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/mapper/MenuAppRecipeMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/mapper/MenuAppRecipeMapper.java index 773519dc..63b5f657 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/mapper/MenuAppRecipeMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/mapper/MenuAppRecipeMapper.java @@ -4,6 +4,8 @@ import com.bonus.canteen.core.menu.vo.AppletReserveCanteenVO; import com.bonus.canteen.core.menu.vo.AppletWeekCanteenVO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; + +import java.time.LocalDate; import java.util.List; import java.util.Set; @@ -15,4 +17,10 @@ public interface MenuAppRecipeMapper { List selectReserveMealCanteenList(@Param("effIdSet") Set effIdSet); + List selectWeekRecipeIdHistory(@Param("recipeIdList") List recipeId, @Param("effIdSet") Set effIdSet, @Param("applyDate") LocalDate applyDate); + + List getRecipeIdListByRecipeId(@Param("recipeId") Long recipeId); + + String getBingTimeByRecipeId(@Param("recipeId") Long recipeId); + } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuRecipeServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuRecipeServiceImpl.java index 019bdf0a..f029c88c 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuRecipeServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuRecipeServiceImpl.java @@ -165,7 +165,41 @@ public class MenuRecipeServiceImpl extends ServiceImpl repeIdList = this.menuAppRecipeMapper.getRecipeIdListByRecipeId(content.getRecipeId()); + recipeIdList = this.menuAppRecipeMapper.selectWeekRecipeIdHistory(repeIdList, null,applyDate); + if(recipeIdList == null || recipeIdList.size() == 0){ + ((List) recipeIdList).add(content.getRecipeId()); + } + } + } + } else if (applyDate.isAfter(now)) { + System.out.println("applyDate 晚于当前日期"); + recipeIdList = this.menuAppRecipeMapper.selectWeekRecipeId(content.getRecipeId(), null); + } else { + System.out.println("applyDate 等于当前日期"); + recipeIdList = this.menuAppRecipeMapper.selectWeekRecipeId(content.getRecipeId(), null); + } + if(recipeIdList == null || recipeIdList.size() == 0){ + throw new ServiceException("本档口没有更早的历史菜谱记录"); + // recipeIdList.add(content.getRecipeId()); + } + // ((List) recipeIdList).add(content.getRecipeId()); } this.generateRecipe((List) recipeIdList, content.getApplyDate()); diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/menu/MenuAppRecipeMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/menu/MenuAppRecipeMapper.xml index 3f7ea5fd..01f6034c 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/menu/MenuAppRecipeMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/menu/MenuAppRecipeMapper.xml @@ -335,4 +335,31 @@ + + + + + + + + +