|
@@ -16,9 +16,11 @@ public class AnalyseFaced {
|
|
|
|
|
|
private final static String SHIP_COVER = "http://172.16.58.199:5000/shipCover";
|
|
|
private final static String BOAT_FLAG = "http://172.16.58.199:3003/boat_flag";
|
|
|
+ private final static String LIFE_JACKET = "http://172.16.58.199:5003/lifejacket";
|
|
|
private final static String DOWNLOAD_FILE_DIR = "/shipAnalysis/HDImages/";
|
|
|
private final static String SHIP_COVER_ANALYSE_DIR = "/disk/shipCover/";
|
|
|
private final static String BOAT_FLAG_ANALYSE_DIR = "/disk/shareFlag/";
|
|
|
+ private final static String LIFE_JACKET_ANALYSE_DIR = "/disk/shareLifejacket/";
|
|
|
private final static String GH_CLOUD_SERVER = "http://10.83.68.108:8090/ghjgBayonetDataShareApi/analyse/receive";
|
|
|
private final static String GH_CLOUD_HISTORY_SERVER = "http://10.83.68.108:8090/ghjgBayonetDataShareApi/analyse/history/receive";
|
|
|
|
|
@@ -94,7 +96,6 @@ public class AnalyseFaced {
|
|
|
return responseBody;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
public static String boatFlagAnalyse(String id, List<String> filePathList, String bayonetId) {
|
|
|
String result = null;
|
|
|
for (String filePath : filePathList) {
|
|
@@ -142,7 +143,6 @@ public class AnalyseFaced {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
public static String boatFlagAnalyseHistory(String id, List<String> filePathList, String bayonetId,String passTime) {
|
|
|
String result = null;
|
|
|
for (String filePath : filePathList) {
|
|
@@ -187,7 +187,6 @@ public class AnalyseFaced {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
public static String boatFlagAnalyse(String id, String filePath) {
|
|
|
HttpRequest post = HttpUtil.createPost(BOAT_FLAG);
|
|
|
Map<String, String> headers = new HashMap<>();
|
|
@@ -200,4 +199,51 @@ public class AnalyseFaced {
|
|
|
.execute()
|
|
|
.body();
|
|
|
}
|
|
|
+
|
|
|
+ public static String lifeJacketAnalyse(String id, List<String> filePathList, String bayonetId) {
|
|
|
+ String result = null;
|
|
|
+ for (String filePath : filePathList) {
|
|
|
+ HttpRequest post = HttpUtil.createPost(LIFE_JACKET);
|
|
|
+ Map<String, String> headers = new HashMap<>();
|
|
|
+ headers.put("Content-Type", "application/json;charset=utf-8");
|
|
|
+ post.addHeaders(headers);
|
|
|
+ Map<String, String> param = new LinkedHashMap<>();
|
|
|
+ param.put("file", DOWNLOAD_FILE_DIR + filePath);
|
|
|
+ String responseBody = post.body(JSONObject.toJSONString(param))
|
|
|
+ .setReadTimeout(3600000)
|
|
|
+ .execute()
|
|
|
+ .body();
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(responseBody);
|
|
|
+ List<Object> strings = JSONArray.parseArray(jsonObject.get("result").toString());
|
|
|
+ JSONObject jsonObject1 = JSONObject.parseObject(strings.get(0).toString());
|
|
|
+ if(String.valueOf(1).equals(jsonObject1.get("is_wear") == null ? null : jsonObject1.get("is_wear").toString())) {
|
|
|
+ // 如果whetherWearLifejacket为1
|
|
|
+ result = responseBody;
|
|
|
+ break;
|
|
|
+ } else {
|
|
|
+ // 如果whetherWearLifejacket为0或空值
|
|
|
+ // 处理穿救生衣或无人时的分析结果
|
|
|
+ result = responseBody;
|
|
|
+ }
|
|
|
+ };
|
|
|
+// log.info("救生衣分析最终结果:{}", result);
|
|
|
+ // 调用云上覆盖物/国旗/救生衣接收接口
|
|
|
+ Map<String, Object> yunParam = new LinkedHashMap<>();
|
|
|
+ yunParam.put("type", "救生衣");
|
|
|
+ yunParam.put("dir", LIFE_JACKET_ANALYSE_DIR);
|
|
|
+ yunParam.put("id", id);
|
|
|
+ yunParam.put("data", result);
|
|
|
+ yunParam.put("bayonetId", bayonetId);
|
|
|
+ String lifejacketJsonString = JSONObject.toJSONString(yunParam);
|
|
|
+// log.info("救生衣调用云上传参为:{}", lifejacketJsonString);
|
|
|
+ HttpRequest ghPost = HttpUtil.createPost(GH_CLOUD_SERVER);
|
|
|
+ Map<String, String> headers = new HashMap<>();
|
|
|
+ headers.put("Content-Type", "application/json;charset=utf-8");
|
|
|
+ ghPost.addHeaders(headers);
|
|
|
+ ghPost.body(lifejacketJsonString)
|
|
|
+ .setReadTimeout(3600000)
|
|
|
+ .execute()
|
|
|
+ .body();
|
|
|
+ return null;
|
|
|
+ }
|
|
|
}
|