TRX 1 год назад
Родитель
Сommit
385141fba6

+ 0 - 8
OneCardIotServer/src/main/java/com/zhongshu/iot/server/core/service/artemis/ArtemisListenerService.java

@@ -1,7 +1,5 @@
 package com.zhongshu.iot.server.core.service.artemis;
 package com.zhongshu.iot.server.core.service.artemis;
 
 
-import com.zhongshu.iot.server.core.service.mqtt.GateWayInfoService;
-import com.zhongshu.iot.server.core.util.mqtt.mqttConfig.client.MQClient;
 import com.zhongshu.iot.server.core.util.mqtt.mqttConfig.constant.MQConstant;
 import com.zhongshu.iot.server.core.util.mqtt.mqttConfig.constant.MQConstant;
 import jakarta.jms.Destination;
 import jakarta.jms.Destination;
 import jakarta.jms.Message;
 import jakarta.jms.Message;
@@ -24,15 +22,9 @@ import java.util.Enumeration;
 @Service
 @Service
 public class ArtemisListenerService {
 public class ArtemisListenerService {
 
 
-    @Autowired
-    MQClient mqClient;
-
     @Autowired
     @Autowired
     OperationMessageService operationMessageService;
     OperationMessageService operationMessageService;
 
 
-    @Autowired
-    GateWayInfoService gateWayInfoService;
-
     // 网关来的消息
     // 网关来的消息
     @JmsListener(destination = "/v1/gateway/#", containerFactory = MQConstant.TopicListenerContainerFactory)
     @JmsListener(destination = "/v1/gateway/#", containerFactory = MQConstant.TopicListenerContainerFactory)
     @JmsListener(destination = ".v1.gateway.#", containerFactory = MQConstant.TopicListenerContainerFactory)
     @JmsListener(destination = ".v1.gateway.#", containerFactory = MQConstant.TopicListenerContainerFactory)

+ 10 - 13
OneCardIotServer/src/main/java/com/zhongshu/iot/server/core/service/artemis/OperationMessageService.java

@@ -214,6 +214,12 @@ public class OperationMessageService {
             }
             }
             // 提取内容里面的数据
             // 提取内容里面的数据
             JSONObject jsonObject = JSONUtil.parseObj(msg);
             JSONObject jsonObject = JSONUtil.parseObj(msg);
+            // 其他地方下发的,不用这处理
+            Boolean issued = jsonObject.getBool("issued");
+            if (issued != null && issued) {
+                return;
+            }
+
             String id = jsonObject.getStr("id");
             String id = jsonObject.getStr("id");
             Long time = jsonObject.getLong("time");
             Long time = jsonObject.getLong("time");
             Long ttl = jsonObject.getLong("ttl");
             Long ttl = jsonObject.getLong("ttl");
@@ -223,21 +229,12 @@ public class OperationMessageService {
                 event = arr[arr.length - 1];
                 event = arr[arr.length - 1];
                 jsonObject.put("event", event);
                 jsonObject.put("event", event);
             }
             }
-            Boolean issued = jsonObject.getBool("issued");
-            if (issued != null && issued) {
-                return;
-            }
-
-            // 是否是测试
-            boolean isTest = false;
-            // ping不执行
-            if (isTest && event.equals("ping")) {
-                return;
-            }
-            if (isTest) {
+            if (StringUtils.isEmpty(id)) {
                 id = CommonUtil.UUID();
                 id = CommonUtil.UUID();
             }
             }
-            log.info("Topic: {} {}", event, topicName);
+            log.info(" ");
+            log.info(" ");
+            log.info("***************start MQTT Message Topic: {} {} ****************", event, topicName);
 
 
             String gateWayId = jsonObject.getStr("gatewayId");
             String gateWayId = jsonObject.getStr("gatewayId");
             String deviceId = jsonObject.getStr("deviceId");
             String deviceId = jsonObject.getStr("deviceId");

