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
|
* @author simon
|
||||||
* @date 2023/9/21
|
* @date 2023/9/21
|
||||||
* @description
|
* @description 按整天天气数据
|
||||||
**/
|
**/
|
||||||
@Data
|
@Data
|
||||||
public class Daily {
|
public class Daily {
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 白天降水数据
|
||||||
|
*/
|
||||||
private List<Temperature> precipitation_08h_20h;
|
private List<Temperature> precipitation_08h_20h;
|
||||||
|
/**
|
||||||
|
* 夜晚降水数据
|
||||||
|
*/
|
||||||
private List<Temperature> precipitation_20h_32h;
|
private List<Temperature> precipitation_20h_32h;
|
||||||
|
/**
|
||||||
|
* 降水数据
|
||||||
|
*/
|
||||||
private List<Temperature> precipitation;
|
private List<Temperature> precipitation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全天地表 2 米气温
|
||||||
|
*/
|
||||||
private List<Temperature> temperature;
|
private List<Temperature> temperature;
|
||||||
|
/**
|
||||||
|
* 白天地表 2 米气温
|
||||||
|
*/
|
||||||
private List<Temperature> temperature_08h_20h;
|
private List<Temperature> temperature_08h_20h;
|
||||||
|
/**
|
||||||
|
* 夜晚地表 2 米气温
|
||||||
|
*/
|
||||||
private List<Temperature> temperature_20h_32h;
|
private List<Temperature> temperature_20h_32h;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全天地表 10 米风速
|
||||||
|
*/
|
||||||
private List<Wind> wind;
|
private List<Wind> wind;
|
||||||
|
/**
|
||||||
|
* 白天地表 10 米风速
|
||||||
|
*/
|
||||||
private List<Wind> wind_08h_20h;
|
private List<Wind> wind_08h_20h;
|
||||||
|
/**
|
||||||
|
* 夜晚地表 10 米风速
|
||||||
|
*/
|
||||||
private List<Wind> wind_20h_32h;
|
private List<Wind> wind_20h_32h;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 地表 2 米相对湿度(%)
|
||||||
|
*/
|
||||||
private List<Temperature> humidity;
|
private List<Temperature> humidity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 云量(0.0-1.0)
|
||||||
|
*/
|
||||||
private List<Temperature> cloudrate;
|
private List<Temperature> cloudrate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 地面气压
|
||||||
|
*/
|
||||||
private List<Temperature> pressure;
|
private List<Temperature> pressure;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 地表水平能见度
|
||||||
|
*/
|
||||||
private List<Temperature> visibility;
|
private List<Temperature> visibility;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 向下短波辐射通量(W/M2)
|
||||||
|
*/
|
||||||
private List<Temperature> dswrf;
|
private List<Temperature> dswrf;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生活指数
|
||||||
|
*/
|
||||||
private LifeIndex life_index;
|
private LifeIndex life_index;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,19 +4,71 @@ import lombok.Data;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按小时天气数据
|
||||||
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class Hourly {
|
public class Hourly {
|
||||||
|
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 天气描述
|
||||||
|
*/
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 降水数据
|
||||||
|
*/
|
||||||
private List<Precipitation> precipitation;
|
private List<Precipitation> precipitation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 地表 2 米气温
|
||||||
|
*/
|
||||||
private List<WeatherTimeInt> temperature;
|
private List<WeatherTimeInt> temperature;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 体感温度
|
||||||
|
*/
|
||||||
private List<WeatherTimeDouble> apparent_temperature;
|
private List<WeatherTimeDouble> apparent_temperature;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 风
|
||||||
|
*/
|
||||||
private List<Wind> wind;
|
private List<Wind> wind;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 地表 2 米相对湿度(%)
|
||||||
|
*/
|
||||||
private List<WeatherTimeDouble> humidity;
|
private List<WeatherTimeDouble> humidity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 云量(0.0-1.0)
|
||||||
|
*/
|
||||||
private List<WeatherTimeInt> cloudrate;
|
private List<WeatherTimeInt> cloudrate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 天气现象
|
||||||
|
*/
|
||||||
private List<WeatherTimeString> skycon;
|
private List<WeatherTimeString> skycon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pressure
|
||||||
|
*/
|
||||||
private List<WeatherTimeDouble> pressure;
|
private List<WeatherTimeDouble> pressure;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 地表水平能见度
|
||||||
|
*/
|
||||||
private List<WeatherTimeDouble> visibility;
|
private List<WeatherTimeDouble> visibility;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 向下短波辐射通量(W/M2)
|
||||||
|
*/
|
||||||
private List<WeatherTimeDouble> dswrf;
|
private List<WeatherTimeDouble> dswrf;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 空气质量
|
||||||
|
*/
|
||||||
private AirQuality air_quality;
|
private AirQuality air_quality;
|
||||||
}
|
}
|
||||||
@ -4,8 +4,20 @@ import lombok.Data;
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class Result {
|
public class Result {
|
||||||
|
/**
|
||||||
|
* 按天小时数据
|
||||||
|
*/
|
||||||
private Hourly hourly;
|
private Hourly hourly;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按天天气数据
|
||||||
|
*/
|
||||||
private Daily daily;
|
private Daily daily;
|
||||||
|
|
||||||
private Integer primary;
|
private Integer primary;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按天天气数据
|
||||||
|
*/
|
||||||
private String forecast_keypoint;
|
private String forecast_keypoint;
|
||||||
}
|
}
|
||||||
@ -4,6 +4,10 @@ import lombok.Data;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文档地址
|
||||||
|
* https://docs.caiyunapp.com/docs/daily
|
||||||
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class WeatherResp {
|
public class WeatherResp {
|
||||||
private String status;
|
private String status;
|
||||||
@ -15,5 +19,8 @@ public class WeatherResp {
|
|||||||
private String timezone;
|
private String timezone;
|
||||||
private Long server_time;
|
private Long server_time;
|
||||||
private List<Double> location;
|
private List<Double> location;
|
||||||
|
/**
|
||||||
|
* 天气结果
|
||||||
|
*/
|
||||||
private Result result;
|
private Result result;
|
||||||
}
|
}
|
||||||
@ -7,13 +7,27 @@ import org.springframework.format.annotation.DateTimeFormat;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
/**
|
||||||
|
* 全天地表 10 米风速
|
||||||
|
*/
|
||||||
public class Wind {
|
public class Wind {
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm", timezone = "GMT+8")
|
||||||
private Date datetime;
|
private Date datetime;
|
||||||
|
/**
|
||||||
|
* 风速
|
||||||
|
*/
|
||||||
private Double speed;
|
private Double speed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 风向
|
||||||
|
*/
|
||||||
private Double direction;
|
private Double direction;
|
||||||
|
|
||||||
private WindSpeed max;
|
private WindSpeed max;
|
||||||
private WindSpeed min;
|
private WindSpeed min;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 平均
|
||||||
|
*/
|
||||||
private WindSpeed avg;
|
private WindSpeed avg;
|
||||||
}
|
}
|
||||||
@ -9,6 +9,13 @@ import lombok.Data;
|
|||||||
**/
|
**/
|
||||||
@Data
|
@Data
|
||||||
public class WindSpeed {
|
public class WindSpeed {
|
||||||
|
/**
|
||||||
|
* 风速
|
||||||
|
*/
|
||||||
private Double speed;
|
private Double speed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 风向
|
||||||
|
*/
|
||||||
private Double direction;
|
private Double direction;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,7 +29,6 @@
|
|||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-webflux</artifactId>
|
<artifactId>spring-boot-starter-webflux</artifactId>
|
||||||
|
|||||||
@ -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
|
@Component
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class YunxiListener {
|
public class YunxiListener {
|
||||||
@RabbitListener(queues = YunxiRabbitConst.QUEUE_YUNXI)
|
@RabbitListener(queues = YunxiRabbitConst.QUEUE_YUNXI, containerFactory = "simpleRabbitListenerContainerFactory")
|
||||||
public void processYunxiQueue(Channel channel, Message message) throws IOException {
|
public void processYunxiQueue(Channel channel, Message message) throws IOException {
|
||||||
String messageContent = new String(message.getBody(), "UTF-8");
|
String messageContent = new String(message.getBody(), "UTF-8");
|
||||||
System.out.println("YunxiListener msg " + messageContent);
|
System.out.println("YunxiListener msg " + messageContent);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user