Compare commits
No commits in common. "cd8bcb8ba010021bdb110dc6c7f21910a25ed296" and "b993638e5bd8e9c4d81d5383e304f27aff02a580" have entirely different histories.
cd8bcb8ba0
...
b993638e5b
|
@ -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:52:45
|
* @LastEditTime: 2022-05-10 19:03:56
|
||||||
* @FilePath: \DisasterWarning\src\main\java\AppMain.java
|
* @FilePath: \DisasterWarning\src\main\java\AppMain.java
|
||||||
* @Description: 和风天气预警推送厦门太保公众号主程序!
|
* @Description: 和风天气预警推送厦门太保公众号主程序!
|
||||||
*
|
*
|
||||||
|
@ -111,10 +111,10 @@ public class AppMain
|
||||||
|
|
||||||
logger.log( Level.INFO, "{0}天气预警,日志发送成功。", new Object[]
|
logger.log( Level.INFO, "{0}天气预警,日志发送成功。", new Object[]
|
||||||
{ city.getCityName()} );
|
{ city.getCityName()} );
|
||||||
|
|
||||||
// 将发送的警报,保存起来
|
|
||||||
sendMessage.saveWeatherDisasterWarning( city.getCityName(), item );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 将发送的警报,保存起来
|
||||||
|
sendMessage.saveWeatherDisasterWarning( city.getCityName(), warning );
|
||||||
}
|
}
|
||||||
catch ( IOException error )
|
catch ( IOException error )
|
||||||
{
|
{
|
||||||
|
|
|
@ -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-05-10 19:02:32
|
||||||
* @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: 用来推送公众号消息的程序库。
|
||||||
*
|
*
|
||||||
|
@ -178,8 +178,7 @@ public class sendMessage
|
||||||
* @throws IOException 读取数据库配置文件时可能抛出的异常。
|
* @throws IOException 读取数据库配置文件时可能抛出的异常。
|
||||||
* @throws ClassNotFoundException 加载oracle jdbc驱动时可能抛出的异常。
|
* @throws ClassNotFoundException 加载oracle jdbc驱动时可能抛出的异常。
|
||||||
*/
|
*/
|
||||||
public static void saveWeatherDisasterWarning( String city,
|
public static void saveWeatherDisasterWarning( String city, QWeatherDisasterWarning warnings )
|
||||||
QWeatherDisasterWarningItem warning )
|
|
||||||
throws SQLException, IOException, ClassNotFoundException
|
throws SQLException, IOException, ClassNotFoundException
|
||||||
{
|
{
|
||||||
Connection conn = null;
|
Connection conn = null;
|
||||||
|
@ -204,19 +203,23 @@ public class sendMessage
|
||||||
|
|
||||||
conn.setAutoCommit( false );
|
conn.setAutoCommit( false );
|
||||||
|
|
||||||
java.sql.Timestamp pubTime = new java.sql.Timestamp( warning.getPubTime().getTime() );
|
for ( QWeatherDisasterWarningItem warning : warnings.getWarning() )
|
||||||
|
{
|
||||||
|
java.sql.Timestamp pubTime =
|
||||||
|
new java.sql.Timestamp( warning.getPubTime().getTime() );
|
||||||
|
|
||||||
stmt.setString( 1, warning.getId() );
|
stmt.setString( 1, warning.getId() );
|
||||||
stmt.setString( 2, warning.getSender() );
|
stmt.setString( 2, warning.getSender() );
|
||||||
stmt.setString( 3, city );
|
stmt.setString( 3, city );
|
||||||
stmt.setString( 4, warning.getLevel() );
|
stmt.setString( 4, warning.getLevel() );
|
||||||
stmt.setString( 5, warning.getType() );
|
stmt.setString( 5, warning.getType() );
|
||||||
stmt.setString( 6, warning.getTypeName() );
|
stmt.setString( 6, warning.getTypeName() );
|
||||||
stmt.setString( 7, warning.getTitle() );
|
stmt.setString( 7, warning.getTitle() );
|
||||||
stmt.setString( 8, warning.getText() );
|
stmt.setString( 8, warning.getText() );
|
||||||
stmt.setTimestamp( 9, pubTime );
|
stmt.setTimestamp( 9, pubTime );
|
||||||
|
|
||||||
stmt.execute();
|
stmt.execute();
|
||||||
|
}
|
||||||
|
|
||||||
// 没有问题就提交
|
// 没有问题就提交
|
||||||
conn.commit();
|
conn.commit();
|
||||||
|
|
|
@ -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:54:36
|
* @LastEditTime: 2022-05-10 11:33:41
|
||||||
* @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:
|
||||||
*
|
*
|
||||||
|
@ -75,7 +75,7 @@ public class sendMessageTest
|
||||||
String city = "东山县";
|
String city = "东山县";
|
||||||
|
|
||||||
|
|
||||||
// sendMessage.saveWeatherDisasterWarning( city, warning );
|
sendMessage.saveWeatherDisasterWarning( city, warning );
|
||||||
}
|
}
|
||||||
catch ( Exception error )
|
catch ( Exception error )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
java -jar disaster_warning-1.0-SNAPSHOT-jar-with-dependencies.jar
|
|
||||||
pause
|
|
Loading…
Reference in New Issue