| | |
| | | eclipse.preferences.version=1
|
| | | encoding//src/com/database_util/DB_App_Sys.java=UTF-8
|
| | | encoding//src/com/database_util/DB_Nj_Measurement.java=UTF-8
|
| | | encoding/<project>=GBK
|
| | |
| | | package com.database_util; |
| | | |
| | | import java.sql.ResultSet; |
| | | import java.sql.SQLException; |
| | | import java.util.Date; |
| | | |
| | | import com.base.Com; |
| | | import com.sql.MysqlConnPool; |
| | | import com.sql.Sql_Mysql; |
| | | |
| | | public class DB_Alarm { |
| | | |
| | | public static void init(MysqlConnPool pool, boolean recreate) { |
| | | System.out.println(" db_alarm init start at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms)); |
| | | |
| | | createDB_ALARM(pool); |
| | | |
| | | createBattalarm_Data_History_Table(pool, recreate); |
| | | |
| | | createBattalarm_Data_Table(pool, recreate); |
| | | |
| | | createBts_Station_Event_Table(pool, recreate); |
| | | |
| | | createDevalarm_Data__History_Table(pool, recreate); |
| | | |
| | | createDevalarm_Data_Table(pool, recreate); |
| | | |
| | | createTb_Alarm_Message(pool, recreate); |
| | | |
| | | createTb_Alarm_Detail_Table(pool, recreate); //创建告警详情 |
| | | |
| | | createTb_Alarm_Relation_Table(pool, recreate); //创建告警对应关系 |
| | | |
| | | createTb_Alarm_Manual_Clear_Table(pool,recreate); |
| | | |
| | | createTb_Battalarm_Data_Verify_Table(pool, recreate); //创建电池告警确认处理表 |
| | | |
| | | createTb_Devalarm_Data_Verify_Table(pool, recreate); //创建设备告警确认处理表 |
| | | |
| | | repairBattAlarmDataHistoryTable(pool); //电池告警分表新增是否紧急字段 |
| | | |
| | | repairDevAlarmDataHistoryTable(pool); //设备告警分表新增是否紧急字段 |
| | | |
| | | System.out.println(" db_alarm init end at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms)); |
| | | } |
| | | |
| | | /** |
| | | * 修复设备历史告警分表中缺少新增字段 `alm_severity`-'告警重要等级[0:重要;1:紧急]' |
| | | * @param pool |
| | | */ |
| | | private static void repairDevAlarmDataHistoryTable(MysqlConnPool pool) { |
| | | String sql_str_sel = " select TABLE_NAME,CREATE_TIME from information_schema.tables " + |
| | | " where table_schema='db_alarm' " + |
| | | " AND TABLE_NAME like 'tb_devalarm_data_history_%';"; |
| | | |
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn()); |
| | | ResultSet res1 = null; |
| | | ResultSet res2= null; |
| | | try { |
| | | res1 = sql.sqlMysqlTotalQuery(sql_str_sel); |
| | | while(res1.next()) { |
| | | String tablename = res1.getString("TABLE_NAME"); |
| | | //System.out.println("表名:"+tablename); |
| | | |
| | | res2 = null; |
| | | // //添加指定的alm_severity列'告警重要等级[0:重要;1:紧急]' |
| | | res2 = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" |
| | | + " WHERE table_schema='db_alarm'" |
| | | + " AND table_name='" + tablename + "'" |
| | | + " AND column_name='alm_severity'"); |
| | | if(false == res2.next()) { |
| | | sql.sqlMysqlTotalExecute(" ALTER TABLE db_alarm." + tablename |
| | | + " ADD COLUMN `alm_severity` int(11) NOT NULL DEFAULT '1' COMMENT '告警重要等级[0:重要;1:紧急]';"); |
| | | } |
| | | |
| | | } |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | if(null != res1) { |
| | | try { |
| | | res1.close(); |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | if(null != res2) { |
| | | try { |
| | | res1.close(); |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | sql.close_con(); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 修复电池历史告警分表中缺少新增字段 `alm_severity`-'告警重要等级[0:重要;1:紧急]' |
| | | * @param pool |
| | | */ |
| | | private static void repairBattAlarmDataHistoryTable(MysqlConnPool pool) { |
| | | String sql_str_sel = " select TABLE_NAME,CREATE_TIME from information_schema.tables " + |
| | | " where table_schema='db_alarm' " + |
| | | " AND TABLE_NAME like 'tb_battalarm_data_history_%';"; |
| | | |
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn()); |
| | | ResultSet res1 = null; |
| | | ResultSet res2= null; |
| | | try { |
| | | res1 = sql.sqlMysqlTotalQuery(sql_str_sel); |
| | | while(res1.next()) { |
| | | String tablename = res1.getString("TABLE_NAME"); |
| | | //System.out.println("表名:"+tablename); |
| | | |
| | | res2 = null; |
| | | // //添加指定的alm_severity列'告警重要等级[0:重要;1:紧急]' |
| | | res2 = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" |
| | | + " WHERE table_schema='db_alarm'" |
| | | + " AND table_name='" + tablename + "'" |
| | | + " AND column_name='alm_severity'"); |
| | | if(false == res2.next()) { |
| | | sql.sqlMysqlExecute(" ALTER TABLE db_alarm." + tablename |
| | | + " ADD COLUMN `alm_severity` int(11) NOT NULL DEFAULT '1' COMMENT '告警重要等级[0:重要;1:紧急]';"); |
| | | } |
| | | |
| | | } |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | if(null != res1) { |
| | | try { |
| | | res1.close(); |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | if(null != res2) { |
| | | try { |
| | | res1.close(); |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | sql.close_con(); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 创建 db_alarm 数据库 |
| | | * @param pool |
| | | */ |
| | | public static void createDB_ALARM(MysqlConnPool pool) { |
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn()); |
| | | try { |
| | | sql.sqlMysqlExecute("CREATE DATABASE IF NOT EXISTS " + Sql_Mysql.DB_ALARM); |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | sql.close_con(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 创建tb_devalarm_data_history表 |
| | | */ |
| | | public static void createDevalarm_Data__History_Table(MysqlConnPool pool, boolean recreate) { |
| | | String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Devalarm_Data__History_Table; |
| | | String sql_str02 = " CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Devalarm_Data__History_Table + " (" + |
| | | " num bigint(20) NOT NULL AUTO_INCREMENT," + |
| | | " record_id bigint(20) NOT NULL DEFAULT '0'," + |
| | | " dev_id int(11) NOT NULL DEFAULT '0'," + |
| | | " dev_ip varchar(24) NOT NULL DEFAULT '127.0.0.1'," + |
| | | " alm_type int(11) NOT NULL DEFAULT '0'," + |
| | | " alm_level int(11) NOT NULL DEFAULT '0'," + |
| | | " alm_start_time datetime NOT NULL DEFAULT '1982-01-01 00:00:00'," + |
| | | " alm_end_time datetime NOT NULL DEFAULT '1982-01-01 00:00:00'," + |
| | | " alm_value float NOT NULL DEFAULT '0'," + |
| | | " alm_is_confirmed tinyint(1) NOT NULL DEFAULT '0'," + |
| | | " alm_confirmed_time datetime NOT NULL DEFAULT '1982-01-01 00:00:00'," + |
| | | " alm_cleared_type int(11) NOT NULL DEFAULT '0'," + |
| | | " usr_Id int(11) NOT NULL DEFAULT '0'," + |
| | | " `alm_severity` int(11) NOT NULL DEFAULT '1' COMMENT '告警重要等级[0:重要;1:紧急]'," + |
| | | " PRIMARY KEY (num)," + |
| | | " KEY index_record_id (record_id)," + |
| | | " KEY index_dev_id (dev_id)," + |
| | | " KEY index_alm_type (alm_type)," + |
| | | " KEY index_alm_start_time (alm_start_time)," + |
| | | " KEY index_alm_cleared_type (alm_cleared_type)" + |
| | | ") ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8;"; |
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn()); |
| | | ResultSet res = null; |
| | | try { |
| | | if(true == recreate) { |
| | | sql.sqlMysqlExecute(sql_str01); |
| | | } |
| | | sql.sqlMysqlExecute(sql_str02); |
| | | |
| | | //添加指定的alm_value列'告警值' |
| | | res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" |
| | | + " WHERE table_schema='db_alarm'" |
| | | + " AND table_name='tb_devalarm_data_history'" |
| | | + " AND column_name='alm_value'"); |
| | | if(false == res.next()) { |
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Devalarm_Data__History_Table |
| | | + " ADD COLUMN alm_value float NOT NULL DEFAULT '0';"); |
| | | } |
| | | //添加指定的alm_severity列'告警重要等级[0:重要;1:紧急]' |
| | | res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" |
| | | + " WHERE table_schema='db_alarm'" |
| | | + " AND table_name='tb_devalarm_data_history'" |
| | | + " AND column_name='alm_severity'"); |
| | | if(false == res.next()) { |
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Devalarm_Data__History_Table |
| | | + " ADD COLUMN `alm_severity` int(11) NOT NULL DEFAULT '1' COMMENT '告警重要等级[0:重要;1:紧急]';"); |
| | | } |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | if(null != res) { |
| | | try { |
| | | res.close(); |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | sql.close_con(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 创建tb_devalarm_data表 |
| | | * @param pool |
| | | * @param recreate |
| | | */ |
| | | public static void createDevalarm_Data_Table(MysqlConnPool pool, boolean recreate) { |
| | | String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Devalarm_Data_Table; |
| | | String sql_str02 = " CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Devalarm_Data_Table + " (" + |
| | | " num bigint(20) NOT NULL AUTO_INCREMENT," + |
| | | " record_id bigint(20) NOT NULL DEFAULT '0'," + |
| | | " dev_id int(11) NOT NULL DEFAULT '0'," + |
| | | " dev_ip varchar(24) NOT NULL DEFAULT '127.0.0.1'," + |
| | | " alm_type int(11) NOT NULL DEFAULT '0'," + |
| | | " alm_level int(11) NOT NULL DEFAULT '0'," + |
| | | " alm_start_time datetime NOT NULL DEFAULT '1982-01-01 00:00:00'," + |
| | | " alm_end_time datetime NOT NULL DEFAULT '1982-01-01 00:00:00'," + |
| | | " alm_value float NOT NULL DEFAULT '0'," + |
| | | " alm_is_confirmed tinyint(1) NOT NULL DEFAULT '0'," + |
| | | " alm_confirmed_time datetime NOT NULL DEFAULT '1982-01-01 00:00:00'," + |
| | | " alm_cleared_type int(11) NOT NULL DEFAULT '0'," + |
| | | " usr_Id int(11) NOT NULL DEFAULT '0'," + |
| | | " `alm_severity` int(11) NOT NULL DEFAULT '1' COMMENT '告警重要等级[0:重要;1:紧急]'," + |
| | | " PRIMARY KEY (num)," + |
| | | " KEY index_record_id (record_id)," + |
| | | " KEY index_dev_id (dev_id)," + |
| | | " KEY index_alm_type (alm_type)," + |
| | | " KEY index_alm_start_time (alm_start_time)," + |
| | | " KEY index_alm_cleared_type (alm_cleared_type)" + |
| | | ") ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8;"; |
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn()); |
| | | ResultSet res = null; |
| | | try { |
| | | if(true == recreate) { |
| | | sql.sqlMysqlExecute(sql_str01); |
| | | } |
| | | sql.sqlMysqlExecute(sql_str02); |
| | | |
| | | //添加指定的alm_value列'告警值' |
| | | res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" |
| | | + " WHERE table_schema='db_alarm'" |
| | | + " AND table_name='tb_devalarm_data'" |
| | | + " AND column_name='alm_value'"); |
| | | if(false == res.next()) { |
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Devalarm_Data_Table |
| | | + " ADD COLUMN alm_value float NOT NULL DEFAULT '0';"); |
| | | } |
| | | res = null; |
| | | |
| | | //添加指定的work_flag列(派单管理) |
| | | res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" |
| | | + " WHERE table_schema='db_alarm'" |
| | | + " AND table_name='tb_devalarm_data'" |
| | | + " AND column_name='work_flag'"); |
| | | if(false == res.next()) { |
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Devalarm_Data_Table |
| | | + " ADD COLUMN `work_flag` tinyint NOT NULL DEFAULT 0;"); |
| | | } |
| | | res = null; |
| | | //添加指定的msg_flag列(派单管理) |
| | | res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" |
| | | + " WHERE table_schema='db_alarm'" |
| | | + " AND table_name='tb_devalarm_data'" |
| | | + " AND column_name='msg_flag'"); |
| | | if(false == res.next()) { |
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Devalarm_Data_Table |
| | | + " ADD COLUMN `msg_flag` tinyint NOT NULL DEFAULT 0;"); |
| | | } |
| | | res = null; |
| | | //添加指定的alm_severity列(告警重要等级[0:重要;1:紧急]) |
| | | res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" |
| | | + " WHERE table_schema='db_alarm'" |
| | | + " AND table_name='tb_devalarm_data'" |
| | | + " AND column_name='alm_severity'"); |
| | | if(false == res.next()) { |
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Devalarm_Data_Table |
| | | + " ADD COLUMN `alm_severity` int(11) NOT NULL DEFAULT '1' COMMENT '告警重要等级[0:重要;1:紧急]';"); |
| | | } |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | sql.close_con(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 创建tb_bts_station_event表 |
| | | * @param pool |
| | | * @param recreate |
| | | */ |
| | | public static void createBts_Station_Event_Table(MysqlConnPool pool, boolean recreate) { |
| | | String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Bts_Station_Event_Table; |
| | | String sql_str02 = " CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Bts_Station_Event_Table + " (" + |
| | | " num bigint(20) NOT NULL AUTO_INCREMENT," + |
| | | " station_id bigint(20) NOT NULL DEFAULT '0'," + |
| | | " dev_id bigint(20) NOT NULL DEFAULT '0'," + |
| | | " record_datetime varchar(20) NOT NULL DEFAULT '2015-12-02 12:10:00'," + |
| | | " station_event_type int(11) NOT NULL DEFAULT '0'," + |
| | | |
| | | " station_event_trig int(11) NOT NULL DEFAULT '0'," + |
| | | " PRIMARY KEY (num)," + |
| | | " KEY index_dev_id (dev_id)," + |
| | | " KEY index_station_id (station_id)" + |
| | | ") ENGINE=InnoDB DEFAULT CHARSET=utf8;"; |
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn()); |
| | | try { |
| | | if(true == recreate) { |
| | | sql.sqlMysqlExecute(sql_str01); |
| | | } |
| | | sql.sqlMysqlExecute(sql_str02); |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | sql.close_con(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 创建tb_battalarm_data_history表 |
| | | * @param pool |
| | | * @param recreate |
| | | */ |
| | | public static void createBattalarm_Data_History_Table(MysqlConnPool pool, boolean recreate) { |
| | | String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Battalarm_Data_History_Table; |
| | | String sql_str02 = " CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Battalarm_Data_History_Table + " (" + |
| | | " num bigint(20) NOT NULL AUTO_INCREMENT," + |
| | | " BattGroupId int(11) NOT NULL DEFAULT '0'," + |
| | | " MonNum int(11) NOT NULL DEFAULT '0'," + |
| | | " Record_Id bigint(20) NOT NULL DEFAULT '0'," + |
| | | " alm_id int(11) NOT NULL DEFAULT '0'," + |
| | | " alm_signal_id int(11) NOT NULL DEFAULT '0'," + |
| | | " alm_level int(11) NOT NULL DEFAULT '0'," + |
| | | " alm_start_time datetime NOT NULL DEFAULT '1982-01-01 00:00:00'," + |
| | | " alm_end_time datetime NOT NULL DEFAULT '1982-01-01 00:00:00'," + |
| | | " alm_value float NOT NULL DEFAULT '0'," + |
| | | " alm_is_confirmed tinyint(1) NOT NULL DEFAULT '0'," + |
| | | " alm_confirmed_time datetime NOT NULL DEFAULT '1982-01-01 00:00:00'," + |
| | | " alm_cleared_type int(11) NOT NULL DEFAULT '0'," + |
| | | " usr_Id int(11) NOT NULL DEFAULT '0'," + |
| | | " `alm_severity` int(11) NOT NULL DEFAULT '0' COMMENT '告警重要等级[0:重要;1:紧急]'," + |
| | | " PRIMARY KEY (num)," + |
| | | " KEY index_battgroup_id (BattGroupId)," + |
| | | " KEY index_Record_Id (Record_Id)," + |
| | | " KEY index_alm_id (alm_id)," + |
| | | " KEY index_alm_start_time (alm_start_time)," + |
| | | " KEY index_alm_cleared_type (alm_cleared_type)," + |
| | | " KEY index_alm_signal_id (alm_signal_id)," + |
| | | " KEY index_alm_level (alm_level)" + |
| | | ") ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;"; |
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn()); |
| | | ResultSet res = null; |
| | | try { |
| | | if(true == recreate) { |
| | | sql.sqlMysqlExecute(sql_str01); |
| | | } |
| | | sql.sqlMysqlExecute(sql_str02); |
| | | |
| | | //添加指定的alm_severity列(告警重要等级) |
| | | res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" |
| | | + " WHERE table_schema='db_alarm'" |
| | | + " AND table_name='tb_battalarm_data_history'" |
| | | + " AND column_name='alm_severity'"); |
| | | if(false == res.next()) { |
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Battalarm_Data_History_Table |
| | | + " ADD COLUMN `alm_severity` int(11) NOT NULL DEFAULT '0' COMMENT '告警重要等级[0:重要;1:紧急]';"); |
| | | } |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | if(null != res) { |
| | | try { |
| | | res.close(); |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | sql.close_con(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 创建tb_battalarm_data表 |
| | | * @param pool |
| | | * @param recreate |
| | | */ |
| | | public static void createBattalarm_Data_Table(MysqlConnPool pool, boolean recreate) { |
| | | String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Battalarm_Data_Table; |
| | | String sql_str02 = " CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Battalarm_Data_Table + " (" + |
| | | " num bigint(20) NOT NULL AUTO_INCREMENT," + |
| | | " BattGroupId int(11) NOT NULL DEFAULT '0'," + |
| | | " MonNum int(11) NOT NULL DEFAULT '0'," + |
| | | " Record_Id bigint(20) NOT NULL DEFAULT '0'," + |
| | | " alm_id int(11) NOT NULL DEFAULT '0'," + |
| | | " alm_signal_id int(11) NOT NULL DEFAULT '0'," + |
| | | " alm_level int(11) NOT NULL DEFAULT '0'," + |
| | | " alm_start_time datetime NOT NULL DEFAULT '1982-01-01 00:00:00'," + |
| | | " alm_end_time datetime NOT NULL DEFAULT '1982-01-01 00:00:00'," + |
| | | " alm_value float NOT NULL DEFAULT '0'," + |
| | | " alm_is_confirmed tinyint(1) NOT NULL DEFAULT '0'," + |
| | | " alm_confirmed_time datetime NOT NULL DEFAULT '1982-01-01 00:00:00'," + |
| | | " alm_cleared_type int(11) NOT NULL DEFAULT '0'," + |
| | | " usr_Id int(11) NOT NULL DEFAULT '0'," + |
| | | " `work_flag` tinyint(4) NOT NULL DEFAULT '0'," + |
| | | " `msg_flag` tinyint(4) NOT NULL DEFAULT '0'," + |
| | | " `alm_severity` int(11) NOT NULL DEFAULT '0' COMMENT '告警重要等级[0:重要;1:紧急]'," + |
| | | " PRIMARY KEY (num)," + |
| | | " KEY index_battgroup_id (BattGroupId)," + |
| | | " KEY index_Record_Id (Record_Id)," + |
| | | " KEY index_alm_id (alm_id)," + |
| | | " KEY index_alm_start_time (alm_start_time)," + |
| | | " KEY index_alm_cleared_type (alm_cleared_type)," + |
| | | " KEY index_alm_signal_id (alm_signal_id)," + |
| | | " KEY index_alm_level (alm_level)" + |
| | | ") ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;"; |
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn()); |
| | | ResultSet res = null; |
| | | try { |
| | | if(true == recreate) { |
| | | sql.sqlMysqlExecute(sql_str01); |
| | | } |
| | | sql.sqlMysqlExecute(sql_str02); |
| | | |
| | | //添加指定的work_flag列(派单管理) |
| | | res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" |
| | | + " WHERE table_schema='db_alarm'" |
| | | + " AND table_name='tb_battalarm_data'" |
| | | + " AND column_name='work_flag'"); |
| | | if(false == res.next()) { |
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Battalarm_Data_Table |
| | | + " ADD COLUMN `work_flag` tinyint NOT NULL DEFAULT 0;"); |
| | | } |
| | | res = null; |
| | | //添加指定的msg_flag列(派单管理) |
| | | res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" |
| | | + " WHERE table_schema='db_alarm'" |
| | | + " AND table_name='tb_battalarm_data'" |
| | | + " AND column_name='msg_flag'"); |
| | | if(false == res.next()) { |
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Battalarm_Data_Table |
| | | + " ADD COLUMN `msg_flag` tinyint NOT NULL DEFAULT 0;"); |
| | | } |
| | | res = null; |
| | | //添加指定的alm_severity 列(告警重要等级) |
| | | res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" |
| | | + " WHERE table_schema='db_alarm'" |
| | | + " AND table_name='tb_battalarm_data'" |
| | | + " AND column_name='alm_severity'"); |
| | | if(false == res.next()) { |
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Battalarm_Data_Table |
| | | + " ADD COLUMN `alm_severity` int(11) NOT NULL DEFAULT '0' COMMENT '告警重要等级[0:重要;1:紧急]';"); |
| | | } |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | if(null != res) { |
| | | try { |
| | | res.close(); |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | sql.close_con(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * |
| | | * @Title: createTb_Alarm_Message |
| | | * @Description: 告警短信 |
| | | * @param pool |
| | | * @param recreate |
| | | * @author author |
| | | * @date 2021年9月6日 |
| | | */ |
| | | public static void createTb_Alarm_Message(MysqlConnPool pool, boolean recreate) { |
| | | String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Tb_Alarm_Message; |
| | | String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Tb_Alarm_Message + " (" + |
| | | "`id` bigint(19) NOT NULL AUTO_INCREMENT," + |
| | | " `phone` varchar(15) DEFAULT NULL COMMENT '短信发送至手机号'," + |
| | | " `full_device_name` varchar(255) DEFAULT NULL COMMENT '设备全名'," + |
| | | " `alarm_time_category` varchar(255) DEFAULT NULL COMMENT '告警时间段'," + |
| | | " `alarm_message` varchar(255) DEFAULT NULL COMMENT '告警信息'," + |
| | | " `alarm_ids` varchar(255) DEFAULT NULL COMMENT '短信对应的告警id'," + |
| | | " `create_time` datetime DEFAULT NULL," + |
| | | " `update_time` datetime DEFAULT NULL COMMENT '记录更新时间'," + |
| | | " `status` tinyint(1) DEFAULT NULL COMMENT '发送状态,0-未发送,1-发送完成,2-发送失败'," + |
| | | " PRIMARY KEY (`id`)" + |
| | | ") ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='告警短信';"; |
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn()); |
| | | try { |
| | | if(true == recreate) { |
| | | sql.sqlMysqlExecute(sql_str01); |
| | | } |
| | | sql.sqlMysqlExecute(sql_str02); |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | sql.close_con(); |
| | | } |
| | | } |
| | | /** |
| | | * |
| | | * @Title: createTb_Alarm_Detail_Table |
| | | * @Description: 告警详情 |
| | | * @param pool |
| | | * @param recreate |
| | | * @author author |
| | | * @date 2021年9月6日 |
| | | */ |
| | | public static void createTb_Alarm_Detail_Table(MysqlConnPool pool, boolean recreate) { |
| | | String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Tb_Alarm_Detail_Table; |
| | | String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Tb_Alarm_Detail_Table + " (" + |
| | | " `id` bigint(19) NOT NULL AUTO_INCREMENT," + |
| | | " `alm_id` varchar(15) DEFAULT NULL COMMENT '告警id'," + |
| | | " `alm_reason` text COMMENT '告警原因'," + |
| | | " `alm_advice` varchar(255) DEFAULT NULL COMMENT '告警建议'," + |
| | | " `alm_type` int(5) NOT NULL DEFAULT '0' COMMENT '告警来源:0电源,1设备,2电池'," + |
| | | " `highorlow` int(5) DEFAULT '0' COMMENT '高低告警0默认1低2高'," + |
| | | " PRIMARY KEY (`id`)" + |
| | | ") ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COMMENT='告警详情';"; |
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn()); |
| | | ResultSet res = null; |
| | | try { |
| | | if(true == recreate) { |
| | | sql.sqlMysqlExecute(sql_str01); |
| | | } |
| | | sql.sqlMysqlExecute(sql_str02); |
| | | |
| | | //添加指定的highorlow列 |
| | | res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" |
| | | + " WHERE table_schema='db_alarm'" |
| | | + " AND table_name='tb_alarm_detail'" |
| | | + " AND column_name='highorlow'"); |
| | | if(false == res.next()) { |
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Tb_Alarm_Detail_Table |
| | | + " ADD COLUMN `highorlow` int(5) DEFAULT '0' COMMENT '高低告警0默认1低2高';"); |
| | | } |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | if(null != res) { |
| | | try { |
| | | res.close(); |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | sql.close_con(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @Title: createTb_Alarm_Relation_Table |
| | | * @Description:告警对应关系 |
| | | * @param pool |
| | | * @param recreate |
| | | * @author author |
| | | * @date 2021年9月6日 |
| | | */ |
| | | public static void createTb_Alarm_Relation_Table(MysqlConnPool pool, boolean recreate) { |
| | | String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Tb_Alarm_Relation_Table; |
| | | String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Tb_Alarm_Relation_Table + " (" + |
| | | " `id` bigint(19) NOT NULL AUTO_INCREMENT," + |
| | | " `alm_id` varchar(255) DEFAULT NULL COMMENT '告警id'," + |
| | | " `alm_name` varchar(255) DEFAULT NULL COMMENT '告警名称'," + |
| | | " `alm_type` int(5) NOT NULL DEFAULT '0' COMMENT '告警来源:0电源,1设备,2电池'," + |
| | | " `alm_point` varchar(255) DEFAULT '' COMMENT '告警点'," + |
| | | " `highorlow` int(5) DEFAULT '0' COMMENT '高低告警0默认1低2高'," + |
| | | " PRIMARY KEY (`id`)" + |
| | | ") ENGINE=InnoDB AUTO_INCREMENT=92 DEFAULT CHARSET=utf8mb4 COMMENT='告警对应关系';"; |
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn()); |
| | | ResultSet res = null; |
| | | try { |
| | | if(true == recreate) { |
| | | sql.sqlMysqlExecute(sql_str01); |
| | | } |
| | | sql.sqlMysqlExecute(sql_str02); |
| | | |
| | | |
| | | |
| | | //添加指定的highorlow列 |
| | | res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" |
| | | + " WHERE table_schema='db_alarm'" |
| | | + " AND table_name='tb_alarm_relation'" |
| | | + " AND column_name='alm_ponit'"); |
| | | if(res.next()) { |
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Tb_Alarm_Relation_Table |
| | | + " CHANGE alm_ponit alm_point varchar(255) DEFAULT '' COMMENT '告警点';"); |
| | | } |
| | | |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | if(null != res) { |
| | | try { |
| | | res.close(); |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | sql.close_con(); |
| | | } |
| | | } |
| | | /** |
| | | * |
| | | * @Title: create tb_alarm_manual_clear |
| | | * @Description:告警对应关系 |
| | | * @param pool |
| | | * @param recreate |
| | | * @author author |
| | | * @date 2021年9月6日 |
| | | */ |
| | | public static void createTb_Alarm_Manual_Clear_Table(MysqlConnPool pool, boolean recreate) { |
| | | String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Tb_Alarm_Manual_Clear_Table; |
| | | String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Tb_Alarm_Manual_Clear_Table + " (" + |
| | | " `id` int(11) NOT NULL AUTO_INCREMENT," + |
| | | " `station_id` varchar(10) DEFAULT NULL," + |
| | | " `station_name1` varchar(45) DEFAULT NULL," + |
| | | " `station_name2` varchar(45) DEFAULT NULL," + |
| | | " `station_name3` varchar(45) DEFAULT NULL," + |
| | | " `station_name4` varchar(45) DEFAULT NULL," + |
| | | " `station_name5` varchar(45) DEFAULT NULL," + |
| | | " `alarm_type` tinyint(4) DEFAULT NULL COMMENT '告警类型:1-电池,2-设备,3-电源'," + |
| | | " `batt_group_id` int(11) DEFAULT NULL," + |
| | | " `batt_group_name` varchar(45) DEFAULT NULL," + |
| | | " `mon_num` int(11) DEFAULT NULL," + |
| | | " `device_id` int(11) DEFAULT NULL," + |
| | | " `device_name` varchar(45) DEFAULT NULL," + |
| | | " `power_device_id` int(11) DEFAULT NULL," + |
| | | " `alm_start_time` datetime DEFAULT NULL," + |
| | | " `alm_id` int(11) DEFAULT NULL," + |
| | | " `alm_signal_id` int(11) DEFAULT NULL," + |
| | | " `reason` varchar(255) DEFAULT NULL COMMENT '恢复原因'," + |
| | | " `file_url` varchar(255) DEFAULT NULL COMMENT '上传的多个文件路径,用;拼接'," + |
| | | " `create_time` datetime DEFAULT NULL," + |
| | | " `deal_user_id` int(11) DEFAULT NULL," + |
| | | " `main_id` int(11) DEFAULT NULL COMMENT '审批流程主表id'," + |
| | | " PRIMARY KEY (`id`)" + |
| | | ") ENGINE=InnoDB DEFAULT CHARSET=utf8;"; |
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn()); |
| | | ResultSet res = null; |
| | | try { |
| | | if(true == recreate) { |
| | | sql.sqlMysqlExecute(sql_str01); |
| | | } |
| | | sql.sqlMysqlExecute(sql_str02); |
| | | |
| | | //添加指定的 station_name4 |
| | | res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" |
| | | + " WHERE table_schema='db_alarm'" |
| | | + " AND table_name='tb_alarm_manual_clear'" |
| | | + " AND column_name='station_name4'"); |
| | | if(!res.next()) { |
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Tb_Alarm_Manual_Clear_Table |
| | | + " ADD COLUMN `station_name4` varchar(45) DEFAULT NULL;"); |
| | | } |
| | | |
| | | res = null; |
| | | //添加指定的 file_url |
| | | res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" |
| | | + " WHERE table_schema='db_alarm'" |
| | | + " AND table_name='tb_alarm_manual_clear'" |
| | | + " AND column_name='file_url'"); |
| | | if(!res.next()) { |
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Tb_Alarm_Manual_Clear_Table |
| | | + " ADD COLUMN `file_url` varchar(255) DEFAULT NULL COMMENT '上传的多个文件路径,用;拼接';"); |
| | | } |
| | | |
| | | res = null; |
| | | //添加指定的 main_id |
| | | res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" |
| | | + " WHERE table_schema='db_alarm'" |
| | | + " AND table_name='tb_alarm_manual_clear'" |
| | | + " AND column_name='main_id'"); |
| | | if(!res.next()) { |
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Tb_Alarm_Manual_Clear_Table |
| | | + " ADD COLUMN `main_id` int(11) DEFAULT NULL COMMENT '审批流程主表id';"); |
| | | } |
| | | |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | if(null != res) { |
| | | try { |
| | | res.close(); |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | sql.close_con(); |
| | | } |
| | | } |
| | | /** |
| | | * |
| | | * @Title: create tb_battalarm_data_verify |
| | | * @Description:电池告警确认处理表 |
| | | * @param pool |
| | | * @param recreate |
| | | * @author author |
| | | * @date 2021年9月6日 |
| | | */ |
| | | public static void createTb_Battalarm_Data_Verify_Table(MysqlConnPool pool, boolean recreate) { |
| | | String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Tb_Battalarm_Data_Verify_Table; |
| | | String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Tb_Battalarm_Data_Verify_Table + " (" + |
| | | " `num` bigint(20) NOT NULL AUTO_INCREMENT," + |
| | | " `BattGroupId` int(11) NOT NULL DEFAULT '0'," + |
| | | " `MonNum` int(11) NOT NULL DEFAULT '0'," + |
| | | " `Record_Id` bigint(20) NOT NULL DEFAULT '0'," + |
| | | " `alm_id` int(11) NOT NULL DEFAULT '0'," + |
| | | " `alm_signal_id` int(11) NOT NULL DEFAULT '0'," + |
| | | " `alm_level` int(11) NOT NULL DEFAULT '0'," + |
| | | " `alm_start_time` datetime NOT NULL DEFAULT '1982-01-01 00:00:00'," + |
| | | " `alm_end_time` datetime NOT NULL DEFAULT '1982-01-01 00:00:00'," + |
| | | " `alm_value` float NOT NULL DEFAULT '0'," + |
| | | " `alm_is_confirmed` tinyint(1) NOT NULL DEFAULT '0'," + |
| | | " `alm_confirmed_time` datetime NOT NULL DEFAULT '1982-01-01 00:00:00'," + |
| | | " `alm_cleared_type` int(11) NOT NULL DEFAULT '0'," + |
| | | " `usr_Id` int(11) NOT NULL DEFAULT '0'," + |
| | | " `work_flag` tinyint(4) NOT NULL DEFAULT '0'," + |
| | | " `msg_flag` tinyint(4) NOT NULL DEFAULT '0'," + |
| | | " `alm_severity` int(11) NOT NULL DEFAULT '0' COMMENT '告警重要等级[0:重要;1:紧急]'," + |
| | | " `alm_solekey` int(11) NOT NULL DEFAULT '1' COMMENT '实时告警主键'," + |
| | | " PRIMARY KEY (`num`)," + |
| | | " KEY `index_battgroup_id` (`BattGroupId`)," + |
| | | " KEY `index_Record_Id` (`Record_Id`)," + |
| | | " KEY `index_alm_id` (`alm_id`)," + |
| | | " KEY `index_alm_start_time` (`alm_start_time`)," + |
| | | " KEY `index_alm_cleared_type` (`alm_cleared_type`)," + |
| | | " KEY `index_alm_signal_id` (`alm_signal_id`)," + |
| | | " KEY `index_alm_level` (`alm_level`)" + |
| | | ") ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='电池告警确认处理表';"; |
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn()); |
| | | ResultSet res = null; |
| | | try { |
| | | if(true == recreate) { |
| | | sql.sqlMysqlExecute(sql_str01); |
| | | } |
| | | sql.sqlMysqlExecute(sql_str02); |
| | | |
| | | |
| | | //添加指定的highorlow列 |
| | | res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" |
| | | + " WHERE table_schema='db_alarm'" |
| | | + " AND table_name='tb_battalarm_data_verify'" |
| | | + " AND column_name='alm_solekey'"); |
| | | if(!res.next()) { |
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Tb_Battalarm_Data_Verify_Table |
| | | + " ADD COLUMN `alm_solekey` int(11) NOT NULL DEFAULT '1' COMMENT '实时告警主键';"); |
| | | } |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | if(null != res) { |
| | | try { |
| | | res.close(); |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | sql.close_con(); |
| | | } |
| | | } |
| | | /** |
| | | * |
| | | * @Title: create tb_devalarm_data_verify |
| | | * @Description:设备告警确认处理表 |
| | | * @param pool |
| | | * @param recreate |
| | | * @author author |
| | | * @date 2021年9月6日 |
| | | */ |
| | | public static void createTb_Devalarm_Data_Verify_Table(MysqlConnPool pool, boolean recreate) { |
| | | String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Tb_Devalarm_Data_Verify_Table; |
| | | String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Tb_Devalarm_Data_Verify_Table + " (" + |
| | | " `num` bigint(20) NOT NULL AUTO_INCREMENT," + |
| | | " `record_id` bigint(20) NOT NULL DEFAULT '0'," + |
| | | " `dev_id` int(11) NOT NULL DEFAULT '0'," + |
| | | " `dev_ip` varchar(24) NOT NULL DEFAULT '127.0.0.1'," + |
| | | " `alm_type` int(11) NOT NULL DEFAULT '0'," + |
| | | " `alm_level` int(11) NOT NULL DEFAULT '0'," + |
| | | " `alm_start_time` datetime NOT NULL DEFAULT '1982-01-01 00:00:00'," + |
| | | " `alm_end_time` datetime NOT NULL DEFAULT '1982-01-01 00:00:00'," + |
| | | " `alm_value` float NOT NULL DEFAULT '0'," + |
| | | " `alm_is_confirmed` tinyint(1) NOT NULL DEFAULT '0'," + |
| | | " `alm_confirmed_time` datetime NOT NULL DEFAULT '1982-01-01 00:00:00'," + |
| | | " `alm_cleared_type` int(11) NOT NULL DEFAULT '0'," + |
| | | " `usr_Id` int(11) NOT NULL DEFAULT '0'," + |
| | | " `work_flag` tinyint(4) NOT NULL DEFAULT '0'," + |
| | | " `msg_flag` tinyint(4) NOT NULL DEFAULT '0'," + |
| | | " `alm_severity` int(11) NOT NULL DEFAULT '1' COMMENT '告警重要等级[0:重要;1:紧急]'," + |
| | | " `alm_solekey` int(11) NOT NULL DEFAULT '1' COMMENT '实时告警主键'," + |
| | | " PRIMARY KEY (`num`)," + |
| | | " KEY `index_record_id` (`record_id`)," + |
| | | " KEY `index_dev_id` (`dev_id`)," + |
| | | " KEY `index_alm_type` (`alm_type`)," + |
| | | " KEY `index_alm_start_time` (`alm_start_time`)," + |
| | | " KEY `index_alm_cleared_type` (`alm_cleared_type`)" + |
| | | ") ENGINE=InnoDB AUTO_INCREMENT=16726 DEFAULT CHARSET=utf8 COMMENT='设备告警确认处理表';"; |
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn()); |
| | | ResultSet res = null; |
| | | try { |
| | | if(true == recreate) { |
| | | sql.sqlMysqlExecute(sql_str01); |
| | | } |
| | | sql.sqlMysqlExecute(sql_str02); |
| | | |
| | | //添加指定的highorlow列 |
| | | res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" |
| | | + " WHERE table_schema='db_alarm'" |
| | | + " AND table_name='tb_devalarm_data_verify'" |
| | | + " AND column_name='alm_solekey'"); |
| | | if(!res.next()) { |
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Tb_Devalarm_Data_Verify_Table |
| | | + " ADD COLUMN `alm_solekey` int(11) NOT NULL DEFAULT '1' COMMENT '实时告警主键';"); |
| | | } |
| | | |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | if(null != res) { |
| | | try { |
| | | res.close(); |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | sql.close_con(); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | package com.database_util;
|
| | |
|
| | | import java.sql.SQLException;
|
| | |
|
| | | import com.sql.MysqlConnPool;
|
| | | import com.sql.Sql_Mysql;
|
| | |
|
| | | public class DB_Alarm {
|
| | |
|
| | | |
| | | public static void init(MysqlConnPool pool, boolean recreate) {
|
| | | //创建数据库
|
| | | createDB_Alarm(pool);
|
| | | |
| | | createAlarm_Param_Table(pool,recreate);
|
| | | |
| | | createDevalarm_Data_Table(pool, recreate);
|
| | |
|
| | | }
|
| | | |
| | | /**
|
| | | * 创建 tb_devalarm_data
|
| | | * @param pool
|
| | | * @param recreate
|
| | | */
|
| | | public static void createDevalarm_Data_Table(MysqlConnPool pool, boolean recreate) {
|
| | | String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Devalarm_Data_Table;
|
| | | String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Devalarm_Data_Table + " (" + |
| | | " `num` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增主键'," + |
| | | " `dev_id` int(11) NOT NULL DEFAULT '0' COMMENT '设备ID'," + |
| | | " `alm_id` int(11) NOT NULL DEFAULT '0' COMMENT '告警ID'," + |
| | | " `alm_signal_id` int(11) NOT NULL DEFAULT '1' COMMENT '告警类型【1-上限告警 2-下限告警】'," + |
| | | " `alm_starttime` datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '告警开始时间'," + |
| | | " `alm_value` float NOT NULL DEFAULT '0' COMMENT '告警值'," + |
| | | " `alm_is_confirmed` tinyint(4) NOT NULL DEFAULT '0' COMMENT '告警是否确认'," + |
| | | " `confirmed_uid` int(11) NOT NULL DEFAULT '0' COMMENT '确认用户ID'," + |
| | | " `confirmed_time` datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '确认时间'," + |
| | | " `alm_endtime` datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '告警结束时间'," + |
| | | " `alm_cleared_type` int(11) NOT NULL DEFAULT '0' COMMENT '告警记录状态[0-实时告警 1-历史告警 2-取消告警]'," + |
| | | " PRIMARY KEY (`num`)," + |
| | | " KEY `idx_dev_id` (`dev_id`) USING BTREE," + |
| | | " KEY `idx_alm_id` (`alm_id`) USING BTREE" + |
| | | ") ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备实时告警记录表';";
|
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
| | | try {
|
| | | if(true == recreate) { |
| | | sql.sqlMysqlExecute(sql_str01);
|
| | | }
|
| | | sql.sqlMysqlExecute(sql_str02);
|
| | | } catch (SQLException e) {
|
| | | e.printStackTrace();
|
| | | } finally {
|
| | | sql.close_con();
|
| | | }
|
| | | }
|
| | | |
| | | /**
|
| | | * 创建 tb_alarm_param
|
| | | * @param pool
|
| | | * @param recreate
|
| | | */
|
| | | public static void createAlarm_Param_Table(MysqlConnPool pool, boolean recreate) {
|
| | | String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Alarm_Param_Table;
|
| | | String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Alarm_Param_Table + " (" + |
| | | " `num` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增主键'," + |
| | | " `dev_id` int(11) NOT NULL DEFAULT '0' COMMENT '设备ID'," + |
| | | " `alm_id` int(11) NOT NULL DEFAULT '0' COMMENT '告警id'," + |
| | | " `alm_name` varchar(255) NOT NULL DEFAULT '' COMMENT '告警名称'," + |
| | | " `alm_high_level` int(11) NOT NULL DEFAULT '4' COMMENT '上限告警等级'," + |
| | | " `alm_high_coe` float NOT NULL DEFAULT '0' COMMENT '上限告警阈值'," + |
| | | " `alm_high_en` tinyint(4) NOT NULL DEFAULT '0' COMMENT '上限告警使能'," + |
| | | " `alm_low_level` int(11) NOT NULL DEFAULT '4' COMMENT '下限告警等级'," + |
| | | " `alm_low_coe` float NOT NULL DEFAULT '0' COMMENT '下限告警使能'," + |
| | | " `alm_low_en` tinyint(4) NOT NULL DEFAULT '0' COMMENT '下限告警使能'," + |
| | | " PRIMARY KEY (`num`)," + |
| | | " KEY `idx_alm_id` (`alm_id`) USING BTREE," + |
| | | " KEY `idx_dev_id` (`dev_id`) USING BTREE" + |
| | | ") ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备告警参数表';";
|
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
| | | try {
|
| | | if(true == recreate) { |
| | | sql.sqlMysqlExecute(sql_str01);
|
| | | }
|
| | | sql.sqlMysqlExecute(sql_str02);
|
| | | } catch (SQLException e) {
|
| | | e.printStackTrace();
|
| | | } finally {
|
| | | sql.close_con();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | public static void createDB_Alarm(MysqlConnPool pool) {
|
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
| | | try {
|
| | | sql.sqlMysqlExecute("CREATE DATABASE IF NOT EXISTS " + Sql_Mysql.DB_ALARM);
|
| | | } catch (SQLException e) {
|
| | | e.printStackTrace();
|
| | | } finally {
|
| | | sql.close_con();
|
| | | }
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.database_util;
|
| | |
|
| | | import java.sql.SQLException;
|
| | |
|
| | | import com.sql.MysqlConnPool;
|
| | | import com.sql.Sql_Mysql;
|
| | |
|
| | | public class DB_App_Config {
|
| | | public static void init(MysqlConnPool pool, boolean recreate) {
|
| | | //创建数据库
|
| | | createDB_App_Config(pool);
|
| | | |
| | | createApp_Config_Table(pool, recreate);
|
| | |
|
| | | }
|
| | | |
| | | /**
|
| | | * 创建 tb_app_config
|
| | | * @param pool
|
| | | * @param recreate
|
| | | */
|
| | | public static void createApp_Config_Table(MysqlConnPool pool, boolean recreate) {
|
| | | String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.App_Config_Table;
|
| | | String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.App_Config_Table + " (" + |
| | | " `num` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增主键'," + |
| | | " `app_name` varchar(255) NOT NULL DEFAULT '' COMMENT '平台软件名称'," + |
| | | " `app_version` varchar(255) NOT NULL DEFAULT '' COMMENT '软件版本号'," + |
| | | " `a200_reload_en` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'A200数据重载标识[0-无 1-需要重载]'," + |
| | | " `actm_reload_en` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'ACTM均衡仪数据重载标识[0-无 1-需要重载]'," + |
| | | " PRIMARY KEY (`num`)" + |
| | | ") ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='平台软件数据源配置相关参数';";
|
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
| | | try {
|
| | | if(true == recreate) { |
| | | sql.sqlMysqlExecute(sql_str01);
|
| | | }
|
| | | sql.sqlMysqlExecute(sql_str02);
|
| | | } catch (SQLException e) {
|
| | | e.printStackTrace();
|
| | | } finally {
|
| | | sql.close_con();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | |
| | | public static void createDB_App_Config(MysqlConnPool pool) {
|
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
| | | try {
|
| | | sql.sqlMysqlExecute("CREATE DATABASE IF NOT EXISTS " + Sql_Mysql.DB_APP_CONFIG);
|
| | | } catch (SQLException e) {
|
| | | e.printStackTrace();
|
| | | } finally {
|
| | | sql.close_con();
|
| | | }
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.database_util;
|
| | |
|
| | | import java.sql.SQLException;
|
| | |
|
| | | import com.sql.MysqlConnPool;
|
| | | import com.sql.Sql_Mysql;
|
| | |
|
| | | public class DB_Batt_TestData {
|
| | | |
| | | |
| | | public static void init(MysqlConnPool pool, boolean recreate) {
|
| | | //创建数据库
|
| | | createDB_Batt_TestData(pool);
|
| | | |
| | | createBatttestdata_Inf_Table(pool, recreate);
|
| | |
|
| | | }
|
| | | |
| | | /**
|
| | | * 创建 tb_batttestdata_inf
|
| | | * @param pool
|
| | | * @param recreate
|
| | | */
|
| | | public static void createBatttestdata_Inf_Table(MysqlConnPool pool, boolean recreate) {
|
| | | String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Batttestdata_Inf_Table;
|
| | | String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Batttestdata_Inf_Table + " (" + |
| | | " `num` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增主键'," + |
| | | " `dev_id` int(11) NOT NULL DEFAULT '0' COMMENT '设备ID'," + |
| | | " `batt_idx` int(11) NOT NULL DEFAULT '0' COMMENT '电池组编号[0-组1 1-组2 ... 4-组4]'," + |
| | | " `test_type` int(11) NOT NULL DEFAULT '0' COMMENT '测试类型'," + |
| | | " `test_record_count` int(11) NOT NULL DEFAULT '0' COMMENT '测试记录次数'," + |
| | | " `record_num` int(11) NOT NULL DEFAULT '0' COMMENT '记录笔数'," + |
| | | " `test_starttime` datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '测试开始时间'," + |
| | | " `test_timelong` bigint(20) NOT NULL DEFAULT '0' COMMENT '测试时长'," + |
| | | " `record_time` datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '记录时间'," + |
| | | " `test_stoptype` int(11) NOT NULL DEFAULT '0' COMMENT '停止原因'," + |
| | | " `group_vol` float NOT NULL DEFAULT '0' COMMENT '组端电压'," + |
| | | " `test_curr` float NOT NULL DEFAULT '0' COMMENT '测试电流'," + |
| | | " `test_cap` float NOT NULL DEFAULT '0' COMMENT '测试容量'," + |
| | | " `max_monvol` float NOT NULL DEFAULT '0' COMMENT '最大单体电压'," + |
| | | " `max_monvolnum` int(11) NOT NULL DEFAULT '0' COMMENT '最大单体电压编号'," + |
| | | " `min_monvol` float NOT NULL DEFAULT '0' COMMENT '最小单体电压'," + |
| | | " `min_monvolnum` int(11) NOT NULL DEFAULT '0' COMMENT '最小单体电压编号'," + |
| | | " PRIMARY KEY (`num`)," + |
| | | " KEY `idx_dev_id` (`dev_id`) USING BTREE," + |
| | | " KEY `idx_test_record_count` (`test_record_count`) USING BTREE," + |
| | | " KEY `idx_batt_idx` (`batt_idx`) USING BTREE" + |
| | | ") ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='电池组历史数据总表';";
|
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
| | | try {
|
| | | if(true == recreate) { |
| | | sql.sqlMysqlExecute(sql_str01);
|
| | | }
|
| | | sql.sqlMysqlExecute(sql_str02);
|
| | | } catch (SQLException e) {
|
| | | e.printStackTrace();
|
| | | } finally {
|
| | | sql.close_con();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | |
| | | public static void createDB_Batt_TestData(MysqlConnPool pool) {
|
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
| | | try {
|
| | | sql.sqlMysqlExecute("CREATE DATABASE IF NOT EXISTS " + Sql_Mysql.DB_BATT_TESTDATA);
|
| | | } catch (SQLException e) {
|
| | | e.printStackTrace();
|
| | | } finally {
|
| | | sql.close_con();
|
| | | }
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.database_util;
|
| | |
|
| | | import java.sql.SQLException;
|
| | |
|
| | | import com.sql.MysqlConnPool;
|
| | | import com.sql.Sql_Mysql;
|
| | |
|
| | | public class DB_Lithium_Ram_Db {
|
| | | |
| | | public static void init(MysqlConnPool pool, boolean recreate) {
|
| | | //创建数据库
|
| | | createDB_Lithium_Ram_Db(pool);
|
| | | |
| | | createA200_Realstate_Table(pool, recreate);
|
| | |
|
| | | createActm_Realstate_Table(pool, recreate);
|
| | |
|
| | | createBatt_Rtdata_Table(pool, recreate);
|
| | |
|
| | | createDev_A200_TestParam_Table(pool, recreate);
|
| | |
|
| | | createDev_Actm_TestParam_Table(pool, recreate);
|
| | |
|
| | | createDev_Inf_Table(pool, recreate);
|
| | |
|
| | | createWorkstate_Cfg_Table(pool, recreate);
|
| | |
|
| | | createWorkstate_Changeevent_Table(pool, recreate);
|
| | |
|
| | | }
|
| | | |
| | | /**
|
| | | * 创建 tb_a200_realstate
|
| | | * @param pool
|
| | | * @param recreate
|
| | | */
|
| | | public static void createA200_Realstate_Table(MysqlConnPool pool, boolean recreate) {
|
| | | String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.A200_Realstate_Table;
|
| | | String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.A200_Realstate_Table + " (" + |
| | | " `num` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增主键'," + |
| | | " `dev_id` int(11) NOT NULL DEFAULT '1' COMMENT '设备ID'," + |
| | | " `record_time` datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '更新时间'," + |
| | | " `battery_name` varchar(255) NOT NULL DEFAULT '' COMMENT 'PACK/模组号'," + |
| | | " `test_type` int(11) NOT NULL DEFAULT '2' COMMENT '测试类型[1-放电 2-充电]'," + |
| | | " `is_testing` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否正在测试'," + |
| | | " `start_test_time` varchar(255) NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '测试开始时间'," + |
| | | " `test_duration` int(11) NOT NULL DEFAULT '0' COMMENT '测试时长(秒)'," + |
| | | " `stop_test_time` varchar(255) NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '测试结束时间'," + |
| | | " `max_battery_voltage` double NOT NULL DEFAULT '0' COMMENT '最高单体电压(V)'," + |
| | | " `min_battery_voltage` double NOT NULL DEFAULT '0' COMMENT '最低单体电压(V)'," + |
| | | " `max_battery_voltage_number` int(11) NOT NULL DEFAULT '1' COMMENT '最高单体电压对应电芯编号'," + |
| | | " `min_battery_voltage_number` int(11) NOT NULL DEFAULT '1' COMMENT '最低单体电压对应电芯编号'," + |
| | | " `diff_battery_voltage` double NOT NULL DEFAULT '0' COMMENT '电芯压差(mV)'," + |
| | | " `storage_voltage` double NOT NULL DEFAULT '0' COMMENT '组端电压(V)'," + |
| | | " `test_current` double NOT NULL DEFAULT '0' COMMENT '测试电流(A)'," + |
| | | " `test_capacity` double NOT NULL DEFAULT '0' COMMENT '测试容量(AH)'," + |
| | | " `min_battery_temperature` double NOT NULL DEFAULT '0' COMMENT '最小温度'," + |
| | | " `max_battery_temperature` double NOT NULL DEFAULT '0' COMMENT '最大温度'," + |
| | | " `max_battery_temperature_number` int(11) NOT NULL DEFAULT '0' COMMENT '最大温度对应温度序号'," + |
| | | " `min_battery_temperature_number` int(11) NOT NULL DEFAULT '0' COMMENT '最小温度对应温度序号'," + |
| | | " `stop_reason` varchar(255) NOT NULL DEFAULT '' COMMENT '停机原因'," + |
| | | " `stop_reason_number` int(11) NOT NULL DEFAULT '0' COMMENT '停机原因序号'," + |
| | | " `fault_state` int(11) NOT NULL DEFAULT '0' COMMENT '故障状态[0-无故障 1-有故障]'," + |
| | | " `work_state` int(11) NOT NULL DEFAULT '0' COMMENT '设备工作状态[0-浮充 1-放电 2-充电]'," + |
| | | " `last_work_state` int(11) NOT NULL DEFAULT '0' COMMENT '上一次工作状态[0-浮充 1-放电 2-充电]'," + |
| | | " `avg_mon_vol` double NOT NULL DEFAULT '0' COMMENT '单体电压平均值'," + |
| | | " `avg_mon_tmp` double NOT NULL DEFAULT '0' COMMENT '单体温度平均值'," + |
| | | " PRIMARY KEY (`num`)," + |
| | | " UNIQUE KEY `idx_dev_id` (`dev_id`) USING BTREE," + |
| | | " KEY `idx_record_time` (`record_time`) USING BTREE" + |
| | | ") ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='A200 设备实时状态表';";
|
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
| | | try {
|
| | | if(true == recreate) { |
| | | sql.sqlMysqlExecute(sql_str01);
|
| | | }
|
| | | sql.sqlMysqlExecute(sql_str02);
|
| | | } catch (SQLException e) {
|
| | | e.printStackTrace();
|
| | | } finally {
|
| | | sql.close_con();
|
| | | }
|
| | | }
|
| | | /**
|
| | | * 创建 tb_actm_realstate
|
| | | * @param pool
|
| | | * @param recreate
|
| | | */
|
| | | public static void createActm_Realstate_Table(MysqlConnPool pool, boolean recreate) {
|
| | | String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Actm_Realstate_Table;
|
| | | String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Actm_Realstate_Table + " (" + |
| | | " `num` bigint(20) NOT NULL AUTO_INCREMENT," + |
| | | " `dev_id` int(11) NOT NULL DEFAULT '0' COMMENT '设备ID'," + |
| | | " `record_time` datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '更新时间'," + |
| | | " `battery_storage_index` int(11) NOT NULL DEFAULT '0' COMMENT '模组序号 从0开始'," + |
| | | " `module_code` varchar(255) NOT NULL DEFAULT '' COMMENT '模组编号'," + |
| | | " `work_mode` int(11) NOT NULL DEFAULT '0' COMMENT '工作模式'," + |
| | | " `battery_type` int(11) NOT NULL DEFAULT '0' COMMENT '电池类型'," + |
| | | " `battery_number` int(11) NOT NULL DEFAULT '0' COMMENT '电芯串数'," + |
| | | " `battery_voltage_threshold` double NOT NULL DEFAULT '0' COMMENT '单体目标电压'," + |
| | | " `storage_voltage_threshold` double NOT NULL DEFAULT '0' COMMENT '模组目标电压'," + |
| | | " `test_current` double NOT NULL DEFAULT '0' COMMENT '工作电流'," + |
| | | " `ntc_count` int(11) NOT NULL DEFAULT '0' COMMENT '温度传感器数量'," + |
| | | " `test_data_id` int(11) NOT NULL DEFAULT '0' COMMENT '测试记录Id'," + |
| | | " `is_testing` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否正在测试'," + |
| | | " `is_test_pause` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否测试暂停'," + |
| | | " `start_test_time` varchar(255) NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '测试开始时间'," + |
| | | " `test_duration` int(11) NOT NULL DEFAULT '0' COMMENT '测试时长(秒)'," + |
| | | " `stop_test_time` varchar(255) NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '测试结束时间'," + |
| | | " `max_battery_voltage` double NOT NULL DEFAULT '0' COMMENT '电压Max'," + |
| | | " `min_battery_voltage` double NOT NULL DEFAULT '0' COMMENT '电压Min'," + |
| | | " `avg_battery_voltage` double NOT NULL DEFAULT '0' COMMENT '平均电压'," + |
| | | " `diff_battery_voltage` double NOT NULL DEFAULT '0' COMMENT '电芯压差'," + |
| | | " `storage_voltage` double NOT NULL DEFAULT '0' COMMENT '模组总电压'," + |
| | | " `temperature_unit_type` varchar(255) NOT NULL DEFAULT '' COMMENT '温度单位'," + |
| | | " `module_status` varchar(255) NOT NULL DEFAULT '' COMMENT '模组状态'," + |
| | | " `module_status_int` int(11) NOT NULL DEFAULT '0' COMMENT '模组状态类型'," + |
| | | " `module_status_color` varchar(255) NOT NULL DEFAULT '' COMMENT '模组状态颜色'," + |
| | | " `fault_info` varchar(255) NOT NULL DEFAULT '' COMMENT '故障信息'," + |
| | | " `avg_mon_vol` double NOT NULL DEFAULT '0' COMMENT '平均单体电压'," + |
| | | " `avg_mon_tmp` double NOT NULL DEFAULT '0' COMMENT '平均单体温度'," + |
| | | " `battery_count` int(11) NOT NULL DEFAULT '2' COMMENT '当前接入电池组数量'," + |
| | | " `battery_moncount` int(11) NOT NULL DEFAULT '24' COMMENT '电池数量'," + |
| | | " PRIMARY KEY (`num`)," + |
| | | " KEY `idx_dev_id` (`dev_id`) USING BTREE" + |
| | | ") ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='ACTM 设备实时状态表';";
|
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
| | | try {
|
| | | if(true == recreate) { |
| | | sql.sqlMysqlExecute(sql_str01);
|
| | | }
|
| | | sql.sqlMysqlExecute(sql_str02);
|
| | | } catch (SQLException e) {
|
| | | e.printStackTrace();
|
| | | } finally {
|
| | | sql.close_con();
|
| | | }
|
| | | }
|
| | | /**
|
| | | * 创建 tb_batt_rtdata
|
| | | * @param pool
|
| | | * @param recreate
|
| | | */
|
| | | public static void createBatt_Rtdata_Table(MysqlConnPool pool, boolean recreate) {
|
| | | String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Batt_Rtdata_Table;
|
| | | String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Batt_Rtdata_Table + " (" + |
| | | " `num` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增主键'," + |
| | | " `dev_id` int(11) NOT NULL DEFAULT '0' COMMENT '设备ID'," + |
| | | " `batt_idx` int(11) NOT NULL DEFAULT '0' COMMENT '电池组编号[0-组1 1-组2 ... 4-组4]'," + |
| | | " `mon_num` int(11) NOT NULL DEFAULT '0' COMMENT '单体编号'," + |
| | | " `record_time` datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '更新时间'," + |
| | | " `mon_vol` double NOT NULL DEFAULT '0' COMMENT '单体电压'," + |
| | | " `mon_tmp` double NOT NULL DEFAULT '0' COMMENT '单体温度'," + |
| | | " `mon_curr` double NOT NULL DEFAULT '0' COMMENT '单体电流'," + |
| | | " `mon_cap` double NOT NULL DEFAULT '0' COMMENT '单体容量'," + |
| | | " `mon_wh` double NOT NULL DEFAULT '0' COMMENT '单体能量'," + |
| | | " `mon_state` varchar(255) NOT NULL DEFAULT '0' COMMENT '单体状态'," + |
| | | " `mon_fault` varchar(255) NOT NULL DEFAULT '0' COMMENT '故障信息'," + |
| | | " `need_test` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否需要测试[0-不需 1-需要]'," + |
| | | " PRIMARY KEY (`num`)," + |
| | | " KEY `idx_dev_id` (`dev_id`) USING BTREE," + |
| | | " KEY `idx_batt_idx` (`batt_idx`) USING BTREE" + |
| | | ") ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='电池组单体实时状态信息表';";
|
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
| | | try {
|
| | | if(true == recreate) { |
| | | sql.sqlMysqlExecute(sql_str01);
|
| | | }
|
| | | sql.sqlMysqlExecute(sql_str02);
|
| | | } catch (SQLException e) {
|
| | | e.printStackTrace();
|
| | | } finally {
|
| | | sql.close_con();
|
| | | }
|
| | | }
|
| | | /**
|
| | | * 创建 tb_dev_a200_testparam
|
| | | * @param pool
|
| | | * @param recreate
|
| | | */
|
| | | public static void createDev_A200_TestParam_Table(MysqlConnPool pool, boolean recreate) {
|
| | | String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Dev_A200_TestParam_Table;
|
| | | String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Dev_A200_TestParam_Table + " (" + |
| | | " `num` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增主键'," + |
| | | " `dev_id` int(11) NOT NULL DEFAULT '0' COMMENT '设备ID'," + |
| | | " `op_cmd` int(11) NOT NULL DEFAULT '0' COMMENT '命令'," + |
| | | " `return_code` int(11) NOT NULL DEFAULT '0' COMMENT '返回响应码'," + |
| | | " `battery_name` varchar(255) NOT NULL DEFAULT '' COMMENT 'pack/模组号'," + |
| | | " `nominal_capacity` double NOT NULL DEFAULT '0' COMMENT '标称容量(AH)'," + |
| | | " `battery_type` int(11) NOT NULL DEFAULT '0' COMMENT '电池类型[0-磷酸铁锂 1-三元锂 2-太酸锂 4-锰酸锂]'," + |
| | | " `battery_number` int(11) NOT NULL DEFAULT '0' COMMENT '电芯串数'," + |
| | | " `diff_battery_voltage` double NOT NULL DEFAULT '0' COMMENT '电芯压差'," + |
| | | " `discharge_current` double NOT NULL DEFAULT '0' COMMENT '放电电流'," + |
| | | " `discharge_time` int(11) NOT NULL DEFAULT '0' COMMENT '放电时间(秒)'," + |
| | | " `discharge_capacity` double NOT NULL DEFAULT '0' COMMENT '预放容量(AH)'," + |
| | | " `is_discharge_capacity_enable` tinyint(4) NOT NULL DEFAULT '0' COMMENT '预放容量限制是否开启'," + |
| | | " `min_battery_voltage` double NOT NULL DEFAULT '0' COMMENT '单串下限(V)'," + |
| | | " `is_min_battery_voltage_enable` tinyint(4) NOT NULL DEFAULT '0' COMMENT '单串下限是否开启'," + |
| | | " `charge_voltage` double NOT NULL DEFAULT '0' COMMENT '充电目标电压(V)'," + |
| | | " `charge_protect_voltage` double NOT NULL DEFAULT '0' COMMENT '充电保护电压'," + |
| | | " `charge_current` double NOT NULL DEFAULT '0' COMMENT '充电电流(A)'," + |
| | | " `charge_stop_current` double NOT NULL DEFAULT '0' COMMENT '充电停机电流(A)'," + |
| | | " `charge_time` int(11) NOT NULL DEFAULT '0' COMMENT '充电时间(秒)'," + |
| | | " `charge_capacity` double NOT NULL DEFAULT '0' COMMENT '充电容量'," + |
| | | " `is_charge_capacity_enable` tinyint(4) NOT NULL DEFAULT '0' COMMENT '预充容量限制是否开启'," + |
| | | " `max_battery_voltage` double NOT NULL DEFAULT '0' COMMENT '单串上限'," + |
| | | " `is_max_battery_voltage_enable` tinyint(4) NOT NULL DEFAULT '0' COMMENT '单串上限限制是否开启'," + |
| | | " `charge_power` double NOT NULL DEFAULT '0' COMMENT '充电功率(KW)'," + |
| | | " `battery_temperature_protect` int(11) NOT NULL DEFAULT '0' COMMENT '单体温度保护'," + |
| | | " `control_type` int(11) NOT NULL DEFAULT '1' COMMENT '控制类型[1-所有停机原因均显示弹窗和蜂鸣声 2-所有停机原因均不显示弹窗和蜂鸣声 3-正常停机原因不显示弹窗和蜂鸣声,异常停机原因显示弹窗和蜂鸣声 4-正常停机原因显示弹窗和蜂鸣声,异常停机原因不显示弹窗和蜂鸣声]'," + |
| | | " `result_reason` varchar(255) NOT NULL DEFAULT '' COMMENT '接口返回失败原因'," + |
| | | " `discharge_voltage` double NOT NULL DEFAULT '0' COMMENT '放电目标电压[组端下限]'," + |
| | | " PRIMARY KEY (`num`)," + |
| | | " UNIQUE KEY `idx_dev_id` (`dev_id`) USING BTREE" + |
| | | ") ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='A200测试参数表';";
|
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
| | | try {
|
| | | if(true == recreate) { |
| | | sql.sqlMysqlExecute(sql_str01);
|
| | | }
|
| | | sql.sqlMysqlExecute(sql_str02);
|
| | | } catch (SQLException e) {
|
| | | e.printStackTrace();
|
| | | } finally {
|
| | | sql.close_con();
|
| | | }
|
| | | }
|
| | | |
| | | /**
|
| | | * 创建 tb_dev_actm_testparam
|
| | | * @param pool
|
| | | * @param recreate
|
| | | */
|
| | | public static void createDev_Actm_TestParam_Table(MysqlConnPool pool, boolean recreate) {
|
| | | String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Dev_Actm_TestParam_Table;
|
| | | String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Dev_Actm_TestParam_Table + " (" + |
| | | " `num` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增主键'," + |
| | | " `dev_id` int(11) NOT NULL DEFAULT '0' COMMENT '设备ID'," + |
| | | " `op_cmd` int(11) NOT NULL DEFAULT '0' COMMENT '操作命令'," + |
| | | " `return_code` int(11) NOT NULL DEFAULT '0' COMMENT '返回响应码'," + |
| | | " `battery_storage_index` int(11) NOT NULL DEFAULT '0' COMMENT '模组需要,从0开始'," + |
| | | " `module_code` varchar(255) NOT NULL DEFAULT '' COMMENT '模组编号'," + |
| | | " `work_mode` int(11) NOT NULL DEFAULT '0' COMMENT '工作模式[0-充电 1-放电 2-均衡]'," + |
| | | " `battery_type` int(11) NOT NULL DEFAULT '0' COMMENT '电池类型[0-铁锂 1-三元锂 2-钛酸锂 3-锰酸锂]'," + |
| | | " `battery_number` int(11) NOT NULL DEFAULT '0' COMMENT '当前配置的电芯数量'," + |
| | | " `ntc_count` int(11) NOT NULL DEFAULT '0' COMMENT '当前配置的温度传感器数量'," + |
| | | " `test_battery_array` varchar(255) NOT NULL DEFAULT '' COMMENT '测试电池列表[测试电池列表是将待测电芯编号用逗号分隔的字符串。例如:1,2,4,6 表示测试1#、2#、4#、6#电芯,其余没有包含的电芯不进行测试]'," + |
| | | " `voltage` double NOT NULL DEFAULT '0' COMMENT '电压阈值'," + |
| | | " `current` double NOT NULL DEFAULT '0' COMMENT '工作电流'," + |
| | | " `max_battery_number` int(11) NOT NULL DEFAULT '0' COMMENT '可配置的最大电芯数量[只读]'," + |
| | | " `max_ntc_count` int(11) NOT NULL DEFAULT '0' COMMENT '可配置的最大温度传感器数量[只读]'," + |
| | | " PRIMARY KEY (`num`)," + |
| | | " UNIQUE KEY `idx_dev_id` (`dev_id`) USING BTREE" + |
| | | ") ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='actm 测试参数表';";
|
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
| | | try {
|
| | | if(true == recreate) { |
| | | sql.sqlMysqlExecute(sql_str01);
|
| | | }
|
| | | sql.sqlMysqlExecute(sql_str02);
|
| | | } catch (SQLException e) {
|
| | | e.printStackTrace();
|
| | | } finally {
|
| | | sql.close_con();
|
| | | }
|
| | | }
|
| | | |
| | | /**
|
| | | * 创建 tb_dev_inf
|
| | | * @param pool
|
| | | * @param recreate
|
| | | */
|
| | | public static void createDev_Inf_Table(MysqlConnPool pool, boolean recreate) {
|
| | | String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Dev_Inf_Table;
|
| | | String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Dev_Inf_Table + " (" + |
| | | " `num` int(20) NOT NULL AUTO_INCREMENT," + |
| | | " `dev_id` int(20) DEFAULT '100000001'," + |
| | | " `dev_ip` varchar(200) NOT NULL DEFAULT '0'," + |
| | | " `dev_type` int(20) NOT NULL DEFAULT '1'," + |
| | | " `dev_model` varchar(200) NOT NULL DEFAULT '0'," + |
| | | " `dev_idcode` varchar(200) NOT NULL DEFAULT '0'," + |
| | | " `dev_online` int(11) NOT NULL DEFAULT '1'," + |
| | | " `create_time` date NOT NULL DEFAULT '2024-08-29'," + |
| | | " `batch_state` int(4) NOT NULL DEFAULT '0' COMMENT '设备批量测试状态[0-未批量 1-批量中]'," + |
| | | " `longitude` double(11,8) NOT NULL DEFAULT '0.00000000'," + |
| | | " `latitude` double(11,8) NOT NULL DEFAULT '0.00000000'," + |
| | | " `reload_en` tinyint(4) NOT NULL DEFAULT '1' COMMENT '是否需要重新加载数据[0- 不需要重载 1-需要重载]'," + |
| | | " PRIMARY KEY (`num`)" + |
| | | ") ENGINE=InnoDB DEFAULT CHARSET=utf8;";
|
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
| | | try {
|
| | | if(true == recreate) { |
| | | sql.sqlMysqlExecute(sql_str01);
|
| | | }
|
| | | sql.sqlMysqlExecute(sql_str02);
|
| | | } catch (SQLException e) {
|
| | | e.printStackTrace();
|
| | | } finally {
|
| | | sql.close_con();
|
| | | }
|
| | | }
|
| | | |
| | | /**
|
| | | * 创建 tb_workstate_cfg
|
| | | * @param pool
|
| | | * @param recreate
|
| | | */
|
| | | public static void createWorkstate_Cfg_Table(MysqlConnPool pool, boolean recreate) {
|
| | | String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Workstate_Cfg_Table;
|
| | | String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Workstate_Cfg_Table + " (" + |
| | | " `num` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增主键'," + |
| | | " `dev_type` int(11) NOT NULL DEFAULT '1' COMMENT '设备类型[1-A200充放电一体机 2-ACTM均衡仪]'," + |
| | | " `last_work_state` int(11) NOT NULL DEFAULT '0' COMMENT '上一次工作状态'," + |
| | | " `now_work_state` int(11) NOT NULL DEFAULT '0' COMMENT '当前设备工作状态'," + |
| | | " `event_str` varchar(255) NOT NULL DEFAULT '' COMMENT '事件描述'," + |
| | | " PRIMARY KEY (`num`)," + |
| | | " KEY `idx_dev_type` (`dev_type`) USING BTREE" + |
| | | ") ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备工作切换描述配置表';";
|
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
| | | try {
|
| | | if(true == recreate) { |
| | | sql.sqlMysqlExecute(sql_str01);
|
| | | }
|
| | | sql.sqlMysqlExecute(sql_str02);
|
| | | } catch (SQLException e) {
|
| | | e.printStackTrace();
|
| | | } finally {
|
| | | sql.close_con();
|
| | | }
|
| | | }
|
| | | |
| | | /**
|
| | | * 创建 tb_workstate_changeevent
|
| | | * @param pool
|
| | | * @param recreate
|
| | | */
|
| | | public static void createWorkstate_Changeevent_Table(MysqlConnPool pool, boolean recreate) {
|
| | | String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Workstate_Changeevent_Table;
|
| | | String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Workstate_Changeevent_Table + " (" + |
| | | " `num` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增主键'," + |
| | | " `dev_id` int(11) NOT NULL DEFAULT '0' COMMENT '设备ID'," + |
| | | " `batt_idx` int(11) NOT NULL DEFAULT '0' COMMENT '电池组号[0-组1 1-组2....]'," + |
| | | " `last_work_state` int(11) NOT NULL DEFAULT '0' COMMENT '上一次工作状态'," + |
| | | " `now_work_state` int(11) NOT NULL DEFAULT '0' COMMENT '当前设备工作状态'," + |
| | | " `record_time` datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '设备工作状态切换时间'," + |
| | | " PRIMARY KEY (`num`)," + |
| | | " KEY `idx_dev_id` (`dev_id`) USING BTREE," + |
| | | " KEY `idx_batt_idx` (`batt_idx`) USING BTREE" + |
| | | ") ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备工作状态切换事件表';";
|
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
| | | try {
|
| | | if(true == recreate) { |
| | | sql.sqlMysqlExecute(sql_str01);
|
| | | }
|
| | | sql.sqlMysqlExecute(sql_str02);
|
| | | } catch (SQLException e) {
|
| | | e.printStackTrace();
|
| | | } finally {
|
| | | sql.close_con();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | |
| | | public static void createDB_Lithium_Ram_Db(MysqlConnPool pool) {
|
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
| | | try {
|
| | | sql.sqlMysqlExecute("CREATE DATABASE IF NOT EXISTS " + Sql_Mysql.DB_LITHIUM_RAM_DB);
|
| | | } catch (SQLException e) {
|
| | | e.printStackTrace();
|
| | | } finally {
|
| | | sql.close_con();
|
| | | }
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.database_util;
|
| | |
|
| | | import java.sql.SQLException;
|
| | |
|
| | | import com.sql.MysqlConnPool;
|
| | | import com.sql.Sql_Mysql;
|
| | |
|
| | | public class DB_User {
|
| | | |
| | | public static void init(MysqlConnPool pool, boolean recreate) {
|
| | | //创建数据库
|
| | | createDB_User(pool);
|
| | | |
| | | createBaoJiGroup_Table(pool, recreate);
|
| | |
|
| | | createBattGroup_BaoJiGroup_Table(pool, recreate);
|
| | | |
| | | createBattGroup_Usr_Table(pool, recreate);
|
| | | |
| | | createOperation_Log_Table(pool, recreate);
|
| | | |
| | | createUser_Inf_Table(pool, recreate);
|
| | | |
| | | createTemp_Numbers_Table(pool, recreate);
|
| | | }
|
| | | |
| | | /**
|
| | | * 创建 tb_baojigroup
|
| | | * @param pool
|
| | | * @param recreate
|
| | | */
|
| | | public static void createBaoJiGroup_Table(MysqlConnPool pool, boolean recreate) {
|
| | | String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.BaoJiGroup_Table;
|
| | | String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.BaoJiGroup_Table + " (" + |
| | | " `num` int(20) NOT NULL AUTO_INCREMENT," + |
| | | " `baoji_group_id` int(20) DEFAULT '0'," + |
| | | " `baoji_group_name` varchar(200) NOT NULL DEFAULT '0'," + |
| | | " PRIMARY KEY (`num`)" + |
| | | ") ENGINE=InnoDB DEFAULT CHARSET=utf8;";
|
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
| | | try {
|
| | | if(true == recreate) { |
| | | sql.sqlMysqlExecute(sql_str01);
|
| | | }
|
| | | sql.sqlMysqlExecute(sql_str02);
|
| | | } catch (SQLException e) {
|
| | | e.printStackTrace();
|
| | | } finally {
|
| | | sql.close_con();
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 创建 tb_battgroup_baojigroup
|
| | | * @param pool
|
| | | * @param recreate
|
| | | */
|
| | | public static void createBattGroup_BaoJiGroup_Table(MysqlConnPool pool, boolean recreate) {
|
| | | String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.BattGroup_BaoJiGroup_Table;
|
| | | String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.BattGroup_BaoJiGroup_Table + " (" + |
| | | " `num` bigint(20) NOT NULL AUTO_INCREMENT," + |
| | | " `baoji_group_id` int(11) NOT NULL DEFAULT '0'," + |
| | | " `dev_id` int(11) NOT NULL DEFAULT '0'," + |
| | | " PRIMARY KEY (`num`)," + |
| | | " KEY `index_group_id` (`baoji_group_id`)" + |
| | | ") ENGINE=InnoDB DEFAULT CHARSET=utf8;";
|
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
| | | try {
|
| | | if(true == recreate) { |
| | | sql.sqlMysqlExecute(sql_str01);
|
| | | }
|
| | | sql.sqlMysqlExecute(sql_str02);
|
| | | } catch (SQLException e) {
|
| | | e.printStackTrace();
|
| | | } finally {
|
| | | sql.close_con();
|
| | | }
|
| | | }
|
| | | |
| | | /**
|
| | | * 创建 tb_battgroup_usr
|
| | | * @param pool
|
| | | * @param recreate
|
| | | */
|
| | | public static void createBattGroup_Usr_Table(MysqlConnPool pool, boolean recreate) {
|
| | | String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.BattGroup_Usr_Table;
|
| | | String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.BattGroup_Usr_Table + " (" + |
| | | " `num` bigint(20) NOT NULL AUTO_INCREMENT," + |
| | | " `baoji_group_id` int(11) NOT NULL DEFAULT '0'," + |
| | | " `uid` int(11) NOT NULL DEFAULT '0'," + |
| | | " PRIMARY KEY (`num`)," + |
| | | " KEY `index_group_id` (`baoji_group_id`)" + |
| | | ") ENGINE=InnoDB DEFAULT CHARSET=utf8;";
|
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
| | | try {
|
| | | if(true == recreate) { |
| | | sql.sqlMysqlExecute(sql_str01);
|
| | | }
|
| | | sql.sqlMysqlExecute(sql_str02);
|
| | | } catch (SQLException e) {
|
| | | e.printStackTrace();
|
| | | } finally {
|
| | | sql.close_con();
|
| | | }
|
| | | }
|
| | | |
| | | /**
|
| | | * 创建 tb_operation_log
|
| | | * @param pool
|
| | | * @param recreate
|
| | | */
|
| | | public static void createOperation_Log_Table(MysqlConnPool pool, boolean recreate) {
|
| | | String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Operation_Log_Table;
|
| | | String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Operation_Log_Table + " (" + |
| | | " `id` int(11) NOT NULL AUTO_INCREMENT," + |
| | | " `user_id` int(11) DEFAULT NULL," + |
| | | " `user_name` varchar(45) DEFAULT NULL," + |
| | | " `type1` int(11) DEFAULT NULL COMMENT '事件类型:1-系统级,2-业务级'," + |
| | | " `type2` int(11) DEFAULT NULL COMMENT '事件类型:子级别'," + |
| | | " `msg` varchar(45) DEFAULT NULL COMMENT '基础信息'," + |
| | | " `detail` varchar(21000) DEFAULT NULL COMMENT '详细信息'," + |
| | | " `ip` varchar(45) DEFAULT NULL COMMENT '操作的ip'," + |
| | | " `create_time` datetime DEFAULT NULL," + |
| | | " PRIMARY KEY (`id`)" + |
| | | ") ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户操作日志';";
|
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
| | | try {
|
| | | if(true == recreate) { |
| | | sql.sqlMysqlExecute(sql_str01);
|
| | | }
|
| | | sql.sqlMysqlExecute(sql_str02);
|
| | | } catch (SQLException e) {
|
| | | e.printStackTrace();
|
| | | } finally {
|
| | | sql.close_con();
|
| | | }
|
| | | }
|
| | | |
| | | /**
|
| | | * 创建 tb_user_inf
|
| | | * @param pool
|
| | | * @param recreate
|
| | | */
|
| | | public static void createUser_Inf_Table(MysqlConnPool pool, boolean recreate) {
|
| | | String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.User_Inf_Table;
|
| | | String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.User_Inf_Table + " (" + |
| | | " `uid` int(11) NOT NULL AUTO_INCREMENT," + |
| | | " `uname` varchar(64) NOT NULL DEFAULT '0' COMMENT '用户名字'," + |
| | | " `usnid` varchar(1000) NOT NULL DEFAULT '0' COMMENT '用户密码'," + |
| | | " `udownload_role` int(16) NOT NULL DEFAULT '0' COMMENT '下载权限'," + |
| | | " PRIMARY KEY (`uid`)" + |
| | | ") ENGINE=InnoDB DEFAULT CHARSET=utf8;";
|
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
| | | try {
|
| | | if(true == recreate) { |
| | | sql.sqlMysqlExecute(sql_str01);
|
| | | }
|
| | | sql.sqlMysqlExecute(sql_str02);
|
| | | } catch (SQLException e) {
|
| | | e.printStackTrace();
|
| | | } finally {
|
| | | sql.close_con();
|
| | | }
|
| | | }
|
| | | |
| | | /**
|
| | | * 创建 temp_numbers
|
| | | * @param pool
|
| | | * @param recreate
|
| | | */
|
| | | public static void createTemp_Numbers_Table(MysqlConnPool pool, boolean recreate) {
|
| | | String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.Temp_Numbers_Table;
|
| | | String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Temp_Numbers_Table + " (" + |
| | | " `unumber` int(11) DEFAULT NULL" + |
| | | ") ENGINE=InnoDB DEFAULT CHARSET=utf8;";
|
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
| | | try {
|
| | | if(true == recreate) { |
| | | sql.sqlMysqlExecute(sql_str01);
|
| | | }
|
| | | sql.sqlMysqlExecute(sql_str02);
|
| | | } catch (SQLException e) {
|
| | | e.printStackTrace();
|
| | | } finally {
|
| | | sql.close_con();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | |
| | | public static void createDB_User(MysqlConnPool pool) {
|
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
| | | try {
|
| | | sql.sqlMysqlExecute("CREATE DATABASE IF NOT EXISTS " + Sql_Mysql.DB_USER);
|
| | | } catch (SQLException e) {
|
| | | e.printStackTrace();
|
| | | } finally {
|
| | | sql.close_con();
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | Integer[] temp3= {1,2,3,4,5,6,7,8,2001,2002,2003,2004,2005,2006,2007,2008,2009,3001,3002,3003,3004,3005,3006,3007,3008,3009,3010,3011,3012,3013,4001,4002,4003,4004,4005,4006,4007,4008,4009,4010,4011,4012,4013,5001,5002,5003,5004,5005,5006,5007,5008,6001,6002,6003,6004,7001,7002,7003,7004,7005,8001,8002,8003}; |
| | | idsDefault_tb_menu = Arrays.asList(temp3); |
| | | sqlstb_tb_menu = new ArrayList<>(); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('1', 'Home', '首页', 'home', '/home', 'el-icon-s-home', '0', '1', null, '1', '1', '0');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('2', 'Online Monitoring', '在线监测', 'testData', '', 'el-icon-s-data', '0', '1', null, '1', '2', '2');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('3', 'Data Management', '数据管理', 'dataMager', '', 'el-icon-s-help', '0', '1', null, '1', '3', '3');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('4', 'Alarm Management', '告警管理', 'alarmMager', '', 'el-icon-message-solid', '0', '1', null, '1', '4', '4');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('5', 'Report Statistics', '报表统计', 'reportStatistics', '', 'el-icon-tickets', '0', '1', null, '1', '5', '5');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('6', 'Device Management', '作业管理', 'jobManage', '', 'el-icon-s-cooperation', '0', '1', null, '1', '6', '6');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('7', 'User Management', '用户管理', 'userMager', '', 'el-icon-user-solid', '0', '1', null, '1', '7', '7');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('8', 'System Setting', '系统设置', 'systemPageSetting', '', 'el-icon-s-management', '0', '1', null, '1', '8', '8');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('2001', 'Real-time Monitoring', '实时监控', 'movingRingSystem', '/dataTest/movingRingSystem', null, '1', '1', null, '2', '1', '2');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('2002', 'Data Viewing', '历史数据', 'history', '/dataTest/history', null, '1', '1', null, '2', '2', '2');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('2003', 'Data Management', '历史数据管理', 'historyInfoMager', '/dataTest/historyInfoMager', null, '1', '1', null, '2', '3', '2');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('2004', 'Standard Curve', '标准曲线', 'standardLine', '/dataTest/standardLine', null, '1', '1', null, '2', '4', '2');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('2005', 'Device Status Search', '设备状态查询', 'btsStatus', '/dataTest/btsStatus', null, '1', '1', null, '2', '5', '2');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('2006', 'FGCD Tester Import Record', '一体机导入记录', 'historyAio', '/dataTest/historyAio', null, '1', '1', null, '2', '6', '2');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('2007', 'Comm Alarm Parameter Rule', '通信电源告警规则', 'hfSwitch', '/dataTest/hfSwitch', null, '1', '1', null, '2', '7', '2');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('2008', 'Telemetering of AC Distribution Cabinet', '交流配电柜遥测量', 'GGDmeasure', '/dataTest/GGDmeasure', null, '1', '1', null, '2', '8', '2');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('2009', 'Discharger Data Analysis', '放电仪放电数据分析', 'dischargeMeterData', '/dataTest/dischargeMeterData', null, '1', '1', null, '2', '9', '2');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('3001', 'Power Supply Setting', '电源信息配置', 'powerMager', '/dataMager/powerMager', null, '1', '1', null, '2', '1', '3');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('3002', 'Battery Info Management', '电池信息管理', 'battGroupMager', '/dataMager/battGroupMager', null, '1', '1', 'batttest_data_query_permit', '2', '2', '3');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('3003', 'Equipment Room Info Manaement', '机房信息管理', 'totalStation', '/dataMager/totalStation', null, '1', '1', 'batttest_data_query_permit', '2', '3', '3');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('3004', 'Battery Info Statistics Analysis', '电池信息统计分析', 'produceTotal', '/dataMager/produceTotal', null, '1', '1', null, '2', '4', '3');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('3005', 'Background Thread Management', '后台线程管理', 'threadMager', '/dataMager/threadMager', null, '1', '1', 'batttest_data_query_permit', '2', '5', '3');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('3006', 'Equipment Room Status Search', '机房状态查询', 'powercut', '/dataMager/powercut', null, '1', '1', 'batttest_data_query_permit', '2', '6', '3');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('3007', 'Battery Management', '电池关注管理', 'batteryMager', '/dataMager/batteryMager', null, '1', '1', 'batttest_data_query_permit', '2', '7', '3');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('3008', 'Device Working Status', '设备工作状态', 'deviceWorkState', '/dataMager/deviceWorkState', null, '1', '1', null, '2', '8', '3');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('3009', 'Dead Battery Management', '报废电池信息管理', 'scrapBattery', '/dataMager/scrapBattery', null, '1', '1', null, '2', '9', '3');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('3010', 'Spare Battery Management', '备件电池信息管理', 'repairBattery', '/dataMager/repairBattery', null, '1', '1', null, '2', '10', '3');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('3011', 'Electricity Rate Distribution Template', '电价分布模板管理', 'elePriceDistributionTpl', '/dataMager/elePriceDistributionTpl', null, '1', '1', null, '2', '11', '3');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('3012', 'FGCD Equipment Room Import', '一体机机房导入', 'aioStationImport', '/dataMager/aioStationImport', null, '1', '1', null, '2', '12', '3');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('3013', 'Carbon Neutral', '碳中和', 'carbonInfo', '/dataMager/carbonInfo', null, '1', '1', null, '2', '13', '3');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('4001', 'Power Supply Real-time Alarm', '电源实时告警', 'powerRealtimeInfo', '/alarmMager/powerRealtimeInfo', null, '1', '1', null, '2', '1', '4');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('4002', 'Power Supply History Alarm', '电源历史告警', 'powerHistoryInfo', '/alarmMager/powerHistoryInfo', null, '1', '1', null, '2', '2', '4');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('4003', 'Battery Alarm Real-time Search', '电池告警实时查询', 'batteryrTimequery', '/alarmMager/batteryrTimequery', null, '1', '1', 'batt_alm_query_permit', '2', '3', '4');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('4004', 'Battery Alarm History Search', '电池告警历史查询', 'batteryrHistoryquery', '/alarmMager/batteryrHistoryquery', null, '1', '1', 'batt_alm_query_permit', '2', '4', '4');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('4005', 'Device Alarm Real-time Search', '设备告警实时查询', 'deviceTimequery', '/alarmMager/deviceTimequery', null, '1', '1', 'dev_alm_query_permit', '2', '5', '4');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('4006', 'Device Alarm History Search', '设备告警历史查询', 'deviceHistoryquery', '/alarmMager/deviceHistoryquery', null, '1', '1', 'dev_alm_query_permit', '2', '6', '4');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('4007', 'Comm Power Real-time Alarm', '通信电源实时告警', 'powerBoxAlarm', '/alarmMager/powerBoxAlarm', null, '1', '1', null, '2', '7', '4');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('4008', 'Comm Power History Alarm', '通信电源历史告警', 'powerBoxHistoryAlarm', '/alarmMager/powerBoxHistoryAlarm', null, '1', '1', null, '2', '8', '4');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('4009', 'Comm Power Timeout Alarm', '通信电源超时告警', 'powerAlarmTimeout', '/alarmMager/powerAlarmTimeout', null, '1', '1', null, '2', '9', '4');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('4010', 'Comm Alarm Parameter Rule', '通信电源告警规则', 'powerCabinetSetting', '/alarmMager/powerCabinetSetting', null, '1', '1', null, '2', '10', '4');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('4011', 'Battery Alarm Parameter Setting', '电池告警参数设置', 'devicepaSetting', '/alarmMager/devicepaSetting', null, '1', '1', 'batt_alm_param_query_permit', '2', '11', '4');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('4012', 'Alarm Assign Management', '告警派单管理', 'alarmDispatch', '/alarmMager/alarmDispatch', null, '1', '1', null, '2', '12', '4');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('4013', 'Alarm Preprocess Management', '告警预处理管理', 'alarmHandle', '/alarmMager/alarmHandle', null, '1', '1', 'batt_alm_param_query_permit', '2', '13', '4');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('5001', 'Battery Group Statistics Search', '电池组统计分析查询', 'eleAnalyse', '/reportStatistics/eleAnalyse', null, '1', '1', null, '2', '1', '5');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('5002', 'Cell Statistics Search', '电池单体统计分析查询', 'eleMonomer', '/reportStatistics/eleMonomer', null, '1', '1', null, '2', '2', '5');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('5003', 'Battery Group Post-Evaluation', '蓄电池组后评估', 'eleAssess', '/reportStatistics/eleAssess', null, '1', '1', null, '2', '3', '5');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('5004', 'Lagging Cell Search', '落后单体查询', 'taskplan', '/reportStatistics/taskplan', null, '1', '1', null, '2', '4', '5');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('5005', 'Battery Real-time Status Search', '电池实时状态查询', 'elestatus', '/reportStatistics/elestatus', null, '1', '1', null, '2', '5', '5');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('5006', 'Battery Life History Search', '电池续航能力历史查询', 'endure', '/reportStatistics/endure', null, '1', '1', null, '2', '6', '5');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('5007', 'Comm Power Report', '通信电源报表', 'powerReport', '/reportStatistics/powerReport', null, '1', '1', null, '2', '7', '5');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('5008', 'Event Summary Table', '事件总表', 'eventTotalPage', '/reportStatistics/eventTotalPage', null, '1', '1', null, '2', '8', '5');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('6001', 'BTS Equipment Upgrade', 'BTS设备升级', 'btsUpgrade', '/jobManage/btsUpgrade', null, '1', '1', null, '2', '1', '6');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('6002', 'Discharge Plan Management', '放电计划管理', 'planManage', '/jobManage/planManage', null, '1', '1', null, '2', '2', '6');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('6003', 'LD-9 Device Upgrade', '9度设备升级', 'nineDevUpdate', '/jobManage/nineDevUpdate', null, '1', '1', null, '2', '3', '6');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('6004', 'FGCD Tester Upgrade', '一体机设备升级', 'aioUpdate', '/jobManage/aioUpdate', null, '1', '1', null, '2', '4', '6');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('7001', 'User Info Management', '用户信息管理', 'userInfoMager', '/userMager/userInfo', null, '1', '1', 'usr_query_permit', '2', '1', '7');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('7002', 'User Facial Recognition', '用户人脸管理', 'userFaceManager', '/userMager/userFaceManager', null, '1', '1', null, '2', '2', '7');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('7003', 'Authority Management', '权限管理', 'powerMager', '/userMager/powerMager', null, '1', '1', 'permit_query_permit', '2', '3', '7');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('7004', 'Work Team Management', '包机组管理', 'baojiMager', '/userMager/baojiMager', null, '1', '1', 'usr_query_permit', '2', '4', '7');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('7005', 'Operation Event Management', '操作事件管理', 'operationRecordMager', '/userMager/operationRecord', null, '1', '1', null, '2', '5', '7');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('8001', 'System Configuration', '系统配置', 'realTimeSetting', '/pageSetting/realTime', null, '1', '1', 'batt_test_op_permit', '2', '1', '8');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('8002', '3D Equipement Room Config.', '3D机房配置', 'threeHomeSetting', '/pageSetting/threeHomeSetting', null, '1', '1', null, '2', '2', '8');"); |
| | | sqlstb_tb_menu.add("INSERT INTO " + Sql_Mysql.Menu_Table + "(id,lableEnUs,label,name,src,icon,closable,enableduse,permitName,level,ord,menuId) VALUES ('8003', 'Map Configuration', '地图配置', 'chartMapSetting', '/pageSetting/chartMapSetting', null, '1', '1', null, '2', '3', '8');"); |
| | | |
| | | } |
| | | |
| | |
| | | import java.util.Date; |
| | | |
| | | import com.base.Com; |
| | | import com.battdata_rt.BattData_RT_RamDB_Thread_SQL; |
| | | import com.config.AppConfig; |
| | | import com.config.AppParam; |
| | | import com.database_util.DB_Alarm; |
| | | import com.database_util.DB_App_Sys; |
| | | import com.database_util.DB_Batt_History; |
| | | import com.database_util.DB_Batt_Testdata; |
| | | import com.database_util.DB_Dev_History; |
| | | import com.database_util.DB_Dev_TestParam; |
| | | import com.database_util.DB_Fbo_testdata; |
| | | import com.database_util.DB_Ied_Scout; |
| | | import com.database_util.DB_Ld9_Testdata; |
| | | import com.database_util.DB_Nj_Measurement; |
| | | import com.database_util.DB_Param; |
| | | import com.database_util.DB_Pwrdev_Alarm; |
| | | import com.database_util.DB_Pwrdev_Data_History; |
| | | import com.database_util.DB_Pwrdev_Data_History_GW; |
| | | import com.database_util.DB_Pwrdev_Data_Rt; |
| | | import com.database_util.DB_Pwrdev_Inf; |
| | | import com.database_util.DB_Ram_db; |
| | | import com.database_util.DB_Upspwrdev_Alarm; |
| | | import com.database_util.DB_Upspwrdev_Data_History; |
| | | import com.database_util.DB_battinf; |
| | | import com.database_util.DB_db_user; |
| | | import com.database_util.DB_App_Config; |
| | | import com.database_util.DB_Batt_TestData; |
| | | import com.database_util.DB_Lithium_Ram_Db; |
| | | import com.database_util.DB_User; |
| | | import com.database_util.DB_web_site; |
| | | import com.dev.fbs9100.FBS9100S_DFU_SQL; |
| | | import com.dev.fbs9100.FBS9100_Task_Thread_SQL; |
| | | import com.sql.MysqlConnPool; |
| | | import com.sql.Sql_Mysql; |
| | | |
| | |
| | | public static int MysqlServer_Port = DEF_MysqlServerFBS_Port; |
| | | |
| | | private static AppConfig m_AppConfig; |
| | | private static AppParam m_AppParam; |
| | | |
| | | private static MysqlConnPool GB_MysqlConnPool; |
| | | |
| | |
| | | //*********************************************************************************// |
| | | //boolean recreate_tb = m_AppConfig.getMysqlDB_RecreateEn(); |
| | | boolean recreate_tb = false; |
| | | |
| | | //初始化数据库 db_battinf |
| | | DB_battinf.init(GB_MysqlConnPool, recreate_tb); |
| | | |
| | | //初始话db_ram_db数据库 |
| | | DB_Ram_db.init(GB_MysqlConnPool, recreate_tb); |
| | | |
| | | //创建tb_batt_rtstate表格并且将电池组id的值 |
| | | BattData_RT_RamDB_Thread_SQL.createBattState_RT_RamDB_Table(GB_MysqlConnPool, recreate_tb); |
| | | //创建tb_batt_rtdata表格并且将电池组id的值 |
| | | BattData_RT_RamDB_Thread_SQL.createBattData_RT_RamDB_Table(GB_MysqlConnPool, recreate_tb); |
| | | //创建tb_server_state表并且设置表中的值 |
| | | BattData_RT_RamDB_Thread_SQL.createServerState_RamDB_Table(GB_MysqlConnPool, recreate_tb); |
| | | |
| | | //创建tb_bts_gprs_state表 |
| | | BattData_RT_RamDB_Thread_SQL.createBTSGPRSState_Table(GB_MysqlConnPool, recreate_tb); |
| | | |
| | | //创建tb_fbs9100_battparam表 |
| | | BattData_RT_RamDB_Thread_SQL.createBattParam_Table(GB_MysqlConnPool, recreate_tb); |
| | | |
| | | /*********************************************************************************/ |
| | | System.out.println("Recreate RamDB Tables State Is '" + recreate_tb + "'" + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms)); |
| | | if(true == recreate_tb) { |
| | | |
| | | //创建tb_fbs9100s_dcdc_data表 |
| | | FBS9100_Task_Thread_SQL.createFBS9100S_DCDC_DataTableOnRam(GB_MysqlConnPool); |
| | | //创建CmccPowerData表 |
| | | FBS9100_Task_Thread_SQL.createFBS9100CmccPowerDataOnRam(GB_MysqlConnPool); |
| | | |
| | | } |
| | | |
| | | //创建tb_fbs9100S_DFU_StateTable表并向表中添加数据[修复数据库中缺失字段bug] |
| | | FBS9100S_DFU_SQL.createFBS9100S_DFU_TableOnRam(GB_MysqlConnPool,recreate_tb); |
| | | |
| | | |
| | | //创建BTSStationState_Table表 |
| | | FBS9100_Task_Thread_SQL.createBTSStationState_TableOnRam(GB_MysqlConnPool,recreate_tb); |
| | | |
| | | //创建设备状态表 |
| | | FBS9100_Task_Thread_SQL.createFBS9100SysParam_TableOnRam(GB_MysqlConnPool,recreate_tb); |
| | | |
| | | //初始化录入机房状态 |
| | | FBS9100_Task_Thread_SQL.insertBTSStationState_TableOnRam(GB_MysqlConnPool); |
| | | |
| | | //重新纠正机房状态表中的机房id和设备id之间的对应关系 |
| | | FBS9100_Task_Thread_SQL.checkBTSStationState_TableOnRam(GB_MysqlConnPool); |
| | | |
| | | //创建61850均衡模块信息表 |
| | | FBS9100_Task_Thread_SQL.createTB_61850_JHState_TableOnRam(GB_MysqlConnPool,recreate_tb); |
| | | |
| | | //创建61850离线养护计划参数表 |
| | | FBS9100_Task_Thread_SQL.createFBS9100_offlineyhplanOnRam(GB_MysqlConnPool, recreate_tb); |
| | | |
| | | |
| | | |
| | | //初始化数据库 web_site |
| | | DB_web_site.init(GB_MysqlConnPool, recreate_tb); |
| | | |
| | | //初始化数据库 db_user |
| | | DB_db_user.init(GB_MysqlConnPool, recreate_tb); |
| | | |
| | | //初始化告警数据库 db_alarm |
| | | DB_Alarm.init(GB_MysqlConnPool, recreate_tb); |
| | | |
| | | //System.out.println("===="+Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms)); |
| | | //初始化软件配置信息表 db_app_sys |
| | | DB_App_Sys.init(GB_MysqlConnPool, recreate_tb); |
| | | |
| | | //初始化电池组历史实时记录库 db_batt_history |
| | | DB_Batt_History.init(GB_MysqlConnPool, recreate_tb); |
| | | |
| | | //初始化9度历史数据数据库 db_ld9_testdata |
| | | DB_Ld9_Testdata.init(GB_MysqlConnPool, recreate_tb); |
| | | |
| | | //初始化DB_Batt_Testdata数据库 db_ld9_testdata |
| | | DB_Batt_Testdata.init(GB_MysqlConnPool, recreate_tb); |
| | | |
| | | //初始化参数数据库 db_param |
| | | DB_Param.init(GB_MysqlConnPool, recreate_tb); |
| | | |
| | | DB_Pwrdev_Inf.init(GB_MysqlConnPool, recreate_tb); |
| | | |
| | | DB_Pwrdev_Alarm.init(GB_MysqlConnPool, recreate_tb); |
| | | |
| | | DB_Pwrdev_Data_Rt.init(GB_MysqlConnPool, recreate_tb); |
| | | DB_App_Config.init(GB_MysqlConnPool, recreate_tb); |
| | | |
| | | |
| | | //System.out.println("===="+Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms)); |
| | | //初始化FBO历史文件数据表 |
| | | DB_Fbo_testdata.init(GB_MysqlConnPool, recreate_tb); |
| | | //初始化数据库 db_battinf |
| | | DB_web_site.init(GB_MysqlConnPool, recreate_tb); |
| | | |
| | | DB_App_Config.init(GB_MysqlConnPool, recreate_tb); |
| | | |
| | | //初始化设备历史实时数据库表 |
| | | DB_Dev_History.init(GB_MysqlConnPool, recreate_tb); |
| | | DB_Batt_TestData.init(GB_MysqlConnPool, recreate_tb); |
| | | |
| | | DB_Dev_TestParam.init(GB_MysqlConnPool, recreate_tb); |
| | | DB_Lithium_Ram_Db.init(GB_MysqlConnPool, recreate_tb); |
| | | |
| | | DB_Pwrdev_Data_History.init(GB_MysqlConnPool, recreate_tb); |
| | | |
| | | DB_Pwrdev_Data_History_GW.init(GB_MysqlConnPool, recreate_tb); |
| | | |
| | | DB_Upspwrdev_Alarm.init(GB_MysqlConnPool, recreate_tb); |
| | | |
| | | DB_Upspwrdev_Data_History.init(GB_MysqlConnPool, recreate_tb); |
| | | |
| | | DB_Ied_Scout.init(GB_MysqlConnPool, recreate_tb); |
| | | |
| | | DB_Nj_Measurement.init(GB_MysqlConnPool, recreate_tb); |
| | | |
| | | |
| | | //设置重启告警线程 |
| | | DB_web_site.setUpThreadRestart(GB_MysqlConnPool); |
| | | |
| | | if(true == m_AppConfig.getMysqlDB_RecreateEn()) { |
| | | m_AppConfig.setMysqlDB_RecreateEn(false); |
| | | m_AppConfig.writeConfigToXml(); |
| | | } |
| | | //修改tb_app_sys表中的关键字,让主程序识别 |
| | | for(int i=0;i<5;i++) { |
| | | |
| | | } |
| | | try { |
| | | Thread.sleep(1000); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | //初始化db_param. |
| | | m_AppParam = new AppParam(GB_MysqlConnPool); |
| | | |
| | | //修复某些基站第一次记录的充放电无法显示bug |
| | | FBS9100_Task_Thread_SQL.repairBattFirstTestData(GB_MysqlConnPool); |
| | | DB_User.init(GB_MysqlConnPool, recreate_tb); |
| | | |
| | | System.out.println("BTS DB BUILDER Work Done @ " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms)); |
| | | /* |