Browse Source

修复程序异常关闭造成的部分bug。

Jay Lee 6 years ago
parent
commit
0446ea45d8

+ 0 - 2
collect/.settings/org.eclipse.core.resources.prefs

@@ -1,5 +1,3 @@
 eclipse.preferences.version=1
 encoding//src/main/java=gbk
 encoding//src/main/resources=UTF-8
-encoding//src/test/java=gbk
-encoding//src/test/resources=UTF-8

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

@@ -4,7 +4,5 @@ public class Report {
 	public String UploadName;
 	public int ReportID;
 	public long resend;
-	public String ReportType;
-	public String mac;
 	public Record record;
 }

+ 1 - 6
collect/src/main/java/com/saga/main/Main.java

@@ -15,7 +15,6 @@ 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.thread.common.CheckThread;
-import com.saga.thread.common.ExcuteAckThread;
 import com.saga.thread.common.LoadConfigThread;
 import com.saga.thread.common.SaveThread;
 import com.saga.thread.common.StatsThread;
@@ -63,7 +62,6 @@ public class Main {
 			// TODO Auto-generated catch block
 			LogUtil.error("Main.threadStart.CollectThread: " + e.toString());
 		}
-		// new ExcuteAckThread().start();
 		// ÉÏ´«½ø³Ì
 		List<IServerManager> udpserverList = new ArrayList<IServerManager>();
 		List<IServerManager> tcpserverList = new ArrayList<IServerManager>();
@@ -88,7 +86,6 @@ public class Main {
 				LogUtil.error("Main.threadStart.SendThread-TCP: " + e.toString());
 			}
 		}
