From e55c8b0a92eb9715edd90c31dfd4de51a47b588b Mon Sep 17 00:00:00 2001
From: liuhaonan <31457034@qq.com>
Date: 星期五, 04 十一月 2022 17:40:08 +0800
Subject: [PATCH] changes
---
ximon-admin/src/main/java/com/sandu/ximon/admin/service/MonitorService.java | 54 ++++++++++++++++++++++++++++++++----------------------
1 files changed, 32 insertions(+), 22 deletions(-)
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/MonitorService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/MonitorService.java
index 2169fc5..4188b54 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/MonitorService.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/MonitorService.java
@@ -175,30 +175,40 @@
/**
* 鍒犻櫎鎽勫儚澶�
*
- * @param Id
+ * @param
* @return
*/
- public boolean deleteMonitor(Long Id) {
- Monitor monitor = getById(Id);
- if (monitor == null) {
- throw new BusinessException("鎵句笉鍒版憚鍍忓ご");
+ public boolean deleteMonitor(List<Long> ids) {
+ List<Long> idList = new ArrayList<Long>();
+ List<Monitor> monitors = listByIds(ids);
+ if (!monitors.isEmpty()) {
+ monitors.forEach(
+ monitor -> {
+ if (monitor == null) {
+ throw new BusinessException("鎵句笉鍒版憚鍍忓ご");
+ }
+ PoleBinding one = poleBindingService.getOne(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getDeviceCode, monitor.getDeviceSerial()));
+ if (one != null) {
+ //鍒犻櫎鎽勫儚澶磋澶囧墠闇�瑕佸厛瑙g粦
+ poleBindingService.unBindPole(null, monitor.getDeviceSerial());
+ }
+ /**
+ * 鍒犻櫎鎽勫儚澶存棩蹇楄褰曞紑濮�
+ */
+ String content = "{鎽勫儚澶碈ode锛�" + monitor.getDeviceSerial() + "锛� 鎽勫儚澶村悕绉帮細" + monitor.getDeviceName() + " }";
+ List<String> listCode = new ArrayList<>();
+ listCode.add(monitor.getDeviceSerial());
+ StoreOperationRecordsUtils.storeOperationData(listCode, null, "鍒犻櫎鎽勫儚澶�", content);
+ /**
+ * 鍒犻櫎鎽勫儚澶存棩蹇楄褰曠粨鏉�
+ */
+ idList.add(monitor.getId());
+ }
+ );
}
- PoleBinding one = poleBindingService.getOne(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getDeviceCode, monitor.getDeviceSerial()));
- if (one != null) {
- //鍒犻櫎鎽勫儚澶磋澶囧墠闇�瑕佸厛瑙g粦
- poleBindingService.unBindPole(null, monitor.getDeviceSerial());
- }
- /**
- * 鍒犻櫎鎽勫儚澶存棩蹇楄褰曞紑濮�
- */
- String content = "{鎽勫儚澶碈ode锛�" + monitor.getDeviceSerial() + "锛� 鎽勫儚澶村悕绉帮細" + monitor.getDeviceName() + " }";
- List<String> listCode = new ArrayList<>();
- listCode.add(monitor.getDeviceSerial());
- StoreOperationRecordsUtils.storeOperationData(listCode, null, "鍒犻櫎鎽勫儚澶�", content);
- /**
- * 鍒犻櫎鎽勫儚澶存棩蹇楄褰曠粨鏉�
- */
- return removeById(Id);
+ //鍏ㄩ儴鍒犻櫎鎴愬姛
+ return removeByIds(idList);
+
}
/**
@@ -216,7 +226,7 @@
YSY_AccessTokenDto accessTokenDto = JSON.parseObject(s, YSY_AccessTokenDto.class);
//浜屾鑾峰彇
- if(accessTokenDto == null){
+ if (accessTokenDto == null) {
log.error("鑾峰彇鎽勫儚澶磘oken澶辫触,鏍煎紡鏈夎!");
s = HttpUtil.post(YSY_URL + ACCESSTOKEN_URL, paramMap);
accessTokenDto = JSON.parseObject(s, YSY_AccessTokenDto.class);
--
Gitblit v1.9.3