From e92ada77fcae1e4bb8fe97eabb59e4e553623608 Mon Sep 17 00:00:00 2001
From: Administrator <1525436766@qq.com>
Date: 星期二, 10 五月 2022 10:32:39 +0800
Subject: [PATCH] V2.24 edit at date 2022-05-10 	1.禁用数据库表删除功能,避免重新删除功能 	2.修复插入BTS停电机房信息时错误bug 	3.修改`db_user`.`tb_user_log`中的'uOprateMsg'字段格式为 		`uOprateMsg` text NOT NULL,

---
 BattMonitor_DB_Builder/src/com/dev/fbs9100/FBS9100_Task_Thread_SQL.java |   31 +++++++++++++++++++++++--------
 1 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/BattMonitor_DB_Builder/src/com/dev/fbs9100/FBS9100_Task_Thread_SQL.java b/BattMonitor_DB_Builder/src/com/dev/fbs9100/FBS9100_Task_Thread_SQL.java
index 8e45bb1..32ab23f 100644
--- a/BattMonitor_DB_Builder/src/com/dev/fbs9100/FBS9100_Task_Thread_SQL.java
+++ b/BattMonitor_DB_Builder/src/com/dev/fbs9100/FBS9100_Task_Thread_SQL.java
@@ -2,6 +2,8 @@
 
 import java.sql.ResultSet;
 import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.Map;
 
 import javax.net.ssl.HandshakeCompletedEvent;
 
@@ -765,21 +767,34 @@
 		try {
 			rs= sql.sqlMysqlQuery(sql_str1);
 			//System.out.println(sql_str1);
-			boolean hasInsertStation = false;;
+			Map<Integer, String> station = new HashMap<>();
 			while(rs.next()) {
-				int dev_id = rs.getInt("FBSDeviceId");
+				String dev_id = rs.getString("FBSDeviceId");
 				int stationid = rs.getInt("StationId");
-				if( !hasInsertStation ) {
-					sql_str2 = sql_str2 + "(" + dev_id + "," + stationid + ")";
-					hasInsertStation = true;
-				}else {
-					sql_str2 = sql_str2 + ",(" + dev_id + "," + stationid + ")";
+				if(stationid > 0 && null != dev_id) {
+					String fbs_dev_id = station.get(stationid);
+					if(null == fbs_dev_id) {
+						station.put(stationid, dev_id);
+					}					
 				}				
 			}
-			if(hasInsertStation) {
+			boolean hasInsertStation = false;
+			if(!station.isEmpty()) {
+				for(Map.Entry<Integer, String> entry : station.entrySet()){
+		            Integer mapKey = entry.getKey();
+		            String mapValue = entry.getValue();
+		            
+		            if( !hasInsertStation ) {
+		            	sql_str2 = sql_str2 + "(" + mapValue + "," + mapKey + ")";
+		            	hasInsertStation = true;
+		            }else {
+		            	sql_str2 = sql_str2 + ",(" + mapValue + "," + mapKey + ")";
+		            }				
+		        }
 				//System.out.println(sql_str2);
 				sql.sqlMysqlExecute(sql_str2);
 			}
+			station.clear();
 		} catch (SQLException e) {
 			e.printStackTrace();
 		} finally {

--
Gitblit v1.9.1