screen-manage/src/main/java/com/moral/api/kafka/consumer/DeviceConsumer.java
@@ -142,6 +142,7 @@ //存入redis redisTemplate.opsForHash().put(RedisConstants.DATA_SECOND, mac, data); //判断并修改设备状态 data.put("mac", mac); deviceService.judgeDeviceState(data); } catch (Exception e) { log.error("param{}" + msg); screen-manage/src/main/java/com/moral/api/service/impl/DeviceServiceImpl.java
@@ -428,8 +428,8 @@ if (!ObjectUtils.isEmpty(adjustFormula)) { Map<String, Object> deviceInfo = getDeviceByMac(mac); Map<String, Object> monitorPoint = (Map<String, Object>) deviceInfo.get("monitorPoint"); Object areaCode = monitorPoint.get("areaCode"); Object cityCode = monitorPoint.get("cityCode"); String areaCode = monitorPoint.get("areaCode").toString(); String cityCode = monitorPoint.get("cityCode").toString(); Map<String, Object> aqiMap = (Map<String, Object>) redisTemplate.opsForHash().get(RedisConstants.AQI_DATA, areaCode); if (ObjectUtils.isEmpty(aqiMap)) { @@ -448,8 +448,8 @@ Map<String, Object> adjustFormula = redisTemplate.opsForHash().entries(RedisConstants.ADJUST + "_" + mac); if (!ObjectUtils.isEmpty(adjustFormula)) { Organization organization = specialDeviceMapper.selectOrgByMac(mac); Integer areaCode = organization.getAreaCode(); Integer cityCode = organization.getCityCode(); String areaCode = organization.getAreaCode().toString(); String cityCode = organization.getCityCode().toString(); Map<String, Object> aqiMap = (Map<String, Object>) redisTemplate.opsForHash().get(RedisConstants.AQI_DATA, areaCode); if (ObjectUtils.isEmpty(aqiMap)) { aqiMap = (Map<String, Object>) redisTemplate.opsForHash().get(RedisConstants.AQI_DATA, cityCode); screen-manage/src/main/java/com/moral/api/util/AdjustDataUtils.java
@@ -9,6 +9,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; import com.alibaba.fastjson.JSON; import com.googlecode.aviator.AviatorEvaluator; @@ -40,11 +41,14 @@ deviceData.put(key, measuredValue); continue; } //根据时间段筛选校准公式 DeviceAdjustValue deviceAdjustValue = sensorFormulas.stream() DeviceAdjustValue deviceAdjustValue = new DeviceAdjustValue(); Optional<DeviceAdjustValue> optional = sensorFormulas.stream() .filter(o -> o.getStartTime().getTime() <= finalTime && o.getEndTime().getTime() > finalTime) .findFirst().get(); .findFirst(); if (optional.isPresent()) { deviceAdjustValue = optional.get(); } String formula = deviceAdjustValue.getValue(); if (StringUtils.isEmpty(formula)) { deviceData.put(key, measuredValue);