|
@@ -21,6 +21,7 @@ import org.thingsboard.server.common.data.id.RuleChainId; |
|
@@ -21,6 +21,7 @@ import org.thingsboard.server.common.data.id.RuleChainId; |
21
|
import org.thingsboard.server.common.data.id.TenantId;
|
21
|
import org.thingsboard.server.common.data.id.TenantId;
|
22
|
import org.thingsboard.server.common.data.page.PageLink;
|
22
|
import org.thingsboard.server.common.data.page.PageLink;
|
23
|
import org.thingsboard.server.common.data.plugin.ComponentLifecycleEvent;
|
23
|
import org.thingsboard.server.common.data.plugin.ComponentLifecycleEvent;
|
|
|
24
|
+import org.thingsboard.server.common.data.rule.RuleChain;
|
24
|
import org.thingsboard.server.common.data.yunteng.common.DeleteGroup;
|
25
|
import org.thingsboard.server.common.data.yunteng.common.DeleteGroup;
|
25
|
import org.thingsboard.server.common.data.yunteng.constant.FastIotConstants;
|
26
|
import org.thingsboard.server.common.data.yunteng.constant.FastIotConstants;
|
26
|
import org.thingsboard.server.common.data.yunteng.core.exception.YtDataValidationException;
|
27
|
import org.thingsboard.server.common.data.yunteng.core.exception.YtDataValidationException;
|
|
@@ -218,9 +219,19 @@ public class YtDeviceProfileController extends BaseController { |
|
@@ -218,9 +219,19 @@ public class YtDeviceProfileController extends BaseController { |
218
|
tbDeviceProfile.setTenantId(TenantId.fromUUID(tenantId));
|
219
|
tbDeviceProfile.setTenantId(TenantId.fromUUID(tenantId));
|
219
|
tbDeviceProfile.setDefault(deviceProfileDTO.isDefault());
|
220
|
tbDeviceProfile.setDefault(deviceProfileDTO.isDefault());
|
220
|
|
221
|
|
|
|
222
|
+
|
|
|
223
|
+ String chainStr = deviceProfileDTO.getDefaultRuleChainId();
|
|
|
224
|
+ if(StringUtils.isBlank(chainStr)){
|
|
|
225
|
+ throw new YtDataValidationException(ErrorMessage.RULE_CHAIN_NOT_ENABLE.getMessage());
|
|
|
226
|
+ }
|
|
|
227
|
+ UUID chainId = UUID.fromString(chainStr);
|
|
|
228
|
+ RuleChain chain = ruleChainService.findRuleChainById(TenantId.SYS_TENANT_ID,new RuleChainId(chainId));
|
|
|
229
|
+ if(chain==null || !deviceProfileDTO.getTenantId().equals(chain.getTenantId().getId().toString())){
|
|
|
230
|
+ throw new YtDataValidationException(ErrorMessage.RULE_CHAIN_NOT_ENABLE.getMessage());
|
|
|
231
|
+ }
|
|
|
232
|
+
|
221
|
// 获取当前租户的默认规则链
|
233
|
// 获取当前租户的默认规则链
|
222
|
if (StringUtils.isNotBlank(deviceProfileDTO.getDefaultRuleChainId())) {
|
234
|
if (StringUtils.isNotBlank(deviceProfileDTO.getDefaultRuleChainId())) {
|
223
|
- UUID chainId = UUID.fromString(deviceProfileDTO.getDefaultRuleChainId());
|
|
|
224
|
tbDeviceProfile.setDefaultRuleChainId(new RuleChainId(chainId));
|
235
|
tbDeviceProfile.setDefaultRuleChainId(new RuleChainId(chainId));
|
225
|
}
|
236
|
}
|
226
|
|
237
|
|