test
This commit is contained in:
parent
9c9935b57e
commit
e2b43a52d7
|
|
@ -3,17 +3,15 @@ package com.bonus.canteen.core.menu.service.impl;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
import java.util.Collections;
|
import java.util.*;
|
||||||
import java.util.Iterator;
|
import java.util.function.Function;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.bonus.canteen.core.alloc.domain.AllocStall;
|
import com.bonus.canteen.core.alloc.domain.AllocStall;
|
||||||
import com.bonus.canteen.core.alloc.domain.AllocStallMealtime;
|
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.domain.MenuRecipe;
|
||||||
import com.bonus.canteen.core.menu.dto.AppletReserveRecipeDTO;
|
import com.bonus.canteen.core.menu.dto.AppletReserveRecipeDTO;
|
||||||
import com.bonus.canteen.core.menu.service.IMenuAppRecipeService;
|
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 {
|
public class MenuAppRecipeServiceImpl implements IMenuAppRecipeService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private MenuAppRecipeMapper menuAppRecipeMapper;
|
private MenuAppRecipeMapper menuAppRecipeMapper;
|
||||||
|
@Autowired
|
||||||
|
AllocStallMapper allocStallMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询移动端菜谱绑定关系
|
* 查询移动端菜谱绑定关系
|
||||||
|
|
@ -120,7 +120,7 @@ public class MenuAppRecipeServiceImpl implements IMenuAppRecipeService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AppletReserveRecipeVO> getReserveRecipeDetailList(AppletReserveRecipeDTO content) {
|
public List<AppletReserveRecipeVO> getReserveRecipeDetailList(AppletReserveRecipeDTO content) {
|
||||||
this.generateRecipe(content.getRecipeId(), content.getApplyDate());
|
//this.generateRecipe(content.getRecipeId(), content.getApplyDate());
|
||||||
List<AppletReserveRecipeVO> resultList = menuAppRecipeMapper.selectReserveRecipe(content.getApplyDate(), content.getRecipeId());
|
List<AppletReserveRecipeVO> resultList = menuAppRecipeMapper.selectReserveRecipe(content.getApplyDate(), content.getRecipeId());
|
||||||
if (ObjectUtil.isEmpty(resultList)) {
|
if (ObjectUtil.isEmpty(resultList)) {
|
||||||
return resultList;
|
return resultList;
|
||||||
|
|
@ -129,8 +129,7 @@ public class MenuAppRecipeServiceImpl implements IMenuAppRecipeService {
|
||||||
return s2.getMealtimeType() - s1.getMealtimeType();
|
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()));
|
Long stallId = menuAppRecipeMapper.selectStallIdByWrappers(Wrappers.lambdaQuery(MenuRecipe.class).eq(MenuRecipe::getRecipeId, content.getRecipeId()).eq(MenuRecipe::getDelFlag, DelFlagEnum.DEL_FALSE.key()));
|
||||||
|
AllocStall allocStall = allocStallMapper.selectAllocStallByStallId(stallId);
|
||||||
AllocStall allocStall = new AllocStall(); //TODO 查询档口
|
|
||||||
List<AllocStallMealtime> mealTimeList = allocStall.getAllocStallMealtimeList();
|
List<AllocStallMealtime> mealTimeList = allocStall.getAllocStallMealtimeList();
|
||||||
log.info("配置api查询的档口餐次,档口id: {}, 配置: {}", stallId, JSON.toJSONString(mealTimeList));
|
log.info("配置api查询的档口餐次,档口id: {}, 配置: {}", stallId, JSON.toJSONString(mealTimeList));
|
||||||
if (ObjectUtil.isEmpty(mealTimeList)) {
|
if (ObjectUtil.isEmpty(mealTimeList)) {
|
||||||
|
|
@ -151,21 +150,14 @@ public class MenuAppRecipeServiceImpl implements IMenuAppRecipeService {
|
||||||
resultList = resultList.stream().filter((time) -> {
|
resultList = resultList.stream().filter((time) -> {
|
||||||
return finalMealTimeList.stream().map(AllocStallMealtime::getMealtimeType).collect(Collectors.toList()).contains(time.getMealtimeType());
|
return finalMealTimeList.stream().map(AllocStallMealtime::getMealtimeType).collect(Collectors.toList()).contains(time.getMealtimeType());
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
resultList.forEach((time) -> {
|
// resultList.forEach((time) -> {
|
||||||
List<AppletReserveRecipeTypeVO> typeList = time.getTypeList();
|
// List<AppletReserveRecipeTypeVO> typeList = time.getTypeList();
|
||||||
if (ObjectUtil.isNotEmpty(typeList)) {
|
// if (ObjectUtil.isNotEmpty(typeList)) {
|
||||||
typeList.forEach((type) -> {
|
// typeList.forEach((type) -> {
|
||||||
List<AppletReserveRecipeDishesVO> dishesList = type.getDishesList();
|
// List<AppletReserveRecipeDishesVO> dishesList = type.getDishesList();
|
||||||
if (ObjectUtil.isNotEmpty(dishesList)) {
|
// });
|
||||||
dishesList.forEach((dishes) -> {
|
// }
|
||||||
dishes.setCostModelList(costModelList);
|
// });
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
Set<Long> dishesIdSet = resultList.stream().flatMap((time) -> {
|
Set<Long> dishesIdSet = resultList.stream().flatMap((time) -> {
|
||||||
return time.getTypeList().stream().flatMap((type) -> {
|
return time.getTypeList().stream().flatMap((type) -> {
|
||||||
return type.getDishesList().stream().map((item) -> {
|
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue