Selaa lähdekoodia

[update]0.7版本

xiahailong 2 vuotta sitten
vanhempi
commit
7e439bd4c9

+ 16 - 1
.idea/workspace.xml

@@ -6,7 +6,11 @@
   <component name="ChangeListManager">
     <list default="true" id="3bf79822-fe13-41ea-bc8f-858fbea129e7" name="Changes" comment="[update]0.7版本">
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/fusion-analysis/src/main/java/cn/com/taiji/constants/EsIndexConstants.java" beforeDir="false" afterPath="$PROJECT_DIR$/fusion-analysis/src/main/java/cn/com/taiji/constants/EsIndexConstants.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/fusion-analysis/src/main/java/cn/com/taiji/controller/FusionAnalysisController.java" beforeDir="false" afterPath="$PROJECT_DIR$/fusion-analysis/src/main/java/cn/com/taiji/controller/FusionAnalysisController.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/fusion-analysis/src/main/java/cn/com/taiji/service/FusionAnalysisService.java" beforeDir="false" afterPath="$PROJECT_DIR$/fusion-analysis/src/main/java/cn/com/taiji/service/FusionAnalysisService.java" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/fusion-analysis/src/main/java/cn/com/taiji/service/impl/FusionAnalysisServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/fusion-analysis/src/main/java/cn/com/taiji/service/impl/FusionAnalysisServiceImpl.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/fusion-analysis/src/main/resources/application.yml" beforeDir="false" afterPath="$PROJECT_DIR$/fusion-analysis/src/main/resources/application.yml" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -187,6 +191,10 @@
       <workItem from="1676253941747" duration="1672000" />
       <workItem from="1676259459788" duration="81000" />
       <workItem from="1676342714497" duration="42000" />
+      <workItem from="1676342761531" duration="45000" />
+      <workItem from="1676443948706" duration="35000" />
+      <workItem from="1676603269237" duration="1088000" />
+      <workItem from="1676711088015" duration="7165000" />
     </task>
     <task id="LOCAL-00001" summary="[insert]新增prod环境配置,完善es连接配置">
       <created>1675652041715</created>
@@ -258,7 +266,14 @@
       <option name="project" value="LOCAL" />
       <updated>1676253533579</updated>
     </task>
-    <option name="localTasksCounter" value="11" />
+    <task id="LOCAL-00011" summary="[update]0.7版本">
+      <created>1676342800141</created>
+      <option name="number" value="00011" />
+      <option name="presentableId" value="LOCAL-00011" />
+      <option name="project" value="LOCAL" />
+      <updated>1676342800141</updated>
+    </task>
+    <option name="localTasksCounter" value="12" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">

+ 5 - 0
fusion-analysis/src/main/java/cn/com/taiji/constants/EsIndexConstants.java

@@ -43,4 +43,9 @@ public class EsIndexConstants {
      * 中远海雷达
      */
     public static final String INDEX_SEAT_TRACK_ZYH = "index_seat_zyh_radar_track_";
+
+    /**
+     * 俯瞰融合
+     */
+    public static final String INDEX_SEAT_FK_REALTIMETRAJECTORY_TEST = "index_seat_fk_realtimetrajectory_test";
 }

+ 24 - 0
fusion-analysis/src/main/java/cn/com/taiji/controller/FusionAnalysisController.java

@@ -94,4 +94,28 @@ public class FusionAnalysisController {
     public void tianaoStaticOrDynamicLeaveOutExcel(@RequestBody FusionQuery query, HttpServletResponse response) throws IOException, ParseException {
         fusionAnalysisService.tianaoStaticOrDynamicLeaveOutExcel(query,response);
     }
+
+    /**
+     * 轨迹融合-航速航向异常波动-识别融合速度异常波动问题
+     * @param query
+     * @param response
+     * @throws IOException
+     * @throws ParseException
+     */
+    @PostMapping("excel/three")
+    public void fusionAnalysisExcelThree(@RequestBody FusionQuery query, HttpServletResponse response) throws IOException, ParseException {
+        fusionAnalysisService.fusionAnalysisExcelThree(query,response);
+    }
+
+    /**
+     * 轨迹融合-航速航向异常波动-识别融合航向异常波动问题
+     * @param query
+     * @param response
+     * @throws IOException
+     * @throws ParseException
+     */
+    @PostMapping("excel/four")
+    public void fusionAnalysisExcelFour(@RequestBody FusionQuery query, HttpServletResponse response) throws IOException, ParseException {
+        fusionAnalysisService.fusionAnalysisExcelFour(query,response);
+    }
 }

