From d495f9b8cdc83663e4189bc3cc72ac9543ff5555 Mon Sep 17 00:00:00 2001
From: liuhaonan <31457034@qq.com>
Date: 星期二, 25 十月 2022 18:18:06 +0800
Subject: [PATCH] changes

---
 ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java |   72 ++++++++++++++++--------------------
 1 files changed, 32 insertions(+), 40 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 f8e1e3a..7e4519c 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
@@ -425,20 +425,19 @@
                 DeviceOnLineCountVO c3m = new DeviceOnLineCountVO();
                 c3mChargings.forEach(
                         device -> {
-//                            RedisUtils.getBean().set(C3mRedisConstant.C3_STATUS.getCode() + heartbeatReportInnerFrame.getHeartBeatDataPackage().getC3Mac()
-//                                    , heartbeatReportInnerFrame.getHeartBeatDataPackage(), 300L);
                             String s = redisUtils.get(C3mRedisConstant.C3_STATUS.getCode() + device.getC3Mac());
                             RedisDeviceStatus redisDeviceStatus = new RedisDeviceStatus();
                             redisDeviceStatus.setDeviceId(device.getC3Id().toString());
                             if (s != null) {
                                 A5C3HeartbeatReportInnerFrame.HeartBeatDataPackage heartBeatDataPackage = JSON.parseObject(s, A5C3HeartbeatReportInnerFrame.HeartBeatDataPackage.class);
+                                //  鍏呯數妗╁彛鐘舵�佷綅  1.绌洪棽 2.鍏呯數涓� 3.鍏呯數涓柇锛岀瓑寰呮湇鍔″櫒纭 4.鍏呯數缁撴潫锛岀瓑寰呮湇鍔″櫒纭 5.鏈夋晠闅� 6.涓庡厖鐢垫々瀵规帴涓�
                                 if ("5".equals(heartBeatDataPackage.getStatusBit())) {
-                                    //鍦ㄧ嚎
-                                    onLine.getAndIncrement();
-                                } else {
                                     //鏁呴殰
                                     onLine.getAndIncrement();
                                     error.getAndIncrement();
+                                } else {
+                                    //鍦ㄧ嚎
+                                    onLine.getAndIncrement();
                                 }
                             } else {
                                 //绂荤嚎
@@ -472,7 +471,7 @@
                 DeviceOnLineCountVO air = new DeviceOnLineCountVO();
                 airEquipments.forEach(
                         device -> {
-                            String s = redisUtils.get(DeviceRedisKey.AIR + device.getAirMac());
+                            String s = redisUtils.get(DeviceRedisKey.AIR + device.getMac());
                             if (s != null) {
                                 RedisDeviceStatus redisDeviceStatus = JSON.parseObject(s, RedisDeviceStatus.class);
                                 if (redisDeviceStatus.getStatus() == 0) {
@@ -728,25 +727,24 @@
      * @param param
      * @return
      */
-    public List<Pole> isBind(List<Pole> list, PoleStatesParam param) {
-        List<Pole> bindList = new ArrayList<>();//宸茬粦瀹氬鎴�
-        List<Pole> unbindList = new ArrayList<>();//鏈粦瀹氬鎴�
-        list.forEach(bindwarpper -> {
-//                Long clientId = bindwarpper.getClientId();
-            if (bindwarpper.getClientId() == null) {//鍒ゆ柇鏄惁缁戝畾
-                unbindList.add(bindwarpper);
-            } else {
-                bindList.add(bindwarpper);
-            }
-        });
-        if (param.getBingStates() == 0) {
-            return bindList;
-        } else if (param.getBingStates() == 1) {
-            return unbindList;
-        }
-        return list;
-    }
-
+//    public List<Pole> isBind(List<Pole> list, PoleStatesParam param) {
+//        List<Pole> bindList = new ArrayList<>();//宸茬粦瀹氬鎴�
+//        List<Pole> unbindList = new ArrayList<>();//鏈粦瀹氬鎴�
+//        list.forEach(bindwarpper -> {
+////                Long clientId = bindwarpper.getClientId();
+//            if (bindwarpper.getClientId() == null) {//鍒ゆ柇鏄惁缁戝畾
+//                unbindList.add(bindwarpper);
+//            } else {
+//                bindList.add(bindwarpper);
+//            }
+//        });
+//        if (param.getBingStates() == 0) {
+//            return bindList;
+//        } else if (param.getBingStates() == 1) {
+//            return unbindList;
+//        }
+//        return list;
+//    }
     public List<Pole> isTrue(List<Pole> list, PoleStatesParam param) {
         //瀹炰綋鐏潌
         List<Pole> isTrue = new ArrayList<>();
@@ -883,7 +881,7 @@
         }
         String deviceName = byId.getDeviceCode();
         if (deviceName.isEmpty()) {
-            throw new BusinessException("璇ョ伅鏉哅ca涓虹┖");
+            throw new BusinessException("璇ョ伅鏉哅ac涓虹┖");
         }
         IRequestFrame build = FrameBuilder.builderA5().orderType(A5OrderEnum.REQUEST_LIGHT_DATA.getCode()).innerFrame(new A5LightResetReqInnerFrame()).build();
         CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(deviceName, build);
@@ -1128,22 +1126,15 @@
 
     public List<Pole> getOwnerPole(BaseConditionVO baseConditionVO, String keyword, Long cilentId) {
         LambdaQueryWrapper<Pole> eq;
-//        if(SecurityUtils.getClientId()!=null){
-        PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
         if (clientService.findClientId(cilentId)) {
-            eq = Wrappers.lambdaQuery(Pole.class).eq(Pole::getUserId, cilentId);
+            eq = Wrappers.lambdaQuery(Pole.class).eq(Pole::getClientId, cilentId);
         } else {
-            PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
             eq = Wrappers.lambdaQuery(Pole.class).eq(Pole::getClientId, cilentId).or(pole -> {
                 pole.eq(Pole::getUserId, cilentId);
             });
         }
 
-//        }else {
-//            PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
-//            eq = Wrappers.lambdaQuery(Pole.class);
-//        }
-        PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
+
         if (!keyword.isEmpty()) {
             eq.like(Pole::getPoleName, keyword).or(code -> {
                 code.like(Pole::getPoleCode, keyword);
@@ -1151,6 +1142,7 @@
                 deviceCode.like(Pole::getDeviceCode, keyword);
             });
         }
+        PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
         List<Pole> list;
         list = list(eq);
         setCount(list);
@@ -1310,17 +1302,17 @@
         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));
-        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("鏈粦瀹氬ぇ姘旂洃娴嬭澶�");
         }
+        PoleBinding nova = poleBindingService.getOne(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getPoleId, poleId).eq(PoleBinding::getDeviceType, 1));
         if (nova == null) {
             throw new BusinessException("鏈粦瀹歯ova璁惧");
         }
+        LedPlayerEntity LED = SpringContextHolder.getBean(LedPlayerEntityService.class).getOne(Wrappers.lambdaQuery(LedPlayerEntity.class).eq(LedPlayerEntity::getSn, nova.getDeviceCode()));
+        if (pole == null) {
+            throw new BusinessException("鐏潌涓嶅瓨鍦�");
+        }
         //鑾峰彇澶ф皵鐩戞祴鏁版嵁
         A5AtmosphereHeartbeatReportInnerFrame.HeartBeatDataPackage data = SpringContextHolder.getBean(AirDataService.class).getDataByPoleid(poleId);
         //鎺ㄩ�佹暟鎹�

--
Gitblit v1.9.3