|
|
|
@ -58,6 +58,7 @@ import java.io.InputStream;
|
|
|
|
|
import java.io.InputStreamReader; |
|
|
|
|
import java.io.OutputStreamWriter; |
|
|
|
|
import java.io.UnsupportedEncodingException; |
|
|
|
|
import java.net.URLEncoder; |
|
|
|
|
import java.sql.Connection; |
|
|
|
|
import java.sql.PreparedStatement; |
|
|
|
|
import java.sql.ResultSet; |
|
|
|
@ -227,11 +228,7 @@ public class InformationCollector implements XMLReadable, XMLWriter {
|
|
|
|
|
private void sendFunctionsInfo(){ |
|
|
|
|
long currentTime = new Date().getTime(); |
|
|
|
|
ArrayList<Map<String, Object>> content = null; |
|
|
|
|
try { |
|
|
|
|
content = getFunctionsContentAsByte(currentTime); |
|
|
|
|
} catch (JSONException e) { |
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
|
} |
|
|
|
|
content = getFunctionsContentAsByte(currentTime); |
|
|
|
|
boolean success = false; |
|
|
|
|
String url = CloudCenter.getInstance().acquireUrlByKind(TABLE_FUNCTION_RECORD); |
|
|
|
|
if(content.size() > 0){ |
|
|
|
@ -246,19 +243,12 @@ public class InformationCollector implements XMLReadable, XMLWriter {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private boolean sendFunctionRecord(String url, Map<String,Object> record) { |
|
|
|
|
HashMap<String, String> para = new HashMap<>(); |
|
|
|
|
para.put("token", SiteCenterToken.generateToken()); |
|
|
|
|
para.put("content", new JSONObject(record).toString()); |
|
|
|
|
String res = null; |
|
|
|
|
try { |
|
|
|
|
res = HttpToolbox.get(url, para); |
|
|
|
|
} catch (IOException e) { |
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
|
} |
|
|
|
|
boolean success = false; |
|
|
|
|
try { |
|
|
|
|
String recordUrl = url+"?token=" + SiteCenterToken.generateToken() + "&content="+URLEncoder.encode(new JSONObject(record).toString(), EncodeConstants.ENCODING_UTF_8); |
|
|
|
|
String res = HttpToolbox.get(recordUrl); |
|
|
|
|
success = ComparatorUtils.equals(new JSONObject(res).get("status"), "success"); |
|
|
|
|
} catch (JSONException e) { |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
|
} |
|
|
|
|
return success; |
|
|
|
@ -424,14 +414,13 @@ public class InformationCollector implements XMLReadable, XMLWriter {
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static ArrayList getFunctionsContentAsByte(long currentTime) throws JSONException{ |
|
|
|
|
public static ArrayList getFunctionsContentAsByte(long currentTime){ |
|
|
|
|
ArrayList<Map<String,Object>> records = new ArrayList<Map<String,Object>>(); |
|
|
|
|
QueryCondition condition = QueryFactory.create().addRestriction( |
|
|
|
|
RestrictionFactory.lte(COLUMN_TIME, currentTime) |
|
|
|
|
); |
|
|
|
|
try { |
|
|
|
|
DataList<FocusPoint> focusPoints = MetricRegistry.getMetric().find(FocusPoint.class,condition); |
|
|
|
|
focusPoints.getList(); |
|
|
|
|
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); |
|
|
|
|
String bbsUserName = MarketConfig.getInstance().getBbsUsername(); |
|
|
|
|
String uuid = envManager.getUUID(); |
|
|
|
|