| | |
| | | import com.moral.api.websocket.SingleDeviceServer; |
| | | import com.moral.util.UnitConvertUtils; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.kafka.clients.consumer.Consumer; |
| | | import org.apache.kafka.clients.consumer.ConsumerRecord; |
| | | import org.apache.kafka.common.TopicPartition; |
| | |
| | | * @Version TODO |
| | | **/ |
| | | @Component |
| | | @Slf4j |
| | | public class SecondDataConsumer implements ConsumerSeekAware { |
| | | |
| | | @KafkaListener(containerFactory = "secondDataListenerFactory",topics = "second_data") |
| | |
| | | String showUnitKey = sensor.getShowUnitKey(); |
| | | String unitKey = sensor.getUnitKey(); |
| | | String unit = sensor.getUnit(); |
| | | //如果消息中没有该因子则退出循环 |
| | | if(message.get(code)==null) |
| | | continue; |
| | | //对数据保留两位小数,并且向下取整 |
| | | Double sourceDataD = Double.valueOf(String.valueOf(message.get(code))); |
| | | BigDecimal bg = new BigDecimal(sourceDataD); |