| | |
| | | }
|
| | | return ukeyID;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 查询电源实时状态
|
| | | * @param pool
|
| | | * @param param
|
| | | */
|
| | | public static void queryPwrdev_Acdcdata_Table(MysqlConnPool pool, FBS9100_StatAndParam param) {
|
| | | String sql_str = "SELECT is_acIn1_powerdown,is_acIn2_powerdown,PowerDeviceId FROM " + Sql_Mysql.Pwrdev_Acdcdata_Table + " WHERE PowerDeviceId = " + param.PowerDeviceId + " LIMIT 1";
|
| | | Sql_Mysql sql = new Sql_Mysql(pool);
|
| | | ResultSet res = null;
|
| | | try {
|
| | | res = sql.sqlMysqlQuery(sql_str);
|
| | | if(res.next()) {
|
| | | boolean powerdown1 = res.getBoolean("is_acIn1_powerdown");
|
| | | boolean powerdown2 = res.getBoolean("is_acIn2_powerdown");
|
| | | if(powerdown1 || powerdown2) {
|
| | | param.setPowerDown(true);
|
| | | }else {
|
| | | param.setPowerDown(false);
|
| | | }
|
| | | }
|
| | | } catch (SQLException e) {
|
| | | e.printStackTrace();
|
| | | } finally {
|
| | | if(null != res) {
|
| | | try {
|
| | | res.close();
|
| | | } catch (SQLException e) {
|
| | | sql.logger.error("BTS61850_Task_Thread_SQL.queryPowerDataInf():" + e.toString(), e); |
| | | }
|
| | | }
|
| | | sql.close_con();
|
| | | }
|
| | | }
|
| | | |
| | | /**
|
| | | * 查询电源信息
|
| | | * @param pool
|
| | | * @param param
|
| | | */
|
| | | public static void queryPowerDataInf(MysqlConnPool pool, FBS9100_StatAndParam param) {
|
| | | String sql_str = "SELECT PowerDeviceId FROM " + Sql_Mysql.Pwrdev_Inf_Table + " WHERE StationId = " + param.StationId + " LIMIT 1";
|
| | | Sql_Mysql sql = new Sql_Mysql(pool);
|
| | | ResultSet res = null;
|
| | | try {
|
| | | res = sql.sqlMysqlQuery(sql_str);
|
| | | if(res.next()) {
|
| | | param.PowerDeviceId = res.getInt("PowerDeviceId");
|
| | | }
|
| | | } catch (SQLException e) {
|
| | | e.printStackTrace();
|
| | | } finally {
|
| | | if(null != res) {
|
| | | try {
|
| | | res.close();
|
| | | } catch (SQLException e) {
|
| | | sql.logger.error("BTS61850_Task_Thread_SQL.queryPowerDataInf():" + e.toString(), e); |
| | | }
|
| | | }
|
| | | sql.close_con();
|
| | | }
|
| | | }
|
| | | |
| | | public static void main(String[] args) {
|
| | | MysqlConnPool pool = new MysqlConnPool("192.168.10.79", 3360, 5);
|
| | | |
| | | FBS9100_StatAndParam param = new FBS9100_StatAndParam("127.0.0.1", 618500059);
|
| | | param.StationId = "42010149";
|
| | | |
| | | queryPowerDataInf(pool, param);
|
| | | queryPwrdev_Acdcdata_Table(pool, param);
|
| | | |
| | | |
| | | System.out.println("PowerDeviceId:" + param.PowerDeviceId + " : " + param.isPowerOff);
|
| | | }
|
| | | }
|