+ 2 - 1
OneCardIotServer/src/main/java/com/zhongshu/iot/server/core/service/mqtt/DevicePingInfoService.java

@@ -75,7 +75,7 @@ public class DevicePingInfoService extends SuperService {
 
 
             // ping记录
             // ping记录
             DevicePingInfo devicePingInfo = new DevicePingInfo();
             DevicePingInfo devicePingInfo = new DevicePingInfo();
-            devicePingInfo.setPingType(DeviceType.Consumer.name());
+            devicePingInfo.setPingType(deviceInfo.getDeviceType().name());
             devicePingInfo.setDeviceId(deviceId);
             devicePingInfo.setDeviceId(deviceId);
             devicePingInfo.setDeviceName(deviceInfo.getDeviceName());
             devicePingInfo.setDeviceName(deviceInfo.getDeviceName());
             devicePingInfo.setGateWayId(param.getGateWayId());
             devicePingInfo.setGateWayId(param.getGateWayId());
@@ -83,6 +83,7 @@ public class DevicePingInfoService extends SuperService {
             devicePingInfo.setTTL(new Date(System.currentTimeMillis() + pingTTl));
             devicePingInfo.setTTL(new Date(System.currentTimeMillis() + pingTTl));
             devicePingInfo.setTimeStr(DateUtils.paresTime(System.currentTimeMillis(), DateUtils.FORMAT_LONG));
             devicePingInfo.setTimeStr(DateUtils.paresTime(System.currentTimeMillis(), DateUtils.FORMAT_LONG));
             devicePingInfoDao.save(devicePingInfo);
             devicePingInfoDao.save(devicePingInfo);
+
             // 通知设备
             // 通知设备
             deviceSyncFullCardService.noticeSyncDeviceOnlineTimeChange(deviceId);
             deviceSyncFullCardService.noticeSyncDeviceOnlineTimeChange(deviceId);
         } else {
         } else {

+ 1 - 1
OneCardIotServer/src/main/java/com/zhongshu/iot/server/core/service/openApi/OpenAPIRegisterService.java

@@ -38,7 +38,7 @@ public class OpenAPIRegisterService {
         param.setPredicateArgs(String.format("/%s/**", sign));
         param.setPredicateArgs(String.format("/%s/**", sign));
         param.setOpenApiInfo(openAPIS);
         param.setOpenApiInfo(openAPIS);
         param.setApiType(ApiType.IOT.name());
         param.setApiType(ApiType.IOT.name());
-        ResultContent content = restTemplate.postForObject("http://openapiserver-wjf/manager/gateway/api/refresh", param, ResultContent.class);
+        ResultContent content = restTemplate.postForObject("http://openapiserver/manager/gateway/api/refresh", param, ResultContent.class);
         if (content == null) {
         if (content == null) {
             content = ResultContent.buildSuccess();
             content = ResultContent.buildSuccess();
         }
         }

+ 1 - 1
OneCardIotServer/src/main/java/com/zhongshu/iot/server/core/service/sync/DeviceSyncFullCardService.java

@@ -249,7 +249,7 @@ public class DeviceSyncFullCardService extends SuperService {
             param.setOnLineState(deviceInfo.getOnLineState().name());
             param.setOnLineState(deviceInfo.getOnLineState().name());
             param.setProjectInfoCode(deviceInfo.getProjectInfoCode());
             param.setProjectInfoCode(deviceInfo.getProjectInfoCode());
             APIResponseModel api = apiRequestService.sendFullCardAPI(FullCardAPIConfig.syncDeviceOnLineState, param);
             APIResponseModel api = apiRequestService.sendFullCardAPI(FullCardAPIConfig.syncDeviceOnLineState, param);
-            log.info("同步设备在线时间{} {}", api.isSuccess(), api.getMsg());
+            log.info("同步设备在线时间: {} {}", api.isSuccess(), api.getMsg());
         }
         }
     }
     }