Browse Source

[update]0.7版本

xiahailong 2 years ago
parent
commit
8accf7c909

+ 18 - 15
fusion-analysis/src/main/java/cn/com/taiji/service/impl/FusionAnalysisServiceImpl.java

@@ -81,7 +81,7 @@ 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_FK_REALTIMETRAJECTORY_TEST);
+        SearchRequest request = new SearchRequest(INDEX_SEAT_REALTIMETRAJECTORY+time);
         // 构建查询条件
         BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
         SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
@@ -133,6 +133,7 @@ public class FusionAnalysisServiceImpl implements FusionAnalysisService {
 //            }
             JSONArray jsonArray =JSONArray.parseArray(maps.getString("array"));
             if (jsonArray.size()>0){
+                jsonArray.sort(Comparator.comparing(obj->((JSONObject)obj).getDate("mergeTime"),Comparator.nullsFirst(Comparator.naturalOrder())));
                 FusionData data = new FusionData();
                 Integer num = 0;
                 for (int i = 0; i < jsonArray.size(); i++) {
@@ -230,7 +231,7 @@ 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_FK_REALTIMETRAJECTORY_TEST);
+        SearchRequest request = new SearchRequest(INDEX_SEAT_REALTIMETRAJECTORY+time);
         // 构建查询条件
         BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
         SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
@@ -462,7 +463,7 @@ public class FusionAnalysisServiceImpl implements FusionAnalysisService {
 //        }
         dtos.forEach(item->{
             LeaveOutData data = new LeaveOutData();
-            SearchRequest request2 = new SearchRequest(INDEX_SEAT_FK_REALTIMETRAJECTORY_TEST);
+            SearchRequest request2 = new SearchRequest(INDEX_SEAT_REALTIMETRAJECTORY+time);
             // 构建查询条件
             BoolQueryBuilder boolQueryBuilder2 = QueryBuilders.boolQuery();
             SearchSourceBuilder searchSourceBuilder2 = new SearchSourceBuilder();
@@ -593,7 +594,7 @@ public class FusionAnalysisServiceImpl implements FusionAnalysisService {
 //        }
         dtos.forEach(item->{
             LeaveOutData data = new LeaveOutData();
-            SearchRequest request2 = new SearchRequest(INDEX_SEAT_FK_REALTIMETRAJECTORY_TEST);
+            SearchRequest request2 = new SearchRequest(INDEX_SEAT_REALTIMETRAJECTORY+time);
             // 构建查询条件
             BoolQueryBuilder boolQueryBuilder2 = QueryBuilders.boolQuery();
             SearchSourceBuilder searchSourceBuilder2 = new SearchSourceBuilder();
@@ -724,7 +725,7 @@ public class FusionAnalysisServiceImpl implements FusionAnalysisService {
 //        }
         dtos.forEach(item->{
             LeaveOutData data = new LeaveOutData();
-            SearchRequest request2 = new SearchRequest(INDEX_SEAT_FK_REALTIMETRAJECTORY_TEST);
+            SearchRequest request2 = new SearchRequest(INDEX_SEAT_REALTIMETRAJECTORY+time);
             // 构建查询条件
             BoolQueryBuilder boolQueryBuilder2 = QueryBuilders.boolQuery();
             SearchSourceBuilder searchSourceBuilder2 = new SearchSourceBuilder();
@@ -847,7 +848,7 @@ public class FusionAnalysisServiceImpl implements FusionAnalysisService {
         });
         dtos.forEach(item->{
             StaticOrDynamicData data = new StaticOrDynamicData();
-            SearchRequest request2 = new SearchRequest(INDEX_SEAT_FK_REALTIMETRAJECTORY_TEST);
+            SearchRequest request2 = new SearchRequest(INDEX_SEAT_REALTIMETRAJECTORY+time);
             // 构建查询条件
             BoolQueryBuilder boolQueryBuilder2 = QueryBuilders.boolQuery();
             SearchSourceBuilder searchSourceBuilder2 = new SearchSourceBuilder();
@@ -906,7 +907,7 @@ 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_FK_REALTIMETRAJECTORY_TEST);
+        SearchRequest request = new SearchRequest(INDEX_SEAT_REALTIMETRAJECTORY+time);
         // 构建查询条件
         BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
         SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
@@ -941,6 +942,7 @@ public class FusionAnalysisServiceImpl implements FusionAnalysisService {
             JSONObject maps = JSONObject.parseObject(JSON.toJSONString(map));
             JSONArray jsonArray =JSONArray.parseArray(maps.getString("array"));
             if (jsonArray.size()>0){
+                jsonArray.sort(Comparator.comparing(obj->((JSONObject)obj).getDate("mergeTime"),Comparator.nullsFirst(Comparator.naturalOrder())));
                 FusionData data = new FusionData();
                 Integer num = 0;
                 for (int i = 0; i < jsonArray.size(); i++) {
@@ -952,7 +954,7 @@ public class FusionAnalysisServiceImpl implements FusionAnalysisService {
                         Double d= Double.parseDouble(targetSpeed);
                         Double d2= Double.parseDouble(targetSpeed2);
                         Double aDouble = speedUtils(d, d2);
-                        if (Double.doubleToLongBits(aDouble)>3L){
+                        if (aDouble>3.0D){
                             num++;
                         }
                     }
@@ -988,7 +990,7 @@ public class FusionAnalysisServiceImpl implements FusionAnalysisService {
             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("识别融合数据率波动问题")
+            EasyExcel.write(response.getOutputStream(), FusionData.class).sheet("识别融合速度异常波动问题")
                     .doWrite(list);
         } catch (Exception e) {
             // 重置response
@@ -1001,7 +1003,7 @@ 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_FK_REALTIMETRAJECTORY_TEST);
+        SearchRequest request = new SearchRequest(INDEX_SEAT_REALTIMETRAJECTORY+time);
         // 构建查询条件
         BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
         SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
@@ -1036,6 +1038,7 @@ public class FusionAnalysisServiceImpl implements FusionAnalysisService {
             JSONObject maps = JSONObject.parseObject(JSON.toJSONString(map));
             JSONArray jsonArray =JSONArray.parseArray(maps.getString("array"));
             if (jsonArray.size()>0){
+                jsonArray.sort(Comparator.comparing(obj->((JSONObject)obj).getDate("mergeTime"),Comparator.nullsFirst(Comparator.naturalOrder())));
                 FusionData data = new FusionData();
                 Integer num = 0;
                 for (int i = 0; i < jsonArray.size(); i++) {
@@ -1047,7 +1050,7 @@ public class FusionAnalysisServiceImpl implements FusionAnalysisService {
                         Double d= Double.parseDouble(targetCourse);
                         Double d2= Double.parseDouble(targetCourse2);
                         Double aDouble = speedUtils(d, d2);
-                        if (Double.doubleToLongBits(aDouble)>60L){
+                        if (aDouble>60.0D){
                             num++;
                         }
                     }
@@ -1083,7 +1086,7 @@ public class FusionAnalysisServiceImpl implements FusionAnalysisService {
             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("识别融合数据率波动问题")
+            EasyExcel.write(response.getOutputStream(), FusionData.class).sheet("识别融合航向异常波动问题")
                     .doWrite(list);
         } catch (Exception e) {
             // 重置response
@@ -1096,7 +1099,7 @@ public class FusionAnalysisServiceImpl implements FusionAnalysisService {
         List<OriginalData> 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);
+        SearchRequest request = new SearchRequest(INDEX_SEAT_REALTIMETRAJECTORY+time);
         // 构建查询条件
         BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
         SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
@@ -1279,7 +1282,7 @@ public class FusionAnalysisServiceImpl implements FusionAnalysisService {
         List<FuseOriginal> 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);
+        SearchRequest request = new SearchRequest(INDEX_SEAT_REALTIMETRAJECTORY+time);
         // 构建查询条件
         BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
         SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
@@ -1458,7 +1461,7 @@ public class FusionAnalysisServiceImpl implements FusionAnalysisService {
     }
 
     public Double speedUtils(Double d,Double d2){
-        if (Double.doubleToLongBits(d)>Double.doubleToLongBits(d2)){
+        if (d>d2){
             return d-d2;
         }else {
             return d2-d;