Browse Source

[update]0.7版本

xiahailong 2 years ago
parent
commit
b04a04f287

+ 3 - 4
.idea/workspace.xml

@@ -4,13 +4,12 @@
     <option name="autoReloadType" value="SELECTIVE" />
   </component>
   <component name="ChangeListManager">
-    <list default="true" id="3bf79822-fe13-41ea-bc8f-858fbea129e7" name="Changes" comment="[update]0.7版本">
+    <list default="true" id="3bf79822-fe13-41ea-bc8f-858fbea129e7" name="Changes" comment="[insert]新增融合解析--识别融合数据率波动问题导出">
+      <change afterPath="$PROJECT_DIR$/fusion-analysis/src/main/java/cn/com/taiji/domain/OriginalData.java" afterDir="false" />
       <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" />
@@ -156,7 +155,7 @@
       <list>
         <item itemvalue="应用程序.text" />
         <item itemvalue="Spring Boot.EsTrackAnAlySisApplication" />
-        <item itemvalue="Spring Boot.EsTrackAnAlySisApplication" />
+        <item itemvalue="应用程序.text" />
         <item itemvalue="Spring Boot.EsTrackAnAlySisApplication" />
         <item itemvalue="Spring Boot.EsTrackAnAlySisApplication" />
       </list>

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

@@ -118,4 +118,41 @@ public class FusionAnalysisController {
     public void fusionAnalysisExcelFour(@RequestBody FusionQuery query, HttpServletResponse response) throws IOException, ParseException {
         fusionAnalysisService.fusionAnalysisExcelFour(query,response);
     }
+
+
+    /**
+     * 轨迹融合-导出融合原始数据
+     * @param query
+     * @param response
+     * @throws IOException
+     * @throws ParseException
+     */
+    @PostMapping("excel/original/one")
+    public void fusionAnalysisExcelOriginalOne(@RequestBody FusionQuery query, HttpServletResponse response) throws IOException, ParseException {
+        fusionAnalysisService.fusionAnalysisExcelOriginalOne(query,response);
+    }
+
+    /**
+     * 轨迹融合-导出北斗原始数据
+     * @param query
+     * @param response
+     * @throws IOException
+     * @throws ParseException
+     */
+    @PostMapping("excel/original/two")
+    public void fusionAnalysisExcelOriginalTwo(@RequestBody FusionQuery query, HttpServletResponse response) throws IOException, ParseException {
+        fusionAnalysisService.fusionAnalysisExcelOriginalTwo(query,response);
+    }
+
+    /**
+     * 轨迹融合-导出天奥原始数据
+     * @param query
+     * @param response
+     * @throws IOException
+     * @throws ParseException
+     */
+    @PostMapping("excel/original/three")
+    public void fusionAnalysisExcelOriginalThree(@RequestBody FusionQuery query, HttpServletResponse response) throws IOException, ParseException {
+        fusionAnalysisService.fusionAnalysisExcelOriginalThree(query,response);
+    }
 }

+ 37 - 0
fusion-analysis/src/main/java/cn/com/taiji/domain/OriginalData.java

@@ -0,0 +1,37 @@
+package cn.com.taiji.domain;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+
+/**
+ * @author xhl
+ * @date 2023/2/18
+ */
+public class OriginalData {
+    /**
+     * 批次号
+     */
+    @ExcelProperty(index = 0,value = "批次号")
+    private String mergeTarget;
+
+    /**
+     * 数量
+     */
+    @ExcelProperty(index = 1,value = "数量")
+    private Integer num;
+
+    public String getMergeTarget() {
+        return mergeTarget;
+    }
+
+    public void setMergeTarget(String mergeTarget) {
+        this.mergeTarget = mergeTarget;
+    }
+
+    public Integer getNum() {
+        return num;
+    }
+
+    public void setNum(Integer num) {
+        this.num = num;
+    }
+}

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

