蓄电池监控管理平台数据库初始化程序
Administrator
2022-10-27 8983244985c5509c6342afb3dbee53a4de5f7e55
V1.44 edit at date 2022-10-27
1.新增电操开关表'db_ram_db.tb_dev_60870_inverter_info'和'db_ram_db.tb_dev_60870_inverter_state'
23个文件已修改
3298 ■■■■■ 已修改文件
BattMonitor_DB_Builder/bin/com/version_inf/version_inf.txt 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/config.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/com/config/AppConfig.java 1388 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/com/database_util/DB_Alarm.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/com/database_util/DB_App_Sys.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/com/database_util/DB_Batt_History.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/com/database_util/DB_Batt_Testdata.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/com/database_util/DB_Dev_History.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/com/database_util/DB_Dev_TestParam.java 176 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/com/database_util/DB_Fbo_testdata.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/com/database_util/DB_Ld9_Testdata.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/com/database_util/DB_Param.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/com/database_util/DB_Pwrdev_Alarm.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/com/database_util/DB_Pwrdev_Data_Rt.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/com/database_util/DB_Pwrdev_Inf.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/com/database_util/DB_Ram_db.java 206 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/com/database_util/DB_battinf.java 1169 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/com/database_util/DB_db_user.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/com/database_util/DB_web_site.java 56 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/com/dev/fbs9100/FBS9100_Task_Thread_SQL.java 128 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/com/sql/Sql_Mysql.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/com/version_inf/version_inf.txt 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/main/main_BTS_DB_Builder.java 85 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/bin/com/version_inf/version_inf.txt
@@ -688,4 +688,8 @@
V1.43 edit at date 2022-10-19    
    1.表'web_site.tb_process_survey'初始录入时添加远程重启装置线程录入
        sql.sqlMysqlExecute(" INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + "(ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('11020', 'BMS_REMOTE_RESTART_DEVICE',     '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_REMOTE_RESTART_DEVICE', '2', 'v1.100', '远程重启装置通信线程', '300');");
V1.44 edit at date 2022-10-27
    1.新增电操开关表'db_ram_db.tb_dev_60870_inverter_info'和'db_ram_db.tb_dev_60870_inverter_state'
BattMonitor_DB_Builder/config.xml
@@ -27,12 +27,12 @@
  <fbs_device_base_ip>192.168.0.1</fbs_device_base_ip>
  <syb_srv_curr_charge_dir_pos>false</syb_srv_curr_charge_dir_pos>
  <mysql_conn_count_max>300</mysql_conn_count_max>
  <work_thread_count_max>300</work_thread_count_max>
  <work_thread_count_max>10</work_thread_count_max>
  <batt_alarm_fn_config>
    <batt_alarm_fn_en>false</batt_alarm_fn_en>
    <batt_alarm_fn_start_delay>60</batt_alarm_fn_start_delay>
    <batt_alarm_cleared_delay>30</batt_alarm_cleared_delay>
    <batt_alarm_data_daycount_max>400</batt_alarm_data_daycount_max>
    <batt_alarm_data_daycount_max>1000000</batt_alarm_data_daycount_max>
  </batt_alarm_fn_config>
  <batt_res_store_fn_config>
    <batt_res_store_fn_en>false</batt_res_store_fn_en>
BattMonitor_DB_Builder/src/com/config/AppConfig.java
@@ -1,694 +1,694 @@
package com.config;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.SAXReader;
import org.dom4j.io.XMLWriter;
/**
 * 创建config.xml文件并更新  config.xml 文件中的属性值
 * @author 军
 *
 */
public class AppConfig {
    public static final int SOURCE_BATTDATA_TYPE_FBSDEV = 0;
    public static final int SOURCE_BATTDATA_TYPE_SQLSERVER = 1;
    public static final int SOURCE_BATTDATA_TYPE_C_INTERFACE = 2;
    public static final int SOURCE_BATTDATA_TYPE_SQLSERVER_AND_C_INTERFACE = 3;
    private final String ConfigFileName = "config.xml";
    private boolean mysqlDB_RecreateEn = false;
    private String mysqlServerIp = "127.0.0.1";
    private int sourceBattDataType = 0;
    //----------------------------------------------------------------//
    private int sourceSQLServerType = 0;
    private String sourceSQLServerIp = "127.0.0.1";
    private String sourceSQLServerUsrName = "sxfg001";
    private String sourceSQLServerPWD = "sxfg001";
    private int sourceSQLServerPort = 5000;
    private String cInterfaceServerIp = "127.0.0.1";
    private String cInterfaceUsrName = "cdnt";
    private String cInterfacePWD = "cdnt";
    private int cInterfaceSocketPort = 7009;
    private String fbsDeviceBaseIp = "192.168.0.1";
    //----------------------------------------------------------------//
    //----------------------------------------------------------------//
    private boolean sybSrvCurrChargeDirPos = false;
    private int mysqlConnCountMax = 300;
    private int workThreadCountMax = 300;
    private boolean battAlarmFnEn = false;
    private int battAlarmFnStartDelay = 60;
    private int battAlarmClearedDelay = 600;
    private int battAlarmDataDayCountMax = 400;
    private boolean battResStoreFnEn = false;
    private int battResStoreDelayForTestManual = 1200;
    private int battResStoreDayInterval = 7;
    private boolean battAutoStoreFnEn = false;
    private int battAutoStoreDelayForStartUp = 60;
    private int battAutoStoreMinuteInterval = 10;
    private int battAutoStoreDayCountMax = 7;
    private boolean userTaskFnEn = true;
    private boolean userTaskSmsFnEn = false;
    private String userTaskSmsDevIp = "192.168.1.60";
    private boolean idce8200ServerFnEn = false;
    private boolean mobileServerFnEn = true;
    private boolean ftpServerFnEn = true;
    private int autoSqlDbBackUpDayInterval = 30;
    private boolean bpm7100CommErrDataClearEN = true;
    private int fbsDevCommRate = 1;
    private boolean DevBTS_SeverComm_En = true;
    private boolean DevFBS9100_SeverComm_En = true;
    private boolean DevFBS9100_ClientComm_En = true;
    public AppConfig()
    {    /*
        String path = System.getProperty("user.dir");
        if(path.contains("\\"))
            path += "\\";
        else path += "/";
        */
        String path = ConfigFileName;
        //System.out.println(path);
        File f = new File(path);
        if(false == f.exists())
        {
            writeConfigToXml();
        }
        readConfigFromXml();
    }
    public boolean getMysqlDB_RecreateEn()
    {
        return mysqlDB_RecreateEn;
    }
    public void setMysqlDB_RecreateEn(boolean en)
    {
        mysqlDB_RecreateEn = en;
    }
    public String getMysqlServerIp()
    {
        return mysqlServerIp;
    }
    public String getSourceSQLServerIp()
    {
        return sourceSQLServerIp;
    }
    public String getSourceSQLServerUsrName()
    {
        return sourceSQLServerUsrName;
    }
    public String getSourceSQLServerPWD()
    {
        return sourceSQLServerPWD;
    }
    public int getSourceSQLServerPort()
    {
        return sourceSQLServerPort;
    }
    public String getCInterfaceServerIp()
    {
        return cInterfaceServerIp;
    }
    public String getCInterfaceUsrName()
    {
        return cInterfaceUsrName;
    }
    public String getCInterfacePWD()
    {
        return cInterfacePWD;
    }
    public int getCInterfacePort()
    {
        return cInterfaceSocketPort;
    }
    public String getFbsDeviceBaseIp()
    {
        return fbsDeviceBaseIp;
    }
    public int getSourceSQLServerType()
    {
        return sourceSQLServerType;
    }
    public int getSourceBattDataType()
    {
        return sourceBattDataType;
    }
    public boolean getSybSrvCurrChargeDirPos()
    {
        return sybSrvCurrChargeDirPos;
    }
    public int getMysqlConnCountMax()
    {
        return mysqlConnCountMax;
    }
    public int getWorkThreadCountMax()
    {
        return workThreadCountMax;
    }
    public boolean getBattAlarmFnEn()
    {
        return battAlarmFnEn;
    }
    public int getBattAlarmFnStartDelay()
    {
        return battAlarmFnStartDelay;
    }
    public int getBattAlarmClearedDelay()
    {
        return battAlarmClearedDelay;
    }
    public int getBattAlarmDataDayCountMax()
    {
        return battAlarmDataDayCountMax;
    }
    public boolean getBattResStoreFnEn()
    {
        return battResStoreFnEn;
    }
    public int getBattResStoreDelayForTestManual()
    {
        return battResStoreDelayForTestManual;
    }
    public int getBattResStoreDayInterval()
    {
        return battResStoreDayInterval;
    }
    public boolean getBattAutoStoreFnEn()
    {
        return battAutoStoreFnEn;
    }
    public int getBattAutoStoreDelayForStartUp()
    {
        return battAutoStoreDelayForStartUp;
    }
    public int getBattAutoStoreMinuteInterval()
    {
        return battAutoStoreMinuteInterval;
    }
    public int getBattAutoStoreDayCountMax()
    {
        return battAutoStoreDayCountMax;
    }
    public boolean getUserTaskFnEn()
    {
        return userTaskFnEn;
    }
    public boolean getUserTaskSmsFnEn()
    {
        return userTaskSmsFnEn;
    }
    public String getUserTaskSmsDevIp()
    {
        return userTaskSmsDevIp;
    }
    public boolean getIdce8200ServerFnEn()
    {
        return idce8200ServerFnEn;
    }
    public boolean getMobileServerFnEn()
    {
        return mobileServerFnEn;
    }
    public boolean getFtpServerFnEn()
    {
        return ftpServerFnEn;
    }
    public int getAutoSqlDbBackUpDayInterval() {
        return autoSqlDbBackUpDayInterval;
    }
    public boolean getBpm7100CommErrDataClearEN() {
        return bpm7100CommErrDataClearEN;
    }
    public int getFbsDevCommRate() {
        return fbsDevCommRate;
    }
    public boolean getBTS_CommEn() {
        return DevBTS_SeverComm_En;
    }
    public boolean getFbs9100_ServerCommEn() {
        return DevFBS9100_SeverComm_En;
    }
    public boolean getFbs9100_ClientCommEn() {
        return DevFBS9100_ClientComm_En;
    }
    public void writeConfigToXml()
    {
        try {
            Document document = DocumentHelper.createDocument();
            Element root = document.addElement("root");
            //root.addComment("这个一个注释");
            Element param;
            Element sub_param;
            //-------------------------------------------------------//
            param = root.addElement("mysql_ramdb_recreate_en");
            param.addText(String.valueOf(mysqlDB_RecreateEn));
            //-------------------------------------------------------//
            param = root.addElement("mysql_server_ip");
            param.addText(mysqlServerIp);
            //-------------------------------------------------------//
            //-------------------------------------------------------//
            root.addComment("SOURCE_BATTDATA_TYPE_FBSDEV = 0");
            root.addComment("SOURCE_BATTDATA_TYPE_SQLSERVER = 1");
            root.addComment("SOURCE_BATTDATA_TYPE_C_INTERFACE = 2");
            root.addComment("SOURCE_BATTDATA_TYPE_SQLSERVER_AND_C_INTERFACE = 3");
            param = root.addElement("source_battdata_type");
            param.addText(String.valueOf(sourceBattDataType));
            //-------------------------------------------------------//
            //-------------------------------------------------------//
            param = root.addElement("source_sqlserver_config");
            param.addComment("SOURCE_SQLSERVER_TYPE_SYBASE_DEMO = 0");
            param.addComment("SOURCE_SQLSERVER_TYPE_SYBASE = 1");
            param.addComment("SOURCE_SQLSERVER_TYPE_MSSQLSERVER = 2");
            sub_param = param.addElement("source_sqlserver_type");
            sub_param.addText(String.valueOf(sourceSQLServerType));
            sub_param = param.addElement("source_sqlserver_ip");
            sub_param.addText(sourceSQLServerIp);
            sub_param = param.addElement("source_sqlserver_usrname");
            sub_param.addText(sourceSQLServerUsrName);
            sub_param = param.addElement("source_sqlserver_pwd");
            sub_param.addText(sourceSQLServerPWD);
            sub_param = param.addElement("source_sqlserver_port");
            sub_param.addText(String.valueOf(sourceSQLServerPort));
            //-------------------------------------------------------//
            //--------------------------------------------------------//
            param = root.addElement("c_interface_server_config");
            sub_param = param.addElement("c_interface_server_ip");
            sub_param.addText(cInterfaceServerIp);
            sub_param = param.addElement("c_interface_usrname");
            sub_param.addText(cInterfaceUsrName);
            sub_param = param.addElement("c_interface_pwd");
            sub_param.addText(cInterfacePWD);
            sub_param = param.addElement("c_interface_sokcet_port");
            sub_param.addText(String.valueOf(cInterfaceSocketPort));
            //--------------------------------------------------------//
            //--------------------------------------------------------//
            param = root.addElement("fbs_device_base_ip");
            param.addText(fbsDeviceBaseIp);
            //--------------------------------------------------------//
            param = root.addElement("syb_srv_curr_charge_dir_pos");
            param.addText(String.valueOf(sybSrvCurrChargeDirPos));
            param = root.addElement("mysql_conn_count_max");
            param.addText(String.valueOf(mysqlConnCountMax));
            param = root.addElement("work_thread_count_max");
            param.addText(String.valueOf(workThreadCountMax));
            //--------------------------------------------------------//
            param = root.addElement("batt_alarm_fn_config");
            sub_param = param.addElement("batt_alarm_fn_en");
            sub_param.addText(String.valueOf(battAlarmFnEn));
            sub_param = param.addElement("batt_alarm_fn_start_delay");
            sub_param.addText(String.valueOf(battAlarmFnStartDelay));
            sub_param = param.addElement("batt_alarm_cleared_delay");
            sub_param.addText(String.valueOf(battAlarmClearedDelay));
            sub_param = param.addElement("batt_alarm_data_daycount_max");
            sub_param.addText(String.valueOf(battAlarmDataDayCountMax));
            //--------------------------------------------------------//
            //--------------------------------------------------------//
            param = root.addElement("batt_res_store_fn_config");
            sub_param = param.addElement("batt_res_store_fn_en");
            sub_param.addText(String.valueOf(battResStoreFnEn));
            sub_param = param.addElement("batt_res_store_delay_for_test_manual");
            sub_param.addText(String.valueOf(battResStoreDelayForTestManual));
            sub_param = param.addElement("batt_res_store_day_interval");
            sub_param.addText(String.valueOf(battResStoreDayInterval));
            //--------------------------------------------------------//
            //--------------------------------------------------------//
            param = root.addElement("batt_auto_store_fn_config");
            sub_param = param.addElement("batt_auto_store_fn_en");
            sub_param.addText(String.valueOf(battAutoStoreFnEn));
            sub_param = param.addElement("batt_auto_store_delay_for_start_up");
            sub_param.addText(String.valueOf(battAutoStoreDelayForStartUp));
            sub_param = param.addElement("batt_auto_store_minute_interval");
            sub_param.addText(String.valueOf(battAutoStoreMinuteInterval));
            sub_param = param.addElement("batt_auto_store_day_count_max");
            sub_param.addText(String.valueOf(battAutoStoreDayCountMax));
            //--------------------------------------------------------//
            //--------------------------------------------------------//
            param = root.addElement("user_task_fn_config");
            sub_param = param.addElement("user_task_fn_en");
            sub_param.addText(String.valueOf(userTaskFnEn));
            sub_param = param.addElement("user_task_sms_fn_en");
            sub_param.addText(String.valueOf(userTaskSmsFnEn));
            sub_param = param.addElement("user_task_sms_dev_ip");
            sub_param.addText(userTaskSmsDevIp);
            //--------------------------------------------------------//
            //--------------------------------------------------------//
            param = root.addElement("idce8200_server_fn_config");
            param.addText(String.valueOf(idce8200ServerFnEn));
            param = root.addElement("mobile_server_fn_config");
            param.addText(String.valueOf(mobileServerFnEn));
            param = root.addElement("ftp_server_fn_config");
            param.addText(String.valueOf(ftpServerFnEn));
            //--------------------------------------------------------//
            //-------------------------------------------------------//
            param = root.addElement("auto_sqldb_backup_dayinterval");
            param.addText(String.valueOf(autoSqlDbBackUpDayInterval));
            //-------------------------------------------------------//
            //-------------------------------------------------------//
            param = root.addElement("bpm7100_commerr_dataclear_en");
            param.addText(String.valueOf(bpm7100CommErrDataClearEN));
            //-------------------------------------------------------//
            //-------------------------------------------------------//
            param = root.addElement("fbsdev_comm_rate");
            param.addText(String.valueOf(fbsDevCommRate));
            //-------------------------------------------------------//
            //-------------------------------------------------------//
            param = root.addElement("dev_bts_severcomm_en");
            param.addText(String.valueOf(DevBTS_SeverComm_En));
            //-------------------------------------------------------//
            //-------------------------------------------------------//
            param = root.addElement("devfbs9100_severcomm_en");
            param.addText(String.valueOf(DevFBS9100_SeverComm_En));
            //-------------------------------------------------------//
            //-------------------------------------------------------//
            param = root.addElement("devfbs9100_clientcomm_en");
            param.addText(String.valueOf(DevFBS9100_ClientComm_En));
            //-------------------------------------------------------//
            OutputFormat format = OutputFormat.createPrettyPrint();
            format.setEncoding("gbk");
            XMLWriter writer2 = new XMLWriter(new FileWriter(ConfigFileName), format);
            writer2.write(document);
            writer2.close();
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    public void readConfigFromXml()
    {
        boolean res = true;
        try
        {
            SAXReader reader = new SAXReader();
            Document document = reader.read(new File(ConfigFileName));
            Element rootnode = document.getRootElement();
            Element node;
            Element sub_node;
            //------------------------------------------------------------//
            node = rootnode.element("mysql_ramdb_recreate_en");
            mysqlDB_RecreateEn = Boolean.parseBoolean(node.getTextTrim());
            //------------------------------------------------------------//
            node = rootnode.element("mysql_server_ip");
            mysqlServerIp = node.getTextTrim();
            //------------------------------------------------------------//
            node = rootnode.element("source_battdata_type");
            sourceBattDataType = Integer.parseInt(node.getTextTrim());
            if(sourceBattDataType < 0)
                sourceBattDataType = 0;
            if(sourceBattDataType > 3)
                sourceBattDataType = 3;
            //------------------------------------------------------------//
            node = rootnode.element("source_sqlserver_config");
            sub_node = node.element("source_sqlserver_type");
            sourceSQLServerType = Integer.parseInt(sub_node.getTextTrim());
            sub_node = node.element("source_sqlserver_ip");
            sourceSQLServerIp = sub_node.getTextTrim();
            sub_node = node.element("source_sqlserver_usrname");
            sourceSQLServerUsrName = sub_node.getTextTrim();
            sub_node = node.element("source_sqlserver_pwd");
            sourceSQLServerPWD = sub_node.getTextTrim();
            sub_node = node.element("source_sqlserver_port");
            sourceSQLServerPort = Integer.parseInt(sub_node.getTextTrim());
            //------------------------------------------------------------//
            //------------------------------------------------------------//
            node = rootnode.element("c_interface_server_config");
            sub_node = node.element("c_interface_server_ip");
            cInterfaceServerIp = sub_node.getTextTrim();
            sub_node = node.element("c_interface_usrname");
            cInterfaceUsrName = sub_node.getTextTrim();
            sub_node = node.element("c_interface_pwd");
            cInterfacePWD = sub_node.getTextTrim();
            sub_node = node.element("c_interface_sokcet_port");
            cInterfaceSocketPort = Integer.parseInt(sub_node.getTextTrim());
            //------------------------------------------------------------//
            //------------------------------------------------------------//
            node = rootnode.element("fbs_device_base_ip");
            fbsDeviceBaseIp = node.getTextTrim();
            //------------------------------------------------------------//
            node = rootnode.element("syb_srv_curr_charge_dir_pos");
            sybSrvCurrChargeDirPos = Boolean.parseBoolean(node.getTextTrim());
            node = rootnode.element("mysql_conn_count_max");
            mysqlConnCountMax = Integer.parseInt(node.getTextTrim());
            if(mysqlConnCountMax < 5)
                mysqlConnCountMax = 5;
            if(mysqlConnCountMax > 400)
                mysqlConnCountMax = 400;
            node = rootnode.element("work_thread_count_max");
            workThreadCountMax = Integer.parseInt(node.getTextTrim());
            if(workThreadCountMax < 10)
                workThreadCountMax = 10;
            if(workThreadCountMax > 400)
                workThreadCountMax = 400;
            //-------------------------------------------------------//
            node = rootnode.element("batt_alarm_fn_config");
            sub_node = node.element("batt_alarm_fn_en");
            battAlarmFnEn = Boolean.parseBoolean(sub_node.getTextTrim());
            sub_node = node.element("batt_alarm_fn_start_delay");
            battAlarmFnStartDelay = Integer.parseInt(sub_node.getTextTrim());
            if(battAlarmFnStartDelay < 0)
                battAlarmFnStartDelay = 0;
            if(battAlarmFnStartDelay > 3600)
                battAlarmFnStartDelay = 3600;
            sub_node = node.element("batt_alarm_cleared_delay");
            battAlarmClearedDelay = Integer.parseInt(sub_node.getTextTrim());
            if(battAlarmClearedDelay < 0)
                battAlarmClearedDelay = 0;
            if(battAlarmClearedDelay > 3600)
                battAlarmClearedDelay = 3600;
            sub_node = node.element("batt_alarm_data_daycount_max");
            battAlarmDataDayCountMax = Integer.parseInt(sub_node.getTextTrim());
            if(battAlarmDataDayCountMax < 7)
                battAlarmDataDayCountMax = 7;
            if(battAlarmDataDayCountMax > 2048)
                battAlarmDataDayCountMax = 2048;
            //-------------------------------------------------------//
            //-------------------------------------------------------//
            node = rootnode.element("batt_res_store_fn_config");
            sub_node = node.element("batt_res_store_fn_en");
            battResStoreFnEn = Boolean.parseBoolean(sub_node.getTextTrim());
            sub_node = node.element("batt_res_store_delay_for_test_manual");
            battResStoreDelayForTestManual = Integer.parseInt(sub_node.getTextTrim());
            if(battResStoreDelayForTestManual < 180)
                battResStoreDelayForTestManual = 180;
            if(battResStoreDelayForTestManual > 1800)
                battResStoreDelayForTestManual = 1800;
            sub_node = node.element("batt_res_store_day_interval");
            battResStoreDayInterval = Integer.parseInt(sub_node.getTextTrim());
            if(battResStoreDayInterval < 1)
                battResStoreDayInterval = 1;
            if(battResStoreDayInterval > 360)
                battResStoreDayInterval = 360;
            //-------------------------------------------------------//
            //-------------------------------------------------------//
            node = rootnode.element("batt_auto_store_fn_config");
            sub_node = node.element("batt_auto_store_fn_en");
            battAutoStoreFnEn = Boolean.parseBoolean(sub_node.getTextTrim());
            sub_node = node.element("batt_auto_store_delay_for_start_up");
            battAutoStoreDelayForStartUp = Integer.parseInt(sub_node.getTextTrim());
            if(battAutoStoreDelayForStartUp < 180)
                battAutoStoreDelayForStartUp = 180;
            if(battAutoStoreDelayForStartUp > 3600)
                battAutoStoreDelayForStartUp = 3600;
            sub_node = node.element("batt_auto_store_minute_interval");
            battAutoStoreMinuteInterval = Integer.parseInt(sub_node.getTextTrim());
            if(battAutoStoreMinuteInterval < 10)
                battAutoStoreMinuteInterval = 10;
            if(battAutoStoreMinuteInterval > ((60*24)*30))
                battAutoStoreMinuteInterval = ((60*24)*30);
            sub_node = node.element("batt_auto_store_day_count_max");
            battAutoStoreDayCountMax = Integer.parseInt(sub_node.getTextTrim());
            if(battAutoStoreDayCountMax < 1)
                battAutoStoreDayCountMax = 1;
            if(battAutoStoreDayCountMax > 300)
                battAutoStoreDayCountMax = 300;
            //-------------------------------------------------------//
            //--------------------------------------------------------//
            node = rootnode.element("user_task_fn_config");
            sub_node = node.element("user_task_fn_en");
            userTaskFnEn = Boolean.parseBoolean(sub_node.getTextTrim());
            sub_node = node.element("user_task_sms_fn_en");
            userTaskSmsFnEn = Boolean.parseBoolean(sub_node.getTextTrim());
            sub_node = node.element("user_task_sms_dev_ip");
            userTaskSmsDevIp = sub_node.getTextTrim();
            //--------------------------------------------------------//
            //--------------------------------------------------------//
            node = rootnode.element("idce8200_server_fn_config");
            idce8200ServerFnEn = Boolean.parseBoolean(node.getTextTrim());
            node = rootnode.element("mobile_server_fn_config");
            mobileServerFnEn = Boolean.parseBoolean(node.getTextTrim());
            node = rootnode.element("ftp_server_fn_config");
            ftpServerFnEn = Boolean.parseBoolean(node.getTextTrim());
            //--------------------------------------------------------//
            //-------------------------------------------------------//
            node = rootnode.element("auto_sqldb_backup_dayinterval");
            autoSqlDbBackUpDayInterval = Integer.parseInt(node.getTextTrim());
            if(autoSqlDbBackUpDayInterval < 7) {
                autoSqlDbBackUpDayInterval = 7;
            }
            if(autoSqlDbBackUpDayInterval > 365) {
                autoSqlDbBackUpDayInterval = 365;
            }
            //-------------------------------------------------------//
            //-------------------------------------------------------//
            node = rootnode.element("bpm7100_commerr_dataclear_en");
            bpm7100CommErrDataClearEN = Boolean.parseBoolean(node.getTextTrim());
            //-------------------------------------------------------//
            //-------------------------------------------------------//
            node = rootnode.element("fbsdev_comm_rate");
            fbsDevCommRate = Integer.parseInt(node.getTextTrim());
            //-------------------------------------------------------//
            //-------------------------------------------------------//
            node = rootnode.element("dev_bts_severcomm_en");
            DevBTS_SeverComm_En = Boolean.parseBoolean(node.getTextTrim());
            //-------------------------------------------------------//
            //-------------------------------------------------------//
            node = rootnode.element("devfbs9100_severcomm_en");
            DevFBS9100_SeverComm_En = Boolean.parseBoolean(node.getTextTrim());
            //-------------------------------------------------------//
            //-------------------------------------------------------//
            node = rootnode.element("devfbs9100_clientcomm_en");
            DevFBS9100_ClientComm_En = Boolean.parseBoolean(node.getTextTrim());
            //-------------------------------------------------------//
        } catch (NullPointerException | NumberFormatException | DocumentException e) {
            res = false;
            e.printStackTrace();
        } finally {
            if(false == res)
                writeConfigToXml();
        }
    }
}
package com.config;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.SAXReader;
import org.dom4j.io.XMLWriter;
/**
 * 创建config.xml文件并更新  config.xml 文件中的属性值
 * @author 军
 *
 */
public class AppConfig {
    public static final int SOURCE_BATTDATA_TYPE_FBSDEV = 0;
    public static final int SOURCE_BATTDATA_TYPE_SQLSERVER = 1;
    public static final int SOURCE_BATTDATA_TYPE_C_INTERFACE = 2;
    public static final int SOURCE_BATTDATA_TYPE_SQLSERVER_AND_C_INTERFACE = 3;
    private final String ConfigFileName = "config.xml";
    private boolean mysqlDB_RecreateEn = false;
    private String mysqlServerIp = "127.0.0.1";
    private int sourceBattDataType = 0;
    //----------------------------------------------------------------//
    private int sourceSQLServerType = 0;
    private String sourceSQLServerIp = "127.0.0.1";
    private String sourceSQLServerUsrName = "sxfg001";
    private String sourceSQLServerPWD = "sxfg001";
    private int sourceSQLServerPort = 5000;
    private String cInterfaceServerIp = "127.0.0.1";
    private String cInterfaceUsrName = "cdnt";
    private String cInterfacePWD = "cdnt";
    private int cInterfaceSocketPort = 7009;
    private String fbsDeviceBaseIp = "192.168.0.1";
    //----------------------------------------------------------------//
    //----------------------------------------------------------------//
    private boolean sybSrvCurrChargeDirPos = false;
    private int mysqlConnCountMax = 300;
    private int workThreadCountMax = 300;
    private boolean battAlarmFnEn = false;
    private int battAlarmFnStartDelay = 60;
    private int battAlarmClearedDelay = 600;
    private int battAlarmDataDayCountMax = 400;
    private boolean battResStoreFnEn = false;
    private int battResStoreDelayForTestManual = 1200;
    private int battResStoreDayInterval = 7;
    private boolean battAutoStoreFnEn = false;
    private int battAutoStoreDelayForStartUp = 60;
    private int battAutoStoreMinuteInterval = 10;
    private int battAutoStoreDayCountMax = 7;
    private boolean userTaskFnEn = true;
    private boolean userTaskSmsFnEn = false;
    private String userTaskSmsDevIp = "192.168.1.60";
    private boolean idce8200ServerFnEn = false;
    private boolean mobileServerFnEn = true;
    private boolean ftpServerFnEn = true;
    private int autoSqlDbBackUpDayInterval = 30;
    private boolean bpm7100CommErrDataClearEN = true;
    private int fbsDevCommRate = 1;
    private boolean DevBTS_SeverComm_En = true;
    private boolean DevFBS9100_SeverComm_En = true;
    private boolean DevFBS9100_ClientComm_En = true;
    public AppConfig()
    {    /*
        String path = System.getProperty("user.dir");
        if(path.contains("\\"))
            path += "\\";
        else path += "/";
        */
        String path = ConfigFileName;
        //System.out.println(path);
        File f = new File(path);
        if(false == f.exists())
        {
            writeConfigToXml();
        }
        readConfigFromXml();
    }
    public boolean getMysqlDB_RecreateEn()
    {
        return mysqlDB_RecreateEn;
    }
    public void setMysqlDB_RecreateEn(boolean en)
    {
        mysqlDB_RecreateEn = en;
    }
    public String getMysqlServerIp()
    {
        return mysqlServerIp;
    }
    public String getSourceSQLServerIp()
    {
        return sourceSQLServerIp;
    }
    public String getSourceSQLServerUsrName()
    {
        return sourceSQLServerUsrName;
    }
    public String getSourceSQLServerPWD()
    {
        return sourceSQLServerPWD;
    }
    public int getSourceSQLServerPort()
    {
        return sourceSQLServerPort;
    }
    public String getCInterfaceServerIp()
    {
        return cInterfaceServerIp;
    }
    public String getCInterfaceUsrName()
    {
        return cInterfaceUsrName;
    }
    public String getCInterfacePWD()
    {
        return cInterfacePWD;
    }
    public int getCInterfacePort()
    {
        return cInterfaceSocketPort;
    }
    public String getFbsDeviceBaseIp()
    {
        return fbsDeviceBaseIp;
    }
    public int getSourceSQLServerType()
    {
        return sourceSQLServerType;
    }
    public int getSourceBattDataType()
    {
        return sourceBattDataType;
    }
    public boolean getSybSrvCurrChargeDirPos()
    {
        return sybSrvCurrChargeDirPos;
    }
    public int getMysqlConnCountMax()
    {
        return mysqlConnCountMax;
    }
    public int getWorkThreadCountMax()
    {
        return workThreadCountMax;
    }
    public boolean getBattAlarmFnEn()
    {
        return battAlarmFnEn;
    }
    public int getBattAlarmFnStartDelay()
    {
        return battAlarmFnStartDelay;
    }
    public int getBattAlarmClearedDelay()
    {
        return battAlarmClearedDelay;
    }
    public int getBattAlarmDataDayCountMax()
    {
        return battAlarmDataDayCountMax;
    }
    public boolean getBattResStoreFnEn()
    {
        return battResStoreFnEn;
    }
    public int getBattResStoreDelayForTestManual()
    {
        return battResStoreDelayForTestManual;
    }
    public int getBattResStoreDayInterval()
    {
        return battResStoreDayInterval;
    }
    public boolean getBattAutoStoreFnEn()
    {
        return battAutoStoreFnEn;
    }
    public int getBattAutoStoreDelayForStartUp()
    {
        return battAutoStoreDelayForStartUp;
    }
    public int getBattAutoStoreMinuteInterval()
    {
        return battAutoStoreMinuteInterval;
    }
    public int getBattAutoStoreDayCountMax()
    {
        return battAutoStoreDayCountMax;
    }
    public boolean getUserTaskFnEn()
    {
        return userTaskFnEn;
    }
    public boolean getUserTaskSmsFnEn()
    {
        return userTaskSmsFnEn;
    }
    public String getUserTaskSmsDevIp()
    {
        return userTaskSmsDevIp;
    }
    public boolean getIdce8200ServerFnEn()
    {
        return idce8200ServerFnEn;
    }
    public boolean getMobileServerFnEn()
    {
        return mobileServerFnEn;
    }
    public boolean getFtpServerFnEn()
    {
        return ftpServerFnEn;
    }
    public int getAutoSqlDbBackUpDayInterval() {
        return autoSqlDbBackUpDayInterval;
    }
    public boolean getBpm7100CommErrDataClearEN() {
        return bpm7100CommErrDataClearEN;
    }
    public int getFbsDevCommRate() {
        return fbsDevCommRate;
    }
    public boolean getBTS_CommEn() {
        return DevBTS_SeverComm_En;
    }
    public boolean getFbs9100_ServerCommEn() {
        return DevFBS9100_SeverComm_En;
    }
    public boolean getFbs9100_ClientCommEn() {
        return DevFBS9100_ClientComm_En;
    }
    public void writeConfigToXml()
    {
        try {
            Document document = DocumentHelper.createDocument();
            Element root = document.addElement("root");
            //root.addComment("这个一个注释");
            Element param;
            Element sub_param;
            //-------------------------------------------------------//
            param = root.addElement("mysql_ramdb_recreate_en");
            param.addText(String.valueOf(mysqlDB_RecreateEn));
            //-------------------------------------------------------//
            param = root.addElement("mysql_server_ip");
            param.addText(mysqlServerIp);
            //-------------------------------------------------------//
            //-------------------------------------------------------//
            root.addComment("SOURCE_BATTDATA_TYPE_FBSDEV = 0");
            root.addComment("SOURCE_BATTDATA_TYPE_SQLSERVER = 1");
            root.addComment("SOURCE_BATTDATA_TYPE_C_INTERFACE = 2");
            root.addComment("SOURCE_BATTDATA_TYPE_SQLSERVER_AND_C_INTERFACE = 3");
            param = root.addElement("source_battdata_type");
            param.addText(String.valueOf(sourceBattDataType));
            //-------------------------------------------------------//
            //-------------------------------------------------------//
            param = root.addElement("source_sqlserver_config");
            param.addComment("SOURCE_SQLSERVER_TYPE_SYBASE_DEMO = 0");
            param.addComment("SOURCE_SQLSERVER_TYPE_SYBASE = 1");
            param.addComment("SOURCE_SQLSERVER_TYPE_MSSQLSERVER = 2");
            sub_param = param.addElement("source_sqlserver_type");
            sub_param.addText(String.valueOf(sourceSQLServerType));
            sub_param = param.addElement("source_sqlserver_ip");
            sub_param.addText(sourceSQLServerIp);
            sub_param = param.addElement("source_sqlserver_usrname");
            sub_param.addText(sourceSQLServerUsrName);
            sub_param = param.addElement("source_sqlserver_pwd");
            sub_param.addText(sourceSQLServerPWD);
            sub_param = param.addElement("source_sqlserver_port");
            sub_param.addText(String.valueOf(sourceSQLServerPort));
            //-------------------------------------------------------//
            //--------------------------------------------------------//
            param = root.addElement("c_interface_server_config");
            sub_param = param.addElement("c_interface_server_ip");
            sub_param.addText(cInterfaceServerIp);
            sub_param = param.addElement("c_interface_usrname");
            sub_param.addText(cInterfaceUsrName);
            sub_param = param.addElement("c_interface_pwd");
            sub_param.addText(cInterfacePWD);
            sub_param = param.addElement("c_interface_sokcet_port");
            sub_param.addText(String.valueOf(cInterfaceSocketPort));
            //--------------------------------------------------------//
            //--------------------------------------------------------//
            param = root.addElement("fbs_device_base_ip");
            param.addText(fbsDeviceBaseIp);
            //--------------------------------------------------------//
            param = root.addElement("syb_srv_curr_charge_dir_pos");
            param.addText(String.valueOf(sybSrvCurrChargeDirPos));
            param = root.addElement("mysql_conn_count_max");
            param.addText(String.valueOf(mysqlConnCountMax));
            param = root.addElement("work_thread_count_max");
            param.addText(String.valueOf(workThreadCountMax));
            //--------------------------------------------------------//
            param = root.addElement("batt_alarm_fn_config");
            sub_param = param.addElement("batt_alarm_fn_en");
            sub_param.addText(String.valueOf(battAlarmFnEn));
            sub_param = param.addElement("batt_alarm_fn_start_delay");
            sub_param.addText(String.valueOf(battAlarmFnStartDelay));
            sub_param = param.addElement("batt_alarm_cleared_delay");
            sub_param.addText(String.valueOf(battAlarmClearedDelay));
            sub_param = param.addElement("batt_alarm_data_daycount_max");
            sub_param.addText(String.valueOf(battAlarmDataDayCountMax));
            //--------------------------------------------------------//
            //--------------------------------------------------------//
            param = root.addElement("batt_res_store_fn_config");
            sub_param = param.addElement("batt_res_store_fn_en");
            sub_param.addText(String.valueOf(battResStoreFnEn));
            sub_param = param.addElement("batt_res_store_delay_for_test_manual");
            sub_param.addText(String.valueOf(battResStoreDelayForTestManual));
            sub_param = param.addElement("batt_res_store_day_interval");
            sub_param.addText(String.valueOf(battResStoreDayInterval));
            //--------------------------------------------------------//
            //--------------------------------------------------------//
            param = root.addElement("batt_auto_store_fn_config");
            sub_param = param.addElement("batt_auto_store_fn_en");
            sub_param.addText(String.valueOf(battAutoStoreFnEn));
            sub_param = param.addElement("batt_auto_store_delay_for_start_up");
            sub_param.addText(String.valueOf(battAutoStoreDelayForStartUp));
            sub_param = param.addElement("batt_auto_store_minute_interval");
            sub_param.addText(String.valueOf(battAutoStoreMinuteInterval));
            sub_param = param.addElement("batt_auto_store_day_count_max");
            sub_param.addText(String.valueOf(battAutoStoreDayCountMax));
            //--------------------------------------------------------//
            //--------------------------------------------------------//
            param = root.addElement("user_task_fn_config");
            sub_param = param.addElement("user_task_fn_en");
            sub_param.addText(String.valueOf(userTaskFnEn));
            sub_param = param.addElement("user_task_sms_fn_en");
            sub_param.addText(String.valueOf(userTaskSmsFnEn));
            sub_param = param.addElement("user_task_sms_dev_ip");
            sub_param.addText(userTaskSmsDevIp);
            //--------------------------------------------------------//
            //--------------------------------------------------------//
            param = root.addElement("idce8200_server_fn_config");
            param.addText(String.valueOf(idce8200ServerFnEn));
            param = root.addElement("mobile_server_fn_config");
            param.addText(String.valueOf(mobileServerFnEn));
            param = root.addElement("ftp_server_fn_config");
            param.addText(String.valueOf(ftpServerFnEn));
            //--------------------------------------------------------//
            //-------------------------------------------------------//
            param = root.addElement("auto_sqldb_backup_dayinterval");
            param.addText(String.valueOf(autoSqlDbBackUpDayInterval));
            //-------------------------------------------------------//
            //-------------------------------------------------------//
            param = root.addElement("bpm7100_commerr_dataclear_en");
            param.addText(String.valueOf(bpm7100CommErrDataClearEN));
            //-------------------------------------------------------//
            //-------------------------------------------------------//
            param = root.addElement("fbsdev_comm_rate");
            param.addText(String.valueOf(fbsDevCommRate));
            //-------------------------------------------------------//
            //-------------------------------------------------------//
            param = root.addElement("dev_bts_severcomm_en");
            param.addText(String.valueOf(DevBTS_SeverComm_En));
            //-------------------------------------------------------//
            //-------------------------------------------------------//
            param = root.addElement("devfbs9100_severcomm_en");
            param.addText(String.valueOf(DevFBS9100_SeverComm_En));
            //-------------------------------------------------------//
            //-------------------------------------------------------//
            param = root.addElement("devfbs9100_clientcomm_en");
            param.addText(String.valueOf(DevFBS9100_ClientComm_En));
            //-------------------------------------------------------//
            OutputFormat format = OutputFormat.createPrettyPrint();
            format.setEncoding("gbk");
            XMLWriter writer2 = new XMLWriter(new FileWriter(ConfigFileName), format);
            writer2.write(document);
            writer2.close();
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    public void readConfigFromXml()
    {
        boolean res = true;
        try
        {
            SAXReader reader = new SAXReader();
            Document document = reader.read(new File(ConfigFileName));
            Element rootnode = document.getRootElement();
            Element node;
            Element sub_node;
            //------------------------------------------------------------//
            node = rootnode.element("mysql_ramdb_recreate_en");
            mysqlDB_RecreateEn = Boolean.parseBoolean(node.getTextTrim());
            //------------------------------------------------------------//
            node = rootnode.element("mysql_server_ip");
            mysqlServerIp = node.getTextTrim();
            //------------------------------------------------------------//
            node = rootnode.element("source_battdata_type");
            sourceBattDataType = Integer.parseInt(node.getTextTrim());
            if(sourceBattDataType < 0)
                sourceBattDataType = 0;
            if(sourceBattDataType > 3)
                sourceBattDataType = 3;
            //------------------------------------------------------------//
            node = rootnode.element("source_sqlserver_config");
            sub_node = node.element("source_sqlserver_type");
            sourceSQLServerType = Integer.parseInt(sub_node.getTextTrim());
            sub_node = node.element("source_sqlserver_ip");
            sourceSQLServerIp = sub_node.getTextTrim();
            sub_node = node.element("source_sqlserver_usrname");
            sourceSQLServerUsrName = sub_node.getTextTrim();
            sub_node = node.element("source_sqlserver_pwd");
            sourceSQLServerPWD = sub_node.getTextTrim();
            sub_node = node.element("source_sqlserver_port");
            sourceSQLServerPort = Integer.parseInt(sub_node.getTextTrim());
            //------------------------------------------------------------//
            //------------------------------------------------------------//
            node = rootnode.element("c_interface_server_config");
            sub_node = node.element("c_interface_server_ip");
            cInterfaceServerIp = sub_node.getTextTrim();
            sub_node = node.element("c_interface_usrname");
            cInterfaceUsrName = sub_node.getTextTrim();
            sub_node = node.element("c_interface_pwd");
            cInterfacePWD = sub_node.getTextTrim();
            sub_node = node.element("c_interface_sokcet_port");
            cInterfaceSocketPort = Integer.parseInt(sub_node.getTextTrim());
            //------------------------------------------------------------//
            //------------------------------------------------------------//
            node = rootnode.element("fbs_device_base_ip");
            fbsDeviceBaseIp = node.getTextTrim();
            //------------------------------------------------------------//
            node = rootnode.element("syb_srv_curr_charge_dir_pos");
            sybSrvCurrChargeDirPos = Boolean.parseBoolean(node.getTextTrim());
            node = rootnode.element("mysql_conn_count_max");
            mysqlConnCountMax = Integer.parseInt(node.getTextTrim());
            if(mysqlConnCountMax < 5)
                mysqlConnCountMax = 5;
            if(mysqlConnCountMax > 400)
                mysqlConnCountMax = 400;
            node = rootnode.element("work_thread_count_max");
            workThreadCountMax = Integer.parseInt(node.getTextTrim());
/*            if(workThreadCountMax < 10)
                workThreadCountMax = 10;
            if(workThreadCountMax > 400)
                workThreadCountMax = 400;*/
            //-------------------------------------------------------//
            node = rootnode.element("batt_alarm_fn_config");
            sub_node = node.element("batt_alarm_fn_en");
            battAlarmFnEn = Boolean.parseBoolean(sub_node.getTextTrim());
            sub_node = node.element("batt_alarm_fn_start_delay");
            battAlarmFnStartDelay = Integer.parseInt(sub_node.getTextTrim());
            if(battAlarmFnStartDelay < 0)
                battAlarmFnStartDelay = 0;
            if(battAlarmFnStartDelay > 3600)
                battAlarmFnStartDelay = 3600;
            sub_node = node.element("batt_alarm_cleared_delay");
            battAlarmClearedDelay = Integer.parseInt(sub_node.getTextTrim());
            if(battAlarmClearedDelay < 0)
                battAlarmClearedDelay = 0;
            if(battAlarmClearedDelay > 3600)
                battAlarmClearedDelay = 3600;
            sub_node = node.element("batt_alarm_data_daycount_max");
            battAlarmDataDayCountMax = Integer.parseInt(sub_node.getTextTrim());
//            if(battAlarmDataDayCountMax < 7)
//                battAlarmDataDayCountMax = 7;
//            if(battAlarmDataDayCountMax > 2048)
//                battAlarmDataDayCountMax = 2048;
            //-------------------------------------------------------//
            //-------------------------------------------------------//
            node = rootnode.element("batt_res_store_fn_config");
            sub_node = node.element("batt_res_store_fn_en");
            battResStoreFnEn = Boolean.parseBoolean(sub_node.getTextTrim());
            sub_node = node.element("batt_res_store_delay_for_test_manual");
            battResStoreDelayForTestManual = Integer.parseInt(sub_node.getTextTrim());
            if(battResStoreDelayForTestManual < 180)
                battResStoreDelayForTestManual = 180;
            if(battResStoreDelayForTestManual > 1800)
                battResStoreDelayForTestManual = 1800;
            sub_node = node.element("batt_res_store_day_interval");
            battResStoreDayInterval = Integer.parseInt(sub_node.getTextTrim());
            if(battResStoreDayInterval < 1)
                battResStoreDayInterval = 1;
            if(battResStoreDayInterval > 360)
                battResStoreDayInterval = 360;
            //-------------------------------------------------------//
            //-------------------------------------------------------//
            node = rootnode.element("batt_auto_store_fn_config");
            sub_node = node.element("batt_auto_store_fn_en");
            battAutoStoreFnEn = Boolean.parseBoolean(sub_node.getTextTrim());
            sub_node = node.element("batt_auto_store_delay_for_start_up");
            battAutoStoreDelayForStartUp = Integer.parseInt(sub_node.getTextTrim());
            if(battAutoStoreDelayForStartUp < 180)
                battAutoStoreDelayForStartUp = 180;
            if(battAutoStoreDelayForStartUp > 3600)
                battAutoStoreDelayForStartUp = 3600;
            sub_node = node.element("batt_auto_store_minute_interval");
            battAutoStoreMinuteInterval = Integer.parseInt(sub_node.getTextTrim());
            if(battAutoStoreMinuteInterval < 10)
                battAutoStoreMinuteInterval = 10;
            if(battAutoStoreMinuteInterval > ((60*24)*30))
                battAutoStoreMinuteInterval = ((60*24)*30);
            sub_node = node.element("batt_auto_store_day_count_max");
            battAutoStoreDayCountMax = Integer.parseInt(sub_node.getTextTrim());
            if(battAutoStoreDayCountMax < 1)
                battAutoStoreDayCountMax = 1;
            if(battAutoStoreDayCountMax > 300)
                battAutoStoreDayCountMax = 300;
            //-------------------------------------------------------//
            //--------------------------------------------------------//
            node = rootnode.element("user_task_fn_config");
            sub_node = node.element("user_task_fn_en");
            userTaskFnEn = Boolean.parseBoolean(sub_node.getTextTrim());
            sub_node = node.element("user_task_sms_fn_en");
            userTaskSmsFnEn = Boolean.parseBoolean(sub_node.getTextTrim());
            sub_node = node.element("user_task_sms_dev_ip");
            userTaskSmsDevIp = sub_node.getTextTrim();
            //--------------------------------------------------------//
            //--------------------------------------------------------//
            node = rootnode.element("idce8200_server_fn_config");
            idce8200ServerFnEn = Boolean.parseBoolean(node.getTextTrim());
            node = rootnode.element("mobile_server_fn_config");
            mobileServerFnEn = Boolean.parseBoolean(node.getTextTrim());
            node = rootnode.element("ftp_server_fn_config");
            ftpServerFnEn = Boolean.parseBoolean(node.getTextTrim());
            //--------------------------------------------------------//
            //-------------------------------------------------------//
            node = rootnode.element("auto_sqldb_backup_dayinterval");
            autoSqlDbBackUpDayInterval = Integer.parseInt(node.getTextTrim());
            if(autoSqlDbBackUpDayInterval < 7) {
                autoSqlDbBackUpDayInterval = 7;
            }
            if(autoSqlDbBackUpDayInterval > 365) {
                autoSqlDbBackUpDayInterval = 365;
            }
            //-------------------------------------------------------//
            //-------------------------------------------------------//
            node = rootnode.element("bpm7100_commerr_dataclear_en");
            bpm7100CommErrDataClearEN = Boolean.parseBoolean(node.getTextTrim());
            //-------------------------------------------------------//
            //-------------------------------------------------------//
            node = rootnode.element("fbsdev_comm_rate");
            fbsDevCommRate = Integer.parseInt(node.getTextTrim());
            //-------------------------------------------------------//
            //-------------------------------------------------------//
            node = rootnode.element("dev_bts_severcomm_en");
            DevBTS_SeverComm_En = Boolean.parseBoolean(node.getTextTrim());
            //-------------------------------------------------------//
            //-------------------------------------------------------//
            node = rootnode.element("devfbs9100_severcomm_en");
            DevFBS9100_SeverComm_En = Boolean.parseBoolean(node.getTextTrim());
            //-------------------------------------------------------//
            //-------------------------------------------------------//
            node = rootnode.element("devfbs9100_clientcomm_en");
            DevFBS9100_ClientComm_En = Boolean.parseBoolean(node.getTextTrim());
            //-------------------------------------------------------//
        } catch (NullPointerException | NumberFormatException | DocumentException e) {
            res = false;
            e.printStackTrace();
        } finally {
            if(false == res)
                writeConfigToXml();
        }
    }
}
BattMonitor_DB_Builder/src/com/database_util/DB_Alarm.java
@@ -2,13 +2,17 @@
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);            
@@ -24,6 +28,7 @@
        createTb_Alarm_Message(pool, recreate);
        
        
        System.out.println(" db_alarm init end at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
    }
    
    /**
BattMonitor_DB_Builder/src/com/database_util/DB_App_Sys.java
@@ -4,14 +4,18 @@
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import com.base.Com;
import com.sql.MysqlConnPool;
import com.sql.Sql_Mysql;
public class DB_App_Sys {
    public static void init(MysqlConnPool pool, boolean recreate) {
        System.out.println(" db_app_sys init start at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
        createDB_AppSys(pool);
        
        createPage_Param_Table(pool, recreate);
@@ -46,6 +50,7 @@
        createTb_Menu_Approve_Table(pool, recreate);//创建表tb_menu_approve
        System.out.println(" db_app_sys init end at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
    }
    
    /**
BattMonitor_DB_Builder/src/com/database_util/DB_Batt_History.java
@@ -1,17 +1,21 @@
package com.database_util;
import java.sql.SQLException;
import java.util.Date;
import com.base.Com;
import com.sql.MysqlConnPool;
import com.sql.Sql_Mysql;
public class DB_Batt_History {
    
    public static void init(MysqlConnPool pool, boolean recreate) {
        System.out.println(" db_batt_history init start at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
        
        createDB_BATT_HISTORY(pool);
        
        
        System.out.println(" db_batt_testdata init end at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
        
    }
    
BattMonitor_DB_Builder/src/com/database_util/DB_Batt_Testdata.java
@@ -1,19 +1,24 @@
package com.database_util;
import java.sql.SQLException;
import java.util.Date;
import com.base.Com;
import com.sql.MysqlConnPool;
import com.sql.Sql_Mysql;
public class DB_Batt_Testdata {
    public static void init(MysqlConnPool pool, boolean recreate) {
        System.out.println(" db_batt_testdata init start at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
        createDB_BATT_TESTDATA(pool);
        
        createBattTestDataInf_Table(pool, recreate);
        
        createBattResDataInf_Table(pool, recreate);
        
        System.out.println(" db_batt_testdata init end at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
    }
    
    /**
BattMonitor_DB_Builder/src/com/database_util/DB_Dev_History.java
@@ -1,15 +1,19 @@
package com.database_util;
import java.sql.SQLException;
import java.util.Date;
import com.base.Com;
import com.sql.MysqlConnPool;
import com.sql.Sql_Mysql;
public class DB_Dev_History {
    public static void init(MysqlConnPool pool, boolean recreate) {
        System.out.println(" db_dev_history init start at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
        
        createDB_Dev_HISTORY(pool);
        
        System.out.println(" db_dev_history init end at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
    }
    
    /**
BattMonitor_DB_Builder/src/com/database_util/DB_Dev_TestParam.java
@@ -2,19 +2,27 @@
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_Dev_TestParam {
    public final static String Tb_Batt_TestParam_Table = "tb_batt_testparam_";
    public static void init(MysqlConnPool pool, boolean recreate) {
        System.out.println(" db_dev_testparam init start at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
        
        createDB_Dev_TESTPARAM(pool);
        
        createBatt_TestParam_Table(pool, recreate);            //创建设备历史参数表用于存储次放电前的放电参数
        
    
        System.out.println(" db_dev_testparam init end at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
        
    }
    
@@ -40,99 +48,111 @@
     * @param recreate
     */
    public static void createBatt_TestParam_Table(MysqlConnPool pool, boolean recreate) {
        //System.out.println("Start:"+Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
        String sql_str_sel = " SELECT FBSDeviceId,BattGroupId " + 
                             " FROM " + Sql_Mysql.BattInf_Table +
                             " WHERE (FLOOR(FBSDeviceId/100000)=8059) " +     //充放电一体机
                             " OR (FLOOR(FBSDeviceId/10000000)=91) " +         //BTS
                             " OR ((FLOOR(FBSDeviceId/100000)=6185)) ";        //61850
        Sql_Mysql sql = new Sql_Mysql(pool.getConn());
        StringBuffer sql_str_head = new StringBuffer(" CREATE TABLE IF NOT EXISTS ");
        StringBuffer sql_str_body = new StringBuffer(" (" +
                "  `num` bigint(20) NOT NULL AUTO_INCREMENT," +
                "  `record_time` datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '参数更新时间'," +
                "  `BattGroupId` int(11) NOT NULL DEFAULT '1' COMMENT '电池组ID'," +
                "  `test_record_count` int(11) NOT NULL DEFAULT '1' COMMENT '电池组放电次数对应db_batt_testdata.tb_batttestdata_inf'," +
                "  `op_cmd` int(11) NOT NULL DEFAULT '0'," +
                "  `TestCmd` int(11) NOT NULL DEFAULT '0' COMMENT '测试类型'," +
                "  `HourRate` int(11) NOT NULL DEFAULT '0' COMMENT '放电小时率'," +
                "  `DisCurr` float NOT NULL DEFAULT '0' COMMENT '放电电流(A)'," +
                "  `DisCap` float NOT NULL DEFAULT '0' COMMENT '放电容量(AH)'," +
                "  `DisTime` int(11) NOT NULL DEFAULT '0' COMMENT '放电时长(分钟)'," +
                "  `GroupVol_LOW` float NOT NULL DEFAULT '0' COMMENT '组端下限(V)'," +
                "  `MonomerVol_LOW` float NOT NULL DEFAULT '0' COMMENT '单体下限(V)'," +
                "  `MonomerLowCount` int(11) NOT NULL DEFAULT '0' COMMENT '单体下限数量'," +
                "  `BattGroupNum` int(11) NOT NULL DEFAULT '0' COMMENT '组号'," +
                "  `OnlineVolLowAction` int(11) NOT NULL DEFAULT '0' COMMENT '在线电压低处理'," +
                "  `DCVolHighLimit` float NOT NULL DEFAULT '0' COMMENT '升压上限(V)'," +
                "  `ChargeCurrSet` float NOT NULL DEFAULT '0' COMMENT '充电电流(V)'," +
                "  `MonomerTmp_High` float NOT NULL DEFAULT '0' COMMENT '单体温度上限(℃)'," +
                "  `AutoTestStartVol` float NOT NULL DEFAULT '0'," +
                "  `OnLineVol_Low` float NOT NULL DEFAULT '0' COMMENT '在线电压低阀值'," +
                "  `OffLineYH_Cycle` int(11) NOT NULL DEFAULT '0' COMMENT '离线养护周期'," +
                "  `OffLineYHstarttime` datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '养护计划开始时间'," +
                "  `OffLineYHTimes` int(11) NOT NULL DEFAULT '1' COMMENT '离线养护执行次数'," +
                "  `OffLineYHOnceCycle` int(11) NOT NULL DEFAULT '1' COMMENT '离线养护每次执行周期'," +
                "  `MonCount` int(11) NOT NULL DEFAULT '0' COMMENT '每组单体数'," +
                "  `MonVol` float NOT NULL DEFAULT '0' COMMENT '单体电压'," +
                "  `DisPower` float NOT NULL DEFAULT '0' COMMENT '预放功率(0.1kw)'," +
                "  `DisPreRes` float(11,0) NOT NULL DEFAULT '0' COMMENT '放电阻值(mΩ)'," +
                "  `CharCap` int(11) NOT NULL DEFAULT '0' COMMENT '充电容量(AH)'," +
                "  `CharTimeLong` int(11) NOT NULL DEFAULT '0' COMMENT '充电时长(min)'," +
                "  `FloatCharTimeLong` int(11) NOT NULL DEFAULT '0' COMMENT '浮充时长'," +
                "  `CharSotpCurr` float NOT NULL DEFAULT '0' COMMENT '截止电流(0.1A)'," +
                "  `MonVolHightLimit` float NOT NULL DEFAULT '0' COMMENT '单体上限(0.01V)'," +
                "  `MonVolHightLimitCount` int(11) NOT NULL DEFAULT '0' COMMENT '单体上限数量'," +
                "  `CharHighTmp` float(11,0) NOT NULL DEFAULT '45' COMMENT '充电过温'," +
                "  `DisWaitTime` int(11) NOT NULL DEFAULT '0' COMMENT '放完静置(0-500分钟)'," +
                "  `CharWaitTime` int(11) NOT NULL DEFAULT '0' COMMENT '充完静置(0-500分钟)'," +
                "  `FlowOver_Count` int(11) NOT NULL DEFAULT '1' COMMENT '恒流总阶段数[1-3]'," +
                "  `FlowOver_CharCurr_1` float NOT NULL DEFAULT '0' COMMENT '恒流1阶段充电电流'," +
                "  `FlowOver_CharCurr_2` float NOT NULL DEFAULT '0' COMMENT '恒流2阶段充电电流'," +
                "  `FlowOver_CharCurr_3` float NOT NULL DEFAULT '0' COMMENT '恒流3阶段充电电流'," +
                "  `FlowOver_CharTime_1` int(11) NOT NULL DEFAULT '0' COMMENT '恒流1阶段充电时长'," +
                "  `FlowOver_CharTime_2` int(11) NOT NULL DEFAULT '0' COMMENT '恒流2阶段充电时长'," +
                "  `FlowOver_CharTime_3` int(11) NOT NULL DEFAULT '0' COMMENT '恒流3阶段充电时长'," +
                "  `ChargeVolt` float NOT NULL DEFAULT '0' COMMENT '充电电压(V)'," +
                "  `C_ProtectVol1` float NOT NULL DEFAULT '0' COMMENT '恒流保护电压1'," +
                "  `C_ProtectVol2` float NOT NULL DEFAULT '0' COMMENT '恒流保护电压2'," +
                "  `C_ProtectVol3` float NOT NULL DEFAULT '0' COMMENT '恒流保护电压3'," +
                "  `C_mon_uppervol1` float NOT NULL DEFAULT '0' COMMENT '恒流单体上限1'," +
                "  `C_mon_uppervol2` float NOT NULL DEFAULT '0' COMMENT '恒流单体上限2'," +
                "  `C_mon_uppervol3` float NOT NULL DEFAULT '0' COMMENT '恒流单体上限3'," +
                "  `C_mon_uppernum1` int(11) NOT NULL DEFAULT '0' COMMENT '恒流上限个数1'," +
                "  `C_mon_uppernum2` int(11) NOT NULL DEFAULT '0' COMMENT '恒流上限个数2'," +
                "  `C_mon_uppernum3` int(11) NOT NULL DEFAULT '0' COMMENT '恒流上限个数3'," +
                "  `HV_charge_num` int(11) NOT NULL DEFAULT '0' COMMENT '恒压总阶段数[1~3]'," +
                "  `HV_charge_Vol1` float NOT NULL DEFAULT '0' COMMENT '恒压阶段1充电电压'," +
                "  `HV_charge_Vol2` float NOT NULL DEFAULT '0' COMMENT '恒压阶段2充电电压'," +
                "  `HV_charge_Vol3` float NOT NULL DEFAULT '0' COMMENT '恒压阶段3充电电压'," +
                "  `HV_time1` int(11) NOT NULL DEFAULT '0' COMMENT '恒压阶段1充电时间'," +
                "  `HV_time2` int(11) NOT NULL DEFAULT '0' COMMENT '恒压阶段2充电时间'," +
                "  `HV_time3` int(11) NOT NULL DEFAULT '0' COMMENT '恒压阶段3充电时间'," +
                "  `HV_ProtectCurr1` float NOT NULL DEFAULT '0' COMMENT '恒压阶段1保护电流'," +
                "  `HV_ProtectCurr2` float NOT NULL DEFAULT '0' COMMENT '恒压阶段2保护电流'," +
                "  `HV_ProtectCurr3` float NOT NULL DEFAULT '0' COMMENT '恒压阶段3保护电流'," +
                "  `HV_mon_uppervol1` float NOT NULL DEFAULT '0' COMMENT '恒压阶段1单体上限'," +
                "  `HV_mon_uppervol2` float NOT NULL DEFAULT '0' COMMENT '恒压阶段2单体上限'," +
                "  `HV_mon_uppervol3` float NOT NULL DEFAULT '0' COMMENT '恒压阶段3单体上限'," +
                "  `HV_mon_uppernum1` int(11) NOT NULL DEFAULT '0' COMMENT '恒压阶段1上限个数'," +
                "  `HV_mon_uppernum2` int(11) NOT NULL DEFAULT '0' COMMENT '恒压阶段2上限个数'," +
                "  `HV_mon_uppernum3` int(11) NOT NULL DEFAULT '0' COMMENT '恒压阶段3上限个数'," +
                "  PRIMARY KEY (`num`)," +
                "  KEY `index_battgroupid` (`BattGroupId`) USING BTREE," +
                "  KEY `index_test_record_count` (`test_record_count`) USING BTREE" +
                ") ENGINE=InnoDB DEFAULT CHARSET=utf8;");
        StringBuffer sql_str_buff = new StringBuffer();
        ResultSet res = null;
        try {
            res = sql.sqlMysqlQuery(sql_str_sel);
            while(res.next()) {
                int battgroupid = res.getInt("BattGroupId");
                sql.sqlMysqlUseDB(Sql_Mysql.DB_DEV_TESTPARAM);
                if(!sql.sqlMysqlCheckIfTableExist(Sql_Mysql.Batt_TestParam_Table + battgroupid)) {
                    sql.sqlMysqlExecute(" CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Batt_TestParam_Table + battgroupid + " (" +
                            "  `num` bigint(20) NOT NULL AUTO_INCREMENT," +
                            "  `record_time` datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '参数更新时间'," +
                            "  `BattGroupId` int(11) NOT NULL DEFAULT '1' COMMENT '电池组ID'," +
                            "  `test_record_count` int(11) NOT NULL DEFAULT '1' COMMENT '电池组放电次数对应db_batt_testdata.tb_batttestdata_inf'," +
                            "  `op_cmd` int(11) NOT NULL DEFAULT '0'," +
                            "  `TestCmd` int(11) NOT NULL DEFAULT '0' COMMENT '测试类型'," +
                            "  `HourRate` int(11) NOT NULL DEFAULT '0' COMMENT '放电小时率'," +
                            "  `DisCurr` float NOT NULL DEFAULT '0' COMMENT '放电电流(A)'," +
                            "  `DisCap` float NOT NULL DEFAULT '0' COMMENT '放电容量(AH)'," +
                            "  `DisTime` int(11) NOT NULL DEFAULT '0' COMMENT '放电时长(分钟)'," +
                            "  `GroupVol_LOW` float NOT NULL DEFAULT '0' COMMENT '组端下限(V)'," +
                            "  `MonomerVol_LOW` float NOT NULL DEFAULT '0' COMMENT '单体下限(V)'," +
                            "  `MonomerLowCount` int(11) NOT NULL DEFAULT '0' COMMENT '单体下限数量'," +
                            "  `BattGroupNum` int(11) NOT NULL DEFAULT '0' COMMENT '组号'," +
                            "  `OnlineVolLowAction` int(11) NOT NULL DEFAULT '0' COMMENT '在线电压低处理'," +
                            "  `DCVolHighLimit` float NOT NULL DEFAULT '0' COMMENT '升压上限(V)'," +
                            "  `ChargeCurrSet` float NOT NULL DEFAULT '0' COMMENT '充电电流(V)'," +
                            "  `MonomerTmp_High` float NOT NULL DEFAULT '0' COMMENT '单体温度上限(℃)'," +
                            "  `AutoTestStartVol` float NOT NULL DEFAULT '0'," +
                            "  `OnLineVol_Low` float NOT NULL DEFAULT '0' COMMENT '在线电压低阀值'," +
                            "  `OffLineYH_Cycle` int(11) NOT NULL DEFAULT '0' COMMENT '离线养护周期'," +
                            "  `OffLineYHstarttime` datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '养护计划开始时间'," +
                            "  `OffLineYHTimes` int(11) NOT NULL DEFAULT '1' COMMENT '离线养护执行次数'," +
                            "  `OffLineYHOnceCycle` int(11) NOT NULL DEFAULT '1' COMMENT '离线养护每次执行周期'," +
                            "  `MonCount` int(11) NOT NULL DEFAULT '0' COMMENT '每组单体数'," +
                            "  `MonVol` float NOT NULL DEFAULT '0' COMMENT '单体电压'," +
                            "  `DisPower` float NOT NULL DEFAULT '0' COMMENT '预放功率(0.1kw)'," +
                            "  `DisPreRes` float(11,0) NOT NULL DEFAULT '0' COMMENT '放电阻值(mΩ)'," +
                            "  `CharCap` int(11) NOT NULL DEFAULT '0' COMMENT '充电容量(AH)'," +
                            "  `CharTimeLong` int(11) NOT NULL DEFAULT '0' COMMENT '充电时长(min)'," +
                            "  `FloatCharTimeLong` int(11) NOT NULL DEFAULT '0' COMMENT '浮充时长'," +
                            "  `CharSotpCurr` float NOT NULL DEFAULT '0' COMMENT '截止电流(0.1A)'," +
                            "  `MonVolHightLimit` float NOT NULL DEFAULT '0' COMMENT '单体上限(0.01V)'," +
                            "  `MonVolHightLimitCount` int(11) NOT NULL DEFAULT '0' COMMENT '单体上限数量'," +
                            "  `CharHighTmp` float(11,0) NOT NULL DEFAULT '45' COMMENT '充电过温'," +
                            "  `DisWaitTime` int(11) NOT NULL DEFAULT '0' COMMENT '放完静置(0-500分钟)'," +
                            "  `CharWaitTime` int(11) NOT NULL DEFAULT '0' COMMENT '充完静置(0-500分钟)'," +
                            "  `FlowOver_Count` int(11) NOT NULL DEFAULT '1' COMMENT '恒流总阶段数[1-3]'," +
                            "  `FlowOver_CharCurr_1` float NOT NULL DEFAULT '0' COMMENT '恒流1阶段充电电流'," +
                            "  `FlowOver_CharCurr_2` float NOT NULL DEFAULT '0' COMMENT '恒流2阶段充电电流'," +
                            "  `FlowOver_CharCurr_3` float NOT NULL DEFAULT '0' COMMENT '恒流3阶段充电电流'," +
                            "  `FlowOver_CharTime_1` int(11) NOT NULL DEFAULT '0' COMMENT '恒流1阶段充电时长'," +
                            "  `FlowOver_CharTime_2` int(11) NOT NULL DEFAULT '0' COMMENT '恒流2阶段充电时长'," +
                            "  `FlowOver_CharTime_3` int(11) NOT NULL DEFAULT '0' COMMENT '恒流3阶段充电时长'," +
                            "  `ChargeVolt` float NOT NULL DEFAULT '0' COMMENT '充电电压(V)'," +
                            "  `C_ProtectVol1` float NOT NULL DEFAULT '0' COMMENT '恒流保护电压1'," +
                            "  `C_ProtectVol2` float NOT NULL DEFAULT '0' COMMENT '恒流保护电压2'," +
                            "  `C_ProtectVol3` float NOT NULL DEFAULT '0' COMMENT '恒流保护电压3'," +
                            "  `C_mon_uppervol1` float NOT NULL DEFAULT '0' COMMENT '恒流单体上限1'," +
                            "  `C_mon_uppervol2` float NOT NULL DEFAULT '0' COMMENT '恒流单体上限2'," +
                            "  `C_mon_uppervol3` float NOT NULL DEFAULT '0' COMMENT '恒流单体上限3'," +
                            "  `C_mon_uppernum1` int(11) NOT NULL DEFAULT '0' COMMENT '恒流上限个数1'," +
                            "  `C_mon_uppernum2` int(11) NOT NULL DEFAULT '0' COMMENT '恒流上限个数2'," +
                            "  `C_mon_uppernum3` int(11) NOT NULL DEFAULT '0' COMMENT '恒流上限个数3'," +
                            "  `HV_charge_num` int(11) NOT NULL DEFAULT '0' COMMENT '恒压总阶段数[1~3]'," +
                            "  `HV_charge_Vol1` float NOT NULL DEFAULT '0' COMMENT '恒压阶段1充电电压'," +
                            "  `HV_charge_Vol2` float NOT NULL DEFAULT '0' COMMENT '恒压阶段2充电电压'," +
                            "  `HV_charge_Vol3` float NOT NULL DEFAULT '0' COMMENT '恒压阶段3充电电压'," +
                            "  `HV_time1` int(11) NOT NULL DEFAULT '0' COMMENT '恒压阶段1充电时间'," +
                            "  `HV_time2` int(11) NOT NULL DEFAULT '0' COMMENT '恒压阶段2充电时间'," +
                            "  `HV_time3` int(11) NOT NULL DEFAULT '0' COMMENT '恒压阶段3充电时间'," +
                            "  `HV_ProtectCurr1` float NOT NULL DEFAULT '0' COMMENT '恒压阶段1保护电流'," +
                            "  `HV_ProtectCurr2` float NOT NULL DEFAULT '0' COMMENT '恒压阶段2保护电流'," +
                            "  `HV_ProtectCurr3` float NOT NULL DEFAULT '0' COMMENT '恒压阶段3保护电流'," +
                            "  `HV_mon_uppervol1` float NOT NULL DEFAULT '0' COMMENT '恒压阶段1单体上限'," +
                            "  `HV_mon_uppervol2` float NOT NULL DEFAULT '0' COMMENT '恒压阶段2单体上限'," +
                            "  `HV_mon_uppervol3` float NOT NULL DEFAULT '0' COMMENT '恒压阶段3单体上限'," +
                            "  `HV_mon_uppernum1` int(11) NOT NULL DEFAULT '0' COMMENT '恒压阶段1上限个数'," +
                            "  `HV_mon_uppernum2` int(11) NOT NULL DEFAULT '0' COMMENT '恒压阶段2上限个数'," +
                            "  `HV_mon_uppernum3` int(11) NOT NULL DEFAULT '0' COMMENT '恒压阶段3上限个数'," +
                            "  PRIMARY KEY (`num`)," +
                            "  KEY `index_battgroupid` (`BattGroupId`) USING BTREE," +
                            "  KEY `index_test_record_count` (`test_record_count`) USING BTREE" +
                            ") ENGINE=InnoDB DEFAULT CHARSET=utf8;");
                if(!sql.sqlMysqlCheckIfTableExist(Tb_Batt_TestParam_Table + battgroupid)) {
                    sql_str_buff = new StringBuffer();
                    sql_str_buff.append(sql_str_head);
                    sql_str_buff.append(Sql_Mysql.Batt_TestParam_Table + battgroupid);
                    sql_str_buff.append(sql_str_body);
                    sql.sqlMysqlExecute(sql_str_buff.toString());
                }
            }                
            //System.out.println("End:"+Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            sql_str_head = null;
            sql_str_buff = null;
            sql_str_body = null;
            if(null != res) {
                try {
                    res.close();
@@ -144,4 +164,8 @@
        }
    }
    
    /*public static void main(String[] args) {
        MysqlConnPool pool = new MysqlConnPool("192.168.10.79", 3360, 5);
        createBatt_TestParam_Table( pool,  false);
    }*/
}
BattMonitor_DB_Builder/src/com/database_util/DB_Fbo_testdata.java
@@ -1,16 +1,21 @@
package com.database_util;
import java.sql.SQLException;
import java.util.Date;
import com.base.Com;
import com.sql.MysqlConnPool;
import com.sql.Sql_Mysql;
public class DB_Fbo_testdata {
    public static void init(MysqlConnPool pool, boolean recreate) {
        System.out.println(" db_fbo_testdata init start at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
        createDB_FBO_TESTDATA(pool);
        
        createFbotestdata_Inf_Table(pool, recreate);        //创建历史数据inf表
        
        System.out.println(" db_fbo_testdata init end at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
    }
    
    /**
BattMonitor_DB_Builder/src/com/database_util/DB_Ld9_Testdata.java
@@ -2,17 +2,23 @@
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_Ld9_Testdata {
    public static void init(MysqlConnPool pool, boolean recreate) {
        System.out.println(" db_ld9_testdata init start at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
        createDB_LD9_TESTDATA(pool);
        
        createLd9testdata_Inf_Table(pool, recreate);
        
        repireLD9TestDataTable(pool);
        System.out.println(" db_ld9_testdata init end at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
    }
    
    /**
BattMonitor_DB_Builder/src/com/database_util/DB_Param.java
@@ -1,12 +1,16 @@
package com.database_util;
import java.sql.SQLException;
import java.util.Date;
import com.base.Com;
import com.sql.MysqlConnPool;
import com.sql.Sql_Mysql;
public class DB_Param {
    public static void init(MysqlConnPool pool, boolean recreate) {
        System.out.println(" db_param init start at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
        createDB_PARAM(pool);
        
        createDev_Param_Table(pool, recreate);
@@ -14,6 +18,8 @@
        createApp_Param_Table(pool, recreate);
        
        createAlarm_Param_Table(pool, recreate);
        System.out.println(" db_param init end at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
        
    }
    
BattMonitor_DB_Builder/src/com/database_util/DB_Pwrdev_Alarm.java
@@ -2,12 +2,16 @@
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_Pwrdev_Alarm {
    public static void init(MysqlConnPool pool, boolean recreate) {
        System.out.println(" db_pwrdev_alarm start end at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
        createDB_Pwrdev_Alarm (pool);
        
        createPwrdev_Alarm_Table(pool, recreate);
@@ -15,6 +19,8 @@
        createPwrdev_Alarm_History_Table(pool, recreate);
        
        createPwrdev_Alarm_Param_Table(pool, recreate);
        System.out.println(" db_pwrdev_alarm init end at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
        
    }
BattMonitor_DB_Builder/src/com/database_util/DB_Pwrdev_Data_Rt.java
@@ -2,21 +2,32 @@
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_Pwrdev_Data_Rt {
    public static void init(MysqlConnPool pool, boolean recreate) {
        System.out.println(" db_pwrdev_data_rt init start at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
        createDB_PWRDEV_DATA_RT (pool);
        
        createPwrdev_Acdata_Table(pool, recreate);
        System.out.println(Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
        
        createPwrdev_Acdcdata_Table(pool, recreate);
        
        System.out.println(Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
        createPwrdev_Dcdata_Table(pool, recreate);
        
        createPwrdev_Event_Table(pool,recreate);
        System.out.println(" db_pwrdev_data_rt init end at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
    }
    /**
@@ -2352,7 +2363,8 @@
    }
    
    public static void main(String[] args) {
        MysqlConnPool pool = new MysqlConnPool("192.168.10.112", 3360, 50);
        createPwrdev_Acdata_Table(pool, false);
        MysqlConnPool pool = new MysqlConnPool("192.168.10.79", 3360, 50);
        //createPwrdev_Acdata_Table(pool, false);
        init(pool, false);
    }
}
BattMonitor_DB_Builder/src/com/database_util/DB_Pwrdev_Inf.java
@@ -2,12 +2,16 @@
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_Pwrdev_Inf {
    public static void init(MysqlConnPool pool, boolean recreate) {
        System.out.println(" db_pwrdev_inf init start at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
        createDB_PWRDEV_INF (pool);
        
        createPwrdev_Inf_Table(pool, recreate);
@@ -23,6 +27,8 @@
        createPwrapp_Acdcinf_Table(pool, recreate);
        
        createDisplay_Config_Table(pool, recreate);        
        System.out.println(" db_pwrdev_inf init end at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
    }
    /**
BattMonitor_DB_Builder/src/com/database_util/DB_Ram_db.java
@@ -12,6 +12,8 @@
public class DB_Ram_db {
    
    public static void init(MysqlConnPool pool, boolean recreate) {
        System.out.println(" Db_Ram_Db init start at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
        createDb_Ram_Db(pool);
        
        createFBS9100s_fod_state(pool,recreate);            //创建除硫状态表tb_fbs9100s_fod_state    
@@ -19,7 +21,6 @@
        createFBS9100SetDLParam_Table(pool,recreate);        //创建除硫参数表
        
        createFBS9100_NiBian_State_Table(pool, recreate);    //创建逆变信息表
        
        createSocketClientStateTable(pool, recreate);
        
@@ -116,6 +117,136 @@
        //创建远程重启装置状态信息表
        createTB_Dev61851_State_Table(pool,recreate);
        //电操开关遥信实时状态表
        createDEV60870_Inverter_State(pool, recreate);
        //创建电操开关遥测实时状态表
        createDEV60870_Inverter_Info(pool, recreate);
        System.out.println(" Db_Ram_Db init end at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
    }
    /**
     *     创建电操开关遥测实时状态表
     * @param pool
     * @param recreate
     */
    private static void createDEV60870_Inverter_Info(MysqlConnPool pool, boolean recreate) {
        String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.DEV60870_Inverter_Info;
        String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.DEV60870_Inverter_Info + " (" +
                        "  `num` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增主键'," +
                        "  `dev_id` int(11) NOT NULL DEFAULT '608700010' COMMENT '设备ID'," +
                        "  `record_time` datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '记录时间'," +
                        "  `fanCurr` float NOT NULL DEFAULT '0' COMMENT '风扇电流'," +
                        "  `heatPipesTmp` float NOT NULL DEFAULT '0' COMMENT '发热管内部温度'," +
                        "  `heatPipesOutTmp` float NOT NULL DEFAULT '0' COMMENT '发热管出风口温度'," +
                        "  `chargerOutputVol1` float NOT NULL DEFAULT '0' COMMENT '充电机1输出电压'," +
                        "  `chargerOutputCurr1` float NOT NULL DEFAULT '0' COMMENT '充电机1输出电流'," +
                        "  `battOutputVol1` float NOT NULL DEFAULT '0' COMMENT '蓄电池组1输出电压'," +
                        "  `battOutputCurr1` float NOT NULL DEFAULT '0' COMMENT '蓄电池组1输出电流'," +
                        "  `controlBusVol1` float NOT NULL DEFAULT '0' COMMENT '第一组控制母线电压'," +
                        "  `chargerOutputVol2` float NOT NULL DEFAULT '0' COMMENT '充电机2输出电压'," +
                        "  `chargerOutputCurr2` float NOT NULL DEFAULT '0' COMMENT '充电机2输出电流'," +
                        "  `battOutputVol2` float NOT NULL DEFAULT '0' COMMENT '蓄电池组2输出电压'," +
                        "  `battOutputCurr2` float NOT NULL DEFAULT '0' COMMENT '蓄电池组2输出电流'," +
                        "  `controlBusVol2` float NOT NULL DEFAULT '0' COMMENT '第二组控制母线电压'," +
                        "  `inverterAOutputVol` float NOT NULL DEFAULT '0' COMMENT '逆变器输出A相电压'," +
                        "  `inverterAOutputCurr` float NOT NULL DEFAULT '0' COMMENT '逆变器输出A相电流'," +
                        "  `inverterAOutputFreq` float NOT NULL DEFAULT '0' COMMENT '逆变器输出A相频率'," +
                        "  `inverterAOutputBackCurr` float NOT NULL DEFAULT '0' COMMENT '逆变器输出A相回馈电流'," +
                        "  `inverterBOutputVol` float NOT NULL DEFAULT '0' COMMENT '逆变器输出B相电压'," +
                        "  `inverterBOutputCurr` float NOT NULL DEFAULT '0' COMMENT '逆变器输出B相电流'," +
                        "  `inverterBOutputFreq` float NOT NULL DEFAULT '0' COMMENT '逆变器输出B相频率'," +
                        "  `inverterBOutputBackCurr` float NOT NULL DEFAULT '0' COMMENT '逆变器输出B相回馈电流'," +
                        "  `inverterCOutputVol` float NOT NULL DEFAULT '0' COMMENT '逆变器输出C相电压'," +
                        "  `inverterCOutputCurr` float NOT NULL DEFAULT '0' COMMENT '逆变器输出C相电流'," +
                        "  `inverterCOutputFreq` float NOT NULL DEFAULT '0' COMMENT '逆变器输出C相频率'," +
                        "  `inverterCOutputBackCurr` float NOT NULL DEFAULT '0' COMMENT '逆变器输出C相回馈电流'," +
                        "  PRIMARY KEY (`num`)" +
                        ") ENGINE=InnoDB AUTO_INCREMENT=1 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();
        }
    }
    /**
     *     创建电操开关遥信实时状态表
     * @param pool
     * @param recreate
     */
    private static void createDEV60870_Inverter_State(MysqlConnPool pool, boolean recreate) {
        String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.DEV60870_Inverter_State;
        String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.DEV60870_Inverter_State + " (" +
                "  `num` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增主键'," +
                "  `dev_id` int(11) NOT NULL DEFAULT '608700010' COMMENT '设备ID'," +
                "  `record_time` datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '记录时间'," +
                "  `aclose1` int(11) NOT NULL DEFAULT '0' COMMENT '1组交流失电'," +
                "  `aclose2` int(11) NOT NULL DEFAULT '0' COMMENT '2组交流失电'," +
                "  `yhMainTmpHigh` int(11) NOT NULL DEFAULT '0' COMMENT '养护仪主机温度高'," +
                "  `yhMainFault` int(11) NOT NULL DEFAULT '0' COMMENT '养护仪主机故障'," +
                "  `yhFromTmpHigh` int(11) NOT NULL DEFAULT '0' COMMENT '养护仪从机温度高'," +
                "  `yhFromFault` int(11) NOT NULL DEFAULT '0' COMMENT '养护仪从机故障'," +
                "  `commErrorFor104` int(11) NOT NULL DEFAULT '0' COMMENT '101/104通讯故障'," +
                "  `commErrorFor485_1` int(11) NOT NULL DEFAULT '0' COMMENT 'RS485通讯故障1组'," +
                "  `commErrorFor485_2` int(11) NOT NULL DEFAULT '0' COMMENT 'RS485通讯故障2组'," +
                "  `devTmpHigh` int(11) NOT NULL DEFAULT '0' COMMENT '设备温度高'," +
                "  `byPassOpenA` int(11) NOT NULL DEFAULT '0' COMMENT 'A组旁路开开'," +
                "  `byPassOpenB` int(11) NOT NULL DEFAULT '0' COMMENT 'B组旁路开开'," +
                "  `disEquFault` int(11) NOT NULL DEFAULT '0' COMMENT '放电设备故障'," +
                "  `eleOperationSwitch1` int(11) NOT NULL DEFAULT '0' COMMENT '电操1开关状态'," +
                "  `eleOperationSwitch2` int(11) NOT NULL DEFAULT '0' COMMENT '电操2开关状态'," +
                "  `eleOperationSwitch3` int(11) NOT NULL DEFAULT '0' COMMENT '电操3开关状态'," +
                "  `eleOperationSwitch4` int(11) NOT NULL DEFAULT '0' COMMENT '电操4开关状态'," +
                "  `eleOperationSwitch5` int(11) NOT NULL DEFAULT '0' COMMENT '电操5开关状态'," +
                "  `eleOperationSwitch6` int(11) NOT NULL DEFAULT '0' COMMENT '电操6开关状态'," +
                "  `eleOperationSwitch7` int(11) NOT NULL DEFAULT '0' COMMENT '电操7开关状态'," +
                "  `eleOperationSwitch10` int(11) NOT NULL DEFAULT '0' COMMENT '电操10开关状态'," +
                "  `eleOperationSwitch11` int(11) NOT NULL DEFAULT '0' COMMENT '电操11开关状态'," +
                "  `eleOperationSwitch12` int(11) NOT NULL DEFAULT '0' COMMENT '电操12开关状态'," +
                "  `eleOperationSwitch13` int(11) NOT NULL DEFAULT '0' COMMENT '电操13开关状态'," +
                "  `eleOperationSwitch14` int(11) NOT NULL DEFAULT '0' COMMENT '电操14开关状态'," +
                "  `eleOperationSwitch15` int(11) NOT NULL DEFAULT '0' COMMENT '电操15开关状态'," +
                "  `eleOperationSwitch16` int(11) NOT NULL DEFAULT '0' COMMENT '电操16开关状态'," +
                "  `dcContactor1` int(11) NOT NULL DEFAULT '0' COMMENT '直流接触器1'," +
                "  `dcContactor2` int(11) NOT NULL DEFAULT '0' COMMENT '直流接触器2'," +
                "  `charState1` int(11) NOT NULL DEFAULT '0' COMMENT '1号充电机状态'," +
                "  `charState2` int(11) NOT NULL DEFAULT '0' COMMENT '2号充电机状态'," +
                "  `battState1` int(11) NOT NULL DEFAULT '0' COMMENT '第一组蓄电池状态'," +
                "  `battState2` int(11) NOT NULL DEFAULT '0' COMMENT '第二组蓄电池状态'," +
                "  `inverterStatusA` int(11) NOT NULL DEFAULT '0' COMMENT '逆变器A开关机状态'," +
                "  `inverterWorkWayA` int(11) NOT NULL DEFAULT '0' COMMENT '逆变器A工作方式'," +
                "  `inverterFaulltA` int(11) NOT NULL DEFAULT '0' COMMENT '逆变器A设备故障状态'," +
                "  `inverterTmpAlmA` int(11) NOT NULL DEFAULT '0' COMMENT '逆变器A温度报警'," +
                "  `inverterStatusB` int(11) NOT NULL DEFAULT '0' COMMENT '逆变器B开关机状态'," +
                "  `inverterWorkWayB` int(11) NOT NULL DEFAULT '0' COMMENT '逆变器B工作方式'," +
                "  `inverterFaulltB` int(11) NOT NULL DEFAULT '0' COMMENT '逆变器B设备故障状态'," +
                "  `inverterTmpAlmB` int(11) NOT NULL DEFAULT '0' COMMENT '逆变器B温度报警'," +
                "  `inverterStatusC` int(11) NOT NULL DEFAULT '0' COMMENT '逆变器C开关机状态'," +
                "  `inverterWorkWayC` int(11) NOT NULL DEFAULT '0' COMMENT '逆变器C工作方式'," +
                "  `inverterFaulltC` int(11) NOT NULL DEFAULT '0' COMMENT '逆变器C设备故障状态'," +
                "  `inverterTmpAlmC` int(11) NOT NULL DEFAULT '0' COMMENT '逆变器C温度报警'," +
                "  PRIMARY KEY (`num`)" +
                ") ENGINE=InnoDB AUTO_INCREMENT=1 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();
        }
    }
    
    /**
@@ -144,7 +275,7 @@
                "  `battfault1` int(11) NOT NULL DEFAULT '0' COMMENT '电池组故障1'," + 
                "  PRIMARY KEY (`num`)," + 
                "  UNIQUE KEY `index_battgroupid` (`BattGroupId`) USING BTREE" + 
                ") ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8";
                ") ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8";
        Sql_Mysql sql = new Sql_Mysql(pool.getConn());
        try {
            if(true == recreate) {            
@@ -634,22 +765,50 @@
            }
            sql.sqlMysqlExecute(sql_str02);
            //修改字段env_temp    类型为float
            sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Tb_li9130_bms_state
                    + " CHANGE `env_temp` `env_temp` float NOT NULL DEFAULT '0' COMMENT '环境温度';");
            //修改字段mos_temp    类型为float
            sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Tb_li9130_bms_state
                    + " CHANGE `mos_temp` `mos_temp` float NOT NULL DEFAULT '0' COMMENT 'MOS管温度';");
            //修改字段current    类型为float
            sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Tb_li9130_bms_state
                    + " CHANGE `current` `current` float NOT NULL DEFAULT '0' COMMENT '电流';");
            //修改字段sum_vol    类型为float
            sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Tb_li9130_bms_state
                    + " CHANGE `sum_vol` `sum_vol` float NOT NULL DEFAULT '0' COMMENT '总压';");
            
            //修改字段env_temp    类型为float
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_li9130_bms_state'"
                    + " AND column_name='env_temp' AND DATA_TYPE != 'float'");
            if(res.next()){
                //修改字段env_temp    类型为float
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Tb_li9130_bms_state
                        + " CHANGE `env_temp` `env_temp` float NOT NULL DEFAULT '0' COMMENT '环境温度';");
            }
            res = null;
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_li9130_bms_state'"
                    + " AND column_name='mos_temp' AND DATA_TYPE != 'float'");
            if(res.next()) {
                //修改字段mos_temp    类型为float
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Tb_li9130_bms_state
                        + " CHANGE `mos_temp` `mos_temp` float NOT NULL DEFAULT '0' COMMENT 'MOS管温度';");
            }
            res = null;
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_li9130_bms_state'"
                    + " AND column_name='current' AND DATA_TYPE != 'float'");
            if(res.next()) {
                //修改字段current    类型为float
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Tb_li9130_bms_state
                        + " CHANGE `current` `current` float NOT NULL DEFAULT '0' COMMENT '电流';");
            }
            res = null;
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_li9130_bms_state'"
                    + " AND column_name='sum_vol' AND DATA_TYPE != 'float'");
            if(res.next()) {
                //修改字段sum_vol    类型为float
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Tb_li9130_bms_state
                        + " CHANGE `sum_vol` `sum_vol` float NOT NULL DEFAULT '0' COMMENT '总压';");
            }
            
            //添加组号:0-组1;1-组2
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
@@ -1769,7 +1928,7 @@
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100s_DFU_state'"
                    + " AND column_name='sysVersion_new'");
                    + " AND column_name='sysVersion_new' AND DATA_TYPE != 'varchar'");
            if(res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100S_DFUState_Table 
                        + " CHANGE `sysVersion_new` `sysVersion_new` varchar(128) NOT NULL DEFAULT '0';");
@@ -1778,7 +1937,7 @@
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100s_DFU_state'"
                    + " AND column_name='sysVersion_dev'");
                    + " AND column_name='sysVersion_dev' AND DATA_TYPE != 'varchar'");
            if(res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100S_DFUState_Table 
                        + " CHANGE `sysVersion_dev` `sysVersion_dev` varchar(128) NOT NULL DEFAULT '0';");
@@ -1893,7 +2052,13 @@
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SysParam_Table 
                        + " ADD COLUMN `JunHeng_Enabled` float NOT NULL DEFAULT '0' COMMENT '均衡功能启用状态(1:启用;0:禁用)';");
            }else{
            }
            res = null;
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_sysparam'"
                    + " AND column_name='JunHeng_Enabled' AND DATA_TYPE != 'float'");
            if(res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SysParam_Table 
                        + " CHANGE `JunHeng_Enabled` `JunHeng_Enabled` float NOT NULL DEFAULT '0' COMMENT '均衡功能启用状态(1:启用;0:禁用)';");
            }
@@ -2863,7 +3028,6 @@
            if(true == recreate) {            
                sql.sqlMysqlExecute(sql_str01);
            }
            sql.sqlMysqlExecute(sql_str02);    
            //移除之前的以电池组id设置的唯一索引
            res = sql.sqlMysqlQuery("show INDEX FROM "+Sql_Mysql.FBS9100_InsulatstateTable+" WHERE KEY_name = 'unique_battgroupid'");
BattMonitor_DB_Builder/src/com/database_util/DB_battinf.java
@@ -2,7 +2,9 @@
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.base.Com;
import com.sql.MysqlConnPool;
@@ -15,7 +17,8 @@
 */
public class DB_battinf {
    public static void init(MysqlConnPool pool, boolean recreate) {
        //System.out.println(" DB_battinf init start at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
        System.out.println(" db_battinf init start at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
        createDB_battinf(pool);                                        //创建db_battinf 数据库                不存在则创建db_battinf数据库
        
        createBattInf_Table(pool, recreate);                          //创建电池组信息配置表
@@ -38,6 +41,7 @@
        
        createBatt_Alm_Param_TABLE(pool, recreate);
        
        createBattspare_TABLE(pool, recreate);
        
        createBattscrap_TABLE(pool, recreate);
@@ -50,7 +54,7 @@
        
        createBattmon_Standardcurve_TABLE(pool,recreate);
        
        //System.out.println(" DB_battinf init end at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
        System.out.println(" db_battinf init end at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
    }
    
    
@@ -778,6 +782,8 @@
                "  `tmp_id` int(11) DEFAULT '0'," +
                "  `price_factor` float DEFAULT '1' COMMENT '电价系数'," +
                "  `PackCount` int DEFAULT '1' COMMENT '锂电池包数量'," +
                "  `dev_num` varchar(255) NOT NULL DEFAULT '0' COMMENT '设备编号[a059用于标识设备]'," +
                "  `mId` bigint(20) DEFAULT '0' COMMENT '二维码信息标识位'," +
                "  PRIMARY KEY (`num`)," +
                "  UNIQUE KEY `index_battgroup_id` (`BattGroupId`) USING BTREE," +
                "  KEY `index_station_id` (`StationId`)," +
@@ -1112,7 +1118,14 @@
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table 
                        + " ADD COLUMN `dev_num` varchar(255) NOT NULL DEFAULT '0' COMMENT '设备编号[a059用于标识设备]';");
            }else{
            }
            res = null;
            //修改dev_num的默认值'' --->'0'
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_battinf'"
                    + " AND table_name='tb_battinf'"
                    + " AND column_name='dev_num' AND COLUMN_DEFAULT = '';");
            if(res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table 
                        + " CHANGE `dev_num` `dev_num` varchar(255) NOT NULL DEFAULT '0' COMMENT '设备编号[a059用于标识设备]';");
            }
@@ -1127,182 +1140,988 @@
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table 
                        + " ADD COLUMN `mId` bigint(20) DEFAULT '0' COMMENT '二维码信息标识位';");
            }
            //设置column 去掉默认NOT NULL
            {
                ArrayList<String> sql_strs = new ArrayList<String>();
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='StationId'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `StationId` `StationId` varchar(20) DEFAULT '0';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='StationId_ex'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `StationId_ex` `StationId_ex` varchar(20) DEFAULT '0';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='StationName'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `StationName` `StationName` varchar(100) DEFAULT ' ';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='StationName1'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `StationName1` `StationName1` varchar(100) DEFAULT ' ';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='StationName2'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `StationName2` `StationName2` varchar(100) DEFAULT ' ';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='StationName3'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `StationName3` `StationName3` varchar(100) DEFAULT ' ';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='StationName4'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `StationName4` `StationName4` varchar(100) DEFAULT ' ';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='StationName5'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `StationName5` `StationName5` varchar(100) DEFAULT ' ';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='StationName6'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `StationName6` `StationName6` varchar(100) DEFAULT ' ';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='StationName7'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `StationName7` `StationName7` varchar(100) DEFAULT ' ';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='StationName8'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `StationName8` `StationName8` varchar(100) DEFAULT ' ';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='StationName9'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `StationName9` `StationName9` varchar(100) DEFAULT ' ';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='StationIP'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `StationIP` `StationIP` varchar(20) DEFAULT '0';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='FBSDeviceId'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `FBSDeviceId` `FBSDeviceId` bigint(11) DEFAULT '0';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='FBSDeviceIp'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `FBSDeviceIp` `FBSDeviceIp` varchar(50) DEFAULT '192.168.0.88';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='FBSDeviceIp_WG'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `FBSDeviceIp_WG` `FBSDeviceIp_WG` varchar(64) DEFAULT '192.168.0.1';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='FBSDeviceIp_YM'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `FBSDeviceIp_YM` `FBSDeviceIp_YM` varchar(64) DEFAULT '255.255.255.0';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='FBSDeviceName'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `FBSDeviceName` `FBSDeviceName` varchar(100) DEFAULT '0';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='GroupIndexInFBSDevice'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `GroupIndexInFBSDevice` `GroupIndexInFBSDevice` int(11) DEFAULT '0';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='BattModel'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `BattModel` `BattModel` varchar(100) DEFAULT ' ';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='BattGroupId'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `BattGroupId` `BattGroupId` int(11) DEFAULT '0';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='BattGroupNum'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `BattGroupNum` `BattGroupNum` int(11) DEFAULT '0';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='BattGroupName'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `BattGroupName` `BattGroupName` varchar(100) DEFAULT ' ';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='BattGroupName1'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `BattGroupName1` `BattGroupName1` varchar(100) DEFAULT ' ';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='BattGroupName2'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `BattGroupName2` `BattGroupName2` varchar(100) DEFAULT ' ';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='BattGroupName3'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `BattGroupName3` `BattGroupName3` varchar(100) DEFAULT ' ';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='BattGroupName4'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `BattGroupName4` `BattGroupName4` varchar(100) DEFAULT ' ';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='BattGroupName5'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `BattGroupName5` `BattGroupName5` varchar(100) DEFAULT ' ';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='BattGroupName6'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `BattGroupName6` `BattGroupName6` varchar(100) DEFAULT ' ';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='FloatVolLevel'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `FloatVolLevel` `FloatVolLevel` float DEFAULT '1.12';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='OfflineVolLevel'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `OfflineVolLevel` `OfflineVolLevel` float DEFAULT '1.06';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='BattFloatCurrent'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `BattFloatCurrent` `BattFloatCurrent` float DEFAULT '0';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='DeviceId'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `DeviceId` `DeviceId` varchar(20) DEFAULT '0';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='DeviceName'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `DeviceName` `DeviceName` varchar(100) DEFAULT '0';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='MonCount'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `MonCount` `MonCount` int(11) DEFAULT '0';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='MonCapStd'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `MonCapStd` `MonCapStd` float DEFAULT '0';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='MonVolStd'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `MonVolStd` `MonVolStd` float DEFAULT '0';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='MonResStd'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `MonResStd` `MonResStd` float DEFAULT '0';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='MonSerStd'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `MonSerStd` `MonSerStd` float DEFAULT '0';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='MonTmpStd'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `MonTmpStd` `MonTmpStd` float DEFAULT '0';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='MonVolLowToAvg'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `MonVolLowToAvg` `MonVolLowToAvg` float DEFAULT '0';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='MonNum'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `MonNum` `MonNum` int(11) DEFAULT '0';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='BattProducer'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `BattProducer` `BattProducer` varchar(45) DEFAULT '0';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='BattProductDate'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `BattProductDate` `BattProductDate` date DEFAULT '2006-07-06';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='BattInUseDate'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `BattInUseDate` `BattInUseDate` date DEFAULT '2006-07-06';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='BattGuarantDayCount'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `BattGuarantDayCount` `BattGuarantDayCount` int(11) DEFAULT '1095';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='SignalId'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `SignalId` `SignalId` varchar(20) DEFAULT '0';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='CInterFaceId'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `CInterFaceId` `CInterFaceId` int(11) DEFAULT '0';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='SignalName'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `SignalName` `SignalName` varchar(50) DEFAULT '0';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='Load_curr'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `Load_curr` `Load_curr` float DEFAULT '15';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='DisCurrMax'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `DisCurrMax` `DisCurrMax` float DEFAULT '0';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='station_phone'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `station_phone` `station_phone` varchar(32) DEFAULT '';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='station_install'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `station_install` `station_install` tinyint(1) DEFAULT '0';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='install_user'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `install_user` `install_user` varchar(64) DEFAULT '';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='charge_curr_max'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `charge_curr_max` `charge_curr_max` float DEFAULT '20';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='Vol_grade'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `Vol_grade` `Vol_grade` float DEFAULT '0';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='Manufacturers'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `Manufacturers` `Manufacturers` varchar(64) DEFAULT '';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='Assetequipment'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `Assetequipment` `Assetequipment` varchar(64) DEFAULT '';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='Deviceclasspath'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `Deviceclasspath` `Deviceclasspath` varchar(64) DEFAULT '';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='DeviceOperationDepartment'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `DeviceOperationDepartment` `DeviceOperationDepartment` varchar(64) DEFAULT '';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='PropertyRightUnit'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `PropertyRightUnit` `PropertyRightUnit` varchar(64) DEFAULT '';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='PropertyAttribute'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `PropertyAttribute` `PropertyAttribute` varchar(64) DEFAULT '';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='FactoryNumber'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `FactoryNumber` `FactoryNumber` varchar(64) DEFAULT '';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='OperationTeam'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `OperationTeam` `OperationTeam` varchar(64) DEFAULT '';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='DeviceIdentityCode'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `DeviceIdentityCode` `DeviceIdentityCode` varchar(64) DEFAULT '';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='ProjectType'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `ProjectType` `ProjectType` varchar(64) DEFAULT '';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='DeviceIdentityCode'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `DeviceIdentityCode` `DeviceIdentityCode` varchar(64) DEFAULT '';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='BatteryApplicationType'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `BatteryApplicationType` `BatteryApplicationType` varchar(64) DEFAULT '';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='SingleRatedVoltage'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `SingleRatedVoltage` `SingleRatedVoltage` float DEFAULT '0';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='RemoteMonitor'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `RemoteMonitor` `RemoteMonitor` varchar(64) DEFAULT '';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='BatttIndependentPlaced'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `BatttIndependentPlaced` `BatttIndependentPlaced` varchar(64) DEFAULT '';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='JunChargeVoltageValue'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `JunChargeVoltageValue` `JunChargeVoltageValue` float DEFAULT '0';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='PublicKeyX'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `PublicKeyX` `PublicKeyX` varchar(200) DEFAULT '';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='PublicKeyY'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `PublicKeyY` `PublicKeyY` varchar(200) DEFAULT '';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='KeyID'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `KeyID` `KeyID` varchar(200) DEFAULT '';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='SerialNumber'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `SerialNumber` `SerialNumber` varchar(200) DEFAULT '';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='sort_id'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `sort_id` `sort_id` int(3) DEFAULT '0';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='video_url'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `video_url` `video_url` varchar(200) DEFAULT NULL;");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='charge_type'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `charge_type` `charge_type` int(11) DEFAULT '1' COMMENT '充放电状态:1:限流充电;2;逆变充电';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='buscouple_state'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `buscouple_state` `buscouple_state` int(11) DEFAULT '0' COMMENT '母联状态:0:无母联;1:有母联';");
                    }
                }
                res = null;
                //判断字段是否允许为空不允许为空则修改字段类型【修复老版本不能为空bug】
                res = sql.sqlMysqlQuery("SELECT IS_NULLABLE FROM information_schema.columns" +
                        " WHERE table_schema='db_battinf'" +
                        " AND table_name='tb_battinf'" +
                        " AND column_name='tmp_id'");
                if(res.next()) {
                    if("NO".equals(res.getString("IS_NULLABLE"))) {
                        sql_strs.add("ALTER TABLE " + Sql_Mysql.BattInf_Table
                                + " CHANGE `tmp_id` `tmp_id` int(11) DEFAULT '0';");
                    }
                }
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `StationId` `StationId` varchar(20) DEFAULT '0';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `StationId_ex` `StationId_ex` varchar(20) DEFAULT '0';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `StationName` `StationName` varchar(100) DEFAULT ' ';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `StationName1` `StationName1` varchar(100) DEFAULT ' ';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `StationName2` `StationName2` varchar(100) DEFAULT ' ';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `StationName3` `StationName3` varchar(100) DEFAULT ' ';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `StationName4` `StationName4` varchar(100) DEFAULT ' ';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `StationName5` `StationName5` varchar(100) DEFAULT ' ';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `StationName6` `StationName6` varchar(100) DEFAULT ' ';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `StationName7` `StationName7` varchar(100) DEFAULT ' ';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `StationName8` `StationName8` varchar(100) DEFAULT ' ';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `StationName9` `StationName9` varchar(100) DEFAULT ' ';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `StationIP` `StationIP` varchar(20) DEFAULT '0';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `FBSDeviceId` `FBSDeviceId` bigint(11) DEFAULT '0';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `FBSDeviceIp` `FBSDeviceIp` varchar(50) DEFAULT '192.168.0.88';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `FBSDeviceIp_WG` `FBSDeviceIp_WG` varchar(64) DEFAULT '192.168.0.1';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `FBSDeviceIp_YM` `FBSDeviceIp_YM` varchar(64) DEFAULT '255.255.255.0';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `FBSDeviceName` `FBSDeviceName` varchar(100) DEFAULT '0';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `GroupIndexInFBSDevice` `GroupIndexInFBSDevice` int(11) DEFAULT '0';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `BattModel` `BattModel` varchar(100) DEFAULT ' ';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `BattGroupId` `BattGroupId` int(11) DEFAULT '0';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `BattGroupNum` `BattGroupNum` int(11) DEFAULT '0';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `BattGroupName` `BattGroupName` varchar(100) DEFAULT ' ';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `BattGroupName1` `BattGroupName1` varchar(100) DEFAULT ' ';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `BattGroupName2` `BattGroupName2` varchar(100) DEFAULT ' ';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `BattGroupName3` `BattGroupName3` varchar(100) DEFAULT ' ';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `BattGroupName4` `BattGroupName4` varchar(100) DEFAULT ' ';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `BattGroupName5` `BattGroupName5` varchar(100) DEFAULT ' ';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `BattGroupName6` `BattGroupName6` varchar(100) DEFAULT ' ';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `FloatVolLevel` `FloatVolLevel` float DEFAULT '1.12';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `OfflineVolLevel` `OfflineVolLevel` float DEFAULT '1.06';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `BattFloatCurrent` `BattFloatCurrent` float DEFAULT '0';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `DeviceId` `DeviceId` varchar(20) DEFAULT '0';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `DeviceName` `DeviceName` varchar(100) DEFAULT '0';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `MonCount` `MonCount` int(11) DEFAULT '0';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `MonCapStd` `MonCapStd` float DEFAULT '0';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `MonVolStd` `MonVolStd` float DEFAULT '0';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `MonResStd` `MonResStd` float DEFAULT '0';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `MonSerStd` `MonSerStd` float DEFAULT '0';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `MonTmpStd` `MonTmpStd` float DEFAULT '0';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `MonVolLowToAvg` `MonVolLowToAvg` float DEFAULT '0';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `MonNum` `MonNum` int(11) DEFAULT '0';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `BattProducer` `BattProducer` varchar(45) DEFAULT '0';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `BattProductDate` `BattProductDate` date DEFAULT '2006-07-06';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `BattInUseDate` `BattInUseDate` date DEFAULT '2006-07-06';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `BattGuarantDayCount` `BattGuarantDayCount` int(11) DEFAULT '1095';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `SignalId` `SignalId` varchar(20) DEFAULT '0';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `CInterFaceId` `CInterFaceId` int(11) DEFAULT '0';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `SignalName` `SignalName` varchar(50) DEFAULT '0';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `Load_curr` `Load_curr` float DEFAULT '15';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `DisCurrMax` `DisCurrMax` float DEFAULT '0';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `station_phone` `station_phone` varchar(32) DEFAULT '';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `station_install` `station_install` tinyint(1) DEFAULT '0';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `install_user` `install_user` varchar(64) DEFAULT '';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `charge_curr_max` `charge_curr_max` float DEFAULT '20';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `Vol_grade` `Vol_grade` float DEFAULT '0';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `Manufacturers` `Manufacturers` varchar(64) DEFAULT '';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `Assetequipment` `Assetequipment` varchar(64) DEFAULT '';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `Deviceclasspath` `Deviceclasspath` varchar(64) DEFAULT '';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `DeviceOperationDepartment` `DeviceOperationDepartment` varchar(64) DEFAULT '';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `PropertyRightUnit` `PropertyRightUnit` varchar(64) DEFAULT '';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `PropertyAttribute` `PropertyAttribute` varchar(64) DEFAULT '';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `FactoryNumber` `FactoryNumber` varchar(64) DEFAULT '';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `OperationTeam` `OperationTeam` varchar(64) DEFAULT '';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `DeviceIdentityCode` `DeviceIdentityCode` varchar(64) DEFAULT '';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `ProjectType` `ProjectType` varchar(64) DEFAULT '';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `DeviceIdentityCode` `DeviceIdentityCode` varchar(64) DEFAULT '';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `BatteryApplicationType` `BatteryApplicationType` varchar(64) DEFAULT '';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `SingleRatedVoltage` `SingleRatedVoltage` float DEFAULT '0';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `RemoteMonitor` `RemoteMonitor` varchar(64) DEFAULT '';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `BatttIndependentPlaced` `BatttIndependentPlaced` varchar(64) DEFAULT '';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `JunChargeVoltageValue` `JunChargeVoltageValue` float DEFAULT '0';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `PublicKeyX` `PublicKeyX` varchar(200) DEFAULT '';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `PublicKeyY` `PublicKeyY` varchar(200) DEFAULT '';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `KeyID` `KeyID` varchar(200) DEFAULT '';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `SerialNumber` `SerialNumber` varchar(200) DEFAULT '';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `sort_id` `sort_id` int(3) DEFAULT '0';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `video_url` `video_url` varchar(200) DEFAULT NULL;");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `charge_type` `charge_type` int(11) DEFAULT '1' COMMENT '充放电状态:1:限流充电;2;逆变充电';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `buscouple_state` `buscouple_state` int(11) DEFAULT '0' COMMENT '母联状态:0:无母联;1:有母联';");
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattInf_Table
                        + " CHANGE `tmp_id` `tmp_id` int(11) DEFAULT '0';");
                if(sql_strs.size() > 0) {
                    sql.makeManualCommit(sql_strs);
                }
            }
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
BattMonitor_DB_Builder/src/com/database_util/DB_db_user.java
@@ -12,6 +12,7 @@
    
    public static void init(MysqlConnPool pool, boolean recreate) {
        System.out.println(" db_db_user init start at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
        
        createDB_UserDB(pool);                                 //创建db_user数据库
        
@@ -65,6 +66,8 @@
        
        createTb_Work_Alarm(pool, recreate);
        
        System.out.println(" db_db_user init end at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
    }
    
    /**
BattMonitor_DB_Builder/src/com/database_util/DB_web_site.java
@@ -12,7 +12,7 @@
    
    
    public static void init(MysqlConnPool pool, boolean recreate) {
        //System.out.println(" DB_web_site init start at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
        System.out.println(" DB_web_site init start at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
        
        createWeb_siteDB(pool);                                        //创建website 数据库
        
@@ -76,7 +76,7 @@
        
        createTB_Map_Outline_Table(pool, recreate);                    //创建首页轮廓图表
        
        //System.out.println(" DB_web_site init start at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
        System.out.println(" DB_web_site init end at " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
    }
    
    
@@ -3706,7 +3706,7 @@
    }
    
    /**
     * 创建线程手动启动工具表
     *     创建线程手动启动工具表
     */
    public static void createThread_utilTable(MysqlConnPool pool, boolean recreate) {
        String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.ThreadUtil_Table;
@@ -3727,11 +3727,11 @@
                sql.sqlMysqlExecute(sql_str01);
            }
            sql.sqlMysqlExecute(sql_str02);
            rs = sql.sqlMysqlQuery("SELECT * from web_site.tb_thread_util WHERE thread_id = 2019001");
            rs = sql.sqlMysqlQuery("SELECT thread_name from web_site.tb_thread_util WHERE thread_id = 2019001");
            if(false == rs.next()) {                
                sql.sqlMysqlExecute("INSERT INTO " + Sql_Mysql.ThreadUtil_Table + " VALUES ('1', '2019001', '机房续航线程', '2019-01-08 10:44:28', '0', '')");            //添加机房续航线程的控制记录
            }
            rs = sql.sqlMysqlQuery("SELECT * from web_site.tb_thread_util WHERE thread_id = 2019002");
            rs = sql.sqlMysqlQuery("SELECT thread_name from web_site.tb_thread_util WHERE thread_id = 2019002");
            if(false == rs.next()) {                
                sql.sqlMysqlExecute("INSERT INTO " + Sql_Mysql.ThreadUtil_Table + " VALUES ('2', '2019002', '落后单体线程', '2019-01-08 10:44:28', '0', '')");            //添加机房续航线程的控制记录
            }
@@ -3928,103 +3928,103 @@
            }
            sql.sqlMysqlExecute(sql_str02);    
            //添加主程序记录
            res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11001");
            res = sql.sqlMysqlQuery("SELECT ProcessName FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11001");
            if(false == res.next()) {                
                sql.sqlMysqlExecute("INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + "(ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('11001', 'BMS_FBSDEV', '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_FBSDEV', '1', 'V1.585', '主程序线程', '300');");
            }
            //添加电池告警进程记录
            res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11002");
            res = sql.sqlMysqlQuery("SELECT ProcessName FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11002");
            if(false == res.next()) {                
                sql.sqlMysqlExecute("INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + "(ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('11002', 'BMS_FBSDEV_ALARM_BATT',     '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_FBSDEV_ALARM', '1', 'V1.109', '电池告警线程', '300');");
            }
            //添加设备告警进程记录
            res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11003");
            res = sql.sqlMysqlQuery("SELECT ProcessName FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11003");
            if(false == res.next()) {                
                sql.sqlMysqlExecute("INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + "(ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('11003', 'BMS_FBSDEV_ALARM_DEV',         '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_FBSDEV_ALARM', '1', 'V1.109', '设备告警线程', '300');");
            }
            //添加落后单体进程记录
            res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11004");
            res = sql.sqlMysqlQuery("SELECT ProcessName FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11004");
            if(false == res.next()) {
                sql.sqlMysqlExecute("INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + "(ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('11004', 'BMS_FBSDEV_BADBATT_MON',     '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_FBSDEV_BADBATT', '1', 'v2.303', '落后单体线程', '300');");
            }
            //添加容量告警进程记录
            res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11005");
            res = sql.sqlMysqlQuery("SELECT ProcessName FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11005");
            if(false == res.next()) {                
                sql.sqlMysqlExecute("INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + "(ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('11005', 'BMS_FBSDEV_BADBATT_CAP',     '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_FBSDEV_BADBATT', '1', 'v2.303', '容量告警线程', '300');");
            }
            //添加放电计划进程记录
            res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11006");
            res = sql.sqlMysqlQuery("SELECT ProcessName FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11006");
            if(false == res.next()) {
                sql.sqlMysqlExecute("INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + "(ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('11006', 'BMS_FBSDEV_PLAN',             '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_FBSDEV_PLAN', '2', ' ', '放电计划线程', '300');");
            }
            //添加机房停电进程记录
            res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11007");
            res = sql.sqlMysqlQuery("SELECT ProcessName FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11007");
            if(false == res.next()) {
                sql.sqlMysqlExecute("INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + "(ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('11007', 'BMS_FBSDEV_POWER_FAIL',     '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_FBSDEV_POWER_FAIL', '2', ' ', '机房停电线程', '300');");
            }
            //添加线程监控进程记录
            res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11008");
            res = sql.sqlMysqlQuery("SELECT ProcessName FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11008");
            if(false == res.next()) {
                sql.sqlMysqlExecute("INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + "(ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('11008', 'BMS_FBSDEV_LISTEN',         '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_FBSDEV_LISTEN', '1', 'V1.101', '线程监控线程', '300');");
            }
            //添加61850进程记录
            res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11009");
            res = sql.sqlMysqlQuery("SELECT ProcessName FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11009");
            if(false == res.next()) {
                sql.sqlMysqlExecute("INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + "(ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('11009', 'BMS_FBS61850_BATT',         '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_FBS61850_BATT', '2', 'V1.101', '61850通讯线程', '300');");
            }
            //添加9600进程记录
            res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11010");
            res = sql.sqlMysqlQuery("SELECT ProcessName FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11010");
            if(false == res.next()) {
                sql.sqlMysqlExecute("INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + "(ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('11010', 'BMS_FBS9600_DISPLAY',         '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_FBS9600_DISPLAY', '2', 'v1.101', '9600显示模块线程', '300');");
            }
            //添加FBS汇集器通讯进程记录
            res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11011");
            res = sql.sqlMysqlQuery("SELECT ProcessName FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11011");
            if(false == res.next()) {
                sql.sqlMysqlExecute("INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + "(ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('11011', 'BMS_FBS_CONCENTRATOR',         '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_FBS_CONCENTRATOR', '2', 'v1.101', 'FBS汇集器通讯线程', '300');");
            }
            //添加9度通讯线程
            res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11012");
            res = sql.sqlMysqlQuery("SELECT ProcessName FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11012");
            if(false == res.next()) {
                sql.sqlMysqlExecute(" INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + "(ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('11012', 'BMS_LD9_MONITOR',         '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_LD9_MONITOR', '2', 'v1.101', '9度设备通讯线程', '300');");
            }
            
            //添加6度通讯线程
            res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11013");
            res = sql.sqlMysqlQuery("SELECT ProcessName FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11013");
            if(false == res.next()) {
                sql.sqlMysqlExecute(" INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + "(ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('11013', 'BMS_LD6_MONITOR',         '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_LD6_MONITOR', '2', 'v1.101', '6度设备通讯线程', '300');");
            }
            //添加BTS续航统计线程
            res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11014");
            res = sql.sqlMysqlQuery("SELECT ProcessName FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11014");
            if(false == res.next()) {
                sql.sqlMysqlExecute(" INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + "(ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('11014', 'BMS_BTS_ENDURANCE',         '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_BTS_ENDURANCE', '2', 'v1.101', 'BTS续航统计线程', '300');");
            }
            //添加通信电源通讯
            res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11015");
            res = sql.sqlMysqlQuery("SELECT ProcessName FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11015");
            if(false == res.next()) {
                sql.sqlMysqlExecute(" INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + "(ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('11015', 'BMS_COMM_POWER',         '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_COMM_POWER', '2', 'v1.101', '通信电源通讯线程', '300');");
            }
            //添加通信电源通讯
            res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11016");
            res = sql.sqlMysqlQuery("SELECT ProcessName FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11016");
            if(false == res.next()) {
                sql.sqlMysqlExecute(" INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + "(ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('11016', 'BMS_POWER_MONITOR',     '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_POWER_MONITOR', '2', 'v1.100', '通信电源监控线程', '300');");
            }
            //蓄电池负载更新线程
            res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11017");
            res = sql.sqlMysqlQuery("SELECT ProcessName FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11017");
            if(false == res.next()) {
                sql.sqlMysqlExecute(" INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + "(ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('11017', 'BMS_BATT_LOADUPDATE',     '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_BATT_LOADUPDATE', '1', 'v1.100', '蓄电池负载更新线程', '300');");
            }
            //充放电一体机通讯线程
            res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11018");
            res = sql.sqlMysqlQuery("SELECT ProcessName FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11018");
            if(false == res.next()) {
                sql.sqlMysqlExecute(" INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + "(ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('11018', 'BMS_BATT_FGCD_A059',     '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_BATT_FGCD_A059', '1', 'v1.100', '充放电一体机通讯线程', '300');");
            }
            //锂电消峰填谷计划线程
            res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11019");
            res = sql.sqlMysqlQuery("SELECT ProcessName FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11019");
            if(false == res.next()) {
                sql.sqlMysqlExecute(" INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + "(ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('11019', 'BMS_PEAK_SUPPRESSION_PLAN',     '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_PEAK_SUPPRESSION_PLAN', '1', 'v1.100', '削峰填谷计划线程', '300');");
            }
            //远程重启装置线程
            res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11020");
            res = sql.sqlMysqlQuery("SELECT ProcessName FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11020");
            if(false == res.next()) {
                sql.sqlMysqlExecute(" INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + "(ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('11020', 'BMS_REMOTE_RESTART_DEVICE',     '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_REMOTE_RESTART_DEVICE', '2', 'v1.100', '远程重启装置通信线程', '300');");
            }
@@ -4092,12 +4092,10 @@
                sql.sqlMysqlExecute(sql_str01);
            }
            sql.sqlMysqlExecute(sql_str02);    
            //清空添加过放电记录中的机房修改过机房名称的记录
            sql.sqlMysqlExecute("  DELETE FROM "+ Sql_Mysql.DevstateUsr_Table +" WHERE BattGroupId not in ( " + 
                    "    SELECT DISTINCT(BattGroupId) FROM " +Sql_Mysql.BattInf_Table +
                    " ) ");
                                "    SELECT DISTINCT(BattGroupId) FROM " +Sql_Mysql.BattInf_Table +
                                " ) ");
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
BattMonitor_DB_Builder/src/com/dev/fbs9100/FBS9100_Task_Thread_SQL.java
@@ -1202,6 +1202,134 @@
        }        
    }
    
    public static void insertDatatb_user_log(MysqlConnPool pool,String sql_str) {
//        String sql_str = "INSERT INTO" +
//                        " db_user.tb_user_log(uid,uOprateMsg,operation_detail)" +
//                            " VALUES(1001,'测试数据','测试插入数据'); ";
        Sql_Mysql sql = new Sql_Mysql(pool.getConn());
        try {
            //System.err.println(sql_str);
            sql.sqlMysqlExecute(sql_str);
        } catch (SQLException e) {
            e.printStackTrace();
        } finally{
            sql.close_con();
        }
    }
    public static void insertDatatb_user_limit(MysqlConnPool pool,String sql_str) {
        //String sql_str = "INSERT INTO db_user.tb_user_limit(userId,limitDuration,loginTime) VALUES(11,2502,NOW()); ";
        Sql_Mysql sql = new Sql_Mysql(pool.getConn());
        try {
            sql.sqlMysqlExecute(sql_str);
        } catch (SQLException e) {
            e.printStackTrace();
        } finally{
            sql.close_con();
        }
    }
    /**
     * 创建用户操作日志表
     * @param pool
     * @param recreate
     */
    public static void createUser_Log_Table(MysqlConnPool pool, boolean recreate) {
        String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.User_Log_Table;
        String sql_str02 = "CREATE TABLE  IF NOT EXISTS " + Sql_Mysql.User_Log_Table + " (" +
                "  `num` bigint(20) NOT NULL AUTO_INCREMENT," +
                "  `uId` int(11) NOT NULL DEFAULT '0'," +
                "  `uOprateType` int(11) NOT NULL DEFAULT '0'," +
                "  `uOprateDay` datetime NOT NULL DEFAULT '1980-01-01 00:00:00'," +
                "  `uTerminalIp` varchar(20) NOT NULL DEFAULT ' '," +
                "  `uOprateMsg` varchar(250) NOT NULL DEFAULT ' '," +
                "  PRIMARY KEY (`num`)," +
                "  KEY `user_id` (`uId`)" +
                ") ENGINE=InnoDB AUTO_INCREMENT=7293 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);
            //添加operation_detail
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_user'"
                    + " AND table_name='tb_user_log'"
                    + " AND column_name='operation_detail'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.User_Log_Table
                                + " ADD COLUMN `operation_detail` text COMMENT '操作的具体数据';");
            }else{
                //修改当前字段的类型
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.User_Log_Table
                        + " CHANGE `operation_detail` `operation_detail` text COMMENT '操作的具体数据';");
            }
            //修改uOprateMsg格式为text
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_user'"
                    + " AND table_name='tb_user_log'"
                    + " AND column_name='uOprateMsg'");
            if(res.next()) {
                //修改当前字段的类型为text
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.User_Log_Table
                        + " CHANGE `uOprateMsg` `uOprateMsg` text;");
            }
            //添加read_flag
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_user'"
                    + " AND table_name='tb_user_log'"
                    + " AND column_name='read_flag'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.User_Log_Table
                                + " ADD COLUMN `read_flag` tinyint(1) DEFAULT '1' COMMENT '是否已阅读,此功能针对异常信息'");
            }
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            if(res != null) {
                try {
                    res.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
            sql.close_con();
        }
    }
    /**
     *
     */
    public static void createUser_Limit_Table(MysqlConnPool pool, boolean recreate) {
        String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.User_Limit_Table;
        String sql_str02 = "CREATE TABLE  IF NOT EXISTS " + Sql_Mysql.User_Limit_Table + " (" +
                "  `id` int(11) NOT NULL AUTO_INCREMENT," +
                "  `userId` int(11) DEFAULT NULL," +
                "  `limitDuration` int(3) DEFAULT NULL COMMENT '限制时间,单位:秒'," +
                "  `loginTime` datetime DEFAULT NULL COMMENT '登录时间'," +
                "  PRIMARY KEY (`id`)" +
                ") ENGINE=InnoDB AUTO_INCREMENT=36 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 main(String[] args) {
        MysqlConnPool pool = new MysqlConnPool("127.0.0.1", 3360, 100);
        FBS9100_Task_Thread_SQL thread = new FBS9100_Task_Thread_SQL();
BattMonitor_DB_Builder/src/com/sql/Sql_Mysql.java
@@ -161,6 +161,9 @@
    public static final String TB_Batt_Gtstate_Table = DB_RamDB +".`tb_batt_gtstate`";                                //山西储能设备实时信息表
    public static final String TB_Dev61851_State_Table = DB_RamDB +".`tb_dev_61851_state`";                            //远程重启装置状态信息表
    
    public final static String DEV60870_Inverter_State = DB_RamDB + ".tb_dev_60870_inverter_state";                    //电操开关遥信实时状态表
    public final static String DEV60870_Inverter_Info = DB_RamDB + ".tb_dev_60870_inverter_info";                    //电操开关遥测实时状态表
    
    /**************************** db_user数据库 ***************************************************/
    public final static String User_Permitgroup_Table = DB_USER + ".`tb_user_permitgroup`";                                //权限表
BattMonitor_DB_Builder/src/com/version_inf/version_inf.txt
@@ -688,4 +688,8 @@
V1.43 edit at date 2022-10-19    
    1.表'web_site.tb_process_survey'初始录入时添加远程重启装置线程录入
        sql.sqlMysqlExecute(" INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + "(ProcessId,ProcessName,ProcessTime,Process_starttime,ServerName,ServerFlag,ProcessVersion,note,OutTime) VALUES ('11020', 'BMS_REMOTE_RESTART_DEVICE',     '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_REMOTE_RESTART_DEVICE', '2', 'v1.100', '远程重启装置通信线程', '300');");
V1.44 edit at date 2022-10-27
    1.新增电操开关表'db_ram_db.tb_dev_60870_inverter_info'和'db_ram_db.tb_dev_60870_inverter_state'
BattMonitor_DB_Builder/src/main/main_BTS_DB_Builder.java
@@ -55,9 +55,10 @@
        
        m_AppConfig = new AppConfig();
        
        System.out.println("正在连接数据库 DBserver IP:" + m_AppConfig.getMysqlServerIp() + ", port: " + MysqlServer_Port);
        
        GB_MysqlConnPool = new MysqlConnPool(m_AppConfig.getMysqlServerIp(), MysqlServer_Port, 5);
        GB_MysqlConnPool = new MysqlConnPool(m_AppConfig.getMysqlServerIp(), MysqlServer_Port, 50);
        
        Sql_Mysql sql_ck = new Sql_Mysql(GB_MysqlConnPool.getConn());
        if(null != sql_ck.mysql_con) {
@@ -73,7 +74,7 @@
        } finally {
            sql_ck.close_con();
        }
        /*********************************************************************************/
        //*********************************************************************************//
        //boolean recreate_tb = m_AppConfig.getMysqlDB_RecreateEn();
        boolean recreate_tb = false;
        
@@ -82,7 +83,6 @@
        //初始话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);
@@ -98,7 +98,7 @@
        BattData_RT_RamDB_Thread_SQL.createBattParam_Table(GB_MysqlConnPool, recreate_tb);
        
        /*********************************************************************************/
        System.out.println("Recreate RamDB Tables State Is '" + 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表
@@ -137,7 +137,6 @@
        
        
        
        //初始化数据库 web_site
        DB_web_site.init(GB_MysqlConnPool, recreate_tb);                
        
@@ -147,6 +146,7 @@
        //初始化告警数据库 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);
        
@@ -169,6 +169,7 @@
        DB_Pwrdev_Inf.init(GB_MysqlConnPool, recreate_tb);
        
        
        System.out.println("===="+Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
        //初始化FBO历史文件数据表
        DB_Fbo_testdata.init(GB_MysqlConnPool, recreate_tb);
        
@@ -212,10 +213,84 @@
            }
        }
        */
        /*MysqlConnPool pool1 = new MysqlConnPool(m_AppConfig.getMysqlServerIp(), 3363, 500);
        MysqlConnPool pool2 = new MysqlConnPool(m_AppConfig.getMysqlServerIp(), 3364, 500);
        //重新建表
        //FBS9100_Task_Thread_SQL.createUser_Log_Table(pool1, true);
        //FBS9100_Task_Thread_SQL.createUser_Log_Table(pool2, true);
        //重新建表
        //FBS9100_Task_Thread_SQL.createUser_Limit_Table(pool1, true);
        //FBS9100_Task_Thread_SQL.createUser_Limit_Table(pool2, true);
        System.out.println("线程总数:"+m_AppConfig.getWorkThreadCountMax()+"每次SQL条数:"+m_AppConfig.getBattAlarmDataDayCountMax());
        StringBuffer buff1 = new StringBuffer("INSERT INTO db_user.tb_user_log(uid,uOprateMsg,operation_detail) VALUES");
        StringBuffer buff2 = new StringBuffer("INSERT INTO db_user.tb_user_limit(userId,limitDuration,loginTime) VALUES");
        for(int i=0;i<m_AppConfig.getBattAlarmDataDayCountMax();i++) {
            if(i>0) {
                buff1.append(",");
                buff2.append(",");
            }
            buff1.append("("+ (1001+i)+",'测试数据','测试插入数据')");
            buff2.append("(11,"+(2502+i)+",NOW())");
            System.out.println(i);
        }
        System.out.println(buff1.toString());
        System.out.println(buff2.toString());
        final String sql_strs11 = buff1.toString();
        final String sql_strs22 = buff2.toString();
        for(int i = 0;i < m_AppConfig.getWorkThreadCountMax();i++ ) {
            new Thread(new Runnable() {
                @Override
                public void run() {
                    while(true) {
                        try {
                            //FBS9100_Task_Thread_SQL.insertDatatb_user_log(pool1,sql_strs11);
                            FBS9100_Task_Thread_SQL.insertDatatb_user_limit(pool1,sql_strs22);
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                }
            }).start();
        }
        for(int i = 0;i < m_AppConfig.getWorkThreadCountMax();i++ ) {
            new Thread(new Runnable() {
                @Override
                public void run() {
                    //System.out.println(Thread.currentThread().getName());
                    while(true) {
                        try {
                            //FBS9100_Task_Thread_SQL.insertDatatb_user_log(pool2,sql_strs11);
                            FBS9100_Task_Thread_SQL.insertDatatb_user_limit(pool2,sql_strs22);
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                }
            }).start();
        }
        System.out.println("线程已完全启动。。。。。。。");*/
    }
    
    
    public static void main(String[] args) {
        init();
    }
}