diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/mapper/MenuRecipeMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/mapper/MenuRecipeMapper.java index 99da530..c8f6db2 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/mapper/MenuRecipeMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/mapper/MenuRecipeMapper.java @@ -215,7 +215,7 @@ public interface MenuRecipeMapper extends BaseMapper { void updateRecipeByCanteeStallMeal(@Param("recipeId")String recipeId, @Param("canteenId")String canteenId, @Param("stallId")String stallId, @Param("deviceIds")List deviceIds); Long getRecipeIdBySn(String machineSn); - List selectMenuRecipeDetailList(Long recipeId); + List selectMenuRecipeDetailLists(Long recipeId); List selectRecipeDishList(@Param("detailIds") List detailIds); @@ -254,4 +254,6 @@ public interface MenuRecipeMapper extends BaseMapper { @Select({"select recipe_id as recipeId from menu_recipe ${ew.customSqlSegment}"}) List selectRecipeIdList(@Param("ew") QueryWrapper recipeType); + + List getDeviceSnByIds(@Param("list") List deviceInfoList); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuDishesServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuDishesServiceImpl.java index a00608b..c685ba3 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuDishesServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuDishesServiceImpl.java @@ -168,7 +168,7 @@ public class MenuDishesServiceImpl extends ServiceImpl deviceInfoList = this.menuRecipeMapper.getDeviceIdByDevivce(String.valueOf(content.getCanteenId()), String.valueOf(content.getStallId())); - if(deviceInfoList == null || deviceInfoList.isEmpty()){ + List deviceInfoList = new ArrayList<>(); + if(content.getStallId() !=null){ + deviceInfoList = this.menuRecipeMapper.getDeviceIdByDevivce(null, String.valueOf(content.getStallId())); + if(deviceInfoList == null || deviceInfoList.isEmpty() || deviceInfoList.size() == 0){ throw new ServiceException(I18n.getMessage("该食堂档口下没有设备信息", new Object[0])); } } + List deviceSnList = this.menuRecipeMapper.getDeviceSnByIds(deviceInfoList); MenuRecipeSortEnum sortEnum = MenuRecipeSortEnum.getBindTypeMap().get(content.getBindType()); MenuAppRecipe mar = new MenuAppRecipe(); mar.setRecipeId(content.getRecipeId()); mar.setMealLineId(content.getMealLineId()); mar.setBindType(content.getBindType()); - List deviceTypeList = menuRecipeMapper.getDeviceIdByDevivce(String.valueOf(menuRecipe.getCanteenId()), String.valueOf(menuRecipe.getStallId())); + List deviceTypeList = menuRecipeMapper.getDeviceIdByDevivce(null, String.valueOf(menuRecipe.getStallId())); if (ObjectUtil.isEmpty(sortEnum)) { throw new ServiceException(I18n.getMessage("bingType值异常", new Object[0])); } else { @@ -248,6 +254,12 @@ public class MenuRecipeServiceImpl extends ServiceImpl deviceInfoList = this.menuRecipeMapper.getDeviceIdByDevivce(String.valueOf(dto.getCanteenId()), String.valueOf(dto.getStallId())); + List deviceSnList = this.menuRecipeMapper.getDeviceSnByIds(deviceInfoList); + for (String deviceSn : deviceSnList){ + DeviceMqPersonalUpdateMessageDTO bean = new DeviceMqPersonalUpdateMessageDTO().setUpdatePerson(0,"update"); + MqUtil.pushToSingleDevice(bean, LeMqConstant.Topic.DEVICE_UPDATE_MENU_CONFIG_V4, deviceSn); + } + } return recipeId; } } @@ -1309,8 +1328,11 @@ public class MenuRecipeServiceImpl extends ServiceImpl menuRecipeDetailList = menuRecipeMapper.selectMenuRecipeDetailList(recipeId); + List menuRecipeDetailList = menuRecipeMapper.selectMenuRecipeDetailLists(recipeId); List detailIds = menuRecipeDetailList.stream().map(MenuAndroidRecipeDetailVO::getDetailId).collect(Collectors.toList()); + if (ObjectUtil.isEmpty(detailIds)){ + return issueRecipe; + } //查询所有的dishesId List recipeDishList = menuRecipeMapper.selectRecipeDishList(detailIds); List dishesIds = recipeDishList.stream().map(IssueRecipeDetailCompressVO::getDishesId).collect(Collectors.toList()); diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/menu/MenuRecipeMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/menu/MenuRecipeMapper.xml index 966eab7..ef66b11 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/menu/MenuRecipeMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/menu/MenuRecipeMapper.xml @@ -714,13 +714,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" from device_recipe where device_id = (select device_id from device_info where device_sn = #{machineSn} limit 1) limit 1 - - - - - - - + @@ -1265,6 +1265,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and mrd.apply_date between #{applyStartDate} and #{applyEndDate} order by mrd.apply_date,mrdd.sort_num +