| | |
| | | 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 { |
| | | //离线 |
| | |
| | | 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) { |
| | |
| | | * @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<>(); |
| | |
| | | * |
| | | * @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); |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | String deviceName = byId.getDeviceCode(); |
| | | if (deviceName.isEmpty()) { |
| | | throw new BusinessException("该灯杆Mca为空"); |
| | | throw new BusinessException("该灯杆Mac为空"); |
| | | } |
| | | IRequestFrame build = FrameBuilder.builderA5().orderType(A5OrderEnum.REQUEST_LIGHT_DATA.getCode()).innerFrame(new A5LightResetReqInnerFrame()).build(); |
| | | CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(deviceName, build); |
| | |
| | | |
| | | 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); |
| | |
| | | deviceCode.like(Pole::getDeviceCode, keyword); |
| | | }); |
| | | } |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | List<Pole> list; |
| | | list = list(eq); |
| | | setCount(list); |
| | |
| | | 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("未绑定nova设备"); |
| | | } |
| | | 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); |
| | | //推送数据 |