蓄电池监控管理平台数据库初始化程序
DELL
2025-03-28 f68b1474d1c63060dc56b8f826074432cde168bc
更新
2个文件已添加
11个文件已修改
390 ■■■■■ 已修改文件
BattMonitor_DB_Builder/bin/com/battdata_rt/PowerData_RT_Array.class 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/bin/com/battdata_rt/PowerData_RT_SQL.class 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/bin/com/sql/util/Db_Alarm.class 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/bin/com/sql/util/Db_Batt.class 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/bin/com/sql/util/Db_Lithium_Ram_Db.class 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/bin/com/sql/util/Db_Param.class 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/bin/com/sql/util/Db_Power_Alarm.class 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/com/sql/MysqlConnPool.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/com/sql/Sql_Mysql.java 42 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/com/sql/util/Db_Batt.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/com/sql/util/Db_Lithium_Ram_Db.java 318 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/com/sql/util/Db_Power_Alarm.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/main/main_BTS_DB_Builder.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/bin/com/battdata_rt/PowerData_RT_Array.class
Binary files differ
BattMonitor_DB_Builder/bin/com/battdata_rt/PowerData_RT_SQL.class
Binary files differ
BattMonitor_DB_Builder/bin/com/sql/util/Db_Alarm.class
Binary files differ
BattMonitor_DB_Builder/bin/com/sql/util/Db_Batt.class
Binary files differ
BattMonitor_DB_Builder/bin/com/sql/util/Db_Lithium_Ram_Db.class
Binary files differ
BattMonitor_DB_Builder/bin/com/sql/util/Db_Param.class
Binary files differ
BattMonitor_DB_Builder/bin/com/sql/util/Db_Power_Alarm.class
Binary files differ
BattMonitor_DB_Builder/src/com/sql/MysqlConnPool.java
@@ -46,7 +46,8 @@
        this.mysql_ds.setJdbcUrl("jdbc:highgo://" + server_ip + ":" + port + "/highgo");
        this.mysql_ds.setUser("sysdba");
//        this.mysql_ds.setPassword("Lmx&8688139");
        this.mysql_ds.setPassword("Fg001@HDW");            //新密码
//        this.mysql_ds.setPassword("Fg001@HDW");            //新密码
        this.mysql_ds.setPassword("Fg001@HDWw");        //2025-03-25新密码
        this.mysql_ds.setMaxPoolSize(conncount_max);
        this.mysql_ds.setMinPoolSize(2);
        this.mysql_ds.setIdleConnectionTestPeriod(300);
BattMonitor_DB_Builder/src/com/sql/Sql_Mysql.java
@@ -15,13 +15,18 @@
public class Sql_Mysql 
{
    /**********************************************************************/
    public static final String DB_ALARM     = "`db_alarm`";
    public static final String DB_BATT         = "`db_batt`";
    public static final String DB_ALARM             = "db_alarm";
    public static final String DB_BATT                 = "db_batt";
    public static final String DB_DIS_BATT     = "db_dis_batt";
    public static final String DB_POWER_RT     = "`db_power_rt`";
    public static final String DB_REAL_BATT = "`db_real_batt`";
    public static final String DB_PARAM     = "`db_param`";
    public static final String DB_POWER_ALARM     = "`db_power_alarm`";
    public static final String DB_POWER_RT             = "db_power_rt";
    public static final String DB_REAL_BATT         = "db_real_batt";
    public static final String DB_PARAM             = "db_param";
    public static final String DB_POWER_ALARM         = "db_power_alarm";
    public static final String DB_LITHIUM_RAM_DB     = "db_lithium_ram_db";
    public static final String DB_LITHIUM_TESTDATA     = "db_lithium_testdata";
    public static final String DB_WORK                 = "db_work";
    public static final String DB_USER                 = "db_user";
    
    
    /**********************************************************************/
@@ -42,8 +47,8 @@
    
    
    /******************************* db_real_batt ***************************************/
    public static final String Rt_Data_Table = DB_REAL_BATT + ".`rt_data`";                                //蓄电池单体实时
    public static final String Rt_State_Table = DB_REAL_BATT + ".`rt_state`";                            //蓄电池单体实时
    public static final String Rt_Data_Table = DB_REAL_BATT + ".rt_data";                                //蓄电池单体实时
    public static final String Rt_State_Table = DB_REAL_BATT + ".rt_state";                            //蓄电池单体实时
    
