| | |
| | | |
| | | import com.zy.acs.hex.constant.RabbitConstant; |
| | | import com.zy.acs.hex.domain.Device; |
| | | import com.zy.component.influxdb.service.InfluxDBService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.amqp.rabbit.core.RabbitTemplate; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | @RestController |
| | |
| | | |
| | | @Autowired |
| | | private RabbitTemplate rabbitTemplate; |
| | | |
| | | |
| | | @Autowired |
| | | private InfluxDBService influxDBService; |
| | | |
| | | |
| | | /** |
| | | * 发送消息test1 |
| | |
| | | rabbitTemplate.convertAndSend(RabbitConstant.TOPIC_EXCHANGE, RabbitConstant.ROUTING_KEY_DOWN, "qswaqsaasas"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 发送消息test2 |
| | | * |
| | | * @return |
| | | */ |
| | | @GetMapping(value = "/query") |
| | | @ResponseBody |
| | | public Object queryTest() { |
| | | return influxDBService.queryData("select * from device order by time desc limit 10"); |
| | | } |
| | | |
| | | /** |
| | | * 发送消息test2 |
| | | * |
| | | * @return |
| | | */ |
| | | @GetMapping(value = "/query2") |
| | | @ResponseBody |
| | | public Object queryTest2() { |
| | | return influxDBService.queryPoints("select * from device order by time desc limit 10", Device.class); |
| | | } |
| | | |
| | | } |