|
|
@ -80,6 +80,10 @@ public class DataTransService { |
|
|
//单独处理ST-150网关数据
|
|
|
//单独处理ST-150网关数据
|
|
|
logger.debug("CustomSend Data :{} ,To: {}", jsonParams,dataCenterEnvConfig.getProcessIoserverUrl()); |
|
|
logger.debug("CustomSend Data :{} ,To: {}", jsonParams,dataCenterEnvConfig.getProcessIoserverUrl()); |
|
|
response = this.defaultHttpRequestUtil.postJson(dataCenterEnvConfig.getGW150ProcessUrl(), jsonParams); |
|
|
response = this.defaultHttpRequestUtil.postJson(dataCenterEnvConfig.getGW150ProcessUrl(), jsonParams); |
|
|
|
|
|
}else if (isTrendLog(rawJson)){ |
|
|
|
|
|
//单独处理TrendLog数据
|
|
|
|
|
|
logger.debug("CustomSend Data :{} ,To: {}", jsonParams,dataCenterEnvConfig.getProcessTrendLogUrl()); |
|
|
|
|
|
response = this.defaultHttpRequestUtil.postJson(dataCenterEnvConfig.getProcessTrendLogUrl(), jsonParams); |
|
|
}else{ |
|
|
}else{ |
|
|
logger.debug("CustomSend Data :{} ,To: {}", jsonParams,dataCenterEnvConfig.getProcessApiUrl()); |
|
|
logger.debug("CustomSend Data :{} ,To: {}", jsonParams,dataCenterEnvConfig.getProcessApiUrl()); |
|
|
response = this.defaultHttpRequestUtil.postJson(dataCenterEnvConfig.getProcessApiUrl(), jsonParams); |
|
|
response = this.defaultHttpRequestUtil.postJson(dataCenterEnvConfig.getProcessApiUrl(), jsonParams); |
|
|
@ -138,4 +142,23 @@ public class DataTransService { |
|
|
return hasD && hasTs; |
|
|
return hasD && hasTs; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 检查JSON字符串是否包含特定的字段,用于判断是否符合GW150数据格式 |
|
|
|
|
|
* |
|
|
|
|
|
* @param jsonStr 待检查的JSON字符串 |
|
|
|
|
|
* @return 如果JSON字符串同时包含字段"Instance"、"DeviceId"和"log_buffer",则返回true,否则返回false |
|
|
|
|
|
*/ |
|
|
|
|
|
private Boolean isTrendLog(String jsonStr){ |
|
|
|
|
|
// 解析JSON字符串为JsonObject,以便进行字段检查
|
|
|
|
|
|
JsonObject json = JsonParser.parseString(jsonStr).getAsJsonObject(); |
|
|
|
|
|
|
|
|
|
|
|
// 检查JSON对象中是否包含字段"Instance"
|
|
|
|
|
|
boolean hasInstance = json.has("Instance"); |
|
|
|
|
|
// 检查JSON对象中是否包含字段"DeviceId"
|
|
|
|
|
|
boolean hasDeviceId = json.has("DeviceId"); |
|
|
|
|
|
// 检查JSON对象中是否包含字段"hasLogBuffer"
|
|
|
|
|
|
boolean hasLogBuffer = json.has("log_buffer"); |
|
|
|
|
|
|
|
|
|
|
|
return hasInstance && hasDeviceId && hasLogBuffer; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|