Просмотр исходного кода

topic和http校验分类错误

xucaiqin 1 год назад
Родитель
Сommit
ab1f916f80

+ 10 - 7
iot-module/iot-module-manage/iot-module-manage-biz/src/main/java/com/middle/platform/manage/biz/service/IotUrlService.java

@@ -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;
     }