+ 18 - 0
fusion-analysis/src/main/java/cn/com/taiji/service/FusionAnalysisService.java

@@ -65,4 +65,22 @@ public interface FusionAnalysisService {
      * @throws ParseException
      */
     void tianaoStaticOrDynamicLeaveOutExcel(FusionQuery query, HttpServletResponse response) throws IOException, ParseException;
+
+    /**
+     * 识别融合速度异常波动问题
+     * @param query
+     * @param response
+     * @throws IOException
+     * @throws ParseException
+     */
+    void fusionAnalysisExcelThree(FusionQuery query, HttpServletResponse response) throws IOException, ParseException;
+
+    /**
+     * 识别融合航向异常波动问题
+     * @param query
+     * @param response
+     * @throws IOException
+     * @throws ParseException
+     */
+    void fusionAnalysisExcelFour(FusionQuery query, HttpServletResponse response) throws IOException, ParseException;
 }

+ 276 - 16
fusion-analysis/src/main/java/cn/com/taiji/service/impl/FusionAnalysisServiceImpl.java

@@ -21,6 +21,7 @@ import org.elasticsearch.client.HttpAsyncResponseConsumerFactory;
 import org.elasticsearch.client.RequestOptions;
 import org.elasticsearch.client.RestClientBuilder;
 import org.elasticsearch.client.RestHighLevelClient;
+import org.elasticsearch.common.geo.GeoPoint;
 import org.elasticsearch.core.TimeValue;
 import org.elasticsearch.index.query.BoolQueryBuilder;
 import org.elasticsearch.index.query.QueryBuilders;
@@ -83,11 +84,17 @@ public class FusionAnalysisServiceImpl implements FusionAnalysisService {
         List<FusionData> list = new CopyOnWriteArrayList<>();
         Date startTime = DateUtils.parse(query.getStartTime(),"yyyy-MM-dd");
         String time = DateUtils.format(startTime,"yyyy-MM-dd");
-        SearchRequest request = new SearchRequest(INDEX_SEAT_REALTIMETRAJECTORY+time);
+        SearchRequest request = new SearchRequest(INDEX_SEAT_FK_REALTIMETRAJECTORY_TEST);
         // 构建查询条件
         BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
         SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
         boolQueryBuilder.filter(QueryBuilders.rangeQuery("mergeTime").gte(query.getStartTime()).lte(query.getEndTime()));
+        double[] doubles = new double[]{109.05069874931793,19.75955316191097,109.20963772383247,19.811999020000147,109.35696654655628,19.782373115430687,109.33374624297481,19.66386949715284,109.09473725611036,19.617428889989903,109.05069874931793,19.75955316191097};
+        List<GeoPoint> points = new ArrayList<>();
+        for(int i = 0 ;i < doubles.length;i=i+2) {
+            points.add(new GeoPoint(doubles[i+1],doubles[i]));
+        }
+        boolQueryBuilder.filter(QueryBuilders.geoPolygonQuery("location", points));
         searchSourceBuilder.query(boolQueryBuilder);
 //        TermsAggregationBuilder aggBuilder = AggregationBuilders.terms("ship_field_agg")
 //                .field("mergeTarget")
@@ -226,11 +233,17 @@ public class FusionAnalysisServiceImpl implements FusionAnalysisService {
         List<FusionData> list = new CopyOnWriteArrayList<>();
         Date startTime = DateUtils.parse(query.getStartTime(),"yyyy-MM-dd");
         String time = DateUtils.format(startTime,"yyyy-MM-dd");
-        SearchRequest request = new SearchRequest(INDEX_SEAT_REALTIMETRAJECTORY+time);
+        SearchRequest request = new SearchRequest(INDEX_SEAT_FK_REALTIMETRAJECTORY_TEST);
         // 构建查询条件
         BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
         SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
         boolQueryBuilder.filter(QueryBuilders.rangeQuery("mergeTime").gte(query.getStartTime()).lte(query.getEndTime()));
+        double[] doubles = new double[]{109.05069874931793,19.75955316191097,109.20963772383247,19.811999020000147,109.35696654655628,19.782373115430687,109.33374624297481,19.66386949715284,109.09473725611036,19.617428889989903,109.05069874931793,19.75955316191097};
+        List<GeoPoint> points = new ArrayList<>();
+        for(int i = 0 ;i < doubles.length;i=i+2) {
+            points.add(new GeoPoint(doubles[i+1],doubles[i]));
+        }
+        boolQueryBuilder.filter(QueryBuilders.geoPolygonQuery("location", points));
         searchSourceBuilder.query(boolQueryBuilder);
 //        TermsAggregationBuilder aggBuilder = AggregationBuilders.terms("ship_field_agg")
 //                .field("mergeTarget")
@@ -395,6 +408,12 @@ public class FusionAnalysisServiceImpl implements FusionAnalysisService {
         BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
         SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
         boolQueryBuilder.filter(QueryBuilders.rangeQuery("receiveTime").gte(query.getStartTime()).lte(query.getEndTime()));
+        double[] doubles = new double[]{109.05069874931793,19.75955316191097,109.20963772383247,19.811999020000147,109.35696654655628,19.782373115430687,109.33374624297481,19.66386949715284,109.09473725611036,19.617428889989903,109.05069874931793,19.75955316191097};
+        List<GeoPoint> points = new ArrayList<>();
+        for(int i = 0 ;i < doubles.length;i=i+2) {
+            points.add(new GeoPoint(doubles[i+1],doubles[i]));
+        }
+        boolQueryBuilder.filter(QueryBuilders.geoPolygonQuery("location", points));
         searchSourceBuilder.query(boolQueryBuilder);
 //        TermsAggregationBuilder aggBuilder = AggregationBuilders.terms("ship_field_agg")
 //                .field("fusionBatchNum")
@@ -420,22 +439,22 @@ public class FusionAnalysisServiceImpl implements FusionAnalysisService {
         }
         outList = change(inList, "fusionBatchNum", outList);
         outList.forEach(map-> {
-                    JSONObject maps = JSONObject.parseObject(JSON.toJSONString(map));
+            JSONObject maps = JSONObject.parseObject(JSON.toJSONString(map));
 //            JSONObject maps = new JSONObject();
 //            Iterator it = map.keySet().iterator();
 //            while (it.hasNext()) {
 //                String key = (String) it.next();
 //                maps.put(key, map.get(key));
 //            }
-                    JSONArray jsonArray = JSONArray.parseArray(maps.getString("array"));
-                    if (jsonArray.size() > 0) {
-                        JSONObject job = jsonArray.getJSONObject(0);
-                        LeaceOutDto dto = new LeaceOutDto();
-                        dto.setBatchNumber(job.getString("fusionBatchNum"));
-            dto.setCount((long) jsonArray.size());
-            dtos.add(dto);
-                    }
-                });
+            JSONArray jsonArray = JSONArray.parseArray(maps.getString("array"));
+            if (jsonArray.size() > 0) {
+                JSONObject job = jsonArray.getJSONObject(0);
+                LeaceOutDto dto = new LeaceOutDto();
+                dto.setBatchNumber(job.getString("fusionBatchNum"));
+                dto.setCount((long) jsonArray.size());
+                dtos.add(dto);
+            }
+        });
 //        Aggregations aggregations = search.getAggregations();
 //        ParsedStringTerms aggregation = aggregations.get("ship_field_agg");
 //        for (Terms.Bucket bucket : aggregation.getBuckets()) {
@@ -446,13 +465,19 @@ public class FusionAnalysisServiceImpl implements FusionAnalysisService {
 //        }
         dtos.forEach(item->{
             LeaveOutData data = new LeaveOutData();
-            SearchRequest request2 = new SearchRequest(INDEX_SEAT_REALTIMETRAJECTORY_TEST+time);
+            SearchRequest request2 = new SearchRequest(INDEX_SEAT_FK_REALTIMETRAJECTORY_TEST);
             // 构建查询条件
             BoolQueryBuilder boolQueryBuilder2 = QueryBuilders.boolQuery();
             SearchSourceBuilder searchSourceBuilder2 = new SearchSourceBuilder();
             boolQueryBuilder2.filter(QueryBuilders.wildcardQuery("trackDeviceNo", "*,"+ item.getBatchNumber() +",*"));
             boolQueryBuilder2.filter(QueryBuilders.rangeQuery("mergeTime").gte(query.getStartTime()).lte(query.getEndTime()));
             boolQueryBuilder2.filter(QueryBuilders.termsQuery("mergeType","TA_RADAR"));
+            double[] doubles2 = new double[]{109.05069874931793,19.75955316191097,109.20963772383247,19.811999020000147,109.35696654655628,19.782373115430687,109.33374624297481,19.66386949715284,109.09473725611036,19.617428889989903,109.05069874931793,19.75955316191097};
+            List<GeoPoint> points2 = new ArrayList<>();
+            for(int i = 0 ;i < doubles2.length;i=i+2) {
+                points2.add(new GeoPoint(doubles2[i+1],doubles2[i]));
+            }
+            boolQueryBuilder2.filter(QueryBuilders.geoPolygonQuery("location", points2));
             searchSourceBuilder2.query(boolQueryBuilder2)
                     .trackTotalHits(true)
                     .size(query.getPageSize())
@@ -514,6 +539,12 @@ public class FusionAnalysisServiceImpl implements FusionAnalysisService {
         BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
         SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
         boolQueryBuilder.filter(QueryBuilders.rangeQuery("locationTime").gte(query.getStartTime()).lte(query.getEndTime()));
+        double[] doubles = new double[]{109.05069874931793,19.75955316191097,109.20963772383247,19.811999020000147,109.35696654655628,19.782373115430687,109.33374624297481,19.66386949715284,109.09473725611036,19.617428889989903,109.05069874931793,19.75955316191097};
+        List<GeoPoint> points = new ArrayList<>();
+        for(int i = 0 ;i < doubles.length;i=i+2) {
+            points.add(new GeoPoint(doubles[i+1],doubles[i]));
+        }
+        boolQueryBuilder.filter(QueryBuilders.geoPolygonQuery("location", points));
         searchSourceBuilder.query(boolQueryBuilder);
 //        TermsAggregationBuilder aggBuilder = AggregationBuilders.terms("ship_field_agg")
 //                .field("fusionBatchNum")
@@ -565,13 +596,19 @@ public class FusionAnalysisServiceImpl implements FusionAnalysisService {
 //        }
         dtos.forEach(item->{
             LeaveOutData data = new LeaveOutData();
-            SearchRequest request2 = new SearchRequest(INDEX_SEAT_REALTIMETRAJECTORY+time);
+            SearchRequest request2 = new SearchRequest(INDEX_SEAT_FK_REALTIMETRAJECTORY_TEST);
             // 构建查询条件
             BoolQueryBuilder boolQueryBuilder2 = QueryBuilders.boolQuery();
             SearchSourceBuilder searchSourceBuilder2 = new SearchSourceBuilder();
             boolQueryBuilder2.filter(QueryBuilders.wildcardQuery("trackDeviceNo", "*,"+ item.getBatchNumber() +",*"));
             boolQueryBuilder2.filter(QueryBuilders.rangeQuery("mergeTime").gte(query.getStartTime()).lte(query.getEndTime()));
             boolQueryBuilder2.filter(QueryBuilders.termsQuery("mergeType","BEIDOU","AIS_BEIDOU","BEIDOU_RADAR","AIS_BEIDOU_RADAR"));
+            double[] doubles2 = new double[]{109.05069874931793,19.75955316191097,109.20963772383247,19.811999020000147,109.35696654655628,19.782373115430687,109.33374624297481,19.66386949715284,109.09473725611036,19.617428889989903,109.05069874931793,19.75955316191097};
+            List<GeoPoint> points2 = new ArrayList<>();
+            for(int i = 0 ;i < doubles2.length;i=i+2) {
+                points2.add(new GeoPoint(doubles2[i+1],doubles2[i]));
+            }
+            boolQueryBuilder2.filter(QueryBuilders.geoPolygonQuery("location", points2));
             searchSourceBuilder2.query(boolQueryBuilder2)
                     .trackTotalHits(true)
                     .size(query.getPageSize())
@@ -633,6 +670,12 @@ public class FusionAnalysisServiceImpl implements FusionAnalysisService {
         BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
         SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
         boolQueryBuilder.filter(QueryBuilders.rangeQuery("time").gte(query.getStartTime()).lte(query.getEndTime()));
+        double[] doubles = new double[]{109.05069874931793,19.75955316191097,109.20963772383247,19.811999020000147,109.35696654655628,19.782373115430687,109.33374624297481,19.66386949715284,109.09473725611036,19.617428889989903,109.05069874931793,19.75955316191097};
+        List<GeoPoint> points = new ArrayList<>();
+        for(int i = 0 ;i < doubles.length;i=i+2) {
+            points.add(new GeoPoint(doubles[i+1],doubles[i]));
+        }
+        boolQueryBuilder.filter(QueryBuilders.geoPolygonQuery("location", points));
         searchSourceBuilder.query(boolQueryBuilder);
 //        TermsAggregationBuilder aggBuilder = AggregationBuilders.terms("ship_field_agg")
 //                .field("fusionBatchNum")
@@ -684,13 +727,19 @@ public class FusionAnalysisServiceImpl implements FusionAnalysisService {
 //        }
         dtos.forEach(item->{
             LeaveOutData data = new LeaveOutData();
-            SearchRequest request2 = new SearchRequest(INDEX_SEAT_REALTIMETRAJECTORY_TEST+time);
+            SearchRequest request2 = new SearchRequest(INDEX_SEAT_FK_REALTIMETRAJECTORY_TEST);
             // 构建查询条件
             BoolQueryBuilder boolQueryBuilder2 = QueryBuilders.boolQuery();
             SearchSourceBuilder searchSourceBuilder2 = new SearchSourceBuilder();
             boolQueryBuilder2.filter(QueryBuilders.wildcardQuery("trackDeviceNo", "*,"+ item.getBatchNumber() +",*"));
             boolQueryBuilder2.filter(QueryBuilders.rangeQuery("mergeTime").gte(query.getStartTime()).lte(query.getEndTime()));
             boolQueryBuilder2.filter(QueryBuilders.termsQuery("mergeType","HLX_AIS_RADAR","HLX_AIS","HLX_RADAR","HLX_ZYD_RADAR"));
+            double[] doubles2 = new double[]{109.05069874931793,19.75955316191097,109.20963772383247,19.811999020000147,109.35696654655628,19.782373115430687,109.33374624297481,19.66386949715284,109.09473725611036,19.617428889989903,109.05069874931793,19.75955316191097};
+            List<GeoPoint> points2 = new ArrayList<>();
+            for(int i = 0 ;i < doubles2.length;i=i+2) {
+                points2.add(new GeoPoint(doubles2[i+1],doubles2[i]));
+            }
+            boolQueryBuilder2.filter(QueryBuilders.geoPolygonQuery("location", points2));
             searchSourceBuilder2.query(boolQueryBuilder2)
                     .trackTotalHits(true)
                     .size(query.getPageSize())
@@ -753,6 +802,12 @@ public class FusionAnalysisServiceImpl implements FusionAnalysisService {
         SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
         boolQueryBuilder.filter(QueryBuilders.rangeQuery("receiveTime").gte(query.getStartTime()).lte(query.getEndTime()));
         boolQueryBuilder.mustNot(QueryBuilders.termQuery("targetProper","0"));
+        double[] doubles = new double[]{109.05069874931793,19.75955316191097,109.20963772383247,19.811999020000147,109.35696654655628,19.782373115430687,109.33374624297481,19.66386949715284,109.09473725611036,19.617428889989903,109.05069874931793,19.75955316191097};
+        List<GeoPoint> points = new ArrayList<>();
+        for(int i = 0 ;i < doubles.length;i=i+2) {
+            points.add(new GeoPoint(doubles[i+1],doubles[i]));
+        }
+        boolQueryBuilder.filter(QueryBuilders.geoPolygonQuery("location", points));
         searchSourceBuilder.query(boolQueryBuilder);
 //        TermsAggregationBuilder aggBuilder = AggregationBuilders.terms("ship_field_agg")
 //                .field("fusionBatchNum")
@@ -795,7 +850,7 @@ public class FusionAnalysisServiceImpl implements FusionAnalysisService {
         });
         dtos.forEach(item->{
             StaticOrDynamicData data = new StaticOrDynamicData();
-            SearchRequest request2 = new SearchRequest(INDEX_SEAT_REALTIMETRAJECTORY_TEST+time);
+            SearchRequest request2 = new SearchRequest(INDEX_SEAT_FK_REALTIMETRAJECTORY_TEST);
             // 构建查询条件
             BoolQueryBuilder boolQueryBuilder2 = QueryBuilders.boolQuery();
             SearchSourceBuilder searchSourceBuilder2 = new SearchSourceBuilder();
@@ -803,6 +858,12 @@ public class FusionAnalysisServiceImpl implements FusionAnalysisService {
             boolQueryBuilder2.filter(QueryBuilders.termQuery("targetType","0"));
             boolQueryBuilder2.filter(QueryBuilders.rangeQuery("mergeTime").gte(query.getStartTime()).lte(query.getEndTime()));
             boolQueryBuilder2.filter(QueryBuilders.termsQuery("mergeType","RADAR","AIS_RADAR","BEIDOU_RADAR","AIS_BEIDOU_RADAR"));
+            double[] doubles2 = new double[]{109.05069874931793,19.75955316191097,109.20963772383247,19.811999020000147,109.35696654655628,19.782373115430687,109.33374624297481,19.66386949715284,109.09473725611036,19.617428889989903,109.05069874931793,19.75955316191097};
+            List<GeoPoint> points2 = new ArrayList<>();
+            for(int i = 0 ;i < doubles2.length;i=i+2) {
+                points2.add(new GeoPoint(doubles2[i+1],doubles2[i]));
+            }
+            boolQueryBuilder2.filter(QueryBuilders.geoPolygonQuery("location", points2));
             searchSourceBuilder2.query(boolQueryBuilder2)
                     .trackTotalHits(true)
                     .size(query.getPageSize())
@@ -843,6 +904,197 @@ public class FusionAnalysisServiceImpl implements FusionAnalysisService {
         }
     }
 
+    @Override
+    public void fusionAnalysisExcelThree(FusionQuery query, HttpServletResponse response) throws IOException, ParseException {
+        List<FusionData> list = new CopyOnWriteArrayList<>();
+        Date startTime = DateUtils.parse(query.getStartTime(),"yyyy-MM-dd");
+        String time = DateUtils.format(startTime,"yyyy-MM-dd");
+        SearchRequest request = new SearchRequest(INDEX_SEAT_FK_REALTIMETRAJECTORY_TEST);
+        // 构建查询条件
+        BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
+        SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
+        boolQueryBuilder.filter(QueryBuilders.rangeQuery("mergeTime").gte(query.getStartTime()).lte(query.getEndTime()));
+        double[] doubles = new double[]{109.05069874931793,19.75955316191097,109.20963772383247,19.811999020000147,109.35696654655628,19.782373115430687,109.33374624297481,19.66386949715284,109.09473725611036,19.617428889989903,109.05069874931793,19.75955316191097};
+        List<GeoPoint> points = new ArrayList<>();
+        for(int i = 0 ;i < doubles.length;i=i+2) {
+            points.add(new GeoPoint(doubles[i+1],doubles[i]));
+        }
+        boolQueryBuilder.filter(QueryBuilders.geoPolygonQuery("location", points));
+        searchSourceBuilder.query(boolQueryBuilder);
+        searchSourceBuilder
+                .trackTotalHits(true)
+                .sort(SortBuilders.fieldSort("mergeTime").order(SortOrder.ASC))
+                .size(query.getPageSize())
+                .timeout(TimeValue.timeValueHours(1L))
+                .timeout(TimeValue.timeValueMinutes(30L))
+                .timeout(TimeValue.timeValueSeconds(500L));
+        request.source(searchSourceBuilder);
+        SearchResponse search = client.search(request, COMMON_OPTIONS);
+        SearchHits searchHits = search.getHits();
+        SearchHit[] hits = searchHits.getHits();
+        List<Map<String, Object>> inList = new CopyOnWriteArrayList<Map<String, Object>>();
+        List<Map<String, Object>> outList = new CopyOnWriteArrayList<Map<String, Object>>();
+        for (SearchHit hit : hits) {
+            Map<String, Object> map = new ConcurrentHashMap();
+            map = hit.getSourceAsMap();
+            inList.add(map);
+        }
+        outList = change(inList, "mergeTarget", outList);
+        outList.forEach(map->{
+            JSONObject maps = JSONObject.parseObject(JSON.toJSONString(map));
+            JSONArray jsonArray =JSONArray.parseArray(maps.getString("array"));
+            if (jsonArray.size()>0){
+                FusionData data = new FusionData();
+                Integer num = 0;
+                for (int i = 0; i < jsonArray.size(); i++) {
+                    if (i<jsonArray.size()-1){
+                        JSONObject job = jsonArray.getJSONObject(i);
+                        JSONObject job2 = jsonArray.getJSONObject(i+1);
+                        String targetSpeed = job.get("targetSpeed").toString();
+                        String targetSpeed2 = job2.get("targetSpeed").toString();
+                        Double d= Double.parseDouble(targetSpeed);
+                        Double d2= Double.parseDouble(targetSpeed2);
+                        Double aDouble = speedUtils(d, d2);
+                        if (Double.doubleToLongBits(aDouble)>3L){
+                            num++;
+                        }
+                    }
+                }
+                if (num>0){
+                    JSONObject sourceItem = jsonArray.getJSONObject(0);
+                    JSONObject sourceItem2 = jsonArray.getJSONObject(jsonArray.size()-1);
+                    data.setMergeTarget(sourceItem.getString("mergeTarget"));
+                    data.setTrackCount((long) jsonArray.size());
+                    Date date = null;
+                    Date date2 = null;
+                    try {
+                        date = DateUtils.parse(sourceItem.getString("mergeTime"),"yyyy-MM-dd HH:mm:ss.SSS");
+                        date2 = DateUtils.parse(sourceItem2.getString("mergeTime"),"yyyy-MM-dd HH:mm:ss.SSS");
+                    } catch (ParseException e) {
+                        e.printStackTrace();
+                    }
+                    if (date.getTime()>date2.getTime()){
+                        data.setStartTime(sourceItem2.getString("mergeTime"));
+                        data.setEndTime(sourceItem.getString("mergeTime"));
+                    }else {
+                        data.setStartTime(sourceItem.getString("mergeTime"));
+                        data.setEndTime(sourceItem2.getString("mergeTime"));
+                    }
+                    data.setFluctuateNumber(num);
+                    list.add(data);
+                }
+            }
+        });
+        try {
+            System.out.println("进入导出识别融合速度异常波动问题");
+            response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+            response.setCharacterEncoding("utf-8");
+            String fileName = URLEncoder.encode("识别融合速度异常波动问题", "UTF-8");
+            response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xlsx");
+            EasyExcel.write(response.getOutputStream(), FusionData.class).sheet("识别融合数据率波动问题")
+                    .doWrite(list);
+        } catch (Exception e) {
+            // 重置response
+            System.out.println("导出识别融合速度异常波动问题excel失败:{}" + e.getMessage() + e);
+        }
+    }
+
+    @Override
+    public void fusionAnalysisExcelFour(FusionQuery query, HttpServletResponse response) throws IOException, ParseException {
+        List<FusionData> list = new CopyOnWriteArrayList<>();
+        Date startTime = DateUtils.parse(query.getStartTime(),"yyyy-MM-dd");
+        String time = DateUtils.format(startTime,"yyyy-MM-dd");
+        SearchRequest request = new SearchRequest(INDEX_SEAT_FK_REALTIMETRAJECTORY_TEST);
+        // 构建查询条件
+        BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
+        SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
+        boolQueryBuilder.filter(QueryBuilders.rangeQuery("mergeTime").gte(query.getStartTime()).lte(query.getEndTime()));
+        double[] doubles = new double[]{109.05069874931793,19.75955316191097,109.20963772383247,19.811999020000147,109.35696654655628,19.782373115430687,109.33374624297481,19.66386949715284,109.09473725611036,19.617428889989903,109.05069874931793,19.75955316191097};
+        List<GeoPoint> points = new ArrayList<>();
+        for(int i = 0 ;i < doubles.length;i=i+2) {
+            points.add(new GeoPoint(doubles[i+1],doubles[i]));
+        }
+        boolQueryBuilder.filter(QueryBuilders.geoPolygonQuery("location", points));
+        searchSourceBuilder.query(boolQueryBuilder);
+        searchSourceBuilder
+                .trackTotalHits(true)
+                .sort(SortBuilders.fieldSort("mergeTime").order(SortOrder.ASC))
+                .size(query.getPageSize())
+                .timeout(TimeValue.timeValueHours(1L))
+                .timeout(TimeValue.timeValueMinutes(30L))
+                .timeout(TimeValue.timeValueSeconds(500L));
+        request.source(searchSourceBuilder);
+        SearchResponse search = client.search(request, COMMON_OPTIONS);
+        SearchHits searchHits = search.getHits();
+        SearchHit[] hits = searchHits.getHits();
+        List<Map<String, Object>> inList = new CopyOnWriteArrayList<Map<String, Object>>();
+        List<Map<String, Object>> outList = new CopyOnWriteArrayList<Map<String, Object>>();
+        for (SearchHit hit : hits) {
+            Map<String, Object> map = new ConcurrentHashMap();
+            map = hit.getSourceAsMap();
+            inList.add(map);
+        }
+        outList = change(inList, "mergeTarget", outList);
+        outList.forEach(map->{
+            JSONObject maps = JSONObject.parseObject(JSON.toJSONString(map));
+            JSONArray jsonArray =JSONArray.parseArray(maps.getString("array"));
+            if (jsonArray.size()>0){
+                FusionData data = new FusionData();
+                Integer num = 0;
+                for (int i = 0; i < jsonArray.size(); i++) {
+                    if (i<jsonArray.size()-1){
+                        JSONObject job = jsonArray.getJSONObject(i);
+                        JSONObject job2 = jsonArray.getJSONObject(i+1);
+                        String targetCourse = job.get("targetCourse").toString();
+                        String targetCourse2 = job2.get("targetCourse").toString();
+                        Double d= Double.parseDouble(targetCourse);
+                        Double d2= Double.parseDouble(targetCourse2);
+                        Double aDouble = speedUtils(d, d2);
+                        if (Double.doubleToLongBits(aDouble)>60L){
+                            num++;
+                        }
+                    }
+                }
+                if (num>0){
+                    JSONObject sourceItem = jsonArray.getJSONObject(0);
+                    JSONObject sourceItem2 = jsonArray.getJSONObject(jsonArray.size()-1);
+                    data.setMergeTarget(sourceItem.getString("mergeTarget"));
+                    data.setTrackCount((long) jsonArray.size());
+                    Date date = null;
+                    Date date2 = null;
+                    try {
+                        date = DateUtils.parse(sourceItem.getString("mergeTime"),"yyyy-MM-dd HH:mm:ss.SSS");
+                        date2 = DateUtils.parse(sourceItem2.getString("mergeTime"),"yyyy-MM-dd HH:mm:ss.SSS");
+                    } catch (ParseException e) {
+                        e.printStackTrace();
+                    }
+                    if (date.getTime()>date2.getTime()){
+                        data.setStartTime(sourceItem2.getString("mergeTime"));
+                        data.setEndTime(sourceItem.getString("mergeTime"));
+                    }else {
+                        data.setStartTime(sourceItem.getString("mergeTime"));
+                        data.setEndTime(sourceItem2.getString("mergeTime"));
+                    }
+                    data.setFluctuateNumber(num);
+                    list.add(data);
+                }
+            }
+        });
+        try {
+            System.out.println("进入导出识别融合航向异常波动问题");
+            response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+            response.setCharacterEncoding("utf-8");
+            String fileName = URLEncoder.encode("识别融合数据率波动问题", "UTF-8");
+            response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xlsx");
+            EasyExcel.write(response.getOutputStream(), FusionData.class).sheet("识别融合数据率波动问题")
+                    .doWrite(list);
+        } catch (Exception e) {
+            // 重置response
+            System.out.println("导出识别融合航向异常波动问题excel失败:{}" + e.getMessage() + e);
+        }
+    }
+
+
     /**
      * 按照List<Map<String,Object>>里面map的某个value重新封装成多个不同的list, 原始数据类型List<Map<String,Object>>, 转换后数据类型Map<String,List<Map<String,Object>>>
      * @param inList
@@ -886,4 +1138,12 @@ public class FusionAnalysisServiceImpl implements FusionAnalysisService {
             return twoTime-oneTime;
         }
     }
+
+    public Double speedUtils(Double d,Double d2){
+        if (Double.doubleToLongBits(d)>Double.doubleToLongBits(d2)){
+            return d-d2;
+        }else {
+            return d2-d;
+        }
+    }
 }

+ 1 - 1
fusion-analysis/src/main/resources/application.yml

@@ -3,7 +3,7 @@ server:
 
 spring:
   application.name: fusion-analysis
-#  profiles.active: prod
+  profiles.active: prod
 
 taiji:
   elasticsearch.rest: