| | |
| | | package com.sandu.ximon.admin.service; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.sandu.common.execption.BusinessException; |
| | |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.enums.A5OrderEnum; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.enums.AtmoFunctionCode; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.mainboard.MainBoardInvokeSyncService; |
| | | import com.sandu.ximon.admin.redis.DeviceRedisKey; |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.admin.utils.RedisUtils; |
| | | import com.sandu.ximon.admin.utils.StoreOperationRecordsUtils; |
| | | import com.sandu.ximon.admin.utils.StringUtil; |
| | | import com.sandu.ximon.admin.vo.EquipmentInfomation; |
| | | import com.sandu.ximon.admin.vo.RedisDeviceStatus; |
| | | import com.sandu.ximon.dao.bo.AirEquipmentBo; |
| | | import com.sandu.ximon.dao.domain.AirEquipment; |
| | | import com.sandu.ximon.dao.mapper.AirEquipmentMapper; |
| | |
| | | public class AirEquipmentService extends BaseServiceImpl<AirEquipmentMapper, AirEquipment> { |
| | | |
| | | private final AirEquipmentMapper airEquipmentMapper; |
| | | private final RedisUtils redisUtils; |
| | | |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | public A5AtmosphereQuerySensorInfoReportInnerFrame.SensorInfoPackage QuerySensorInfo(String mac) { |
| | | //TODO |
| | | if (StringUtil.strIsNullOrEmpty(mac)) { |
| | | throw new BusinessException("灯杆mac参数错误!"); |
| | | } |
| | |
| | | // FEA584000CFE040004FFFF0105954FAA7F1123C0CB -----------commonFrame |
| | | A5AtmosphereQueryVersionReportInnerFrame a5AtmosphereQueryVersionReportInnerFrame = |
| | | new A5AtmosphereQueryVersionReportInnerFrame().transformFrame(commonFrame.getPayload()); |
| | | if (a5AtmosphereQueryVersionReportInnerFrame.isValidate()) { |
| | | if (a5AtmosphereQueryVersionReportInnerFrame != null && a5AtmosphereQueryVersionReportInnerFrame.isValidate()) { |
| | | return a5AtmosphereQueryVersionReportInnerFrame.getVersion(); |
| | | } else { |
| | | throw new BusinessException("数据校验异常!"); |
| | |
| | | throw new BusinessException("数据校验异常!"); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 向Redis中存入设备状态 |
| | | */ |
| | | public void setCacheData() { |
| | | list().forEach( |
| | | device -> { |
| | | RedisDeviceStatus deviceStatus = new RedisDeviceStatus(); |
| | | deviceStatus.setDeviceId(device.getMac()); |
| | | |
| | | if (RedisUtils.getBean().get(AtmoFunctionCode.AIR_HEARTBEAT_STATE.getCode() + device.getMac()) != null) { |
| | | deviceStatus.setStatus(0); |
| | | } else { |
| | | deviceStatus.setStatus(1); |
| | | } |
| | | redisUtils.set(DeviceRedisKey.AIR + device.getMac(), JSON.toJSONString(deviceStatus)); |
| | | // redisUtils.delete(DeviceRedisKey.AIR + device.getAirMac()); |
| | | } |
| | | ); |
| | | } |
| | | } |