From 51af3e4e7c5fb612576b98fd6407f6b65859f374 Mon Sep 17 00:00:00 2001
From: Van333 <van666666@foxmail.com>
Date: 星期三, 16 十一月 2022 15:58:06 +0800
Subject: [PATCH] 区分消息订阅类型,新增上下线监听,修复定时帧缺少CRC32,替换设备在线状态查询方法
---
ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java | 42 ++++++++++++++++++++++++++++++------------
1 files changed, 30 insertions(+), 12 deletions(-)
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java
index bc17092..0de67ea 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java
@@ -60,6 +60,8 @@
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
+import static com.sandu.ximon.admin.localMQTT.callback.StatusMqttCallBack.localMqttConnectStatusMap;
+
/**
* 鐏潌鐩稿叧
*
@@ -129,24 +131,26 @@
/**
* 鍒犻櫎鐏潌
*/
- public boolean deletePole(Long poleId) {
- Pole pole = getById(poleId);
- if (pole == null) {
+ public boolean deletePole(List<Long> poleIds) {
+ List<Pole> poles = listByIds(poleIds);
+ if (poles.isEmpty()) {
throw new BusinessException("鏈壘鍒拌鐏潌");
}
// 鍒犻櫎鐏潌缁戝畾鍏崇郴
- poleBindingService.remove(Wrappers.<PoleBinding>lambdaQuery().eq(PoleBinding::getPoleId, poleId));
+ poleBindingService.remove(Wrappers.<PoleBinding>lambdaQuery().in(PoleBinding::getPoleId, poleIds));
+ SpringContextHolder.getBean(LightTaskPoleRelationService.class)
+ .remove(Wrappers.lambdaQuery(LightTaskPoleRelation.class).in(LightTaskPoleRelation::getPoleId, poleIds));
/**
* 鍒犻櫎鐏潌鏃ュ織璁板綍寮�濮�
*/
- String content = "{鐏潌Code锛�" + pole.getDeviceCode() + "锛� 鐏潌鍚嶇О锛�" + pole.getPoleName() + " }";
+ String content = "{鐏潌id锛�" + poles + " }";
StoreOperationRecordsUtils.storeOperationData(null, null, "鍒犻櫎鐏潌", content);
/**
* 鍒犻櫎鐏潌鏃ュ織璁板綍缁撴潫
*/
- return removeById(poleId);
+ return removeByIds(poleIds);
}
@@ -745,7 +749,6 @@
// }
// return list;
// }
-
public List<Pole> isTrue(List<Pole> list, PoleStatesParam param) {
//瀹炰綋鐏潌
List<Pole> isTrue = new ArrayList<>();
@@ -864,8 +867,8 @@
*
* @return 鏄惁鎴愬姛
*/
- public boolean unBindPole(Long poleId, String deviceCode) {
- return poleBindingService.unBindPole(poleId, deviceCode);
+ public boolean unBindPole(Long poleId, String deviceCode, Integer deviceType) {
+ return poleBindingService.unBindPole(poleId, deviceCode, deviceType);
}
@@ -1049,7 +1052,7 @@
* @return 璁惧鐘舵�佸垪琛�
*/
public List<DeviceStatus> listStatusByDeviceCode(ArrayList<String> deviceCodeList) {
- // 鏈�澶у彧鑳芥煡50涓�
+// 鏈�澶у彧鑳芥煡50涓�
List<List<String>> split = CollectionUtil.split(deviceCodeList, 50);
List<DeviceStatus> statusList = new ArrayList<>();
for (List<String> list : split) {
@@ -1063,6 +1066,21 @@
}
}
}
+// List<DeviceStatus> statusList = new ArrayList<>();
+//
+// deviceCodeList.forEach(l -> {
+// DeviceStatus deviceStatus = new DeviceStatus();
+// deviceStatus.setDeviceCode(l);
+//
+// if (localMqttConnectStatusMap.get(l)!=null &&
+// localMqttConnectStatusMap.get(l)== 1){
+// deviceStatus.setStatus(1);
+// }else {
+// deviceStatus.setStatus(0);
+// }
+// statusList.add(deviceStatus);
+// });
+
return statusList;
}
@@ -1337,7 +1355,7 @@
//璁剧疆瑙﹀彂鏉′欢 瀛樺叆Redis 15鍒嗛挓瓒呮椂 15鍒嗛挓鍐呭啀娆¤皟鐢ㄧ洿鎺ヨ繑鍥�
redisUtils.set("redisStatusKeyTimeout", System.currentTimeMillis(), 60 * 15);
- CountDownLatch countDownLatch = new CountDownLatch(7);//todo
+ CountDownLatch countDownLatch = new CountDownLatch(7);//todo 鍑犱釜璁惧璁剧疆涓哄嚑
//鑾峰彇涓�涓�7浣嶉殢鏈烘暟
String str = RandomStringUtils.randomAlphanumeric(7);
countDownLatchUtil.push(str, countDownLatch);
@@ -1418,4 +1436,4 @@
}
-}
\ No newline at end of file
+}
--
Gitblit v1.9.3