From 0a6ca18f4e8340e18e3e5afca4b3bfafdd73c8bd Mon Sep 17 00:00:00 2001
From: DELL <1525436766@qq.com>
Date: 星期四, 18 七月 2024 10:47:32 +0800
Subject: [PATCH] V6.106 edit by lijun	@  2024-04-19 	1.修复老版本程序只能识别第一个干接点告警,2-10编号干接点告警无法触发 	2.新增单体电压,单体内阻,单体温度,单体剩余容量告警,核容终止时剩余容量,核容终止时组端电压,核容终止时间等读取 	3.新增历史实时数据通过表 'db_param.tb_app_param'设置保存的时间

---
 iec61850_forFoShanAES_Model/src/com/dec/fbs9100/Sql_Mysql.java               |    5 
 iec61850_forFoShanAES_Model/src/com/dec/fbs9100/main_BTS_APP_IEC61850.java   |    2 
 iec61850_forFoShanAES_Model/bin/com/dec/fbs9100/AppParam$MonitorParam.class  |    0 
 iec61850_forFoShanAES_Model/bin/com/dec/fbs9100/AppParam.class               |    0 
 iec61850_forFoShanAES_Model/bin/com/dec/fbs9100/Sql_Mysql.class              |    0 
 iec61850_forFoShanAES_Model/bin/com/dec/fbs9100/BattRealDataPro_Thread.class |    0 
 iec61850_forFoShanAES_Model/bin/com/version_inf/version_inf.txt              |    1 
 iec61850_forFoShanAES_Model/src/com/dec/fbs9100/AppParam.java                |  268 +++++++++++++++++++++++++-------------------
 iec61850_forFoShanAES_Model/src/com/version_inf/version_inf.txt              |    1 
 iec61850_forFoShanAES_Model/bin/com/dec/fbs9100/main_BTS_APP_IEC61850.class  |    0 
 iec61850_forFoShanAES_Model/src/com/dec/fbs9100/BattRealDataPro_Thread.java  |   29 ++--
 11 files changed, 175 insertions(+), 131 deletions(-)

diff --git a/iec61850_forFoShanAES_Model/bin/com/dec/fbs9100/AppParam$MonitorParam.class b/iec61850_forFoShanAES_Model/bin/com/dec/fbs9100/AppParam$MonitorParam.class
index 8a54d98..e8ff2cf 100644
--- a/iec61850_forFoShanAES_Model/bin/com/dec/fbs9100/AppParam$MonitorParam.class
+++ b/iec61850_forFoShanAES_Model/bin/com/dec/fbs9100/AppParam$MonitorParam.class
Binary files differ
diff --git a/iec61850_forFoShanAES_Model/bin/com/dec/fbs9100/AppParam.class b/iec61850_forFoShanAES_Model/bin/com/dec/fbs9100/AppParam.class
index e8ff27e..cfa1d06 100644
--- a/iec61850_forFoShanAES_Model/bin/com/dec/fbs9100/AppParam.class
+++ b/iec61850_forFoShanAES_Model/bin/com/dec/fbs9100/AppParam.class
Binary files differ
diff --git a/iec61850_forFoShanAES_Model/bin/com/dec/fbs9100/BattRealDataPro_Thread.class b/iec61850_forFoShanAES_Model/bin/com/dec/fbs9100/BattRealDataPro_Thread.class
index 255604d..43c5d6e 100644
--- a/iec61850_forFoShanAES_Model/bin/com/dec/fbs9100/BattRealDataPro_Thread.class
+++ b/iec61850_forFoShanAES_Model/bin/com/dec/fbs9100/BattRealDataPro_Thread.class
Binary files differ
diff --git a/iec61850_forFoShanAES_Model/bin/com/dec/fbs9100/Sql_Mysql.class b/iec61850_forFoShanAES_Model/bin/com/dec/fbs9100/Sql_Mysql.class
index c13f7c6..dc817a9 100644
--- a/iec61850_forFoShanAES_Model/bin/com/dec/fbs9100/Sql_Mysql.class
+++ b/iec61850_forFoShanAES_Model/bin/com/dec/fbs9100/Sql_Mysql.class
Binary files differ
diff --git a/iec61850_forFoShanAES_Model/bin/com/dec/fbs9100/main_BTS_APP_IEC61850.class b/iec61850_forFoShanAES_Model/bin/com/dec/fbs9100/main_BTS_APP_IEC61850.class
index 82ab305..348b2b8 100644
--- a/iec61850_forFoShanAES_Model/bin/com/dec/fbs9100/main_BTS_APP_IEC61850.class
+++ b/iec61850_forFoShanAES_Model/bin/com/dec/fbs9100/main_BTS_APP_IEC61850.class
Binary files differ
diff --git a/iec61850_forFoShanAES_Model/bin/com/version_inf/version_inf.txt b/iec61850_forFoShanAES_Model/bin/com/version_inf/version_inf.txt
index 3f45930..df2d60b 100644
--- a/iec61850_forFoShanAES_Model/bin/com/version_inf/version_inf.txt
+++ b/iec61850_forFoShanAES_Model/bin/com/version_inf/version_inf.txt
@@ -6,6 +6,7 @@
 V6.106 edit by lijun	@  2024-04-19
 	1.淇鑰佺増鏈▼搴忓彧鑳借瘑鍒涓�涓共鎺ョ偣鍛婅,2-10缂栧彿骞叉帴鐐瑰憡璀︽棤娉曡Е鍙�
 	2.鏂板鍗曚綋鐢靛帇锛屽崟浣撳唴闃伙紝鍗曚綋娓╁害锛屽崟浣撳墿浣欏閲忓憡璀�,鏍稿缁堟鏃跺墿浣欏閲忥紝鏍稿缁堟鏃剁粍绔數鍘嬶紝鏍稿缁堟鏃堕棿绛夎鍙�
