|
|
@@ -60,12 +60,15 @@ public class IotUrlService {
|
|
|
if (Objects.isNull(query) || Global.DEL == query.getDelFlag()) {
|
|
|
throw new BusinessException("产品不存在");
|
|
|
}
|
|
|
- //产品key
|
|
|
- String code = query.getCode();
|
|
|
- if (!StringUtils.startsWith(iotUrlPara.getUrl(), String.format(topicPrefix, code))) {
|
|
|
- throw new BusinessException("topic必须以" + String.format(topicPrefix, code) + "为前缀");
|
|
|
+ if (Objects.equals(iotUrlPara.getType(), UrlTypeEnum.MQTT.getVal())) {
|
|
|
+ //产品key
|
|
|
+ String code = query.getCode();
|
|
|
+ if (!StringUtils.startsWith(iotUrlPara.getUrl(), String.format(topicPrefix, code))) {
|
|
|
+ throw new BusinessException("topic必须以" + String.format(topicPrefix, code) + "为前缀");
|
|
|
+ }
|
|
|
+ //todo topic合规校验
|
|
|
+
|
|
|
}
|
|
|
- //todo topic合规校验
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -120,8 +123,8 @@ public class IotUrlService {
|
|
|
iotUrlMapper.insert(iotUrl);
|
|
|
//新增订阅的topic
|
|
|
if (Objects.equals(iotUrlPara.getType(), UrlTypeEnum.MQTT.getVal())
|
|
|
- && (Objects.equals(iotUrlPara.getPermission(), TopicType.PUB) || Objects.equals(iotUrlPara.getPermission(), TopicType.BOTH))) {
|
|
|
- subUrl(iotUrl.getUrl(), iotUrl.getFunc() + String.valueOf(iotUrl.getPermission()));
|
|
|
+ && (StrUtil.equals(iotUrlPara.getPermission(), TopicType.PUB) || StrUtil.equals(iotUrlPara.getPermission(), TopicType.BOTH))) {
|
|
|
+ subUrl(iotUrl.getUrl(), iotUrl.getFunc() + iotUrl.getPermission());
|
|
|
}
|
|
|
return true;
|
|
|
}
|