Browse Source

添加数据同步协议。

Jay Lee 6 years ago
parent
commit
1a162bbb53
1 changed files with 18 additions and 0 deletions
  1. 18 0
      collect/src/main/java/com/saga/thread/down/CollectThread.java

+ 18 - 0
collect/src/main/java/com/saga/thread/down/CollectThread.java

@@ -401,6 +401,24 @@ public class CollectThread extends Thread {
 								new Packet(rList[0] + ";" + rList[1] + ";" + "pointcount" + ";" + "" + ";" + id));
 						LogUtil.info(server.Name() + " AppendToSend:" + p.address + " " + rList[0] + ";" + rList[1]
 								+ ";" + "pointcount" + ";" + "" + ";" + id);
+					} else if ("synchronization".equalsIgnoreCase(rList[2])) {
+						//// 1101070037;1;synchronizationack;;123;50;1001;11;20181213000000;1...
+
+						for (Record r : Constant.RecordList) {
+							if (rList[0].equalsIgnoreCase(r.buildingSign)) {
+
+								int id = Constant.getID();
+								server.AppendToSend(p.address,
+										new Packet(rList[0] + ";" + rList[1] + ";" + "synchronizationack" + ";" + ""
+												+ ";" + id + ";1;" + r.meterSign + ";" + r.funcID + ";"
+												+ Constant.format(r.receivetime) + ";" + r.data + ";"));
+								LogUtil.info(server.Name() + " AppendToSend:" + p.address + " "
+										+ (rList[0] + ";" + rList[1] + ";" + "synchronizationack" + ";" + "" + ";" + id
+												+ ";1;" + r.meterSign + ";" + r.funcID + ";"
+												+ Constant.format(r.receivetime) + ";" + r.data + ";"));
+							}
+						}
+
 					} else if ("heart".equalsIgnoreCase(rList[2])) {
 						sb.append(rList[0] + ";" + rList[1] + ";" + "heartack" + ";" + Constant.format(new Date()));
 						// server.AppendToSend(p.address, new Packet(