保存进度!

This commit is contained in:
Kane Wang 2022-05-17 10:39:53 +08:00
parent 4c0cb3c76e
commit db8f9e9c05
2 changed files with 8 additions and 10 deletions

View File

@ -74,7 +74,7 @@ public class QWeatherDisasterWarning
private String code; private String code;
@JsonProperty( "updateTime") @JsonProperty( "updateTime")
@JsonFormat( pattern = "yyyy-MM-dd\'T\'HH:mmXXX") @JsonFormat( pattern = "yyyy-MM-dd'T'HH:mmXXX")
private Date updateTime; private Date updateTime;
@JsonProperty( "fxLink") @JsonProperty( "fxLink")

View File

@ -62,7 +62,7 @@ public class sendMessage
// 拼接消息内容 // 拼接消息内容
String title = warningItem.getTitle(); String title = warningItem.getTitle();
String text = warningItem.getText(); String text = warningItem.getText();
String color = warningLevel.keySet().contains( warningItem.getLevel() ) String color = warningLevel.containsKey( warningItem.getLevel() )
? warningLevel.get( warningItem.getLevel() ) ? warningLevel.get( warningItem.getLevel() )
: "#000000"; : "#000000";
requestBody = new StringBuilder(); requestBody = new StringBuilder();
@ -97,7 +97,6 @@ public class sendMessage
boolean result = false; boolean result = false;
OracleConfig dbConfig = OracleConfigManager.getOracleConfig(); OracleConfig dbConfig = OracleConfigManager.getOracleConfig();
;
Connection conn = null; Connection conn = null;
PreparedStatement stmt = null; PreparedStatement stmt = null;
@ -173,21 +172,22 @@ public class sendMessage
* 保存的数据用来判断预警是否已经推送过以防止反复推送数据 * 保存的数据用来判断预警是否已经推送过以防止反复推送数据
* *
* @param city 城市名称 * @param city 城市名称
* @param warnings 预警数据 QWeatherDisasterWarningItem 对象 * @param warning 预警数据 QWeatherDisasterWarningItem 对象
* @throws SQLException 执行sql时可能抛出的异常出现sql异常就回滚事务 * @throws SQLException 执行sql时可能抛出的异常出现sql异常就回滚事务
* @throws IOException 读取数据库配置文件时可能抛出的异常 * @throws IOException 读取数据库配置文件时可能抛出的异常
* @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 = "insert into weather_disaster_notify(notify_id, sender, city," String sql = new StringBuilder().append( "insert into weather_disaster_notify(notify_id, sender, city," )
+ "warning_level, warning_type_code, warning_type_name, title," .append( "warning_level, warning_type_code, warning_type_name, title," )
+ "text, pub_time) values( ?,?,?,?,?,?,?,?,?)"; .append( "text, pub_time) values( ?,?,?,?,?,?,?,?,?)" )
.toString();
OracleConfig dbConfig = OracleConfigManager.getOracleConfig(); OracleConfig dbConfig = OracleConfigManager.getOracleConfig();
@ -259,7 +259,6 @@ public class sendMessage
} }
} }
static static
{ {
// 预警级别色彩 // 预警级别色彩
@ -272,7 +271,6 @@ public class sendMessage
} }
} }
class WechatOfficalAccountMessageParameter class WechatOfficalAccountMessageParameter
{ {