From 52eb3f0befcb397d2fdd645c8d7471d6ee477f87 Mon Sep 17 00:00:00 2001
From: zhanzhiqin <895896009@qq.com>
Date: 星期一, 09 五月 2022 16:36:38 +0800
Subject: [PATCH] 权限
---
ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java | 97 ++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 92 insertions(+), 5 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 cfd41c4..223503d 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
@@ -17,6 +17,7 @@
import com.sandu.ximon.admin.manager.iot.frame.A1Frame;
import com.sandu.ximon.admin.manager.iot.frame.FrameBuilder;
import com.sandu.ximon.admin.manager.iot.frame.IRequestFrame;
+import com.sandu.ximon.admin.manager.iot.frame.inner.report.A5AtmosphereHeartbeatReportInnerFrame;
import com.sandu.ximon.admin.manager.iot.frame.inner.request.A1TernaryCodeReqInnerFrame;
import com.sandu.ximon.admin.manager.iot.frame.inner.request.A5LightResetReqInnerFrame;
import com.sandu.ximon.admin.manager.iot.frame.inner.request.EmptyRequestInnerFrame;
@@ -29,7 +30,9 @@
import com.sandu.ximon.admin.param.*;
import com.sandu.ximon.admin.redis.LightKey;
import com.sandu.ximon.admin.security.SecurityUtils;
+import com.sandu.ximon.admin.utils.LightemitUtils;
import com.sandu.ximon.admin.utils.RedisUtils;
+import com.sandu.ximon.admin.utils.response.VnnoxResult;
import com.sandu.ximon.admin.vo.PoleBindVO;
import com.sandu.ximon.dao.bo.*;
import com.sandu.ximon.dao.domain.*;
@@ -164,9 +167,9 @@
MonitorParam monitorParam = new MonitorParam();
monitorParam.setEquipmentState(2);
monitorParam.setBindingState(2);
- List<MonitorBo> monitorBos = SpringContextHolder.getBean(MonitorService.class).listMonitorByKeyword(null, monitorParam);
+ List<MonitorBo> monitorBos = SpringContextHolder.getBean(MonitorService.class).listMonitorByKeyword(null, monitorParam).getList();
monitorParam.setEquipmentState(1);
- List<MonitorBo> online = SpringContextHolder.getBean(MonitorService.class).listMonitorByKeyword(null, monitorParam);
+ List<MonitorBo> online = SpringContextHolder.getBean(MonitorService.class).listMonitorByKeyword(null, monitorParam).getList();
result.put("monitorOnlineCount", online.size());
result.put("monitorTotalCount", monitorBos.size());
@@ -197,12 +200,22 @@
number = 0;
List<AirEquipmentBo> airEquipments = SpringContextHolder.getBean(AirEquipmentService.class).listAirEquipmentByKeyword(null, null);
for (AirEquipmentBo airEquipmentBo : airEquipments) {
- if (RedisUtils.getBean().get(AtmoFunctionCode.AIR_HEARTBEAT.getCode() + airEquipmentBo.getMac()) != null) {
+ if (RedisUtils.getBean().get(AtmoFunctionCode.AIR_HEARTBEAT_STATE.getCode() + airEquipmentBo.getMac()) != null) {
number++;
}
}
result.put("AirEquipmentOnlineCount", number);
result.put("AirEquipmentTotalCount", airEquipments.size());
+ //澶ф皵(鍐滆��)
+ number = 0;
+ List<AirEquipmentNongGengBo> airEquipmentNongGengBos = SpringContextHolder.getBean(AirEquipmentNongGengService.class).listAirEquipmentByKeyword(null, null);
+ for (AirEquipmentNongGengBo airEquipmentNongGengBo : airEquipmentNongGengBos) {
+ if (RedisUtils.getBean().get(AtmoFunctionCode.AIR_HEARTBEAT_NONG_GENG_STATE.getCode() + airEquipmentNongGengBo.getMac()) != null) {
+ number++;
+ }
+ }
+ result.put("AirEquipmentNongGengOnlineCount", number);
+ result.put("AirEquipmentNongGengTotalCount", airEquipmentNongGengBos.size());
//姘磋川
number = 0;
List<WaterQualityEquipmentBo> waterQualityEquipments
@@ -851,8 +864,82 @@
// }
- public boolean updateDeviceCode(Long poleId){
- return poleMapper.updateDeviceCode(poleId);
+ public boolean updateDeviceCode(Long poleId) {
+ return poleMapper.updateDeviceCode(poleId);
}
+
+ /**
+ * 鎺ㄩ�佸ぇ姘旂洃娴嬫暟鎹埌novaLED
+ */
+ public boolean pushAirDataToXiXun(Long poleId) {
+ Pole pole = getById(poleId);
+ //鍒ゆ柇褰掑睘鏉�
+ if (SecurityUtils.getClientId() != null) {
+ if (!pole.getClientId().equals(SecurityUtils.getUserId()) && !pole.getUserId().equals(SecurityUtils.getUserId())) {
+ throw new BusinessException("鏃犳潈闄愭搷浣�");
+ }
+ }
+ PoleBinding air = poleBindingService.getOne(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getPoleId, poleId).eq(PoleBinding::getDeviceType, 3));
+ PoleBinding xixun = poleBindingService.getOne(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getPoleId, poleId).eq(PoleBinding::getDeviceType, 10));
+ if (pole == null) {
+ throw new BusinessException("鐏潌涓嶅瓨鍦�");
+ }
+ if (air == null) {
+ throw new BusinessException("鏈粦瀹氬ぇ姘旂洃娴嬭澶�");
+ }
+ if (xixun == null) {
+ throw new BusinessException("鏈粦瀹歺ixun璁惧");
+ }
+ //鑾峰彇澶ф皵鐩戞祴鏁版嵁
+ A5AtmosphereHeartbeatReportInnerFrame.HeartBeatDataPackage data = SpringContextHolder.getBean(AirDataService.class).getDataByPoleid(poleId);
+ //鎺ㄩ�佹暟鎹�
+ return SpringContextHolder.getBean(XiXunPlayerService.class).pushWeather(xixun.getDeviceCode(), data, pole);
+ }
+
+
+ /**
+ * 鍏抽棴鐔欒澶ф皵鎺ㄩ��
+ */
+ public void closeXiXunAirPush(Long poleId) {
+ Pole pole = getById(poleId);
+ if (SecurityUtils.getClientId() != null) {
+ if (!pole.getClientId().equals(SecurityUtils.getUserId()) && !pole.getUserId().equals(SecurityUtils.getUserId())) {
+ throw new BusinessException("鏃犳潈闄愭搷浣�");
+ }
+ }
+ PoleBinding air = poleBindingService.getOne(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getPoleId, poleId).eq(PoleBinding::getDeviceType, 3));
+ PoleBinding xixun = poleBindingService.getOne(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getPoleId, poleId).eq(PoleBinding::getDeviceType, 10));
+ if (pole == null || air == null || xixun == null) {
+ throw new BusinessException("璁惧涓嶅瓨鍦�");
+ }
+ //鍏抽棴鎺ㄩ��
+ SpringContextHolder.getBean(LightemitUtils.class).clear(xixun.getDeviceCode());
+
+ }
+
+ /**
+ * 鎺ㄩ�佸ぇ姘旂洃娴嬫暟鎹埌novaLED
+ */
+ public VnnoxResult pushAirDataToNova(Long poleId) {
+ 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));
+ LedPlayerEntity LED = SpringContextHolder.getBean(LedPlayerEntityService.class).getOne(Wrappers.lambdaQuery(LedPlayerEntity.class).eq(LedPlayerEntity::getSn, nova.getDeviceCode()));
+ if (pole == null) {
+ throw new BusinessException("鐏潌涓嶅瓨鍦�");
+ }
+ if (air == null) {
+ throw new BusinessException("鏈粦瀹氬ぇ姘旂洃娴嬭澶�");
+ }
+ if (nova == null) {
+ throw new BusinessException("鏈粦瀹歯ova璁惧");
+ }
+ //鑾峰彇澶ф皵鐩戞祴鏁版嵁
+ A5AtmosphereHeartbeatReportInnerFrame.HeartBeatDataPackage data = SpringContextHolder.getBean(AirDataService.class).getDataByPoleid(poleId);
+ //鎺ㄩ�佹暟鎹�
+ return SpringContextHolder.getBean(VnnoxService.class).publishWaterData(LED.getPlayerId(), data);
+ }
+
+
}
\ No newline at end of file
--
Gitblit v1.9.3