|
|
@ -54,7 +54,7 @@ public class AnalyseRequest implements RetryableRequest, Serializable { |
|
|
* 新增 annotations对象 algo.analyse.sgcc/id 对应 taskPatrolId |
|
|
* 新增 annotations对象 algo.analyse.sgcc/id 对应 taskPatrolId |
|
|
* 新增 annotations对象 task.analyse.sgcc/total 对应 totalNumber |
|
|
* 新增 annotations对象 task.analyse.sgcc/total 对应 totalNumber |
|
|
*/ |
|
|
*/ |
|
|
public static String convertJson(String originalJson) { |
|
|
|
|
|
|
|
|
public static String convertJson(boolean isFilter, String originalJson) { |
|
|
Gson gson = new GsonBuilder().setPrettyPrinting().create(); |
|
|
Gson gson = new GsonBuilder().setPrettyPrinting().create(); |
|
|
JsonObject root = JsonParser.parseString(originalJson).getAsJsonObject(); |
|
|
JsonObject root = JsonParser.parseString(originalJson).getAsJsonObject(); |
|
|
|
|
|
|
|
|
@ -64,7 +64,13 @@ public class AnalyseRequest implements RetryableRequest, Serializable { |
|
|
// 遍历 root 的所有 entry,复制除 objectList 外的所有字段 |
|
|
// 遍历 root 的所有 entry,复制除 objectList 外的所有字段 |
|
|
for (String key : root.keySet()) { |
|
|
for (String key : root.keySet()) { |
|
|
if (!"objectList".equals(key)) { |
|
|
if (!"objectList".equals(key)) { |
|
|
newRoot.add(key, root.get(key).deepCopy()); // deepCopy 防止引用问题 |
|
|
|
|
|
|
|
|
if (key.equals("typeList") && isFilter) { |
|
|
|
|
|
JsonArray typeList = new JsonArray(); |
|
|
|
|
|
typeList.add("tx_pb"); |
|
|
|
|
|
newRoot.add(key, typeList); |
|
|
|
|
|
} else { |
|
|
|
|
|
newRoot.add(key, root.get(key).deepCopy()); // deepCopy 防止引用问题 |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -81,6 +87,12 @@ public class AnalyseRequest implements RetryableRequest, Serializable { |
|
|
obj.add("imagePathList", imageUrlList.deepCopy()); |
|
|
obj.add("imagePathList", imageUrlList.deepCopy()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (obj.has("typeList") && isFilter) { |
|
|
|
|
|
JsonArray typeList = new JsonArray(); |
|
|
|
|
|
typeList.add("tx_pb"); |
|
|
|
|
|
obj.add("typeList", typeList); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// 添加 annotations |
|
|
// 添加 annotations |
|
|
JsonObject annotations = new JsonObject(); |
|
|
JsonObject annotations = new JsonObject(); |
|
|
// 从根对象取值(即使根对象有很多字段,也只用这两个) |
|
|
// 从根对象取值(即使根对象有很多字段,也只用这两个) |
|
|
@ -177,9 +189,9 @@ public class AnalyseRequest implements RetryableRequest, Serializable { |
|
|
@Override |
|
|
@Override |
|
|
public String toString() { |
|
|
public String toString() { |
|
|
String jsonStr = JSONObject.toJSONString(this); |
|
|
String jsonStr = JSONObject.toJSONString(this); |
|
|
if ("SJZZ".equals(this.drafter) && this.isFilter) { |
|
|
|
|
|
|
|
|
if ("SJZZ".equals(this.drafter)) { |
|
|
log.info("数聚智造请求格式构造中"); |
|
|
log.info("数聚智造请求格式构造中"); |
|
|
return convertJson(jsonStr); |
|
|
|
|
|
|
|
|
return convertJson(this.isFilter, jsonStr); |
|
|
} |
|
|
} |
|
|
return jsonStr; |
|
|
return jsonStr; |
|
|
} |
|
|
} |
|
|
|