完成判断消息是否已发送功能!
This commit is contained in:
parent
0587001de0
commit
5da53f02ea
@ -2,8 +2,8 @@
|
||||
"tns_name": "xmcx1",
|
||||
"ip_addr": "10.39.0.86",
|
||||
"jdbc_url": "",
|
||||
"user_name": "xim_offical_account",
|
||||
"password": "Cpic#1234",
|
||||
"user_name": "wechat",
|
||||
"password": "@rn7Q+t5zeyKIZ~s",
|
||||
"tables": [
|
||||
{
|
||||
"table_name": "",
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @Author: Kane
|
||||
* @Date: 2022-04-22 10:53:49
|
||||
* @LastEditors: Kane
|
||||
* @LastEditTime: 2022-04-25 19:20:32
|
||||
* @LastEditTime: 2022-04-27 16:09:17
|
||||
* @FilePath: \DisasterWarning\src\main\java\com\cpic\xim\wechat\officalAccount\sendMessage.java
|
||||
* @Description: 用来推送公众号消息的程序库。
|
||||
*
|
||||
@ -16,7 +16,13 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Vector;
|
||||
import java.util.logging.*;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import com.cpic.xim.notify.disaster.*;
|
||||
import com.cpic.xim.httpUtil.HttpUtils;
|
||||
|
||||
@ -80,11 +86,55 @@ public class sendMessage
|
||||
* @param warningID
|
||||
* @return
|
||||
*/
|
||||
private boolean checkWarningHasSended( String warningID )
|
||||
public boolean checkWarningHasSended( String warningID )
|
||||
throws ClassNotFoundException, SQLException
|
||||
{
|
||||
boolean result = false;
|
||||
|
||||
// 暂时写死,以后改成读取配置方式
|
||||
String jdbcURL = "jdbc:oracle:thin@10.39.0.86:1521:wechat";
|
||||
String userName = "wechat";
|
||||
String password = "@rn7Q+t5zeyKIZ~s";
|
||||
String sql = "select count(*) from weather_disaster_notify where notify_id = ?";
|
||||
|
||||
Connection conn = null;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
|
||||
// Logger logger = Logger.getLogger( "com.cpicxim.wechat.officalAccount.sendMessage" );
|
||||
|
||||
try
|
||||
{
|
||||
Class.forName( "oracle.jdbc.driver.OracleDriver" );
|
||||
|
||||
conn = DriverManager.getConnection( jdbcURL, userName, password );
|
||||
stmt = conn.prepareStatement( sql );
|
||||
stmt.setString( 1, warningID );
|
||||
|
||||
rs = stmt.executeQuery( sql );
|
||||
|
||||
if ( rs.next() && rs.getInt( 0 ) == 0)
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if ( rs != null)
|
||||
{
|
||||
rs.close();
|
||||
}
|
||||
|
||||
if ( stmt != null)
|
||||
{
|
||||
stmt.close();
|
||||
}
|
||||
|
||||
if ( conn != null)
|
||||
{
|
||||
conn.close();
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user