@@ -83,4 +83,31 @@ public interface FusionAnalysisService {
      * @throws ParseException
      */
     void fusionAnalysisExcelFour(FusionQuery query, HttpServletResponse response) throws IOException, ParseException;
+
+    /**
+     * 导出融合原始数据
+     * @param query
+     * @param response
+     * @throws IOException
+     * @throws ParseException
+     */
+    void fusionAnalysisExcelOriginalOne(FusionQuery query, HttpServletResponse response) throws IOException, ParseException;
+
+    /**
+     * 导出北斗原始数据
+     * @param query
+     * @param response
+     * @throws IOException
+     * @throws ParseException
+     */
+    void fusionAnalysisExcelOriginalTwo(FusionQuery query, HttpServletResponse response) throws IOException, ParseException;
+
+    /**
+     * 导出天奥原始数据
+     * @param query
+     * @param response
+     * @throws IOException
+     * @throws ParseException
+     */
+    void fusionAnalysisExcelOriginalThree(FusionQuery query, HttpServletResponse response) throws IOException, ParseException;
 }

+ 184 - 4
fusion-analysis/src/main/java/cn/com/taiji/service/impl/FusionAnalysisServiceImpl.java

@@ -1,9 +1,6 @@
 package cn.com.taiji.service.impl;
 
-import cn.com.taiji.domain.FusionData;
-import cn.com.taiji.domain.FusionQuery;
-import cn.com.taiji.domain.LeaveOutData;
-import cn.com.taiji.domain.StaticOrDynamicData;
+import cn.com.taiji.domain.*;
 import cn.com.taiji.domain.dto.LeaceOutDto;
 import cn.com.taiji.service.FusionAnalysisService;
 import cn.com.taiji.utils.DateUtils;
@@ -1094,6 +1091,189 @@ public class FusionAnalysisServiceImpl implements FusionAnalysisService {
         }
     }
 
+    @Override
+    public void fusionAnalysisExcelOriginalOne(FusionQuery query, HttpServletResponse response) throws IOException, ParseException {
+        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);
+        // 构建查询条件
+        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) {
+                OriginalData data = new OriginalData();
+                JSONObject sourceItem = jsonArray.getJSONObject(0);
+                data.setMergeTarget(sourceItem.getString("mergeTarget"));
+                data.setNum(jsonArray.size());
+                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(), OriginalData.class).sheet("融合原始数据")
+                    .doWrite(list);
+        } catch (Exception e) {
+            // 重置response
+            System.out.println("导出融合原始数据excel失败:{}" + e.getMessage() + e);
+        }
+    }
+
+    @Override
+    public void fusionAnalysisExcelOriginalTwo(FusionQuery query, HttpServletResponse response) throws IOException, ParseException {
+        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_TRACK_BEIDOU+time);
+        // 构建查询条件
+        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);
+        searchSourceBuilder
+                .trackTotalHits(true)
+                .size(query.getPageSize())
+                .sort(SortBuilders.fieldSort("locationTime").order(SortOrder.ASC))
+                .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, "devideNo", outList);
+        outList.forEach(map-> {
+            JSONObject maps = JSONObject.parseObject(JSON.toJSONString(map));
+            JSONArray jsonArray = JSONArray.parseArray(maps.getString("array"));
+            if (jsonArray.size() > 0) {
+                OriginalData data = new OriginalData();
+                JSONObject sourceItem = jsonArray.getJSONObject(0);
+                data.setMergeTarget(sourceItem.getString("devideNo"));
+                data.setNum(jsonArray.size());
+                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(), OriginalData.class).sheet("北斗原始数据")
+                    .doWrite(list);
+        } catch (Exception e) {
+            // 重置response
+            System.out.println("导出北斗原始数据excel失败:{}" + e.getMessage() + e);
+        }
+    }
+
+    @Override
+    public void fusionAnalysisExcelOriginalThree(FusionQuery query, HttpServletResponse response) throws IOException, ParseException {
+        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_TRACK_RADAR+time);
+        // 构建查询条件
+        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);
+        searchSourceBuilder
+                .trackTotalHits(true)
+                .size(query.getPageSize())
+                .sort(SortBuilders.fieldSort("receiveTime").order(SortOrder.ASC))
+                .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, "fusionBatchNum", outList);
+        outList.forEach(map-> {
+            JSONObject maps = JSONObject.parseObject(JSON.toJSONString(map));
+            JSONArray jsonArray = JSONArray.parseArray(maps.getString("array"));
+            if (jsonArray.size() > 0) {
+                OriginalData data = new OriginalData();
+                JSONObject sourceItem = jsonArray.getJSONObject(0);
+                data.setMergeTarget(sourceItem.getString("fusionBatchNum"));
+                data.setNum(jsonArray.size());
+                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(), OriginalData.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>>>