kaiyu
2022-03-09 997353a844c1d10ab930cbcd95922640063535f0
screen-api/src/main/java/com/moral/api/websocket/SingleDeviceServer.java
@@ -45,19 +45,22 @@
    private Map<String, Object> regionAqi;
    private Map<String,Object> adjustFormula;
    @OnOpen
    public void onOpen(Session session, @PathParam("mac") String mac) throws Exception {
        this.session = session;
        this.mac = mac;
        this.deviceAlarmInfo = (Device) redisTemplate.opsForHash().get(RedisConstants.DEVICE_INFO, mac);
        this.unitConversions = redisTemplate.opsForList().range(RedisConstants.UNIT_CONVERSION, 0, -1);
        this.adjustFormula = redisTemplate.opsForHash().entries("adjust_"+mac);
        //获取设备地区对应的AQI用于补偿使用
        Map<String, Object> deviceInfo = (Map<String, Object>) redisTemplate.opsForHash().get(RedisConstants.DEVICE, mac);
        Map<String, Object> monitorPointMap = (Map<String, Object>) deviceInfo.get("monitorPoint");
        String areaCode = String.valueOf(monitorPointMap.get("areaCode"));
        String cityCode = String.valueOf(monitorPointMap.get("cityCode"));
        try {
            this.regionAqi = (Map<String, Object>) redisTemplate.opsForHash().get(RedisConstants.AQI_DATA, areaCode);
            this.regionAqi = (Map<String, Object>) redisTemplate.opsForHash().get(RedisConstants.CITY_AQI, areaCode);
            if (ObjectUtils.isEmpty(this.regionAqi))
                this.regionAqi = (Map<String, Object>) redisTemplate.opsForHash().get(RedisConstants.AQI_DATA, cityCode);
        } catch (Exception e) {