| | |
| | | package com.moral.api.utils; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.moral.constant.SensorContrasts; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.ObjectUtils; |
| | |
| | | if (formula.contains("aqi")) { |
| | | Object aqiValue = null; |
| | | if (aqiMap != null) { |
| | | String jsonStr = JsonUtil.readJsonFile("screen-api/src/main/resources/SensorContrast.json"); |
| | | String jsonStr = JsonUtil.readJsonFile("classpath:json/SensorContrast.json"); |
| | | JSONObject result = JSONObject.parseObject(jsonStr); |
| | | aqiValue = aqiMap.get(result.get(key)); |
| | | //aqiValue = aqiMap.get(SensorContrasts.sensorContrastMap.get(key)); |
| | | } |
| | | env.put("aqi", ObjectUtils.isEmpty(aqiValue) ? 0F : Float.parseFloat((String) aqiValue)); |
| | | } |