Browse Source

Merge remote-tracking branch 'origin/master'

wurui 3 tuần trước cách đây
mục cha
commit
ae4041a0a9

+ 62 - 75
orbit-base-plan/base-plan-service/src/main/java/com/base/plan/service/StripService.java

@@ -795,20 +795,7 @@ 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);
@@ -822,80 +809,80 @@ public class StripService extends ServiceImpl<StripMapper, StripInfo> {
 
 
             log.info("开始计算:{}", System.currentTimeMillis());
-            threadPoolTaskExecutor.execute(() -> {
-                List<PointRpcDTO> value=targetRelationDTO.getPointDTOList();
-                /**
-                 * 1.构建观测区域
-                 * 2.根据观测区域获取可见星下点数据
-                 */
-                System.out.println("====================构建观测区域===================");
-
-                //判断是那个类型的目标 目前只有移动点目标 线目标 点群目标需要做单独处理
-                if (targetRelationDTO.getType()==1){
-                    //移动点目标
-                    //根据 航向 航速 时间进行轨迹推算 取得所需时刻后的目标点位
-
-                    //先满足点选
+
+            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
-                        );
-                    }
+                for (PointRpcDTO p : value) {
+                    //移动目标计算每个点位
+                    List<PointRpcDTO> valuenew = new ArrayList<>();
+                    valuenew.add(p);
+                    targetRelationDTO.setPointDTOList(valuenew);
+                    count(targetRelationDTO, payloadRpcDTOList, stripCalcResults, primaryKeyGenerator
+                    );
                 }
+            }
 
-                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);
-                        }
-                    }
+            Map<Integer, List<PointRpcDTO>> PointRpcDTOmapNew = new HashMap<>();
 
-                }
-                if (targetRelationDTO.getType()==4){
-                    //点群目标
-                    //先绘制点群外接四边形区域
-                    List<PointRpcDTO> pointRpcDTOList2=new ArrayList<>();
-                    pointRpcDTOList2=LaLonUtil.getregion(value);
-                    value=new ArrayList<>();
-                    value=pointRpcDTOList2;
+            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 {
-                    if (targetRelationDTO.getType()!=1){
-                        //排除移动目标 移动目标再上面单独循环调用
-                        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());
         }
     }