|  |  |  | 
|---|
|  |  |  | package com.moral.api.websocket; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.moral.api.entity.Device; | 
|---|
|  |  |  | import lombok.Data; | 
|---|
|  |  |  | import org.springframework.data.redis.core.RedisTemplate; | 
|---|
|  |  |  | import org.springframework.stereotype.Component; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private String mac; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private SpecialDevice deviceAlarmInfo; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private Map<String, Object> adjustFormula; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private SpecialDevice specialDevice; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private Map<String, Object> regionAqi; | 
|---|
|  |  |  | 
|---|
|  |  |  | public void onOpen(Session session, @PathParam("mac") String mac) { | 
|---|
|  |  |  | this.session = session; | 
|---|
|  |  |  | this.mac = mac; | 
|---|
|  |  |  | this.deviceAlarmInfo = (SpecialDevice) redisTemplate.opsForHash().get(RedisConstants.SPECIAL_DEVICE_INFO, mac); | 
|---|
|  |  |  | this.unitConversions = redisTemplate.opsForList().range(RedisConstants.UNIT_CONVERSION, 0, -1); | 
|---|
|  |  |  | this.adjustFormula = redisTemplate.opsForHash().entries("adjust_"+mac); | 
|---|
|  |  |  | this.specialDevice = (SpecialDevice) redisTemplate.opsForHash().get(RedisConstants.SPECIAL_DEVICE_INFO, mac); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | //获取设备信息 | 
|---|