|
@@ -465,6 +465,9 @@ public class HBaseUtil {
|
|
|
|
|
|
JSONArray InsertObjects = new JSONArray();
|
|
|
try {
|
|
|
+ if (DB == null) {
|
|
|
+ DB = Constant.defaultDB;
|
|
|
+ }
|
|
|
if (DB != null) {
|
|
|
|
|
|
JSONObject InsertObject = new JSONObject();
|
|
@@ -496,6 +499,9 @@ public class HBaseUtil {
|
|
|
|
|
|
JSONArray InsertObjects = new JSONArray();
|
|
|
try {
|
|
|
+ if (DB == null) {
|
|
|
+ DB = Constant.defaultDB;
|
|
|
+ }
|
|
|
if (DB != null) {
|
|
|
|
|
|
JSONObject InsertObject = new JSONObject();
|
|
@@ -528,6 +534,9 @@ public class HBaseUtil {
|
|
|
|
|
|
JSONArray InsertObjects = new JSONArray();
|
|
|
try {
|
|
|
+ if (DB == null) {
|
|
|
+ DB = Constant.defaultDB;
|
|
|
+ }
|
|
|
if (DB != null) {
|
|
|
|
|
|
JSONObject InsertObject = new JSONObject();
|
|
@@ -563,6 +572,9 @@ public class HBaseUtil {
|
|
|
|
|
|
JSONArray InsertObjects = new JSONArray();
|
|
|
try {
|
|
|
+ if (DB == null) {
|
|
|
+ DB = Constant.defaultDB;
|
|
|
+ }
|
|
|
if (DB != null) {
|
|
|
|
|
|
JSONObject InsertObject = new JSONObject();
|
|
@@ -596,6 +608,9 @@ public class HBaseUtil {
|
|
|
|
|
|
JSONArray InsertObjects = new JSONArray();
|
|
|
try {
|
|
|
+ if (DB == null) {
|
|
|
+ DB = Constant.defaultDB;
|
|
|
+ }
|
|
|
if (DB != null) {
|
|
|
|
|
|
JSONObject InsertObject = new JSONObject();
|
|
@@ -679,6 +694,17 @@ public class HBaseUtil {
|
|
|
public static void BatchInsert(ZillionAgent agent, String DB, List<Record> dataList) throws Exception {
|
|
|
JSONArray InsertObjects = new JSONArray();
|
|
|
try {
|
|
|
+ boolean history = false;
|
|
|
+ for (String h : Constant.PortHistory.values()) {
|
|
|
+ if ("true".equalsIgnoreCase(h)) {
|
|
|
+ history = true;
|
|
|
+ } else {
|
|
|
+ history = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (DB == null) {
|
|
|
+ DB = Constant.defaultDB;
|
|
|
+ }
|
|
|
if (DB != null && dataList.size() > 0) {
|
|
|
for (int i = 0; i < dataList.size(); i++) {
|
|
|
|
|
@@ -706,15 +732,17 @@ public class HBaseUtil {
|
|
|
wrapperObject.put("Datatable", "original_month");
|
|
|
wrapperObject.put("InsertObjects", InsertObjects);
|
|
|
agent.Query(wrapperObject);
|
|
|
- wrapperObject = new JSONObject();
|
|
|
- wrapperObject.put("QueryType", "batch_put");
|
|
|
- wrapperObject.put("Database", DB);
|
|
|
- wrapperObject.put("Datatable", "original_present");
|
|
|
- wrapperObject.put("InsertObjects", InsertObjects);
|
|
|
- agent.Query(wrapperObject);
|
|
|
- // LogUtil.info("insert into " + DB + "." +
|
|
|
- // "original_month&" + "original_present "
|
|
|
- // + InsertObjects.toFormatString());
|
|
|
+ if (!history) {
|
|
|
+ wrapperObject = new JSONObject();
|
|
|
+ wrapperObject.put("QueryType", "batch_put");
|
|
|
+ wrapperObject.put("Database", DB);
|
|
|
+ wrapperObject.put("Datatable", "original_present");
|
|
|
+ wrapperObject.put("InsertObjects", InsertObjects);
|
|
|
+ agent.Query(wrapperObject);
|
|
|
+ // LogUtil.info("insert into " + DB + "." +
|
|
|
+ // "original_month&" + "original_present "
|
|
|
+ // + InsertObjects.toFormatString());
|
|
|
+ }
|
|
|
LogUtil.info(
|
|
|
"insert into " + DB + "." + "original_month&" + "original_present " + InsertObjects.size());
|
|
|
}
|
|
@@ -729,6 +757,9 @@ public class HBaseUtil {
|
|
|
public static void BatchInsert_Set1(ZillionAgent agent, String DB, PointSet ps) throws Exception {
|
|
|
JSONArray InsertObjects = new JSONArray();
|
|
|
try {
|
|
|
+ if (DB == null) {
|
|
|
+ DB = Constant.defaultDB;
|
|
|
+ }
|
|
|
if (DB != null) {
|
|
|
|
|
|
JSONObject InsertObject = new JSONObject();
|
|
@@ -774,6 +805,9 @@ public class HBaseUtil {
|
|
|
public static void BatchInsert_Set2(ZillionAgent agent, String DB, PointSet ps) throws Exception {
|
|
|
JSONArray InsertObjects = new JSONArray();
|
|
|
try {
|
|
|
+ if (DB == null) {
|
|
|
+ DB = Constant.defaultDB;
|
|
|
+ }
|
|
|
if (DB != null) {
|
|
|
|
|
|
JSONObject InsertObject = new JSONObject();
|
|
@@ -820,6 +854,9 @@ public class HBaseUtil {
|
|
|
public static void BatchInsert_Set3(ZillionAgent agent, String DB, PointSet ps) throws Exception {
|
|
|
JSONArray InsertObjects = new JSONArray();
|
|
|
try {
|
|
|
+ if (DB == null) {
|
|
|
+ DB = Constant.defaultDB;
|
|
|
+ }
|
|
|
if (DB != null) {
|
|
|
|
|
|
JSONObject InsertObject = new JSONObject();
|