diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookRecipeServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookRecipeServiceImpl.java index 905eaa3..382af21 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookRecipeServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookRecipeServiceImpl.java @@ -118,14 +118,14 @@ public class CookRecipeServiceImpl implements ICookRecipeService { Map bindTypeMap = CookRecipeSortEnum.getKeyMap(); CookRecipeSortEnum sortEnum = bindTypeMap.get(content.getKey()); List records = new ArrayList<>(); - if (ObjectUtil.isEmpty(sortEnum)) { + if (Objects.isNull(sortEnum)) { throw new ServiceException("参数错误"); }else{ content.setDeviceTypeList(sortEnum.getDeviceType()); content.setBindType(sortEnum.getBindType()); content.setRecipeName(LeBeanUtil.fieldLikeHandle(content.getRecipeName())); records = cookRecipeMapper.selectCookRecipeListV2(content); - if (ObjectUtil.isNotEmpty(records)) { + if (!CollectionUtils.isEmpty(records)) { List recipeIds; Map maping; List stallIds = records.stream().map(CookRecipeVO::getStallId).collect(Collectors.toList()); @@ -155,9 +155,9 @@ public class CookRecipeServiceImpl implements ICookRecipeService { item.setRecipeDateList(Arrays.asList(cookRecipeDateVO)); item.setRecipeName(Optional.ofNullable(recipeMap.get(recipeId)).map(CookRecipe::getRecipeName).orElse(null)); count = 0L; - if (ObjectUtil.isNotEmpty(item.getRecipeDateDetail()) && ObjectUtil.isNotEmpty(item.getRecipeDateList().get(0).getDetailList())) { + if (Objects.nonNull(item.getRecipeDateDetail()) && !CollectionUtils.isEmpty(item.getRecipeDateList().get(0).getDetailList())) { count = item.getRecipeDateList().get(0).getDetailList().stream().filter((x) -> { - return ObjectUtil.isNotEmpty(x.getDishesList()); + return !CollectionUtils.isEmpty(x.getDishesList()); }).flatMap((x) -> { return x.getDishesList().stream(); }).map(CookRecipeDishesVO::getDishesId).distinct().count(); @@ -367,7 +367,7 @@ public class CookRecipeServiceImpl implements ICookRecipeService { public void bindCookRecipe(CookRecipeBindDTO content) { CookRecipe cookRecipe = this.cookRecipeMapper.selectCookRecipeByRecipeId(content.getRecipeId()); CookRecipeSortEnum sortEnum = CookRecipeSortEnum.getBindTypeMap().get(content.getBindType()); - if (ObjectUtil.isEmpty(sortEnum)) { + if (Objects.isNull(sortEnum)) { throw new ServiceException("菜谱绑定类型错误"); } else { List deviceIds = new ArrayList<>(); @@ -396,19 +396,19 @@ public class CookRecipeServiceImpl implements ICookRecipeService { throw new ServiceException("菜谱已被使用,请勿重复绑定"); } List sourceRecipeList = this.cookRecipeMapper.selectRecipeInSameShop(cookRecipe.getStallId(), content.getBindType(), content.getMealLineId()); - if (ObjectUtil.isNotEmpty(sourceRecipeList)) { + if (!CollectionUtils.isEmpty(sourceRecipeList)) { appRecipe.setRecipeIds(sourceRecipeList); this.cookRecipeMapper.deleteBind(appRecipe); } this.cookRecipeMapper.insertBind(appRecipe); - if (ObjectUtil.isNotEmpty(deviceIds)) { + if (!CollectionUtils.isEmpty(deviceIds)) { this.cookRecipeMapper.updateRecipeByCanteenStallMeal(content.getRecipeId(), cookRecipe.getCanteenId(), cookRecipe.getStallId(), deviceIds); } MqUtil.sendDataChange(cookRecipe, LeMqConstant.DataChangeType.ADD, LeMqConstant.Topic.DATA_CHANGE_RECIPE_RELEASE); } else { appRecipe.setRecipeIds(Collections.singletonList(appRecipe.getRecipeId())); this.cookRecipeMapper.deleteBind(appRecipe); - if (ObjectUtil.isNotEmpty(deviceIds)) { + if (!CollectionUtils.isEmpty(deviceIds)) { this.cookRecipeMapper.updateRecipeByCanteenStallMeal(-1L, cookRecipe.getCanteenId(), cookRecipe.getStallId(), deviceIds); } }