Commit 63ce2724c23585e52f31de5ad37ddd0c9f48e54b

Authored by 云中非
1 parent 9498d98f

fix(DEFECT-441): 设备删除提示信息

... ... @@ -151,30 +151,34 @@ public class YtDeviceServiceImpl extends AbstractBaseService<DeviceMapper, YtDev
151 151 if (scenes == null || scenes.isEmpty()) {
152 152 return true;
153 153 }
  154 + Set<String> sceneNames = new HashSet<>();
154 155 for (SceneLinkage scene : scenes) {
155 156 List<Trigger> triggers = triggerMapper.selectList(new QueryWrapper<Trigger>().lambda()
156 157 .eq(Trigger::getSceneLinkageId, scene.getId())
157 158 .eq(scene.getStatus() == FastIotConstants.StateValue.DISABLE, Trigger::getTriggerType, ScopeEnum.PART)
158 159 .like(Trigger::getEntityId, tbDeviceId));
159 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 163 List<DoCondition> conditions = conditionMapper.selectList(new QueryWrapper<DoCondition>().lambda()
163 164 .eq(DoCondition::getSceneLinkageId, scene.getId())
164 165 .eq(scene.getStatus() == FastIotConstants.StateValue.DISABLE, DoCondition::getEntityType, ScopeEnum.PART)
165 166 .like(DoCondition::getEntityId, tbDeviceId));
166 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 170 List<DoAction> actions = actionMapper.selectList(new QueryWrapper<DoAction>().lambda()
170 171 .eq(DoAction::getSceneLinkageId, scene.getId())
171 172 .eq(scene.getStatus() == FastIotConstants.StateValue.DISABLE, DoAction::getEntityType, ScopeEnum.PART)
172 173 .like(DoAction::getDeviceId, tbDeviceId));
173 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 184 return result;
... ...