|  |  | 
 |  |  | import com.moral.constant.RedisConstants; | 
 |  |  | import com.moral.util.ConvertUtils; | 
 |  |  | import com.moral.util.DateUtils; | 
 |  |  |  | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.data.redis.core.RedisTemplate; | 
 |  |  | 
 |  |  | import java.beans.PropertyDescriptor; | 
 |  |  | import java.lang.reflect.Field; | 
 |  |  | import java.lang.reflect.Method; | 
 |  |  | import java.lang.reflect.Type; | 
 |  |  | import java.text.SimpleDateFormat; | 
 |  |  | import java.util.*; | 
 |  |  | import java.util.stream.Collectors; | 
 |  |  |  | 
 |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public Map<String, Object> adjustDeviceData(Map<String, Object> deviceData) { | 
 |  |  |         String mac = deviceData.remove("mac").toString(); | 
 |  |  |     public Map<String, Object> adjustDeviceData(Map<String, Object> deviceData,String code) { | 
 |  |  | //        String mac = deviceData.remove("mac").toString(); | 
 |  |  |         String mac = deviceData.get("mac").toString(); | 
 |  |  |         //从redis获取校准公式 | 
 |  |  |         Map<String, Object> adjustFormula = redisTemplate.opsForHash().entries(RedisConstants.ADJUST + "_" + mac); | 
 |  |  |         if (!ObjectUtils.isEmpty(adjustFormula)) { | 
 |  |  | 
 |  |  |             if (govMpInfo.get("guid") != null) { | 
 |  |  |                 aqiMap = (Map<String, Object>) redisTemplate.opsForHash().get(RedisConstants.AQI_DATA, govMpInfo.get("guid").toString()); | 
 |  |  |             } | 
 |  |  |             return adjustDataUtils.adjust(deviceData, adjustFormula, ObjectUtils.isEmpty(aqiMap) ? null : aqiMap); | 
 |  |  |             return adjustDataUtils.adjust(deviceData, adjustFormula, ObjectUtils.isEmpty(aqiMap) ? null : aqiMap,code); | 
 |  |  |         } | 
 |  |  |         deviceData.remove("DataTime"); | 
 |  |  |         return deviceData; | 
 |  |  | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public Map<String, Object> adjustSpecialDeviceData(Map<String, Object> deviceData) { | 
 |  |  |         String mac = deviceData.remove("mac").toString(); | 
 |  |  | //        String mac = deviceData.remove("mac").toString(); | 
 |  |  |         String mac = deviceData.get("mac").toString(); | 
 |  |  |         //从redis获取校准公式 | 
 |  |  |         Map<String, Object> adjustFormula = redisTemplate.opsForHash().entries(RedisConstants.ADJUST + "_" + mac); | 
 |  |  |         if (!ObjectUtils.isEmpty(adjustFormula)) { | 
 |  |  | 
 |  |  |             if (ObjectUtils.isEmpty(aqiMap)) { | 
 |  |  |                 aqiMap = (Map<String, Object>) redisTemplate.opsForHash().get(RedisConstants.AQI_DATA, cityCode); | 
 |  |  |             } | 
 |  |  |             return adjustDataUtils.adjust(deviceData, adjustFormula, ObjectUtils.isEmpty(aqiMap) ? null : aqiMap); | 
 |  |  |             return adjustDataUtils.adjust(deviceData, adjustFormula, ObjectUtils.isEmpty(aqiMap) ? null : aqiMap,"0"); | 
 |  |  |         } | 
 |  |  |         deviceData.remove("DataTime"); | 
 |  |  |         return deviceData; |