From 4082af9f2275d501cd47a8a63e34cb266a2fbfd4 Mon Sep 17 00:00:00 2001
From: 罗元桥 <2376770955@qq.com>
Date: 星期六, 09 十月 2021 18:44:00 +0800
Subject: [PATCH] Merge branch 'test_bak' into 'master'

---
 springcloud_k8s_panzhihuazhihuishequ/service_property/src/main/java/com/panzhihua/service_property/config/WebSocketClient.java |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 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 fe1d535..621cc0a 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
@@ -12,6 +12,7 @@
 import org.springframework.stereotype.Component;
 
 import com.alibaba.fastjson.JSONObject;
+import com.panzhihua.common.utlis.StringUtils;
 import com.panzhihua.service_property.dao.ComPropertyAlarmDao;
 import com.panzhihua.service_property.dto.DeviceDto;
 import com.panzhihua.service_property.entity.ComPropertyAlarm;
@@ -65,6 +66,7 @@
     @OnMessage
     public void onMessage(String message, Session session) {
         // 提取数据
+        logger.info("收到的原始数据:{}", message);
         dealData(message);
     }
 
@@ -72,12 +74,16 @@
     void dealData(String message) {
         comPropertyAlarmDao = SpringUtil.getBean(ComPropertyAlarmDao.class);
         DeviceDto deviceInfo = JSONObject.parseObject(message, DeviceDto.class);
-        if (deviceInfo.getCallstatus().equals("RINGING")) {
+        boolean checkFlag =
+            "RINGING".equals(deviceInfo.getCallstatus()) && StringUtils.isNotEmpty(deviceInfo.getOri_number());
+        if (checkFlag) {
             logger.info("收到设备报警信息:{}", message);
             ComPropertyAlarm comPropertyAlarm = new ComPropertyAlarm();
-            comPropertyAlarm.setSerialNo(deviceInfo.getCallid());
-            comPropertyAlarm.setStatus(1);
+            comPropertyAlarm.setSerialNo(deviceInfo.getOri_number());
+            comPropertyAlarm.setReceiveNo(deviceInfo.getUserid());
+            comPropertyAlarm.setStatus(0);
             comPropertyAlarm.setCreateTime(new Date());
+            comPropertyAlarm.setType(1);
             comPropertyAlarmDao.insert(comPropertyAlarm);
         }
     }

--
Gitblit v1.7.1