From 49e023b28af6d32dad613c19eb6eb2701cdcc040 Mon Sep 17 00:00:00 2001
From: zengh <123456>
Date: Thu, 14 Jan 2021 15:37:29 +0800
Subject: [PATCH] 客户列表接口修改
---
src/main/java/org/springblade/modules/Netty/controller/nettyController.java | 39 ++++++++++++++++++++++++++++++++++++---
1 files changed, 36 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/springblade/modules/Netty/controller/nettyController.java b/src/main/java/org/springblade/modules/Netty/controller/nettyController.java
index 5d7acb3..fb8011b 100644
--- a/src/main/java/org/springblade/modules/Netty/controller/nettyController.java
+++ b/src/main/java/org/springblade/modules/Netty/controller/nettyController.java
@@ -159,22 +159,36 @@
int zT = 0;
+ String arr = "";
+
+
//将得到的设备与查询所得设备进行匹配
for (int i = 0; i < childList.size(); i++) {
for (int j = 0; j < pages.size(); j++) {
if (childList.get(i).get("eqid") != null) {
if (childList.get(i).get("eqid").equals(pages.get(j).getDeviceNumber())) {
+ zT = 1;
+ arr += pages.get(j).getId() + ",";
List<String> outData = new ArrayList<>();
outData.add("LC8109085B#@");
- int code = Integer.parseInt(pages.get(j).getDeviceNumber());
- Channel channel = channelHashMap.get(code);
+ Channel channel = channelHashMap.get(pages.get(j).getDeviceNumber());
+ if(channel == null){
+ break;
+ }
channel.writeAndFlush(Unpooled.copiedBuffer(outData.get(0), CharsetUtil.UTF_8));
+ break;
}
}
}
}
+
+ if (!arr.equals("")){
+ String substring = arr.substring(0, arr.length() - 1);
+ equipmentService.updataType(substring);
+ }
+
if (zT == 0) {
- return R.success("暂无设备撤");
+ return R.success("暂无设备布防");
}
return R.success("设备布防");
}
@@ -202,18 +216,31 @@
int zT = 0;
+ String arr = "";
+
//将得到的设备与查询所得设备进行匹配
for (int i = 0; i < childList.size(); i++) {
for (int j = 0; j < pages.size(); j++) {
if (childList.get(i).get("eqid") != null) {
if (childList.get(i).get("eqid").equals(pages.get(j).getDeviceNumber())) {
+ zT = 1;
+ arr += pages.get(j).getId() + ",";
List<String> outData = new ArrayList<>();
outData.add("LC8109085C#@");
Channel channel = channelHashMap.get(pages.get(j).getDeviceNumber());
+ if(channel == null){
+ break;
+ }
channel.writeAndFlush(Unpooled.copiedBuffer(outData.get(0), CharsetUtil.UTF_8));
+ break;
}
}
}
+ }
+
+ if (!arr.equals("")){
+ String substring = arr.substring(0, arr.length() - 1);
+ equipmentService.updataTypeC(substring);
}
if (zT == 0) {
@@ -256,6 +283,9 @@
List<String> outData = new ArrayList<>();
outData.add("LC8109085B#@");
Channel channel = channelHashMap.get(deviceNumber);
+ if(channel == null){
+ return R.success("未查询到设备");
+ }
channel.writeAndFlush(Unpooled.copiedBuffer(outData.get(0), CharsetUtil.UTF_8));
return R.success("设备布防");
@@ -274,6 +304,9 @@
List<String> outData = new ArrayList<>();
outData.add("LC8109085C#@");
Channel channel = channelHashMap.get(deviceNumber);
+ if(channel == null){
+ return R.success("未查询到设备");
+ }
channel.writeAndFlush(Unpooled.copiedBuffer(outData.get(0), CharsetUtil.UTF_8));
return R.success("设备撤防");
--
Gitblit v1.9.3