-
 		// Êý¾Ý´¦Àí½ø³Ì
 		try {
 			new SaveThread().start();
@@ -616,11 +613,9 @@ public class Main {
 
 			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("zookeeper1.test");
+			// qrlist.add("zookeeper1");
 
 			for (String qr : qrlist) {
 				try {

+ 8 - 159
collect/src/main/java/com/saga/test/Test.java

@@ -34,165 +34,14 @@ public class Test {
 
 	public static void main(String[] args) throws InterruptedException {
 		// TODO Auto-generated method stub
-
-		Constant.ackList.put("192.168.20.159:8081", new ArrayList<String>());
-		Constant.ackList.put("192.168.20.159:8082", new ArrayList<String>());
-		Constant.ackList.get("192.168.20.159:8081").add("ack1;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack2;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack3;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack4;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack5;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack6;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack7;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack8;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack9;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack10;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack11;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack12;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack13;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack14;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack15;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack16;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack17;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack18;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack19;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack20;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack21;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack22;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack23;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack24;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack25;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack26;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack27;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack28;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack29;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack30;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack31;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack32;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack33;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack34;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack35;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack36;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack37;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack38;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack39;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack40;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack41;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack42;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack43;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack44;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack45;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack46;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack47;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack48;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack49;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack50;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack51;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack52;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack53;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack54;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack55;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack56;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack57;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack58;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack59;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack60;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack61;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack62;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack63;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack64;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack65;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack66;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack67;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack68;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack69;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack70;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack71;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack72;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack73;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack74;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack75;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack76;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack77;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack78;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack79;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack80;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack81;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack82;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack83;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack84;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack85;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack86;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack87;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack88;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack89;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack90;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack91;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack92;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack93;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack94;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack95;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack96;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack97;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack98;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack99;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack100;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack101;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack102;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack103;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack104;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack105;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack106;");
-		Constant.ackList.get("192.168.20.159:8081").add("ack107;");
-
-		for (Entry<String, List<String>> a : excuteAckList().entrySet()) {
-			for (String v : a.getValue()) {
-				System.out.println(a.getKey() + "");
-				System.out.println(v + "");
-			}
-
-		}
-
-		// ³õʼ»¯
-		// init(args);
-		// ÒµÎñ½ø³ÌÆô¶¯
-		// threadStart();
-		// agentsStart();
-		// while (true) {
-		// Constant.AgentsLoadDB2Cache_dy_pointlist();
-		// for (Entry<String, List<String>> p :
-		// Constant.ps_ProjectList.entrySet()) {
-		// LogUtil.info(p.getKey() + " " + p.getValue());
-		// }
-		// for (Entry<String, List<String>> m :
-		// Constant.ps_MeterList.entrySet()) {
-		// LogUtil.info(m.getKey() + " " + m.getValue());
-		// }
-		// Thread.sleep(Constant.Millisecond.MINUTE_1);
-		// }
-	}
-
-	private static Map<String, List<String>> excuteAckList() {
-		Map<String, List<String>> ackListResult = new HashMap<String, List<String>>();
-		synchronized (Constant.ackList) {
-			for (Entry<String, List<String>> ack : Constant.ackList.entrySet()) {
-				StringBuffer cmd = new StringBuffer();
-				for (int i = 0; i < ack.getValue().size(); i++) {
-					cmd.append(ack.getValue().get(i));
-					if ((i > 0) && (i % 50 == 0 || i == ack.getValue().size() - 1)) {
-						if (!ackListResult.containsKey(ack.getKey())) {
-							ackListResult.put(ack.getKey(), new ArrayList<String>());
-						}
-						ackListResult.get(ack.getKey()).add(cmd.toString());
-						cmd = new StringBuffer();
-					} else {
-						cmd.append("&");
-					}
-				}
-			}
-		}
-		Constant.ackList.clear();
-		return ackListResult;
+		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);
 
 	}
 

+ 0 - 31
collect/src/main/java/com/saga/test/TestClient.java

@@ -1,31 +0,0 @@
-package com.saga.test;
-
-import java.util.Date;
-
-import com.persagy.communication.entity.Packet;
-import com.persagy.communication.mina.udp.client.UDPClientManager;
-import com.persagy.communication.util.IClientManager;
-import com.saga.util.Constant;
-
-public class TestClient {
-
-	public static void main(String[] args) {
-		// TODO Auto-generated method stub
-		IClientManager client = new UDPClientManager("192.168.20.159", 8089, "192.168.20.159", 8080, "utf-8", false,
-				1000);
-		while (true) {
-			StringBuffer sb = new StringBuffer();
-			sb.append("1234567890").append(";").append(1).append(";").append("report").append(";")
-					.append(Constant.format(new Date())).append(";").append(Constant.getID()).append(";").append("1001")
-					.append(";1;").append(1111).append(";").append(3.33).append(";");
-			client.AppendToSend(new Packet(sb.toString()));
-			try {
-				Thread.sleep(1L);
-			} catch (InterruptedException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
-		}
-	}
-
-}

+ 0 - 38
collect/src/main/java/com/saga/test/TestServer.java

@@ -1,38 +0,0 @@
-package com.saga.test;
-
-import org.zillion.util.log.LogUtil;
-
-import com.persagy.communication.entity.Packet;
-import com.persagy.communication.entity.PacketEntity;
-import com.persagy.communication.mina.udp.server.UDPServerManager;
-import com.persagy.communication.util.IServerManager;
-
-public class TestServer {
-
-	public static void main(String[] args) {
-		// TODO Auto-generated method stub
-		IServerManager server = new UDPServerManager("0.0.0.0", 8080, "utf-8", false, 10000);
-		server.Start();
-		while (true) {
-
-			PacketEntity p = server.PopRece();
-			if (p != null)
-
-			{
-				handlePacket2(server, p);
-			}
-			try {
-				Thread.sleep(2L);
-			} catch (InterruptedException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
-		}
-	}
-
-	private static void handlePacket2(IServerManager server, PacketEntity p) {
-		// TODO Auto-generated method stub
-		LogUtil.info(server.Name() + " PopRece:" + p.address + " " + p.content.packetString);
-
-	}
-}

+ 19 - 43
collect/src/main/java/com/saga/thread/common/CheckThread.java

@@ -24,11 +24,6 @@ public class CheckThread extends Thread {
 	private Map<String, String> projectStatus = new HashMap<String, String>();
 	private Map<String, String> physicalStatus = new HashMap<String, String>();
 
-	private Map<String, String> dbPointStatus = new HashMap<String, String>();
-	private Map<String, String> dbMeterStatus = new HashMap<String, String>();
-	private Map<String, String> dbProjectStatus = new HashMap<String, String>();
-	private Map<String, String> dbPhysicalStatus = new HashMap<String, String>();
-
 	public CheckThread() {
 		try {
 			// this.agent = agent;
@@ -47,18 +42,15 @@ public class CheckThread extends Thread {
 		LogUtil.info("CheckThread-" + this.getName() + " Starting ...");
 		// 初次加载生成当前状态
 		this.excuteDBStatus();
-		// 获取DB当前状态
 		this.loadDBStatus();
 
 		while (true) {
 			try {
-
 				// // V1.0点位日志结构
 				// this.realCheck();
 				// V2.0点位日志结构
 				this.realCheck2();
 				// Constant.showStatus();
-				this.DBStatus();
 				Thread.sleep(Constant.Millisecond.SECOND_1);
 			} catch (Exception e) {
 				// TODO Auto-generated catch block
@@ -69,23 +61,18 @@ public class CheckThread extends Thread {
 
 	private void loadDBStatus() {
 		// TODO Auto-generated method stub
-		// 重新启动加载节点、点位状态
-		this.dbPointStatus = new HashMap<String, String>();
-		this.dbMeterStatus = new HashMap<String, String>();
-		this.dbProjectStatus = new HashMap<String, String>();
-		this.dbPhysicalStatus = new HashMap<String, String>();
+
 		for (ZillionAgent agent : Constant.agents) {
 			for (Entry<String, String> bd : Constant.BuildingDB.entrySet()) {
 				try {
 					String project = bd.getKey();
 					String db = bd.getValue();
-					this.dbPhysicalStatus
-							.putAll(HBaseUtil.ps_physical_status(agent, db, "ps_physical_status", project));
-					this.dbMeterStatus
+					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.dbPointStatus
+					this.pointStatus
 							.putAll(HBaseUtil.ps_virtual_point_status(agent, db, "ps_virtual_point_status", project));
-					this.dbProjectStatus.putAll(
+					this.projectStatus.putAll(
 							HBaseUtil.ps_virtual_project_status(agent, db, "ps_virtual_project_status", project));
 
 				} catch (Exception e) {
@@ -98,19 +85,6 @@ public class CheckThread extends Thread {
 		}
 	}
 
-	private void DBStatus() {
-		// TODO Auto-generated method stub
-
-		this.dbPhysicalStatus = this.physicalStatus;
-
-		this.dbMeterStatus = this.meterStatus;
-
-		this.dbPointStatus = this.pointStatus;
-
-		this.dbProjectStatus = this.projectStatus;
-
-	}
-
 	private void excuteDBStatus() {
 		// TODO Auto-generated method stub
 		// for (Entry<String, Long> pns : Constant.ps_NodeStatus.entrySet()) {
@@ -211,9 +185,7 @@ public class CheckThread extends Thread {
 					// 首次
 					!this.projectStatus.containsKey(project) || null == this.projectStatus.get(project) ||
 					// 已有记录且状态发生变化
-							!status.equalsIgnoreCase(this.projectStatus.get(project)) ||
-							// DB同步
-							!status.equalsIgnoreCase(this.dbProjectStatus.get(project))) {
+							!status.equalsIgnoreCase(this.projectStatus.get(project))) {
 						Constant.Insert_agents_ps_virtual_project_log(project, Constant.format(new Date()), status);
 						if ("disconn".equalsIgnoreCase(status)) {
 							Constant.Insert_agents_ps_virtual_project_status(project, status,
@@ -249,9 +221,7 @@ public class CheckThread extends Thread {
 					// 首次
 					!this.meterStatus.containsKey(pm) || null == this.meterStatus.get(pm) ||
 					// 已有记录且状态发生变化
-							!status.equalsIgnoreCase(this.meterStatus.get(pm))
-							// DB同步
-							|| !status.equalsIgnoreCase(this.dbMeterStatus.get(pm))) {
+							!status.equalsIgnoreCase(this.meterStatus.get(pm))) {
 						Constant.Insert_agents_ps_virtual_meter_log(project, meter, "up", Constant.format(new Date()),
 								status);
 						if ("disconn".equalsIgnoreCase(status)) {
@@ -305,9 +275,7 @@ public class CheckThread extends Thread {
 					// 首次
 					!this.physicalStatus.containsKey(physical) || null == this.physicalStatus.get(physical) ||
 					// 已有记录且状态发生变化
-							!status.equalsIgnoreCase(this.physicalStatus.get(physical)) ||
-							// DB同步
-							!status.equalsIgnoreCase(this.dbPhysicalStatus.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);
 
@@ -526,9 +494,7 @@ public class CheckThread extends Thread {
 					}
 				} else if (
 				// 已有记录且状态发生变化
-				(!status.equalsIgnoreCase(this.pointStatus.get(pointUp.getKey()))) ||
-				// DB同步
-						(!status.equalsIgnoreCase(this.dbPointStatus.get(pointUp.getKey())))) {
+				(!status.equalsIgnoreCase(this.pointStatus.get(pointUp.getKey())))) {
 					// 添加Log记录
 					if (Constant.RecordAddress.containsKey(building + "-" + point.replace(".", "-"))) {
 						if (Constant.RecordAddress.get(building + "-" + point.replace(".", "-")) != null) {
@@ -548,6 +514,16 @@ public class CheckThread extends Thread {
 										"up", status, pointUp.getValue(), "");
 							}
 						}
+					} else {
+						Constant.Insert_agents_ps_virtual_point_log(building, meter, Long.valueOf(funcid), "up",
+								pointUp.getValue(), 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(), "");
+						}
 					}
 				}
 				// 更新Status

+ 0 - 49
collect/src/main/java/com/saga/thread/common/ExcuteAckThread.java

@@ -1,49 +0,0 @@
-package com.saga.thread.common;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map.Entry;
-
-import org.zillion.util.log.LogUtil;
-
-import com.saga.util.Constant;
-
-public class ExcuteAckThread extends Thread {
-	public void run() {
-		LogUtil.info("ExcuteAckThread-" + this.getName() + " Starting ...");
-
-		while (true) {
-			try {
-				excuteAckList();
-				Thread.sleep(10L);
-
-			} catch (Exception e) {
-				// TODO Auto-generated catch block
-				LogUtil.error("ExcuteAckThread.run.Exception: " + e.toString());
-			}
-		}
-	}
-
-	private void excuteAckList() {
-		synchronized (Constant.ackList) {
-			for (Entry<String, List<String>> ack : Constant.ackList.entrySet()) {
-				StringBuffer cmd = new StringBuffer();
-				for (int i = 0; i < ack.getValue().size(); i++) {
-					cmd.append(ack.getValue().get(i));
-					if ((i > 0) && (i % 50 == 0 || i == ack.getValue().size() - 1)) {
-						synchronized (Constant.ackListResult) {
-							if (!Constant.ackListResult.containsKey(ack.getKey())) {
-								Constant.ackListResult.put(ack.getKey(), new ArrayList<String>());
-							}
-							Constant.ackListResult.get(ack.getKey()).add(cmd.toString());
-						}
-						cmd = new StringBuffer();
-					} else {
-						cmd.append("&");
-					}
-				}
-			}
-			Constant.ackList.clear();
-		}
-	}
-}

+ 104 - 131
collect/src/main/java/com/saga/thread/common/SaveThread.java

@@ -2,24 +2,19 @@ package com.saga.thread.common;
 
 import java.util.ArrayList;
 import java.util.Date;
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
 
 import org.zillion.util.log.LogUtil;
 
 import com.saga.entity.Record;
-import com.saga.entity.Report;
 import com.saga.util.Constant;
 
 public class SaveThread extends Thread {
 	// private List<String> pointCommunicationList = new ArrayList<String>();
 	// private String ip = null;
-
-	private Map<String, List<String>> streportList = new HashMap<String, List<String>>();
-	private List<Report> strecordList = new ArrayList<Report>();
+	private List<String> streportList = new ArrayList<String>();
+	private List<Record> strecordList = new ArrayList<Record>();
 
 	public SaveThread() {
 		try {
@@ -73,15 +68,7 @@ public class SaveThread extends Thread {
 			synchronized (Constant.CollectReportList) {
 				if (Constant.CollectReportList.size() > 0) {
 					LogUtil.info("Constant.CollectReportList:" + Constant.CollectReportList.size());
-					for (Entry<String, List<String>> cr : Constant.CollectReportList.entrySet()) {
-						if (!this.streportList.containsKey(cr.getKey())) {
-							this.streportList.put(cr.getKey(), new ArrayList<String>());
-						}
-						this.streportList.get(cr.getKey()).addAll(cr.getValue());
-						Constant.collectReportCount += cr.getValue().size();
-						LogUtil.info("ReportList." + cr.getKey() + ":" + cr.getValue().size());
-					}
-
+					this.streportList.addAll(Constant.CollectReportList);
 					Constant.CollectReportList.clear();
 					// Constant.CollectReportList = new ArrayList<String>();
 					LogUtil.info("Constant.CollectReportList:" + Constant.CollectReportList.size());
@@ -95,147 +82,133 @@ public class SaveThread extends Thread {
 					return;
 				}
 			}
-
+			Constant.collectReportCount += this.streportList.size();
+			LogUtil.info("ReportList:" + this.streportList.size());
 			int seq = 0;
-			Map<String, String> recvlist = new HashMap<String, String>();
-			for (Entry<String, List<String>> rl : this.streportList.entrySet()) {
-				recvlist.put(rl.getKey(), rl.getKey());
-			}
-			for (Entry<String, String> r : recvlist.entrySet()) {
-				while (this.streportList.get(r.getKey()).size() > 0) {
-					seq++;
-					LogUtil.info("ReportList:" + this.streportList.get(r.getKey()).size() + " seq:" + seq);
-					int no = 5000 > this.streportList.get(r.getKey()).size() ? this.streportList.get(r.getKey()).size()
-							: 5000;
-					if (no == 5000 || seq > 1) {
-						LogUtil.info("ReportList:" + this.streportList.get(r.getKey()).size() + " seq:" + seq);
-					}
-					String b = this.streportList.get(r.getKey()).get(0).replace("(", "").replace(")", "").replace("",
-							"");
-					if (b == null || b.length() == 0) {
-						this.streportList.get(r.getKey()).remove(0);
-						return;
-					}
-					b = this.streportList.get(r.getKey()).get(0).replace("(", "").replace(")", "").replace(" ", "")
-							.split(";")[0];
 
-					while (Constant.RecordListToDB.size() > 0) {
-						if (Constant.RecordListToDB.size() == 0) {
-							break;
-						} else {
-							Thread.sleep(3L);
-						}
-						Thread.sleep(1L);
-					}
+			while (this.streportList.size() > 0) {
+				seq++;
+				LogUtil.info("ReportList:" + this.streportList.size() + " seq:" + seq);
+				int no = 5000 > this.streportList.size() ? this.streportList.size() : 5000;
+				if (no == 5000 || seq > 1) {
+					LogUtil.info("ReportList:" + this.streportList.size() + " seq:" + seq);
+				}
+				String b = this.streportList.get(0).replace("(", "").replace(")", "").replace("", "");
+				if (b == null || b.length() == 0) {
+					this.streportList.remove(0);
+					return;
+				}
+				b = this.streportList.get(0).replace("(", "").replace(")", "").replace(" ", "").split(";")[0];
 
-					// recordList = new ArrayList<Record>();
-					if (this.strecordList.size() > 0) {
-						LogUtil.info("SaveThread.recordList " + this.strecordList.size());
-						this.strecordList.clear();
-						System.gc();
+				while (Constant.RecordListToDB.size() > 0) {
+					if (Constant.RecordListToDB.size() == 0) {
+						break;
+					} else {
+						Thread.sleep(3L);
 					}
-					Iterator<String> it = this.streportList.get(r.getKey()).iterator();
-					int c = 0;
-					synchronized (Constant.ps_PointStatusUp) {
-						while (it.hasNext()) {
-							try {
-								String report = it.next().replace("(", "").replace(")", "").replace(" ", "");
-								if (c < no) {
-									if (report != null) {
-										String[] rList = report.replace("(", "").replace(")", "").replace(" ", "")
-												.split(";");
-										if (rList != null && rList.length > 8) {
-											String building = rList[0];
-											if (!building.equalsIgnoreCase(b)) {
-												continue;
-											}
-											String mac = rList[1];
-											String function = rList[2];
-											Date time = Constant.parse(rList[3]);
-											String meter = rList[5];
-											int count = Integer.valueOf(rList[6]);
-											int id = Integer.valueOf(rList[4]);
+					Thread.sleep(1L);
+				}
+
+				// recordList = new ArrayList<Record>();
+				if (this.strecordList.size() > 0) {
+					LogUtil.warn("SaveThread.recordList " + this.strecordList.size());
+					this.strecordList.clear();
+					System.gc();
+				}
+				Iterator<String> it = this.streportList.iterator();
+				int c = 0;
+				synchronized (Constant.ps_PointStatusUp) {
+					while (it.hasNext()) {
+						try {
+							String report = it.next().replace("(", "").replace(")", "").replace(" ", "");
+							if (c < no) {
+								if (report != null) {
+									String[] rList = report.replace("(", "").replace(")", "").replace(" ", "")
+											.split(";");
+									if (rList != null && rList.length > 8) {
+										String building = rList[0];
+										if (!building.equalsIgnoreCase(b)) {
+											continue;
+										}
+										//String mac = rList[1];
+										String function = rList[2];
+										Date time = Constant.parse(rList[3]);
+										String meter = rList[5];
+										int count = Integer.valueOf(rList[6]);
+										// String id = rList[4];
 
-											for (int i = 0; i < count; i++) {
-												Report report2 = new Report();
-												Record record = new Record();
-												if ("report".equalsIgnoreCase(function)) {
-													record.funcID = Integer.valueOf(rList[7 + 2 * i]);
-													record.data = Double.valueOf(rList[8 + 2 * i]);
-													// synchronized
-													// (Constant.pointListUp) {
-													Constant.ps_PointStatusUp.put(
-															building + "-" + meter + "." + record.funcID,
-															System.currentTimeMillis());
-													// }
+										for (int i = 0; i < count; i++) {
+											Record record = new Record();
+											if ("report".equalsIgnoreCase(function)) {
+												record.funcID = Integer.valueOf(rList[7 + 2 * i]);
+												record.data = Double.valueOf(rList[8 + 2 * i]);
+												// synchronized
+												// (Constant.pointListUp) {
+												Constant.ps_PointStatusUp.put(
+														building + "-" + meter + "." + record.funcID,
+														System.currentTimeMillis());
+												// }
 
-												} else if ("reportaddtion".equalsIgnoreCase(function)) {
-													record.funcID = Integer.valueOf(rList[7 + 3 * i]);
-													record.data = Double.valueOf(rList[8 + 3 * i]);
-													record.addtion = "null".equalsIgnoreCase(rList[9 + i * 3]) ? ""
-															: (rList[9 + i * 3]);
-													// synchronized
-													// (Constant.pointListUp) {
-													Constant.ps_PointStatusUp.put(
-															building + "-" + meter + "." + record.funcID,
-															System.currentTimeMillis());
+											} else if ("reportaddtion".equalsIgnoreCase(function)) {
+												record.funcID = Integer.valueOf(rList[7 + 3 * i]);
+												record.data = Double.valueOf(rList[8 + 3 * i]);
+												record.addtion = "null".equalsIgnoreCase(rList[9 + i * 3]) ? ""
+														: (rList[9 + i * 3]);
+												// synchronized
+												// (Constant.pointListUp) {
+												Constant.ps_PointStatusUp.put(
+														building + "-" + meter + "." + record.funcID,
+														System.currentTimeMillis());
 
-													// }
-												}
+												// }
+											}
 
-												record.buildingSign = building;
-												record.meterSign = meter;
-												record.receivetime = time;
-												report2.record = record;
+											record.buildingSign = building;
+											record.meterSign = meter;
+											record.receivetime = time;
 
-												report2.ReportID = id;
-												report2.mac = mac;
-												report2.UploadName = r.getKey();
-												report2.ReportType = function;
-												this.strecordList.add(report2);
+											this.strecordList.add(record);
 
-											}
-											it.remove();
-											// LogUtil.info("HBase.BatchInsert "
-											// +
-											// report);
-										} else {
-											it.remove();
 										}
-
+										it.remove();
+										// LogUtil.info("HBase.BatchInsert "
+										// +
+										// report);
 									} else {
 										it.remove();
 									}
+
 								} else {
-									break;
+									it.remove();
 								}
-								c++;
-								// Thread.sleep(1L);
-							} catch (Exception e) {
-								// TODO Auto-generated catch block
-								it.remove();
-								LogUtil.error("SaveThread.run.Exception: " + e.toString());
+							} else {
+								break;
 							}
+							c++;
+							// Thread.sleep(1L);
+						} catch (Exception e) {
+							// TODO Auto-generated catch block
+							it.remove();
+							LogUtil.error("SaveThread.run.Exception: " + e.toString());
 						}
 					}
+				}
 
-					Constant.RecordListToDB.addAll(this.strecordList);
-					Constant.report2DBCount += this.strecordList.size();
-					LogUtil.info("Constant.RecordListToDB add " + this.strecordList.size());
-					// recordList = new ArrayList<Record>();
-					this.strecordList.clear();
+				Constant.RecordListToDB.addAll(this.strecordList);
+				Constant.report2DBCount += this.strecordList.size();
+				LogUtil.info("Constant.RecordListToDB add " + this.strecordList.size());
+				// recordList = new ArrayList<Record>();
+				this.strecordList.clear();
 
-					Thread.sleep(1L);
+				Thread.sleep(1L);
 
-					// Thread.sleep(Constant.Millisecond.SECOND_1);
-				}
+				// Thread.sleep(Constant.Millisecond.SECOND_1);
 			}
-
 			if (this.streportList.size() > 0) {
-				LogUtil.info("SaveThread.reportList " + streportList.size());
+				LogUtil.warn("SaveThread.reportList " + streportList.size());
 				this.streportList.clear();
 				System.gc();
-				LogUtil.info("SaveThread.reportList " + streportList.size());
+				LogUtil.warn("SaveThread.reportList " + streportList.size());
 			}
 		} catch (Exception e) {
 			// TODO Auto-generated catch block

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

@@ -11,14 +11,13 @@ import java.util.List;
 import org.zillion.util.log.LogUtil;
 
 import com.saga.entity.Record;
-import com.saga.entity.Report;
 import com.saga.util.Constant;
 
 public class WTDBThread extends Thread {
 	// ZillionAgent agent;
 	long realCheck = 0;
 	// private String ip = null;
-	private List<Report> wtdbrecordList = new ArrayList<Report>();
+	private List<Record> wtdbrecordList = new ArrayList<Record>();
 	// private Map<String, String> nodeStatus = new HashMap<String, String>();
 	// private Map<String, String> pointStatus = new HashMap<String, String>();
 
@@ -55,7 +54,7 @@ public class WTDBThread extends Thread {
 						// + Constant.RecordListToDB.size());
 						wtdbrecordList.addAll(Constant.RecordListToDB);
 						LogUtil.info("Constant.RecordListToDB remove " + wtdbrecordList.size());
-						Constant.RecordListToDB = new ArrayList<Report>();
+						Constant.RecordListToDB = new ArrayList<Record>();
 
 						// LogUtil.info(
 						// this.getName() + " Constant.RecordListToDB.size(): "
@@ -63,19 +62,18 @@ public class WTDBThread extends Thread {
 					}
 				}
 				if (wtdbrecordList.size() > 0) {
-					String b = wtdbrecordList.get(0).record.buildingSign;
+					String b = wtdbrecordList.get(0).buildingSign;
 					if (Constant.BuildingConv.containsKey(b)) {
 						b = Constant.BuildingConv.get(b);
 					}
 					// HBaseUtil.BatchInsert(Constant.agent,
 					// Constant.BuildingDB.get(b), wtdbrecordList);
 					Constant.AgentsBatchInsert(Constant.BuildingDB.get(b), wtdbrecordList);
-					this.addAck(wtdbrecordList);
 					// LogUtil.info(this.getName() + " recordList size: " +
 					// recordList.size());
 					// LogUtil.info(this.getName() + " HBaseUtil.BatchInsert
 					// size: " + recordList.size());
-					wtdbrecordList = new ArrayList<Report>();
+					wtdbrecordList = new ArrayList<Record>();
 					// LogUtil.info(this.getName() + " recordList size: " +
 					// recordList.size());
 				}
@@ -88,22 +86,6 @@ public class WTDBThread extends Thread {
 		}
 	}
 
-	private void addAck(List<Report> wtdbrecordList2) {
-		// TODO Auto-generated method stub
-		synchronized (Constant.ackList) {
-			for (Report r : wtdbrecordList2) {
-				if (!Constant.ackList.containsKey(r.UploadName)) {
-					Constant.ackList.put(r.UploadName, new ArrayList<String>());
-				}
-				// 1101070037;1;reportack;;123
-				StringBuffer sb = new StringBuffer();
-				sb.append(r.record.buildingSign).append(";").append(r.mac).append(";").append(r.ReportType)
-						.append("ack").append(";;").append(r.ReportID);
-				Constant.ackList.get(r.UploadName).add(sb.toString());
-			}
-		}
-	}
-
 	// private void insertCollectorCommunicationLog(String building, String mac)
 	// {
 	// // TODO Auto-generated method stub

+ 12 - 45
collect/src/main/java/com/saga/thread/down/CollectThread.java

@@ -1,6 +1,5 @@
 package com.saga.thread.down;
 
-import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
@@ -41,24 +40,24 @@ public class CollectThread extends Thread {
 			// }
 			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, 10000));
+				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, 10000, (byte) '(', (byte) ')'));
+						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, 10000));
+					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, 10000, (byte) '(', (byte) ')'));
+							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, 10000));
+					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, 10000, (byte) '(', (byte) ')'));
+							new TCPServerManager("0.0.0.0", this.port, "utf-8", false, 1000, (byte) '(', (byte) ')'));
 				}
 			}
 
@@ -97,15 +96,11 @@ public class CollectThread extends Thread {
 					{
 						this.handlePacket2(server.getValue(), p);
 						this.handlePointSet2();
-						// this.ack(server.getValue());
 
 					}
-				}
-				Thread.sleep(1L);
-				// synchronized (Constant.ackListResult) {
-				// Constant.ackListResult.clear();
-				// }
 
+					Thread.sleep(1L);
+				}
 				// Thread.sleep(3L);
 			} catch (Exception e) {
 				// TODO Auto-generated catch block
@@ -114,21 +109,6 @@ public class CollectThread extends Thread {
 		}
 	}
 
-	private void ack(IServerManager server) {
-		// TODO Auto-generated method stub
-		synchronized (Constant.ackListResult) {
-			for (Entry<String, List<String>> ack : Constant.ackListResult.entrySet()) {
-				for (String cmd : ack.getValue()) {
-					try {
-						server.AppendToSend(ack.getKey(), new Packet(cmd));
-					} catch (Exception e) {
-						// e.printStackTrace();
-					}
-				}
-			}
-		}
-	}
-
 	private void handlePointSet2() {
 		// TODO Auto-generated method stub
 		try {
@@ -302,8 +282,7 @@ public class CollectThread extends Thread {
 							if (Constant.BuildingAdds.containsKey(rList[0])) {
 								for (String building : Constant.BuildingAdds.get(rList[0])) {
 									String newData = s.replace(rList[0], building);
-									this.addReport(p.address, newData);
-									// Constant.CollectReportList.add(newData);
+									Constant.CollectReportList.add(newData);
 									// LogUtil.info("Constant.CollectReportList
 									// add:" + newData);
 									// String key = building + "-" + rList[1] +
@@ -312,8 +291,7 @@ public class CollectThread extends Thread {
 									// System.currentTimeMillis());
 								}
 							} else {
-								this.addReport(p.address, s);
-								// Constant.CollectReportList.add(s);
+								Constant.CollectReportList.add(s);
 								// LogUtil.info("rList[0]:" + rList[0]);
 								// String key = rList[0] + "-" + rList[1] + "-"
 								// + rList[4];
@@ -354,8 +332,7 @@ public class CollectThread extends Thread {
 							if (Constant.BuildingAdds.containsKey(rList[0])) {
 								for (String building : Constant.BuildingAdds.get(rList[0])) {
 									String newData = s.replace(rList[0], building);
-									this.addReport(p.address, newData);
-									// Constant.CollectReportList.add(newData);
+									Constant.CollectReportList.add(newData);
 									// LogUtil.info("Constant.CollectReportList
 									// add:" + newData);
 									// String key = building + "-" + rList[1] +
@@ -364,8 +341,7 @@ public class CollectThread extends Thread {
 									// System.currentTimeMillis());
 								}
 							} else {
-								this.addReport(p.address, s);
-								// Constant.CollectReportList.add(s);
+								Constant.CollectReportList.add(s);
 								// LogUtil.info("rList[0]:" + rList[0]);
 								// String key = rList[0] + "-" + rList[1] + "-"
 								// + rList[4];
@@ -591,15 +567,6 @@ public class CollectThread extends Thread {
 		}
 	}
 
-	private void addReport(String address, String data) {
-		// TODO Auto-generated method stub
-
-		if (!Constant.CollectReportList.containsKey(address)) {
-			Constant.CollectReportList.put(address, new ArrayList<String>());
-		}
-		Constant.CollectReportList.get(address).add(data);
-	}
-
 	private void getPointList(String address, String[] rList) {
 		// TODO Auto-generated method stub
 		String key = rList[0] + "-" + rList[1] + "-" + address;

+ 4 - 7
collect/src/main/java/com/saga/util/Constant.java

@@ -26,7 +26,6 @@ import com.google.gson.JsonParser;
 import com.saga.entity.Data;
 import com.saga.entity.PointSet;
 import com.saga.entity.Record;
-import com.saga.entity.Report;
 import com.zillion.database.agent.ZillionAgent;
 
 public class Constant {
@@ -34,12 +33,12 @@ public class Constant {
 	public static int InsertThread = 1;
 	// public static ZillionAgent agent;
 	public static List<ZillionAgent> agents = new ArrayList<ZillionAgent>();
-	// public static boolean DBConn = true;
+	public static boolean DBConn = true;
 	public static String WaitingTimeControl = "5Second";
 	public static File setlog = new File(System.getProperty("user.dir") + "/setlog.log");
-	public static Map<String, List<String>> CollectReportList = new HashMap<String, List<String>>();
+	public static List<String> CollectReportList = new ArrayList<String>();
 
-	public static List<Report> RecordListToDB = new ArrayList<Report>();
+	public static List<Record> RecordListToDB = new ArrayList<Record>();
 	public static Map<String, String> Meter_Collector = new HashMap<String, String>();
 	public static Map<String, String> Meter_Collector_Control = new HashMap<String, String>();
 	public static List<PointSet> pointSetList = new ArrayList<PointSet>();
@@ -86,8 +85,6 @@ public class Constant {
 	public static int collectReportCount = 0;
 	public static int report2DBCount = 0;
 	public static Map<String, String> pointMAC = new HashMap<String, String>();
-	public static Map<String, List<String>> ackList = new HashMap<String, List<String>>();
-	public static Map<String, List<String>> ackListResult = new HashMap<String, List<String>>();
 
 	static {
 		String resource = "\\config.json";
@@ -577,7 +574,7 @@ public class Constant {
 		}
 	}
 
-	public static void AgentsBatchInsert(String db, List<Report> wtdbrecordList) {
+	public static void AgentsBatchInsert(String db, List<Record> wtdbrecordList) {
 		// TODO Auto-generated method stub
 		for (ZillionAgent agent : Constant.agents) {
 			try {

+ 145 - 144
collect/src/main/java/com/saga/util/HBaseUtil.java

@@ -11,12 +11,153 @@ import org.zillion.util.log.LogUtil;
 
 import com.saga.entity.PointSet;
 import com.saga.entity.Record;
-import com.saga.entity.Report;
 import com.sagacloud.json.JSONArray;
 import com.sagacloud.json.JSONObject;
 import com.zillion.database.agent.ZillionAgent;
 
 public class HBaseUtil {
+	public static Map<String, String> ps_physical_status(ZillionAgent agent, String db, String tb, String project)
+			throws Exception {
+		// 序号 名称 数据类型 释义 备注
+		// 1 project String 项目名 主键
+		// 2 address_1 String 一级地址 主键
+		// 3 address_2 String 二级地址 主键
+		// 4 address_3 String 三级地址 主键
+		// 5 address_4 String 四级地址 主键
+		// 6 status String 状态 conn/disconn
+		// 7 receivetime String 时间 最近通讯时间
+		// 8 detail String 详情
+		Map<String, String> dbPhysicalStatus = new HashMap<String, String>();
+		JSONObject Criteria = new JSONObject();
+		Criteria.put("project", project);
+
+		JSONObject wrapperObject = new JSONObject();
+		wrapperObject.put("QueryType", "select");
+		wrapperObject.put("Database", db);
+		wrapperObject.put("Datatable", tb);
+		wrapperObject.put("Criteria", Criteria);
+		JSONObject queryResult = agent.Query(wrapperObject);
+		JSONArray resultContent = (JSONArray) queryResult.get("Content");
+		for (int i = 0; i < resultContent.size(); i++) {
+			JSONObject dataItem = (JSONObject) resultContent.get(i);
+			String address_1 = (String) dataItem.get("address_1");
+			String address_2 = (String) dataItem.get("address_2");
+			String address_3 = (String) dataItem.get("address_3");
+			String address_4 = (String) dataItem.get("address_4");
+			String key = project + ";" + address_1 + ";" + address_2 + ";" + address_3 + ";" + address_4;
+			String status = (String) dataItem.get("status");
+			dbPhysicalStatus.put(key, status);
+
+		}
+		return dbPhysicalStatus;
+	}
+
+	public static Map<String, String> ps_virtual_point_status(ZillionAgent agent, String db, String tb, String project)
+			throws Exception {
+		// 序号 名称 数据类型 释义 备注
+		// 1 project String 项目名 主键
+		// 2 meter String 仪表 主键
+		// 3 funcid Long 功能号 主键
+		// 4 updown String 上/下行 主键
+		// 5 status String 状态
+		// 6 receivetime String 时间
+		// 7 detail String 详情
+		Map<String, String> dbPointStatus = new HashMap<String, String>();
+
+		JSONObject Criteria = new JSONObject();
+		Criteria.put("project", project);
+
+		JSONObject wrapperObject = new JSONObject();
+		wrapperObject.put("QueryType", "select");
+		wrapperObject.put("Database", db);
+		wrapperObject.put("Datatable", tb);
+		wrapperObject.put("Criteria", Criteria);
+		JSONObject queryResult = agent.Query(wrapperObject);
+		JSONArray resultContent = (JSONArray) queryResult.get("Content");
+
+		for (int i = 0; i < resultContent.size(); i++) {
+			JSONObject dataItem = (JSONObject) resultContent.get(i);
+			String meter = (String) dataItem.get("meter");
+			long funcid = (long) dataItem.get("funcid");
+			String updown = (String) dataItem.get("updown");
+			if ("up".equalsIgnoreCase(updown)) {
+				String key = project + "-" + meter + "." + funcid;
+				String status = (String) dataItem.get("status");
+				dbPointStatus.put(key, status);
+			}
+		}
+		return dbPointStatus;
+	}
+
+	public static Map<String, String> ps_virtual_meter_status(ZillionAgent agent, String db, String tb, String project)
+			throws Exception {
+		// 序号 名称 数据类型 释义 备注
+		// 1 project String 项目名 主键
+		// 2 meter String 仪表 主键
+		// 3 updown String 上/下行 主键
+		// 4 status String 状态
+		// 5 receivetime String 时间
+		// 6 detail String 详情
+
+		Map<String, String> dbMeterStatus = new HashMap<String, String>();
+
+		JSONObject Criteria = new JSONObject();
+		Criteria.put("project", project);
+
+		JSONObject wrapperObject = new JSONObject();
+		wrapperObject.put("QueryType", "select");
+		wrapperObject.put("Database", db);
+		wrapperObject.put("Datatable", tb);
+		wrapperObject.put("Criteria", Criteria);
+		JSONObject queryResult = agent.Query(wrapperObject);
+		JSONArray resultContent = (JSONArray) queryResult.get("Content");
+
+		for (int i = 0; i < resultContent.size(); i++) {
+			JSONObject dataItem = (JSONObject) resultContent.get(i);
+			String meter = (String) dataItem.get("meter");
+			String updown = (String) dataItem.get("updown");
+			if ("up".equalsIgnoreCase(updown)) {
+				String key = project + "-" + meter;
+				String status = (String) dataItem.get("status");
+				dbMeterStatus.put(key, status);
+
+			}
+		}
+		return dbMeterStatus;
+	}
+
+	public static Map<String, String> ps_virtual_project_status(ZillionAgent agent, String db, String tb,
+			String project) throws Exception {
+		// 序号 名称 数据类型 释义 备注
+		// 1 project String 项目名 主键
+		// 2 status String 状态
+		// 3 receivetime String 时间
+		// 4 detail String 详情
+
+		Map<String, String> dbProjectStatus = new HashMap<String, String>();
+
+		JSONObject Criteria = new JSONObject();
+		Criteria.put("project", project);
+
+		JSONObject wrapperObject = new JSONObject();
+		wrapperObject.put("QueryType", "select");
+		wrapperObject.put("Database", db);
+		wrapperObject.put("Datatable", tb);
+		wrapperObject.put("Criteria", Criteria);
+		JSONObject queryResult = agent.Query(wrapperObject);
+		JSONArray resultContent = (JSONArray) queryResult.get("Content");
+
+		for (int i = 0; i < resultContent.size(); i++) {
+			JSONObject dataItem = (JSONObject) resultContent.get(i);
+
+			String key = project;
+			String status = (String) dataItem.get("status");
+			dbProjectStatus.put(key, status);
+
+		}
+		return dbProjectStatus;
+	}
+
 	public static void LoadDB2Cache_dy_pointlist(ZillionAgent agent, String db, String tb, String project)
 			throws Exception {
 		// 序号 名称 数据类型 释义 备注
@@ -1876,7 +2017,7 @@ public class HBaseUtil {
 	// }
 	// }
 
-	public static void BatchInsert(ZillionAgent agent, String DB, List<Report> dataList) throws Exception {
+	public static void BatchInsert(ZillionAgent agent, String DB, List<Record> dataList) throws Exception {
 		JSONArray InsertObjects = new JSONArray();
 		try {
 			boolean history = false;
@@ -1893,7 +2034,7 @@ public class HBaseUtil {
 			if (DB != null && dataList.size() > 0) {
 				for (int i = 0; i < dataList.size(); i++) {
 
-					Record data = dataList.get(i).record;
+					Record data = dataList.get(i);
 
 					JSONObject InsertObject = new JSONObject();
 					InsertObject.put("building", data.buildingSign);
@@ -1934,7 +2075,7 @@ public class HBaseUtil {
 
 		} catch (Exception e) {
 			LogUtil.error(agent.getFull_name() + " HBaseUtil.BatchInsert.Exception: " + e.toString());
-			// Constant.DBConn = false;
+			Constant.DBConn = false;
 		}
 	}
 
@@ -2080,144 +2221,4 @@ public class HBaseUtil {
 		}
 	}
 
-	public static Map<String, String> ps_physical_status(ZillionAgent agent, String db, String tb, String project) throws Exception {
-		// 序号 名称 数据类型 释义 备注
-		// 1 project String 项目名 主键
-		// 2 address_1 String 一级地址 主键
-		// 3 address_2 String 二级地址 主键
-		// 4 address_3 String 三级地址 主键
-		// 5 address_4 String 四级地址 主键
-		// 6 status String 状态 conn/disconn
-		// 7 receivetime String 时间 最近通讯时间
-		// 8 detail String 详情
-		Map<String, String> dbPhysicalStatus = new HashMap<String, String>();
-		JSONObject Criteria = new JSONObject();
-		Criteria.put("project", project);
-
-		JSONObject wrapperObject = new JSONObject();
-		wrapperObject.put("QueryType", "select");
-		wrapperObject.put("Database", db);
-		wrapperObject.put("Datatable", tb);
-		wrapperObject.put("Criteria", Criteria);
-		JSONObject queryResult = agent.Query(wrapperObject);
-		JSONArray resultContent = (JSONArray) queryResult.get("Content");
-		for (int i = 0; i < resultContent.size(); i++) {
-			JSONObject dataItem = (JSONObject) resultContent.get(i);
-			String address_1 = (String) dataItem.get("address_1");
-			String address_2 = (String) dataItem.get("address_2");
-			String address_3 = (String) dataItem.get("address_3");
-			String address_4 = (String) dataItem.get("address_4");
-			String key = project + ";" + address_1 + ";" + address_2 + ";" + address_3 + ";" + address_4;
-			String status = (String) dataItem.get("status");
-			dbPhysicalStatus.put(key, status);
-
-		}
-		return dbPhysicalStatus;
-	}
-
-	public static Map<String, String> ps_virtual_point_status(ZillionAgent agent, String db, String tb, String project)
-			throws Exception {
-		// 序号 名称 数据类型 释义 备注
-		// 1 project String 项目名 主键
-		// 2 meter String 仪表 主键
-		// 3 funcid Long 功能号 主键
-		// 4 updown String 上/下行 主键
-		// 5 status String 状态
-		// 6 receivetime String 时间
-		// 7 detail String 详情
-		Map<String, String> dbPointStatus = new HashMap<String, String>();
-
-		JSONObject Criteria = new JSONObject();
-		Criteria.put("project", project);
-
-		JSONObject wrapperObject = new JSONObject();
-		wrapperObject.put("QueryType", "select");
-		wrapperObject.put("Database", db);
-		wrapperObject.put("Datatable", tb);
-		wrapperObject.put("Criteria", Criteria);
-		JSONObject queryResult = agent.Query(wrapperObject);
-		JSONArray resultContent = (JSONArray) queryResult.get("Content");
-
-		for (int i = 0; i < resultContent.size(); i++) {
-			JSONObject dataItem = (JSONObject) resultContent.get(i);
-			String meter = (String) dataItem.get("meter");
-			long funcid = (long) dataItem.get("funcid");
-			String updown = (String) dataItem.get("updown");
-			if ("up".equalsIgnoreCase(updown)) {
-				String key = project + "-" + meter + "." + funcid;
-				String status = (String) dataItem.get("status");
-				dbPointStatus.put(key, status);
-			}
-		}
-		return dbPointStatus;
-	}
-
-	public static Map<String, String> ps_virtual_meter_status(ZillionAgent agent, String db, String tb, String project)
-			throws Exception {
-		// 序号 名称 数据类型 释义 备注
-		// 1 project String 项目名 主键
-		// 2 meter String 仪表 主键
-		// 3 updown String 上/下行 主键
-		// 4 status String 状态
-		// 5 receivetime String 时间
-		// 6 detail String 详情
-
-		Map<String, String> dbMeterStatus = new HashMap<String, String>();
-
-		JSONObject Criteria = new JSONObject();
-		Criteria.put("project", project);
-
-		JSONObject wrapperObject = new JSONObject();
-		wrapperObject.put("QueryType", "select");
-		wrapperObject.put("Database", db);
-		wrapperObject.put("Datatable", tb);
-		wrapperObject.put("Criteria", Criteria);
-		JSONObject queryResult = agent.Query(wrapperObject);
-		JSONArray resultContent = (JSONArray) queryResult.get("Content");
-
-		for (int i = 0; i < resultContent.size(); i++) {
-			JSONObject dataItem = (JSONObject) resultContent.get(i);
-			String meter = (String) dataItem.get("meter");
-			String updown = (String) dataItem.get("updown");
-			if ("up".equalsIgnoreCase(updown)) {
-				String key = project + "-" + meter;
-				String status = (String) dataItem.get("status");
-				dbMeterStatus.put(key, status);
-
-			}
-		}
-		return dbMeterStatus;
-	}
-
-	public static Map<String, String> ps_virtual_project_status(ZillionAgent agent, String db, String tb,
-			String project) throws Exception {
-		// 序号 名称 数据类型 释义 备注
-		// 1 project String 项目名 主键
-		// 2 status String 状态
-		// 3 receivetime String 时间
-		// 4 detail String 详情
-
-		Map<String, String> dbProjectStatus = new HashMap<String, String>();
-
-		JSONObject Criteria = new JSONObject();
-		Criteria.put("project", project);
-
-		JSONObject wrapperObject = new JSONObject();
-		wrapperObject.put("QueryType", "select");
-		wrapperObject.put("Database", db);
-		wrapperObject.put("Datatable", tb);
-		wrapperObject.put("Criteria", Criteria);
-		JSONObject queryResult = agent.Query(wrapperObject);
-		JSONArray resultContent = (JSONArray) queryResult.get("Content");
-
-		for (int i = 0; i < resultContent.size(); i++) {
-			JSONObject dataItem = (JSONObject) resultContent.get(i);
-
-			String key = project;
-			String status = (String) dataItem.get("status");
-			dbProjectStatus.put(key, status);
-
-		}
-		return dbProjectStatus;
-	}
 }