Showing
1 changed file
with
7 additions
and
3 deletions
@@ -151,30 +151,34 @@ public class YtDeviceServiceImpl extends AbstractBaseService<DeviceMapper, YtDev | @@ -151,30 +151,34 @@ public class YtDeviceServiceImpl extends AbstractBaseService<DeviceMapper, YtDev | ||
151 | if (scenes == null || scenes.isEmpty()) { | 151 | if (scenes == null || scenes.isEmpty()) { |
152 | return true; | 152 | return true; |
153 | } | 153 | } |
154 | + Set<String> sceneNames = new HashSet<>(); | ||
154 | for (SceneLinkage scene : scenes) { | 155 | for (SceneLinkage scene : scenes) { |
155 | List<Trigger> triggers = triggerMapper.selectList(new QueryWrapper<Trigger>().lambda() | 156 | List<Trigger> triggers = triggerMapper.selectList(new QueryWrapper<Trigger>().lambda() |
156 | .eq(Trigger::getSceneLinkageId, scene.getId()) | 157 | .eq(Trigger::getSceneLinkageId, scene.getId()) |
157 | .eq(scene.getStatus() == FastIotConstants.StateValue.DISABLE, Trigger::getTriggerType, ScopeEnum.PART) | 158 | .eq(scene.getStatus() == FastIotConstants.StateValue.DISABLE, Trigger::getTriggerType, ScopeEnum.PART) |
158 | .like(Trigger::getEntityId, tbDeviceId)); | 159 | .like(Trigger::getEntityId, tbDeviceId)); |
159 | if (triggers != null && triggers.size() > 0) { | 160 | if (triggers != null && triggers.size() > 0) { |
160 | - throw new YtDataValidationException(String.format(ErrorMessage.DEVICE_USED_SCENE_REACT.getMessage(), scene.getName())); | 161 | + sceneNames.add(scene.getName()); |
161 | } | 162 | } |
162 | List<DoCondition> conditions = conditionMapper.selectList(new QueryWrapper<DoCondition>().lambda() | 163 | List<DoCondition> conditions = conditionMapper.selectList(new QueryWrapper<DoCondition>().lambda() |
163 | .eq(DoCondition::getSceneLinkageId, scene.getId()) | 164 | .eq(DoCondition::getSceneLinkageId, scene.getId()) |
164 | .eq(scene.getStatus() == FastIotConstants.StateValue.DISABLE, DoCondition::getEntityType, ScopeEnum.PART) | 165 | .eq(scene.getStatus() == FastIotConstants.StateValue.DISABLE, DoCondition::getEntityType, ScopeEnum.PART) |
165 | .like(DoCondition::getEntityId, tbDeviceId)); | 166 | .like(DoCondition::getEntityId, tbDeviceId)); |
166 | if (conditions != null && conditions.size() > 0) { | 167 | if (conditions != null && conditions.size() > 0) { |
167 | - throw new YtDataValidationException(String.format(ErrorMessage.DEVICE_USED_SCENE_REACT.getMessage(), scene.getName())); | 168 | + sceneNames.add(scene.getName()); |
168 | } | 169 | } |
169 | List<DoAction> actions = actionMapper.selectList(new QueryWrapper<DoAction>().lambda() | 170 | List<DoAction> actions = actionMapper.selectList(new QueryWrapper<DoAction>().lambda() |
170 | .eq(DoAction::getSceneLinkageId, scene.getId()) | 171 | .eq(DoAction::getSceneLinkageId, scene.getId()) |
171 | .eq(scene.getStatus() == FastIotConstants.StateValue.DISABLE, DoAction::getEntityType, ScopeEnum.PART) | 172 | .eq(scene.getStatus() == FastIotConstants.StateValue.DISABLE, DoAction::getEntityType, ScopeEnum.PART) |
172 | .like(DoAction::getDeviceId, tbDeviceId)); | 173 | .like(DoAction::getDeviceId, tbDeviceId)); |
173 | if (actions != null && actions.size() > 0) { | 174 | if (actions != null && actions.size() > 0) { |
174 | - throw new YtDataValidationException(String.format(ErrorMessage.DEVICE_USED_SCENE_REACT.getMessage(), scene.getName())); | 175 | + sceneNames.add(scene.getName()); |
175 | } | 176 | } |
176 | 177 | ||
177 | } | 178 | } |
179 | + if(sceneNames.size()>0){ | ||
180 | + throw new YtDataValidationException(String.format(ErrorMessage.DEVICE_USED_SCENE_REACT.getMessage(), sceneNames)); | ||
181 | + } | ||
178 | 182 | ||
179 | 183 | ||
180 | return result; | 184 | return result; |