TRX 1 år sedan
förälder
incheckning
bea899426a
14 ändrade filer med 57 tillägg och 23 borttagningar
  1. 6 0
      OneCardIotClient/src/main/java/com/zhongshu/iot/client/model/mqtt/GateWayUserInfoAddParam.java
  2. 3 0
      OneCardIotClient/src/main/java/com/zhongshu/iot/client/model/mqtt/GateWayUserInfoSearchParam.java
  3. 4 0
      OneCardIotServer/src/main/java/com/zhongshu/iot/server/core/dao/mqtt/impl/GateWayUserInfoDaoImpl.java
  4. 3 0
      OneCardIotServer/src/main/java/com/zhongshu/iot/server/core/domain/iot/mqtt/GateWayUserInfo.java
  5. 4 2
      OneCardIotServer/src/main/java/com/zhongshu/iot/server/core/service/device/GateWayInfoService.java
  6. 3 0
      OneCardIotServer/src/main/java/com/zhongshu/iot/server/core/service/device/GateWayUserInfoService.java
  7. 3 1
      OneCardIotServer/src/main/java/com/zhongshu/iot/server/core/service/iotPlatform/PlatformTopic.java
  8. 3 1
      OneCardIotServer/src/main/java/com/zhongshu/iot/server/core/service/iotPlatform/impl/OnLineTopic.java
  9. 3 2
      OneCardIotServer/src/main/java/com/zhongshu/iot/server/core/service/iotPlatform/impl/PingTopic.java
  10. 3 2
      OneCardIotServer/src/main/java/com/zhongshu/iot/server/core/service/iotPlatform/impl/RegisterDeviceTopic.java
  11. 3 2
      OneCardIotServer/src/main/java/com/zhongshu/iot/server/core/service/iotPlatform/impl/RegisterGatewayTopic.java
  12. 3 2
      OneCardIotServer/src/main/java/com/zhongshu/iot/server/core/service/iotPlatform/impl/SystemTimeTopic.java
  13. 3 2
      OneCardIotServer/src/main/java/com/zhongshu/iot/server/core/service/iotPlatform/impl/UnLineTopic.java
  14. 13 9
      OneCardIotServer/src/main/java/com/zhongshu/iot/server/core/service/other/ScanExecuteService.java

+ 6 - 0
OneCardIotClient/src/main/java/com/zhongshu/iot/client/model/mqtt/GateWayUserInfoAddParam.java

@@ -21,4 +21,10 @@ public class GateWayUserInfoAddParam extends SuperParam {
 
     @Schema(description = "最大的可绑定的设备数")
     private Long number;
+
+    @Schema(description = "分组code")
+    private String projectCode;
+
+    @Schema(description = "是否显示")
+    private Boolean isShow = Boolean.TRUE;
 }

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

@@ -23,4 +23,7 @@ public class GateWayUserInfoSearchParam extends SuperSearchParam {
 
     @Schema(description = "用户状态:可用不可用")
     private MqttUserState state;
+
+    @Schema(description = "是否显示")
+    private Boolean isShow;
 }

+ 4 - 0
OneCardIotServer/src/main/java/com/zhongshu/iot/server/core/dao/mqtt/impl/GateWayUserInfoDaoImpl.java

@@ -44,6 +44,10 @@ public class GateWayUserInfoDaoImpl extends BaseImpl implements GateWayUserInfoD
             criteria.and("state").is(param.getState());
         }
 
