From fda9237a0eee9b12b8f83e5dc03a44ae63b3d73d Mon Sep 17 00:00:00 2001
From: Administrator <1525436766@qq.com>
Date: 星期四, 30 六月 2022 09:58:13 +0800
Subject: [PATCH] V1.34 edit at date 2022-06-30 	1.修复之前默认添加的superuser账号为临时账号bug

---
 BattMonitor_DB_Builder/src/com/database_util/DB_db_user.java |   36 +++++++++++++++++++++++++++++++++---
 1 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/BattMonitor_DB_Builder/src/com/database_util/DB_db_user.java b/BattMonitor_DB_Builder/src/com/database_util/DB_db_user.java
index 0758daa..d6fbb72 100644
--- a/BattMonitor_DB_Builder/src/com/database_util/DB_db_user.java
+++ b/BattMonitor_DB_Builder/src/com/database_util/DB_db_user.java
@@ -1475,15 +1475,45 @@
 			//123456--------
 			String upstr = "jFr3/n7JBhwxVE+uiMzC9LapSjDb97x1P7s8npTTLepabMucHcgVPwU/rkiG4tLlEICjYJKINQzoZQ0bqGxhwASe9vT2KukOOHJAEmBjs1uWkJoK0GLMZtNt7oiRoQzVSzPCfmtlc64gplUCSH6UTqqkMu//pEn/67W4sTLzUzg=";
 			res = sql.sqlMysqlQuery("SELECT COUNT(*) as num_count FROM " + Sql_Mysql.TB_UserInf);
-			if(res.next()) {
+			/*if(res.next()) {
 				int count = res.getInt("num_count");
 				if(count<1) {
 					//默认没有添加用户信息时添加superuser
-					sql.sqlMysqlExecute("INSERT INTO "+Sql_Mysql.TB_UserInf+" VALUES ('1001', '" + upstr + "', 'admin', 'admin', 'employeeid', '12345678912', '12345678912', 'abcde@mail.com', '', '1980-01-01', '2015-12-09', '男', '广东省', 'protitle', 'authority', '默认班组', 'duties', 'tasks', '1', 'note', '"+upstr+"', '', '', '48505834353130373639353153594E4F', '28', '0','0','0','0','1','" + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms) + "','2022-05-19 14:53:44','2022-05-19 14:53:44','2022-05-19 14:53:44','2022-05-19 14:53:44','0','0');");
-					sql.sqlMysqlExecute("INSERT INTO "+Sql_Mysql.TB_UserInf+" VALUES ('1002', '" + upstr + "', 'superuser', '1234567', '100010000', '12345678', '15346259512', '123456789@qq.com', '', '1990-04-20', '2016-03-28', '男', '湖北省', '软件工程师', 'authority111', '默认班组', 'dutie', '完成软件的研发工作', '0', 'note', '"+upstr+"', '', '', '14031C0F0136063E', '27', '0','0','0','0','1','" + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms) + "','2022-05-19 14:53:44','2022-05-19 14:53:44','2022-05-19 14:53:44','2022-05-19 14:53:44','0','0');");
+					sql.sqlMysqlExecute("INSERT INTO "+Sql_Mysql.TB_UserInf+" VALUES ('1001', '" + upstr + "', 'admin', 'admin', 'employeeid', '12345678912', '12345678912', 'abcde@mail.com', '', '1980-01-01', '2015-12-09', '男', '广东省', 'protitle', 'authority', '默认班组', 'duties', 'tasks', '1', 'note', '"+upstr+"', '', '', '48505834353130373639353153594E4F', '28', '0','0','0','1','1',null,'"+Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms)+"','2022-05-19 14:53:44','2022-05-19 14:53:44',null,'00:00:01~23:59:59','*');");
+					sql.sqlMysqlExecute("INSERT INTO "+Sql_Mysql.TB_UserInf+" VALUES ('1002', '" + upstr + "', 'superuser', '1234567', '100010000', '12345678', '15346259512', '123456789@qq.com', '', '1990-04-20', '2016-03-28', '男', '湖北省', '软件工程师', 'authority111', '默认班组', 'dutie', '完成软件的研发工作', '0', 'note', '"+upstr+"', '', '', '14031C0F0136063E', '27', '0','0','0','1','1',null,'"+Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms)+"','2022-05-19 14:53:44','2022-05-19 14:53:44',null,'00:00:01~23:59:59','*');");
+				}
+			}*/
+			
+			//默认新增系统默认的账号superuser,admin
+			{
+				//添加admin
+				res = sql.sqlMysqlQuery("SELECT COUNT(*) as num_count FROM " + Sql_Mysql.TB_UserInf + " WHERE uName = 'admin';");
+				if(res.next()) {
+					int count = res.getInt("num_count");
+					if(count<1) {
+						//默认没有添加用户信息时添加'admin'
+						sql.sqlMysqlExecute("INSERT INTO "+Sql_Mysql.TB_UserInf+" VALUES ('1001', '" + upstr + "', 'admin', 'admin', 'employeeid', '12345678912', '12345678912', 'abcde@mail.com', '', '1980-01-01', '2015-12-09', '男', '广东省', 'protitle', 'authority', '默认班组', 'duties', 'tasks', '1', 'note', '"+upstr+"', '', '', '48505834353130373639353153594E4F', '28', '0','0','0','1','1',null,'"+Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms)+"','2022-05-19 14:53:44','2022-05-19 14:53:44',null,'00:00:01~23:59:59','*');");
+					}else {
+						//修复前期添加默认账号时添加成了临时账号
+						sql.sqlMysqlExecute("UPDATE " + Sql_Mysql.UserInfTable + " SET type = 1,expiration_time = null,lock_time = null,visit_time='00:00:00~23:59:59',visit_ip = '*' WHERE uName = 'admin'");
+					}					
+				}
+				//添加superuser
+				res = sql.sqlMysqlQuery("SELECT COUNT(*) as num_count FROM " + Sql_Mysql.TB_UserInf + " WHERE uName = 'superuser';");
+				if(res.next()) {
+					int count = res.getInt("num_count");
+					if(count<1) {
+						//默认没有添加用户信息时添加'superuser'
+						sql.sqlMysqlExecute("INSERT INTO "+Sql_Mysql.TB_UserInf+" VALUES ('1002', '" + upstr + "', 'superuser', '1234567', '100010000', '12345678', '15346259512', '123456789@qq.com', '', '1990-04-20', '2016-03-28', '男', '湖北省', '软件工程师', 'authority111', '默认班组', 'dutie', '完成软件的研发工作', '0', 'note', '"+upstr+"', '', '', '14031C0F0136063E', '27', '0','0','0','1','1',null,'"+Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms)+"','2022-05-19 14:53:44','2022-05-19 14:53:44',null,'00:00:01~23:59:59','*');");
+					}else {
+						//修复前期添加默认账号时添加成了临时账号
+						sql.sqlMysqlExecute("UPDATE " + Sql_Mysql.UserInfTable + " SET type = 1,expiration_time = null,lock_time = null,visit_time='00:00:00~23:59:59',visit_ip = '*' WHERE uName = 'superuser'");
+					}
+					
 				}
 			}
 			
+			
 			//默认新增指定UID = 0;1;2的 账号
 			{
 				res = sql.sqlMysqlQuery("SELECT COUNT(*) as num_count FROM " + Sql_Mysql.TB_UserInf + " WHERE uName = '未登录的用户账号';");

--
Gitblit v1.9.1