From a767f8b7e2aabf9bb3bb98344e8c559c71c1d442 Mon Sep 17 00:00:00 2001
From: ‘liusuyi’ <1951119284@qq.com>
Date: 星期五, 11 八月 2023 14:40:28 +0800
Subject: [PATCH] 过滤通用光电报警只保留移动侦测、周界入侵报警、越界侦测报警 增加报警主机、门禁主机、通用光电数据同步
---
src/main/java/com/ard/alarm/tube/service/TubeAlarmService.java | 39 +++++++++++++++++++--------------------
1 files changed, 19 insertions(+), 20 deletions(-)
diff --git a/src/main/java/com/ard/alarm/tube/service/TubeAlarmService.java b/src/main/java/com/ard/alarm/tube/service/TubeAlarmService.java
index 360f727..06584e6 100644
--- a/src/main/java/com/ard/alarm/tube/service/TubeAlarmService.java
+++ b/src/main/java/com/ard/alarm/tube/service/TubeAlarmService.java
@@ -1,12 +1,12 @@
package com.ard.alarm.tube.service;
import com.alibaba.fastjson2.JSON;
-import com.ard.utils.DateUtils;
+import com.ard.utils.other.DateUtils;
import com.ard.utils.mqtt.MqttConsumer;
-import com.ard.utils.tcp.NettyTcpClient;
import com.ard.utils.udp.NettyUdpServer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
+import org.springframework.core.annotation.Order;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
@@ -14,8 +14,6 @@
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
/**
* @Description: 绠$嚎娉勬紡鎶ヨ鏈嶅姟
@@ -26,14 +24,14 @@
**/
@Service
@Slf4j(topic = "tube")
+@Order(3)
public class TubeAlarmService {
@Resource
NettyUdpServer nettyUdpServer;
- @Resource
- NettyTcpClient nettyTcpClient;
- @Value("${spring.netty.port}")
+
+ @Value("${spring.netty.udp.port}")
private Integer udpPort;
- @Value("${spring.netty.enabled}")
+ @Value("${spring.netty.udp.enabled}")
private String UdpServerEnable;
@PostConstruct
@@ -42,10 +40,9 @@
return;
}
nettyUdpServer.init(udpPort);
- log.info("UDP鏈嶅姟宸茬粡鍚姩");
- nettyTcpClient.init("112.98.126.2",1200);
- log.info("TCP瀹㈡埛绔凡杩炴帴");
+ log.debug("绠$嚎娉勯湶UDP鏈嶅姟宸插惎鍔�");
}
+
@Async("alarm")
public void alarmHandler(String message) {
@@ -55,7 +52,7 @@
String start = messages[0];
String host = messages[1];
String tubeId = messages[2];
- String alarmTime = DateUtils.convertDate(messages[3]);
+ String alarmTime = DateUtils.convertDate(messages[3], "yyyy/M/d H:m:s");
String position = messages[4];
String type = messages[5];
String watcher = messages[6];
@@ -68,14 +65,14 @@
map.put("alarmType", start);
map.put("position", position);
map.put("watcher", watcher);
- log.info("寮�濮嬭В鏋�" + start);
- log.info("涓绘満锛�" + host);
- log.info("绠$嚎缂栧彿锛�" + tubeId);
- log.info("鎶ヨ鏃堕棿锛�" + alarmTime);
- log.info("鎶ヨ绫诲瀷锛�" + type);
- log.info("浣嶇疆锛�" + position);
- log.info("鍊肩彮浜猴細" + watcher);
- log.info("缁撴潫瑙f瀽" + stop);
+ log.debug("寮�濮嬭В鏋�" + start);
+ log.debug("涓绘満锛�" + host);
+ log.debug("绠$嚎缂栧彿锛�" + tubeId);
+ log.debug("鎶ヨ鏃堕棿锛�" + alarmTime);
+ log.debug("鎶ヨ绫诲瀷锛�" + type);
+ log.debug("浣嶇疆锛�" + position);
+ log.debug("鍊肩彮浜猴細" + watcher);
+ log.debug("缁撴潫瑙f瀽" + stop);
MqttConsumer.publish(2, false, "tube", JSON.toJSONString(map));
} else {
log.error("鏁版嵁寮傚父");
@@ -84,4 +81,6 @@
log.error("tube鎶ヨ鏁版嵁鎺ㄩ�佸紓甯革細" + ex.getMessage());
}
}
+
+
}
--
Gitblit v1.9.3