Ver código fonte

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	orbit-base-plan/base-plan-service/src/main/java/com/base/plan/service/StripService.java
lhq 3 semanas atrás
pai
commit
15eae1d697

+ 16 - 0
orbit-base-biz/base-biz-api/src/main/java/com/base/api/model/PointRpcDTO.java

@@ -34,4 +34,20 @@ public class PointRpcDTO {
     private String hotspot;//是否是热点 0是热点 1普通
 
     private String iscover;//当目标类型是点群时 需要这个字段判断该点是否被覆盖 0覆盖 1没有覆盖
+
+    /**
+     * 动目标平均航速,单位节,1节=1海里/小时=1.852km/h
+     */
+    @ApiModelProperty("动目标平均航速")
+    private String movingEvgSpeed;
+
+    /**
+     * 航向
+     */
+    private String heading;
+
+    /**
+     * 移动时长
+     */
+    private String time;
 }

+ 2 - 0
orbit-base-biz/base-biz-api/src/main/java/com/base/api/model/TargetDemandRpcDTO.java

@@ -3,6 +3,7 @@ package com.base.api.model;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
 
@@ -95,4 +96,5 @@ public class TargetDemandRpcDTO {
 
     @ApiModelProperty("需求名称")
     private String reqName;
+
 }

+ 16 - 0
orbit-base-biz/base-biz-service/src/main/java/com/base/biz/model/PointDTO.java

@@ -15,4 +15,20 @@ public class PointDTO {
     @ApiModelProperty("经度")
     private Double lng;
 
+    /**
+     * 动目标平均航速,单位节,1节=1海里/小时=1.852km/h
+     */
+    @ApiModelProperty("动目标平均航速")
+    private String movingEvgSpeed;
+
+    /**
+     * 航向
+     */
+    private String heading;
+
+    /**
+     * 移动时长
+     */
+    private String time;
+
 }

+ 17 - 0
orbit-base-biz/base-biz-service/src/main/java/com/base/biz/model/dto/request/QueryTargetPointBatchDTO.java

@@ -2,6 +2,7 @@ package com.base.biz.model.dto.request;
 
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.math.BigDecimal;
@@ -82,5 +83,21 @@ public class QueryTargetPointBatchDTO {
      */
     private Integer source;
 
+    /**
+     * 动目标平均航速,单位节,1节=1海里/小时=1.852km/h
+     */
+    @ApiModelProperty("动目标平均航速")
+    private String movingEvgSpeed;
+
+    /**
+     * 航向
+     */
+    private String heading;
+
+    /**
+     * 移动时长
+     */
+    private String time;
+
 
 }

+ 18 - 0
orbit-base-biz/base-biz-service/src/main/java/com/base/biz/model/entity/SceneTargetPoint.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
@@ -92,4 +93,21 @@ public class SceneTargetPoint implements Serializable {
     private Integer source;
 
 
+    /**
+     * 动目标平均航速,单位节,1节=1海里/小时=1.852km/h
+     */
+    @ApiModelProperty("动目标平均航速")
+    private String movingEvgSpeed;
+
+    /**
+     * 航向
+     */
+    private String heading;
+
+    /**
+     * 移动时长
+     */
+    private String time;
+
+
 }

+ 8 - 0
orbit-base-biz/base-biz-service/src/main/java/com/base/biz/service/TargetDemandService.java

@@ -322,6 +322,9 @@ public class TargetDemandService extends ServiceImpl<TargetDemandMapper, TargetD
                     pointRpcDTO.setLongitude(sceneTargetPoint.getLongitude().toString());
                     pointRpcDTO.setLatitude(sceneTargetPoint.getLatitude().toString());
                     pointRpcDTO.setSerial(sceneTargetPoint.getSequence().toString());
+                    pointRpcDTO.setMovingEvgSpeed(sceneTargetPoint.getMovingEvgSpeed());
+                    pointRpcDTO.setHeading(sceneTargetPoint.getHeading());
+                    pointRpcDTO.setTime(sceneTargetPoint.getTime());
                     pointDTOList.add(pointRpcDTO);
                 }
             }
@@ -470,6 +473,8 @@ public class TargetDemandService extends ServiceImpl<TargetDemandMapper, TargetD
             targetDemandDTO.setParentId(TargetRelation.getParentId());
             targetDemandDTO.setRate(TargetRelation.getRate());
             targetDemandDTO.setInvestigativeMeans(TargetRelation.getInvestigativeMeans());
+            targetDemandDTO.setType(TargetRelation.getType());
+            targetDemandDTO.setReqName(TargetRelation.getReqName());
 
             if (CollectionUtils.isEmpty(points)) {
                 res.add(targetDemandDTO);
@@ -576,6 +581,9 @@ public class TargetDemandService extends ServiceImpl<TargetDemandMapper, TargetD
             SceneTargetPoint.setLongitude(BigDecimal.valueOf(pointDTO.getLng()));
             SceneTargetPoint.setTargetId(targetId);
             SceneTargetPoint.setSequence(pointDTO.getSequence());
+            SceneTargetPoint.setMovingEvgSpeed(pointDTO.getMovingEvgSpeed());
+            SceneTargetPoint.setHeading(pointDTO.getHeading());
+            SceneTargetPoint.setTime(pointDTO.getTime());
             SceneTargetPointList.add(SceneTargetPoint);
         }
         return SceneTargetPointList;

+ 89 - 60
orbit-base-plan/base-plan-service/src/main/java/com/base/plan/service/StripService.java

@@ -794,6 +794,21 @@ public class StripService extends ServiceImpl<StripMapper, StripInfo> {
     }*/
     public void getPayloadInfosByReqId(List<TargetDemandRpcDTO> targetDemandRpcDTOS) {
         if (CollectionUtils.isEmpty(targetDemandRpcDTOS)) return;
+        ThreadPoolTaskExecutor threadPoolTaskExecutor = null;
+        try {
+            threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
+            threadPoolTaskExecutor.setCorePoolSize(COUR_SIZE);
+            threadPoolTaskExecutor.setMaxPoolSize(MAX_COUR_SIZE);
+            threadPoolTaskExecutor.setQueueCapacity(MAX_COUR_SIZE * 2 * 10);
+            threadPoolTaskExecutor.setKeepAliveSeconds(60);
+            threadPoolTaskExecutor.setThreadNamePrefix("threadExecutor-");
+            threadPoolTaskExecutor.setRejectedExecutionHandler(new ThreadPoolExecutor.AbortPolicy());
+            threadPoolTaskExecutor.setWaitForTasksToCompleteOnShutdown(true);
+            threadPoolTaskExecutor.initialize();
+            log.info("线程池初始化成功");
+        } catch (Exception e) {
+            log.info("初始化线程池失败:{}", e.getMessage());
+        }
         List<PayloadRpcDTO> payloadRpcDTOList = payloadRpcService.getAllList();
         ArrayList<StripCalcResult> stripCalcResults = new ArrayList<>();
         AtomicLong primaryKeyGenerator = new AtomicLong(1);
@@ -807,73 +822,87 @@ public class StripService extends ServiceImpl<StripMapper, StripInfo> {
 
 
             log.info("开始计算:{}", System.currentTimeMillis());
-
-            List<PointRpcDTO> value = targetRelationDTO.getPointDTOList();
-            /**
-             * 1.构建观测区域
-             * 2.根据观测区域获取可见星下点数据
-             */
-            System.out.println("====================构建观测区域===================");
-
-            //判断是那个类型的目标 目前只有移动点目标 线目标 点群目标需要做单独处理
-            if (targetRelationDTO.getType() == 1) {
-                //移动点目标
-                //根据 航向 航速 时间进行轨迹推算 取得所需时刻后的目标点位
-                String startlon = value.get(0).getLongitude();
-                String startlat = value.get(0).getLatitude();
-                PointRpcDTO pointRpcDTO = LaLonUtil.deadReckoning(startlon, startlat, "10", "1", "90");
-                value.get(0).setLatitude(pointRpcDTO.getLatitude());
-                value.get(0).setLongitude(pointRpcDTO.getLongitude());
-            }
-
-            Map<Integer, List<PointRpcDTO>> PointRpcDTOmapNew = new HashMap<>();
-
-            if (targetRelationDTO.getType() == 3) {
-                //线目标
-                //先将多点目标按照时间连城线并绘制区域
-                PointRpcDTO pointRpcDTO1 = new PointRpcDTO();
-                PointRpcDTO pointRpcDTO2 = new PointRpcDTO();
-                for (int i = 0; i < value.size(); i++) {
-                    if (i != value.size() - 1) {
-                        pointRpcDTO1 = value.get(i);
-                        pointRpcDTO2 = value.get(i + 1);
-                        //两点连线转区域
-                        List<PointRpcDTO> pointRpcDTOList2 = new ArrayList<>();
-                        pointRpcDTOList2 = LaLonUtil.draw(pointRpcDTO1, pointRpcDTO2);
-                        PointRpcDTOmapNew.put(i, pointRpcDTOList2);
+            threadPoolTaskExecutor.execute(() -> {
+                List<PointRpcDTO> value=targetRelationDTO.getPointDTOList();
+                /**
+                 * 1.构建观测区域
+                 * 2.根据观测区域获取可见星下点数据
+                 */
+                System.out.println("====================构建观测区域===================");
+
+                //判断是那个类型的目标 目前只有移动点目标 线目标 点群目标需要做单独处理
+                if (targetRelationDTO.getType()==1){
+                    //移动点目标
+                    //根据 航向 航速 时间进行轨迹推算 取得所需时刻后的目标点位
+
+                    //先满足点选
+/*                    String startlon=value.get(0).getLongitude() ;
+                    String startlat=value.get(0).getLatitude();
+                    PointRpcDTO pointRpcDTO=LaLonUtil.deadReckoning(startlon,startlat,"10","1","90");
+                    value.get(0).setLatitude(pointRpcDTO.getLatitude());
+                    value.get(0).setLongitude(pointRpcDTO.getLongitude());*/
+
+                    for (PointRpcDTO p:value){
+                        //移动目标计算每个点位
+                        List<PointRpcDTO> valuenew=new ArrayList<>();
+                        valuenew.add(p);
+                        targetRelationDTO.setPointDTOList(valuenew);
+                        count( targetRelationDTO, payloadRpcDTOList, stripCalcResults, primaryKeyGenerator
+                        );
                     }
                 }
 
-            }
-            if (targetRelationDTO.getType() == 4) {
-                //点群目标
-                //先绘制点群外接四边形区域
-                List<PointRpcDTO> pointRpcDTOList2 = new ArrayList<>();
-                pointRpcDTOList2 = LaLonUtil.getregion(value);
-                value = new ArrayList<>();
-                value = pointRpcDTOList2;
-            }
+                Map<Integer, List<PointRpcDTO>> PointRpcDTOmapNew=new HashMap<>();
+
+                if (targetRelationDTO.getType()==3){
+                    //线目标
+                    //先将多点目标按照时间连城线并绘制区域
+                    PointRpcDTO pointRpcDTO1=new PointRpcDTO();
+                    PointRpcDTO pointRpcDTO2=new PointRpcDTO();
+                    for (int i=0;i<value.size();i++){
+                        if (i!=value.size()-1){
+                            pointRpcDTO1=value.get(i);
+                            pointRpcDTO2=value.get(i+1);
+                            //两点连线转区域
+                            List<PointRpcDTO> pointRpcDTOList2=new ArrayList<>();
+                            pointRpcDTOList2= LaLonUtil.draw(pointRpcDTO1,pointRpcDTO2);
+                            PointRpcDTOmapNew.put(i,pointRpcDTOList2);
+                        }
+                    }
 
-            if (!CollectionUtils.isEmpty(PointRpcDTOmapNew)) {
-                PointRpcDTOmapNew.forEach((key1, value1) -> {
-                    targetRelationDTO.setPointDTOList(value1);
-                    count(targetRelationDTO, payloadRpcDTOList, stripCalcResults, primaryKeyGenerator
-                    );
-                });
+                }
+                if (targetRelationDTO.getType()==4){
+                    //点群目标
+                    //先绘制点群外接四边形区域
+                    List<PointRpcDTO> pointRpcDTOList2=new ArrayList<>();
+                    pointRpcDTOList2=LaLonUtil.getregion(value);
+                    value=new ArrayList<>();
+                    value=pointRpcDTOList2;
+                }
 
-            } else {
-                targetRelationDTO.setPointDTOList(value);
-                count(targetRelationDTO, payloadRpcDTOList, stripCalcResults, primaryKeyGenerator
-                );
-            }
+                if (!CollectionUtils.isEmpty(PointRpcDTOmapNew)) {
+                    PointRpcDTOmapNew.forEach((key1, value1) -> {
+                        targetRelationDTO.setPointDTOList(value1);
+                        count( targetRelationDTO, payloadRpcDTOList, stripCalcResults, primaryKeyGenerator
+                        );
+                    });
 
+                }else {
+                    if (targetRelationDTO.getType()!=1){
+                        //排除移动目标 移动目标再上面单独循环调用
+                        targetRelationDTO.setPointDTOList(value);
+                        count( targetRelationDTO, payloadRpcDTOList, stripCalcResults, primaryKeyGenerator
+                        );
+                    }
+                }
+            });
             log.info("结束计算:{}", System.currentTimeMillis());
         }
     }
 
-    public void count(TargetDemandRpcDTO targetRelationDTO, List<PayloadRpcDTO> payloadRpcDTOList
-            , ArrayList<StripCalcResult> stripCalcResults
-            , AtomicLong primaryKeyGenerator) {
+    public void count(TargetDemandRpcDTO targetRelationDTO ,List<PayloadRpcDTO> payloadRpcDTOList
+            ,ArrayList<StripCalcResult> stripCalcResults
+            ,AtomicLong primaryKeyGenerator) {
         List<SatelliteIdAndPayloadDTO> dtos = satelliteIdCastDTO(targetRelationDTO.getSatelliteSelected());
         for (SatelliteIdAndPayloadDTO dto : dtos) {
             //根据卫星id查询载荷
@@ -945,7 +974,7 @@ public class StripService extends ServiceImpl<StripMapper, StripInfo> {
                         /*regionCoreDTO.setBizSerial(req.getReqIds().get(0));*/
                         bizReq.setRegion(regionCoreDTO);
                         List<SubPointDataRpcDTO> subPointDataRpcDTOS = regionService.getSubPoint(regionCoreDTO, payloadRpcDTO, targetRelationDTO);
-                        log.info("查询到星下点条数!:" + subPointDataRpcDTOS.size());
+                        log.info("查询到星下点条数!:"+subPointDataRpcDTOS.size());
                         if (!CollectionUtils.isEmpty(subPointDataRpcDTOS)) {
                                     /*EphTrack ephTrack = ephTrackService.convertEphTrack(subPointDataRpcDTOS, payloadInfo, fzTaskInfo);
                                     ephdatas.add(ephTrack);*/
@@ -962,7 +991,7 @@ public class StripService extends ServiceImpl<StripMapper, StripInfo> {
                             List<AlgSchemeStepWindow> algSchemeStepWindows = formatAndBatch(stripDTOList, payloadRpcDTO, targetRelationDTO.getParentId());
                             try {
                                 saveStrips(stripDTOList, payloadRpcDTO, targetRelationDTO.getParentId(), targetRelationDTO.getPointDTOList().get(0));
-                            } catch (Exception e) {
+                            }catch (Exception e){
                                 /*stripCalcResult.setIsSucceeded(STRIP_CALC_RESULT_FAILED);*/
                                 log.info("条带保存失败!");
                             }
@@ -977,7 +1006,7 @@ public class StripService extends ServiceImpl<StripMapper, StripInfo> {
                 }
             }
         }
-        /* stripCalcResultService.saveBatch(stripCalcResults);*/
+       /* stripCalcResultService.saveBatch(stripCalcResults);*/
     }
 
     /**