+	3.鏂板鍘嗗彶瀹炴椂鏁版嵁閫氳繃琛� 'db_param.tb_app_param'璁剧疆淇濆瓨鐨勬椂闂�
 
 V6.105 edit by lijun    @  2024-02-21	
 	1.鏂板sign_type 鏍囪瘑褰撳墠璁惧鏄爣鍑�1鎵�1杩樻槸鏍囧噯1鎵�2璁惧
diff --git a/iec61850_forFoShanAES_Model/src/com/dec/fbs9100/AppParam.java b/iec61850_forFoShanAES_Model/src/com/dec/fbs9100/AppParam.java
index b793559..2d9e2ac 100644
--- a/iec61850_forFoShanAES_Model/src/com/dec/fbs9100/AppParam.java
+++ b/iec61850_forFoShanAES_Model/src/com/dec/fbs9100/AppParam.java
@@ -1,15 +1,22 @@
 package com.dec.fbs9100;
 
 import java.sql.ResultSet;
+import java.sql.SQLException;
 import java.util.ArrayList;
 
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 
+
+/**
+ * 杞欢鐨勫悇绉嶅弬鏁颁俊鎭�
+ * @author 鍐�
+ *
+ */
 public class AppParam {
 	public final static String AppParamTableName = "tb_app_param";
-	public final static String AppLog4jTableName = "tb_batt_61850_dev_x64_log4j";
-	public final static String AppLog4j2_TableName = "tb_batt_61850_dev_x64_log4j2";
+	public final static String AppLog4jTableName = "tb_batt_ms_x64_fbsdev_log4j";
+	
 	public final static int AppParam_Discharge = 0;
 	public final static int AppParam_Charge = 1;
 	public final static int AppParam_PowerOff = 2;
@@ -17,37 +24,31 @@
 	private MysqlConnPool m_Conn_Pool;
 	private boolean MysqlDataTable_Exist = false;
 	private MonitorParam m_MonitorParam = new MonitorParam();
+	private Logger logger = null;
 	
 	public AppParam()
 	{
+		logger = LogManager.getLogger(this.getClass());
 	}
 	
 	public AppParam(MysqlConnPool pool)
 	{
+		logger = LogManager.getLogger(this.getClass());
+		
 		m_Conn_Pool = pool;
 		getAppParam();
 	}
-	/***************************************************************************************
+	/*
 	public void checkAndCreateLog4jTable() {
-		Logger logger = LogManager.getLogger(this.getClass());
 		Sql_Mysql sql = null;
 		try {
 			sql = new Sql_Mysql(m_Conn_Pool);
 			sql.sqlMysqlUseDB(Sql_Mysql.DB_AppSys);
-			
 			if(false == sql.sqlMysqlCheckIfTableExist(AppLog4jTableName)) {
 				FBS9100_Task_Thread_SQL.createAppLog4jTable(m_Conn_Pool, 
 										Sql_Mysql.DB_AppSys + ".`" + AppLog4jTableName + "`");
-				
 				logger.warn(Sql_Mysql.DB_AppSys + ".`" + AppLog4jTableName + "`" + " dose not exist, create now..." );
 			}
-			
-			if(false == sql.sqlMysqlCheckIfTableExist(AppLog4j2_TableName)) {
-				FBS9100_Task_Thread_SQL.createAppLog4j2_Table(m_Conn_Pool, 
-										Sql_Mysql.DB_AppSys + ".`" + AppLog4j2_TableName + "`");
-				logger.warn(Sql_Mysql.DB_AppSys + ".`" + AppLog4j2_TableName + "`" + " dose not exist, create now..." );
-			}
-			
 		} catch (Exception e) {
 			logger.error(e.toString(), e);
 		} finally {
@@ -60,12 +61,11 @@
 	}
 	
 	public void checkAndDeleteLog4jOldData() {
-		Logger logger = LogManager.getLogger(this.getClass());
 		Sql_Mysql sql = null;
 		try {
 			sql = new Sql_Mysql(m_Conn_Pool);
 			FBS9100_Task_Thread_SQL.deleteAppLog4jTableOldData(m_Conn_Pool, 
-									Sql_Mysql.DB_AppSys + ".`" + AppLog4j2_TableName + "`");
+									Sql_Mysql.DB_AppSys + ".`" + AppLog4jTableName + "`");
 		} catch (Exception e) {
 			logger.error(e.toString(), e);
 		} finally {
@@ -76,9 +76,9 @@
 			}
 		}
 	}
-	*****************************************************************************************/
+	*/
 	/**
-	 * 锟斤拷锟斤拷锟斤拷param锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟絤_MonitorParam锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷
+	 * 灏唒aram瀵硅薄涓殑灞炴�у�煎鍒� 鍒扮殑褰撳墠瀵硅薄鐨刴_MonitorParam灞炴�т腑
 	 * @param param
 	 */
 	public void copyAppParam(AppParam param)
@@ -100,33 +100,41 @@
 		m_MonitorParam.poweroff_BattTestGroupCountMax = param.m_MonitorParam.poweroff_BattTestGroupCountMax;
 		m_MonitorParam.poweroff_MonVolChangeLevel = param.m_MonitorParam.poweroff_MonVolChangeLevel;
 		m_MonitorParam.poweroff_TestDataRecordCountMax = param.m_MonitorParam.poweroff_TestDataRecordCountMax;
+	
+		m_MonitorParam.BattJunHengFN = param.m_MonitorParam.BattJunHengFN;
+		m_MonitorParam.realdata_SaveDataTimeInterval = param.m_MonitorParam.realdata_SaveDataTimeInterval;
+		m_MonitorParam.realdata_SaveDataTimeMax = param.m_MonitorParam.realdata_SaveDataTimeMax;
+
 	}
 	
 	class MonitorParam {
 		public int discharge_SaveDataTimeInterval = 10;
 		public float discharge_MonVolChangeLevel = (float) 0.05;
-		public int discharge_TestTimeLongMinimum = 60;
+		public int discharge_TestTimeLongMinimum = 1800;
 		public int discharge_TestDataRecordCountMax = 10000;
 		public int discharge_BattTestGroupCountMax = 10;
 		
 		public int charge_SaveDataTimeInterval = 10;
 		public float charge_MonVolChangeLevel = (float) 0.05;
-		public int charge_TestTimeLongMinimum = 60;
+		public int charge_TestTimeLongMinimum = 1800;
 		public int charge_TestDataRecordCountMax = 10000;
 		public int charge_BattTestGroupCountMax = 10;
 		
 		public int poweroff_SaveDataTimeInterval = 10;
 		public float poweroff_MonVolChangeLevel = (float) 0.05;
-		public int poweroff_TestTimeLongMinimum = 60;
+		public int poweroff_TestTimeLongMinimum = 1800;
 		public int poweroff_TestDataRecordCountMax = 10000;
 		public int poweroff_BattTestGroupCountMax = 10;
 		
 		public boolean BattJunHengFN = false;
+		
+		public int realdata_SaveDataTimeInterval = 60;				//鍘嗗彶瀹炴椂鏁版嵁瀛樺偍鏁版嵁闂撮殧
+		public int realdata_SaveDataTimeMax = 90;					//鍘嗗彶瀹炴椂鏁版嵁鏈�澶т繚瀛樺懆鏈�
 	}
 	
 	
 	/**
-	 * 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷type锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷
+	 * 鏍规嵁type鑾峰彇褰撳墠鏄偅绉嶇被鍨嬬殑娴嬭瘯锛岃幏鍙栧瓨鍌ㄦ暟鎹殑鏃堕棿闂撮殧
 	 * @param type
 	 * @return
 	 */
