From 0b86991ec32103d55603c3b267b026193ea14a65 Mon Sep 17 00:00:00 2001
From: manailin <261030956@qq.com>
Date: 星期五, 08 四月 2022 10:19:42 +0800
Subject: [PATCH] [修改]修改设备取值区分,7-8开头的是攀枝花设备

---
 springcloud_k8s_panzhihuazhihuishequ/service_property/src/main/java/com/panzhihua/service_property/config/WebSocketClient.java |   35 ++++++++++++++++++++---------------
 1 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_property/src/main/java/com/panzhihua/service_property/config/WebSocketClient.java b/springcloud_k8s_panzhihuazhihuishequ/service_property/src/main/java/com/panzhihua/service_property/config/WebSocketClient.java
index 23fda66..44709df 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_property/src/main/java/com/panzhihua/service_property/config/WebSocketClient.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_property/src/main/java/com/panzhihua/service_property/config/WebSocketClient.java
@@ -76,21 +76,26 @@
         boolean checkFlag =
                 ("trace_call".equals(deviceMess.getString("cmd")) && (StringUtils.isNotEmpty(deviceMess.getString("userid"))));
         if (checkFlag) {
-            logger.info("收到设备报警信息:{}", message);
-            for (int i = 1; i < 10; i++) {
-                if (org.apache.commons.lang.StringUtils.isNotEmpty(deviceMess.getString("num" + i))) {
-                    ComPropertyAlarm comPropertyAlarm = new ComPropertyAlarm();
-                    comPropertyAlarm.setSerialNo(deviceMess.getString("userid"));
-                    comPropertyAlarm.setReceiveNo(deviceMess.getString("num" + i));
-                    comPropertyAlarm.setStatus(0);
-                    // 10位的秒级别的时间戳
-                    Date createDate = new Date(deviceMess.getLong("ts" + i) * 1000);
-                    //对应的就是时间戳对应的Date
-                    comPropertyAlarm.setCreateTime(createDate);
-                    comPropertyAlarm.setType(1);
-                    comPropertyAlarmDao.insert(comPropertyAlarm);
-                } else {
-                    break;
+            log.info("已经接收到报警记录,记录信息:{}",deviceMess.toJSONString());
+            boolean panzhihuaDevice = deviceMess.getString("userid").startsWith("7") || deviceMess.getString("userid").startsWith("8");
+            if(panzhihuaDevice) {
+                log.info("报警记录是攀枝花设备7-8开头的设备");
+                logger.info("收到设备报警信息:{}", message);
+                for (int i = 1; i < 10; i++) {
+                    if (org.apache.commons.lang.StringUtils.isNotEmpty(deviceMess.getString("num" + i))) {
+                        ComPropertyAlarm comPropertyAlarm = new ComPropertyAlarm();
+                        comPropertyAlarm.setSerialNo(deviceMess.getString("userid"));
+                        comPropertyAlarm.setReceiveNo(deviceMess.getString("num" + i));
+                        comPropertyAlarm.setStatus(0);
+                        // 10位的秒级别的时间戳
+                        Date createDate = new Date(deviceMess.getLong("ts" + i) * 1000);
+                        //对应的就是时间戳对应的Date
+                        comPropertyAlarm.setCreateTime(createDate);
+                        comPropertyAlarm.setType(1);
+                        comPropertyAlarmDao.insert(comPropertyAlarm);
+                    } else {
+                        break;
+                    }
                 }
             }
         }

--
Gitblit v1.7.1