Merge remote-tracking branch 'origin/feature-BOX一期' into feature-BOX一期
# Conflicts: # iot-modules/iot-box-user-api/pom.xml
This commit is contained in:
commit
8f0ce6d36b
@ -7,24 +7,78 @@ import java.util.List;
|
||||
/**
|
||||
* @author simon
|
||||
* @date 2023/9/21
|
||||
* @description
|
||||
* @description 按整天天气数据
|
||||
**/
|
||||
@Data
|
||||
public class Daily {
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 白天降水数据
|
||||
*/
|
||||
private List<Temperature> precipitation_08h_20h;
|
||||
/**
|
||||
* 夜晚降水数据
|
||||
*/
|
||||
private List<Temperature> precipitation_20h_32h;
|
||||
/**
|
||||
* 降水数据
|
||||
*/
|
||||
private List<Temperature> precipitation;
|
||||
|
||||
/**
|
||||
* 全天地表 2 米气温
|
||||
*/
|
||||
private List<Temperature> temperature;
|
||||
/**
|
||||
* 白天地表 2 米气温
|
||||
*/
|
||||
private List<Temperature> temperature_08h_20h;
|
||||
/**
|
||||
* 夜晚地表 2 米气温
|
||||
*/
|
||||
private List<Temperature> temperature_20h_32h;
|
||||
|
||||
/**
|
||||
* 全天地表 10 米风速
|
||||
*/
|
||||
private List<Wind> wind;
|
||||
/**
|
||||
* 白天地表 10 米风速
|
||||
*/
|
||||
private List<Wind> wind_08h_20h;
|
||||
/**
|
||||
* 夜晚地表 10 米风速
|
||||
*/
|
||||
private List<Wind> wind_20h_32h;
|
||||
|
||||
/**
|
||||
* 地表 2 米相对湿度(%)
|
||||
*/
|
||||
private List<Temperature> humidity;
|
||||
|
||||
/**
|
||||
* 云量(0.0-1.0)
|
||||
*/
|
||||
private List<Temperature> cloudrate;
|
||||
|
||||
/**
|
||||
* 地面气压
|
||||
*/
|
||||
private List<Temperature> pressure;
|
||||
|
||||
/**
|
||||
* 地表水平能见度
|
||||
*/
|
||||
private List<Temperature> visibility;
|
||||
|
||||
/**
|
||||
* 向下短波辐射通量(W/M2)
|
||||
*/
|
||||
private List<Temperature> dswrf;
|
||||
|
||||
/**
|
||||
* 生活指数
|
||||
*/
|
||||
private LifeIndex life_index;
|
||||
}
|
||||
|
||||
@ -4,19 +4,71 @@ import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 按小时天气数据
|
||||
*/
|
||||
@Data
|
||||
public class Hourly {
|
||||
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 天气描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 降水数据
|
||||
*/
|
||||
private List<Precipitation> precipitation;
|
||||
|
||||
/**
|
||||
* 地表 2 米气温
|
||||
*/
|
||||
private List<WeatherTimeInt> temperature;
|
||||
|
||||
/**
|
||||
* 体感温度
|
||||
*/
|
||||
private List<WeatherTimeDouble> apparent_temperature;
|
||||
|
||||
/**
|
||||
* 风
|
||||
*/
|
||||
private List<Wind> wind;
|
||||
|
||||
/**
|
||||
* 地表 2 米相对湿度(%)
|
||||
*/
|
||||
private List<WeatherTimeDouble> humidity;
|
||||
|
||||
/**
|
||||
* 云量(0.0-1.0)
|
||||
*/
|
||||
private List<WeatherTimeInt> cloudrate;
|
||||
|
||||
/**
|
||||
* 天气现象
|
||||
*/
|
||||
private List<WeatherTimeString> skycon;
|
||||
|
||||
/**
|
||||
* pressure
|
||||
*/
|
||||
private List<WeatherTimeDouble> pressure;
|
||||
|
||||
/**
|
||||
* 地表水平能见度
|
||||
*/
|
||||
private List<WeatherTimeDouble> visibility;
|
||||
|
||||
/**
|
||||
* 向下短波辐射通量(W/M2)
|
||||
*/
|
||||
private List<WeatherTimeDouble> dswrf;
|
||||
|
||||
/**
|
||||
* 空气质量
|
||||
*/
|
||||
private AirQuality air_quality;
|
||||
}
|
||||
@ -4,8 +4,20 @@ import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class Result {
|
||||
/**
|
||||
* 按天小时数据
|
||||
*/
|
||||
private Hourly hourly;
|
||||
|
||||
/**
|
||||
* 按天天气数据
|
||||
*/
|
||||
private Daily daily;
|
||||
|
||||
private Integer primary;
|
||||
|
||||
/**
|
||||
* 按天天气数据
|
||||
*/
|
||||
private String forecast_keypoint;
|
||||
}
|
||||
@ -4,6 +4,10 @@ import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 文档地址
|
||||
* https://docs.caiyunapp.com/docs/daily
|
||||
*/
|
||||
@Data
|
||||
public class WeatherResp {
|
||||
private String status;
|
||||
@ -15,5 +19,8 @@ public class WeatherResp {
|
||||
private String timezone;
|
||||
private Long server_time;
|
||||
private List<Double> location;
|
||||
/**
|
||||
* 天气结果
|
||||
*/
|
||||
private Result result;
|
||||
}
|
||||
@ -7,13 +7,27 @@ import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
/**
|
||||
* 全天地表 10 米风速
|
||||
*/
|
||||
public class Wind {
|
||||
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm", timezone = "GMT+8")
|
||||
private Date datetime;
|
||||
/**
|
||||
* 风速
|
||||
*/
|
||||
private Double speed;
|
||||
|
||||
/**
|
||||
* 风向
|
||||
*/
|
||||
private Double direction;
|
||||
|
||||
private WindSpeed max;
|
||||
private WindSpeed min;
|
||||
|
||||
/**
|
||||
* 平均
|
||||
*/
|
||||
private WindSpeed avg;
|
||||
}
|
||||
@ -9,6 +9,13 @@ import lombok.Data;
|
||||
**/
|
||||
@Data
|
||||
public class WindSpeed {
|
||||
/**
|
||||
* 风速
|
||||
*/
|
||||
private Double speed;
|
||||
|
||||
/**
|
||||
* 风向
|
||||
*/
|
||||
private Double direction;
|
||||
}
|
||||
|
||||
@ -28,7 +28,6 @@
|
||||
<artifactId>iot-third</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
||||
@ -0,0 +1,28 @@
|
||||
package com.qiuguo.iot.user.api.config;
|
||||
|
||||
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
|
||||
|
||||
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory;
|
||||
|
||||
|
||||
/**
|
||||
* @author simon
|
||||
* @date 2023/9/26
|
||||
* @description
|
||||
**/
|
||||
@Configuration
|
||||
public class TopicRabbitListenerConfig {
|
||||
@Bean
|
||||
public SimpleRabbitListenerContainerFactory simpleRabbitListenerContainerFactory(ConnectionFactory connectionFactory) {
|
||||
// 配置消息监听容器工厂
|
||||
SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
|
||||
factory.setConnectionFactory(connectionFactory);
|
||||
factory.setConcurrentConsumers(3); // 并发消费者数量
|
||||
factory.setMaxConcurrentConsumers(10); // 最大并发消费者数量
|
||||
factory.setPrefetchCount(1); // 每个消费者的消息预取数量
|
||||
return factory;
|
||||
}
|
||||
}
|
||||
@ -18,7 +18,7 @@ import java.io.IOException;
|
||||
@Component
|
||||
@Slf4j
|
||||
public class YunxiListener {
|
||||
@RabbitListener(queues = YunxiRabbitConst.QUEUE_YUNXI)
|
||||
@RabbitListener(queues = YunxiRabbitConst.QUEUE_YUNXI, containerFactory = "simpleRabbitListenerContainerFactory")
|
||||
public void processYunxiQueue(Channel channel, Message message) throws IOException {
|
||||
String messageContent = new String(message.getBody(), "UTF-8");
|
||||
System.out.println("YunxiListener msg " + messageContent);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user