@@ -146,7 +154,7 @@
 	}
 	
 	/**
-	 * 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷type锟斤拷锟斤拷锟斤拷锟斤拷MonVolChangeLevel
+	 * 鏍规嵁type鑾峰彇MonVolChangeLevel
 	 * @param type
 	 * @return
 	 */
@@ -166,7 +174,7 @@
 	}
 	
 	/**
-	 * 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷type锟斤拷锟斤拷锟斤拷锟斤拷TestTimeLongMinimum锟斤拷
+	 * 鏍规嵁type鑾峰彇TestTimeLongMinimum鍊�
 	 * @param type
 	 * @return
 	 */
@@ -186,7 +194,7 @@
 	}
 	
 	/**
-	 * 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷type 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷TestDataRecordCountMax锟斤拷
+	 * 鏍规嵁type 鑾峰彇鏁版嵁涓殑TestDataRecordCountMax鍊�
 	 * @param type
 	 * @return
 	 */
@@ -206,7 +214,7 @@
 	}
 	
 	/**
-	 * 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷type锟斤拷锟斤拷锟斤拷锟斤拷BattTestGroupCountMax锟斤拷
+	 * 鏍规嵁type鑾峰彇BattTestGroupCountMax鍊�
 	 * @param type
 	 * @return
 	 */
