Compare commits
6 Commits
develop
...
添加使用代理服务器功
Author | SHA1 | Date | |
---|---|---|---|
59208d80ba | |||
cba061e177 | |||
c988bf4c91 | |||
628b08e1ef | |||
7dce36562c | |||
9b0d6a8c6d |
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"java.configuration.updateBuildConfiguration": "automatic",
|
"java.configuration.updateBuildConfiguration": "automatic",
|
||||||
"java.format.settings.url": "D:\\工作文档\\配置备份\\vscode\\eclipse-java-google-style.xml",
|
"java.format.settings.url": "E:\\工作文档\\4、配置备份\\vscode\\eclipse-java-google-style.xml",
|
||||||
"[java]": {
|
"[java]": {
|
||||||
"editor.detectIndentation": true
|
"editor.detectIndentation": true
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,12 @@
|
|||||||
"query_url": "https://devapi.qweather.com/v7/warning/now?",
|
"query_url": "https://devapi.qweather.com/v7/warning/now?",
|
||||||
"wechat_officalaccount_url": "https://cxxmwx.cpic.com.cn/app/index.php?i=2&c=entry&do=send_group_tpl_api&m=ok_tplmessage",
|
"wechat_officalaccount_url": "https://cxxmwx.cpic.com.cn/app/index.php?i=2&c=entry&do=send_group_tpl_api&m=ok_tplmessage",
|
||||||
"query_interval": 10,
|
"query_interval": 10,
|
||||||
|
"proxy_setting": {
|
||||||
|
"enable": true,
|
||||||
|
"proxy_mode": "http",
|
||||||
|
"proxy_address": "172.16.39.2",
|
||||||
|
"proxy_port": 18080
|
||||||
|
},
|
||||||
"cities": [
|
"cities": [
|
||||||
{
|
{
|
||||||
"city_name": "厦门",
|
"city_name": "厦门",
|
||||||
|
@ -225,11 +225,6 @@
|
|||||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||||
</remote-repository>
|
</remote-repository>
|
||||||
</component>
|
</component>
|
||||||
<component name="SwUserDefinedSpecifications">
|
|
||||||
<option name="specTypeByUrl">
|
|
||||||
<map />
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
<component name="VcsDirectoryMappings">
|
<component name="VcsDirectoryMappings">
|
||||||
<mapping directory="$PROJECT_DIR$/../../.." vcs="Git" />
|
<mapping directory="$PROJECT_DIR$/../../.." vcs="Git" />
|
||||||
</component>
|
</component>
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.cpic.xim</groupId>
|
<groupId>com.cpic.xim</groupId>
|
||||||
<artifactId>disaster_warning</artifactId>
|
<artifactId>disaster_warning</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.1</version>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.oracle</groupId>
|
<groupId>com.oracle</groupId>
|
||||||
@ -23,20 +25,23 @@
|
|||||||
<version>4.13.2</version>
|
<version>4.13.2</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<!--jackson-->
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
|
||||||
<artifactId>jackson-core</artifactId>
|
|
||||||
<version>2.9.8</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-databind</artifactId>
|
<artifactId>jackson-databind</artifactId>
|
||||||
<version>2.9.8</version>
|
<version>2.14.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-core</artifactId>
|
||||||
|
<version>2.13.4</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-annotations</artifactId>
|
<artifactId>jackson-annotations</artifactId>
|
||||||
<version>2.9.8</version>
|
<version>2.13.4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* @Author: Kane
|
* @Author: Kane
|
||||||
* @Date: 2022-04-22 10:53:49
|
* @Date: 2022-04-22 10:53:49
|
||||||
* @LastEditors: Kane
|
* @LastEditors: Kane
|
||||||
* @LastEditTime: 2022-06-07 13:16:35
|
* @LastEditTime: 2022-11-04 11:50:17
|
||||||
* @FilePath: \DisasterWarning\src\main\java\AppMain.java
|
* @FilePath: \DisasterWarning\src\main\java\AppMain.java
|
||||||
* @Description: 和风天气预警推送厦门太保公众号主程序!
|
* @Description: 和风天气预警推送厦门太保公众号主程序!
|
||||||
*
|
*
|
||||||
@ -22,34 +22,42 @@ import java.sql.SQLException;
|
|||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import java.util.logging.*;
|
import java.util.logging.*;
|
||||||
|
|
||||||
public class AppMain {
|
public class AppMain
|
||||||
|
{
|
||||||
// private final static String LOG_FILE_PATH = "./logs/app%u.log";
|
// private final static String LOG_FILE_PATH = "./logs/app%u.log";
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main( String[] args )
|
||||||
|
{
|
||||||
String json;
|
String json;
|
||||||
WeatherDisasterNotifyConfig config = null;
|
WeatherDisasterNotifyConfig config = null;
|
||||||
QWeatherDisasterWarning warning = null;
|
QWeatherDisasterWarning warning = null;
|
||||||
Logger logger = null;
|
Logger logger = null;
|
||||||
|
|
||||||
// 配置logger
|
// 配置logger
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
setRootLogger();
|
setRootLogger();
|
||||||
|
|
||||||
logger = Logger.getLogger("com.cpicxim");
|
logger = Logger.getLogger( "com.cpicxim" );
|
||||||
} catch (IOException error) {
|
}
|
||||||
System.out.println("配置logger失败,原因:" + error.getMessage());
|
catch ( IOException error )
|
||||||
|
{
|
||||||
|
System.out.println( "配置logger失败,原因:" + error.getMessage() );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 读取配置
|
// 读取配置
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
config = AppConfigManager.getConfig();
|
config = AppConfigManager.getConfig();
|
||||||
} catch (IOException error) {
|
}
|
||||||
System.out.println("读取配置文件失败!");
|
catch ( IOException error )
|
||||||
System.out.println(error.getMessage());
|
{
|
||||||
|
System.out.println( "读取配置文件失败!" );
|
||||||
|
System.out.println( error.getMessage() );
|
||||||
|
|
||||||
logger.log(Level.SEVERE, "读取配置文件失败:{0}", error.getMessage());
|
logger.log( Level.SEVERE, "读取配置文件失败:{0}", error.getMessage() );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -59,68 +67,90 @@ public class AppMain {
|
|||||||
String userKey = config.getKey();
|
String userKey = config.getKey();
|
||||||
|
|
||||||
// 遍历所有城市,查询是否有警报,有则推送。
|
// 遍历所有城市,查询是否有警报,有则推送。
|
||||||
while (true) {
|
while (true)
|
||||||
for (City city : cities) {
|
{
|
||||||
try {
|
for ( City city : cities )
|
||||||
json = WeatherDisasterWarningGrabber.getWeatherDisasterWarningJSON(queryURL,
|
{
|
||||||
userKey, city.getCityCode());
|
try
|
||||||
warning = WeatherDisasterWarningGrabber.convertWeatherDisasterWarning(json);
|
{
|
||||||
|
json = WeatherDisasterWarningGrabber.getWeatherDisasterWarningJSON( queryURL,
|
||||||
|
userKey, city.getCityCode(), config.getProxySetting() );
|
||||||
|
warning = WeatherDisasterWarningGrabber.convertWeatherDisasterWarning( json );
|
||||||
|
|
||||||
logger.log(Level.INFO, "查询{0}天气预警,结果:{1}。", new Object[] { city.getCityName(), json });
|
logger.log( Level.INFO, "查询{0}天气预警,结果:{1}。", new Object[]
|
||||||
|
{ city.getCityName(), json} );
|
||||||
|
|
||||||
Vector<QWeatherDisasterWarningItem> warningItems = warning.getWarning();
|
Vector<QWeatherDisasterWarningItem> warningItems = warning.getWarning();
|
||||||
|
|
||||||
// 判断是否有警报,没有警报就结束当前城市的处理
|
// 判断是否有警报,没有警报就结束当前城市的处理
|
||||||
if (warningItems.isEmpty() == true) {
|
if ( warningItems.isEmpty() == true)
|
||||||
logger.log(Level.INFO, "查询{0}天气预警,无警报!。", new Object[] { city.getCityName() });
|
{
|
||||||
|
logger.log( Level.INFO, "查询{0}天气预警,无警报!。", new Object[]
|
||||||
|
{ city.getCityName()} );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 有警报,就遍历警报数组
|
// 有警报,就遍历警报数组
|
||||||
for (QWeatherDisasterWarningItem item : warningItems) {
|
for ( QWeatherDisasterWarningItem item : warningItems )
|
||||||
|
{
|
||||||
// 先检查是否已经发送过
|
// 先检查是否已经发送过
|
||||||
if (sendMessage.checkWarningHasSended(item.getId()) == false) {
|
if ( sendMessage.checkWarningHasSended( item.getId() ) == false)
|
||||||
logger.log(Level.INFO, "查询{0}天气预警,ID:{1},已有发送记录,跳过。",
|
{
|
||||||
new Object[] { city.getCityName(), item.getId() });
|
logger.log( Level.INFO, "查询{0}天气预警,ID:{1},已有发送记录,跳过。", new Object[]
|
||||||
|
{ city.getCityName(), item.getId()} );
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 没有发送过
|
// 没有发送过
|
||||||
logger.log(Level.INFO, "查询{0}天气预警,发送日志。", new Object[] { city.getCityName() });
|
logger.log( Level.INFO, "查询{0}天气预警,发送日志。", new Object[]
|
||||||
|
{ city.getCityName()} );
|
||||||
|
|
||||||
sendMessage.sendWeatherDisasterWarning(config.getWechatOfficalAccountURL(),
|
sendMessage.sendWeatherDisasterWarning( config.getWechatOfficalAccountURL(),
|
||||||
item);
|
item );
|
||||||
|
|
||||||
logger.log(Level.INFO, "{0}天气预警,日志发送成功。", new Object[] { city.getCityName() });
|
logger.log( Level.INFO, "{0}天气预警,日志发送成功。", new Object[]
|
||||||
|
{ city.getCityName()} );
|
||||||
|
|
||||||
// 将发送的警报,保存起来
|
// 将发送的警报,保存起来
|
||||||
sendMessage.saveWeatherDisasterWarning(city.getCityName(), item);
|
sendMessage.saveWeatherDisasterWarning( city.getCityName(), item );
|
||||||
}
|
}
|
||||||
} catch (IOException error) {
|
}
|
||||||
System.out.println("查询" + city.getCityName() + "出现异常!");
|
catch ( IOException error )
|
||||||
System.out.println(error.getMessage());
|
{
|
||||||
|
System.out.println( "查询" + city.getCityName() + "出现异常!" );
|
||||||
|
System.out.println( error.getMessage() );
|
||||||
|
|
||||||
logger.log(Level.SEVERE, "查询 {0} 出现异常:{1}。",
|
logger.log( Level.SEVERE, "查询 {0} 出现异常:{1}。", new Object[]
|
||||||
new Object[] { city.getCityName(), error.getMessage() });
|
{ city.getCityName(), error.getMessage()} );
|
||||||
} catch (SQLException error) {
|
}
|
||||||
logger.log(Level.SEVERE, "查询 {0} 写入数据库失败:{1}。",
|
catch ( SQLException error )
|
||||||
new Object[] { city.getCityName(), error.getMessage() });
|
{
|
||||||
} catch (ClassNotFoundException error) {
|
logger.log( Level.SEVERE, "查询 {0} 写入数据库失败:{1}。", new Object[]
|
||||||
logger.log(Level.SEVERE, "查询 {0} 加载oracle驱动失败:{1}。",
|
{ city.getCityName(), error.getMessage()} );
|
||||||
new Object[] { city.getCityName(), error.getMessage() });
|
}
|
||||||
|
catch ( ClassNotFoundException error )
|
||||||
|
{
|
||||||
|
logger.log( Level.SEVERE, "查询 {0} 加载oracle驱动失败:{1}。", new Object[]
|
||||||
|
{ city.getCityName(), error.getMessage()} );
|
||||||
|
|
||||||
} catch (Exception error) {
|
}
|
||||||
logger.log(Level.SEVERE, "查询 {0} 出现未知错误:{1}。",
|
catch ( Exception error )
|
||||||
new Object[] { city.getCityName(), error.getMessage() });
|
{
|
||||||
|
logger.log( Level.SEVERE, "查询 {0} 出现未知错误:{1}。", new Object[]
|
||||||
|
{ city.getCityName(), error.getMessage()} );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try
|
||||||
logger.log(Level.INFO, "查询结束,休眠{0}分钟。", config.getQueryInterval());
|
{
|
||||||
Thread.sleep(config.getQueryInterval() * 1000 * 60);
|
logger.log( Level.INFO, "查询结束,休眠{0}分钟。", config.getQueryInterval() );
|
||||||
} catch (InterruptedException error) {
|
Thread.sleep( config.getQueryInterval() * 1000 * 60 );
|
||||||
logger.log(Level.SEVERE, "线程休眠异常,错误信息:{0}", new Object[] { error.getMessage() });
|
}
|
||||||
|
catch ( InterruptedException error )
|
||||||
|
{
|
||||||
|
logger.log( Level.SEVERE, "线程休眠异常,错误信息:{0}", new Object[]
|
||||||
|
{ error.getMessage()} );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -128,16 +158,17 @@ public class AppMain {
|
|||||||
/**
|
/**
|
||||||
* 设置JUL的logger。
|
* 设置JUL的logger。
|
||||||
*/
|
*/
|
||||||
private static void setRootLogger() throws IOException {
|
private static void setRootLogger() throws IOException
|
||||||
|
{
|
||||||
LogManager logManager = LogManager.getLogManager();
|
LogManager logManager = LogManager.getLogManager();
|
||||||
// 使用外部的配置文件。
|
// 使用外部的配置文件。
|
||||||
FileInputStream configFile = new FileInputStream("./logging.properties");
|
FileInputStream configFile = new FileInputStream( "./logging.properties" );
|
||||||
// 使用jar中的配置文件。
|
// 使用jar中的配置文件。
|
||||||
// InputStream configFile =
|
// InputStream configFile =
|
||||||
// AppMain.class.getClassLoader().getResourceAsStream( "logging.properties" );
|
// AppMain.class.getClassLoader().getResourceAsStream( "logging.properties" );
|
||||||
|
|
||||||
logManager.readConfiguration(configFile);
|
logManager.readConfiguration( configFile );
|
||||||
|
|
||||||
Logger.getLogger("com.cpicxim");
|
Logger.getLogger( "com.cpicxim" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,116 @@
|
|||||||
|
/*
|
||||||
|
* @Author: Kane
|
||||||
|
* @Date: 2022-11-04 14:18:19
|
||||||
|
* @LastEditors: Kane
|
||||||
|
* @LastEditTime: 2022-11-04 15:01:58
|
||||||
|
* @FilePath: \DisasterWarning\src\main\java\com\cpic\xim\config\db\ProxySetting.java
|
||||||
|
* @Description: 用于存放代理服务器设置的类。
|
||||||
|
*
|
||||||
|
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||||||
|
*/
|
||||||
|
package com.cpic.xim.config;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.*;;
|
||||||
|
|
||||||
|
/*****************************************************
|
||||||
|
* 用于存放代理服务器设置的类。
|
||||||
|
*****************************************************/
|
||||||
|
public class ProxySetting
|
||||||
|
{
|
||||||
|
public ProxySetting()
|
||||||
|
{}
|
||||||
|
|
||||||
|
public boolean isEnable()
|
||||||
|
{
|
||||||
|
return enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnable( boolean enable )
|
||||||
|
{
|
||||||
|
this.enable = enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProxyMode()
|
||||||
|
{
|
||||||
|
return proxyMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProxyMode( String proxyMode )
|
||||||
|
{
|
||||||
|
this.proxyMode = proxyMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProxyAddress()
|
||||||
|
{
|
||||||
|
return proxyAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProxyAddress( String proxy_address )
|
||||||
|
{
|
||||||
|
this.proxyAddress = proxy_address;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getProxyPort()
|
||||||
|
{
|
||||||
|
return proxyPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProxyPort( int proxy_port )
|
||||||
|
{
|
||||||
|
this.proxyPort = proxy_port;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode()
|
||||||
|
{
|
||||||
|
final int prime = 31;
|
||||||
|
int result = 1;
|
||||||
|
result = prime * result + (enable ? 1231 : 1237);
|
||||||
|
result = prime * result + ((proxyMode == null) ? 0 : proxyMode.hashCode());
|
||||||
|
result = prime * result + ((proxyAddress == null) ? 0 : proxyAddress.hashCode());
|
||||||
|
result = prime * result + proxyPort;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals( Object obj )
|
||||||
|
{
|
||||||
|
if ( this == obj)
|
||||||
|
return true;
|
||||||
|
if ( obj == null)
|
||||||
|
return false;
|
||||||
|
if ( getClass() != obj.getClass())
|
||||||
|
return false;
|
||||||
|
ProxySetting other = (ProxySetting) obj;
|
||||||
|
if ( enable != other.enable)
|
||||||
|
return false;
|
||||||
|
if ( proxyMode == null)
|
||||||
|
{
|
||||||
|
if ( other.proxyMode != null)
|
||||||
|
return false;
|
||||||
|
} else if ( !proxyMode.equals( other.proxyMode ))
|
||||||
|
return false;
|
||||||
|
if ( proxyAddress == null)
|
||||||
|
{
|
||||||
|
if ( other.proxyAddress != null)
|
||||||
|
return false;
|
||||||
|
} else if ( !proxyAddress.equals( other.proxyAddress ))
|
||||||
|
return false;
|
||||||
|
if ( proxyPort != other.proxyPort)
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonProperty( "enable")
|
||||||
|
private boolean enable = true;
|
||||||
|
|
||||||
|
@JsonProperty( "proxy_mode")
|
||||||
|
private String proxyMode = "http";
|
||||||
|
|
||||||
|
@JsonProperty( "proxy_address")
|
||||||
|
private String proxyAddress;
|
||||||
|
|
||||||
|
@JsonProperty( "proxy_port")
|
||||||
|
private int proxyPort;
|
||||||
|
|
||||||
|
}
|
@ -2,7 +2,7 @@
|
|||||||
* @Author: Kane
|
* @Author: Kane
|
||||||
* @Date: 2022-04-24 10:21:46
|
* @Date: 2022-04-24 10:21:46
|
||||||
* @LastEditors: Kane
|
* @LastEditors: Kane
|
||||||
* @LastEditTime: 2022-05-10 16:16:28
|
* @LastEditTime: 2022-11-04 15:03:05
|
||||||
* @FilePath: \DisasterWarning\src\main\java\com\cpic\xim\config\WeatherDisasterNotifyConfig.java
|
* @FilePath: \DisasterWarning\src\main\java\com\cpic\xim\config\WeatherDisasterNotifyConfig.java
|
||||||
* @Description:
|
* @Description:
|
||||||
*
|
*
|
||||||
@ -11,7 +11,6 @@
|
|||||||
package com.cpic.xim.config;
|
package com.cpic.xim.config;
|
||||||
|
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
|
||||||
@ -67,6 +66,15 @@ public class WeatherDisasterNotifyConfig
|
|||||||
this.queryInterval = queryInterval;
|
this.queryInterval = queryInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ProxySetting getProxySetting()
|
||||||
|
{
|
||||||
|
return proxySetting;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProxySetting( ProxySetting proxySetting )
|
||||||
|
{
|
||||||
|
this.proxySetting = proxySetting;
|
||||||
|
}
|
||||||
|
|
||||||
public void setCities( Vector<City> cities )
|
public void setCities( Vector<City> cities )
|
||||||
{
|
{
|
||||||
@ -105,6 +113,9 @@ public class WeatherDisasterNotifyConfig
|
|||||||
@JsonProperty( "query_interval")
|
@JsonProperty( "query_interval")
|
||||||
private int queryInterval;
|
private int queryInterval;
|
||||||
|
|
||||||
|
@JsonProperty( "proxy_setting")
|
||||||
|
private ProxySetting proxySetting;
|
||||||
|
|
||||||
@JsonProperty( "wechat_officalaccount_url")
|
@JsonProperty( "wechat_officalaccount_url")
|
||||||
private String wechatOfficalAccountURL;
|
private String wechatOfficalAccountURL;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* @Author: Kane
|
* @Author: Kane
|
||||||
* @Date: 2022-04-25 21:45:12
|
* @Date: 2022-04-25 21:45:12
|
||||||
* @LastEditors: Kane
|
* @LastEditors: Kane
|
||||||
* @LastEditTime: 2022-05-03 22:34:37
|
* @LastEditTime: 2022-11-04 14:51:25
|
||||||
* @FilePath: \DisasterWarning\src\main\java\com\cpic\xim\config\db\OracleConfigManager.java
|
* @FilePath: \DisasterWarning\src\main\java\com\cpic\xim\config\db\OracleConfigManager.java
|
||||||
* @Description: oracle数据库配置文件加载类
|
* @Description: oracle数据库配置文件加载类
|
||||||
*
|
*
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* @Author: Kane
|
* @Author: Kane
|
||||||
* @Date: 2022-04-22 09:54:05
|
* @Date: 2022-04-22 09:54:05
|
||||||
* @LastEditors: Kane
|
* @LastEditors: Kane
|
||||||
* @LastEditTime: 2022-04-22 16:18:17
|
* @LastEditTime: 2022-11-04 11:48:28
|
||||||
* @FilePath: \DisasterWarning\src\main\java\com\cpic\xim\httpUtil\HttpUtils.java
|
* @FilePath: \DisasterWarning\src\main\java\com\cpic\xim\httpUtil\HttpUtils.java
|
||||||
* @Description: http相关的工具类。
|
* @Description: http相关的工具类。
|
||||||
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||||||
@ -22,85 +22,71 @@ import java.nio.charset.StandardCharsets;
|
|||||||
/**
|
/**
|
||||||
* Http相关的工具类。
|
* Http相关的工具类。
|
||||||
*/
|
*/
|
||||||
public class HttpUtils
|
public class HttpUtils {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* 以POST方式发送http请求!
|
* 以POST方式发送http请求!
|
||||||
* @param url 访问的链接字符串
|
*
|
||||||
|
* @param url 访问的链接字符串
|
||||||
* @param headers 请求头部参数集合
|
* @param headers 请求头部参数集合
|
||||||
* @param params 请求体字符串
|
* @param params 请求体字符串
|
||||||
*/
|
*/
|
||||||
public static String postHttpRequest( String url, HashMap<String, String> headers,
|
public static String postHttpRequest(String url, HashMap<String, String> headers,
|
||||||
String param ) throws MalformedURLException
|
String param) throws MalformedURLException {
|
||||||
{
|
|
||||||
URL httpURL = null;
|
URL httpURL = null;
|
||||||
HttpURLConnection conn = null;
|
HttpURLConnection conn = null;
|
||||||
OutputStreamWriter out = null;
|
OutputStreamWriter out = null;
|
||||||
BufferedReader in = null;
|
BufferedReader in = null;
|
||||||
StringBuilder result = new StringBuilder();
|
StringBuilder result = new StringBuilder();
|
||||||
|
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
// 获取connection
|
// 获取connection
|
||||||
httpURL = new URL( url );
|
httpURL = new URL(url);
|
||||||
conn = (HttpURLConnection) httpURL.openConnection();
|
conn = (HttpURLConnection) httpURL.openConnection();
|
||||||
|
|
||||||
// 设置请求方式
|
// 设置请求方式
|
||||||
conn.setRequestMethod( "POST" );
|
conn.setRequestMethod("POST");
|
||||||
|
|
||||||
// 设置请求头参数
|
// 设置请求头参数
|
||||||
for ( HashMap.Entry<String, String> head : headers.entrySet())
|
for (HashMap.Entry<String, String> head : headers.entrySet()) {
|
||||||
{
|
conn.setRequestProperty(head.getKey(), head.getValue());
|
||||||
conn.setRequestProperty( head.getKey(), head.getValue() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 连接
|
// 连接
|
||||||
conn.setDoInput( true );
|
conn.setDoInput(true);
|
||||||
conn.setDoOutput( true );
|
conn.setDoOutput(true);
|
||||||
conn.connect();
|
conn.connect();
|
||||||
|
|
||||||
// 输出请求
|
// 输出请求
|
||||||
out = new OutputStreamWriter( conn.getOutputStream(), StandardCharsets.UTF_8 );
|
out = new OutputStreamWriter(conn.getOutputStream(), StandardCharsets.UTF_8);
|
||||||
out.write( param );
|
out.write(param);
|
||||||
out.flush();
|
out.flush();
|
||||||
|
|
||||||
// 读取返回值。
|
// 读取返回值。
|
||||||
in = new BufferedReader( new InputStreamReader( conn.getInputStream() ) );
|
in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
|
||||||
|
|
||||||
String line = in.readLine();
|
String line = in.readLine();
|
||||||
|
|
||||||
while (line != null)
|
while (line != null) {
|
||||||
{
|
result.append(line);
|
||||||
result.append( line );
|
|
||||||
|
|
||||||
line = in.readLine();
|
line = in.readLine();
|
||||||
}
|
}
|
||||||
}
|
} catch (IOException error) {
|
||||||
catch (IOException error)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
} finally {
|
||||||
finally
|
try {
|
||||||
{
|
if (out != null) {
|
||||||
try
|
|
||||||
{
|
|
||||||
if ( out != null)
|
|
||||||
{
|
|
||||||
out.close();
|
out.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( in != null)
|
if (in != null) {
|
||||||
{
|
|
||||||
in.close();
|
in.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( conn != null)
|
if (conn != null) {
|
||||||
{
|
|
||||||
conn.disconnect();
|
conn.disconnect();
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception error) {
|
||||||
catch (Exception error)
|
|
||||||
{
|
|
||||||
error.printStackTrace();
|
error.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,267 +1,357 @@
|
|||||||
package com.cpic.xim.notify.disaster;
|
package com.cpic.xim.notify.disaster;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
//import com.fasterxml.jackson.annotation.JsonIgnore;
|
//import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
|
||||||
public class QWeatherDisasterWarningItem {
|
public class QWeatherDisasterWarningItem
|
||||||
public QWeatherDisasterWarningItem() {
|
{
|
||||||
|
public QWeatherDisasterWarningItem()
|
||||||
|
{}
|
||||||
|
|
||||||
|
public String getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public QWeatherDisasterWarningItem(String id, String sender, Date pubTime, String title, String status,
|
public void setId( String id )
|
||||||
String level, String severity, String severityColor, String type, String typeName, String text,
|
{
|
||||||
String related, String urgency, String certainty) {
|
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSender()
|
||||||
|
{
|
||||||
|
return sender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSender( String sender )
|
||||||
|
{
|
||||||
this.sender = sender;
|
this.sender = sender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getPubTime()
|
||||||
|
{
|
||||||
|
return pubTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPubTime( Date pubTime )
|
||||||
|
{
|
||||||
this.pubTime = pubTime;
|
this.pubTime = pubTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle()
|
||||||
|
{
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle( String title )
|
||||||
|
{
|
||||||
this.title = title;
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getStartTime()
|
||||||
|
{
|
||||||
|
return startTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartTime( Date startTime )
|
||||||
|
{
|
||||||
|
this.startTime = startTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getEndTime()
|
||||||
|
{
|
||||||
|
return endTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndTime( Date endTime )
|
||||||
|
{
|
||||||
|
this.endTime = endTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatus()
|
||||||
|
{
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus( String status )
|
||||||
|
{
|
||||||
this.status = status;
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLevel()
|
||||||
|
{
|
||||||
|
return level;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLevel( String level )
|
||||||
|
{
|
||||||
this.level = level;
|
this.level = level;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSeverity()
|
||||||
|
{
|
||||||
|
return severity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSeverity( String severity )
|
||||||
|
{
|
||||||
this.severity = severity;
|
this.severity = severity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSeverityColor()
|
||||||
|
{
|
||||||
|
return severityColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSeverityColor( String severityColor )
|
||||||
|
{
|
||||||
this.severityColor = severityColor;
|
this.severityColor = severityColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType()
|
||||||
|
{
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType( String type )
|
||||||
|
{
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTypeName()
|
||||||
|
{
|
||||||
|
return typeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTypeName( String typeName )
|
||||||
|
{
|
||||||
this.typeName = typeName;
|
this.typeName = typeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getText()
|
||||||
|
{
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setText( String text )
|
||||||
|
{
|
||||||
this.text = text;
|
this.text = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRelated()
|
||||||
|
{
|
||||||
|
return related;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRelated( String related )
|
||||||
|
{
|
||||||
this.related = related;
|
this.related = related;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUrgency()
|
||||||
|
{
|
||||||
|
return urgency;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUrgency( String urgency )
|
||||||
|
{
|
||||||
this.urgency = urgency;
|
this.urgency = urgency;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCertainty()
|
||||||
|
{
|
||||||
|
return certainty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCertainty( String certainty )
|
||||||
|
{
|
||||||
this.certainty = certainty;
|
this.certainty = certainty;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode()
|
||||||
|
{
|
||||||
final int prime = 31;
|
final int prime = 31;
|
||||||
int result = 1;
|
int result = 1;
|
||||||
result = prime * result + ((certainty == null) ? 0 : certainty.hashCode());
|
|
||||||
result = prime * result + ((id == null) ? 0 : id.hashCode());
|
result = prime * result + ((id == null) ? 0 : id.hashCode());
|
||||||
result = prime * result + ((level == null) ? 0 : level.hashCode());
|
|
||||||
result = prime * result + ((pubTime == null) ? 0 : pubTime.hashCode());
|
|
||||||
result = prime * result + ((related == null) ? 0 : related.hashCode());
|
|
||||||
result = prime * result + ((sender == null) ? 0 : sender.hashCode());
|
result = prime * result + ((sender == null) ? 0 : sender.hashCode());
|
||||||
|
result = prime * result + ((pubTime == null) ? 0 : pubTime.hashCode());
|
||||||
|
result = prime * result + ((title == null) ? 0 : title.hashCode());
|
||||||
|
result = prime * result + ((startTime == null) ? 0 : startTime.hashCode());
|
||||||
|
result = prime * result + ((endTime == null) ? 0 : endTime.hashCode());
|
||||||
|
result = prime * result + ((status == null) ? 0 : status.hashCode());
|
||||||
|
result = prime * result + ((level == null) ? 0 : level.hashCode());
|
||||||
result = prime * result + ((severity == null) ? 0 : severity.hashCode());
|
result = prime * result + ((severity == null) ? 0 : severity.hashCode());
|
||||||
result = prime * result + ((severityColor == null) ? 0 : severityColor.hashCode());
|
result = prime * result + ((severityColor == null) ? 0 : severityColor.hashCode());
|
||||||
result = prime * result + ((status == null) ? 0 : status.hashCode());
|
|
||||||
result = prime * result + ((text == null) ? 0 : text.hashCode());
|
|
||||||
result = prime * result + ((title == null) ? 0 : title.hashCode());
|
|
||||||
result = prime * result + ((type == null) ? 0 : type.hashCode());
|
result = prime * result + ((type == null) ? 0 : type.hashCode());
|
||||||
result = prime * result + ((typeName == null) ? 0 : typeName.hashCode());
|
result = prime * result + ((typeName == null) ? 0 : typeName.hashCode());
|
||||||
|
result = prime * result + ((text == null) ? 0 : text.hashCode());
|
||||||
|
result = prime * result + ((related == null) ? 0 : related.hashCode());
|
||||||
result = prime * result + ((urgency == null) ? 0 : urgency.hashCode());
|
result = prime * result + ((urgency == null) ? 0 : urgency.hashCode());
|
||||||
|
result = prime * result + ((certainty == null) ? 0 : certainty.hashCode());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals( Object obj )
|
||||||
if (this == obj)
|
{
|
||||||
|
if ( this == obj)
|
||||||
return true;
|
return true;
|
||||||
if (obj == null)
|
if ( obj == null)
|
||||||
return false;
|
return false;
|
||||||
if (getClass() != obj.getClass())
|
if ( getClass() != obj.getClass())
|
||||||
return false;
|
return false;
|
||||||
QWeatherDisasterWarningItem other = (QWeatherDisasterWarningItem) obj;
|
QWeatherDisasterWarningItem other = (QWeatherDisasterWarningItem) obj;
|
||||||
if (certainty == null) {
|
if ( id == null)
|
||||||
if (other.certainty != null)
|
{
|
||||||
|
if ( other.id != null)
|
||||||
return false;
|
return false;
|
||||||
} else if (!certainty.equals(other.certainty))
|
} else if ( !id.equals( other.id ))
|
||||||
return false;
|
return false;
|
||||||
if (id == null) {
|
if ( sender == null)
|
||||||
if (other.id != null)
|
{
|
||||||
|
if ( other.sender != null)
|
||||||
return false;
|
return false;
|
||||||
} else if (!id.equals(other.id))
|
} else if ( !sender.equals( other.sender ))
|
||||||
return false;
|
return false;
|
||||||
if (level == null) {
|
if ( pubTime == null)
|
||||||
if (other.level != null)
|
{
|
||||||
|
if ( other.pubTime != null)
|
||||||
return false;
|
return false;
|
||||||
} else if (!level.equals(other.level))
|
} else if ( !pubTime.equals( other.pubTime ))
|
||||||
return false;
|
return false;
|
||||||
if (pubTime == null) {
|
if ( title == null)
|
||||||
if (other.pubTime != null)
|
{
|
||||||
|
if ( other.title != null)
|
||||||
return false;
|
return false;
|
||||||
} else if (!pubTime.equals(other.pubTime))
|
} else if ( !title.equals( other.title ))
|
||||||
return false;
|
return false;
|
||||||
if (related == null) {
|
if ( startTime == null)
|
||||||
if (other.related != null)
|
{
|
||||||
|
if ( other.startTime != null)
|
||||||
return false;
|
return false;
|
||||||
} else if (!related.equals(other.related))
|
} else if ( !startTime.equals( other.startTime ))
|
||||||
return false;
|
return false;
|
||||||
if (sender == null) {
|
if ( endTime == null)
|
||||||
if (other.sender != null)
|
{
|
||||||
|
if ( other.endTime != null)
|
||||||
return false;
|
return false;
|
||||||
} else if (!sender.equals(other.sender))
|
} else if ( !endTime.equals( other.endTime ))
|
||||||
return false;
|
return false;
|
||||||
if (severity == null) {
|
if ( status == null)
|
||||||
if (other.severity != null)
|
{
|
||||||
|
if ( other.status != null)
|
||||||
return false;
|
return false;
|
||||||
} else if (!severity.equals(other.severity))
|
} else if ( !status.equals( other.status ))
|
||||||
return false;
|
return false;
|
||||||
if (severityColor == null) {
|
if ( level == null)
|
||||||
if (other.severityColor != null)
|
{
|
||||||
|
if ( other.level != null)
|
||||||
return false;
|
return false;
|
||||||
} else if (!severityColor.equals(other.severityColor))
|
} else if ( !level.equals( other.level ))
|
||||||
return false;
|
return false;
|
||||||
if (status == null) {
|
if ( severity == null)
|
||||||
if (other.status != null)
|
{
|
||||||
|
if ( other.severity != null)
|
||||||
return false;
|
return false;
|
||||||
} else if (!status.equals(other.status))
|
} else if ( !severity.equals( other.severity ))
|
||||||
return false;
|
return false;
|
||||||
if (text == null) {
|
if ( severityColor == null)
|
||||||
if (other.text != null)
|
{
|
||||||
|
if ( other.severityColor != null)
|
||||||
return false;
|
return false;
|
||||||
} else if (!text.equals(other.text))
|
} else if ( !severityColor.equals( other.severityColor ))
|
||||||
return false;
|
return false;
|
||||||
if (title == null) {
|
if ( type == null)
|
||||||
if (other.title != null)
|
{
|
||||||
|
if ( other.type != null)
|
||||||
return false;
|
return false;
|
||||||
} else if (!title.equals(other.title))
|
} else if ( !type.equals( other.type ))
|
||||||
return false;
|
return false;
|
||||||
if (type == null) {
|
if ( typeName == null)
|
||||||
if (other.type != null)
|
{
|
||||||
|
if ( other.typeName != null)
|
||||||
return false;
|
return false;
|
||||||
} else if (!type.equals(other.type))
|
} else if ( !typeName.equals( other.typeName ))
|
||||||
return false;
|
return false;
|
||||||
if (typeName == null) {
|
if ( text == null)
|
||||||
if (other.typeName != null)
|
{
|
||||||
|
if ( other.text != null)
|
||||||
return false;
|
return false;
|
||||||
} else if (!typeName.equals(other.typeName))
|
} else if ( !text.equals( other.text ))
|
||||||
return false;
|
return false;
|
||||||
if (urgency == null) {
|
if ( related == null)
|
||||||
if (other.urgency != null)
|
{
|
||||||
|
if ( other.related != null)
|
||||||
return false;
|
return false;
|
||||||
} else if (!urgency.equals(other.urgency))
|
} else if ( !related.equals( other.related ))
|
||||||
|
return false;
|
||||||
|
if ( urgency == null)
|
||||||
|
{
|
||||||
|
if ( other.urgency != null)
|
||||||
|
return false;
|
||||||
|
} else if ( !urgency.equals( other.urgency ))
|
||||||
|
return false;
|
||||||
|
if ( certainty == null)
|
||||||
|
{
|
||||||
|
if ( other.certainty != null)
|
||||||
|
return false;
|
||||||
|
} else if ( !certainty.equals( other.certainty ))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
@JsonProperty( "id")
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(String id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSender() {
|
|
||||||
return sender;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSender(String sender) {
|
|
||||||
this.sender = sender;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getPubTime() {
|
|
||||||
return pubTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPubTime(Date pubTime) {
|
|
||||||
this.pubTime = pubTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTitle(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus(String status) {
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLevel() {
|
|
||||||
return level;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLevel(String level) {
|
|
||||||
this.level = level;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSeverity() {
|
|
||||||
return severity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSeverity(String severity) {
|
|
||||||
this.severity = severity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSeverityColor() {
|
|
||||||
return severityColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSeverityColor(String severityColor) {
|
|
||||||
this.severityColor = severityColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setType(String type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTypeName() {
|
|
||||||
return typeName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTypeName(String typeName) {
|
|
||||||
this.typeName = typeName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getText() {
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setText(String text) {
|
|
||||||
this.text = text;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRelated() {
|
|
||||||
return related;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRelated(String related) {
|
|
||||||
this.related = related;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUrgency() {
|
|
||||||
return urgency;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUrgency(String urgency) {
|
|
||||||
this.urgency = urgency;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCertainty() {
|
|
||||||
return certainty;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCertainty(String certainty) {
|
|
||||||
this.certainty = certainty;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
|
@JsonProperty( "sender")
|
||||||
private String sender;
|
private String sender;
|
||||||
|
|
||||||
@JsonProperty("pubTime")
|
@JsonProperty( "pubTime")
|
||||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd\'T\'HH:mmXXX")
|
@JsonFormat( shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd\'T\'HH:mmXXX")
|
||||||
private Date pubTime;
|
private Date pubTime;
|
||||||
|
|
||||||
|
@JsonProperty( "title")
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
|
@JsonProperty( "startTime")
|
||||||
|
@JsonFormat( shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd\'T\'HH:mmXXX")
|
||||||
|
private Date startTime;
|
||||||
|
|
||||||
|
@JsonProperty( "endTime")
|
||||||
|
@JsonFormat( shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd\'T\'HH:mmXXX")
|
||||||
|
private Date endTime;
|
||||||
|
|
||||||
|
@JsonProperty( "status")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
|
@JsonProperty( "level")
|
||||||
private String level;
|
private String level;
|
||||||
|
|
||||||
|
@JsonProperty( "severity")
|
||||||
private String severity;
|
private String severity;
|
||||||
|
|
||||||
|
@JsonProperty( "severityColor")
|
||||||
private String severityColor;
|
private String severityColor;
|
||||||
|
|
||||||
|
@JsonProperty( "type")
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
|
@JsonProperty( "typeName")
|
||||||
private String typeName;
|
private String typeName;
|
||||||
|
|
||||||
|
@JsonProperty( "text")
|
||||||
private String text;
|
private String text;
|
||||||
|
|
||||||
|
@JsonProperty( "related")
|
||||||
private String related;
|
private String related;
|
||||||
|
|
||||||
|
@JsonProperty( "urgency")
|
||||||
private String urgency;
|
private String urgency;
|
||||||
|
|
||||||
|
@JsonProperty( "certainty")
|
||||||
private String certainty;
|
private String certainty;
|
||||||
}
|
}
|
||||||
|
@ -4,17 +4,18 @@
|
|||||||
*/
|
*/
|
||||||
package com.cpic.xim.notify.disaster;
|
package com.cpic.xim.notify.disaster;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import java.io.BufferedReader;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.BufferedReader;
|
|
||||||
|
|
||||||
import java.net.MalformedURLException;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.InetSocketAddress;
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.Proxy;
|
||||||
|
import java.net.URL;
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
import com.cpic.xim.config.ProxySetting;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -23,45 +24,58 @@ public class WeatherDisasterWarningGrabber
|
|||||||
{
|
{
|
||||||
/***
|
/***
|
||||||
* 从和风天气获取天气警报json字符串
|
* 从和风天气获取天气警报json字符串
|
||||||
|
*
|
||||||
* @param cityCode 城市或区域代码
|
* @param cityCode 城市或区域代码
|
||||||
* @return 返回警报的json字符串
|
* @return 返回警报的json字符串
|
||||||
*/
|
*/
|
||||||
public static String getWeatherDisasterWarningJSON( String queryURL,
|
public static String getWeatherDisasterWarningJSON( String queryURL, String userKey,
|
||||||
String userKey,
|
String cityCode, ProxySetting proxySetting )
|
||||||
String cityCode )
|
|
||||||
{
|
{
|
||||||
//拼接url字符串
|
// 拼接url字符串
|
||||||
String json = "";
|
String json = "";
|
||||||
String requestURL = queryURL + "key=" + userKey + "&location=" + cityCode;
|
String requestURL = queryURL + "key=" + userKey + "&location=" + cityCode;
|
||||||
|
|
||||||
//链接用
|
// 链接用
|
||||||
HttpURLConnection connection = null;
|
HttpURLConnection connection = null;
|
||||||
URL url = null;
|
URL url = null;
|
||||||
InputStream inputStream = null;
|
InputStream inputStream = null;
|
||||||
BufferedReader bufferedReader = null;
|
BufferedReader bufferedReader = null;
|
||||||
StringBuilder buffer = new StringBuilder();
|
StringBuilder buffer = new StringBuilder();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
url = new URL( requestURL );
|
url = new URL( requestURL );
|
||||||
connection = (HttpURLConnection) url.openConnection();
|
|
||||||
|
// 是否要用代理服务器
|
||||||
|
if ( proxySetting.isEnable())
|
||||||
|
{
|
||||||
|
InetSocketAddress proxyAddress = new InetSocketAddress(
|
||||||
|
proxySetting.getProxyAddress(), proxySetting.getProxyPort() );
|
||||||
|
Proxy proxy = new Proxy( Proxy.Type.HTTP, proxyAddress );
|
||||||
|
|
||||||
|
connection = (HttpURLConnection) url.openConnection( proxy );
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
connection = (HttpURLConnection) url.openConnection();
|
||||||
|
}
|
||||||
|
|
||||||
connection.setRequestMethod( "GET" );
|
connection.setRequestMethod( "GET" );
|
||||||
connection.setConnectTimeout( 15000 );
|
connection.setConnectTimeout( 15000 );
|
||||||
connection.setReadTimeout( 60000 );
|
connection.setReadTimeout( 60000 );
|
||||||
connection.connect();
|
connection.connect();
|
||||||
|
|
||||||
//如果responseCode为200,说明访问成功!
|
// 如果responseCode为200,说明访问成功!
|
||||||
if ( connection.getResponseCode() == 200 )
|
if ( connection.getResponseCode() == 200)
|
||||||
{
|
{
|
||||||
//注意,和风使用了gzip压缩响应体
|
// 注意,和风使用了gzip压缩响应体
|
||||||
inputStream = new GZIPInputStream( connection.getInputStream() );
|
inputStream = new GZIPInputStream( connection.getInputStream() );
|
||||||
bufferedReader = new BufferedReader( new InputStreamReader( inputStream, "UTF-8" ) );
|
bufferedReader =
|
||||||
|
new BufferedReader( new InputStreamReader( inputStream, "UTF-8" ) );
|
||||||
|
|
||||||
//读出数据
|
// 读出数据
|
||||||
String temp = bufferedReader.readLine();
|
String temp = bufferedReader.readLine();
|
||||||
|
|
||||||
while ( temp != null )
|
while (temp != null)
|
||||||
{
|
{
|
||||||
buffer.append( temp );
|
buffer.append( temp );
|
||||||
|
|
||||||
@ -81,7 +95,7 @@ public class WeatherDisasterWarningGrabber
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if ( bufferedReader != null )
|
if ( bufferedReader != null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -93,7 +107,7 @@ public class WeatherDisasterWarningGrabber
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( inputStream != null )
|
if ( inputStream != null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -105,7 +119,7 @@ public class WeatherDisasterWarningGrabber
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( connection != null )
|
if ( connection != null)
|
||||||
{
|
{
|
||||||
connection.disconnect();
|
connection.disconnect();
|
||||||
}
|
}
|
||||||
@ -116,8 +130,9 @@ public class WeatherDisasterWarningGrabber
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 将天气警告的json字符串转换成java对象。
|
* 将天气警告的json字符串转换成java对象。
|
||||||
|
*
|
||||||
* @param json json字符串
|
* @param json json字符串
|
||||||
* @return 返回 QWeatherDisasterWarning 对象。
|
* @return 返回 QWeatherDisasterWarning 对象。
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public static QWeatherDisasterWarning convertWeatherDisasterWarning( String json )
|
public static QWeatherDisasterWarning convertWeatherDisasterWarning( String json )
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* @Author: Kane
|
* @Author: Kane
|
||||||
* @Date: 2022-04-22 10:53:49
|
* @Date: 2022-04-22 10:53:49
|
||||||
* @LastEditors: Kane
|
* @LastEditors: Kane
|
||||||
* @LastEditTime: 2022-05-12 09:51:13
|
* @LastEditTime: 2022-12-16 15:51:36
|
||||||
* @FilePath: \DisasterWarning\src\main\java\com\cpic\xim\wechat\officalAccount\sendMessage.java
|
* @FilePath: \DisasterWarning\src\main\java\com\cpic\xim\wechat\officalAccount\sendMessage.java
|
||||||
* @Description: 用来推送公众号消息的程序库。
|
* @Description: 用来推送公众号消息的程序库。
|
||||||
*
|
*
|
||||||
@ -37,15 +37,15 @@ public class sendMessage
|
|||||||
{
|
{
|
||||||
private static HashMap<String, String> warningLevel;
|
private static HashMap<String, String> warningLevel;
|
||||||
|
|
||||||
/**
|
/*****************************************************
|
||||||
* 推送天气灾害预警!接口文档参考 彭奕洁 编写《消息发送接口调用文档》
|
* 推送天气灾害预警!接口文档参考 彭奕洁 编写《消息发送接口调用文档》
|
||||||
* 使用 post 方式,请求体内容以最基础的 post 格式。
|
* 使用 post 方式,请求体内容以最基础的 post 格式。
|
||||||
*
|
*
|
||||||
* @param officalAccountURL 产险厦门分公司公众号接口网址
|
* @param officalAccountURL 产险厦门分公司公众号接口网址
|
||||||
* @param warningItem 灾害预警对象
|
* @param warningItem 灾害预警对象
|
||||||
*/
|
*****************************************************/
|
||||||
public static void sendWeatherDisasterWarning( String officalAccountURL,
|
public static void sendWeatherDisasterWarning( String officalAccountURL,
|
||||||
QWeatherDisasterWarningItem warningItem )
|
QWeatherDisasterWarningItem warningItem )
|
||||||
{
|
{
|
||||||
// Vector<QWeatherDisasterWarningItem> warningItems = warningItem.getWarning();
|
// Vector<QWeatherDisasterWarningItem> warningItems = warningItem.getWarning();
|
||||||
StringBuilder requestBody = null;
|
StringBuilder requestBody = null;
|
||||||
@ -61,7 +61,7 @@ public class sendMessage
|
|||||||
|
|
||||||
// 拼接消息内容
|
// 拼接消息内容
|
||||||
String title = warningItem.getTitle();
|
String title = warningItem.getTitle();
|
||||||
String text = warningItem.getText();
|
String text = warningItem.getText();
|
||||||
String color = warningLevel.containsKey( warningItem.getLevel() )
|
String color = warningLevel.containsKey( warningItem.getLevel() )
|
||||||
? warningLevel.get( warningItem.getLevel() )
|
? warningLevel.get( warningItem.getLevel() )
|
||||||
: "#000000";
|
: "#000000";
|
||||||
@ -98,14 +98,14 @@ public class sendMessage
|
|||||||
|
|
||||||
OracleConfig dbConfig = OracleConfigManager.getOracleConfig();
|
OracleConfig dbConfig = OracleConfigManager.getOracleConfig();
|
||||||
|
|
||||||
Connection conn = null;
|
Connection conn = null;
|
||||||
PreparedStatement stmt = null;
|
PreparedStatement stmt = null;
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
|
|
||||||
String jdbcURL = dbConfig.getJdbcURL();
|
String jdbcURL = dbConfig.getJdbcURL();
|
||||||
String userName = dbConfig.getUserName();
|
String userName = dbConfig.getUserName();
|
||||||
String password = dbConfig.getPassword();
|
String password = dbConfig.getPassword();
|
||||||
String sql = "select count(*) from weather_disaster_notify where notify_id = ?";
|
String sql = "select count(*) from weather_disaster_notify where notify_id = ?";
|
||||||
|
|
||||||
// Logger logger = Logger.getLogger( "com.cpicxim.wechat.officalAccount.sendMessage" );
|
// Logger logger = Logger.getLogger( "com.cpicxim.wechat.officalAccount.sendMessage" );
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ public class sendMessage
|
|||||||
|
|
||||||
rs = stmt.executeQuery();
|
rs = stmt.executeQuery();
|
||||||
|
|
||||||
if ( rs.next() && rs.getInt( 1 ) == 0 )
|
if ( rs.next() && rs.getInt( 1 ) == 0)
|
||||||
{
|
{
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
@ -128,7 +128,7 @@ public class sendMessage
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if ( rs != null )
|
if ( rs != null)
|
||||||
{
|
{
|
||||||
rs.close();
|
rs.close();
|
||||||
}
|
}
|
||||||
@ -140,7 +140,7 @@ public class sendMessage
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if ( stmt != null )
|
if ( stmt != null)
|
||||||
{
|
{
|
||||||
stmt.close();
|
stmt.close();
|
||||||
}
|
}
|
||||||
@ -152,7 +152,7 @@ public class sendMessage
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if ( conn != null )
|
if ( conn != null)
|
||||||
{
|
{
|
||||||
conn.close();
|
conn.close();
|
||||||
}
|
}
|
||||||
@ -178,20 +178,20 @@ public class sendMessage
|
|||||||
* @throws ClassNotFoundException 加载oracle jdbc驱动时可能抛出的异常。
|
* @throws ClassNotFoundException 加载oracle jdbc驱动时可能抛出的异常。
|
||||||
*/
|
*/
|
||||||
public static void saveWeatherDisasterWarning( String city,
|
public static void saveWeatherDisasterWarning( String city,
|
||||||
QWeatherDisasterWarningItem warning )
|
QWeatherDisasterWarningItem warning )
|
||||||
throws SQLException, IOException, ClassNotFoundException
|
throws SQLException, IOException, ClassNotFoundException
|
||||||
{
|
{
|
||||||
Connection conn = null;
|
Connection conn = null;
|
||||||
PreparedStatement stmt = null;
|
PreparedStatement stmt = null;
|
||||||
|
|
||||||
String sql = new StringBuilder().append( "insert into weather_disaster_notify(notify_id, sender, city," )
|
String sql = new StringBuilder()
|
||||||
.append( "warning_level, warning_type_code, warning_type_name, title," )
|
.append( "insert into weather_disaster_notify(notify_id, sender, city," )
|
||||||
.append( "text, pub_time) values( ?,?,?,?,?,?,?,?,?)" )
|
.append( "warning_level, warning_type_code, warning_type_name, title," )
|
||||||
.toString();
|
.append( "text, pub_time) values( ?,?,?,?,?,?,?,?,?)" ).toString();
|
||||||
|
|
||||||
OracleConfig dbConfig = OracleConfigManager.getOracleConfig();
|
OracleConfig dbConfig = OracleConfigManager.getOracleConfig();
|
||||||
|
|
||||||
String jdbcURL = dbConfig.getJdbcURL();
|
String jdbcURL = dbConfig.getJdbcURL();
|
||||||
String userName = dbConfig.getUserName();
|
String userName = dbConfig.getUserName();
|
||||||
String password = dbConfig.getPassword();
|
String password = dbConfig.getPassword();
|
||||||
|
|
||||||
@ -224,7 +224,7 @@ public class sendMessage
|
|||||||
catch ( SQLException error )
|
catch ( SQLException error )
|
||||||
{
|
{
|
||||||
// 出现sql错误,就回滚!
|
// 出现sql错误,就回滚!
|
||||||
if ( conn != null )
|
if ( conn != null)
|
||||||
{
|
{
|
||||||
conn.rollback();
|
conn.rollback();
|
||||||
}
|
}
|
||||||
@ -235,7 +235,7 @@ public class sendMessage
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if ( stmt != null )
|
if ( stmt != null)
|
||||||
{
|
{
|
||||||
stmt.close();
|
stmt.close();
|
||||||
}
|
}
|
||||||
@ -247,7 +247,7 @@ public class sendMessage
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if ( conn != null )
|
if ( conn != null)
|
||||||
{
|
{
|
||||||
conn.close();
|
conn.close();
|
||||||
}
|
}
|
||||||
@ -271,49 +271,50 @@ public class sendMessage
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class WechatOfficalAccountMessageParameter
|
class WechatOfficalAccountMessageParameter
|
||||||
{
|
{
|
||||||
|
|
||||||
WechatOfficalAccountMessageParameter()
|
WechatOfficalAccountMessageParameter()
|
||||||
{
|
{
|
||||||
tplID = 57;
|
tplID = 57;
|
||||||
groupID = 1;
|
groupID = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonProperty("tplid")
|
@JsonProperty( "tplid")
|
||||||
private int tplID;
|
private int tplID;
|
||||||
|
|
||||||
@JsonProperty("groupid")
|
@JsonProperty( "groupid")
|
||||||
private int groupID;
|
private int groupID;
|
||||||
|
|
||||||
@JsonProperty("first")
|
@JsonProperty( "first")
|
||||||
private String first;
|
private String first;
|
||||||
|
|
||||||
@JsonProperty("keyword1")
|
@JsonProperty( "keyword1")
|
||||||
private String keyword1;
|
private String keyword1;
|
||||||
|
|
||||||
@JsonProperty("keyword1color")
|
@JsonProperty( "keyword1color")
|
||||||
private String keyword1Color;
|
private String keyword1Color;
|
||||||
|
|
||||||
@JsonProperty("keyword2")
|
@JsonProperty( "keyword2")
|
||||||
private String keyword2;
|
private String keyword2;
|
||||||
|
|
||||||
@JsonProperty("keyword2color")
|
@JsonProperty( "keyword2color")
|
||||||
private String keyword2Color;
|
private String keyword2Color;
|
||||||
|
|
||||||
@JsonProperty("remark")
|
@JsonProperty( "remark")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
@JsonProperty("remarkcolor")
|
@JsonProperty( "remarkcolor")
|
||||||
private String remarkColor;
|
private String remarkColor;
|
||||||
|
|
||||||
@JsonProperty("url")
|
@JsonProperty( "url")
|
||||||
private String url;
|
private String url;
|
||||||
|
|
||||||
@JsonProperty("appid")
|
@JsonProperty( "appid")
|
||||||
private String appid;
|
private String appid;
|
||||||
|
|
||||||
@JsonProperty("pagepath")
|
@JsonProperty( "pagepath")
|
||||||
private String pagePath;
|
private String pagePath;
|
||||||
|
|
||||||
public int getTplID()
|
public int getTplID()
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
* @Author: Kane
|
* @Author: Kane
|
||||||
* @Date: 2022-04-22 10:53:49
|
* @Date: 2022-04-22 10:53:49
|
||||||
* @LastEditors: Kane
|
* @LastEditors: Kane
|
||||||
* @LastEditTime: 2022-05-12 09:54:36
|
* @LastEditTime: 2023-05-15 21:03:21
|
||||||
* @FilePath: \DisasterWarning\src\test\java\com\cpic\xim\wechat\officalAccount\sendMessageTest.java
|
* @FilePath: /DisasterWarning/src/test/java/com/cpic/xim/wechat/officalAccount/sendMessageTest.java
|
||||||
* @Description:
|
* @Description:
|
||||||
*
|
*
|
||||||
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||||||
@ -17,7 +17,7 @@ import com.cpic.xim.httpUtil.*;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import org.junit.Test;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
public class sendMessageTest
|
public class sendMessageTest
|
||||||
@ -25,7 +25,7 @@ public class sendMessageTest
|
|||||||
private static String url =
|
private static String url =
|
||||||
"https://cxxmwx.cpic.com.cn/app/index.php?i=2&c=entry&do=send_group_tpl_api&m=ok_tplmessage";
|
"https://cxxmwx.cpic.com.cn/app/index.php?i=2&c=entry&do=send_group_tpl_api&m=ok_tplmessage";
|
||||||
|
|
||||||
// @Test
|
@Test
|
||||||
public void postNotifyMessageJson()
|
public void postNotifyMessageJson()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -83,7 +83,7 @@ public class sendMessageTest
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Test
|
@Test
|
||||||
public void testCheckWarningHasSended()
|
public void testCheckWarningHasSended()
|
||||||
{
|
{
|
||||||
String warningID = "10123060820220422061200476313081";
|
String warningID = "10123060820220422061200476313081";
|
||||||
|
26
数据/和风天气/看格式用.json
Normal file
26
数据/和风天气/看格式用.json
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"code": "200",
|
||||||
|
"updateTime": "2022-11-04T15:18+08:00",
|
||||||
|
"fxLink": "http://hfx.link/3565",
|
||||||
|
"warning": [
|
||||||
|
{
|
||||||
|
"id": "10123020120221104060100024343791",
|
||||||
|
"sender": "厦门市气象台",
|
||||||
|
"pubTime": "2022-11-04T06:01+08:00",
|
||||||
|
"title": "厦门市气象台发布大风黄色预警[Ⅲ级/较重]",
|
||||||
|
"startTime": "2022-11-04T06:09+08:00",
|
||||||
|
"endTime": "2022-11-05T06:09+08:00",
|
||||||
|
"status": "active",
|
||||||
|
"level": "黄色",
|
||||||
|
"severity": "Moderate",
|
||||||
|
"severityColor": "Yellow",
|
||||||
|
"type": "1006",
|
||||||
|
"typeName": "大风",
|
||||||
|
"urgency": "",
|
||||||
|
"certainty": "",
|
||||||
|
"text": "厦门市气象台2022年11月04日06时01分发布大风黄色预警信号:受冷空气影响,未来12小时思明区、湖里区、集美区、海沧区及海上风力逐渐增强,预计厦门市区东北风最大可达5~6级、阵风7~8级;厦门内海及各大桥、高海拔山区最大可达6~7级、阵风8~9级;崇武到东山沿海最大可达7~8级、阵风9级;台湾海峡南部最大可达7~8级、阵风9~10级。请注意防范。同安区、翔安区请关注属地的预警信号发布情况。",
|
||||||
|
"related": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"refer": { "sources": ["12379"], "license": ["no commercial use"] }
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user