h5周菜谱
This commit is contained in:
parent
0005d5861f
commit
0f9b5a20f0
|
|
@ -78,7 +78,7 @@ public interface CookRecipeDetailMapper {
|
|||
|
||||
List<CookRecipeDetail> getByRecipeIdAndDatesAndIntervalId(@Param("recipeId") Long recipeId, @Param("dateList") Set<LocalDate> dateList, @Param("mealtimeType") Long mealtimeType);
|
||||
|
||||
List<CookRecipeDetail> getCookRecipeDetailsByApplyDateAndRecipeIds(@Param("recipeIdList") List<Long> recipeIdList);
|
||||
List<CookRecipeDetail> getCookRecipeDetailsByApplyDateAndRecipeIds(@Param("recipeIdList") List<Long> recipeIdList, @Param("applyDate") LocalDate applyDate);
|
||||
|
||||
List<CookRecipeDetail> getCookRecipeDetailsByDetailTypeAndRecipeIds(@Param("recipeIdList") List<Long> recipeIdList);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -527,7 +527,7 @@ public class CookRecipeServiceImpl implements ICookRecipeService {
|
|||
public synchronized void generateRecipe(List<Long> inputRecipeIdList, LocalDate applyDate) {
|
||||
if (!ObjectUtil.isEmpty(inputRecipeIdList) && !ObjectUtil.isEmpty(applyDate)) {
|
||||
List<Long> recipeIdList = new ArrayList(inputRecipeIdList);
|
||||
List<CookRecipeDetail> cookRecipeDetails = cookRecipeDetailMapper.getCookRecipeDetailsByApplyDateAndRecipeIds(recipeIdList);
|
||||
List<CookRecipeDetail> cookRecipeDetails = cookRecipeDetailMapper.getCookRecipeDetailsByApplyDateAndRecipeIds(recipeIdList, applyDate);
|
||||
Map<Long, Long> recipeDetailContMap = cookRecipeDetails.stream().collect(Collectors.groupingBy(CookRecipeDetail::getRecipeId, Collectors.counting()));
|
||||
recipeIdList.removeAll(recipeDetailContMap.keySet());
|
||||
if (!ObjectUtil.isEmpty(recipeIdList)) {
|
||||
|
|
@ -544,57 +544,35 @@ public class CookRecipeServiceImpl implements ICookRecipeService {
|
|||
Map<Long, List<CookRecipeDishes>> recipeDishes = (Map)foundDishes.stream().collect(Collectors.groupingBy(CookRecipeDishes::getRecipeDetailId));
|
||||
List<CookRecipeDetail> recipeDetailV2List = Lists.newArrayList();
|
||||
List<CookRecipeDishes> recipeDishesV2List = Lists.newArrayList();
|
||||
Iterator var13 = recipeMap.keySet().iterator();
|
||||
// label59:
|
||||
// while(true) {
|
||||
// Long recipeId;
|
||||
// Integer type;
|
||||
// List menuRecipeDetail;
|
||||
// do {
|
||||
// if (!var13.hasNext()) {
|
||||
// this.cookRecipeDetailMapper.insert(recipeDetailV2List);
|
||||
// if (ObjectUtil.isNotEmpty(recipeDishesV2List)) {
|
||||
// this.cookRecipeDishesService.saveBatch(recipeDishesV2List);
|
||||
// }
|
||||
// return;
|
||||
// }
|
||||
// recipeId = (Long)var13.next();
|
||||
// type = (Integer)recipeTypeMap.get(recipeId);
|
||||
// menuRecipeDetail = (List)detailMap.get(recipeId);
|
||||
// } while(!ObjectUtil.isNotEmpty(menuRecipeDetail));
|
||||
// Iterator var17 = menuRecipeDetail.iterator();
|
||||
// while(true) {
|
||||
// Long detailId;
|
||||
// List dishes;
|
||||
// do {
|
||||
// if (!var17.hasNext()) {
|
||||
// continue label59;
|
||||
// }
|
||||
// CookRecipeDetail recipeDetail = (CookRecipeDetail)var17.next();
|
||||
// CookRecipeDetail detailItem = new CookRecipeDetail();
|
||||
// detailId = Id.next();
|
||||
// detailItem.setDetailId(detailId);
|
||||
// detailItem.setRecipeId(recipeId);
|
||||
// if (ObjectUtil.equal(type, 3)) {
|
||||
// detailItem.setApplyWeek(applyDate.getDayOfWeek().getValue());
|
||||
// }
|
||||
// detailItem.setApplyDate(applyDate);
|
||||
// detailItem.setMealtimeType(recipeDetail.getMealtimeType());
|
||||
// detailItem.setCreateBy("");
|
||||
// detailItem.setDetailType(2);
|
||||
// recipeDetailV2List.add(detailItem);
|
||||
// dishes = (List)recipeDishes.get(recipeDetail.getDetailId());
|
||||
// } while(!ObjectUtil.isNotEmpty(dishes));
|
||||
// Iterator var22 = dishes.iterator();
|
||||
// while(var22.hasNext()) {
|
||||
// CookRecipeDishes dish = (CookRecipeDishes)var22.next();
|
||||
// CookRecipeDishes dishesItem = (CookRecipeDishes) BeanUtil.copyProperties(dish, CookRecipeDishes.class, new String[0]);
|
||||
// dishesItem.setDetailId(detailId);
|
||||
// dishesItem.setId((Long)null);
|
||||
// recipeDishesV2List.add(dishesItem);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
for (Long recipeId : recipeMap.keySet()) {
|
||||
CookRecipe recipe = recipeMap.get(recipeId);
|
||||
List<CookRecipeDetail> cookRecipeDetailList = (List) detailMap.get(recipeId);
|
||||
for (CookRecipeDetail oldDetail : cookRecipeDetailList) {
|
||||
Long oldDetailId = oldDetail.getRecipeDetailId();
|
||||
CookRecipeDetail newRecipeDetail = new CookRecipeDetail();
|
||||
newRecipeDetail.setRecipeId(recipeId);
|
||||
Integer recipeType = recipeTypeMap.get(recipeId);
|
||||
if (ObjectUtil.equal(recipeType, RecipeTypeEnum.WEEKLY.key())) {
|
||||
newRecipeDetail.setApplyWeek((long)applyDate.getDayOfWeek().getValue());
|
||||
}
|
||||
newRecipeDetail.setApplyDate(applyDate);
|
||||
newRecipeDetail.setCreateBy("JOB");
|
||||
newRecipeDetail.setDetailType(RecipeDetailTypeEnum.DETAIL_DATA.key());
|
||||
cookRecipeDetailMapper.insertCookRecipeDetail(newRecipeDetail); //插入菜谱之执行计划
|
||||
Long newDetailId = newRecipeDetail.getRecipeDetailId();
|
||||
List<CookRecipeDishes> dishes = recipeDishes.get(oldDetailId);
|
||||
for (CookRecipeDishes dishesDTO : dishes) {
|
||||
CookRecipeDishes newRecipeDishes = new CookRecipeDishes();
|
||||
BeanUtils.copyProperties(dishesDTO, newRecipeDishes);
|
||||
newRecipeDishes.setCreateTime(DateUtils.getNowDate());
|
||||
long supplyNum = Objects.isNull(newRecipeDishes.getSupplyNum()) ? 0 : newRecipeDishes.getSupplyNum();
|
||||
long saleNum = Objects.isNull(newRecipeDishes.getSaleNum()) ? 0 : newRecipeDishes.getSaleNum();
|
||||
newRecipeDishes.setRemanentNum((int) (supplyNum - saleNum));
|
||||
newRecipeDishes.setRecipeDetailId(newDetailId);
|
||||
cookRecipeDishesMapper.insertCookRecipeDishes(newRecipeDishes); //插入菜谱之菜品详情
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue