From e2b43a52d79f58164d8c42532b7c747c57560396 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Thu, 17 Apr 2025 11:05:46 +0800 Subject: [PATCH] test --- .../impl/MenuAppRecipeServiceImpl.java | 44 +++++++------------ 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuAppRecipeServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuAppRecipeServiceImpl.java index c9c1caf..8e805ec 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuAppRecipeServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuAppRecipeServiceImpl.java @@ -3,17 +3,15 @@ package com.bonus.canteen.core.menu.service.impl; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.Set; +import java.util.*; +import java.util.function.Function; import java.util.stream.Collectors; - import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.bonus.canteen.core.alloc.domain.AllocStall; import com.bonus.canteen.core.alloc.domain.AllocStallMealtime; +import com.bonus.canteen.core.alloc.mapper.AllocStallMapper; import com.bonus.canteen.core.menu.domain.MenuRecipe; import com.bonus.canteen.core.menu.dto.AppletReserveRecipeDTO; import com.bonus.canteen.core.menu.service.IMenuAppRecipeService; @@ -41,6 +39,8 @@ import com.bonus.canteen.core.menu.domain.MenuAppRecipe; public class MenuAppRecipeServiceImpl implements IMenuAppRecipeService { @Autowired private MenuAppRecipeMapper menuAppRecipeMapper; + @Autowired + AllocStallMapper allocStallMapper; /** * 查询移动端菜谱绑定关系 @@ -120,7 +120,7 @@ public class MenuAppRecipeServiceImpl implements IMenuAppRecipeService { @Override public List getReserveRecipeDetailList(AppletReserveRecipeDTO content) { - this.generateRecipe(content.getRecipeId(), content.getApplyDate()); + //this.generateRecipe(content.getRecipeId(), content.getApplyDate()); List resultList = menuAppRecipeMapper.selectReserveRecipe(content.getApplyDate(), content.getRecipeId()); if (ObjectUtil.isEmpty(resultList)) { return resultList; @@ -129,8 +129,7 @@ public class MenuAppRecipeServiceImpl implements IMenuAppRecipeService { return s2.getMealtimeType() - s1.getMealtimeType(); })); Long stallId = menuAppRecipeMapper.selectStallIdByWrappers(Wrappers.lambdaQuery(MenuRecipe.class).eq(MenuRecipe::getRecipeId, content.getRecipeId()).eq(MenuRecipe::getDelFlag, DelFlagEnum.DEL_FALSE.key())); - - AllocStall allocStall = new AllocStall(); //TODO 查询档口 + AllocStall allocStall = allocStallMapper.selectAllocStallByStallId(stallId); List mealTimeList = allocStall.getAllocStallMealtimeList(); log.info("配置api查询的档口餐次,档口id: {}, 配置: {}", stallId, JSON.toJSONString(mealTimeList)); if (ObjectUtil.isEmpty(mealTimeList)) { @@ -151,21 +150,14 @@ public class MenuAppRecipeServiceImpl implements IMenuAppRecipeService { resultList = resultList.stream().filter((time) -> { return finalMealTimeList.stream().map(AllocStallMealtime::getMealtimeType).collect(Collectors.toList()).contains(time.getMealtimeType()); }).collect(Collectors.toList()); - resultList.forEach((time) -> { - List typeList = time.getTypeList(); - if (ObjectUtil.isNotEmpty(typeList)) { - typeList.forEach((type) -> { - List dishesList = type.getDishesList(); - if (ObjectUtil.isNotEmpty(dishesList)) { - dishesList.forEach((dishes) -> { - dishes.setCostModelList(costModelList); - }); - } - - }); - } - - }); +// resultList.forEach((time) -> { +// List typeList = time.getTypeList(); +// if (ObjectUtil.isNotEmpty(typeList)) { +// typeList.forEach((type) -> { +// List dishesList = type.getDishesList(); +// }); +// } +// }); Set dishesIdSet = resultList.stream().flatMap((time) -> { return time.getTypeList().stream().flatMap((type) -> { return type.getDishesList().stream().map((item) -> { @@ -217,9 +209,5 @@ public class MenuAppRecipeServiceImpl implements IMenuAppRecipeService { } } - public void generateRecipe(Long recipeId, LocalDate applyDate) { - if (!ObjectUtil.isEmpty(recipeId) && !ObjectUtil.isEmpty(applyDate)) { - this.generateRecipe(Collections.singletonList(recipeId), applyDate); - } - } + }