@@ -226,7 +234,7 @@
 	}
 	
 	/**
-	 * 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 m_MonitorParam.BattJunHengFN锟斤拷
+	 * 鑾峰彇褰撳墠瀵硅薄灞炴�� m_MonitorParam.BattJunHengFN鍊�
 	 * @return
 	 */
 	public boolean getBattJunHengFN()
@@ -234,97 +242,121 @@
 		return m_MonitorParam.BattJunHengFN;
 	}
 	
+	public int getRealdata_SaveDataTimeInterval() {
+		return m_MonitorParam.realdata_SaveDataTimeInterval;
+	}
+	
+	public int getRealdata_SaveDataTimeMax() {
+		return m_MonitorParam.realdata_SaveDataTimeMax;
+	}
+	
 	/**
-	 * 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷tb_app_param锟斤拷锟斤拷锟斤拷
+	 * 浠庢暟鎹簱涓幏鍙栧弬鏁扮殑鍊硷紝骞朵笖鍒涘缓tb_app_param琛�
 	 */
 	public void getAppParam()
 	{
-		Logger logger = LogManager.getLogger(this.getClass());
-		Sql_Mysql sql = null;
+		Sql_Mysql sql = new Sql_Mysql(m_Conn_Pool);
 		String sql_str;
-		ResultSet res;
-		
+		ResultSet res = null;
+		sql_str = "INSERT INTO " + Sql_Mysql.App_Param_Table
+				+ " (param_name, "
+				+ "param_value, "
+				+ "param_caption)"
+				+ " VALUES ";
 		try {
-			sql = new Sql_Mysql(m_Conn_Pool);
-			sql.sqlMysqlUseDB(Sql_Mysql.DB_PARAM);
-			if(false == MysqlDataTable_Exist) {
-				MysqlDataTable_Exist = sql.sqlMysqlCheckIfTableExist(AppParamTableName);
+			res = sql.sqlMysqlQuery("SELECT * FROM " + Sql_Mysql.App_Param_Table + " WHERE param_name = 'discharge_SaveDataTimeInterval'");
+			if(!res.next()) {
+				sql.sqlMysqlExecute(sql_str + "('discharge_SaveDataTimeInterval', '" + this.m_MonitorParam.discharge_SaveDataTimeInterval + "','discharge_TimeInterval for every data insert into db_batt_testdata by seconds')");
 			}
 			
-			if(false == MysqlDataTable_Exist)
-			{
-				System.out.println(AppParamTableName + " is not exist, create it now...");
-				ArrayList<String> al_sqlstr = new ArrayList<String>();
-				
-				sql_str = "CREATE TABLE `" + AppParamTableName + "` "
-						+ "( `num` INT NOT NULL AUTO_INCREMENT, "
-						+ "`param_name` VARCHAR(50) NULL, "
-						+ "`param_value` VARCHAR(50) NULL, "
-						+ "`param_caption` VARCHAR(200) NULL, "
-						+ "PRIMARY KEY (`num`));";
-				al_sqlstr.add(sql_str);
-				
-				sql_str = "INSERT INTO " + AppParamTableName
-						+ " (param_name, "
-						+ "param_value, "
-						+ "param_caption)"
-						+ " VALUES "
-						//-------------------------------------------------------------------------------//
-						+ "('discharge_SaveDataTimeInterval', '10', "
-						+ "'discharge_TimeInterval for every data insert into db_batt_testdata by seconds'), "
+			res = sql.sqlMysqlQuery("SELECT * FROM " + Sql_Mysql.App_Param_Table + " WHERE param_name = 'discharge_MonVolChangeLevel'");
+			if(!res.next()) {
+				sql.sqlMysqlExecute(sql_str + "('discharge_MonVolChangeLevel', '" + this.m_MonitorParam.discharge_MonVolChangeLevel+ "', "+ "'discharge_MonVolChangeLevel for batt test data to save');");
+			}	
+			
+			res = sql.sqlMysqlQuery("SELECT * FROM " + Sql_Mysql.App_Param_Table + " WHERE param_name = 'discharge_TestTimeLongMinimum'");
+			if(!res.next()) {
+				sql.sqlMysqlExecute(sql_str + "('discharge_TestTimeLongMinimum', '" + this.m_MonitorParam.discharge_TestTimeLongMinimum + "', " + "'discharge_TestTimeLongMinimum for batttest data to store');");
+			}
 						
-						+ "('discharge_MonVolChangeLevel', '0.05', "
-						+ "'discharge_MonVolChangeLevel for batt test data to save'), "
-						
-						+ "('discharge_TestTimeLongMinimum', '1800', "
-						+ "'discharge_TestTimeLongMinimum for batttest data to store'), "
-						
-						+ "('discharge_TestDataRecordCountMax', '10000', "
-						+ "'discharge_TestDataRecordCountMax for batttest data count to insert to mysql server'), "
-						
-						+ "('discharge_BattTestGroupCountMax', '10', "
-						+ "'discharge_BattTestGroupCountMax for batttest thread count to work at the same time'), "
-						//-------------------------------------------------------------------------------//
-						+ "('charge_SaveDataTimeInterval', '10', "
-						+ "'charge_TimeInterval for every data insert into db_batt_testdata by seconds'), "
-						
-						+ "('charge_MonVolChangeLevel', '0.05', "
-						+ "'charge_MonVolChangeLevel for batt test data to save'), "
-						
-						+ "('charge_TestTimeLongMinimum', '1800', "
-						+ "'charge_TestTimeLongMinimum for batttest data to store'), "
-						
-						+ "('charge_TestDataRecordCountMax', '10000', "
-						+ "'charge_TestDataRecordCountMax for batttest data count to insert to mysql server'), "
-						
-						+ "('charge_BattTestGroupCountMax', '10', "
-						+ "'charge_BattTestGroupCountMax for batttest thread count to work at the same time'), "
-						//-------------------------------------------------------------------------------//
-						+ "('poweroff_SaveDataTimeInterval', '10', "
-						+ "'poweroff_TimeInterval for every data insert into db_batt_testdata by seconds'), "
-						
-						+ "('poweroff_MonVolChangeLevel', '0.05', "
-						+ "'poweroff_MonVolChangeLevel for batt test data to save'), "
-						
-						+ "('poweroff_TestTimeLongMinimum', '1800', "
-						+ "'poweroff_TestTimeLongMinimum for batttest data to store'), "
-						
-						+ "('poweroff_TestDataRecordCountMax', '10000', "
-						+ "'poweroff_TestDataRecordCountMax for batttest data count to insert to mysql server'), "
-						
-						+ "('poweroff_BattTestGroupCountMax', '10', "
-						+ "'poweroff_BattTestGroupCountMax for batttest thread count to work at the same time'), "
-						//-------------------------------------------------------------------------------//
-						+ "('BattJunHengFN', 'false', "
-						+ "'BattJunHengFN for batt monomer to be balance')";
-				
-				al_sqlstr.add(sql_str);
-				
-				for(int n=0; n<al_sqlstr.size(); n++)
-					sql.sqlMysqlExecute(al_sqlstr.get(n));
+			res = sql.sqlMysqlQuery("SELECT * FROM " + Sql_Mysql.App_Param_Table + " WHERE param_name = 'discharge_TestDataRecordCountMax'");
+			if(!res.next()) {
+				sql.sqlMysqlExecute(sql_str + "('discharge_TestDataRecordCountMax', '" + this.m_MonitorParam.discharge_TestDataRecordCountMax + "', " + "'discharge_TestDataRecordCountMax for batttest data count to insert to mysql server');");
+			}	
+			
+			res = sql.sqlMysqlQuery("SELECT * FROM " + Sql_Mysql.App_Param_Table + " WHERE param_name = 'discharge_BattTestGroupCountMax'");
+			if(!res.next()) {
+				sql.sqlMysqlExecute(sql_str + "('discharge_BattTestGroupCountMax', '" + this.m_MonitorParam.discharge_BattTestGroupCountMax + "', "	+ "'discharge_BattTestGroupCountMax for batttest thread count to work at the same time');");
+			}
+			//-------------------------------------------------------------------------------//
+			res = sql.sqlMysqlQuery("SELECT * FROM " + Sql_Mysql.App_Param_Table + " WHERE param_name = 'charge_SaveDataTimeInterval'");
+			if(!res.next()) {
+				sql.sqlMysqlExecute(sql_str + "('charge_SaveDataTimeInterval', '" + this.m_MonitorParam.charge_SaveDataTimeInterval + "', "	+ "'charge_TimeInterval for every data insert into db_batt_testdata by seconds');");
 			}
 			
-			sql_str = "SELECT * FROM  " + AppParamTableName;
+			res = sql.sqlMysqlQuery("SELECT * FROM " + Sql_Mysql.App_Param_Table + " WHERE param_name = 'charge_MonVolChangeLevel'");
+			if(!res.next()) {
+				sql.sqlMysqlExecute(sql_str + "('charge_MonVolChangeLevel', '" + this.m_MonitorParam.charge_MonVolChangeLevel + "', " + "'charge_MonVolChangeLevel for batt test data to save');");
+			}
+			
+			res = sql.sqlMysqlQuery("SELECT * FROM " + Sql_Mysql.App_Param_Table + " WHERE param_name = 'charge_TestTimeLongMinimum'");
+			if(!res.next()) {
+				sql.sqlMysqlExecute(sql_str + "('charge_TestTimeLongMinimum', '" + this.m_MonitorParam.charge_TestTimeLongMinimum + "', " + "'charge_TestTimeLongMinimum for batttest data to store');");
+			}
+			
+			res = sql.sqlMysqlQuery("SELECT * FROM " + Sql_Mysql.App_Param_Table + " WHERE param_name = 'charge_TestDataRecordCountMax'");
+			if(!res.next()) {
+				sql.sqlMysqlExecute(sql_str + "('charge_TestDataRecordCountMax', '" + this.m_MonitorParam.charge_TestDataRecordCountMax + "', "	+ "'charge_TestDataRecordCountMax for batttest data count to insert to mysql server');");
+			}
+			
+			res = sql.sqlMysqlQuery("SELECT * FROM " + Sql_Mysql.App_Param_Table + " WHERE param_name = 'charge_BattTestGroupCountMax'");
+			if(!res.next()) {
+				sql.sqlMysqlExecute(sql_str + "('charge_BattTestGroupCountMax', '" + this.m_MonitorParam.charge_BattTestGroupCountMax + "', " + "'charge_BattTestGroupCountMax for batttest thread count to work at the same time')");
+			}
+			//-------------------------------------------------------------------------------//
+			
+			res = sql.sqlMysqlQuery("SELECT * FROM " + Sql_Mysql.App_Param_Table + " WHERE param_name = 'poweroff_SaveDataTimeInterval'");
+			if(!res.next()) {
+				sql.sqlMysqlExecute(sql_str + "('poweroff_SaveDataTimeInterval', '" + this.m_MonitorParam.poweroff_SaveDataTimeInterval + "', "	+ "'poweroff_TimeInterval for every data insert into db_batt_testdata by seconds');");
+			}
+			
+			res = sql.sqlMysqlQuery("SELECT * FROM " + Sql_Mysql.App_Param_Table + " WHERE param_name = 'poweroff_MonVolChangeLevel'");
+			if(!res.next()) {
+				sql.sqlMysqlExecute(sql_str + "('poweroff_MonVolChangeLevel', '" + this.m_MonitorParam.poweroff_MonVolChangeLevel + "', " + "'poweroff_MonVolChangeLevel for batt test data to save');");
+			}
+			
+			res = sql.sqlMysqlQuery("SELECT * FROM " + Sql_Mysql.App_Param_Table + " WHERE param_name = 'poweroff_TestTimeLongMinimum'");
+			if(!res.next()) {
+				sql.sqlMysqlExecute(sql_str + "('poweroff_TestTimeLongMinimum', '" + this.m_MonitorParam.poweroff_TestTimeLongMinimum + "', " + "'poweroff_TestTimeLongMinimum for batttest data to store')");
+			}
+			
+			res = sql.sqlMysqlQuery("SELECT * FROM " + Sql_Mysql.App_Param_Table + " WHERE param_name = 'poweroff_TestDataRecordCountMax'");
+			if(!res.next()) {
+				sql.sqlMysqlExecute(sql_str + "('poweroff_TestDataRecordCountMax', '" + this.m_MonitorParam.poweroff_TestDataRecordCountMax + "', "	+ "'poweroff_TestDataRecordCountMax for batttest data count to insert to mysql server')");
+			}
+			
+			res = sql.sqlMysqlQuery("SELECT * FROM " + Sql_Mysql.App_Param_Table + " WHERE param_name = 'poweroff_BattTestGroupCountMax'");
+			if(!res.next()) {
+				sql.sqlMysqlExecute(sql_str + "('poweroff_BattTestGroupCountMax', '" + this.m_MonitorParam.poweroff_BattTestGroupCountMax + "', " + "'poweroff_BattTestGroupCountMax for batttest thread count to work at the same time')");
+			}
+			
+			//-------------------------------------------------------------------------------//
+			res = sql.sqlMysqlQuery("SELECT * FROM " + Sql_Mysql.App_Param_Table + " WHERE param_name = 'BattJunHengFN'");
+			if(!res.next()) {
+				sql.sqlMysqlExecute(sql_str + "('BattJunHengFN', '" + this.m_MonitorParam.BattJunHengFN + "', "	+ "'BattJunHengFN for batt monomer to be balance')");
+			}
+			//-------------------------------------------------------------------------------//
+			res = sql.sqlMysqlQuery("SELECT * FROM " + Sql_Mysql.App_Param_Table + " WHERE param_name = 'realdata_SaveDataTimeInterval'");
+			if(!res.next()) {
+				sql.sqlMysqlExecute(sql_str + "('realdata_SaveDataTimeInterval', '" + this.m_MonitorParam.realdata_SaveDataTimeInterval + "', "	+ "'real-time history data save data interval by seconds')");
+			}
+			//-------------------------------------------------------------------------------//
+			res = sql.sqlMysqlQuery("SELECT * FROM " + Sql_Mysql.App_Param_Table + " WHERE param_name = 'realdata_SaveDataTimeMax'");
+			if(!res.next()) {
+				sql.sqlMysqlExecute(sql_str + "('realdata_SaveDataTimeMax', '" + this.m_MonitorParam.realdata_SaveDataTimeMax + "', "	+ "'real-time history data save data max time for batttest data count to insert to mysql server')");
+			}
+			
+			sql_str = "SELECT * FROM  " + Sql_Mysql.App_Param_Table;
 			res = sql.sqlMysqlQuery(sql_str);
 			String pm_name;
 			while(res.next())
@@ -366,18 +398,18 @@
 				//---------------------------------------------------------------------------//
 				else if(pm_name.equals("BattJunHengFN"))
 					m_MonitorParam.BattJunHengFN = res.getBoolean("param_value");
+				//---------------------------------------------------------------------------//
+				else if(pm_name.equals("realdata_SaveDataTimeInterval"))
+					m_MonitorParam.realdata_SaveDataTimeInterval = res.getInt("param_value");
+				//---------------------------------------------------------------------------//
+				else if(pm_name.equals("realdata_SaveDataTimeMax"))
+					m_MonitorParam.realdata_SaveDataTimeMax = res.getInt("param_value");
+				//---------------------------------------------------------------------------//
 			}
-		}
-		catch (Exception e) {
+		} catch (SQLException e) {
 			logger.error(e.toString(), e);
-		}
-		finally
-		{
-			try {
-				sql.close_con();
-			} catch (Exception e) {
-				logger.error(e.toString(), e);
-			}
+		} finally {
+			sql.close_con();
 		}
 		//--------------------------------------------------------------------------------------------------------//
 		if(m_MonitorParam.discharge_SaveDataTimeInterval < 5) m_MonitorParam.discharge_SaveDataTimeInterval = 5;
@@ -424,6 +456,10 @@
 		
 		if(m_MonitorParam.poweroff_BattTestGroupCountMax < 10) m_MonitorParam.poweroff_BattTestGroupCountMax = 10;
 		if(m_MonitorParam.poweroff_BattTestGroupCountMax > 350) m_MonitorParam.poweroff_BattTestGroupCountMax = 350;
+
+		if(m_MonitorParam.realdata_SaveDataTimeInterval < 10) m_MonitorParam.realdata_SaveDataTimeInterval = 10;
+		
+		if(m_MonitorParam.realdata_SaveDataTimeMax < 31) m_MonitorParam.realdata_SaveDataTimeMax = 31;
 		//--------------------------------------------------------------------------------------------------------//
 	}
 }
