| | |
| | | import com.moral.constant.KafkaConstants; |
| | | import com.moral.constant.RedisConstants; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.kafka.clients.consumer.CommitFailedException; |
| | | import org.apache.kafka.clients.consumer.ConsumerRecord; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | |
| | | data.remove("entryTime"); |
| | | |
| | | //数据校准 |
| | | data = deviceService.adjustDeviceData(data,"0"); |
| | | //data = deviceService.adjustDeviceData(data,"0"); |
| | | //存入redis |
| | | data.put("DataTime", time); |
| | | redisTemplate.opsForHash().put(RedisConstants.DATA_SECOND, mac, data); |
| | | //redisTemplate.opsForHash().put(RedisConstants.DATA_SECOND, mac, data); |
| | | //判断并修改设备状态 |
| | | data.put("mac", mac); |
| | | deviceService.judgeDeviceState(data); |
| | | ack.acknowledge(); |
| | | deviceService.judgeDeviceState(data); |
| | | |
| | | }catch (CommitFailedException e){ |
| | | log.error("param{}" + msg); |
| | | } catch (Exception e) { |
| | | log.error("param{}" + msg); |
| | | ack.acknowledge(); |