    /******************************* db_param ***************************************/
@@ -58,6 +63,27 @@
    public static final String Batt_Alarm_Table = DB_ALARM + ".batt_alarm";                        //电源实时告警分表
    
    /**********************************************************************/
    /**********************************************************************/
    public static final String A200_RealState_Table                 = DB_LITHIUM_RAM_DB + ".tb_a200_realstate";                        //电源实时告警分表
    public static final String Dev_A200_TestParam_Table             = DB_LITHIUM_RAM_DB + ".tb_dev_a200_testparam";                    //电源实时告警分表
    public static final String Dev_Inf_Table                         = DB_LITHIUM_RAM_DB + ".tb_dev_inf";                            //电源实时告警分表
    public static final String Lithium_Rtdata_Table                 = DB_LITHIUM_RAM_DB + ".tb_lithium_rtdata";                        //电源实时告警分表
    public static final String Workstate_Cfg_Table                     = DB_LITHIUM_RAM_DB + ".tb_workstate_cfg";                        //电源实时告警分表
    public static final String Workstate_ChangeEvent_Table             = DB_LITHIUM_RAM_DB + ".tb_workstate_changeevent";                //电源实时告警分表
    /**********************************************************************/
    public static final String BattTestdata_Inf_Table                 = DB_LITHIUM_TESTDATA + ".tb_batttestdata_inf";                //电源实时告警分表
    /**********************************************************************/
    public static final String Operation_Log_Table                     = DB_USER + ".operation_log";                //电源实时告警分表
    public static final String Temp_Numbers_Table                     = DB_USER + ".temp_numbers";                //电源实时告警分表
    public static final String User_Inf_Table                         = DB_USER + ".user_inf";                //电源实时告警分表
    /**********************************************************************/
    public static final String Worksheet_Link_Table                 = DB_WORK + ".worksheet_link";                //电源实时告警分表
    public static final String Worksheet_Main_Table                 = DB_WORK + ".worksheet_main";                //电源实时告警分表
    /**********************************************************************/
    //--------------------------------------------------------------------------------------------//
    public Connection mysql_con;
    
BattMonitor_DB_Builder/src/com/sql/util/Db_Batt.java
@@ -62,7 +62,7 @@
            sql.sqlMysqlExecute(sql_str_auto);
            
