| | |
| | | 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; |
| | |
| | | import com.sandu.ximon.admin.redis.LightKey; |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | 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.*; |
| | |
| | | private final PoleBindingService poleBindingService; |
| | | private final PoleGroupRelationService groupRelationService; |
| | | private final ClientService clientService; |
| | | private final PoleMapper poleMapper; |
| | | |
| | | public boolean addPole(PoleParam param) { |
| | | Pole pole = new Pole(); |
| | | BeanUtils.copyProperties(param, pole); |
| | | pole.setPoleCode(generatePoleCode()); |
| | | pole.setDeviceType(-1); |
| | | return save(pole); |
| | | } |
| | | |
| | |
| | | } |
| | | 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.getCode() + airEquipmentNongGengBo.getMac()) != null) { |
| | | number++; |
| | | } |
| | | } |
| | | result.put("AirEquipmentNongGengOnlineCount", number); |
| | | result.put("AirEquipmentNongGengTotalCount", airEquipmentNongGengBos.size()); |
| | | //水质 |
| | | number = 0; |
| | | List<WaterQualityEquipmentBo> waterQualityEquipments |
| | |
| | | public Pole getPoleByMac(Long poleId) { |
| | | Pole one = getOne(Wrappers.lambdaQuery(Pole.class).eq(Pole::getId, poleId)); |
| | | ArrayList<String> macs = new ArrayList<>(); |
| | | |
| | | macs.add(one.getDeviceCode()); |
| | | List<DeviceStatus> deviceStatuses = listStatusByDeviceCode(macs); |
| | | if (deviceStatuses.get(0).getStatus() == 0) { |
| | | if (one.getDeviceCode() == null || one.getDeviceType() == null || one.getDeviceType() == -1) { |
| | | one.setOnLineState("虚拟灯杆"); |
| | | } else if (deviceStatuses.get(0).getStatus() == 0) { |
| | | one.setOnLineState("离线"); |
| | | } else if (deviceStatuses.get(0).getStatus() == 1) { |
| | | one.setOnLineState("在线"); |
| | |
| | | // return energy; |
| | | // } |
| | | |
| | | |
| | | public boolean updateDeviceCode(Long poleId) { |
| | | return poleMapper.updateDeviceCode(poleId); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 推送大气监测数据到novaLED |
| | | */ |
| | | public boolean pushAirDataToXiXun(Long poleId) { |
| | | Pole pole = getById(poleId); |
| | | 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("未绑定xixun设备"); |
| | | } |
| | | //获取大气监测数据 |
| | | A5AtmosphereHeartbeatReportInnerFrame.HeartBeatDataPackage data = SpringContextHolder.getBean(AirDataService.class).getDataByPoleid(poleId); |
| | | //推送数据 |
| | | return SpringContextHolder.getBean(XiXunPlayerService.class).pushWeather(xixun.getDeviceCode(), data, pole); |
| | | } |
| | | |
| | | /** |
| | | * 推送大气监测数据到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("未绑定nova设备"); |
| | | } |
| | | //获取大气监测数据 |
| | | A5AtmosphereHeartbeatReportInnerFrame.HeartBeatDataPackage data = SpringContextHolder.getBean(AirDataService.class).getDataByPoleid(poleId); |
| | | //推送数据 |
| | | return SpringContextHolder.getBean(VnnoxService.class).publishWaterData(LED.getPlayerId(), data); |
| | | } |
| | | |
| | | |
| | | } |