From af4cd17b9851e940dd1dc8a43b3b21fbdd452f76 Mon Sep 17 00:00:00 2001
From: liuhaonan <31457034@qq.com>
Date: 星期五, 23 九月 2022 17:09:54 +0800
Subject: [PATCH] changes
---
ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java | 56 +++++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 45 insertions(+), 11 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 9cf84ce..fb5656d 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
@@ -32,6 +32,7 @@
import com.sandu.ximon.admin.param.PoleBindingParam;
import com.sandu.ximon.admin.param.PoleParam;
import com.sandu.ximon.admin.param.PoleStatesParam;
+import com.sandu.ximon.admin.param.PushAirDataToNovaParam;
import com.sandu.ximon.admin.redis.LightKey;
import com.sandu.ximon.admin.security.SecurityUtils;
import com.sandu.ximon.admin.utils.LightemitUtils;
@@ -643,10 +644,13 @@
boolean result = saveOrUpdate(pole);
if (result) {
- Light light = new Light();
- light.setDeviceCode(uniqueMac);
- light.setLightCount(2);
- SpringContextHolder.getBean(LightService.class).save(light);
+ Light light = SpringContextHolder.getBean(LightService.class).getOne(Wrappers.lambdaQuery(Light.class).eq(Light::getDeviceCode, pole.getDeviceCode()).last("limit 1"));
+ if (light == null) {
+ light = new Light();
+ light.setDeviceCode(uniqueMac);
+ light.setLightCount(2);
+ SpringContextHolder.getBean(LightService.class).save(light);
+ }
}
/**
@@ -713,10 +717,36 @@
if (pole == null) {
throw new BusinessException("鐏潌涓嶅瓨鍦�");
}
- pole.setUserId(clientId);
- if (!clientService.findClientId(clientId)) {
- pole.setClientId(clientService.getClientId(clientId));
+ pole.setClientId(clientId);
+ if (clientService.findClientId(clientId)) {
+ pole.setUserId(clientService.getClientId(clientId));
+
}
+ r = updateById(pole);
+
+ if (!r) {
+ throw new BusinessException("鐏潌ID涓�" + poleId + "璁剧疆澶辫触,鑷姩鍋滄");
+ }
+
+ }
+ return r;
+ }
+
+ /**
+ * 鐢ㄦ埛瑙g粦鐏潌
+ *
+ * @param clientId
+ * @param poleIds
+ * @return
+ */
+ public boolean ClientUnBindingPole(long clientId, int[] poleIds) {
+ boolean r = false;
+ for (int poleId : poleIds) {
+ Pole pole = getById(poleId);
+ if (pole == null) {
+ throw new BusinessException("鐏潌涓嶅瓨鍦�");
+ }
+ pole.setClientId(-1L);
r = updateById(pole);
if (!r) {
@@ -899,14 +929,17 @@
throw new BusinessException("璁惧涓嶅瓨鍦�");
}
//鍏抽棴鎺ㄩ��
- SpringContextHolder.getBean(LightemitUtils.class).clear(xixun.getDeviceCode());
-
+ String clear = SpringContextHolder.getBean(LightemitUtils.class).clear(xixun.getDeviceCode());
+ if (clear.contains("is not") || clear.contains("does not")) {
+ throw new BusinessException("璁惧涓嶅湪绾挎垨璁惧鏈瓨鍦ㄤ簬鏈嶅姟鍣�");
+ }
}
/**
* 鎺ㄩ�佸ぇ姘旂洃娴嬫暟鎹埌novaLED
*/
- public VnnoxResult pushAirDataToNova(Long poleId) {
+ public VnnoxResult pushAirDataToNova(PushAirDataToNovaParam param) {
+ Long poleId=param.getPoleId();
Pole pole = getById(poleId);
PoleBinding air = poleBindingService.getOne(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getPoleId, poleId).eq(PoleBinding::getDeviceType, 3));
PoleBinding nova = poleBindingService.getOne(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getPoleId, poleId).eq(PoleBinding::getDeviceType, 1));
@@ -923,7 +956,8 @@
//鑾峰彇澶ф皵鐩戞祴鏁版嵁
A5AtmosphereHeartbeatReportInnerFrame.HeartBeatDataPackage data = SpringContextHolder.getBean(AirDataService.class).getDataByPoleid(poleId);
//鎺ㄩ�佹暟鎹�
- return SpringContextHolder.getBean(VnnoxService.class).publishWaterData(LED.getPlayerId(), data);
+// return SpringContextHolder.getBean(VnnoxService.class).publishWaterData(LED.getPlayerId(),param.getDuration(), data);
+ return SpringContextHolder.getBean(VnnoxService.class).WaterData(LED.getPlayerId(),param.getDuration(), data);
}
--
Gitblit v1.9.3