Explorar o código

1、中断间隔添加配置项;2、时间补偿添加配置项(项目级);3、ip添加配置项;4、配置文件添加excel格式的支持;5、添加mysql数据库支持;6、添加upload表的生成;7、添加功能号转换(项目级)功能,日志记录原功能号;8、添加接收时间/数据时间的记录。

Jay Lee %!s(int64=6) %!d(string=hai) anos
pai
achega
217f9b6d79

+ 2 - 2
collect/src/main/java/com/saga/entity/Collector.java

@@ -1,10 +1,10 @@
 package com.saga.entity;
 
-public class Collector {
+public class Server {
 	public String IP;
 	public int Port;
-	public String MAC;
 	public String PROTOCOL;
 	public String Mode;
 	public int Max_size;
+	public boolean compress;
 }

+ 0 - 15
collect/src/main/java/com/saga/entity/Upload.java

@@ -1,15 +0,0 @@
-package com.saga.entity;
-
-public class Upload {
-	public String PROTOCOL;
-	public String IP;
-	public int Port;
-	public String ServerIP;
-	public int ServerPort;
-	public String Mode;
-	public int Max_size;
-	public int SleepCount;
-	public String Separate;
-	public String Separate_begin;
-	public String Separate_end;
-}

+ 195 - 201
collect/src/main/java/com/saga/main/Main.java

@@ -1,35 +1,28 @@
 package com.saga.main;
 
-import java.io.FileInputStream;
+import java.sql.DriverManager;
 import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
 
 import org.apache.hadoop.conf.Configuration;
 import org.zillion.util.log.LogUtil;
 
-import com.persagy.communication.mina.tcp.server.TCPServerManager;
-import com.persagy.communication.mina.udp.server.UDPServerManager;
-import com.persagy.communication.util.IServerManager;
+import com.saga.entity.EntityHbase;
+import com.saga.entity.EntityMysql;
 import com.saga.thread.common.CheckThread;
 import com.saga.thread.common.LoadConfigThread;
 import com.saga.thread.common.SaveThread;
 import com.saga.thread.common.StatsThread;
 import com.saga.thread.common.WTDBThread;
-import com.saga.thread.down.CollectThread;
-import com.saga.thread.up.SendThread;
+import com.saga.thread.down.DownThread;
+import com.saga.thread.up.UpThread;
 import com.saga.util.Constant;
-import com.saga.util.HBaseUtil;
 import com.zillion.database.agent.ZillionAgent;
 
 public class Main {
 
 	public static void main(String[] args) {
 		// TODO Auto-generated method stub
-
 		// 初始化
 		init(args);
 		// 业务进程启动
@@ -49,43 +42,28 @@ public class Main {
 		// 配置实时加载进程
 		try {
 			new LoadConfigThread().start();
-			Thread.sleep(3L);
+			Thread.sleep(Constant.Millisecond.SECOND_1);
 		} catch (Exception e) {
 			// TODO Auto-generated catch block
 			LogUtil.error("Main.threadStart.LoadConfigThread: " + e.toString());
 		}
-		// 采集进程
+		// Down进程
 		try {
-			new CollectThread(Integer.valueOf(Constant.TypePort.get("Down"))).start();
+			new DownThread(Constant.TypeServer.get("Down")).start();
 			Thread.sleep(3L);
 		} catch (Exception e) {
 			// TODO Auto-generated catch block
-			LogUtil.error("Main.threadStart.CollectThread: " + e.toString());
-		}
-		// 上传进程
-		List<IServerManager> udpserverList = new ArrayList<IServerManager>();
-		List<IServerManager> tcpserverList = new ArrayList<IServerManager>();
-		udpserverList.add(new UDPServerManager("0.0.0.0", Integer.valueOf(Constant.TypePort.get("Up")), "utf-8", 1000));
-		tcpserverList.add(new TCPServerManager("0.0.0.0", Integer.valueOf(Constant.TypePort.get("Up")), "utf-8", 1000));
-
-		for (IServerManager server : udpserverList) {
-			try {
-				new SendThread(server).start();
-				Thread.sleep(3L);
-			} catch (Exception e) {
-				// TODO Auto-generated catch block
-				LogUtil.error("Main.threadStart.SendThread-UDP: " + e.toString());
-			}
+			LogUtil.error("Main.threadStart.DownThread: " + e.toString());
 		}
-		for (IServerManager server : tcpserverList) {
-			try {
-				new SendThread(server).start();
-				Thread.sleep(3L);
-			} catch (Exception e) {
-				// TODO Auto-generated catch block
-				LogUtil.error("Main.threadStart.SendThread-TCP: " + e.toString());
-			}
+		// Up进程
+		try {
+			new UpThread(Constant.TypeServer.get("Up")).start();
+			Thread.sleep(3L);
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			LogUtil.error("Main.threadStart.UpThread: " + e.toString());
 		}
+
 		// 数据处理进程
 		try {
 			new SaveThread().start();
@@ -120,9 +98,10 @@ public class Main {
 	private static void init(String[] args) {
 		// TODO Auto-generated method stub
 		try {
-			// ZillionAgent 启动
-			// agentStart(args);
-			agentsStart();
+			// loadExcelConfig
+			LoadConfigThread.loadExcelConfig();
+			// DB 连接
+			dbConnect();
 			// 初始化数据库环境
 			initDB();
 			// 加载DB配置
@@ -162,6 +141,30 @@ public class Main {
 	// }
 	// }
 
+	private static void dbConnect() {
+		// TODO Auto-generated method stub
+		if (Constant.DbConnection.containsKey("Db-Mysql")) {
+			mysqlConnect();
+		} else if (Constant.DbConnection.containsKey("Db-Hbase")) {
+			hbaseConnect();
+		}
+	}
+
+	private static void mysqlConnect() {
+		// TODO Auto-generated method stub
+		try {
+			Class.forName("com.mysql.jdbc.Driver");
+			EntityMysql entityMysql = new EntityMysql();
+			entityMysql = (EntityMysql) Constant.DbConnection.get("Db-Mysql");
+			Constant.conn = DriverManager.getConnection("jdbc:mysql://" + entityMysql.Ip + ":" + entityMysql.Port + "/",
+					entityMysql.User, entityMysql.Password);
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+			LogUtil.error("Main.init.mysqlConnect: " + e.toString());
+		}
+	}
+
 	private static void loadDB() {
 		// TODO Auto-generated method stub
 		// // V1.0点位日志结构
@@ -172,9 +175,9 @@ public class Main {
 		{
 			// 先加载状态再加载列表,如无状态记录则根据列表生成null
 			// loadStatus2();
-			loadAgentsStatus2();
+			loadStatus2();
 			// loadPointList2();
-			loadAgentsPointList2();
+			loadPointList2();
 		}
 	}
 	//
@@ -196,10 +199,10 @@ public class Main {
 	// }
 	// }
 
-	private static void loadAgentsPointList2() {
+	private static void loadPointList2() {
 		// TODO Auto-generated method stub
 		// 重新启动加载点位列表
-		Constant.AgentsLoadDB2Cache_dy_pointlist();
+		Constant.loadDB2Cache_dy_pointlist();
 	}
 	// private static void loadStatus() {
 	// // TODO Auto-generated method stub
@@ -244,62 +247,48 @@ public class Main {
 	// }
 	// }
 
-	private static void loadAgentsStatus2() {
+	private static void loadStatus2() {
 		// TODO Auto-generated method stub
 		// 重新启动加载节点、点位状态
-		for (ZillionAgent agent : Constant.agents) {
-			for (Entry<String, String> bd : Constant.BuildingDB.entrySet()) {
-				try {
-					String project = bd.getKey();
-					String db = bd.getValue();
-					HBaseUtil.LoadDB2Cache_ps_physical_status(agent, db, "ps_physical_status", project);
-					HBaseUtil.LoadDB2Cache_ps_virtual_meter_status(agent, db, "ps_virtual_meter_status", project);
-					HBaseUtil.LoadDB2Cache_ps_virtual_point_status(agent, db, "ps_virtual_point_status", project);
-					HBaseUtil.LoadDB2Cache_ps_virtual_project_status(agent, db, "ps_virtual_project_status", project);
-				} catch (Exception e) {
-					// TODO Auto-generated catch block
-					e.printStackTrace();
-					LogUtil.error("Main.loadAgentsStatus2: " + e.toString());
-				}
-			}
+		try {
+			Constant.LoadDB2Cache_ps_physical_status(Constant.Database, "ps_physical_status");
+			Constant.LoadDB2Cache_ps_virtual_meter_status(Constant.Database, "ps_virtual_meter_status");
+			Constant.LoadDB2Cache_ps_virtual_point_status(Constant.Database, "ps_virtual_point_status");
+			Constant.LoadDB2Cache_ps_virtual_project_status(Constant.Database, "ps_virtual_project_status");
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+			LogUtil.error("Main.loadStatus2: " + e.toString());
 		}
 	}
 
 	private static void initDB() {
 		// TODO Auto-generated method stub
-		Map<String, String> dbList = new HashMap<String, String>();
-		for (Entry<String, String> bd : Constant.BuildingDB.entrySet()) {
-			dbList.put(bd.getValue(), bd.getValue());
-		}
-
-		for (String db : dbList.keySet()) {
-			try {
-
-				// createDB(db);
-				createAgentsDB(db);
-				Thread.sleep(Constant.Millisecond.SECOND_1);
+		try {
+			// createDB(db);
+			Constant.CreateDB(Constant.Database);
+			Thread.sleep(Constant.Millisecond.SECOND_1);
+
+			// // V1.0点位日志结构
+			// {
+			// Thread.sleep(Constant.Millisecond.SECOND_1);
+			// // dropTB(db);
+			// // Thread.sleep(Constant.Millisecond.SECOND_1);
+			// createTB(db);
+			// }
 
-				// // V1.0点位日志结构
-				// {
+			// V2.0点位日志结构
+			{
+				// dropTB2(db);
 				// Thread.sleep(Constant.Millisecond.SECOND_1);
-				// // dropTB(db);
-				// // Thread.sleep(Constant.Millisecond.SECOND_1);
-				// createTB(db);
-				// }
-
-				// V2.0点位日志结构
-				{
-					// dropTB2(db);
-					// Thread.sleep(Constant.Millisecond.SECOND_1);
-					// createTB2(db);
-					createAgentsTB2(db);
-				}
-
-				Thread.sleep(Constant.Millisecond.SECOND_1);
-			} catch (InterruptedException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
+				// createTB2(db);
+				createTB2(Constant.Database);
 			}
+
+			Thread.sleep(Constant.Millisecond.SECOND_1);
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
 		}
 	}
 
@@ -371,67 +360,71 @@ public class Main {
 	// }
 	// }
 
-	private static void createAgentsTB2(String db) {
+	private static void createTB2(String db) {
 		// TODO Auto-generated method stub
-		for (ZillionAgent agent : Constant.agents) {
-			try {
-				// original_month
-				HBaseUtil.CreateTable(agent, db, "original_month");
-				Thread.sleep(Constant.Millisecond.SECOND_3);
-				// original_present
-				HBaseUtil.CreateTable_present(agent, db, "original_present");
-				Thread.sleep(Constant.Millisecond.SECOND_3);
-				// originalset
-				HBaseUtil.CreateTable_set(agent, db, "originalset");
-				Thread.sleep(Constant.Millisecond.SECOND_3);
-				// originalset_present
-				HBaseUtil.CreateTable_setpresent(agent, db, "originalset_present");
-				Thread.sleep(Constant.Millisecond.SECOND_3);
-				// dy_pointlist
-				HBaseUtil.CreateTable_dy_pointlist(agent, db, "dy_pointlist");
-				Thread.sleep(Constant.Millisecond.SECOND_3);
-				// fjd_0_buildingcomputetime
-				HBaseUtil.CreateTable_fjd_0_buildingcomputetime(agent, db, "fjd_0_buildingcomputetime");
-				Thread.sleep(Constant.Millisecond.SECOND_3);
-
-				// ps_physical_status
-				HBaseUtil.CreateTable_ps_physical_status(agent, db, "ps_physical_status");
-				Thread.sleep(Constant.Millisecond.SECOND_3);
-
-				// ps_physical_log
-				HBaseUtil.CreateTable_ps_physical_log(agent, db, "ps_physical_log");
-				Thread.sleep(Constant.Millisecond.SECOND_3);
-
-				// ps_virtual_point_status
-				HBaseUtil.CreateTable_ps_virtual_point_status(agent, db, "ps_virtual_point_status");
-				Thread.sleep(Constant.Millisecond.SECOND_3);
-
-				// ps_virtual_point_log
-				HBaseUtil.CreateTable_ps_virtual_point_log(agent, db, "ps_virtual_point_log");
-				Thread.sleep(Constant.Millisecond.SECOND_3);
-
-				// ps_virtual_meter_status
-				HBaseUtil.CreateTable_ps_virtual_meter_status(agent, db, "ps_virtual_meter_status");
-				Thread.sleep(Constant.Millisecond.SECOND_3);
-
-				// ps_virtual_meter_log
-				HBaseUtil.CreateTable_ps_virtual_meter_log(agent, db, "ps_virtual_meter_log");
-				Thread.sleep(Constant.Millisecond.SECOND_3);
-
-				// ps_virtual_project_status
-				HBaseUtil.CreateTable_ps_virtual_project_status(agent, db, "ps_virtual_project_status");
-				Thread.sleep(Constant.Millisecond.SECOND_3);
-
-				// ps_virtual_project_log
-				HBaseUtil.CreateTable_ps_virtual_project_log(agent, db, "ps_virtual_project_log");
-				Thread.sleep(Constant.Millisecond.SECOND_3);
-
-				Thread.sleep(Constant.Millisecond.SECOND_30);
-			} catch (Exception e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-				LogUtil.error("Main.init.initDB.createAgentsTB2: " + e.toString());
-			}
+		try {
+			// original_month
+			Constant.CreateTable(db, "original_month");
+			Thread.sleep(Constant.Millisecond.SECOND_3);
+			// original_detail
+			Constant.CreateTable_detail(db, "original_detail");
+			Thread.sleep(Constant.Millisecond.SECOND_3);
+			// original_upload
+			Constant.CreateTable_upload(db, Constant.uploadList);
+			Thread.sleep(Constant.Millisecond.SECOND_3);
+			// original_present
+			Constant.CreateTable_present(db, "original_present");
+			Thread.sleep(Constant.Millisecond.SECOND_3);
+			// originalset
+			Constant.CreateTable_set(db, "originalset");
+			Thread.sleep(Constant.Millisecond.SECOND_3);
+			// originalset_present
+			Constant.CreateTable_setpresent(db, "originalset_present");
+			Thread.sleep(Constant.Millisecond.SECOND_3);
+			// dy_pointlist
+			Constant.CreateTable_dy_pointlist(db, "dy_pointlist");
+			Thread.sleep(Constant.Millisecond.SECOND_3);
+			// fjd_0_buildingcomputetime
+			Constant.CreateTable_fjd_0_buildingcomputetime(db, "fjd_0_buildingcomputetime");
+			Thread.sleep(Constant.Millisecond.SECOND_3);
+
+			// ps_physical_status
+			Constant.CreateTable_ps_physical_status(db, "ps_physical_status");
+			Thread.sleep(Constant.Millisecond.SECOND_3);
+
+			// ps_physical_log
+			Constant.CreateTable_ps_physical_log(db, "ps_physical_log");
+			Thread.sleep(Constant.Millisecond.SECOND_3);
+
+			// ps_virtual_point_status
+			Constant.CreateTable_ps_virtual_point_status(db, "ps_virtual_point_status");
+			Thread.sleep(Constant.Millisecond.SECOND_3);
+
+			// ps_virtual_point_log
+			Constant.CreateTable_ps_virtual_point_log(db, "ps_virtual_point_log");
+			Thread.sleep(Constant.Millisecond.SECOND_3);
+
+			// ps_virtual_meter_status
+			Constant.CreateTable_ps_virtual_meter_status(db, "ps_virtual_meter_status");
+			Thread.sleep(Constant.Millisecond.SECOND_3);
+
+			// ps_virtual_meter_log
+			Constant.CreateTable_ps_virtual_meter_log(db, "ps_virtual_meter_log");
+			Thread.sleep(Constant.Millisecond.SECOND_3);
+
+			// ps_virtual_project_status
+			Constant.CreateTable_ps_virtual_project_status(db, "ps_virtual_project_status");
+			Thread.sleep(Constant.Millisecond.SECOND_3);
+
+			// ps_virtual_project_log
+			Constant.CreateTable_ps_virtual_project_log(db, "ps_virtual_project_log");
+			Thread.sleep(Constant.Millisecond.SECOND_3);
+
+			Thread.sleep(Constant.Millisecond.SECOND_30);
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+			LogUtil.error("Main.init.initDB.createTB2: " + e.toString());
 		}
 	}
 	//
@@ -556,18 +549,17 @@ public class Main {
 	// }
 	// }
 
-	private static void createAgentsDB(String db) {
-		// TODO Auto-generated method stub
-		for (ZillionAgent agent : Constant.agents) {
-			try {
-				HBaseUtil.CreateDB(agent, db);
-				Thread.sleep(1000L);
-			} catch (Exception e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
-		}
-	}
+	// private static void createAgentsDB(String db) {
+	// // TODO Auto-generated method stub
+	// try {
+	// HBaseUtil.CreateDB(db);
+	// Thread.sleep(1000L);
+	// } catch (Exception e) {
+	// // TODO Auto-generated catch block
+	// e.printStackTrace();
+	// }
+	//
+	// }
 
 	// private static void agentStart(String[] args) {
 	// // TODO Auto-generated method stub
@@ -602,47 +594,49 @@ public class Main {
 	// }
 	// }
 
-	private static void agentsStart() {
+	private static void hbaseConnect() {
 		// TODO Auto-generated method stub
+		// try {
+		// String resource = "/hbase-site.xml";
+		// Configuration configuration = new Configuration();
+		// configuration.addResource(new
+		// FileInputStream(System.getProperty("user.dir") + resource));
+		// int zookeeper_sessionTimeout = 300000;
+
+		// List<String> qrlist = new ArrayList<String>();
+		// qrlist.add("zookeeper1:2181,zookeeper2:2181,zookeeper3:2181");
+		// qrlist.add("zookeeper1,zookeeper2,zookeeper3");
+		// qrlist.add("zookeeper1.saga");
+		// qrlist.add("zookeeper");
+
+		// for (String qr : qrlist) {
 		try {
-			String resource = "/hbase-site.xml";
+			EntityHbase entityHbase = new EntityHbase();
+			entityHbase = (EntityHbase) Constant.DbConnection.get("Db-Hbase");
 			Configuration configuration = new Configuration();
-			configuration.addResource(new FileInputStream(System.getProperty("user.dir") + resource));
-			// int zookeeper_sessionTimeout = 300000;
-
-			// List<String> qrlist = new ArrayList<String>();
-			// qrlist.add("zookeeper1:2181,zookeeper2:2181,zookeeper3:2181");
-			// qrlist.add("zookeeper1,zookeeper2,zookeeper3");
-			// qrlist.add("zookeeper1.saga");
-			// qrlist.add("zookeeper");
-
-			// for (String qr : qrlist) {
-			try {
-				// Configuration configuration = new Configuration();
-				// configuration.set("hbase.cluster.distributed", "true");
-				// configuration.set("hbase.zookeeper.quorum", qr);
-				ZillionAgent agent = new ZillionAgent(configuration);
-				agent.Start();
-				Constant.agents.add(agent);
-			} catch (Exception e) {
-				e.printStackTrace();
-				LogUtil.error("Main.init.agentsStart: " + e.toString());
-			}
-			// }
-			// Constant.agents.add(new ZillionAgent(configuration,
-			// "zookeeper1:2181,zookeeper2:2181,zookeeper3:2181",
-			// zookeeper_sessionTimeout));
-			// Constant.agents
-			// .add(new ZillionAgent(configuration,
-			// "zookeeper1,zookeeper2,zookeeper3", zookeeper_sessionTimeout));
-			// Constant.agents.add(new ZillionAgent(configuration, "zookeeper1",
-			// zookeeper_sessionTimeout));
-			// Constant.agents.add(new ZillionAgent(configuration,
-			// "zookeeper1.saga", zookeeper_sessionTimeout));
-
+			configuration.set("hbase.cluster.distributed", "true");
+			configuration.set("hbase.zookeeper.quorum", entityHbase.Address);
+			Constant.agent = new ZillionAgent(configuration);
+			Constant.agent.Start();
 		} catch (Exception e) {
-			// TODO Auto-generated catch block
-			LogUtil.error("Main.init.agentsStart: " + e.toString());
+			e.printStackTrace();
+			LogUtil.error("Main.init.hbaseConnect: " + e.toString());
 		}
+		// }
+		// Constant.agents.add(new ZillionAgent(configuration,
+		// "zookeeper1:2181,zookeeper2:2181,zookeeper3:2181",
+		// zookeeper_sessionTimeout));
+		// Constant.agents
+		// .add(new ZillionAgent(configuration,
+		// "zookeeper1,zookeeper2,zookeeper3", zookeeper_sessionTimeout));
+		// Constant.agents.add(new ZillionAgent(configuration, "zookeeper1",
+		// zookeeper_sessionTimeout));
+		// Constant.agents.add(new ZillionAgent(configuration,
+		// "zookeeper1.saga", zookeeper_sessionTimeout));
+
+		// } catch (Exception e) {
+		// // TODO Auto-generated catch block
+		// LogUtil.error("Main.init.hbaseConnect: " + e.toString());
+		// }
 	}
 }

+ 80 - 83
collect/src/main/java/com/saga/test/Test.java

@@ -1,103 +1,100 @@
 package com.saga.test;
 
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Date;
 
-import org.apache.hadoop.conf.Configuration;
 import org.zillion.util.log.LogUtil;
 
-import com.persagy.communication.mina.tcp.server.TCPServerManager;
-import com.persagy.communication.mina.udp.server.UDPServerManager;
-import com.persagy.communication.util.IServerManager;
-import com.saga.entity.EntityPoint;
-import com.saga.thread.common.CheckThread;
+import com.saga.entity.EntityMysql;
 import com.saga.thread.common.LoadConfigThread;
-import com.saga.thread.common.SaveThread;
-import com.saga.thread.common.StatsThread;
-import com.saga.thread.common.WTDBThread;
-import com.saga.thread.down.CollectThread;
-import com.saga.thread.up.SendThread;
 import com.saga.util.Constant;
-import com.saga.util.HBaseUtil;
-import com.zillion.database.agent.ZillionAgent;
+import com.saga.util.MySQLUtil;
 
 public class Test {
 
 	public static void main(String[] args) throws InterruptedException {
 		// TODO Auto-generated method stub
-		Map<String, String> m1 = new HashMap<String, String>();
-		Map<String, String> m2 = new HashMap<String, String>();
-		m1.put("a", "b");
-		m1.put("d", "d");
-		m1.put("e", "f");
-		m2.put("a", "f");
-		m1.putAll(m2);
-		System.out.println(m1);
 
-	}
-
-	private static void agentsStart() {
-		// TODO Auto-generated method stub
-		try {
-			// String resource = "/hbase-site.xml";
-			// Configuration configuration = new Configuration();
-			// configuration.addResource(new
-			// FileInputStream(System.getProperty("user.dir") + resource));
-			// int zookeeper_sessionTimeout = 300000;
+		Date d1 = new Date();
+		System.out.println(d1);
+		Date d2 = new Date(d1.getTime() + Constant.Millisecond.HOUR);
+		System.out.println(d2);
+		System.out.println("" + Integer.valueOf(Constant.format_month(new Date()).substring(4)));
 
-			List<String> qrlist = new ArrayList<String>();
-			qrlist.add("zookeeper1:2181,zookeeper2:2181,zookeeper3:2181");
-			qrlist.add("zookeeper1,zookeeper2,zookeeper3");
-			qrlist.add("zookeeper1");
-			qrlist.add("zookeeper1.saga");
+		// new LoadConfigThread().start();
+		// MySQLUtil.select("SELECT * FROM
+		// zz_originaldata.201705_monthdata_1101080002 LIMIT 100");
 
-			for (String qr : qrlist) {
-				Configuration configuration = new Configuration();
-				configuration.set("hbase.cluster.distributed", "true");
-				configuration.set("hbase.zookeeper.quorum", qr);
-				ZillionAgent agent = new ZillionAgent(configuration);
-				agent.setFull_name(qr);
-				Constant.agents.add(agent);
-			}
-			// Constant.agents.add(new ZillionAgent(configuration,
-			// "zookeeper1:2181,zookeeper2:2181,zookeeper3:2181",
-			// zookeeper_sessionTimeout));
-			// Constant.agents
-			// .add(new ZillionAgent(configuration,
-			// "zookeeper1,zookeeper2,zookeeper3", zookeeper_sessionTimeout));
-			// Constant.agents.add(new ZillionAgent(configuration, "zookeeper1",
-			// zookeeper_sessionTimeout));
-			// Constant.agents.add(new ZillionAgent(configuration,
-			// "zookeeper1.saga", zookeeper_sessionTimeout));
+		// Map<String, String> m1 = new HashMap<String, String>();
+		// Map<String, String> m2 = new HashMap<String, String>();
+		// m1.put("a", "b");
+		// m1.put("d", "d");
+		// m1.put("e", "f");
+		// m2.put("a", "f");
+		// m1.putAll(m2);
+		// System.out.println(m1);
+		//
+		// System.out.println(Constant.black_Buildings);
+		// System.out.println(Constant.whilte_Funcs);
 
-			Iterator<ZillionAgent> it = Constant.agents.iterator();
-			while (it.hasNext()) {
-				ZillionAgent agent = it.next();
-				try {
-					agent.Start();
-					LogUtil.info(agent.getFull_name() + " starting ...");
-				} catch (Exception e) {
-					// TODO Auto-generated catch block
-					// agent启动失败则移除,以免造成资源浪费
-					LogUtil.warn(agent.getFull_name() + " failed to start ,now remove !");
-					it.remove();
-					LogUtil.error("Main.init.agentsStart: " + e.toString());
-				}
-			}
-		} catch (Exception e) {
-			// TODO Auto-generated catch block
-			LogUtil.error("Main.init.agentsStart: " + e.toString());
-		}
 	}
+
+	// private static void agentsStart() {
+	// // TODO Auto-generated method stub
+	// try {
+	// // String resource = "/hbase-site.xml";
+	// // Configuration configuration = new Configuration();
+	// // configuration.addResource(new
+	// // FileInputStream(System.getProperty("user.dir") + resource));
+	// // int zookeeper_sessionTimeout = 300000;
+	//
+	// List<String> qrlist = new ArrayList<String>();
+	// qrlist.add("zookeeper1:2181,zookeeper2:2181,zookeeper3:2181");
+	// qrlist.add("zookeeper1,zookeeper2,zookeeper3");
+	// qrlist.add("zookeeper1");
+	// qrlist.add("zookeeper1.saga");
+	//
+	// for (String qr : qrlist) {
+	// Configuration configuration = new Configuration();
+	// configuration.set("hbase.cluster.distributed", "true");
+	// configuration.set("hbase.zookeeper.quorum", qr);
+	// ZillionAgent agent = new ZillionAgent(configuration);
+	// agent.setFull_name(qr);
+	// Constant.agents.add(agent);
+	// }
+	// // Constant.agents.add(new ZillionAgent(configuration,
+	// // "zookeeper1:2181,zookeeper2:2181,zookeeper3:2181",
+	// // zookeeper_sessionTimeout));
+	// // Constant.agents
+	// // .add(new ZillionAgent(configuration,
+	// // "zookeeper1,zookeeper2,zookeeper3", zookeeper_sessionTimeout));
+	// // Constant.agents.add(new ZillionAgent(configuration, "zookeeper1",
+	// // zookeeper_sessionTimeout));
+	// // Constant.agents.add(new ZillionAgent(configuration,
+	// // "zookeeper1.saga", zookeeper_sessionTimeout));
+	//
+	// Iterator<ZillionAgent> it = Constant.agents.iterator();
+	// while (it.hasNext()) {
+	// ZillionAgent agent = it.next();
+	// try {
+	// agent.Start();
+	// LogUtil.info(agent.getFull_name() + " starting ...");
+	// } catch (Exception e) {
+	// // TODO Auto-generated catch block
+	// // agent启动失败则移除,以免造成资源浪费
+	// LogUtil.warn(agent.getFull_name() + " failed to start ,now remove !");
+	// it.remove();
+	// LogUtil.error("Main.init.agentsStart: " + e.toString());
+	// }
+	// }
+	// } catch (Exception e) {
+	// // TODO Auto-generated catch block
+	// LogUtil.error("Main.init.agentsStart: " + e.toString());
+	// }
+	// }
 	// private static void threadStart() {
 	// // TODO Auto-generated method stub
 	// // 点位状态监控

+ 67 - 77
collect/src/main/java/com/saga/thread/common/CheckThread.java

@@ -10,14 +10,14 @@ import java.util.Map.Entry;
 
 import org.zillion.util.log.LogUtil;
 
+import com.saga.entity.Server;
 import com.saga.util.Constant;
-import com.saga.util.HBaseUtil;
-import com.zillion.database.agent.ZillionAgent;
 
 public class CheckThread extends Thread {
 	// ZillionAgent agent;
 	long realCheck = 0;
-	private String ip = null;
+	private Server server;
+	// private String ip = null;
 	// private Map<String, String> nodeStatus = new HashMap<String, String>();
 	private Map<String, String> pointStatus = new HashMap<String, String>();
 	private Map<String, String> meterStatus = new HashMap<String, String>();
@@ -27,11 +27,9 @@ public class CheckThread extends Thread {
 	public CheckThread() {
 		try {
 			// this.agent = agent;
-			this.ip = Constant.getLocalHostLANAddress().getHostAddress() + ":" + Constant.TypePort.get("Down");
-
+			server = Constant.TypeServer.get("Down");
 		} catch (Exception e) {
 			// TODO Auto-generated catch block
-			this.ip = "0.0.0.0" + ":" + Constant.TypePort.get("Down");
 			e.printStackTrace();
 			LogUtil.error("CheckThread.Exception: " + e.toString());
 			System.exit(0);
@@ -61,28 +59,21 @@ public class CheckThread extends Thread {
 
 	private void loadDBStatus() {
 		// TODO Auto-generated method stub
+		try {
+			this.physicalStatus.putAll(Constant.ps_physical_status(Constant.Database, "ps_physical_status"));
+			this.meterStatus.putAll(Constant.ps_virtual_meter_status(Constant.Database, "ps_virtual_meter_status"));
+			this.pointStatus.putAll(Constant.ps_virtual_point_status(Constant.Database, "ps_virtual_point_status"));
+			this.projectStatus
+					.putAll(Constant.ps_virtual_project_status(Constant.Database, "ps_virtual_project_status"));
 
-		for (ZillionAgent agent : Constant.agents) {
-			for (Entry<String, String> bd : Constant.BuildingDB.entrySet()) {
-				try {
-					String project = bd.getKey();
-					String db = bd.getValue();
-					this.physicalStatus.putAll(HBaseUtil.ps_physical_status(agent, db, "ps_physical_status", project));
-					this.meterStatus
-							.putAll(HBaseUtil.ps_virtual_meter_status(agent, db, "ps_virtual_meter_status", project));
-					this.pointStatus
-							.putAll(HBaseUtil.ps_virtual_point_status(agent, db, "ps_virtual_point_status", project));
-					this.projectStatus.putAll(
-							HBaseUtil.ps_virtual_project_status(agent, db, "ps_virtual_project_status", project));
-
-				} catch (Exception e) {
-					// TODO Auto-generated catch block
-					e.printStackTrace();
-					LogUtil.error("CheckThread.loadDBStatus: " + e.toString());
-				}
-			}
-			return;
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+			LogUtil.error("CheckThread.loadDBStatus: " + e.toString());
 		}
+
+		return;
+
 	}
 
 	private void excuteDBStatus() {
@@ -97,7 +88,7 @@ public class CheckThread extends Thread {
 		// }
 		for (Entry<String, Long> ppsu : Constant.ps_PointStatusUp.entrySet()) {
 			if (ppsu.getValue() != null) {
-				if (System.currentTimeMillis() - ppsu.getValue() < Constant.Millisecond.MINUTE_15) {
+				if (System.currentTimeMillis() - ppsu.getValue() < Constant.Disconnect) {
 					this.pointStatus.put(ppsu.getKey(), "conn");
 				} else {
 					this.pointStatus.put(ppsu.getKey(), "disconn");
@@ -110,7 +101,7 @@ public class CheckThread extends Thread {
 		for (Entry<String, Long> pps : Constant.ps_PhysicalStatus.entrySet()) {
 			// if (!pps.getKey().endsWith(";;;")) {
 			if (pps.getValue() != null) {
-				if (System.currentTimeMillis() - pps.getValue() < Constant.Millisecond.MINUTE_15) {
+				if (System.currentTimeMillis() - pps.getValue() < Constant.Disconnect) {
 					this.physicalStatus.put(pps.getKey(), "conn");
 				} else {
 					this.physicalStatus.put(pps.getKey(), "disconn");
@@ -123,7 +114,7 @@ public class CheckThread extends Thread {
 		}
 		for (Entry<String, Long> pps : Constant.ps_ProjectStatus.entrySet()) {
 			if (pps.getValue() != null) {
-				if (System.currentTimeMillis() - pps.getValue() < Constant.Millisecond.MINUTE_15) {
+				if (System.currentTimeMillis() - pps.getValue() < Constant.Disconnect) {
 					this.projectStatus.put(pps.getKey(), "conn");
 				} else {
 					this.projectStatus.put(pps.getKey(), "disconn");
@@ -135,7 +126,7 @@ public class CheckThread extends Thread {
 		}
 		for (Entry<String, Long> pmsu : Constant.ps_MeterStatusUp.entrySet()) {
 			if (pmsu.getValue() != null) {
-				if (System.currentTimeMillis() - pmsu.getValue() < Constant.Millisecond.MINUTE_15) {
+				if (System.currentTimeMillis() - pmsu.getValue() < Constant.Disconnect) {
 					this.meterStatus.put(pmsu.getKey(), "conn");
 				} else {
 					this.meterStatus.put(pmsu.getKey(), "disconn");
@@ -177,18 +168,18 @@ public class CheckThread extends Thread {
 				String status = this.gatherStatus(plist);
 				try {
 					if ("conn".equalsIgnoreCase(status)) {
-						Constant.Insert_agents_ps_virtual_project_status(project, status, Constant.format(new Date()),
-								"");
+						Constant.Insert_ps_virtual_project_status(Constant.Database, project, status,
+								Constant.format(new Date()), "");
 					}
-
 					if (
 					// 首次
 					!this.projectStatus.containsKey(project) || null == this.projectStatus.get(project) ||
 					// 已有记录且状态发生变化
 							!status.equalsIgnoreCase(this.projectStatus.get(project))) {
-						Constant.Insert_agents_ps_virtual_project_log(project, Constant.format(new Date()), status);
+						Constant.Insert_ps_virtual_project_log(Constant.Database, project, Constant.format(new Date()),
+								status);
 						if ("disconn".equalsIgnoreCase(status)) {
-							Constant.Insert_agents_ps_virtual_project_status(project, status,
+							Constant.Insert_ps_virtual_project_status(Constant.Database, project, status,
 									Constant.format(new Date()), "");
 						}
 					}
@@ -213,19 +204,18 @@ public class CheckThread extends Thread {
 				String meter = ml[1];
 				try {
 					if ("conn".equalsIgnoreCase(status)) {
-						Constant.Insert_agents_ps_virtual_meter_status(project, meter, "up", status,
+						Constant.Insert_ps_virtual_meter_status(Constant.Database, project, meter, "up", status,
 								Constant.format(new Date()), "");
 					}
-
 					if (
 					// 首次
 					!this.meterStatus.containsKey(pm) || null == this.meterStatus.get(pm) ||
 					// 已有记录且状态发生变化
 							!status.equalsIgnoreCase(this.meterStatus.get(pm))) {
-						Constant.Insert_agents_ps_virtual_meter_log(project, meter, "up", Constant.format(new Date()),
-								status);
+						Constant.Insert_ps_virtual_meter_log(Constant.Database, project, meter, "up",
+								Constant.format(new Date()), status);
 						if ("disconn".equalsIgnoreCase(status)) {
-							Constant.Insert_agents_ps_virtual_meter_status(project, meter, "up", status,
+							Constant.Insert_ps_virtual_meter_status(Constant.Database, project, meter, "up", status,
 									Constant.format(new Date()), "");
 						}
 					}
@@ -267,21 +257,19 @@ public class CheckThread extends Thread {
 				}
 				try {
 					if ("conn".equalsIgnoreCase(status)) {
-						Constant.Insert_agents_ps_physical_status(project, address_1, address_2, address_3, address_4,
-								status, Constant.format(new Date()), "");
+						Constant.Insert_ps_physical_status(Constant.Database, project, address_1, address_2, address_3,
+								address_4, status, Constant.format(new Date()), "");
 					}
-
 					if (
 					// 首次
 					!this.physicalStatus.containsKey(physical) || null == this.physicalStatus.get(physical) ||
 					// 已有记录且状态发生变化
 							!status.equalsIgnoreCase(this.physicalStatus.get(physical))) {
-						Constant.Insert_agents_ps_physical_log(project, address_1, address_2, address_3, address_4,
-								Constant.format(new Date()), status);
-
+						Constant.Insert_ps_physical_log(Constant.Database, project, address_1, address_2, address_3,
+								address_4, Constant.format(new Date()), status);
 						if ("disconn".equalsIgnoreCase(status)) {
-							Constant.Insert_agents_ps_physical_status(project, address_1, address_2, address_3,
-									address_4, status, Constant.format(new Date()), "");
+							Constant.Insert_ps_physical_status(Constant.Database, project, address_1, address_2,
+									address_3, address_4, status, Constant.format(new Date()), "");
 						}
 					}
 				} catch (Exception e) {
@@ -291,7 +279,6 @@ public class CheckThread extends Thread {
 				this.physicalStatus.put(physical, status);
 			}
 		}
-
 	}
 
 	private String gatherStatus(List<String> l) {
@@ -346,8 +333,8 @@ public class CheckThread extends Thread {
 									// Constant.format(new
 									// Date(Constant.id2time.get(n.getKey()))),
 									// Constant.id2status.get(n.getKey()));
-									ps.add(Constant.BuildingDB.get(building) + ";" + building + ";" + this.ip + ";"
-											+ mac + ";" + meter + ";" + funcid + ";" + "down" + ";" + "conn" + ";"
+									ps.add(Constant.Database + ";" + building + ";" + this.server.IP + ";" + mac + ";"
+											+ meter + ";" + funcid + ";" + "down" + ";" + "conn" + ";"
 											+ Constant.format(new Date(Constant.ps_ID2Time.get(n.getKey()))) + ";"
 											+ Constant.ps_ID2Status.get(n.getKey()));
 								} else {
@@ -361,8 +348,8 @@ public class CheckThread extends Thread {
 									// Constant.format(new
 									// Date(Constant.id2time.get(n.getKey()))),
 									// Constant.id2status.get(n.getKey()));
-									ps.add(Constant.BuildingDB.get(building) + ";" + building + ";" + this.ip + ";"
-											+ mac + ";" + meter + ";" + funcid + ";" + "down" + ";" + "disconn" + ";"
+									ps.add(Constant.Database + ";" + building + ";" + this.server.IP + ";" + mac + ";"
+											+ meter + ";" + funcid + ";" + "down" + ";" + "disconn" + ";"
 											+ Constant.format(new Date(Constant.ps_ID2Time.get(n.getKey()))) + ";"
 											+ Constant.ps_ID2Status.get(n.getKey()));
 								}
@@ -406,16 +393,13 @@ public class CheckThread extends Thread {
 			nk = new ArrayList<String>();
 			for (String s : ps) {
 				String[] a = s.split(";");
+				String time = a[8];
 
-				Constant.Insert_agents_ps_virtual_point_status(a[1], a[4], Long.valueOf(a[5]), a[6], a[7],
-						Constant.parse(a[8]).getTime(), a[9]);
-				// HBaseUtil.Insert_ps_virtual_point_status(Constant.agent,
-				// a[0], a[1], a[4], Long.valueOf(a[5]), a[6],
-				// a[7], a[8], a[9]);
+				Constant.Insert_ps_virtual_point_status(Constant.Database, a[1], a[4], Long.valueOf(a[5]), a[6], a[7],
+						time, a[9]);
 				Thread.sleep(1L);
 			}
 			ps = new ArrayList<String>();
-
 		} catch (Exception e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
@@ -457,7 +441,7 @@ public class CheckThread extends Thread {
 				String status = "";
 
 				if (pointUp.getValue() != null) {
-					if (this.realCheck - pointUp.getValue() < Constant.Millisecond.MINUTE_15) {
+					if (this.realCheck - pointUp.getValue() < Constant.Disconnect) {
 						status = "conn";
 					} else {
 						status = "disconn";
@@ -465,14 +449,14 @@ public class CheckThread extends Thread {
 				} else {
 					// 首次
 					status = "disconn";
-
 				}
 				if ("conn".equalsIgnoreCase(status)) {
 					// this.Insert_ps_virtual_point_status(building, meter,
 					// Long.valueOf(funcid), "up", status,
 					// pointUp.getValue(), "");
-					Constant.Insert_agents_ps_virtual_point_status(building, meter, Long.valueOf(funcid), "up", status,
-							(pointUp.getValue()), "");
+					long time = pointUp.getValue() == null ? System.currentTimeMillis() : pointUp.getValue();
+					Constant.Insert_ps_virtual_point_status(Constant.Database, building, meter, Long.valueOf(funcid),
+							"up", status, Constant.format(new Date(time)), "");
 				}
 
 				if (
@@ -483,14 +467,16 @@ public class CheckThread extends Thread {
 					// this.Insert_ps_virtual_point_log(building, meter,
 					// Long.valueOf(funcid), "up",
 					// System.currentTimeMillis(), 0l, status, "");
-					Constant.Insert_agents_ps_virtual_point_log(building, meter, Long.valueOf(funcid), "up",
-							System.currentTimeMillis(), 0l, status, "");
+
+					Constant.Insert_ps_virtual_point_log(Constant.Database, building, meter, Long.valueOf(funcid), "up",
+							Constant.format(new Date()), 0l, status, "");
 					if ("disconn".equalsIgnoreCase(status)) {
 						// this.Insert_ps_virtual_point_status(building, meter,
 						// Long.valueOf(funcid), "up", status,
 						// pointUp.getValue(), "");
-						Constant.Insert_agents_ps_virtual_point_status(building, meter, Long.valueOf(funcid), "up",
-								status, pointUp.getValue(), "");
+						long time = pointUp.getValue() == null ? System.currentTimeMillis() : pointUp.getValue();
+						Constant.Insert_ps_virtual_point_status(Constant.Database, building, meter,
+								Long.valueOf(funcid), "up", status, Constant.format(new Date(time)), "");
 					}
 				} else if (
 				// 已有记录且状态发生变化
@@ -504,25 +490,28 @@ public class CheckThread extends Thread {
 							// pointUp.getValue(),
 							// Long.valueOf(Constant.RecordList.get(address).seq),
 							// status, "");
-							Constant.Insert_agents_ps_virtual_point_log(building, meter, Long.valueOf(funcid), "up",
-									pointUp.getValue(), Long.valueOf(Constant.RecordList.get(address).seq), status, "");
+							long time = pointUp.getValue() == null ? System.currentTimeMillis() : pointUp.getValue();
+							Constant.Insert_ps_virtual_point_log(Constant.Database, building, meter,
+									Long.valueOf(funcid), "up", Constant.format(new Date(time)),
+									Long.valueOf(Constant.RecordList.get(address).seq), status, "");
 							if ("disconn".equalsIgnoreCase(status)) {
 								// this.Insert_ps_virtual_point_status(building,
 								// meter, Long.valueOf(funcid), "up", status,
 								// pointUp.getValue(), "");
-								Constant.Insert_agents_ps_virtual_point_status(building, meter, Long.valueOf(funcid),
-										"up", status, pointUp.getValue(), "");
+								Constant.Insert_ps_virtual_point_status(Constant.Database, building, meter,
+										Long.valueOf(funcid), "up", status, Constant.format(new Date(time)), "");
 							}
 						}
 					} else {
-						Constant.Insert_agents_ps_virtual_point_log(building, meter, Long.valueOf(funcid), "up",
-								pointUp.getValue(), 0l, status, "");
+						long time = pointUp.getValue() == null ? System.currentTimeMillis() : pointUp.getValue();
+						Constant.Insert_ps_virtual_point_log(Constant.Database, building, meter, Long.valueOf(funcid),
+								"up", Constant.format(new Date(time)), 0l, status, "");
 						if ("disconn".equalsIgnoreCase(status)) {
 							// this.Insert_ps_virtual_point_status(building,
 							// meter, Long.valueOf(funcid), "up", status,
 							// pointUp.getValue(), "");
-							Constant.Insert_agents_ps_virtual_point_status(building, meter, Long.valueOf(funcid), "up",
-									status, pointUp.getValue(), "");
+							Constant.Insert_ps_virtual_point_status(Constant.Database, building, meter,
+									Long.valueOf(funcid), "up", status, Constant.format(new Date(time)), "");
 						}
 					}
 				}
@@ -530,8 +519,9 @@ public class CheckThread extends Thread {
 				this.pointStatus.put(pointUp.getKey(), status);
 			} catch (Exception e) {
 				// TODO Auto-generated catch block
-				e.printStackTrace();
-				LogUtil.error("CheckThread.virtual_point_status_up_Check.Exception:" + e.toString());
+				// e.printStackTrace();
+				// LogUtil.error("CheckThread.virtual_point_status_up_Check.Exception:"
+				// + e.toString());
 			}
 		}
 	}

+ 487 - 89
collect/src/main/java/com/saga/thread/common/LoadConfigThread.java

@@ -1,27 +1,24 @@
 package com.saga.thread.common;
 
-import java.io.FileReader;
+import java.io.File;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.Map.Entry;
 
 import org.zillion.util.log.LogUtil;
 
-import com.google.gson.JsonArray;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
+import com.saga.entity.EntityHbase;
+import com.saga.entity.EntityMysql;
+import com.saga.entity.Server;
 import com.saga.util.Constant;
-import com.saga.util.HBaseUtil;
-import com.zillion.database.agent.ZillionAgent;
+import com.saga.util.ExcelUtil;
 
 public class LoadConfigThread extends Thread {
-	// ZillionAgent agent;
 
 	public LoadConfigThread() {
 		try {
-			// this.agent = Constant.agent;
-
 		} catch (Exception e) {
 			// TODO Auto-generated catch block
 			LogUtil.error("LoadConfigThread.Exception: " + e.toString());
@@ -31,26 +28,21 @@ public class LoadConfigThread extends Thread {
 
 	public void run() {
 		LogUtil.info("LoadConfigThread" + this.getName() + " Starting ...");
-		try {
-			Thread.sleep(Constant.Millisecond.MINUTE_3);
-			while (true) {
-				try {
-					// 加载config配置文件
-					this.loadConfig();
-					// 加载DB点位列表
-					this.loadPointList2();
-					// 加载采集器配置文件
-					// this.loadCJQ();
-					Thread.sleep(Constant.Millisecond.MINUTE_5);
-
-				} catch (Exception e) {
-					// TODO Auto-generated catch block
-					LogUtil.error("LoadConfigThread.run.Exception: " + e.toString());
-				}
+		while (true) {
+			try {
+				// 加载config配置文件
+				// this.loadJsonConfig();
+				loadExcelConfig();
+				// 加载DB点位列表
+				this.loadPointList2();
+				// 加载采集器配置文件
+				// this.loadCJQ();
+				Thread.sleep(Constant.Millisecond.MINUTE_5);
+
+			} catch (Exception e) {
+				// TODO Auto-generated catch block
+				LogUtil.error("LoadConfigThread.run.Exception: " + e.toString());
 			}
-		} catch (InterruptedException e1) {
-			// TODO Auto-generated catch block
-			e1.printStackTrace();
 		}
 	}
 
@@ -73,19 +65,12 @@ public class LoadConfigThread extends Thread {
 			// Constant.ps_MeterList.clear();
 		}
 		LogUtil.info("Clear Project Point List" + " End...");
-		for (ZillionAgent agent : Constant.agents) {
-			for (Entry<String, String> bd : Constant.BuildingDB.entrySet()) {
-				try {
-					String project = bd.getKey();
-					String db = bd.getValue();
-					HBaseUtil.LoadDB2Cache_dy_pointlist(agent, db, "dy_pointlist", project);
-
-				} catch (Exception e) {
-					// TODO Auto-generated catch block
-					e.printStackTrace();
-					LogUtil.error("LoadConfigThread.loadPointList2: " + e.toString());
-				}
-			}
+		try {
+			Constant.LoadDB2Cache_dy_pointlist(Constant.Database, "dy_pointlist");
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+			LogUtil.error("LoadConfigThread.loadPointList2: " + e.toString());
 		}
 	}
 
@@ -122,69 +107,482 @@ public class LoadConfigThread extends Thread {
 	// }
 	// }
 
-	private void loadConfig() {
+	public static void loadExcelConfig() {
 		// TODO Auto-generated method stub
-		String resource = "/config.json";
+		String resource = "/config.xls";
 		String path = null;
-		JsonParser config = new JsonParser();
-
 		try {
 			LogUtil.info("System.get " + System.getProperty("user.dir") + resource);
 			LogUtil.info("LogUtil.get " + LogUtil.GetPath() + resource);
 			path = LogUtil.GetPath() + resource;
+			File file = new File(path);
+			if (file.exists()) {
+				excuteDbMysql(file);
+				excuteDbHbase(file);
+				excuteNetworkUp(file);
+				excuteNetworkDown(file);
+				excuteRulesGlobal(file);
+				excuteRulesBuildingConvert(file);
+				excuteRulesFuncConvert(file);
+				excuteRulesWhiteList(file);
+				excuteRulesBlackList(file);
+			}
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+	}
+
+	private static void excuteRulesBlackList(File file) {
+		// TODO Auto-generated method stub
+
+		int begin = 65535;
+		int end = 65535;
+		Map<String, Integer> pty = new HashMap<String, Integer>();
+		// Map<Integer, String> ptyValue = new HashMap<Integer, String>();
+
+		Map<Integer, Map<Integer, Map<Integer, String>>> excelData = ExcelUtil.readExcel(file);
+		for (int k = 0; k < excelData.size(); k++) {
+			Map<Integer, Map<Integer, String>> sheetData = excelData.get(k);
+			for (int i = 0; i < sheetData.size(); i++) {
+				Map<Integer, String> rowData = sheetData.get(i);
+				if ("Rules-BlackList".equalsIgnoreCase(rowData.get(0))) {
+					begin = i;
+					// Constant.info("Rules-BlackList begin: " + i);
+					for (int j = 1; j < rowData.size(); j++) {
+						pty.put(rowData.get(j), j);
+						// ptyValue.put(j, rowData.get(j));
+					}
+				} else if ((rowData.get(0).length() > 0) && !("Rules-BlackList".equalsIgnoreCase(rowData.get(0)))) {
+					begin = 65535;
+					end = 65535;
+					pty = new HashMap<String, Integer>();
+					// ptyValue = new HashMap<Integer, String>();
+					// Constant.info("Rules-BlackList end: " + i);
+				} else if (i > begin && i < end) {
+					// Constant.info("Rules-BlackList add: " + i);
+					if (rowData.get(1) == null || rowData.get(1).length() == 0) {
+						continue;
+					}
+
+					pty = Constant.toLower(pty);
+					String building = rowData.get(pty.get("building"));
+
+					Constant.black_Buildings.put(building, null);
+				}
+			}
+		}
+	}
+
+	private static void excuteRulesWhiteList(File file) {
+		// TODO Auto-generated method stub
 
-			JsonObject object = (JsonObject) config.parse(new FileReader(path));
-
-			JsonArray db = object.get("DB").getAsJsonArray();
-			for (int i = 0; i < db.size(); i++) {
-				JsonObject subObject = db.get(i).getAsJsonObject();
-				if (subObject.get("building") != null) {
-					String building = subObject.get("building").getAsString();
-					// if(Constant.BuildingDB.containsKey(building)){
-					// continue;
-					// }
-					Constant.BuildingDB.put(building, subObject.get("database").getAsString());
-
-					if (subObject.get("buildingadds") != null) {
-						JsonArray buildingAdds = subObject.get("buildingadds").getAsJsonArray();
-						for (int j = 0; j < buildingAdds.size(); j++) {
-							JsonObject addObject = buildingAdds.get(j).getAsJsonObject();
-							String builing_new = addObject.get("building").getAsString();
-							if (!Constant.BuildingAdds.containsKey(building)) {
-								Constant.BuildingAdds.put(building, new ArrayList<String>());
-							}
-							if (!exist(builing_new)) {
-								Constant.BuildingAdds.get(building).add(builing_new);
-								Constant.BuildingConv.put(builing_new, building);
-							}
-						}
-
-					}
-				} else if (subObject.get("insertthread") != null) {
-					Constant.InsertThread = subObject.get("insertthread").getAsInt();
+		int begin = 65535;
+		int end = 65535;
+		Map<String, Integer> pty = new HashMap<String, Integer>();
+		// Map<Integer, String> ptyValue = new HashMap<Integer, String>();
+
+		Map<Integer, Map<Integer, Map<Integer, String>>> excelData = ExcelUtil.readExcel(file);
+		for (int k = 0; k < excelData.size(); k++) {
+			Map<Integer, Map<Integer, String>> sheetData = excelData.get(k);
+			for (int i = 0; i < sheetData.size(); i++) {
+				Map<Integer, String> rowData = sheetData.get(i);
+				if ("Rules-WhiteList".equalsIgnoreCase(rowData.get(0))) {
+					begin = i;
+					// Constant.info("Rules-WhiteList begin: " + i);
+					for (int j = 1; j < rowData.size(); j++) {
+						pty.put(rowData.get(j), j);
+						// ptyValue.put(j, rowData.get(j));
+					}
+				} else if ((rowData.get(0).length() > 0) && !("Rules-WhiteList".equalsIgnoreCase(rowData.get(0)))) {
+					begin = 65535;
+					end = 65535;
+					pty = new HashMap<String, Integer>();
+					// ptyValue = new HashMap<Integer, String>();
+					// Constant.info("Rules-WhiteList end: " + i);
+				} else if (i > begin && i < end) {
+					// Constant.info("Rules-WhiteList add: " + i);
+					if (rowData.get(1) == null || rowData.get(1).length() == 0) {
+						continue;
+					}
+
+					pty = Constant.toLower(pty);
+					String funcid = rowData.get(pty.get("funcid"));
+
+					Constant.whilte_Funcs.put(Integer.valueOf(funcid), null);
+				}
+			}
+		}
+	}
+
+	private static void excuteRulesFuncConvert(File file) {
+		// TODO Auto-generated method stub
+
+		int begin = 65535;
+		int end = 65535;
+		Map<String, Integer> pty = new HashMap<String, Integer>();
+		// Map<Integer, String> ptyValue = new HashMap<Integer, String>();
+
+		Map<Integer, Map<Integer, Map<Integer, String>>> excelData = ExcelUtil.readExcel(file);
+		for (int k = 0; k < excelData.size(); k++) {
+			Map<Integer, Map<Integer, String>> sheetData = excelData.get(k);
+			for (int i = 0; i < sheetData.size(); i++) {
+				Map<Integer, String> rowData = sheetData.get(i);
+				if ("Rules-FuncConvert".equalsIgnoreCase(rowData.get(0))) {
+					begin = i;
+					// Constant.info("Rules-FuncConvert begin: " + i);
+					for (int j = 1; j < rowData.size(); j++) {
+						pty.put(rowData.get(j), j);
+						// ptyValue.put(j, rowData.get(j));
+					}
+				} else if ((rowData.get(0).length() > 0) && !("Rules-FuncConvert".equalsIgnoreCase(rowData.get(0)))) {
+					begin = 65535;
+					end = 65535;
+					pty = new HashMap<String, Integer>();
+					// ptyValue = new HashMap<Integer, String>();
+					// Constant.info("Rules-FuncConvert end: " + i);
+				} else if (i > begin && i < end) {
+					// Constant.info("Rules-FuncConvert add: " + i);
+					if (rowData.get(1) == null || rowData.get(1).length() == 0) {
+						continue;
+					}
+
+					pty = Constant.toLower(pty);
+					String buildingOld = rowData.get(pty.get("building"));
+					String funcidOld = rowData.get(pty.get("oldfuncid"));
+					String funcidNew = rowData.get(pty.get("newfuncid"));
+
+					Constant.FunctionConv.put(buildingOld + "-" + funcidOld, funcidNew);
+					Constant.FunctionConvReverse.put(buildingOld + "-" + funcidNew, funcidOld);
 				}
 			}
-			JsonArray port = object.get("Port").getAsJsonArray();
-			for (int i = 0; i < port.size(); i++) {
-				JsonObject subObject = port.get(i).getAsJsonObject();
-				Constant.TypePort.put(subObject.get("type").getAsString(), subObject.get("port").getAsString());
-				Constant.PortCompress.put(Integer.valueOf(subObject.get("port").getAsString()),
-						subObject.get("Compress").getAsString());
-				Constant.PortHistory.put(Integer.valueOf(subObject.get("port").getAsString()),
-						subObject.get("History").getAsString());
+		}
+	}
+
+	private static void excuteRulesBuildingConvert(File file) {
+		// TODO Auto-generated method stub
+
+		int begin = 65535;
+		int end = 65535;
+		Map<String, Integer> pty = new HashMap<String, Integer>();
+		// Map<Integer, String> ptyValue = new HashMap<Integer, String>();
+
+		Map<Integer, Map<Integer, Map<Integer, String>>> excelData = ExcelUtil.readExcel(file);
+		for (int k = 0; k < excelData.size(); k++) {
+			Map<Integer, Map<Integer, String>> sheetData = excelData.get(k);
+			for (int i = 0; i < sheetData.size(); i++) {
+				Map<Integer, String> rowData = sheetData.get(i);
+				if ("Rules-BuildingConvert".equalsIgnoreCase(rowData.get(0))) {
+					begin = i;
+					// Constant.info("Rules-BuildingConvert begin: " + i);
+					for (int j = 1; j < rowData.size(); j++) {
+						pty.put(rowData.get(j), j);
+						// ptyValue.put(j, rowData.get(j));
+					}
+				} else if ((rowData.get(0).length() > 0)
+						&& !("Rules-BuildingConvert".equalsIgnoreCase(rowData.get(0)))) {
+					begin = 65535;
+					end = 65535;
+					pty = new HashMap<String, Integer>();
+					// ptyValue = new HashMap<Integer, String>();
+					// Constant.info("Rules-BuildingConvert end: " + i);
+				} else if (i > begin && i < end) {
+					// Constant.info("Rules-BuildingConvert add: " + i);
+					if (rowData.get(1) == null || rowData.get(1).length() == 0) {
+						continue;
+					}
+					pty = Constant.toLower(pty);
+					String buildingOld = rowData.get(pty.get("oldbuilding"));
+					String buildingNew = rowData.get(pty.get("newbuilding"));
+					String timeOffset = rowData.get(pty.get("timeoffset"));
+					if (!Constant.BuildingAdds.containsKey(buildingOld)) {
+						Constant.BuildingAdds.put(buildingOld, new ArrayList<String>());
+					}
+					Constant.BuildingAdds.get(buildingOld).add(buildingNew);
+					Constant.BuildingConv.put(buildingNew, buildingOld);
+					Constant.BuildingOffset.put(buildingOld, Boolean.getBoolean(timeOffset));
+				}
 			}
+		}
+	}
 
-		} catch (Exception e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
+	private static void excuteRulesGlobal(File file) {
+		// TODO Auto-generated method stub
+		int begin = 65535;
+		int end = 65535;
+		Map<String, Integer> pty = new HashMap<String, Integer>();
+		// Map<Integer, String> ptyValue = new HashMap<Integer, String>();
+
+		Map<Integer, Map<Integer, Map<Integer, String>>> excelData = ExcelUtil.readExcel(file);
+		for (int k = 0; k < excelData.size(); k++) {
+			Map<Integer, Map<Integer, String>> sheetData = excelData.get(k);
+			for (int i = 0; i < sheetData.size(); i++) {
+				Map<Integer, String> rowData = sheetData.get(i);
+				if ("Rules-Global".equalsIgnoreCase(rowData.get(0))) {
+					begin = i;
+					// Constant.info("Rules-Global begin: " + i);
+					for (int j = 1; j < rowData.size(); j++) {
+						pty.put(rowData.get(j), j);
+						// ptyValue.put(j, rowData.get(j));
+					}
+				} else if ((rowData.get(0).length() > 0) && !("Rules-Global".equalsIgnoreCase(rowData.get(0)))) {
+					begin = 65535;
+					end = 65535;
+					pty = new HashMap<String, Integer>();
+					// ptyValue = new HashMap<Integer, String>();
+					// Constant.info("Rules-Global end: " + i);
+				} else if (i > begin && i < end) {
+					// Constant.info("Rules-Global add: " + i);
+					if (rowData.get(1) == null || rowData.get(1).length() == 0) {
+						continue;
+					}
+					pty = Constant.toLower(pty);
+
+					Constant.Disconnect = Constant.getMillisecond(rowData.get(pty.get("disconnect")));
+					Constant.Database = rowData.get(pty.get("database"));
+					Constant.InsertThread = Integer.valueOf(rowData.get(pty.get("insertthread")));
+					for (String upload : rowData.get(pty.get("uploadtable")).split(",")) {
+						Constant.uploadList.add(upload);
+					}
+				}
+			}
+		}
+	}
+
+	private static void excuteNetworkDown(File file) {
+		// TODO Auto-generated method stub
+		int begin = 65535;
+		int end = 65535;
+
+		Map<String, Integer> pty = new HashMap<String, Integer>();
+		// Map<Integer, String> ptyValue = new HashMap<Integer, String>();
+		Map<Integer, Map<Integer, Map<Integer, String>>> excelData = ExcelUtil.readExcel(file);
+		for (int k = 0; k < excelData.size(); k++) {
+			Map<Integer, Map<Integer, String>> sheetData = excelData.get(k);
+			for (int i = 0; i < sheetData.size(); i++) {
+				Map<Integer, String> rowData = sheetData.get(i);
+				if ("Network-Down".equalsIgnoreCase(rowData.get(0))) {
+					begin = i;
+					// Constant.info("Network-Down begin: " + i);
+					for (int j = 1; j < rowData.size(); j++) {
+						pty.put(rowData.get(j), j);
+						// ptyValue.put(j, rowData.get(j));
+					}
+				} else if ((rowData.get(0).length() > 0) && !("Network-Down".equalsIgnoreCase(rowData.get(0)))) {
+					begin = 65535;
+					end = 65535;
+					pty = new HashMap<String, Integer>();
+					// ptyValue = new HashMap<Integer, String>();
+					// Constant.info("Network-Down end: " + i);
+				} else if (i > begin && i < end) {
+					// Constant.info("Network-Down add: " + i);
+					if (rowData.get(1) == null || rowData.get(1).length() == 0) {
+						continue;
+					}
+					pty = Constant.toLower(pty);
+					Server server = new Server();
+					server.IP = rowData.get(pty.get("ip"));
+					server.Port = Integer.valueOf(rowData.get(pty.get("port")));
+					server.compress = Boolean.getBoolean(rowData.get(pty.get("compress")));
+
+					Constant.TypeServer.put("Down", server);
+				}
+			}
+		}
+	}
+
+	private static void excuteNetworkUp(File file) {
+		// TODO Auto-generated method stub
+
+		int begin = 65535;
+		int end = 65535;
+		Map<String, Integer> pty = new HashMap<String, Integer>();
+		// Map<Integer, String> ptyValue = new HashMap<Integer, String>();
+		Map<Integer, Map<Integer, Map<Integer, String>>> excelData = ExcelUtil.readExcel(file);
+		for (int k = 0; k < excelData.size(); k++) {
+			Map<Integer, Map<Integer, String>> sheetData = excelData.get(k);
+			for (int i = 0; i < sheetData.size(); i++) {
+				Map<Integer, String> rowData = sheetData.get(i);
+				if ("Network-Up".equalsIgnoreCase(rowData.get(0))) {
+					begin = i;
+					// Constant.info("Network-Up begin: " + i);
+					for (int j = 1; j < rowData.size(); j++) {
+						pty.put(rowData.get(j), j);
+						// ptyValue.put(j, rowData.get(j));
+					}
+				} else if ((rowData.get(0).length() > 0) && !("Network-Up".equalsIgnoreCase(rowData.get(0)))) {
+					begin = 65535;
+					end = 65535;
+					pty = new HashMap<String, Integer>();
+					// ptyValue = new HashMap<Integer, String>();
+					// Constant.info("Network-Up end: " + i);
+				} else if (i > begin && i < end) {
+					// Constant.info("Network-Up add: " + i);
+					if (rowData.get(1) == null || rowData.get(1).length() == 0) {
+						continue;
+					}
+					pty = Constant.toLower(pty);
+					Server server = new Server();
+					server.IP = rowData.get(pty.get("ip"));
+					server.Port = Integer.valueOf(rowData.get(pty.get("port")));
+					server.compress = Boolean.getBoolean(rowData.get(pty.get("compress")));
+
+					Constant.TypeServer.put("Up", server);
+				}
+			}
+		}
+	}
+
+	private static void excuteDbHbase(File file) {
+		// TODO Auto-generated method stub
+
+		int begin = 65535;
+		int end = 65535;
+		Map<String, Integer> pty = new HashMap<String, Integer>();
+		// Map<Integer, String> ptyValue = new HashMap<Integer, String>();
+
+		Map<Integer, Map<Integer, Map<Integer, String>>> excelData = ExcelUtil.readExcel(file);
+		for (int k = 0; k < excelData.size(); k++) {
+			Map<Integer, Map<Integer, String>> sheetData = excelData.get(k);
+			for (int i = 0; i < sheetData.size(); i++) {
+				Map<Integer, String> rowData = sheetData.get(i);
+				if ("Db-Hbase".equalsIgnoreCase(rowData.get(0))) {
+					begin = i;
+					// Constant.info("Db-Hbase begin: " + i);
+					for (int j = 1; j < rowData.size(); j++) {
+						pty.put(rowData.get(j), j);
+						// ptyValue.put(j, rowData.get(j));
+					}
+				} else if ((rowData.get(0).length() > 0) && !("Db-Hbase".equalsIgnoreCase(rowData.get(0)))) {
+					begin = 65535;
+					end = 65535;
+					pty = new HashMap<String, Integer>();
+					// ptyValue = new HashMap<Integer, String>();
+					// Constant.info("Db-Hbase end: " + i);
+				} else if (i > begin && i < end) {
+					// Constant.info("Db-Hbase add: " + i);
+					if (rowData.get(1) == null || rowData.get(1).length() == 0) {
+						continue;
+					}
+					pty = Constant.toLower(pty);
+					EntityHbase entityHbase = new EntityHbase();
+					entityHbase.Address = rowData.get(pty.get("address"));
+
+					Constant.DbConnection.put("Db-Hbase", entityHbase);
+				}
+			}
 		}
 	}
 
-	private boolean exist(String builing_new) {
+	private static void excuteDbMysql(File file) {
 		// TODO Auto-generated method stub
-		if (Constant.BuildingConv.containsKey(builing_new)) {
-			return true;
+
+		int begin = 65535;
+		int end = 65535;
+		Map<String, Integer> pty = new HashMap<String, Integer>();
+		// Map<Integer, String> ptyValue = new HashMap<Integer, String>();
+
+		Map<Integer, Map<Integer, Map<Integer, String>>> excelData = ExcelUtil.readExcel(file);
+		for (int k = 0; k < excelData.size(); k++) {
+			Map<Integer, Map<Integer, String>> sheetData = excelData.get(k);
+			for (int i = 0; i < sheetData.size(); i++) {
+				Map<Integer, String> rowData = sheetData.get(i);
+				if ("Db-Mysql".equalsIgnoreCase(rowData.get(0))) {
+					begin = i;
+					// Constant.info("Db-Mysql begin: " + i);
+					for (int j = 1; j < rowData.size(); j++) {
+						pty.put(rowData.get(j), j);
+						// ptyValue.put(j, rowData.get(j));
+					}
+				} else if ((rowData.get(0).length() > 0) && !("Db-Mysql".equalsIgnoreCase(rowData.get(0)))) {
+					begin = 65535;
+					end = 65535;
+					pty = new HashMap<String, Integer>();
+					// ptyValue = new HashMap<Integer, String>();
+					// Constant.info("Db-Mysql end: " + i);
+				} else if (i > begin && i < end) {
+					// Constant.info("Db-Mysql add: " + i);
+					if (rowData.get(1) == null || rowData.get(1).length() == 0) {
+						continue;
+					}
+					pty = Constant.toLower(pty);
+					EntityMysql entityMysql = new EntityMysql();
+					entityMysql.Ip = rowData.get(pty.get("ip"));
+					entityMysql.Port = Integer.valueOf(rowData.get(pty.get("port")));
+					entityMysql.User = rowData.get(pty.get("user"));
+					entityMysql.Password = rowData.get(pty.get("password"));
+
+					Constant.DbConnection.put("Db-Mysql", entityMysql);
+				}
+			}
 		}
-		return false;
 	}
+
+	// private void loadJsonConfig() {
+	// // TODO Auto-generated method stub
+	// String resource = "/config.json";
+	// String path = null;
+	// JsonParser config = new JsonParser();
+	//
+	// try {
+	// LogUtil.info("System.get " + System.getProperty("user.dir") + resource);
+	// LogUtil.info("LogUtil.get " + LogUtil.GetPath() + resource);
+	// path = LogUtil.GetPath() + resource;
+	//
+	// JsonObject object = (JsonObject) config.parse(new FileReader(path));
+	//
+	// JsonArray db = object.get("DB").getAsJsonArray();
+	// for (int i = 0; i < db.size(); i++) {
+	// JsonObject subObject = db.get(i).getAsJsonObject();
+	// if (subObject.get("building") != null) {
+	// String building = subObject.get("building").getAsString();
+	// // if(Constant.BuildingDB.containsKey(building)){
+	// // continue;
+	// // }
+	// Constant.BuildingDB.put(building,
+	// subObject.get("database").getAsString());
+	//
+	// if (subObject.get("buildingadds") != null) {
+	// JsonArray buildingAdds = subObject.get("buildingadds").getAsJsonArray();
+	// for (int j = 0; j < buildingAdds.size(); j++) {
+	// JsonObject addObject = buildingAdds.get(j).getAsJsonObject();
+	// String builing_new = addObject.get("building").getAsString();
+	// if (!Constant.BuildingAdds.containsKey(building)) {
+	// Constant.BuildingAdds.put(building, new ArrayList<String>());
+	// }
+	// if (!exist(builing_new)) {
+	// Constant.BuildingAdds.get(building).add(builing_new);
+	// Constant.BuildingConv.put(builing_new, building);
+	// }
+	// }
+	//
+	// }
+	// } else if (subObject.get("insertthread") != null) {
+	// Constant.InsertThread = subObject.get("insertthread").getAsInt();
+	// }
+	// }
+	// JsonArray port = object.get("Port").getAsJsonArray();
+	// for (int i = 0; i < port.size(); i++) {
+	// JsonObject subObject = port.get(i).getAsJsonObject();
+	// Constant.TypePort.put(subObject.get("type").getAsString(),
+	// subObject.get("port").getAsString());
+	// Constant.PortCompress.put(Integer.valueOf(subObject.get("port").getAsString()),
+	// subObject.get("Compress").getAsString());
+	// Constant.PortHistory.put(Integer.valueOf(subObject.get("port").getAsString()),
+	// subObject.get("History").getAsString());
+	// }
+	//
+	// } catch (Exception e) {
+	// // TODO Auto-generated catch block
+	// e.printStackTrace();
+	// }
+	// }
+	//
+	// private boolean exist(String builing_new) {
+	// // TODO Auto-generated method stub
+	// if (Constant.BuildingConv.containsKey(builing_new)) {
+	// return true;
+	// }
+	// return false;
+	// }
 }

+ 2 - 1
collect/src/main/java/com/saga/thread/common/SaveThread.java

@@ -166,11 +166,12 @@ public class SaveThread extends Thread {
 											record.buildingSign = building;
 											record.meterSign = meter;
 											record.receivetime = time;
+											record.receivetime = Constant.getOffSetTime(record);
+											record.funcID = Constant.getFunctionConv(record);
 
 											if (toDB(record.buildingSign, record.funcID)) {
 												this.strecordList.add(record);
 											}
-
 										}
 										it.remove();
 										// LogUtil.info("HBase.BatchInsert "

+ 1 - 1
collect/src/main/java/com/saga/thread/common/WTDBThread.java

@@ -68,7 +68,7 @@ public class WTDBThread extends Thread {
 					}
 					// HBaseUtil.BatchInsert(Constant.agent,
 					// Constant.BuildingDB.get(b), wtdbrecordList);
-					Constant.AgentsBatchInsert(Constant.BuildingDB.get(b), wtdbrecordList);
+					Constant.BatchInsert(Constant.Database, wtdbrecordList);
 					// LogUtil.info(this.getName() + " recordList size: " +
 					// recordList.size());
 					// LogUtil.info(this.getName() + " HBaseUtil.BatchInsert

+ 60 - 92
collect/src/main/java/com/saga/thread/down/CollectThread.java

@@ -15,10 +15,11 @@ import com.persagy.communication.mina.udp.server.UDPServerManager;
 import com.persagy.communication.util.IServerManager;
 import com.saga.entity.PointSet;
 import com.saga.entity.Record;
+import com.saga.entity.Server;
 import com.saga.util.Constant;
 
-public class CollectThread extends Thread {
-	private int port = 0;
+public class DownThread extends Thread {
+	// private int port = 0;
 	// private long getPointList = 0;
 	private Map<String, Long> getPointList = new HashMap<String, Long>();
 	// private String ip = null;
@@ -26,44 +27,15 @@ public class CollectThread extends Thread {
 	// ArrayList<IServerManager>();
 	private Map<String, IServerManager> serverList = new HashMap<String, IServerManager>();
 
-	public CollectThread(int port) {
+	public DownThread(Server server) {
 		try {
-			// try {
-			// // this.ip = Constant.getLocalHostLANAddress().getHostAddress()
-			// // + ":" + Constant.TypePort.get("Down");
-			//
-			// } catch (Exception e) {
-			// // TODO Auto-generated catch block
-			// // this.ip = "0.0.0.0" + ":" + Constant.TypePort.get("Down");
-			//
-			// e.printStackTrace();
-			// }
-			this.port = port;
-			if (Constant.PortCompress == null || !Constant.PortCompress.containsKey(this.port)) {
-				this.serverList.put("UDP", new UDPServerManager("0.0.0.0", this.port, "utf-8", false, 1000));
-				this.serverList.put("TCP",
-						new TCPServerManager("0.0.0.0", this.port, "utf-8", false, 1000, (byte) '(', (byte) ')'));
-			} else {
-				if ("true".equalsIgnoreCase(Constant.PortCompress.get(this.port))) {
-					// this.serverList.put("UDP", new
-					// UDPServerManager("0.0.0.0",
-					// this.port, "utf-8", 1000));
-					this.serverList.put("UDP", new UDPServerManager("0.0.0.0", this.port, "utf-8", true, 1000));
-					this.serverList.put("TCP",
-							new TCPServerManager("0.0.0.0", this.port, "utf-8", true, 1000, (byte) '(', (byte) ')'));
-				} else {
-					// this.serverList.put("UDP", new
-					// UDPServerManager("0.0.0.0",
-					// this.port, "utf-8", 1000));
-					this.serverList.put("UDP", new UDPServerManager("0.0.0.0", this.port, "utf-8", false, 1000));
-					this.serverList.put("TCP",
-							new TCPServerManager("0.0.0.0", this.port, "utf-8", false, 1000, (byte) '(', (byte) ')'));
-				}
-			}
+			this.serverList.put("UDP", new UDPServerManager(server.IP, server.Port, "utf-8", server.compress, 1000));
+			this.serverList.put("TCP", new TCPServerManager(server.IP, server.Port, "utf-8", server.compress, 1000,
+					(byte) '(', (byte) ')'));
 
 		} catch (Exception e) {
-			LogUtil.error("CollectThread.Exception: " + e.toString());
-			LogUtil.error("CollectThread(" + port + ") failed to excute, exit!");
+			LogUtil.error("DownThread.Exception: " + e.toString());
+			LogUtil.error("DownThread(" + server.IP + ":" + server.Port + ") failed to excute, exit!");
 			System.exit(0);
 
 		}
@@ -71,9 +43,9 @@ public class CollectThread extends Thread {
 
 	public void run() {
 		for (Entry<String, IServerManager> server : this.serverList.entrySet()) {
-			LogUtil.info("CollectThread(" + this.port + "): " + server.getValue().Name() + " Created ...");
+			LogUtil.info("DownThread(" + server.getValue().Name() + "): " + " Created ...");
 			server.getValue().Start();
-			LogUtil.info("CollectThread(" + this.port + "): " + server.getValue().Name() + " Starting ...");
+			LogUtil.info("DownThread(" + server.getValue().Name() + "): " + " Starting ...");
 		}
 		while (true) {
 			try {
@@ -82,29 +54,27 @@ public class CollectThread extends Thread {
 					// // V1.0点位日志结构
 					// {
 					// // LogUtil.info(server.getKey() + " " +
-					// // "CollectThread.handlePacket begin");
+					// // "DownThread.handlePacket begin");
 					// this.handlePacket(server.getValue(), p);
 					// // LogUtil.info(server.getKey() + " " +
-					// // "CollectThread.handlePacket end");
+					// // "DownThread.handlePacket end");
 					// // LogUtil.info(server.getKey() + " " +
-					// // "CollectThread.handlePointSet begin");
+					// // "DownThread.handlePointSet begin");
 					// this.handlePointSet();
 					// // LogUtil.info(server.getKey() + " " +
-					// // "CollectThread.handlePointSet end");
+					// // "DownThread.handlePointSet end");
 					// }
 					// V2.0点位日志结构
 					{
 						this.handlePacket2(server.getValue(), p);
 						this.handlePointSet2();
-
 					}
-
 					Thread.sleep(1L);
 				}
 				// Thread.sleep(3L);
 			} catch (Exception e) {
 				// TODO Auto-generated catch block
-				LogUtil.error("CollectThread.run.Exception: " + e.toString());
+				LogUtil.error("DownThread.run.Exception: " + e.toString());
 			}
 		}
 	}
@@ -119,7 +89,7 @@ public class CollectThread extends Thread {
 					String address = null;
 					if (ps.sendTime == 0) {
 						address = Constant.Meter_Collector_Control.get(ps.buildingSign + "-" + ps.meterSign);
-						// LogUtil.info("CollectThread.handlePointSet " +
+						// LogUtil.info("DownThread.handlePointSet " +
 						// ps.buildingSign + " " + ps.meterSign + "." +
 						// ps.funcID
 						// + " " + address);
@@ -148,22 +118,21 @@ public class CollectThread extends Thread {
 									// Constant.format(new Date()),
 									// Long.valueOf(ps.ID), "senddownset",
 									// "processing:sent");
-									Constant.Insert_agents_ps_virtual_point_log(ps.buildingSignUP, ps.meterSign,
-											Long.valueOf(ps.funcID), "down", System.currentTimeMillis(),
+									Constant.Insert_ps_virtual_point_log(Constant.Database, ps.buildingSignUP,
+											ps.meterSign, Long.valueOf(ps.funcID), "down", Constant.format(new Date()),
 											Long.valueOf(ps.ID), "senddownset", "processing:sent");
-
 									server.getValue().AppendToSend(address, new Packet(cmd));
 									Constant.collectSend += cmd.length();
 									Constant.pointSetList.get(i).sendTime = System.currentTimeMillis();
 									// HBaseUtil.BatchInsert_Set1(Constant.agent,
 									// Constant.BuildingDB.get(ps.buildingSign),
 									// ps);
-									Constant.AgentsBatchInsert_Set1(Constant.BuildingDB.get(ps.buildingSign), ps);
+									Constant.BatchInsert_Set1(Constant.Database, ps);
 									LogUtil.info(server.getValue().Name() + " AppendToSend:" + address + " " + cmd);
 									break;
 								} catch (Exception e) {
 									// TODO Auto-generated catch block
-									LogUtil.error("CollectThread.handlePointSet.Exception: " + e.toString());
+									LogUtil.error("DownThread.handlePointSet.Exception: " + e.toString());
 								}
 							}
 						}
@@ -175,7 +144,7 @@ public class CollectThread extends Thread {
 			}
 		} catch (Exception e) {
 			// TODO Auto-generated catch block
-			LogUtil.error("CollectThread.handlePointSet.Exception: " + e.toString());
+			LogUtil.error("DownThread.handlePointSet.Exception: " + e.toString());
 		}
 
 	}
@@ -191,7 +160,7 @@ public class CollectThread extends Thread {
 	// if (ps.sendTime == 0) {
 	// address = Constant.Meter_Collector_Control.get(ps.buildingSign + "-" +
 	// ps.meterSign);
-	// // LogUtil.info("CollectThread.handlePointSet " +
+	// // LogUtil.info("DownThread.handlePointSet " +
 	// // ps.buildingSign + " " + ps.meterSign + "." +
 	// // ps.funcID
 	// // + " " + address);
@@ -229,7 +198,7 @@ public class CollectThread extends Thread {
 	// break;
 	// } catch (Exception e) {
 	// // TODO Auto-generated catch block
-	// LogUtil.error("CollectThread.handlePointSet.Exception: " + e.toString());
+	// LogUtil.error("DownThread.handlePointSet.Exception: " + e.toString());
 	// }
 	// }
 	// }
@@ -241,7 +210,7 @@ public class CollectThread extends Thread {
 	// }
 	// } catch (Exception e) {
 	// // TODO Auto-generated catch block
-	// LogUtil.error("CollectThread.handlePointSet.Exception: " + e.toString());
+	// LogUtil.error("DownThread.handlePointSet.Exception: " + e.toString());
 	// }
 	//
 	// }
@@ -257,10 +226,10 @@ public class CollectThread extends Thread {
 				String[] list = p.content.packetString.replace("(", "").replace(")", "").replace(" ", "").split("&");
 				// LogUtil.info("handlePacket split end...");
 				StringBuffer sb = new StringBuffer();
-				// LogUtil.info("CollectThread Challenge
+				// LogUtil.info("DownThread Challenge
 				// Constant.CollectReportList begin...");
 
-				// LogUtil.info("CollectThread Challenge
+				// LogUtil.info("DownThread Challenge
 				// Constant.CollectReportList get...");
 				for (String s : list) {
 					// LogUtil.info("handlePacket " + s);
@@ -273,10 +242,10 @@ public class CollectThread extends Thread {
 						Constant.pointMAC.put(rList[0] + "-" + rList[5], rList[1]);
 						Constant.collectCount++;
 						Constant.ps_PhysicalStatus.put(rList[0] + ";" + rList[1] + ";;;", System.currentTimeMillis());
-						// LogUtil.info("CollectThread Challenge
+						// LogUtil.info("DownThread Challenge
 						// Constant.CollectReportList begin...");
 						// synchronized (Constant.CollectReportList) {
-						// LogUtil.info("CollectThread Challenge
+						// LogUtil.info("DownThread Challenge
 						// Constant.CollectReportList get...");
 						synchronized (Constant.CollectReportList) {
 							if (Constant.BuildingAdds.containsKey(rList[0])) {
@@ -300,7 +269,7 @@ public class CollectThread extends Thread {
 							}
 						}
 						// }
-						// LogUtil.info("CollectThread Challenge
+						// LogUtil.info("DownThread Challenge
 						// Constant.CollectReportList release...");
 						// LogUtil.info("handlePacket pushData begin...");
 						this.pushData(rList);
@@ -323,10 +292,10 @@ public class CollectThread extends Thread {
 						Constant.pointMAC.put(rList[0] + "-" + rList[5], rList[1]);
 						Constant.collectCount++;
 						Constant.ps_PhysicalStatus.put(rList[0] + ";" + rList[1] + ";;;", System.currentTimeMillis());
-						// LogUtil.info("CollectThread Challenge
+						// LogUtil.info("DownThread Challenge
 						// Constant.CollectReportList begin...");
 						// synchronized (Constant.CollectReportList) {
-						// LogUtil.info("CollectThread Challenge
+						// LogUtil.info("DownThread Challenge
 						// Constant.CollectReportList get...");
 						synchronized (Constant.CollectReportList) {
 							if (Constant.BuildingAdds.containsKey(rList[0])) {
@@ -351,7 +320,7 @@ public class CollectThread extends Thread {
 						}
 
 						// }
-						// LogUtil.info("CollectThread Challenge
+						// LogUtil.info("DownThread Challenge
 						// Constant.CollectReportList release...");
 						// LogUtil.info("handlePacket pushData begin...");
 						this.pushDataAddtion(rList);
@@ -391,9 +360,9 @@ public class CollectThread extends Thread {
 						// Constant.format(new Date()),
 						// Long.valueOf(rList[4]), "senddownsetack",
 						// "processing:finish:" + rList[7]);
-						Constant.Insert_agents_ps_virtual_point_log(rList[0], rList[5], Long.valueOf(rList[6]), "down",
-								System.currentTimeMillis(), Long.valueOf(rList[4]), "senddownsetack",
-								"processing:finish:" + rList[7]);
+						Constant.Insert_ps_virtual_point_log(Constant.Database, rList[0], rList[5],
+								Long.valueOf(rList[6]), "down", Constant.format(new Date()), Long.valueOf(rList[4]),
+								"senddownsetack", "processing:finish:" + rList[7]);
 
 					} else if ("connect".equalsIgnoreCase(rList[2])) {
 						sb.append(rList[0] + ";" + rList[1] + ";" + "connectack" + ";" + Constant.format(new Date()));
@@ -521,8 +490,7 @@ public class CollectThread extends Thread {
 						// Constant.BuildingDB.get(building), "dy_pointlist",
 						// building).entrySet()) {
 						for (Entry<String, List<Integer>> mfs : Constant
-								.AgentsGetDBPointList(Constant.BuildingDB.get(building), "dy_pointlist", building)
-								.entrySet()) {
+								.GetDBPointList2Cache(Constant.Database, "dy_pointlist", building).entrySet()) {
 							StringBuffer sb1 = new StringBuffer();
 							sb1.append(building).append(";").append(rList[1]).append(";").append("getdbpointlistack")
 									.append(";").append(mfs.getKey()).append(";").append(mfs.getValue().size());
@@ -546,13 +514,13 @@ public class CollectThread extends Thread {
 							// "第三方", p.address.split(":")[0],
 							// p.address, p.address.split(":")[1], "", "",
 							// "15min", rList[6 + 2 * i], "");
-							Constant.Insert_agents_dy_pointlist(building, meter, Integer.valueOf(rList[5 + 2 * i]),
-									"其他", "第三方", p.address.split(":")[0], p.address, p.address.split(":")[1], "", "",
-									"15min", rList[6 + 2 * i], "");
+							Constant.Insert_dy_pointlist(building, meter, Integer.valueOf(rList[5 + 2 * i]), "其他",
+									"第三方", p.address.split(":")[0], p.address, p.address.split(":")[1], "", "", "15min",
+									rList[6 + 2 * i], "");
 						}
 					}
 				}
-				LogUtil.info("CollectThread Challenge Constant.CollectReportList release...");
+				LogUtil.info("DownThread Challenge Constant.CollectReportList release...");
 
 				if (sb.length() > 0) {
 					server.AppendToSend(p.address, new Packet(sb.toString()));
@@ -563,7 +531,7 @@ public class CollectThread extends Thread {
 			}
 		} catch (Exception e) {
 			// TODO Auto-generated catch block
-			LogUtil.error("CollectThread.handlePacket.Exception: " + e.toString());
+			LogUtil.error("DownThread.handlePacket.Exception: " + e.toString());
 		}
 	}
 
@@ -605,10 +573,10 @@ public class CollectThread extends Thread {
 	// "").replace(" ", "").split("&");
 	// // LogUtil.info("handlePacket split end...");
 	// StringBuffer sb = new StringBuffer();
-	// // LogUtil.info("CollectThread Challenge
+	// // LogUtil.info("DownThread Challenge
 	// // Constant.CollectReportList begin...");
 	//
-	// // LogUtil.info("CollectThread Challenge
+	// // LogUtil.info("DownThread Challenge
 	// // Constant.CollectReportList get...");
 	// for (String s : list) {
 	// // LogUtil.info("handlePacket " + s);
@@ -621,10 +589,10 @@ public class CollectThread extends Thread {
 	// Constant.collectCount++;
 	// Constant.ps_NodeStatus.put(rList[0] + "-" + rList[1],
 	// System.currentTimeMillis());
-	// // LogUtil.info("CollectThread Challenge
+	// // LogUtil.info("DownThread Challenge
 	// // Constant.CollectReportList begin...");
 	// // synchronized (Constant.CollectReportList) {
-	// // LogUtil.info("CollectThread Challenge
+	// // LogUtil.info("DownThread Challenge
 	// // Constant.CollectReportList get...");
 	// synchronized (Constant.CollectReportList) {
 	// if (Constant.BuildingAdds.containsKey(rList[0])) {
@@ -648,7 +616,7 @@ public class CollectThread extends Thread {
 	// }
 	// }
 	// // }
-	// // LogUtil.info("CollectThread Challenge
+	// // LogUtil.info("DownThread Challenge
 	// // Constant.CollectReportList release...");
 	// // LogUtil.info("handlePacket pushData begin...");
 	// this.pushData(rList);
@@ -674,10 +642,10 @@ public class CollectThread extends Thread {
 	// Constant.collectCount++;
 	// Constant.ps_NodeStatus.put(rList[0] + "-" + rList[1],
 	// System.currentTimeMillis());
-	// // LogUtil.info("CollectThread Challenge
+	// // LogUtil.info("DownThread Challenge
 	// // Constant.CollectReportList begin...");
 	// // synchronized (Constant.CollectReportList) {
-	// // LogUtil.info("CollectThread Challenge
+	// // LogUtil.info("DownThread Challenge
 	// // Constant.CollectReportList get...");
 	// synchronized (Constant.CollectReportList) {
 	// if (Constant.BuildingAdds.containsKey(rList[0])) {
@@ -702,7 +670,7 @@ public class CollectThread extends Thread {
 	// }
 	//
 	// // }
-	// // LogUtil.info("CollectThread Challenge
+	// // LogUtil.info("DownThread Challenge
 	// // Constant.CollectReportList release...");
 	// // LogUtil.info("handlePacket pushData begin...");
 	// this.pushDataAddtion(rList);
@@ -917,7 +885,7 @@ public class CollectThread extends Thread {
 	// funcidList);
 	// }
 	// }
-	// LogUtil.info("CollectThread Challenge Constant.CollectReportList
+	// LogUtil.info("DownThread Challenge Constant.CollectReportList
 	// release...");
 	//
 	// if (sb.length() > 0) {
@@ -930,7 +898,7 @@ public class CollectThread extends Thread {
 	// }
 	// } catch (Exception e) {
 	// // TODO Auto-generated catch block
-	// LogUtil.error("CollectThread.handlePacket.Exception: " + e.toString());
+	// LogUtil.error("DownThread.handlePacket.Exception: " + e.toString());
 	// }
 	// }
 
@@ -969,7 +937,7 @@ public class CollectThread extends Thread {
 	// } catch (Exception e) {
 	// // TODO Auto-generated catch block
 	// e.printStackTrace();
-	// LogUtil.error("CollectThread.insertCollectorCommunicationLog.Exception: "
+	// LogUtil.error("DownThread.insertCollectorCommunicationLog.Exception: "
 	// + e.toString());
 	// }
 	// }
@@ -1002,7 +970,7 @@ public class CollectThread extends Thread {
 				}
 			} catch (Exception e) {
 				// TODO Auto-generated catch block
-				LogUtil.error("CollectThread.pushData.Exception: " + e.toString());
+				LogUtil.error("DownThread.pushData.Exception: " + e.toString());
 			}
 		}
 	}
@@ -1043,7 +1011,7 @@ public class CollectThread extends Thread {
 				}
 			} catch (Exception e) {
 				// TODO Auto-generated catch block
-				LogUtil.error("CollectThread.pushData2.Exception: " + e.toString());
+				LogUtil.error("DownThread.pushData2.Exception: " + e.toString());
 			}
 		}
 	}
@@ -1094,7 +1062,7 @@ public class CollectThread extends Thread {
 	//
 	// } catch (Exception e) {
 	// // TODO Auto-generated catch block
-	// LogUtil.error("CollectThread.handleData.Exception: " + e.toString());
+	// LogUtil.error("DownThread.handleData.Exception: " + e.toString());
 	// }
 	// }
 
@@ -1148,7 +1116,7 @@ public class CollectThread extends Thread {
 
 		} catch (Exception e) {
 			// TODO Auto-generated catch block
-			LogUtil.error("CollectThread.handleData.Exception: " + e.toString());
+			LogUtil.error("DownThread.handleData.Exception: " + e.toString());
 		}
 	}
 
@@ -1201,7 +1169,7 @@ public class CollectThread extends Thread {
 			Constant.Meter_Collector.put(building + "-" + meter, address);
 		} catch (Exception e) {
 			// TODO Auto-generated catch block
-			LogUtil.error("CollectThread.updateMeterCollector.Exception: " + e.toString());
+			LogUtil.error("DownThread.updateMeterCollector.Exception: " + e.toString());
 		}
 	}
 
@@ -1223,7 +1191,7 @@ public class CollectThread extends Thread {
 			Constant.Meter_Collector_Control.put(building + "-" + meter, address);
 		} catch (Exception e) {
 			// TODO Auto-generated catch block
-			LogUtil.error("CollectThread.updateMeterCollector.Exception: " + e.toString());
+			LogUtil.error("DownThread.updateMeterCollector.Exception: " + e.toString());
 		}
 	}
 
@@ -1238,7 +1206,7 @@ public class CollectThread extends Thread {
 	// }
 	// } catch (Exception e) {
 	// // TODO Auto-generated catch block
-	// LogUtil.error("CollectThread.needAck.Exception: " + e.toString());
+	// LogUtil.error("DownThread.needAck.Exception: " + e.toString());
 	// }
 	// return true;
 	// }

+ 85 - 82
collect/src/main/java/com/saga/thread/up/SendThread.java

@@ -4,23 +4,28 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.Map.Entry;
 
 import org.zillion.util.log.LogUtil;
 
 import com.persagy.communication.entity.Packet;
 import com.persagy.communication.entity.PacketEntity;
+import com.persagy.communication.mina.tcp.server.TCPServerManager;
+import com.persagy.communication.mina.udp.server.UDPServerManager;
 import com.persagy.communication.util.IServerManager;
 import com.saga.entity.PointSet;
 import com.saga.entity.Record;
+import com.saga.entity.Server;
 import com.saga.util.Constant;
 
-public class SendThread extends Thread {
+public class UpThread extends Thread {
 
-	private IServerManager uploadServer = null;
+	// private IServerManager uploadServer = null;
 	// private String ip = null;
+	private Map<String, IServerManager> serverList = new HashMap<String, IServerManager>();
 	private Map<String, String> pointMac_UP = new HashMap<String, String>();
 
-	public SendThread(IServerManager uploadServer) {
+	public UpThread(Server server) {
 		// TODO Auto-generated constructor stub
 		try {
 			// try {
@@ -31,53 +36,56 @@ public class SendThread extends Thread {
 			// // this.ip = "0.0.0.0" + ":" + Constant.TypePort.get("Down");
 			// e.printStackTrace();
 			// }
-			this.uploadServer = uploadServer;
-			this.uploadServer.Start();
-			LogUtil.info("SendThread" + ": " + this.uploadServer.Name() + " Created ...");
+			this.serverList.put("UDP", new UDPServerManager(server.IP, server.Port, "utf-8", server.compress, 1000));
+			this.serverList.put("TCP", new TCPServerManager(server.IP, server.Port, "utf-8", server.compress, 1000,
+					(byte) '(', (byte) ')'));
 		} catch (Exception e) {
-			LogUtil.error("SendThread.Exception: " + e.toString());
-			LogUtil.error("SendThread" + ": " + this.uploadServer.Name() + " failed to excute, exit!");
+			LogUtil.error("UpThread.Exception: " + e.toString());
+			LogUtil.error("UpThread(" + ": " + server.IP + ":" + server.Port + ") failed to excute, exit!");
 			System.exit(0);
 		}
 	}
 
 	public void run() {
 		try {
-			this.uploadServer.Start();
+			for (Entry<String, IServerManager> server : this.serverList.entrySet()) {
+				LogUtil.info("UpThread(" + server.getValue().Name() + "): " + " Created ...");
+				server.getValue().Start();
+				LogUtil.info("UpThread(" + server.getValue().Name() + "): " + " Starting ...");
+			}
 		} catch (Exception e) {
-			LogUtil.error("SendThread.run.Exception: " + e.toString());
+			LogUtil.error("UpThread.run.Exception: " + e.toString());
 		}
-		LogUtil.info("SendThread" + ": " + this.uploadServer.Name() + " Starting ...");
 		while (true) {
 			try {
-				// Constant.setlog = new File(
-				// System.getProperty("user.dir") + "/setlog" +
-				// Constant.format_day(new Date()) + ".log");
-				// // V1.0点位日志结构
-				// {
-				// // 返pointset结果包
-				// this.returnPointSet();
-				// // 处理PopRece
-				// PacketEntity packageRece = this.uploadServer.PopRece();
-				// if (packageRece != null) {
-				// this.handlePopRece(packageRece);
-				// }
-				// }
-				// V2.0点位日志结构
-				{
-					// 返pointset结果包
-					this.returnPointSet2();
-					// 处理PopRece
-					PacketEntity packageRece = this.uploadServer.PopRece();
-					if (packageRece != null) {
-						this.handlePopRece2(packageRece);
+				for (Entry<String, IServerManager> server : this.serverList.entrySet()) {
+					PacketEntity packageRece = server.getValue().PopRece();
+					// Constant.setlog = new File(
+					// System.getProperty("user.dir") + "/setlog" +
+					// Constant.format_day(new Date()) + ".log");
+					// // V1.0点位日志结构
+					// {
+					// // 返pointset结果
+					// this.returnPointSet();
+					// // 处理PopRece包
+					// PacketEntity packageRece = this.uploadServer.PopRece();
+					// if (packageRece != null) {
+					// this.handlePopRece(packageRece);
+					// }
+					// }
+					// V2.0点位日志结构
+					{
+						// 返pointset结果
+						this.returnPointSet2(server.getValue());
+						// 处理PopRece包
+						this.handlePopRece2(server.getValue(), packageRece);
 					}
-				}
 
-				Thread.sleep(1L);
+					Thread.sleep(1L);
+				}
 			} catch (Exception e) {
 				// TODO Auto-generated catch block
-				LogUtil.error("SendThread.run.Exception: " + e.toString());
+				LogUtil.error("UpThread.run.Exception: " + e.toString());
 			}
 		}
 	}
@@ -206,16 +214,15 @@ public class SendThread extends Thread {
 	//
 	// } catch (Exception e) {
 	// // TODO Auto-generated catch block
-	// LogUtil.error("SendThread.returnPointSet.Exception: " + e.toString());
+	// LogUtil.error("UpThread.returnPointSet.Exception: " + e.toString());
 	// }
 	// }
 
-	private void handlePopRece2(PacketEntity packageRece) {
+	private void handlePopRece2(IServerManager server, PacketEntity packageRece) {
 		// TODO Auto-generated method stub
 		if ((packageRece != null) && (packageRece.content.packetString != null)
 				&& (packageRece.content.packetString.length() > 0)) {
-			LogUtil.info(this.uploadServer.Name() + " PopRece: " + packageRece.address + " "
-					+ packageRece.content.packetString);
+			LogUtil.info(server.Name() + " PopRece: " + packageRece.address + " " + packageRece.content.packetString);
 			Constant.sendRec += packageRece.content.packetString.length();
 			String results = packageRece.content.packetString.replace("(", "").replace(")", "").replace(" ", "");
 			String[] resultArray = results.split("&");
@@ -243,9 +250,9 @@ public class SendThread extends Thread {
 						// this.getupdown(rList[2]),
 						// Constant.format(new Date()), Long.valueOf(rList[4]),
 						// rList[2], "processing:rcvd");
-						Constant.Insert_agents_ps_virtual_point_log(rList[0], rList[5], Long.valueOf(rList[6]),
-								this.getupdown(rList[2]), System.currentTimeMillis(), Long.valueOf(rList[4]), rList[2],
-								"processing:rcvd");
+						Constant.Insert_ps_virtual_point_log(Constant.Database, rList[0], rList[5],
+								Long.valueOf(rList[6]), this.getupdown(rList[2]), Constant.format(new Date()),
+								Long.valueOf(rList[4]), rList[2], "processing:rcvd");
 					} catch (Exception e1) {
 						// TODO Auto-generated catch block
 						e1.printStackTrace();
@@ -267,7 +274,7 @@ public class SendThread extends Thread {
 						}
 
 						PointSet ps = new PointSet();
-						ps.uploadName = this.uploadServer.Name();
+						ps.uploadName = server.Name();
 						ps.address = packageRece.address;
 						ps.content = rList;
 						ps.sendTime = 0;
@@ -302,9 +309,9 @@ public class SendThread extends Thread {
 							StringBuffer sb = new StringBuffer();
 							sb = this.getCacheData(rList);
 							if (sb != null && sb.toString().length() > 0) {
-								this.uploadServer.AppendToSend(packageRece.address, new Packet(sb.toString()));
-								LogUtil.info(this.uploadServer.Name() + " AppendToSend: " + packageRece.address + " "
-										+ sb.toString());
+								server.AppendToSend(packageRece.address, new Packet(sb.toString()));
+								LogUtil.info(
+										server.Name() + " AppendToSend: " + packageRece.address + " " + sb.toString());
 								// Constant.id2status.put(id, "finish:finish:" +
 								// "success");
 								// HBaseUtil.Insert_ps_virtual_point_log(Constant.agent,
@@ -314,9 +321,9 @@ public class SendThread extends Thread {
 								// Constant.format(new Date()),
 								// Long.valueOf(rList[4]), "pointreadack",
 								// "finish:finish:" + "success");
-								Constant.Insert_agents_ps_virtual_point_log(rList[0], rList[5], Long.valueOf(rList[6]),
-										this.getupdown(rList[2]), System.currentTimeMillis(), Long.valueOf(rList[4]),
-										"pointreadack", "finish:finish:" + "success");
+								Constant.Insert_ps_virtual_point_log(Constant.Database, rList[0], rList[5],
+										Long.valueOf(rList[6]), this.getupdown(rList[2]), Constant.format(new Date()),
+										Long.valueOf(rList[4]), "pointreadack", "finish:finish:" + "success");
 							} else {
 								// Constant.id2status.put(id, "finish:finish:" +
 								// "fail");
@@ -327,14 +334,14 @@ public class SendThread extends Thread {
 								// Constant.format(new Date()),
 								// Long.valueOf(rList[4]), "pointreadack",
 								// "finish:finish:" + "fail");
-								Constant.Insert_agents_ps_virtual_point_log(rList[0], rList[5], Long.valueOf(rList[6]),
-										this.getupdown(rList[2]), System.currentTimeMillis(), Long.valueOf(rList[4]),
-										"pointreadack", "finish:finish:" + "fail");
+								Constant.Insert_ps_virtual_point_log(Constant.Database, rList[0], rList[5],
+										Long.valueOf(rList[6]), this.getupdown(rList[2]), Constant.format(new Date()),
+										Long.valueOf(rList[4]), "pointreadack", "finish:finish:" + "fail");
 							}
 
 						} catch (Exception e) {
 							e.printStackTrace();
-							LogUtil.error("SendThread.handlePopRece2.pointread.Exception: " + e.toString());
+							LogUtil.error("UpThread.handlePopRece2.pointread.Exception: " + e.toString());
 						}
 
 					} else if (rList.length > 6 && "realtimepointdata".equalsIgnoreCase(rList[2])) {
@@ -342,9 +349,9 @@ public class SendThread extends Thread {
 							StringBuffer sb = new StringBuffer();
 							sb = this.getCacheData2(rList);
 							if (sb != null && sb.toString().length() > 0) {
-								this.uploadServer.AppendToSend(packageRece.address, new Packet(sb.toString()));
-								LogUtil.info(this.uploadServer.Name() + " AppendToSend: " + packageRece.address + " "
-										+ sb.toString());
+								server.AppendToSend(packageRece.address, new Packet(sb.toString()));
+								LogUtil.info(
+										server.Name() + " AppendToSend: " + packageRece.address + " " + sb.toString());
 								// Constant.id2status.put(id, "finish:finish:" +
 								// "success");
 								// HBaseUtil.Insert_ps_virtual_point_log(Constant.agent,
@@ -355,10 +362,9 @@ public class SendThread extends Thread {
 								// Long.valueOf(rList[4]),
 								// "realtimepointdataack",
 								// "finish:finish:" + "success");
-								Constant.Insert_agents_ps_virtual_point_log(rList[0], rList[5], Long.valueOf(rList[6]),
-										this.getupdown(rList[2]), System.currentTimeMillis(), Long.valueOf(rList[4]),
-										"realtimepointdataack", "finish:finish:" + "success");
-
+								Constant.Insert_ps_virtual_point_log(Constant.Database, rList[0], rList[5],
+										Long.valueOf(rList[6]), this.getupdown(rList[2]), Constant.format(new Date()),
+										Long.valueOf(rList[4]), "realtimepointdataack", "finish:finish:" + "success");
 							} else {
 								// Constant.id2status.put(id, "finish:finish:" +
 								// "fail");
@@ -370,14 +376,14 @@ public class SendThread extends Thread {
 								// Long.valueOf(rList[4]),
 								// "realtimepointdataack",
 								// "finish:finish:" + "fail");
-								Constant.Insert_agents_ps_virtual_point_log(rList[0], rList[5], Long.valueOf(rList[6]),
-										this.getupdown(rList[2]), System.currentTimeMillis(), Long.valueOf(rList[4]),
-										"realtimepointdataack", "finish:finish:" + "fail");
+								Constant.Insert_ps_virtual_point_log(Constant.Database, rList[0], rList[5],
+										Long.valueOf(rList[6]), this.getupdown(rList[2]), Constant.format(new Date()),
+										Long.valueOf(rList[4]), "realtimepointdataack", "finish:finish:" + "fail");
 							}
 
 						} catch (Exception e) {
 							e.printStackTrace();
-							LogUtil.error("SendThread.handlePopRece2.realtimepointdata.Exception: " + e.toString());
+							LogUtil.error("UpThread.handlePopRece2.realtimepointdata.Exception: " + e.toString());
 						}
 					}
 				}
@@ -385,7 +391,7 @@ public class SendThread extends Thread {
 		}
 	}
 
-	private void returnPointSet2() {
+	private void returnPointSet2(IServerManager server) {
 		// TODO Auto-generated method stub
 		try {
 			synchronized (Constant.pointSetList) {
@@ -400,7 +406,7 @@ public class SendThread extends Thread {
 						// + ps.ID + ";");
 						// String address = ps.address;
 
-						if (!ps.uploadName.equalsIgnoreCase(this.uploadServer.Name())) {
+						if (!ps.uploadName.equalsIgnoreCase(server.Name())) {
 							break;
 						}
 
@@ -417,13 +423,12 @@ public class SendThread extends Thread {
 									.append(";").append(Constant.format(new Date())).append(";").append(ps.ID)
 									.append(";").append(ps.meterSign).append(";").append(ps.funcID).append(";")
 									.append(ps.status).append(";");
-							this.uploadServer.AppendToSend(ps.address, new Packet(sb.toString()));
+							server.AppendToSend(ps.address, new Packet(sb.toString()));
 							Constant.sendSend += sb.toString().length();
 							// HBaseUtil.BatchInsert_Set2(Constant.agent,
 							// Constant.BuildingDB.get(ps.buildingSign), ps);
-							Constant.AgentsBatchInsert_Set2(Constant.BuildingDB.get(ps.buildingSign), ps);
-							LogUtil.info(
-									this.uploadServer.Name() + " AppendToSend: " + ps.address + " " + sb.toString());
+							Constant.BatchInsert_Set2(Constant.Database, ps);
+							LogUtil.info(server.Name() + " AppendToSend: " + ps.address + " " + sb.toString());
 
 							String id = ps.buildingSignUP + "-" + ps.mac + "-" + ps.ID;
 							// HBaseUtil.Insert_ps_virtual_point_log(Constant.agent,
@@ -434,8 +439,8 @@ public class SendThread extends Thread {
 							// Constant.format(new Date()),
 							// Long.valueOf(ps.ID), "pointsetack",
 							// "finish:finish:" + ps.status);
-							Constant.Insert_agents_ps_virtual_point_log(ps.buildingSignUP, ps.meterSign,
-									Long.valueOf(ps.funcID), this.getupdown("pointsetack"), System.currentTimeMillis(),
+							Constant.Insert_ps_virtual_point_log(Constant.Database, ps.buildingSignUP, ps.meterSign,
+									Long.valueOf(ps.funcID), this.getupdown("pointsetack"), Constant.format(new Date()),
 									Long.valueOf(ps.ID), "pointsetack", "finish:finish:" + ps.status);
 
 							synchronized (Constant.ps_ID2Status) {
@@ -459,14 +464,13 @@ public class SendThread extends Thread {
 									.append(";").append(Constant.format(new Date())).append(";").append(ps.ID)
 									.append(";").append(ps.meterSign).append(";").append(ps.funcID).append(";")
 									.append("fail:timeout").append(";");
-							this.uploadServer.AppendToSend(ps.address, new Packet(sb.toString()));
+							server.AppendToSend(ps.address, new Packet(sb.toString()));
 							Constant.sendSend += sb.toString().length();
 							// HBaseUtil.BatchInsert_Set3(Constant.agent,
 							// Constant.BuildingDB.get(ps.buildingSign), ps);
-							Constant.AgentsBatchInsert_Set3(Constant.BuildingDB.get(ps.buildingSign), ps);
+							Constant.BatchInsert_Set3(Constant.Database, ps);
 
-							LogUtil.info(
-									this.uploadServer.Name() + " AppendToSend: " + ps.address + " " + sb.toString());
+							LogUtil.info(server.Name() + " AppendToSend: " + ps.address + " " + sb.toString());
 							String id = ps.buildingSignUP + "-" + ps.mac + "-" + ps.ID;
 
 							// LogUtil.info("InsertPointCommunicationLog" + "
@@ -479,9 +483,8 @@ public class SendThread extends Thread {
 							// Constant.format(new Date()),
 							// Long.valueOf(ps.ID), "pointsetack",
 							// "finish:finish:" + "fail:timeout");
-
-							Constant.Insert_agents_ps_virtual_point_log(ps.buildingSignUP, ps.meterSign,
-									Long.valueOf(ps.funcID), this.getupdown("pointsetack"), System.currentTimeMillis(),
+							Constant.Insert_ps_virtual_point_log(Constant.Database, ps.buildingSignUP, ps.meterSign,
+									Long.valueOf(ps.funcID), this.getupdown("pointsetack"), Constant.format(new Date()),
 									Long.valueOf(ps.ID), "pointsetack", "finish:finish:" + "fail:timeout");
 
 							synchronized (Constant.ps_ID2Status) {
@@ -516,7 +519,7 @@ public class SendThread extends Thread {
 
 		} catch (Exception e) {
 			// TODO Auto-generated catch block
-			LogUtil.error("SendThread.returnPointSet2.Exception: " + e.toString());
+			LogUtil.error("UpThread.returnPointSet2.Exception: " + e.toString());
 		}
 	}
 
@@ -643,7 +646,7 @@ public class SendThread extends Thread {
 	//
 	// } catch (Exception e) {
 	// e.printStackTrace();
-	// LogUtil.error("SendThread.handlePopRece.pointread.Exception: " +
+	// LogUtil.error("UpThread.handlePopRece.pointread.Exception: " +
 	// e.toString());
 	// }
 	//
@@ -679,7 +682,7 @@ public class SendThread extends Thread {
 	//
 	// } catch (Exception e) {
 	// e.printStackTrace();
-	// LogUtil.error("SendThread.handlePopRece.realtimepointdata.Exception: " +
+	// LogUtil.error("UpThread.handlePopRece.realtimepointdata.Exception: " +
 	// e.toString());
 	// }
 	// }

+ 79 - 74
collect/src/main/java/com/saga/tool/ImportPoints.java

@@ -27,9 +27,9 @@ public class ImportPoints {
 	public static void main(String[] args) {
 		// TODO Auto-generated method stub
 		// agentStart();
-		agentsStart();
-		importPoints();
-		System.exit(0);
+		// agentsStart();
+		// importPoints();
+		// System.exit(0);
 	}
 
 	private static Map<Integer, Map<Integer, Map<Integer, String>>> readExcel(File file) {
@@ -105,73 +105,78 @@ public class ImportPoints {
 		return result;
 	}
 
-	private static void importPoints() {
-		// TODO Auto-generated method stub
-		try {
-			String filepathPoints = "\\pointlistadd.xls";
-			File file = new File(System.getProperty("user.dir") + filepathPoints);
-			Map<Integer, Map<Integer, Map<Integer, String>>> points = readExcel(file);
-			Map<String, List<EntityPoint>> buildingPointList = new HashMap<String, List<EntityPoint>>();
-			for (Entry<Integer, Map<Integer, Map<Integer, String>>> s : points.entrySet()) {
-				Map<String, Integer> cv = new HashMap<String, Integer>();
-				for (Entry<Integer, Map<Integer, String>> r : s.getValue().entrySet()) {
-					if (r.getKey() == 0) {
-						for (Entry<Integer, String> c : r.getValue().entrySet()) {
-							cv.put(c.getValue(), c.getKey());
-						}
-					} else {
-
-						EntityPoint ep = new EntityPoint();
-
-						ep.building = r.getValue().get(cv.get("building"));
-						ep.meter = r.getValue().get(cv.get("meter"));
-						ep.funcid = Long.valueOf(r.getValue().get(cv.get("funcid")));
-						ep.system = r.getValue().get(cv.get("system"));
-						ep.source = r.getValue().get(cv.get("source"));
-						ep.address_1 = r.getValue().get(cv.get("address_1"));
-						ep.ip_port = r.getValue().get(cv.get("ip_port"));
-						ep.address_2 = r.getValue().get(cv.get("address_2"));
-						ep.address_3 = r.getValue().get(cv.get("address_3"));
-						ep.address_4 = r.getValue().get(cv.get("address_4"));
-						ep.data_type = r.getValue().get(cv.get("data_type"));
-						ep.collect_cycle = r.getValue().get(cv.get("collect_cycle"));
-						ep.unit = r.getValue().get(cv.get("unit"));
-						ep.remark1 = r.getValue().get(cv.get("remark1"));
-						ep.remark2 = r.getValue().get(cv.get("remark2"));
-						ep.remark3 = r.getValue().get(cv.get("remark3"));
-
-						if (!buildingPointList.containsKey(ep.building)) {
-							buildingPointList.put(ep.building, new ArrayList<EntityPoint>());
-						}
-						buildingPointList.get(ep.building).add(ep);
-					}
-				}
-			}
-
-			for (Entry<String, List<EntityPoint>> e : buildingPointList.entrySet()) {
-				for (EntityPoint p : e.getValue()) {
-					try {
-						// HBaseUtil.Insert_dy_pointlist(Constant.agent,
-						// Constant.BuildingDB.get(p.building), p.building,
-						// p.meter, p.funcid, p.system, p.source, p.address_1,
-						// p.ip_port, p.address_2, p.address_3,
-						// p.address_4, p.collect_cycle, p.data_type, p.unit);
-						Constant.Insert_agents_dy_pointlist(p.building, p.meter, (int) p.funcid, p.system, p.source,
-								p.address_1, p.ip_port, p.address_2, p.address_3, p.address_4, p.collect_cycle,
-								p.data_type, p.unit);
-					} catch (Exception e1) {
-						// TODO Auto-generated catch block
-						e1.printStackTrace();
-					}
-				}
-				LogUtil.info(" batch_insert dy_pointlist " + e.getKey() + " complete!");
-			}
-		} catch (Exception e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-
-	}
+	// private static void importPoints() {
+	// // TODO Auto-generated method stub
+	// try {
+	// String filepathPoints = "\\pointlistadd.xls";
+	// File file = new File(System.getProperty("user.dir") + filepathPoints);
+	// Map<Integer, Map<Integer, Map<Integer, String>>> points =
+	// readExcel(file);
+	// Map<String, List<EntityPoint>> buildingPointList = new HashMap<String,
+	// List<EntityPoint>>();
+	// for (Entry<Integer, Map<Integer, Map<Integer, String>>> s :
+	// points.entrySet()) {
+	// Map<String, Integer> cv = new HashMap<String, Integer>();
+	// for (Entry<Integer, Map<Integer, String>> r : s.getValue().entrySet()) {
+	// if (r.getKey() == 0) {
+	// for (Entry<Integer, String> c : r.getValue().entrySet()) {
+	// cv.put(c.getValue(), c.getKey());
+	// }
+	// } else {
+	//
+	// EntityPoint ep = new EntityPoint();
+	//
+	// ep.building = r.getValue().get(cv.get("building"));
+	// ep.meter = r.getValue().get(cv.get("meter"));
+	// ep.funcid = Long.valueOf(r.getValue().get(cv.get("funcid")));
+	// ep.system = r.getValue().get(cv.get("system"));
+	// ep.source = r.getValue().get(cv.get("source"));
+	// ep.address_1 = r.getValue().get(cv.get("address_1"));
+	// ep.ip_port = r.getValue().get(cv.get("ip_port"));
+	// ep.address_2 = r.getValue().get(cv.get("address_2"));
+	// ep.address_3 = r.getValue().get(cv.get("address_3"));
+	// ep.address_4 = r.getValue().get(cv.get("address_4"));
+	// ep.data_type = r.getValue().get(cv.get("data_type"));
+	// ep.collect_cycle = r.getValue().get(cv.get("collect_cycle"));
+	// ep.unit = r.getValue().get(cv.get("unit"));
+	// ep.remark1 = r.getValue().get(cv.get("remark1"));
+	// ep.remark2 = r.getValue().get(cv.get("remark2"));
+	// ep.remark3 = r.getValue().get(cv.get("remark3"));
+	//
+	// if (!buildingPointList.containsKey(ep.building)) {
+	// buildingPointList.put(ep.building, new ArrayList<EntityPoint>());
+	// }
+	// buildingPointList.get(ep.building).add(ep);
+	// }
+	// }
+	// }
+	//
+	// for (Entry<String, List<EntityPoint>> e : buildingPointList.entrySet()) {
+	// for (EntityPoint p : e.getValue()) {
+	// try {
+	// // HBaseUtil.Insert_dy_pointlist(Constant.agent,
+	// // Constant.BuildingDB.get(p.building), p.building,
+	// // p.meter, p.funcid, p.system, p.source, p.address_1,
+	// // p.ip_port, p.address_2, p.address_3,
+	// // p.address_4, p.collect_cycle, p.data_type, p.unit);
+	// Constant.Insert_agents_dy_pointlist(p.building, p.meter, (int) p.funcid,
+	// p.system, p.source,
+	// p.address_1, p.ip_port, p.address_2, p.address_3, p.address_4,
+	// p.collect_cycle,
+	// p.data_type, p.unit);
+	// } catch (Exception e1) {
+	// // TODO Auto-generated catch block
+	// e1.printStackTrace();
+	// }
+	// }
+	// LogUtil.info(" batch_insert dy_pointlist " + e.getKey() + " complete!");
+	// }
+	// } catch (Exception e) {
+	// // TODO Auto-generated catch block
+	// e.printStackTrace();
+	// }
+	//
+	// }
 
 	private static void agentsStart() {
 		// TODO Auto-generated method stub
@@ -193,10 +198,10 @@ public class ImportPoints {
 					Configuration configuration = new Configuration();
 					configuration.set("hbase.cluster.distributed", "true");
 					configuration.set("hbase.zookeeper.quorum", qr);
-					ZillionAgent agent = new ZillionAgent(configuration);
-					agent.setFull_name(qr);
-					agent.Start();
-					Constant.agents.add(agent);
+					Constant.agent = new ZillionAgent(configuration);
+					Constant.agent.setFull_name(qr);
+					Constant.agent.Start();
+
 				} catch (Exception e) {
 					e.printStackTrace();
 					LogUtil.error("Main.init.agentsStart: " + e.toString());

+ 0 - 57
collect/src/main/java/com/saga/util/CSVUtil.java

@@ -1,57 +0,0 @@
-package com.saga.util;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-
-import org.zillion.util.log.LogUtil;
-
-public class CSVUtil {
-	public static void createFile(File csvFile) {
-		if (!csvFile.exists()) {
-			try {
-				csvFile.createNewFile();
-				LogUtil.info(csvFile.getPath() + csvFile.getName() + " Created!");
-			} catch (IOException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			} finally {
-				try {
-					Thread.sleep(10L);
-				} catch (InterruptedException e) {
-					// TODO Auto-generated catch block
-					e.printStackTrace();
-				}
-			}
-		}
-	}
-
-	public static void deleteFile(File csvFile) {
-		if (csvFile.exists()) {
-			csvFile.delete();
-			LogUtil.info(csvFile.getPath() + csvFile.getName() + " Deleted!");
-			try {
-				Thread.sleep(10L);
-			} catch (InterruptedException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
-		}
-	}
-
-	public static void insert(File csvFile, StringBuffer sb) {
-		try {
-			BufferedWriter csvWtriter = new BufferedWriter(
-					new OutputStreamWriter(new FileOutputStream(csvFile, true), "GB2312"), 1024);
-			LogUtil.info(csvFile.getPath() + csvFile.getName() + " Insert into " + sb.toString());
-			csvWtriter.write(sb.toString());
-			csvWtriter.flush();
-			csvWtriter.close();
-		} catch (IOException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-	}
-}

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 890 - 417
collect/src/main/java/com/saga/util/Constant.java


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 684 - 613
collect/src/main/java/com/saga/util/HBaseUtil.java


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1291 - 0
collect/src/main/java/com/saga/util/MySQLUtil.java