From a3693858feb822e03114bde465b1e0490c4bfcd3 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Thu, 29 May 2025 14:09:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BD=93=E5=89=8D=E8=8F=9C=E8=B0=B1bind?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/cook/service/impl/CookRecipeServiceImpl.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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 734ea84..de39b5e 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 @@ -310,13 +310,14 @@ public class CookRecipeServiceImpl implements ICookRecipeService { public void bindCookRecipe(CookRecipeBindDTO cookRecipeDTO) { CookRecipe menuRecipe = this.cookRecipeMapper.selectCookRecipeByRecipeId(cookRecipeDTO.getRecipeId()); List deviceInfoList = new ArrayList<>(); + List deviceSnList = new ArrayList<>(); if(cookRecipeDTO.getStallId() !=null){ deviceInfoList = this.cookRecipeMapper.getDeviceIdByDevivce(null, String.valueOf(cookRecipeDTO.getStallId())); if(deviceInfoList == null || deviceInfoList.isEmpty() || deviceInfoList.size() == 0){ throw new ServiceException("该食堂档口下没有设备信息"); } + deviceSnList = this.cookRecipeMapper.getDeviceSnByIds(deviceInfoList); } - List deviceSnList = this.cookRecipeMapper.getDeviceSnByIds(deviceInfoList); CookRecipeSortEnum sortEnum = CookRecipeSortEnum.getBindTypeMap().get(cookRecipeDTO.getBindType()); CookAppRecipe mar = new CookAppRecipe(); mar.setRecipeId(cookRecipeDTO.getRecipeId()); @@ -362,9 +363,11 @@ public class CookRecipeServiceImpl implements ICookRecipeService { } } //发送mq - for (String deviceSn : deviceSnList){ - DeviceMqPersonalUpdateMessageDTO bean = new DeviceMqPersonalUpdateMessageDTO().setUpdatePerson(0,cookRecipeDTO.getHandleType().equals(1) ? "update" : "del"); - MqUtil.pushToSingleDevice(bean, LeMqConstant.Topic.DEVICE_UPDATE_MENU_CONFIG_V4, deviceSn); + if (!CollectionUtils.isEmpty(deviceSnList)) { + for (String deviceSn : deviceSnList) { + DeviceMqPersonalUpdateMessageDTO bean = new DeviceMqPersonalUpdateMessageDTO().setUpdatePerson(0, cookRecipeDTO.getHandleType().equals(1) ? "update" : "del"); + MqUtil.pushToSingleDevice(bean, LeMqConstant.Topic.DEVICE_UPDATE_MENU_CONFIG_V4, deviceSn); + } } } }