h5周菜谱
This commit is contained in:
parent
558646d274
commit
83c20f2bc4
|
|
@ -535,7 +535,7 @@ public class CookRecipeServiceImpl implements ICookRecipeService {
|
||||||
if (!ObjectUtil.isEmpty(menuRecipes)) {
|
if (!ObjectUtil.isEmpty(menuRecipes)) {
|
||||||
Map<Long, CookRecipe> recipeMap = (Map)menuRecipes.stream().collect(Collectors.toMap(CookRecipe::getRecipeId, Function.identity()));
|
Map<Long, CookRecipe> recipeMap = (Map)menuRecipes.stream().collect(Collectors.toMap(CookRecipe::getRecipeId, Function.identity()));
|
||||||
List<CookRecipeDetail> menuRecipeDetails = cookRecipeDetailMapper.getCookRecipeDetailsByDetailTypeAndRecipeIds(recipeIdList);
|
List<CookRecipeDetail> menuRecipeDetails = cookRecipeDetailMapper.getCookRecipeDetailsByDetailTypeAndRecipeIds(recipeIdList);
|
||||||
Map<Long, Integer> recipeTypeMap = (Map)menuRecipes.stream().collect(Collectors.toMap(CookRecipe::getRecipeId, CookRecipe::getRecipeType));
|
Map<Long, Long> recipeTypeMap = (Map)menuRecipes.stream().collect(Collectors.toMap(CookRecipe::getRecipeId, CookRecipe::getRecipeType));
|
||||||
menuRecipeDetails = this.filterCookRecipeDetails(recipeTypeMap, menuRecipeDetails, applyDate);
|
menuRecipeDetails = this.filterCookRecipeDetails(recipeTypeMap, menuRecipeDetails, applyDate);
|
||||||
if (!ObjectUtil.isEmpty(menuRecipeDetails)) {
|
if (!ObjectUtil.isEmpty(menuRecipeDetails)) {
|
||||||
Map<Long, List<CookRecipeDetail>> detailMap = (Map)menuRecipeDetails.stream().collect(Collectors.groupingBy(CookRecipeDetail::getRecipeId));
|
Map<Long, List<CookRecipeDetail>> detailMap = (Map)menuRecipeDetails.stream().collect(Collectors.groupingBy(CookRecipeDetail::getRecipeId));
|
||||||
|
|
@ -552,7 +552,7 @@ public class CookRecipeServiceImpl implements ICookRecipeService {
|
||||||
newRecipeDetail.setCreateBy("JOB");
|
newRecipeDetail.setCreateBy("JOB");
|
||||||
newRecipeDetail.setCreateTime(DateUtils.getNowDate());
|
newRecipeDetail.setCreateTime(DateUtils.getNowDate());
|
||||||
newRecipeDetail.setRecipeId(recipeId);
|
newRecipeDetail.setRecipeId(recipeId);
|
||||||
Integer recipeType = recipeTypeMap.get(recipeId);
|
Long recipeType = recipeTypeMap.get(recipeId);
|
||||||
if (ObjectUtil.equal(recipeType, RecipeTypeEnum.WEEKLY.key())) {
|
if (ObjectUtil.equal(recipeType, RecipeTypeEnum.WEEKLY.key())) {
|
||||||
newRecipeDetail.setApplyWeek((long)applyDate.getDayOfWeek().getValue());
|
newRecipeDetail.setApplyWeek((long)applyDate.getDayOfWeek().getValue());
|
||||||
}
|
}
|
||||||
|
|
@ -581,10 +581,10 @@ public class CookRecipeServiceImpl implements ICookRecipeService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<CookRecipeDetail> filterCookRecipeDetails(Map<Long, Integer> recipeTypeMap, List<CookRecipeDetail> cookRecipeDetails, LocalDate applyDate) {
|
public List<CookRecipeDetail> filterCookRecipeDetails(Map<Long, Long> recipeTypeMap, List<CookRecipeDetail> cookRecipeDetails, LocalDate applyDate) {
|
||||||
return (List)cookRecipeDetails.stream().filter((item) -> {
|
return (List)cookRecipeDetails.stream().filter((item) -> {
|
||||||
Long recipeId = item.getRecipeId();
|
Long recipeId = item.getRecipeId();
|
||||||
Integer type = (Integer)recipeTypeMap.get(recipeId);
|
Long type = (Long)recipeTypeMap.get(recipeId);
|
||||||
if (type == 3) {
|
if (type == 3) {
|
||||||
return ObjectUtil.equal(item.getApplyWeek(), applyDate.getDayOfWeek().getValue());
|
return ObjectUtil.equal(item.getApplyWeek(), applyDate.getDayOfWeek().getValue());
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue