| | |
| | | |
| | | import com.moral.api.entity.SpecialDevice; |
| | | import com.moral.api.entity.UnitConversion; |
| | | import com.moral.api.pojo.redisBean.SpecialDeviceInfoDTO; |
| | | import com.moral.constant.RedisConstants; |
| | | |
| | | //走航车实时websocket |
| | |
| | | this.session = session; |
| | | this.mac = mac; |
| | | this.specialDevice = (SpecialDevice) redisTemplate.opsForHash().get(RedisConstants.SPECIAL_DEVICE_INFO, mac); |
| | | //获取设备地区对应的AQI用于补偿使用 |
| | | Map<String, Object> deviceInfo = (Map<String, Object>) redisTemplate.opsForHash().get(RedisConstants.DEVICE, mac); |
| | | Map<String, Object> orgInfo = (Map<String, Object>) deviceInfo.get("organization"); |
| | | String areaCode = String.valueOf(orgInfo.get("areaCode")); |
| | | String cityCode = String.valueOf(orgInfo.get("cityCode")); |
| | | try { |
| | | this.regionAqi = (Map<String, Object>) redisTemplate.opsForHash().get(RedisConstants.AQI_DATA, areaCode); |
| | | if (ObjectUtils.isEmpty(this.regionAqi)) |
| | | this.regionAqi = (Map<String, Object>) redisTemplate.opsForHash().get(RedisConstants.AQI_DATA, cityCode); |
| | | //获取设备信息 |
| | | SpecialDeviceInfoDTO deviceInfo = (SpecialDeviceInfoDTO) redisTemplate.opsForHash().get(RedisConstants.SPECIAL_DEVICE, mac); |
| | | //获取与设备绑定的国控站guid, |
| | | String guid = deviceInfo.getSpecialDevice().getGuid(); |
| | | if (!ObjectUtils.isEmpty(guid)) { |
| | | //获取国控aqi数据,用于补偿 |
| | | this.regionAqi = (Map<String, Object>) redisTemplate.opsForHash().get(RedisConstants.AQI_DATA, guid); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |