Browse Source

[feat]#北斗、海兰信一级融合

chenfangchao 2 years ago
parent
commit
618a1ce8a7
19 changed files with 497 additions and 23 deletions
  1. 11 3
      beidou-analysis/src/main/java/cn/com/taiji/controller/BeidouAnalySisController.java
  2. 47 0
      beidou-analysis/src/main/java/cn/com/taiji/entity/BeidouShipTrackDTO.java
  3. 4 1
      beidou-analysis/src/main/java/cn/com/taiji/service/BeidouAnalySisService.java
  4. 112 1
      beidou-analysis/src/main/java/cn/com/taiji/service/impl/BeidouAnalySisServiceImpl.java
  5. 1 1
      beidou-analysis/src/main/resources/application.yml
  6. 1 1
      tianao-analysis/src/main/java/cn/com/taiji/vo/TianaoVo.java
  7. 8 0
      hlx-one-fusion-analysis/pom.xml
  8. 18 0
      hlx-one-fusion-analysis/src/main/java/cn/com/taiji/HlxOneLevelApplication.java
  9. 40 0
      hlx-one-fusion-analysis/src/main/java/cn/com/taiji/controller/HlxOneLevelController.java
  10. 72 0
      hlx-one-fusion-analysis/src/main/java/cn/com/taiji/entity/HlxOneLevelShipTrackDTO.java
  11. 18 0
      hlx-one-fusion-analysis/src/main/java/cn/com/taiji/service/HlxOneLevelService.java
  12. 136 0
      hlx-one-fusion-analysis/src/main/java/cn/com/taiji/service/HlxOneLevelServiceImpl.java
  13. 7 0
      hlx-one-fusion-analysis/src/main/resources/application-prod.yml
  14. 10 0
      hlx-one-fusion-analysis/src/main/resources/application.yml
  15. 4 8
      tianao-analysis/src/main/java/cn/com/taiji/controller/TianaoRadarController.java
  16. 2 2
      tianao-analysis/src/main/java/cn/com/taiji/service/TianaoService.java
  17. 4 4
      tianao-analysis/src/main/java/cn/com/taiji/service/impl/TianaoServiceImpl.java
  18. 1 1
      tianao-analysis/src/main/resources/application.yml
  19. 1 1
      tianao-analysis/target/classes/application.yml

+ 11 - 3
beidou-analysis/src/main/java/cn/com/taiji/controller/BeidouAnalySisController.java

@@ -2,6 +2,8 @@ package cn.com.taiji.controller;
 
 import cn.com.taiji.entity.QueryVo;
 import cn.com.taiji.service.BeidouAnalySisService;
+import cn.com.taiji.utils.ExcelUtils;
+import cn.com.taiji.vo.ExportVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -9,6 +11,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.servlet.http.HttpServletResponse;
+import java.util.List;
 
 /**
  * @author chenfangchao
@@ -17,7 +20,7 @@ import javax.servlet.http.HttpServletResponse;
  * @description: TODO
  * @date 2023/2/7 10:59 AM
  */
-@RequestMapping("/beidou/analysis")
+@RequestMapping("/beidou")
 @RestController
 public class BeidouAnalySisController {
 
@@ -25,8 +28,13 @@ public class BeidouAnalySisController {
     private BeidouAnalySisService beidouAnalySisService;
 
     @PostMapping("/export")
-    public void beidouAnalySis(HttpServletResponse response, @RequestBody QueryVo query){
-        beidouAnalySisService.export(query);
+    public void beidouAnalySis(HttpServletResponse response, @RequestBody QueryVo query) {
+        try {
+            List<ExportVo> list = beidouAnalySisService.export(query);
+            ExcelUtils.export2Web(response, "北斗", "天奥", ExportVo.class, list);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
     }
 
 }

+ 47 - 0
beidou-analysis/src/main/java/cn/com/taiji/entity/BeidouShipTrackDTO.java

@@ -0,0 +1,47 @@
+package cn.com.taiji.entity;
+
+import cn.hutool.core.util.StrUtil;
+import lombok.Data;
+
+import java.io.Serializable;
+
+
+@Data
+public class BeidouShipTrackDTO implements Serializable {
+
+    private static final long serialVersionUID = -8983779632713666636L;
+
+    private String time;
+    private Long trackId;
+    private String deviceId;
+    private Long shipType;
+    private Long workType;
+    private Integer workWay;
+    private String sendTime;
+    private String locationTime;
+    private Integer online;
+    private Integer shipLength;
+    private Integer shipWidth;
+    private Integer texture;
+    private Double longitude;
+    private Double latitude;
+    private Double direction;
+    private Double speed;
+    private Integer kwh;
+    private String shipName;
+    //船籍港
+    private String gisShipPort = "";
+    //船舶材质
+    private String gisShipMaterial = "";
+    //船舶用途
+    private String gisShipUse = "";
+    //是否被关注 0未关注 1已关注
+    private Integer focus = 0;
+    //是否为重点 0否 1是
+    private Integer fokey = 0;
+    //关注颜色
+    private String focusColor = "";
+    //用户id
+    private String focusUserId = "";
+    private String location;
+}

+ 4 - 1
beidou-analysis/src/main/java/cn/com/taiji/service/BeidouAnalySisService.java

@@ -1,6 +1,9 @@
 package cn.com.taiji.service;
 
 import cn.com.taiji.entity.QueryVo;
+import cn.com.taiji.vo.ExportVo;
+
+import java.util.List;
 
 /**
  * @author chenfangchao
@@ -11,5 +14,5 @@ import cn.com.taiji.entity.QueryVo;
  */
 public interface BeidouAnalySisService {
 
-    void export(QueryVo query);
+    List<ExportVo> export(QueryVo query);
 }

+ 112 - 1
beidou-analysis/src/main/java/cn/com/taiji/service/impl/BeidouAnalySisServiceImpl.java

@@ -1,11 +1,28 @@
 package cn.com.taiji.service.impl;
 
+import cn.com.taiji.constants.EsIndexConstants;
+import cn.com.taiji.entity.BeidouShipTrackDTO;
+import cn.com.taiji.entity.CountDTO;
+import cn.com.taiji.entity.FusionNewShipJsonDTO;
 import cn.com.taiji.entity.QueryVo;
 import cn.com.taiji.service.BeidouAnalySisService;
+import cn.com.taiji.utils.DateUtils;
+import cn.com.taiji.vo.ExportVo;
+import com.alibaba.fastjson.JSON;
+import org.elasticsearch.action.search.SearchRequest;
+import org.elasticsearch.action.search.SearchResponse;
+import org.elasticsearch.client.RequestOptions;
 import org.elasticsearch.client.RestHighLevelClient;
+import org.elasticsearch.index.query.BoolQueryBuilder;
+import org.elasticsearch.index.query.QueryBuilders;
+import org.elasticsearch.search.SearchHit;
+import org.elasticsearch.search.builder.SearchSourceBuilder;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.io.IOException;
+import java.util.*;
+
 /**
  * @author chenfangchao
  * @title: BeidouAnalySisServiceImpl
@@ -20,7 +37,101 @@ public class BeidouAnalySisServiceImpl implements BeidouAnalySisService {
     private RestHighLevelClient restHighLevelClient;
 
     @Override
-    public void export(QueryVo query) {
+    public List<ExportVo> export(QueryVo query) {
+        ArrayList<String> result = new ArrayList<>();
+        List<String> beidouList = new ArrayList<>();
+        IdentityHashMap<String, CountDTO> idenNewStringMap = new IdentityHashMap<>();
+        String time = DateUtils.format(new Date(), "yyyy-MM-dd");
+        SearchRequest searchRequest = new SearchRequest(EsIndexConstants.INDEX_SEAT_TRACK_BEIDOU + time);
+        // 构建查询条件
+        BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
+        SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
+        boolQueryBuilder.filter(QueryBuilders.rangeQuery("sendTime").gte(query.getStartTime()).lte(query.getEndTime()));
+        searchSourceBuilder.query(boolQueryBuilder);
+        searchRequest.source(searchSourceBuilder);
+        try {
+            SearchResponse search = restHighLevelClient.search(searchRequest, RequestOptions.DEFAULT);
+            SearchHit[] hits = search.getHits().getHits();
+            for (SearchHit hit : hits) {
+                String sourceAsString = hit.getSourceAsString();
+                BeidouShipTrackDTO object = JSON.parseObject(sourceAsString, BeidouShipTrackDTO.class);
+                //存储北斗
+                beidouList.add(object.getDeviceId());
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
 
+        //融合
+        SearchRequest fusionSearchRequest = new SearchRequest((EsIndexConstants.INDEX_SEAT_REALTIMETRAJECTORY + time));
+        // 构建查询条件
+        BoolQueryBuilder fusionBoolQueryBuilder = QueryBuilders.boolQuery();
+        SearchSourceBuilder fusionSearchSourceBuilder = new SearchSourceBuilder();
+        boolQueryBuilder.filter(QueryBuilders.rangeQuery("mergeTime").gte(query.getStartTime()).lte(query.getEndTime()));
+        fusionSearchSourceBuilder.query(fusionBoolQueryBuilder);
+        fusionSearchRequest.source(fusionSearchSourceBuilder);
+        try {
+            SearchResponse fusionSearch = restHighLevelClient.search(fusionSearchRequest, RequestOptions.DEFAULT);
+            SearchHit[] hits = fusionSearch.getHits().getHits();
+            for (SearchHit hit : hits) {
+                Map<String, Object> sourceAsMap = hit.getSourceAsMap();
+                String mergeTarget = (String) sourceAsMap.get("merge_target");
+                String targetSource = (String) sourceAsMap.get("targetSource");
+                List<FusionNewShipJsonDTO> targetSourceList = JSON.parseArray(targetSource, FusionNewShipJsonDTO.class);
+                for (FusionNewShipJsonDTO item : targetSourceList) {
+                    if (null != item) {
+                        if (null != item.getType() && "BEIDOU".equals(item.getType())) {
+                            if(idenNewStringMap.get(item.getTrackId()) != null){
+                                CountDTO countDTO = idenNewStringMap.get(item.getTrackId());
+                                countDTO.setCount(countDTO.getCount()+1);
+                                List<String> data = countDTO.getData();
+                                if(!data.contains(mergeTarget)){
+                                    data.add(mergeTarget);
+                                    countDTO.setData(data);
+                                }
+                                idenNewStringMap.put(item.getTrackId(),countDTO);
+                            }else {
+                                ArrayList<String> list = new ArrayList<>();
+                                list.add(mergeTarget);
+                                idenNewStringMap.put(item.getTrackId(),new CountDTO(1,list));
+                            }
+                        }
+                    }
+                }
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        //遍历北斗数据、找到在一条北斗在融合中有两个不同mergeTarget的融合数据
+        for (String key : beidouList) {
+            //计算key在map中的数量,大于1则拿出map中的mergeTarget
+            CountDTO countDTO = idenNewStringMap.get(key);
+            if(countDTO.getCount() > 1){
+                List<String> data = countDTO.getData();
+                result.addAll(data);
+            }
+        }
+        //导出融合数据
+        SearchRequest exportFusionSearchRequest = new SearchRequest(EsIndexConstants.INDEX_SEAT_REALTIMETRAJECTORY + time);
+        SearchSourceBuilder exportSearchSourceBuilder = new SearchSourceBuilder();
+        exportSearchSourceBuilder.query(QueryBuilders.termsQuery("mergeTime",result));
+        exportFusionSearchRequest.source(exportSearchSourceBuilder);
+        List<ExportVo> data = new ArrayList<>();
+        try {
+            SearchResponse response = restHighLevelClient.search(searchRequest, RequestOptions.DEFAULT);
+            SearchHit[] hits = response.getHits().getHits();
+            for (SearchHit hit : hits) {
+                Map<String, Object> sourceAsMap = hit.getSourceAsMap();
+                String mergeTarget = (String) sourceAsMap.get("merge_target");
+                String targetSource = (String) sourceAsMap.get("targetSource");
+                ExportVo tianaoVo = new ExportVo();
+                tianaoVo.setMergeTarget(mergeTarget);
+                tianaoVo.setStartTime(targetSource);
+                data.add(tianaoVo);
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return data;
     }
 }

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

@@ -1,5 +1,5 @@
 server:
-  port: 8081
+  port: 9002
 
 taiji:
   elasticsearch.rest:

+ 1 - 1
tianao-analysis/src/main/java/cn/com/taiji/vo/TianaoVo.java

@@ -13,7 +13,7 @@ import java.io.Serializable;
  * @date 2023/2/7 10:29 AM
  */
 @Data
-public class TianaoVo implements Serializable {
+public class ExportVo implements Serializable {
 
     @ExcelProperty(value = {"批次号"}, index = 0)
     private String mergeTarget;

+ 8 - 0
hlx-one-fusion-analysis/pom.xml

@@ -16,4 +16,12 @@
         <maven.compiler.target>8</maven.compiler.target>
     </properties>
 
+    <dependencies>
+        <dependency>
+            <groupId>cn.com.taiji</groupId>
+            <artifactId>es-track-common</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
+
 </project>

+ 18 - 0
hlx-one-fusion-analysis/src/main/java/cn/com/taiji/HlxOneLevelApplication.java

@@ -0,0 +1,18 @@
+package cn.com.taiji;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+/**
+ * @author chenfangchao
+ * @title: HlxOneLevelApplication
+ * @projectName es-track-analysis
+ * @description: TODO
+ * @date 2023/2/7 4:54 PM
+ */
+@SpringBootApplication
+public class HlxOneLevelApplication {
+    public static void main(String[] args) {
+        SpringApplication.run(HlxOneLevelApplication.class,args);
+    }
+}

+ 40 - 0
hlx-one-fusion-analysis/src/main/java/cn/com/taiji/controller/HlxOneLevelController.java

@@ -0,0 +1,40 @@
+package cn.com.taiji.controller;
+
+import cn.com.taiji.entity.QueryVo;
+import cn.com.taiji.service.HlxOneLevelService;
+import cn.com.taiji.utils.ExcelUtils;
+import cn.com.taiji.vo.ExportVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * @author chenfangchao
+ * @title: HlxOneLevelController
+ * @projectName es-track-analysis
+ * @description: TODO
+ * @date 2023/2/7 4:53 PM
+ */
+@RequestMapping("/hlx")
+@RestController
+public class HlxOneLevelController {
+
+    @Autowired
+    private HlxOneLevelService hlxOneLevelService;
+
+    @PostMapping("/export")
+    public void hlx(HttpServletResponse response, @RequestBody QueryVo query) {
+        try {
+            List<ExportVo> list = hlxOneLevelService.hlx(query);
+            ExcelUtils.export2Web(response, "海兰信", "海兰信", ExportVo.class, list);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+}

+ 72 - 0
hlx-one-fusion-analysis/src/main/java/cn/com/taiji/entity/HlxOneLevelShipTrackDTO.java

@@ -0,0 +1,72 @@
+package cn.com.taiji.entity;
+
+
+import lombok.Data;
+import lombok.ToString;
+
+/**
+ * @author chenfangchao
+ * @title: HxlOneLevelShipTrackDTO
+ * @projectName ax-geomesa-redis
+ * @description: TODO
+ * @date 2022/11/7 5:29 PM
+ */
+@Data
+@ToString
+public class HlxOneLevelShipTrackDTO {
+
+    /** 一级融合输出批次号 **/
+    private String targetId;
+
+    /** 雷达主站点编号,非雷达融合目标取0 **/
+    private String radarId;
+
+    /** true/false,目标是否处于预测态 **/
+    private String predicted;
+
+    /** 航速,节 **/
+    private Float speed;
+
+    /** 航向,度 **/
+    private Float course;
+
+    /** 艏向,度 **/
+    private Float heading;
+
+    /** 经度,度 **/
+    private Float longitude;
+
+    /** 纬度,度 **/
+    private Float latitude;
+
+    /** 船长 **/
+    private Double length;
+
+    /** 非AIS融合取0 **/
+    private String mmsi;
+
+    /** 0:非AIS融合,1:class A 2:class B 3:AID **/
+    private Long shipClass;
+
+    /** 0:非AIS融合,非0:AIS船型编号 **/
+    private Long shipType;
+
+    /** 船名 **/
+    private String vesselName;
+
+    /** 融合时间,utc毫秒 **/
+    private String time;
+
+
+    /**
+     * 太极应用层计算
+     */
+    private String gisShipType;
+
+    private String gisNationality;
+
+    /**
+     * 位置
+     */
+    private String location;
+}

+ 18 - 0
hlx-one-fusion-analysis/src/main/java/cn/com/taiji/service/HlxOneLevelService.java

@@ -0,0 +1,18 @@
+package cn.com.taiji.service;
+
+import cn.com.taiji.entity.QueryVo;
+import cn.com.taiji.vo.ExportVo;
+
+import java.util.List;
+
+/**
+ * @author chenfangchao
+ * @title: HlxOneLevelService
+ * @projectName es-track-analysis
+ * @description: TODO
+ * @date 2023/2/7 4:53 PM
+ */
+public interface HlxOneLevelService {
+
+    List<ExportVo> hlx(QueryVo query);
+}

+ 136 - 0
hlx-one-fusion-analysis/src/main/java/cn/com/taiji/service/HlxOneLevelServiceImpl.java

@@ -0,0 +1,136 @@
+package cn.com.taiji.service;
+
+import cn.com.taiji.constants.EsIndexConstants;
+import cn.com.taiji.entity.CountDTO;
+import cn.com.taiji.entity.FusionNewShipJsonDTO;
+import cn.com.taiji.entity.HlxOneLevelShipTrackDTO;
+import cn.com.taiji.entity.QueryVo;
+import cn.com.taiji.utils.DateUtils;
+import cn.com.taiji.vo.ExportVo;
+import com.alibaba.fastjson.JSON;
+import org.elasticsearch.action.search.SearchRequest;
+import org.elasticsearch.action.search.SearchResponse;
+import org.elasticsearch.client.RequestOptions;
+import org.elasticsearch.client.RestHighLevelClient;
+import org.elasticsearch.index.query.BoolQueryBuilder;
+import org.elasticsearch.index.query.QueryBuilders;
+import org.elasticsearch.search.SearchHit;
+import org.elasticsearch.search.builder.SearchSourceBuilder;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.io.IOException;
+import java.util.*;
+
+/**
+ * @author chenfangchao
+ * @title: HlxOneLevelServiceImpl
+ * @projectName es-track-analysis
+ * @description: TODO
+ * @date 2023/2/7 4:53 PM
+ */
+@Service
+public class HlxOneLevelServiceImpl implements HlxOneLevelService{
+
+    @Autowired
+    private RestHighLevelClient restHighLevelClient;
+
+    @Override
+    public List<ExportVo> hlx(QueryVo query) {
+        ArrayList<String> result = new ArrayList<>();
+        List<String> hlxList = new ArrayList<>();
+        IdentityHashMap<String, CountDTO> idenNewStringMap = new IdentityHashMap<>();
+        String time = DateUtils.format(new Date(), "yyyy-MM-dd");
+        SearchRequest searchRequest = new SearchRequest(EsIndexConstants.INDEX_SEAT_HLX_FUSION_SHIP + time);
+        // 构建查询条件
+        BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
+        SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
+        boolQueryBuilder.filter(QueryBuilders.rangeQuery("time").gte(query.getStartTime()).lte(query.getEndTime()));
+        searchSourceBuilder.query(boolQueryBuilder);
+        searchRequest.source(searchSourceBuilder);
+        try {
+            SearchResponse search = restHighLevelClient.search(searchRequest, RequestOptions.DEFAULT);
+            SearchHit[] hits = search.getHits().getHits();
+            for (SearchHit hit : hits) {
+                String sourceAsString = hit.getSourceAsString();
+                HlxOneLevelShipTrackDTO object = JSON.parseObject(sourceAsString, HlxOneLevelShipTrackDTO.class);
+                //存储海兰信
+                hlxList.add(object.getTargetId());
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+        //融合
+        SearchRequest fusionSearchRequest = new SearchRequest((EsIndexConstants.INDEX_SEAT_REALTIMETRAJECTORY + time));
+        // 构建查询条件
+        BoolQueryBuilder fusionBoolQueryBuilder = QueryBuilders.boolQuery();
+        SearchSourceBuilder fusionSearchSourceBuilder = new SearchSourceBuilder();
+        boolQueryBuilder.filter(QueryBuilders.rangeQuery("mergeTime").gte(query.getStartTime()).lte(query.getEndTime()));
+        fusionSearchSourceBuilder.query(fusionBoolQueryBuilder);
+        fusionSearchRequest.source(fusionSearchSourceBuilder);
+        try {
+            SearchResponse fusionSearch = restHighLevelClient.search(fusionSearchRequest, RequestOptions.DEFAULT);
+            SearchHit[] hits = fusionSearch.getHits().getHits();
+            for (SearchHit hit : hits) {
+                Map<String, Object> sourceAsMap = hit.getSourceAsMap();
+                String mergeTarget = (String) sourceAsMap.get("merge_target");
+                String targetSource = (String) sourceAsMap.get("targetSource");
+                List<FusionNewShipJsonDTO> targetSourceList = JSON.parseArray(targetSource, FusionNewShipJsonDTO.class);
+                for (FusionNewShipJsonDTO item : targetSourceList) {
+                    if (null != item) {
+                        if (null != item.getType() && "HLX_AIS_RADAR".equals(item.getType())) {
+                            if(idenNewStringMap.get(item.getTrackId()) != null){
+                                CountDTO countDTO = idenNewStringMap.get(item.getTrackId());
+                                countDTO.setCount(countDTO.getCount()+1);
+                                List<String> data = countDTO.getData();
+                                if(!data.contains(mergeTarget)){
+                                    data.add(mergeTarget);
+                                    countDTO.setData(data);
+                                }
+                                idenNewStringMap.put(item.getTrackId(),countDTO);
+                            }else {
+                                ArrayList<String> list = new ArrayList<>();
+                                list.add(mergeTarget);
+                                idenNewStringMap.put(item.getTrackId(),new CountDTO(1,list));
+                            }
+                        }
+                    }
+                }
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        //遍历海兰信数据、找到在一条海兰信数据在融合中有两个不同mergeTarget的融合数据
+        for (String key : hlxList) {
+            //计算key在map中的数量,大于1则拿出map中的mergeTarget
+            CountDTO countDTO = idenNewStringMap.get(key);
+            if(countDTO.getCount() > 1){
+                List<String> data = countDTO.getData();
+                result.addAll(data);
+            }
+        }
+        //导出融合数据
+        SearchRequest exportFusionSearchRequest = new SearchRequest(EsIndexConstants.INDEX_SEAT_REALTIMETRAJECTORY + time);
+        SearchSourceBuilder exportSearchSourceBuilder = new SearchSourceBuilder();
+        exportSearchSourceBuilder.query(QueryBuilders.termsQuery("mergeTime",result));
+        exportFusionSearchRequest.source(exportSearchSourceBuilder);
+        List<ExportVo> data = new ArrayList<>();
+        try {
+            SearchResponse response = restHighLevelClient.search(searchRequest, RequestOptions.DEFAULT);
+            SearchHit[] hits = response.getHits().getHits();
+            for (SearchHit hit : hits) {
+                Map<String, Object> sourceAsMap = hit.getSourceAsMap();
+                String mergeTarget = (String) sourceAsMap.get("merge_target");
+                String targetSource = (String) sourceAsMap.get("targetSource");
+                ExportVo tianaoVo = new ExportVo();
+                tianaoVo.setMergeTarget(mergeTarget);
+                tianaoVo.setStartTime(targetSource);
+                data.add(tianaoVo);
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return data;
+    }
+}

+ 7 - 0
hlx-one-fusion-analysis/src/main/resources/application-prod.yml

@@ -0,0 +1,7 @@
+taiji:
+  elasticsearch.rest:
+    uris: 74.10.28.65:9200,74.10.28.65:9201,74.10.28.65:9202,74.10.28.66:9200,74.10.28.66:9201,74.10.28.66:9202,74.10.28.67:9200,74.10.28.67:9201,74.10.28.67:9202,74.10.28.68:9200,74.10.28.68:9201,74.10.28.68:9202,74.10.28.69:9200,74.10.28.69:9201,74.10.28.69:9202
+    username: ax_seat       #如果你设置了基于x-pack的验证就要填写账号和密码
+    password: ax_seat       #没有则不用配置
+    connection-timeout: 100 #连接超时
+    max-connection: 100  #最大连接数

+ 10 - 0
hlx-one-fusion-analysis/src/main/resources/application.yml

@@ -0,0 +1,10 @@
+server:
+  port: 9001
+
+taiji:
+  elasticsearch.rest:
+    uris: 120.25.233.10:9200
+    username: elastic       #如果你设置了基于x-pack的验证就要填写账号和密码
+    password: root@2022!       #没有则不用配置
+    connection-timeout: 100 #连接超时
+    max-connection: 100  #最大连接数

+ 4 - 8
tianao-analysis/src/main/java/cn/com/taiji/controller/TianaoRadarController.java

@@ -3,16 +3,14 @@ package cn.com.taiji.controller;
 import cn.com.taiji.entity.QueryVo;
 import cn.com.taiji.service.TianaoService;
 import cn.com.taiji.utils.ExcelUtils;
-import cn.com.taiji.vo.TianaoVo;
+import cn.com.taiji.vo.ExportVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import java.net.URLEncoder;
 import java.util.List;
 
 /**
@@ -31,12 +29,10 @@ public class TianaoRadarController {
     private TianaoService tianaoService;
 
     @PostMapping("/export")
-    public void tianaRader(HttpServletResponse response, @RequestBody QueryVo query){
-        List<TianaoVo> list = tianaoService.tianaRader(query);
+    public void tianaRader(HttpServletResponse response, @RequestBody QueryVo query) {
         try {
-            if(null != list && 0 < list.size()){
-                ExcelUtils.export2Web(response, "天奥", "天奥", TianaoVo.class, list);
-            }
+            List<ExportVo> list = tianaoService.tianaRader(query);
+            ExcelUtils.export2Web(response, "天奥", "天奥", ExportVo.class, list);
         } catch (Exception e) {
             e.printStackTrace();
         }

+ 2 - 2
tianao-analysis/src/main/java/cn/com/taiji/service/TianaoService.java

@@ -1,7 +1,7 @@
 package cn.com.taiji.service;
 
 import cn.com.taiji.entity.QueryVo;
-import cn.com.taiji.vo.TianaoVo;
+import cn.com.taiji.vo.ExportVo;
 
 import java.util.List;
 
@@ -14,5 +14,5 @@ import java.util.List;
  */
 public interface TianaoService {
 
-    List<TianaoVo> tianaRader(QueryVo query);
+    List<ExportVo> tianaRader(QueryVo query);
 }

+ 4 - 4
tianao-analysis/src/main/java/cn/com/taiji/service/impl/TianaoServiceImpl.java

@@ -7,7 +7,7 @@ import cn.com.taiji.entity.QueryVo;
 import cn.com.taiji.entity.TianaoRadar;
 import cn.com.taiji.service.TianaoService;
 import cn.com.taiji.utils.DateUtils;
-import cn.com.taiji.vo.TianaoVo;
+import cn.com.taiji.vo.ExportVo;
 import com.alibaba.fastjson.JSON;
 import org.elasticsearch.action.search.SearchRequest;
 import org.elasticsearch.action.search.SearchResponse;
@@ -38,7 +38,7 @@ public class TianaoServiceImpl implements TianaoService {
 
 
     @Override
-    public List<TianaoVo> tianaRader(QueryVo query) {
+    public List<ExportVo> tianaRader(QueryVo query) {
         ArrayList<String> result = new ArrayList<>();
         List<String> tianaoRadarList = new ArrayList<>();
         IdentityHashMap<String, CountDTO> idenNewStringMap = new IdentityHashMap<>();
@@ -117,7 +117,7 @@ public class TianaoServiceImpl implements TianaoService {
         SearchSourceBuilder exportSearchSourceBuilder = new SearchSourceBuilder();
         exportSearchSourceBuilder.query(QueryBuilders.termsQuery("mergeTime",result));
         exportFusionSearchRequest.source(exportSearchSourceBuilder);
-        List<TianaoVo> data = new ArrayList<>();
+        List<ExportVo> data = new ArrayList<>();
         try {
             SearchResponse response = restHighLevelClient.search(searchRequest, RequestOptions.DEFAULT);
             SearchHit[] hits = response.getHits().getHits();
@@ -125,7 +125,7 @@ public class TianaoServiceImpl implements TianaoService {
                 Map<String, Object> sourceAsMap = hit.getSourceAsMap();
                 String mergeTarget = (String) sourceAsMap.get("merge_target");
                 String targetSource = (String) sourceAsMap.get("targetSource");
-                TianaoVo tianaoVo = new TianaoVo();
+                ExportVo tianaoVo = new ExportVo();
                 tianaoVo.setMergeTarget(mergeTarget);
                 tianaoVo.setStartTime(targetSource);
                 data.add(tianaoVo);

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

@@ -1,5 +1,5 @@
 server:
-  port: 8081
+  port: 9003
 
 taiji:
   elasticsearch.rest:

+ 1 - 1
tianao-analysis/target/classes/application.yml

@@ -1,5 +1,5 @@
 server:
-  port: 8081
+  port: 9003
 
 taiji:
   elasticsearch.rest: