TRX 1 rok pred
rodič
commit
aade0dbd6a

+ 3 - 0
OneCardIotClient/src/main/java/com/zhongshu/iot/client/model/iot/IotMainSearch.java

@@ -3,6 +3,7 @@ package com.zhongshu.iot.client.model.iot;
 import com.zhongshu.iot.client.model.baseParam.SuperSearchParam;
 import com.zhongshu.iot.client.type.DataType;
 import com.github.microservice.types.FunctionType;
+import com.zhongshu.iot.client.type.IotDataType;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.AllArgsConstructor;
 import lombok.Data;
@@ -43,4 +44,6 @@ public class IotMainSearch extends SuperSearchParam {
 
     @Schema(description = "搜索关键字")
     private String keyWord;
+
+    private IotDataType iotDataType;
 }

+ 6 - 0
OneCardIotServer/src/main/java/com/zhongshu/iot/server/core/dao/iot/impl/IotMainDaoImpl.java

@@ -6,6 +6,7 @@ import com.zhongshu.iot.server.core.domain.iot.IotMain;
 import com.zhongshu.iot.server.core.domain.iot.IotTemplate;
 import com.github.microservice.components.data.mongo.mongo.helper.DBHelper;
 import com.zhongshu.iot.client.model.iot.IotMainSearch;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
@@ -25,6 +26,7 @@ import java.util.regex.Pattern;
  * @CreateDate: 2023/4/12
  * @Version: 1.0
  */
+@Slf4j
 public class IotMainDaoImpl extends BaseImpl implements IotMainDaoExtend {
 
     @Autowired
@@ -45,6 +47,10 @@ public class IotMainDaoImpl extends BaseImpl implements IotMainDaoExtend {
             criteria.and("functionType").is(param.getFunctionType());
         }
 
+        if (param.getIotDataType() != null) {
+            criteria.and("iotDataType").is(param.getIotDataType());
+        }
+
         if (param.getDataType() != null) {
             criteria.and("dataType").is(param.getDataType());
         }

+ 3 - 2
OneCardIotServer/src/main/java/com/zhongshu/iot/server/core/service/iot/IotSendMessageService.java

@@ -75,6 +75,7 @@ public class IotSendMessageService extends SuperService {
     public ResultContent sendIotMessage(IotSendParam param) {
         IotMainSearch search = new IotMainSearch();
         BeanUtils.copyProperties(param, search);
+        search.setIotDataType(IotDataType.Device);
         Pageable pageable = PageRequest.of(0, Integer.MAX_VALUE);
         Page<IotMain> page = iotMainDao.page(pageable, search);
 
@@ -84,8 +85,8 @@ public class IotSendMessageService extends SuperService {
             return ResultContent.buildFail("没有对应的设备物模型");
         }
         // list 去重
-        list= list.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(
-                        () -> new TreeSet<>(Comparator.comparing(IotMain::getRealIotTopic))), ArrayList::new));
+        list = list.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(
+                () -> new TreeSet<>(Comparator.comparing(IotMain::getRealIotTopic))), ArrayList::new));
 
         DeviceInfo deviceInfo = null;
         GateWayInfo gateWayInfo = null;