|
@@ -1,6 +1,5 @@
|
|
|
package com.saga.util;
|
|
|
|
|
|
-import java.io.File;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
@@ -99,7 +98,9 @@ public class HBaseUtil {
|
|
|
JSONObject dataItem = (JSONObject) resultContent.get(i);
|
|
|
|
|
|
String meter = (String) dataItem.get("meter");
|
|
|
- Integer funcid = (Integer) dataItem.get("funcid");
|
|
|
+ Long f = (long) dataItem.get("funcid");
|
|
|
+
|
|
|
+ Integer funcid = f.intValue();
|
|
|
if (!dbPointList.containsKey(meter)) {
|
|
|
dbPointList.put(meter, new ArrayList<Integer>());
|
|
|
}
|
|
@@ -409,6 +410,320 @@ public class HBaseUtil {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public static void CreateTable_dy_pointlist(ZillionAgent agent, String DB, String tableName) throws Exception {
|
|
|
+ // 序号 名称 数据类型 释义 备注
|
|
|
+ // 1 building String 楼号 主键
|
|
|
+ // 2 meter String 表号 主键
|
|
|
+ // 3 funcid Long 功能号 主键
|
|
|
+ // 4 system String 系统
|
|
|
+ // 5 source String 数据来源
|
|
|
+ // 6 address_1 String 一级地址 采集器网关ID
|
|
|
+ // 7 address_2 String 二级地址 总线端口号
|
|
|
+ // 8 address_3 String 三级地址 仪表地址
|
|
|
+ // 9 address_4 String 四级地址
|
|
|
+ // 10 collect_cycle String 采集频率 采集器上传频率
|
|
|
+ // 11 data_type String 点位类型
|
|
|
+ // Acc:累积变量;Inst:瞬时变量;Boolv:通断变量;Enumv:状态变量;Step:阶跃变量
|
|
|
+
|
|
|
+ if (!tableExist(agent, DB, tableName)) {
|
|
|
+ JSONArray Columns = new JSONArray();
|
|
|
+ Columns.add(CreateJSON("building", "String"));
|
|
|
+ Columns.add(CreateJSON("meter", "String"));
|
|
|
+ Columns.add(CreateJSON("funcid", "Long"));
|
|
|
+ Columns.add(CreateJSON("system", "String"));
|
|
|
+ Columns.add(CreateJSON("source", "String"));
|
|
|
+ Columns.add(CreateJSON("address_1", "String"));
|
|
|
+ Columns.add(CreateJSON("address_2", "String"));
|
|
|
+ Columns.add(CreateJSON("address_3", "String"));
|
|
|
+ Columns.add(CreateJSON("address_4", "String"));
|
|
|
+ Columns.add(CreateJSON("collect_cycle", "String"));
|
|
|
+ Columns.add(CreateJSON("data_type", "String"));
|
|
|
+
|
|
|
+ JSONArray Key = new JSONArray();
|
|
|
+ Key.add("building");
|
|
|
+ Key.add("meter");
|
|
|
+ Key.add("funcid");
|
|
|
+
|
|
|
+ JSONObject Definition = new JSONObject();
|
|
|
+ Definition.put("Columns", Columns);
|
|
|
+ Definition.put("Key", Key);
|
|
|
+ JSONArray Indexes = new JSONArray();
|
|
|
+ agent.DDL_AddTable(DB, tableName, Definition, Indexes);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void CreateTable_ps_physical_status(ZillionAgent agent, String DB, String tableName)
|
|
|
+ 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 详情
|
|
|
+
|
|
|
+ if (!tableExist(agent, DB, tableName)) {
|
|
|
+ JSONArray Columns = new JSONArray();
|
|
|
+ Columns.add(CreateJSON("project", "String"));
|
|
|
+ Columns.add(CreateJSON("address_1", "String"));
|
|
|
+ Columns.add(CreateJSON("address_2", "String"));
|
|
|
+ Columns.add(CreateJSON("address_3", "String"));
|
|
|
+ Columns.add(CreateJSON("address_4", "String"));
|
|
|
+ Columns.add(CreateJSON("status", "String"));
|
|
|
+ Columns.add(CreateJSON("receivetime", "String"));
|
|
|
+ Columns.add(CreateJSON("detail", "String"));
|
|
|
+
|
|
|
+ JSONArray Key = new JSONArray();
|
|
|
+ Key.add("project");
|
|
|
+ Key.add("address_1");
|
|
|
+ Key.add("address_2");
|
|
|
+ Key.add("address_3");
|
|
|
+ Key.add("address_4");
|
|
|
+
|
|
|
+ JSONObject Definition = new JSONObject();
|
|
|
+ Definition.put("Columns", Columns);
|
|
|
+ Definition.put("Key", Key);
|
|
|
+ JSONArray Indexes = new JSONArray();
|
|
|
+ agent.DDL_AddTable(DB, tableName, Definition, Indexes);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void CreateTable_ps_physical_log(ZillionAgent agent, String DB, String tableName) throws Exception {
|
|
|
+ // 序号 名称 数据类型 释义 备注
|
|
|
+ // 1 project String 项目名 主键
|
|
|
+ // 2 address_1 String 一级地址 主键
|
|
|
+ // 3 address_2 String 二级地址 主键
|
|
|
+ // 4 address_3 String 三级地址 主键
|
|
|
+ // 5 address_4 String 四级地址 主键
|
|
|
+ // 6 receivetime String 时间 主键,触发时间
|
|
|
+ // 7 function String 通讯功能 主键,conn/disconn
|
|
|
+
|
|
|
+ if (!tableExist(agent, DB, tableName)) {
|
|
|
+ JSONArray Columns = new JSONArray();
|
|
|
+ Columns.add(CreateJSON("project", "String"));
|
|
|
+ Columns.add(CreateJSON("address_1", "String"));
|
|
|
+ Columns.add(CreateJSON("address_2", "String"));
|
|
|
+ Columns.add(CreateJSON("address_3", "String"));
|
|
|
+ Columns.add(CreateJSON("address_4", "String"));
|
|
|
+ Columns.add(CreateJSON("receivetime", "String"));
|
|
|
+ Columns.add(CreateJSON("function", "String"));
|
|
|
+
|
|
|
+ JSONArray Key = new JSONArray();
|
|
|
+ Key.add("project");
|
|
|
+ Key.add("address_1");
|
|
|
+ Key.add("address_2");
|
|
|
+ Key.add("address_3");
|
|
|
+ Key.add("address_4");
|
|
|
+ Key.add("receivetime");
|
|
|
+ Key.add("function");
|
|
|
+
|
|
|
+ JSONObject Definition = new JSONObject();
|
|
|
+ Definition.put("Columns", Columns);
|
|
|
+ Definition.put("Key", Key);
|
|
|
+ JSONArray Indexes = new JSONArray();
|
|
|
+ agent.DDL_AddTable(DB, tableName, Definition, Indexes);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void CreateTable_ps_virtual_point_status(ZillionAgent agent, String DB, String tableName)
|
|
|
+ throws Exception {
|
|
|
+ // 序号 名称 数据类型 释义 备注
|
|
|
+ // 1 project String 项目名 主键
|
|
|
+ // 2 meter String 仪表 主键
|
|
|
+ // 3 funcid Long 功能号 主键
|
|
|
+ // 4 updown String 上/下行 主键
|
|
|
+ // 5 status String 状态
|
|
|
+ // 6 receivetime String 时间
|
|
|
+ // 7 detail String 详情
|
|
|
+
|
|
|
+ if (!tableExist(agent, DB, tableName)) {
|
|
|
+ JSONArray Columns = new JSONArray();
|
|
|
+ Columns.add(CreateJSON("project", "String"));
|
|
|
+ Columns.add(CreateJSON("meter", "String"));
|
|
|
+ Columns.add(CreateJSON("funcid", "Long"));
|
|
|
+ Columns.add(CreateJSON("updown", "String"));
|
|
|
+ Columns.add(CreateJSON("status", "String"));
|
|
|
+ Columns.add(CreateJSON("receivetime", "String"));
|
|
|
+ Columns.add(CreateJSON("detail", "String"));
|
|
|
+
|
|
|
+ JSONArray Key = new JSONArray();
|
|
|
+ Key.add("project");
|
|
|
+ Key.add("meter");
|
|
|
+ Key.add("funcid");
|
|
|
+ Key.add("updown");
|
|
|
+
|
|
|
+ JSONObject Definition = new JSONObject();
|
|
|
+ Definition.put("Columns", Columns);
|
|
|
+ Definition.put("Key", Key);
|
|
|
+ JSONArray Indexes = new JSONArray();
|
|
|
+ agent.DDL_AddTable(DB, tableName, Definition, Indexes);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void CreateTable_ps_virtual_point_log(ZillionAgent agent, String DB, String tableName)
|
|
|
+ throws Exception {
|
|
|
+ // 序号 名称 数据类型 释义 备注
|
|
|
+ // 1 project String 项目名 主键
|
|
|
+ // 2 meter String 仪表 主键
|
|
|
+ // 3 funcid Long 功能号 主键
|
|
|
+ // 4 updown String 上/下行 主键
|
|
|
+ // 5 receivetime String 时间 主键
|
|
|
+ // 6 seq Long 报文序号 主键
|
|
|
+ // 7 function String 通讯功能 主键
|
|
|
+ // 8 feedback String 反馈 processing:rcvd(采集软件已收到)
|
|
|
+ // processing:sent(采集软件已发出)
|
|
|
+ // processing:finish:finish:+采集节点反馈标识(采集软件已收到反馈)
|
|
|
+ // finish:finish:+采集节点反馈标识(采集软件已反馈)
|
|
|
+ // 其中采集节点反馈标识,分两级,分别为:
|
|
|
+ // 1、success/fail
|
|
|
+ // 2、如success,该级空;如fail,则该级描述fail原因
|
|
|
+
|
|
|
+ if (!tableExist(agent, DB, tableName)) {
|
|
|
+ JSONArray Columns = new JSONArray();
|
|
|
+ Columns.add(CreateJSON("project", "String"));
|
|
|
+ Columns.add(CreateJSON("meter", "String"));
|
|
|
+ Columns.add(CreateJSON("funcid", "Long"));
|
|
|
+ Columns.add(CreateJSON("updown", "String"));
|
|
|
+ Columns.add(CreateJSON("receivetime", "String"));
|
|
|
+ Columns.add(CreateJSON("seq", "Long"));
|
|
|
+ Columns.add(CreateJSON("function", "String"));
|
|
|
+ Columns.add(CreateJSON("feedback", "String"));
|
|
|
+
|
|
|
+ JSONArray Key = new JSONArray();
|
|
|
+ Key.add("project");
|
|
|
+ Key.add("meter");
|
|
|
+ Key.add("funcid");
|
|
|
+ Key.add("updown");
|
|
|
+ Key.add("receivetime");
|
|
|
+ Key.add("seq");
|
|
|
+ Key.add("function");
|
|
|
+
|
|
|
+ JSONObject Definition = new JSONObject();
|
|
|
+ Definition.put("Columns", Columns);
|
|
|
+ Definition.put("Key", Key);
|
|
|
+ JSONArray Indexes = new JSONArray();
|
|
|
+ agent.DDL_AddTable(DB, tableName, Definition, Indexes);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void CreateTable_ps_virtual_meter_status(ZillionAgent agent, String DB, String tableName)
|
|
|
+ throws Exception {
|
|
|
+ // 序号 名称 数据类型 释义 备注
|
|
|
+ // 1 project String 项目名 主键
|
|
|
+ // 2 meter String 仪表 主键
|
|
|
+ // 3 updown String 上/下行 主键
|
|
|
+ // 4 status String 状态
|
|
|
+ // 5 receivetime String 时间
|
|
|
+ // 6 detail String 详情
|
|
|
+
|
|
|
+ if (!tableExist(agent, DB, tableName)) {
|
|
|
+ JSONArray Columns = new JSONArray();
|
|
|
+ Columns.add(CreateJSON("project", "String"));
|
|
|
+ Columns.add(CreateJSON("meter", "String"));
|
|
|
+ Columns.add(CreateJSON("updown", "String"));
|
|
|
+ Columns.add(CreateJSON("status", "String"));
|
|
|
+ Columns.add(CreateJSON("receivetime", "String"));
|
|
|
+ Columns.add(CreateJSON("detail", "String"));
|
|
|
+
|
|
|
+ JSONArray Key = new JSONArray();
|
|
|
+ Key.add("project");
|
|
|
+ Key.add("meter");
|
|
|
+ Key.add("updown");
|
|
|
+
|
|
|
+ JSONObject Definition = new JSONObject();
|
|
|
+ Definition.put("Columns", Columns);
|
|
|
+ Definition.put("Key", Key);
|
|
|
+ JSONArray Indexes = new JSONArray();
|
|
|
+ agent.DDL_AddTable(DB, tableName, Definition, Indexes);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void CreateTable_ps_virtual_meter_log(ZillionAgent agent, String DB, String tableName)
|
|
|
+ throws Exception {
|
|
|
+ // 序号 名称 数据类型 释义 备注
|
|
|
+ // 1 project String 项目名 主键
|
|
|
+ // 2 meter String 仪表 主键
|
|
|
+ // 3 updown String 上/下行 主键
|
|
|
+ // 4 receivetime String 时间 主键
|
|
|
+ // 5 function String 通讯功能 主键
|
|
|
+
|
|
|
+ if (!tableExist(agent, DB, tableName)) {
|
|
|
+ JSONArray Columns = new JSONArray();
|
|
|
+ Columns.add(CreateJSON("project", "String"));
|
|
|
+ Columns.add(CreateJSON("meter", "String"));
|
|
|
+ Columns.add(CreateJSON("updown", "String"));
|
|
|
+ Columns.add(CreateJSON("receivetime", "String"));
|
|
|
+ Columns.add(CreateJSON("function", "String"));
|
|
|
+
|
|
|
+ JSONArray Key = new JSONArray();
|
|
|
+ Key.add("project");
|
|
|
+ Key.add("meter");
|
|
|
+ Key.add("updown");
|
|
|
+ Key.add("receivetime");
|
|
|
+ Key.add("function");
|
|
|
+
|
|
|
+ JSONObject Definition = new JSONObject();
|
|
|
+ Definition.put("Columns", Columns);
|
|
|
+ Definition.put("Key", Key);
|
|
|
+ JSONArray Indexes = new JSONArray();
|
|
|
+ agent.DDL_AddTable(DB, tableName, Definition, Indexes);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void CreateTable_ps_virtual_project_status(ZillionAgent agent, String DB, String tableName)
|
|
|
+ throws Exception {
|
|
|
+ // 序号 名称 数据类型 释义 备注
|
|
|
+ // 1 project String 项目名 主键
|
|
|
+ // 2 status String 状态
|
|
|
+ // 3 receivetime String 时间
|
|
|
+ // 4 detail String 详情
|
|
|
+
|
|
|
+ if (!tableExist(agent, DB, tableName)) {
|
|
|
+ JSONArray Columns = new JSONArray();
|
|
|
+ Columns.add(CreateJSON("project", "String"));
|
|
|
+ Columns.add(CreateJSON("status", "String"));
|
|
|
+ Columns.add(CreateJSON("receivetime", "String"));
|
|
|
+ Columns.add(CreateJSON("detail", "String"));
|
|
|
+
|
|
|
+ JSONArray Key = new JSONArray();
|
|
|
+ Key.add("project");
|
|
|
+
|
|
|
+ JSONObject Definition = new JSONObject();
|
|
|
+ Definition.put("Columns", Columns);
|
|
|
+ Definition.put("Key", Key);
|
|
|
+ JSONArray Indexes = new JSONArray();
|
|
|
+ agent.DDL_AddTable(DB, tableName, Definition, Indexes);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void CreateTable_ps_virtual_project_log(ZillionAgent agent, String DB, String tableName)
|
|
|
+ throws Exception {
|
|
|
+ // 序号 名称 数据类型 释义 备注
|
|
|
+ // 1 project String 项目名 主键
|
|
|
+ // 2 receivetime String 时间 主键
|
|
|
+ // 3 function String 通讯功能 主键
|
|
|
+
|
|
|
+ if (!tableExist(agent, DB, tableName)) {
|
|
|
+ JSONArray Columns = new JSONArray();
|
|
|
+ Columns.add(CreateJSON("project", "String"));
|
|
|
+ Columns.add(CreateJSON("receivetime", "String"));
|
|
|
+ Columns.add(CreateJSON("function", "String"));
|
|
|
+
|
|
|
+ JSONArray Key = new JSONArray();
|
|
|
+ Key.add("project");
|
|
|
+ Key.add("receivetime");
|
|
|
+ Key.add("function");
|
|
|
+
|
|
|
+ JSONObject Definition = new JSONObject();
|
|
|
+ Definition.put("Columns", Columns);
|
|
|
+ Definition.put("Key", Key);
|
|
|
+ JSONArray Indexes = new JSONArray();
|
|
|
+ agent.DDL_AddTable(DB, tableName, Definition, Indexes);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public static void CreateTable_PointStatus(ZillionAgent agent, String DB, String tableName) throws Exception {
|
|
|
if (!tableExist(agent, DB, tableName)) {
|
|
|
|
|
@@ -702,6 +1017,404 @@ public class HBaseUtil {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public static void Insert_dy_pointlist(ZillionAgent agent, String DB, String building, String meter, long funcid,
|
|
|
+ String system, String source, String address_1, String address_2, String address_3, String address_4,
|
|
|
+ String collect_cycle, String data_type) throws Exception {
|
|
|
+ // 序号 名称 数据类型 释义 备注
|
|
|
+ // 1 building String 楼号 主键
|
|
|
+ // 2 meter String 表号 主键
|
|
|
+ // 3 funcid Long 功能号 主键
|
|
|
+ // 4 system String 系统
|
|
|
+ // 5 source String 数据来源
|
|
|
+ // 6 address_1 String 一级地址 采集器网关ID
|
|
|
+ // 7 address_2 String 二级地址 总线端口号
|
|
|
+ // 8 address_3 String 三级地址 仪表地址
|
|
|
+ // 9 address_4 String 四级地址
|
|
|
+ // 10 collect_cycle String 采集频率 采集器上传频率
|
|
|
+ // 11 data_type String 点位类型 Acc:累积变量;Inst:瞬时变量;Boolv:通断变量;
|
|
|
+ // Enumv:状态变量;Step:阶跃变量
|
|
|
+
|
|
|
+ JSONArray InsertObjects = new JSONArray();
|
|
|
+ try {
|
|
|
+ if (DB == null) {
|
|
|
+ DB = Constant.defaultDB;
|
|
|
+ }
|
|
|
+ if (DB != null) {
|
|
|
+
|
|
|
+ JSONObject InsertObject = new JSONObject();
|
|
|
+ InsertObject.put("building", building);
|
|
|
+ InsertObject.put("meter", meter);
|
|
|
+ InsertObject.put("funcid", funcid);
|
|
|
+ InsertObject.put("system", system);
|
|
|
+ InsertObject.put("source", source);
|
|
|
+ InsertObject.put("address_1", address_1);
|
|
|
+ InsertObject.put("address_2", address_2);
|
|
|
+ InsertObject.put("address_3", address_3);
|
|
|
+ InsertObject.put("address_4", address_4);
|
|
|
+ InsertObject.put("collect_cycle", collect_cycle);
|
|
|
+ InsertObject.put("data_type", data_type);
|
|
|
+
|
|
|
+ InsertObjects.add(InsertObject);
|
|
|
+
|
|
|
+ JSONObject wrapperObject = new JSONObject();
|
|
|
+
|
|
|
+ wrapperObject = new JSONObject();
|
|
|
+ wrapperObject.put("QueryType", "batch_insert");
|
|
|
+ wrapperObject.put("Database", DB);
|
|
|
+ wrapperObject.put("Datatable", "dy_pointlist");
|
|
|
+ wrapperObject.put("InsertObjects", InsertObjects);
|
|
|
+ agent.Query(wrapperObject);
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ LogUtil.error("HBaseUtil.Insert_dy_pointlist.Exception: " + e.toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void Insert_ps_physical_status(ZillionAgent agent, String DB, String project, String address_1,
|
|
|
+ String address_2, String address_3, String address_4, String status, String receivetime, String detail)
|
|
|
+ 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 详情
|
|
|
+
|
|
|
+ JSONArray InsertObjects = new JSONArray();
|
|
|
+ try {
|
|
|
+ if (DB == null) {
|
|
|
+ DB = Constant.defaultDB;
|
|
|
+ }
|
|
|
+ if (DB != null) {
|
|
|
+
|
|
|
+ JSONObject InsertObject = new JSONObject();
|
|
|
+ InsertObject.put("project", project);
|
|
|
+ InsertObject.put("address_1", address_1);
|
|
|
+ InsertObject.put("address_2", address_2);
|
|
|
+ InsertObject.put("address_3", address_3);
|
|
|
+ InsertObject.put("address_4", address_4);
|
|
|
+ InsertObject.put("status", status);
|
|
|
+ InsertObject.put("receivetime", receivetime);
|
|
|
+ InsertObject.put("detail", detail);
|
|
|
+
|
|
|
+ InsertObjects.add(InsertObject);
|
|
|
+
|
|
|
+ JSONObject wrapperObject = new JSONObject();
|
|
|
+
|
|
|
+ wrapperObject = new JSONObject();
|
|
|
+ wrapperObject.put("QueryType", "batch_insert");
|
|
|
+ wrapperObject.put("Database", DB);
|
|
|
+ wrapperObject.put("Datatable", "ps_physical_status");
|
|
|
+ wrapperObject.put("InsertObjects", InsertObjects);
|
|
|
+ agent.Query(wrapperObject);
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ LogUtil.error("HBaseUtil.Insert_ps_physical_status.Exception: " + e.toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void Insert_ps_physical_log(ZillionAgent agent, String DB, String project, String address_1,
|
|
|
+ String address_2, String address_3, String address_4, String receivetime, String function)
|
|
|
+ throws Exception {
|
|
|
+ // 序号 名称 数据类型 释义 备注
|
|
|
+ // 1 project String 项目名 主键
|
|
|
+ // 2 address_1 String 一级地址 主键
|
|
|
+ // 3 address_2 String 二级地址 主键
|
|
|
+ // 4 address_3 String 三级地址 主键
|
|
|
+ // 5 address_4 String 四级地址 主键
|
|
|
+ // 6 receivetime String 时间 主键,触发时间
|
|
|
+ // 7 function String 通讯功能 主键,conn/disconn
|
|
|
+
|
|
|
+ JSONArray InsertObjects = new JSONArray();
|
|
|
+ try {
|
|
|
+ if (DB == null) {
|
|
|
+ DB = Constant.defaultDB;
|
|
|
+ }
|
|
|
+ if (DB != null) {
|
|
|
+
|
|
|
+ JSONObject InsertObject = new JSONObject();
|
|
|
+ InsertObject.put("project", project);
|
|
|
+ InsertObject.put("address_1", address_1);
|
|
|
+ InsertObject.put("address_2", address_2);
|
|
|
+ InsertObject.put("address_3", address_3);
|
|
|
+ InsertObject.put("address_4", address_4);
|
|
|
+ InsertObject.put("receivetime", receivetime);
|
|
|
+ InsertObject.put("function", function);
|
|
|
+
|
|
|
+ InsertObjects.add(InsertObject);
|
|
|
+
|
|
|
+ JSONObject wrapperObject = new JSONObject();
|
|
|
+
|
|
|
+ wrapperObject = new JSONObject();
|
|
|
+ wrapperObject.put("QueryType", "batch_insert");
|
|
|
+ wrapperObject.put("Database", DB);
|
|
|
+ wrapperObject.put("Datatable", "ps_physical_log");
|
|
|
+ wrapperObject.put("InsertObjects", InsertObjects);
|
|
|
+ agent.Query(wrapperObject);
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ LogUtil.error("HBaseUtil.Insert_ps_physical_log.Exception: " + e.toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void Insert_ps_virtual_point_status(ZillionAgent agent, String DB, String project, String meter,
|
|
|
+ long funcid, String updown, String status, String receivetime, String detail) throws Exception {
|
|
|
+ // 序号 名称 数据类型 释义 备注
|
|
|
+ // 1 project String 项目名 主键
|
|
|
+ // 2 meter String 仪表 主键
|
|
|
+ // 3 funcid Long 功能号 主键
|
|
|
+ // 4 updown String 上/下行 主键
|
|
|
+ // 5 status String 状态
|
|
|
+ // 6 receivetime String 时间
|
|
|
+ // 7 detail String 详情
|
|
|
+
|
|
|
+ JSONArray InsertObjects = new JSONArray();
|
|
|
+ try {
|
|
|
+ if (DB == null) {
|
|
|
+ DB = Constant.defaultDB;
|
|
|
+ }
|
|
|
+ if (DB != null) {
|
|
|
+
|
|
|
+ JSONObject InsertObject = new JSONObject();
|
|
|
+ InsertObject.put("project", project);
|
|
|
+ InsertObject.put("meter", meter);
|
|
|
+ InsertObject.put("funcid", funcid);
|
|
|
+ InsertObject.put("updown", updown);
|
|
|
+ InsertObject.put("status", status);
|
|
|
+ InsertObject.put("receivetime", receivetime);
|
|
|
+ InsertObject.put("detail", detail);
|
|
|
+
|
|
|
+ InsertObjects.add(InsertObject);
|
|
|
+
|
|
|
+ JSONObject wrapperObject = new JSONObject();
|
|
|
+
|
|
|
+ wrapperObject = new JSONObject();
|
|
|
+ wrapperObject.put("QueryType", "batch_insert");
|
|
|
+ wrapperObject.put("Database", DB);
|
|
|
+ wrapperObject.put("Datatable", "ps_virtual_point_status");
|
|
|
+ wrapperObject.put("InsertObjects", InsertObjects);
|
|
|
+ agent.Query(wrapperObject);
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ LogUtil.error("HBaseUtil.Insert_ps_virtual_point_status.Exception: " + e.toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void Insert_ps_virtual_point_log(ZillionAgent agent, String DB, String project, String meter,
|
|
|
+ long funcid, String updown, String receivetime, long seq, String function, String feedback)
|
|
|
+ throws Exception {
|
|
|
+ // 序号 名称 数据类型 释义 备注
|
|
|
+ // 1 project String 项目名 主键
|
|
|
+ // 2 meter String 仪表 主键
|
|
|
+ // 3 funcid Long 功能号 主键
|
|
|
+ // 4 updown String 上/下行 主键
|
|
|
+ // 5 receivetime String 时间 主键
|
|
|
+ // 6 seq Long 报文序号 主键
|
|
|
+ // 7 function String 通讯功能 主键
|
|
|
+ // 8 feedback String 反馈 processing:rcvd(采集软件已收到)
|
|
|
+ // processing:sent(采集软件已发出)
|
|
|
+ // processing:finish:finish:+采集节点反馈标识(采集软件已收到反馈)
|
|
|
+ // finish:finish:+采集节点反馈标识(采集软件已反馈)
|
|
|
+ // 其中采集节点反馈标识,分两级,分别为:
|
|
|
+ // 1、success/fail
|
|
|
+ // 2、如success,该级空;如fail,则该级描述fail原因
|
|
|
+
|
|
|
+ JSONArray InsertObjects = new JSONArray();
|
|
|
+ try {
|
|
|
+ if (DB == null) {
|
|
|
+ DB = Constant.defaultDB;
|
|
|
+ }
|
|
|
+ if (DB != null) {
|
|
|
+
|
|
|
+ JSONObject InsertObject = new JSONObject();
|
|
|
+ InsertObject.put("project", project);
|
|
|
+ InsertObject.put("meter", meter);
|
|
|
+ InsertObject.put("funcid", funcid);
|
|
|
+ InsertObject.put("updown", updown);
|
|
|
+ InsertObject.put("receivetime", receivetime);
|
|
|
+ InsertObject.put("seq", seq);
|
|
|
+ InsertObject.put("function", function);
|
|
|
+ InsertObject.put("feedback", feedback);
|
|
|
+
|
|
|
+ InsertObjects.add(InsertObject);
|
|
|
+
|
|
|
+ JSONObject wrapperObject = new JSONObject();
|
|
|
+
|
|
|
+ wrapperObject = new JSONObject();
|
|
|
+ wrapperObject.put("QueryType", "batch_insert");
|
|
|
+ wrapperObject.put("Database", DB);
|
|
|
+ wrapperObject.put("Datatable", "ps_virtual_point_log");
|
|
|
+ wrapperObject.put("InsertObjects", InsertObjects);
|
|
|
+ agent.Query(wrapperObject);
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ LogUtil.error("HBaseUtil.Insert_ps_virtual_point_log.Exception: " + e.toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void Insert_ps_virtual_meter_status(ZillionAgent agent, String DB, String project, String meter,
|
|
|
+ String updown, String status, String receivetime, String detail) throws Exception {
|
|
|
+ // 序号 名称 数据类型 释义 备注
|
|
|
+ // 1 project String 项目名 主键
|
|
|
+ // 2 meter String 仪表 主键
|
|
|
+ // 3 updown String 上/下行 主键
|
|
|
+ // 4 status String 状态
|
|
|
+ // 5 receivetime String 时间
|
|
|
+ // 6 detail String 详情
|
|
|
+
|
|
|
+ JSONArray InsertObjects = new JSONArray();
|
|
|
+ try {
|
|
|
+ if (DB == null) {
|
|
|
+ DB = Constant.defaultDB;
|
|
|
+ }
|
|
|
+ if (DB != null) {
|
|
|
+
|
|
|
+ JSONObject InsertObject = new JSONObject();
|
|
|
+ InsertObject.put("project", project);
|
|
|
+ InsertObject.put("meter", meter);
|
|
|
+ InsertObject.put("updown", updown);
|
|
|
+ InsertObject.put("status", status);
|
|
|
+ InsertObject.put("receivetime", receivetime);
|
|
|
+ InsertObject.put("detail", detail);
|
|
|
+
|
|
|
+ InsertObjects.add(InsertObject);
|
|
|
+
|
|
|
+ JSONObject wrapperObject = new JSONObject();
|
|
|
+
|
|
|
+ wrapperObject = new JSONObject();
|
|
|
+ wrapperObject.put("QueryType", "batch_insert");
|
|
|
+ wrapperObject.put("Database", DB);
|
|
|
+ wrapperObject.put("Datatable", "ps_virtual_meter_status");
|
|
|
+ wrapperObject.put("InsertObjects", InsertObjects);
|
|
|
+ agent.Query(wrapperObject);
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ LogUtil.error("HBaseUtil.Insert_ps_virtual_meter_status.Exception: " + e.toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void Insert_ps_virtual_meter_log(ZillionAgent agent, String DB, String project, String meter,
|
|
|
+ String updown, String receivetime, String function) throws Exception {
|
|
|
+ // 序号 名称 数据类型 释义 备注
|
|
|
+ // 1 project String 项目名 主键
|
|
|
+ // 2 meter String 仪表 主键
|
|
|
+ // 3 updown String 上/下行 主键
|
|
|
+ // 4 receivetime String 时间 主键
|
|
|
+ // 5 function String 通讯功能 主键
|
|
|
+
|
|
|
+ JSONArray InsertObjects = new JSONArray();
|
|
|
+ try {
|
|
|
+ if (DB == null) {
|
|
|
+ DB = Constant.defaultDB;
|
|
|
+ }
|
|
|
+ if (DB != null) {
|
|
|
+
|
|
|
+ JSONObject InsertObject = new JSONObject();
|
|
|
+ InsertObject.put("project", project);
|
|
|
+ InsertObject.put("meter", meter);
|
|
|
+ InsertObject.put("updown", updown);
|
|
|
+ InsertObject.put("receivetime", receivetime);
|
|
|
+ InsertObject.put("function", function);
|
|
|
+
|
|
|
+ InsertObjects.add(InsertObject);
|
|
|
+
|
|
|
+ JSONObject wrapperObject = new JSONObject();
|
|
|
+
|
|
|
+ wrapperObject = new JSONObject();
|
|
|
+ wrapperObject.put("QueryType", "batch_insert");
|
|
|
+ wrapperObject.put("Database", DB);
|
|
|
+ wrapperObject.put("Datatable", "ps_virtual_meter_log");
|
|
|
+ wrapperObject.put("InsertObjects", InsertObjects);
|
|
|
+ agent.Query(wrapperObject);
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ LogUtil.error("HBaseUtil.Insert_ps_virtual_meter_log.Exception: " + e.toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void Insert_ps_virtual_project_status(ZillionAgent agent, String DB, String project, String status,
|
|
|
+ String receivetime, String detail) throws Exception {
|
|
|
+ // 序号 名称 数据类型 释义 备注
|
|
|
+ // 1 project String 项目名 主键
|
|
|
+ // 2 status String 状态
|
|
|
+ // 3 receivetime String 时间
|
|
|
+ // 4 detail String 详情
|
|
|
+
|
|
|
+ JSONArray InsertObjects = new JSONArray();
|
|
|
+ try {
|
|
|
+ if (DB == null) {
|
|
|
+ DB = Constant.defaultDB;
|
|
|
+ }
|
|
|
+ if (DB != null) {
|
|
|
+
|
|
|
+ JSONObject InsertObject = new JSONObject();
|
|
|
+ InsertObject.put("project", project);
|
|
|
+ InsertObject.put("status", status);
|
|
|
+ InsertObject.put("receivetime", receivetime);
|
|
|
+ InsertObject.put("detail", detail);
|
|
|
+
|
|
|
+ InsertObjects.add(InsertObject);
|
|
|
+
|
|
|
+ JSONObject wrapperObject = new JSONObject();
|
|
|
+
|
|
|
+ wrapperObject = new JSONObject();
|
|
|
+ wrapperObject.put("QueryType", "batch_insert");
|
|
|
+ wrapperObject.put("Database", DB);
|
|
|
+ wrapperObject.put("Datatable", "ps_virtual_project_status");
|
|
|
+ wrapperObject.put("InsertObjects", InsertObjects);
|
|
|
+ agent.Query(wrapperObject);
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ LogUtil.error("HBaseUtil.Insert_ps_virtual_project_status.Exception: " + e.toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void Insert_ps_virtual_project_log(ZillionAgent agent, String DB, String project, String receivetime,
|
|
|
+ String function) throws Exception {
|
|
|
+ // 序号 名称 数据类型 释义 备注
|
|
|
+ // 1 project String 项目名 主键
|
|
|
+ // 2 receivetime String 时间 主键
|
|
|
+ // 3 function String 通讯功能 主键
|
|
|
+
|
|
|
+ JSONArray InsertObjects = new JSONArray();
|
|
|
+ try {
|
|
|
+ if (DB == null) {
|
|
|
+ DB = Constant.defaultDB;
|
|
|
+ }
|
|
|
+ if (DB != null) {
|
|
|
+
|
|
|
+ JSONObject InsertObject = new JSONObject();
|
|
|
+ InsertObject.put("project", project);
|
|
|
+ InsertObject.put("receivetime", receivetime);
|
|
|
+ InsertObject.put("function", function);
|
|
|
+
|
|
|
+ InsertObjects.add(InsertObject);
|
|
|
+
|
|
|
+ JSONObject wrapperObject = new JSONObject();
|
|
|
+
|
|
|
+ wrapperObject = new JSONObject();
|
|
|
+ wrapperObject.put("QueryType", "batch_insert");
|
|
|
+ wrapperObject.put("Database", DB);
|
|
|
+ wrapperObject.put("Datatable", "ps_virtual_project_log");
|
|
|
+ wrapperObject.put("InsertObjects", InsertObjects);
|
|
|
+ agent.Query(wrapperObject);
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ LogUtil.error("HBaseUtil.Insert_ps_virtual_project_log.Exception: " + e.toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
// public static void InsertPointCommunicationLog(List<String> list) throws
|
|
|
// Exception {
|
|
|
// // TODO Auto-generated method stub
|