            String sql_str = " CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Sinf_Pinf_Table + " "
                            + "(num integer NOT NULL DEFAULT nextval('" + Sql_Mysql.Sinf_Pinf_Table + "db_batt.sinf_pinf_auto'::regclass)," +
                            + "(num integer NOT NULL DEFAULT nextval('" + Sql_Mysql.Sinf_Pinf_Table + "_auto'::regclass)," +
                            "    sinf_id integer NOT NULL," + 
                            "    pinf_id integer NOT NULL," + 
                            "     PRIMARY KEY (num)" + 
@@ -104,6 +104,12 @@
                            "    mon_cap integer NOT NULL DEFAULT 150," + 
                            "    mon_res double precision NOT NULL DEFAULT '0.4'::double precision," + 
                            "    load_curr double precision NOT NULL DEFAULT '0'::double precision," + 
                            "    sip_num character(32) NOT NULL COLLATE pg_catalog.\"default\" DEFAULT '127.0.0.1'::character varying," +
                            "    channel_count integer NOT NULL DEFAULT 1," +
                            "    create_time timestamp without time zone NOT NULL DEFAULT '2000-01-01 00:00:00'::timestamp without time zone," +
                            "    update_time timestamp without time zone NOT NULL DEFAULT '2000-01-01 00:00:00'::timestamp without time zone," +
                            "     PRIMARY KEY (power_id)" + 
                            ")";
            sql.sqlMysqlExecute(sql_str);
@@ -123,6 +129,14 @@
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Power_Inf_Table + ".mon_res IS '标称内阻';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Power_Inf_Table + ".load_curr IS '负载电流';");
        
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Power_Inf_Table + ".sip_num IS 'sip编号';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Power_Inf_Table + ".channel_count IS '视频流频道数';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Power_Inf_Table + ".create_time IS '创建时间';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Power_Inf_Table + ".update_time IS '更新时间';");
        
        
        } catch (Exception e) {
BattMonitor_DB_Builder/src/com/sql/util/Db_Lithium_Ram_Db.java
New file
@@ -0,0 +1,318 @@
package com.sql.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) {
        createDb_Lithium_Ram_Db(pool);
        createA200_RealState_Table(pool);
        createDev_A200_TestParam_Table(pool);
        createDev_Inf_Table(pool);
    }
    public static void createDb_Lithium_Ram_Db(MysqlConnPool pool) {
        Sql_Mysql sql = new Sql_Mysql(pool.getConn());
        try {
            sql.sqlMysqlExecute("CREATE SCHEMA IF NOT EXISTS " + Sql_Mysql.DB_LITHIUM_RAM_DB + " AUTHORIZATION sysdba");
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
    /**
     * 创建 db_lithium_ram_db.tb_a200_realstate 数据库表
     * @param conn
     */
    public static void createA200_RealState_Table(MysqlConnPool pool)
    {
        Sql_Mysql sql = new Sql_Mysql(pool.getConn());
        try {
            String sql_str_auto = "CREATE SEQUENCE IF NOT EXISTS " + Sql_Mysql.A200_RealState_Table + "_auto" +
                                 " INCREMENT 1" +
                                 " MINVALUE 1" +
                                 " MAXVALUE 9223372036854775807" +
                                 " START 1" +
                                 " CACHE 1;";
            //创建自增序列
            sql.sqlMysqlExecute(sql_str_auto);
            String sql_str = " CREATE TABLE IF NOT EXISTS " + Sql_Mysql.A200_RealState_Table + " "
                            + "(num bigint NOT NULL DEFAULT nextval('" + Sql_Mysql.A200_RealState_Table + "_auto'::regclass)," +
                            "    dev_id integer NOT NULL DEFAULT 1," +
                            "    record_time timestamp without time zone NOT NULL DEFAULT '2000-01-01 00:00:00'::timestamp without time zone," +
                            "    battery_name character varying NOT NULL COLLATE pg_catalog.\"default\" DEFAULT ''::character varying," +
                            "    test_type integer NOT NULL DEFAULT 2," +
                            "    is_testing integer NOT NULL DEFAULT 0," +
                            "    start_test_time timestamp without time zone NOT NULL DEFAULT '2000-01-01 00:00:00'::timestamp without time zone," +
                            "    test_duration integer NOT NULL DEFAULT 0," +
                            "    stop_test_time timestamp without time zone NOT NULL DEFAULT '2000-01-01 00:00:00'::timestamp without time zone," +
                            "    max_battery_voltage double precision NOT NULL DEFAULT 0," +
                            "    min_battery_voltage double precision NOT NULL DEFAULT 0," +
                            "    max_battery_voltage_number integer NOT NULL DEFAULT 1," +
                            "    min_battery_voltage_number integer NOT NULL DEFAULT 1," +
                            "    diff_battery_voltage double precision NOT NULL DEFAULT 0," +
                            "    storage_voltage double precision NOT NULL DEFAULT 0," +
                            "    test_current double precision NOT NULL DEFAULT 0," +
                            "    test_capacity double precision NOT NULL DEFAULT 0," +
                            "    min_battery_temperature double precision NOT NULL DEFAULT 0," +
                            "    max_battery_temperature double precision NOT NULL DEFAULT 0," +
                            "    max_battery_temperature_number double precision NOT NULL DEFAULT 1," +
                            "    min_battery_temperature_number double precision NOT NULL DEFAULT 1," +
                            "    stop_reason character varying(32) NOT NULL COLLATE pg_catalog.\"default\" DEFAULT 0," +
                            "    stop_reason_number integer NOT NULL DEFAULT 0," +
                            "    fault_state integer NOT NULL DEFAULT 0," +
                            "    work_state integer NOT NULL DEFAULT 0," +
                            "    last_work_state integer NOT NULL DEFAULT 0," +
                            "    avg_mon_vol double precision NOT NULL DEFAULT 0," +
                            "    avg_mon_tmp double precision NOT NULL DEFAULT 0," +
                            "    test_pause integer NOT NULL DEFAULT 0," +
                            "     PRIMARY KEY (num)" +
                            ")";
            sql.sqlMysqlExecute(sql_str);
            sql.sqlMysqlExecute("ALTER    TABLE " + Sql_Mysql.A200_RealState_Table + "    OWNER TO sysdba;");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.A200_RealState_Table + ".num IS '自增主键';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.A200_RealState_Table + ".dev_id IS '设备ID';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.A200_RealState_Table + ".record_time IS '更新时间';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.A200_RealState_Table + ".battery_name IS 'PACK/模组号';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.A200_RealState_Table + ".test_type IS '测试类型[1-放电  2-充电]';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.A200_RealState_Table + ".is_testing IS '是否正在测试';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.A200_RealState_Table + ".start_test_time IS '测试开始时间';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.A200_RealState_Table + ".test_duration IS '测试时长(秒)';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.A200_RealState_Table + ".stop_test_time IS '测试结束时间';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.A200_RealState_Table + ".max_battery_voltage IS '最高单体电压(V)';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.A200_RealState_Table + ".min_battery_voltage IS '最低单体电压(V)';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.A200_RealState_Table + ".max_battery_voltage_number IS '最高单体电压对应电芯编号';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.A200_RealState_Table + ".min_battery_voltage_number IS '最低单体电压对应电芯编号';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.A200_RealState_Table + ".diff_battery_voltage IS '电芯压差(mv)';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.A200_RealState_Table + ".storage_voltage IS '组端电压(v)';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.A200_RealState_Table + ".test_current IS '测试电流(A)';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.A200_RealState_Table + ".test_capacity IS '测试容量(AH)';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.A200_RealState_Table + ".min_battery_temperature IS '最小温度';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.A200_RealState_Table + ".max_battery_temperature IS '最大温度';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.A200_RealState_Table + ".max_battery_temperature_number IS '最大温度对应温度序号';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.A200_RealState_Table + ".min_battery_temperature_number IS '最小温度对应温度序号';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.A200_RealState_Table + ".stop_reason IS '停机原因';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.A200_RealState_Table + ".stop_reason_number IS '停机原因序号';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.A200_RealState_Table + ".fault_state IS '故障状态[0-无故障  1-有故障]';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.A200_RealState_Table + ".work_state IS '设备工作状态[0-浮充  1-放电  2-充电]';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.A200_RealState_Table + ".last_work_state IS '上一次工作状态[0-浮充  1-放电  2-充电]';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.A200_RealState_Table + ".avg_mon_vol IS '单体电压平均值';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.A200_RealState_Table + ".avg_mon_tmp IS '单体温度平均值';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.A200_RealState_Table + ".test_pause IS '是否暂停测试[0-未暂停  1-暂停中]';");
            sql.sqlMysqlExecute("COMMENT ON   TABLE " + Sql_Mysql.A200_RealState_Table + " IS 'A200实时状态表';");
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    }
    /**
     * 创建 db_lithium_ram_db.tb_dev_a200_testparam 数据库表
     * @param conn
     */
    public static void createDev_A200_TestParam_Table(MysqlConnPool pool)
    {
        Sql_Mysql sql = new Sql_Mysql(pool.getConn());
        try {
            String sql_str_auto = "CREATE SEQUENCE IF NOT EXISTS " + Sql_Mysql.Dev_A200_TestParam_Table + "_auto" +
                                 " INCREMENT 1" +
                                 " MINVALUE 1" +
                                 " MAXVALUE 9223372036854775807" +
                                 " START 1" +
                                 " CACHE 1;";
            //创建自增序列
            sql.sqlMysqlExecute(sql_str_auto);
            String sql_str = " CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Dev_A200_TestParam_Table + " "
                            + "(num bigint NOT NULL DEFAULT nextval('" + Sql_Mysql.Dev_A200_TestParam_Table + "_auto'::regclass)," +
                            "    dev_id integer NOT NULL DEFAULT 1," +
                            "    op_cmd integer NOT NULL DEFAULT 0," +
                            "    return_code integer NOT NULL DEFAULT 0," +
                            "    battery_name character varying NOT NULL COLLATE pg_catalog.\"default\" DEFAULT ''::character varying," +
                            "    nominal_capacity double precision NOT NULL DEFAULT 0," +
                            "    battery_type integer NOT NULL DEFAULT 0," +
                            "    battery_number integer NOT NULL DEFAULT 16," +
                            "    diff_battery_voltage double precision NOT NULL DEFAULT 0," +
                            "    discharge_current double precision NOT NULL DEFAULT 0," +
                            "    discharge_time integer NOT NULL DEFAULT 0," +
                            "    discharge_capacity double precision NOT NULL DEFAULT 0," +
                            "    is_discharge_capacity_enable integer NOT NULL DEFAULT 0," +
                            "    min_battery_voltage double precision NOT NULL DEFAULT 0," +
                            "    is_min_battery_voltage_enable integer NOT NULL DEFAULT 0," +
                            "    charge_voltage double precision NOT NULL DEFAULT 0," +
                            "    charge_protect_voltage double precision NOT NULL DEFAULT 0," +
                            "    charge_current double precision NOT NULL DEFAULT 0," +
                            "    charge_stop_current double precision NOT NULL DEFAULT 0," +
                            "    charge_time integer NOT NULL DEFAULT 0," +
                            "    charge_capacity double precision NOT NULL DEFAULT 0," +
                            "    is_charge_capacity_enable integer NOT NULL DEFAULT 0," +
                            "    max_battery_voltage double precision NOT NULL DEFAULT 0," +
                            "    is_max_battery_voltage_enable integer NOT NULL DEFAULT 0," +
                            "    charge_power double precision NOT NULL DEFAULT 0," +
                            "    battery_temperature_protect integer NOT NULL DEFAULT 0," +
                            "    control_type integer NOT NULL DEFAULT 0," +
                            "    result_reason character varying NOT NULL COLLATE pg_catalog.\"default\" DEFAULT ''::character varying," +
                            "    discharge_voltage double precision NOT NULL DEFAULT 0," +
                            "     PRIMARY KEY (num)" +
                            ")";
            sql.sqlMysqlExecute(sql_str);
            sql.sqlMysqlExecute("ALTER    TABLE " + Sql_Mysql.Dev_A200_TestParam_Table + "    OWNER TO sysdba;");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_A200_TestParam_Table + ".num IS '自增主键';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_A200_TestParam_Table + ".dev_id IS '设备ID';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_A200_TestParam_Table + ".op_cmd IS '命令';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_A200_TestParam_Table + ".return_code IS '返回响应码';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_A200_TestParam_Table + ".battery_name IS 'pack/模组号';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_A200_TestParam_Table + ".nominal_capacity IS '标称容量(AH)';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_A200_TestParam_Table + ".battery_type IS '电池类型[0-磷酸铁锂  1-三元锂   2-太酸锂 4-锰酸锂]';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_A200_TestParam_Table + ".battery_number IS '电芯串数';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_A200_TestParam_Table + ".diff_battery_voltage IS '电芯压差';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_A200_TestParam_Table + ".discharge_current IS '放电电流';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_A200_TestParam_Table + ".discharge_time IS '放电时间(秒)';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_A200_TestParam_Table + ".discharge_capacity IS '预放容量(AH)';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_A200_TestParam_Table + ".is_discharge_capacity_enable IS '预放容量限制是否开启';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_A200_TestParam_Table + ".min_battery_voltage IS '单串下限(V)';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_A200_TestParam_Table + ".is_min_battery_voltage_enable IS '单串下限是否开启';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_A200_TestParam_Table + ".charge_voltage IS '充电目标电压(V)';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_A200_TestParam_Table + ".charge_protect_voltage IS '充电保护电压';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_A200_TestParam_Table + ".charge_current IS '充电电流(A)';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_A200_TestParam_Table + ".charge_stop_current IS '充电停机电流(A)';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_A200_TestParam_Table + ".charge_time IS '充电时间(秒)';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_A200_TestParam_Table + ".charge_capacity IS '充电容量';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_A200_TestParam_Table + ".is_charge_capacity_enable IS '预充容量限制是否开启';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_A200_TestParam_Table + ".max_battery_voltage IS '单串上限';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_A200_TestParam_Table + ".is_max_battery_voltage_enable IS '单串上限限制是否开启';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_A200_TestParam_Table + ".charge_power IS '充电功率(KW)';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_A200_TestParam_Table + ".battery_temperature_protect IS '单体温度保护';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_A200_TestParam_Table + ".control_type IS '控制类型[1-所有停机原因均显示弹窗和蜂鸣声  2-所有停机原因均不显示弹窗和蜂鸣声  3-正常停机原因不显示弹窗和蜂鸣声,异常停机原因显示弹窗和蜂鸣声 4-正常停机原因显示弹窗和蜂鸣声,异常停机原因不显示弹窗和蜂鸣声]';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_A200_TestParam_Table + ".result_reason IS '接口返回失败原因';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_A200_TestParam_Table + ".discharge_voltage IS '放电目标电压[组端下限]';");
            sql.sqlMysqlExecute("COMMENT ON   TABLE " + Sql_Mysql.Dev_A200_TestParam_Table + " IS 'A200测试参数表';");
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    }
    /**
     * 创建 db_lithium_ram_db.tb_dev_inf 数据库表
     * @param conn
     */
    public static void createDev_Inf_Table(MysqlConnPool pool)
    {
        Sql_Mysql sql = new Sql_Mysql(pool.getConn());
        try {
            String sql_str_auto = "CREATE SEQUENCE IF NOT EXISTS " + Sql_Mysql.Dev_Inf_Table + "_auto" +
                                 " INCREMENT 1" +
                                 " MINVALUE 1" +
                                 " MAXVALUE 9223372036854775807" +
                                 " START 1" +
                                 " CACHE 1;";
            //创建自增序列
            sql.sqlMysqlExecute(sql_str_auto);
            String sql_str = " CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Dev_Inf_Table + " "
                            + "(num bigint NOT NULL DEFAULT nextval('" + Sql_Mysql.Dev_Inf_Table + "_auto'::regclass)," +
                            "    dev_id integer NOT NULL DEFAULT 100000001," +
                            "    dev_ip character varying(200) NOT NULL COLLATE pg_catalog.\"default\" DEFAULT '127.0.0.1'::character varying," +
                            "    dev_type integer NOT NULL DEFAULT 1," +
                            "    dev_model character varying(200) NOT NULL COLLATE pg_catalog.\"default\" DEFAULT ''::character varying," +
                            "    dev_idcode character varying(200) NOT NULL COLLATE pg_catalog.\"default\" DEFAULT ''::character varying," +
                            "    dev_online integer NOT NULL DEFAULT 1," +
                            "    create_time date NOT NULL DEFAULT '2000-01-01'::date," +
                            "    batch_state integer NOT NULL DEFAULT 0," +
                            "    longitude double precision NOT NULL DEFAULT 0.0," +
                            "    latitude double precision NOT NULL DEFAULT 0.0," +
                            "    reload_en integer NOT NULL DEFAULT 1," +
                            "     PRIMARY KEY (num)" +
                            ")";
            sql.sqlMysqlExecute(sql_str);
            sql.sqlMysqlExecute("ALTER    TABLE " + Sql_Mysql.Dev_Inf_Table + " OWNER TO sysdba;");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_Inf_Table + ".num IS '自增主键';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_Inf_Table + ".dev_id IS '设备ID';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_Inf_Table + ".dev_ip IS '设备IP';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_Inf_Table + ".dev_type IS '设备类型[1-A200]';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_Inf_Table + ".dev_model IS '设备型号';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_Inf_Table + ".dev_online IS '设备在线状态';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_Inf_Table + ".batch_state IS '设备批量测试状态[0-未批量  1-批量中]';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_Inf_Table + ".reload_en IS '是否需要重新加载数据[0- 不需要重载  1-需要重载]';");
            sql.sqlMysqlExecute("COMMENT ON   TABLE " + Sql_Mysql.Dev_Inf_Table + " IS 'A200设备信息配置表';");
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    }
    /**
     * 创建 db_lithium_ram_db.tb_dev_inf 数据库表
     * @param conn
     */
    public static void createLithium_Rtdata_Table(MysqlConnPool pool)
    {
        Sql_Mysql sql = new Sql_Mysql(pool.getConn());
        try {
            String sql_str_auto = "CREATE SEQUENCE IF NOT EXISTS " + Sql_Mysql.Lithium_Rtdata_Table + "_auto" +
                    " INCREMENT 1" +
                    " MINVALUE 1" +
                    " MAXVALUE 9223372036854775807" +
                    " START 1" +
                    " CACHE 1;";
            //创建自增序列
            sql.sqlMysqlExecute(sql_str_auto);
            String sql_str = " CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Dev_Inf_Table + " "
                    + "(num bigint NOT NULL DEFAULT nextval('" + Sql_Mysql.Dev_Inf_Table + "_auto'::regclass)," +
                    "    dev_id integer NOT NULL DEFAULT 100000001," +
                    "    dev_ip character varying(200) NOT NULL COLLATE pg_catalog.\"default\" DEFAULT '127.0.0.1'::character varying," +
                    "    dev_type integer NOT NULL DEFAULT 1," +
                    "    dev_model character varying(200) NOT NULL COLLATE pg_catalog.\"default\" DEFAULT ''::character varying," +
                    "    dev_idcode character varying(200) NOT NULL COLLATE pg_catalog.\"default\" DEFAULT ''::character varying," +
                    "    dev_online integer NOT NULL DEFAULT 1," +
                    "    create_time date NOT NULL DEFAULT '2000-01-01'::date," +
                    "    batch_state integer NOT NULL DEFAULT 0," +
                    "    longitude double precision NOT NULL DEFAULT 0.0," +
                    "    latitude double precision NOT NULL DEFAULT 0.0," +
                    "    reload_en integer NOT NULL DEFAULT 1," +
                    "     PRIMARY KEY (num)" +
                    ")";
            sql.sqlMysqlExecute(sql_str);
            sql.sqlMysqlExecute("ALTER    TABLE " + Sql_Mysql.Dev_Inf_Table + " OWNER TO sysdba;");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_Inf_Table + ".num IS '自增主键';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_Inf_Table + ".dev_id IS '设备ID';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_Inf_Table + ".dev_ip IS '设备IP';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_Inf_Table + ".dev_type IS '设备类型[1-A200]';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_Inf_Table + ".dev_model IS '设备型号';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_Inf_Table + ".dev_online IS '设备在线状态';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_Inf_Table + ".batch_state IS '设备批量测试状态[0-未批量  1-批量中]';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Dev_Inf_Table + ".reload_en IS '是否需要重新加载数据[0- 不需要重载  1-需要重载]';");
            sql.sqlMysqlExecute("COMMENT ON   TABLE " + Sql_Mysql.Dev_Inf_Table + " IS 'A200设备信息配置表';");
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    }
}
BattMonitor_DB_Builder/src/com/sql/util/Db_Power_Alarm.java
@@ -72,8 +72,8 @@
                            "    power_id integer NOT NULL DEFAULT 0," + 
                            "    alm_id integer NOT NULL DEFAULT 0," + 
                            "    alm_value double precision NOT NULL DEFAULT 0," + 
                            "    alm_starttime timestamp without time zone NOT NULL DEFAULT '2000-01-01 00:00:00'::timestamp without time zone," +
                            "    alm_endtime timestamp without time zone NOT NULL DEFAULT '2000-01-01 00:00:00'::timestamp without time zone," +
                            "    alm_start_time timestamp without time zone NOT NULL DEFAULT '2000-01-01 00:00:00'::timestamp without time zone," +
                            "    alm_end_time timestamp without time zone NOT NULL DEFAULT '2000-01-01 00:00:00'::timestamp without time zone," +
                            "    alm_confirm_en integer NOT NULL DEFAULT 0," + 
                            "    alm_confirm_time timestamp without time zone NOT NULL DEFAULT '2000-01-01 00:00:00'::timestamp without time zone," + 
                            "    alm_level integer NOT NULL DEFAULT 1," + 
@@ -92,8 +92,8 @@
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Power_Alarm_Table + ".power_id IS '电源ID';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Power_Alarm_Table + ".alm_id IS '电源告警ID';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Power_Alarm_Table + ".alm_value IS '告警值';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Power_Alarm_Table + ".alm_starttime IS '告警开始时间';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Power_Alarm_Table + ".alm_endtime IS '告警结束时间';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Power_Alarm_Table + ".alm_start_time IS '告警开始时间';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Power_Alarm_Table + ".alm_end_time IS '告警结束时间';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Power_Alarm_Table + ".alm_confirm_en IS '告警是否确认';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Power_Alarm_Table + ".alm_confirm_time IS '告警确认时间';");
            sql.sqlMysqlExecute("COMMENT ON COLUMN " + Sql_Mysql.Power_Alarm_Table + ".alm_level IS '告警等级';");
BattMonitor_DB_Builder/src/main/main_BTS_DB_Builder.java
@@ -10,6 +10,7 @@
import com.sql.util.Db_Alarm;
import com.sql.util.Db_Batt;
import com.sql.util.Db_Dis_Batt;
import com.sql.util.Db_Lithium_Ram_Db;
import com.sql.util.Db_Param;
import com.sql.util.Db_Power_Alarm;
@@ -88,6 +89,8 @@
        //初始化电源告警库
        Db_Power_Alarm.init(GB_MysqlConnPool);
        
        Db_Lithium_Ram_Db.init(GB_MysqlConnPool);
        GB_DataArray.checkBattRealData();
    }