+        if (param.getIsShow() != null) {
+            criteria.and("isShow").is(param.getIsShow());
+        }
+
         // 模糊搜索
         List<Criteria> criterias = new ArrayList<>();
         if (StringUtils.isNotEmpty(param.getUserName())) {

+ 3 - 0
OneCardIotServer/src/main/java/com/zhongshu/iot/server/core/domain/iot/mqtt/GateWayUserInfo.java

@@ -38,4 +38,7 @@ public class GateWayUserInfo extends SuperEntity {
 
     @Schema(description = "已绑定的设备数量")
     private Long bindNumber = 0L;
+
+    @Schema(description = "是否显示")
+    private Boolean isShow = Boolean.TRUE;
 }

+ 4 - 2
OneCardIotServer/src/main/java/com/zhongshu/iot/server/core/service/device/GateWayInfoService.java

@@ -98,11 +98,13 @@ public class GateWayInfoService extends SuperService {
         CommonResult commonResult = new CommonResult();
         OperationMessage operationMessage = operationMessageDao.findTopByDataId(dataId);
         if (ObjectUtils.isEmpty(operationMessage)) {
-            return ResultContent.buildFail("数据不存在");
+            commonResult.setFailed("数据不存在");
+            return ResultContent.buildSuccess(commonResult);
         }
         ResultContent<GateWayUserInfo> resultContent = gateWayUserInfoService.verifyMqttUser(operationMessage.getTopic());
         if (resultContent.isFailed()) {
-            return ResultContent.buildFail(resultContent.getMsg());
+            commonResult.setFailed(resultContent.getMsg());
+            return ResultContent.buildSuccess(commonResult);
         }
 
         return ResultContent.buildSuccess(commonResult);

+ 3 - 0
OneCardIotServer/src/main/java/com/zhongshu/iot/server/core/service/device/GateWayUserInfoService.java

@@ -87,6 +87,7 @@ public class GateWayUserInfoService {
             param.setUserName(userName);
             param.setPassWord("admin123");
             param.setRoleName(MqttConfig.adminRoleName);
+            param.setIsShow(Boolean.FALSE);
             addGateWayUser(param);
             log.info(String.format("gateWayUser [%s] 初始化成功", userName));
         } else {
@@ -151,6 +152,7 @@ public class GateWayUserInfoService {
         userParam.setPassWord(CommonUtil.generateRandomString(16));
         userParam.setRoleName(roleName);
         userParam.setNumber(number);
+        userParam.setProjectCode(param.getProjectCode());
         ResultContent<GateWayUserInfo> resultContent = addGateWayUser(userParam);
         if (resultContent.isFailed()) {
             return ResultContent.buildFail(resultContent.getMsg());
@@ -292,6 +294,7 @@ public class GateWayUserInfoService {
      * @return
      */
     public ResultContent<Page<GateWayUserInfoModel>> pageGateWayUser(Pageable pageable, GateWayUserInfoSearchParam param) {
+        param.setIsShow(Boolean.TRUE);
         Page<GateWayUserInfo> page = gateWayUserInfoDao.page(pageable, param);
         return ResultContent.buildSuccess(PageEntityUtil.toPageModel(page, this::toModel));
     }

+ 3 - 1
OneCardIotServer/src/main/java/com/zhongshu/iot/server/core/service/iotPlatform/PlatformTopic.java

@@ -1,9 +1,11 @@
 package com.zhongshu.iot.server.core.service.iotPlatform;
 
+import com.github.microservice.net.ResultContent;
+
 public interface PlatformTopic {
 
     public String topic();
 
-    public void action(String dataId, String message);
+    public ResultContent<Object> action(String dataId, String message);
 
 }

+ 3 - 1
OneCardIotServer/src/main/java/com/zhongshu/iot/server/core/service/iotPlatform/impl/OnLineTopic.java

@@ -1,5 +1,6 @@
 package com.zhongshu.iot.server.core.service.iotPlatform.impl;
 
+import com.github.microservice.net.ResultContent;
 import com.zhongshu.iot.server.core.domain.ExecuteAnnotationService;
 import com.zhongshu.iot.server.core.service.base.SuperService;
 import com.zhongshu.iot.server.core.service.iotPlatform.PlatformTopic;
@@ -21,7 +22,8 @@ public class OnLineTopic implements PlatformTopic {
     }
 
     @Override
-    public void action(String topic, String message) {
+    public ResultContent<Object> action(String topic, String message) {
 
+        return ResultContent.buildSuccess();
     }
 }

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

@@ -1,5 +1,6 @@
 package com.zhongshu.iot.server.core.service.iotPlatform.impl;
 
+import com.github.microservice.net.ResultContent;
 import com.zhongshu.iot.server.core.domain.ExecuteAnnotationService;
 import com.zhongshu.iot.server.core.domain.ExecuteAnnotationServiceMethod;
 import com.zhongshu.iot.server.core.service.device.DevicePingInfoService;
@@ -27,7 +28,7 @@ public class PingTopic implements PlatformTopic {
 
     @ExecuteAnnotationServiceMethod(value = "ping", remark = "ping心跳")
     @Override
-    public void action(String dataId, String message) {
-        devicePingInfoService.ping(dataId, message);
+    public ResultContent<Object> action(String dataId, String message) {
+        return devicePingInfoService.ping(dataId, message);
     }
 }

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

@@ -1,6 +1,7 @@
 package com.zhongshu.iot.server.core.service.iotPlatform.impl;
 
 
+import com.github.microservice.net.ResultContent;
 import com.zhongshu.iot.server.core.domain.ExecuteAnnotationService;
 import com.zhongshu.iot.server.core.domain.ExecuteAnnotationServiceMethod;
 import com.zhongshu.iot.server.core.service.iotPlatform.PlatformTopic;
@@ -23,7 +24,7 @@ public class RegisterDeviceTopic implements PlatformTopic {
 
     @ExecuteAnnotationServiceMethod(value = "registDevice", remark = "设备注册")
     @Override
-    public void action(String dataId, String message) {
-
+    public ResultContent<Object> action(String dataId, String message) {
+        return ResultContent.buildSuccess();
     }
 }

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

@@ -1,6 +1,7 @@
 package com.zhongshu.iot.server.core.service.iotPlatform.impl;
 
 
+import com.github.microservice.net.ResultContent;
 import com.zhongshu.iot.server.core.domain.ExecuteAnnotationService;
 import com.zhongshu.iot.server.core.domain.ExecuteAnnotationServiceMethod;
 import com.zhongshu.iot.server.core.service.device.GateWayInfoService;
@@ -28,7 +29,7 @@ public class RegisterGatewayTopic implements PlatformTopic {
 
     @ExecuteAnnotationServiceMethod(value = "registGateway", remark = "网关注册")
     @Override
-    public void action(String dataId, String message) {
-        gateWayInfoService.gateWayRegister(dataId, message);
+    public ResultContent<Object> action(String dataId, String message) {
+        return gateWayInfoService.gateWayRegister(dataId, message);
     }
 }

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

@@ -1,5 +1,6 @@
 package com.zhongshu.iot.server.core.service.iotPlatform.impl;
 
+import com.github.microservice.net.ResultContent;
 import com.zhongshu.iot.server.core.domain.ExecuteAnnotationService;
 import com.zhongshu.iot.server.core.service.iotPlatform.PlatformTopic;
 import lombok.extern.slf4j.Slf4j;
@@ -20,8 +21,8 @@ public class SystemTimeTopic implements PlatformTopic {
     }
 
     @Override
-    public void action(String topic, String message) {
-
+    public ResultContent<Object> action(String topic, String message) {
+        return ResultContent.buildSuccess();
     }
 
 }

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

@@ -1,5 +1,6 @@
 package com.zhongshu.iot.server.core.service.iotPlatform.impl;
 
+import com.github.microservice.net.ResultContent;
 import com.zhongshu.iot.server.core.domain.ExecuteAnnotationService;
 import com.zhongshu.iot.server.core.service.iotPlatform.PlatformTopic;
 import lombok.extern.slf4j.Slf4j;
@@ -20,8 +21,8 @@ public class UnLineTopic implements PlatformTopic {
     }
 
     @Override
-    public void action(String topic, String message) {
-
+    public ResultContent<Object> action(String topic, String message) {
+        return ResultContent.buildSuccess();
     }
 
 }

+ 13 - 9
OneCardIotServer/src/main/java/com/zhongshu/iot/server/core/service/other/ScanExecuteService.java

@@ -10,6 +10,7 @@ import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.lang.annotation.Annotation;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.List;
@@ -40,15 +41,18 @@ public class ScanExecuteService {
                 String className = CommonUtil.toFirstCharLowerCase(cls.getSimpleName());
                 Method[] methods = cls.getMethods();
                 for (Method method : methods) {
-                    if (method.isAnnotationPresent(ExecuteAnnotationServiceMethod.class)) {
-                        String methodName = method.getName();
-                        ExecuteAnnotationServiceMethod t = method.getAnnotation(ExecuteAnnotationServiceMethod.class);
-                        ExecuteMethodInfo methodInfo = new ExecuteMethodInfo();
-                        methodInfo.setMethodName(methodName);
-                        methodInfo.setBeanName(className);
-                        methodInfo.setEvent(t.value());
-                        methodInfo.setRemark(t.remark());
-                        list.add(methodInfo);
+                    Annotation[] annotations = method.getAnnotations();
+                    for(Annotation annotation : annotations) {
+                        if (annotation instanceof ExecuteAnnotationServiceMethod) {
+                            String methodName = method.getName();
+                            ExecuteAnnotationServiceMethod t = method.getAnnotation(ExecuteAnnotationServiceMethod.class);
+                            ExecuteMethodInfo methodInfo = new ExecuteMethodInfo();
+                            methodInfo.setMethodName(methodName);
+                            methodInfo.setBeanName(className);
+                            methodInfo.setEvent(t.value());
+                            methodInfo.setRemark(t.remark());
+                            list.add(methodInfo);
+                        }
                     }
                 }
             }