...
This commit is contained in:
parent
0e574c7031
commit
cea1ff78f7
@ -42,6 +42,22 @@
|
|||||||
<version>2.4</version>
|
<version>2.4</version>
|
||||||
<classifier>jdk15</classifier>
|
<classifier>jdk15</classifier>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!--Jackson包-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-core</artifactId>
|
||||||
|
<version>2.9.8</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-databind</artifactId>
|
||||||
|
<version>2.9.8</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-annotations</artifactId>
|
||||||
|
<version>2.9.8</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.cpic.xim.disaster_warning;
|
||||||
|
|
||||||
|
import java.util.Vector;
|
||||||
|
|
||||||
|
public class QWeatherDisasterWarning
|
||||||
|
{
|
||||||
|
private String code;
|
||||||
|
private String updateTime;
|
||||||
|
private String flLink;
|
||||||
|
private Vector<QWeatherDisasterWarningItem> warningItems;
|
||||||
|
}
|
@ -0,0 +1,207 @@
|
|||||||
|
package com.cpic.xim.disaster_warning;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
public class QWeatherDisasterWarningItem
|
||||||
|
{
|
||||||
|
public QWeatherDisasterWarningItem( String id,
|
||||||
|
String sender,
|
||||||
|
String pubTime,
|
||||||
|
String title,
|
||||||
|
String status,
|
||||||
|
String level,
|
||||||
|
String type,
|
||||||
|
String typeName,
|
||||||
|
String text,
|
||||||
|
String related,
|
||||||
|
String urgency, String centainy )
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
this.sender = sender;
|
||||||
|
this.pubTime = pubTime;
|
||||||
|
this.title = title;
|
||||||
|
this.status = status;
|
||||||
|
this.level = level;
|
||||||
|
this.type = type;
|
||||||
|
this.typeName = typeName;
|
||||||
|
this.text = text;
|
||||||
|
this.related = related;
|
||||||
|
this.urgency = urgency;
|
||||||
|
this.centainy = centainy;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals( Object o )
|
||||||
|
{
|
||||||
|
if ( this == o )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if ( o == null || getClass() != o.getClass() )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
QWeatherDisasterWarningItem that = (QWeatherDisasterWarningItem) o;
|
||||||
|
return id.equals( that.id ) && Objects.equals( sender, that.sender ) && Objects.equals( pubTime,
|
||||||
|
that.pubTime ) && Objects.equals(
|
||||||
|
title,
|
||||||
|
that.title ) && Objects.equals( status, that.status ) && Objects.equals( level,
|
||||||
|
that.level ) && Objects.equals(
|
||||||
|
type,
|
||||||
|
that.type ) && Objects.equals( typeName, that.typeName ) && Objects.equals( text,
|
||||||
|
that.text ) && Objects.equals(
|
||||||
|
related,
|
||||||
|
that.related ) && Objects.equals( urgency, that.urgency ) && Objects.equals( centainy,
|
||||||
|
that.centainy );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode()
|
||||||
|
{
|
||||||
|
return Objects.hash( id,
|
||||||
|
sender,
|
||||||
|
pubTime,
|
||||||
|
title,
|
||||||
|
status,
|
||||||
|
level,
|
||||||
|
type,
|
||||||
|
typeName,
|
||||||
|
text,
|
||||||
|
related,
|
||||||
|
urgency,
|
||||||
|
centainy );
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId( String id )
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSender()
|
||||||
|
{
|
||||||
|
return sender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSender( String sender )
|
||||||
|
{
|
||||||
|
this.sender = sender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPubTime()
|
||||||
|
{
|
||||||
|
return pubTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPubTime( String 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 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 getCentainy()
|
||||||
|
{
|
||||||
|
return centainy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCentainy( String centainy )
|
||||||
|
{
|
||||||
|
this.centainy = centainy;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
private String sender;
|
||||||
|
private String pubTime;
|
||||||
|
private String title;
|
||||||
|
private String status;
|
||||||
|
private String level;
|
||||||
|
private String type;
|
||||||
|
private String typeName;
|
||||||
|
private String text;
|
||||||
|
private String related;
|
||||||
|
private String urgency;
|
||||||
|
private String centainy;
|
||||||
|
}
|
@ -10,11 +10,11 @@ import java.net.URL;
|
|||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
|
|
||||||
public class WeatherDisasterWarningGrabber
|
public class WeatherDisasterWarningGrabber
|
||||||
{
|
{
|
||||||
private static String QUERY_URL = "https://devapi.qweather.com/v7/warning/now?";
|
private static String QUERY_URL = "https://devapi.qweather.com/v7/warning/now?";
|
||||||
private static String USER_KEY = "fe9fa8eeeb6f4301a92541eed565dd15";
|
private static String USER_KEY = "fe9fa8eeeb6f4301a92541eed565dd15";
|
||||||
|
private static QWeatherDisasterWarningItem item = null;
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* 从和风天气获取天气警报json字符串
|
* 从和风天气获取天气警报json字符串
|
||||||
@ -105,4 +105,5 @@ public class WeatherDisasterWarningGrabber
|
|||||||
|
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user