diff --git a/iec61850_forFoShanAES_Model/src/com/dec/fbs9100/BattRealDataPro_Thread.java b/iec61850_forFoShanAES_Model/src/com/dec/fbs9100/BattRealDataPro_Thread.java
index 28f846f..8e4068e 100644
--- a/iec61850_forFoShanAES_Model/src/com/dec/fbs9100/BattRealDataPro_Thread.java
+++ b/iec61850_forFoShanAES_Model/src/com/dec/fbs9100/BattRealDataPro_Thread.java
@@ -20,19 +20,22 @@
  */
 public class BattRealDataPro_Thread extends Thread{
 	public MysqlConnPool con_pool;
-	public AppConfig cfg;
+	public AppParam param;
 	public BattData_RT_Array data;
 	Logger logger = null;
 	
 	public static int MinRecordTimeLong = 60;			//每次记录的最短时间间隔
 	public static int MaxRecordTimeLong = 366;		//最大记录历史数据时间
 	
-	public BattRealDataPro_Thread(MysqlConnPool con_pool, AppConfig cfg, BattData_RT_Array data) {
+	public BattRealDataPro_Thread(MysqlConnPool con_pool, AppParam param, BattData_RT_Array data) {
 		logger = LogManager.getLogger(this.getClass());
 		
-		this.cfg = cfg;
+		this.param = param;
 		this.con_pool = con_pool;
 		this.data = data;
+		
+		MinRecordTimeLong = param.getRealdata_SaveDataTimeInterval();
+		MaxRecordTimeLong = param.getRealdata_SaveDataTimeMax();
 	}
 	
 	
@@ -43,14 +46,14 @@
 		Date lastTime = new Date();
 		Date lastdelTime = new Date(0);
 		//线程启动前休眠60秒							//用于甄别还未通讯上的设备
-//		for(int i =0; i<60; i++) {
-//			try {
-//				sleep(1000);
-//			} catch (InterruptedException e) {
-//				logger.error(e.toString(), e);
-//			}
-//		}
-		logger.info("BattRealDataPro_Thread Start  Record......");
+		for(int i =0; i<60; i++) {
+			try {
+				sleep(1000);
+			} catch (InterruptedException e) {
+				logger.error(e.toString(), e);
+			}
+		}
+		logger.warn("BattRealDataPro_Thread Start  Record MinRecordTimeLong:" + MinRecordTimeLong + "  MaxRecordTimeLong:"+MaxRecordTimeLong);
 		Date nowTime = null;
 		while(true) {
 			/**************** mxpopstar add @ 20200817 ***************/
@@ -73,9 +76,9 @@
 					 */
 					//获取指定天数之前的时间
 					Date critical = getDateBefore(nowTime, MaxRecordTimeLong);
-					logger.error("删除"+Com.get_DTF(critical, Com.DTF_YMDhms)+"之前创建的电池组历史实时数据库表");
+					//logger.error("删除"+Com.get_DTF(critical, Com.DTF_YMDhms)+"之前创建的电池组历史实时数据库表");
 					BTS61850_Task_Thread_SQL.deleteHistoryData(con_pool, critical);
-					logger.error("删除结束。。。。。。");
+					//logger.error("删除结束。。。。。。");
 					
 					lastdelTime = nowTime;
 				}
diff --git a/iec61850_forFoShanAES_Model/src/com/dec/fbs9100/Sql_Mysql.java b/iec61850_forFoShanAES_Model/src/com/dec/fbs9100/Sql_Mysql.java
index 2b151a9..dbd25fd 100644
--- a/iec61850_forFoShanAES_Model/src/com/dec/fbs9100/Sql_Mysql.java
+++ b/iec61850_forFoShanAES_Model/src/com/dec/fbs9100/Sql_Mysql.java
@@ -134,7 +134,10 @@
 	public final static String Tb_Vip_UserTable = WEB_Site+".tb_vip_user";									//vip鐢ㄦ埛琛�
 	public final static String Tb_Batt_Param_LowTable = WEB_Site+".tb_batt_param_low";						//鐢垫睜涓嬮檺琛�
 	public final static String Tb_AnnounceTable = WEB_Site+".tb_announce";									//骞冲彴鍏憡琛�
-	//--------------------------------------------------------------------------------------------//
+	//------------------------------------- -------------------------------------------------------//
+	//------------------------------------- -------------------------------------------------------//
+	public final static String App_Param_Table = DB_PARAM + ".`tb_app_param`";
+	//------------------------------------- -------------------------------------------------------//
 	public final static String Tb_BtsStateChange_inf = DB_BATT_HISTORY + ".`tb_btsstaechange_inf`";			//璁惧鐘舵�佸彉鎹㈣褰曡〃
 	public final static String Tb_Batt_RealData = DB_BATT_HISTORY + ".tb_batt_realdata_";					//鐢垫睜瀹炴椂鏁版嵁璁板綍琛�
 	
diff --git a/iec61850_forFoShanAES_Model/src/com/dec/fbs9100/main_BTS_APP_IEC61850.java b/iec61850_forFoShanAES_Model/src/com/dec/fbs9100/main_BTS_APP_IEC61850.java
index 8e78603..1a12a11 100644
--- a/iec61850_forFoShanAES_Model/src/com/dec/fbs9100/main_BTS_APP_IEC61850.java
+++ b/iec61850_forFoShanAES_Model/src/com/dec/fbs9100/main_BTS_APP_IEC61850.java
@@ -142,7 +142,7 @@
         
         /************************************ 璁板綍鍘嗗彶瀹炴椂鏁版嵁 ***************************************************************/
         {
-            BattRealDataPro_Thread batt_realdata = new BattRealDataPro_Thread(GB_MysqlConnPool, m_AppConfig, GB_DataArray);
+            BattRealDataPro_Thread batt_realdata = new BattRealDataPro_Thread(GB_MysqlConnPool, GB_App_Param, GB_DataArray);
             batt_realdata.start();
         }
         /*********************************************************************************/
diff --git a/iec61850_forFoShanAES_Model/src/com/version_inf/version_inf.txt b/iec61850_forFoShanAES_Model/src/com/version_inf/version_inf.txt
index 3f45930..df2d60b 100644
--- a/iec61850_forFoShanAES_Model/src/com/version_inf/version_inf.txt
+++ b/iec61850_forFoShanAES_Model/src/com/version_inf/version_inf.txt
@@ -6,6 +6,7 @@
 V6.106 edit by lijun	@  2024-04-19
 	1.淇鑰佺増鏈▼搴忓彧鑳借瘑鍒涓�涓共鎺ョ偣鍛婅,2-10缂栧彿骞叉帴鐐瑰憡璀︽棤娉曡Е鍙�
 	2.鏂板鍗曚綋鐢靛帇锛屽崟浣撳唴闃伙紝鍗曚綋娓╁害锛屽崟浣撳墿浣欏閲忓憡璀�,鏍稿缁堟鏃跺墿浣欏閲忥紝鏍稿缁堟鏃剁粍绔數鍘嬶紝鏍稿缁堟鏃堕棿绛夎鍙�
+	3.鏂板鍘嗗彶瀹炴椂鏁版嵁閫氳繃琛� 'db_param.tb_app_param'璁剧疆淇濆瓨鐨勬椂闂�
 
 V6.105 edit by lijun    @  2024-02-21	
 	1.鏂板sign_type 鏍囪瘑褰撳墠璁惧鏄爣鍑�1鎵�1杩樻槸鏍囧噯1鎵�2璁惧

--
Gitblit v1.9.1