|
@@ -18,6 +18,7 @@ import com.base.plan.model.dto.request.QueryDemandDTO;
|
|
import com.base.plan.model.dto.request.QueryKjckDTO;
|
|
import com.base.plan.model.dto.request.QueryKjckDTO;
|
|
import com.base.plan.model.entity.*;
|
|
import com.base.plan.model.entity.*;
|
|
import com.base.plan.model.param.DemandParam;
|
|
import com.base.plan.model.param.DemandParam;
|
|
|
|
+import com.base.plan.utils.PropertiesUtil;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.util.Assert;
|
|
import org.springframework.util.Assert;
|
|
@@ -544,6 +545,7 @@ public class DemandService {
|
|
stripMapper.initSelected(parentIdSubstring);
|
|
stripMapper.initSelected(parentIdSubstring);
|
|
stepWindowControlPassRelationMapper.initSelected(parentIdSubstring);
|
|
stepWindowControlPassRelationMapper.initSelected(parentIdSubstring);
|
|
stepWindowDataPassRelationMapper.initSelected(parentIdSubstring);
|
|
stepWindowDataPassRelationMapper.initSelected(parentIdSubstring);
|
|
|
|
+ stepWindowRelationMapper.initConfirmStatus(parentIdSubstring);
|
|
}else{
|
|
}else{
|
|
//2.1 根据传入的parent_id集合查询alg_scheme_step_window中parent_id一致的数据,然后按照卫星冲突检测规则进行时间筛选
|
|
//2.1 根据传入的parent_id集合查询alg_scheme_step_window中parent_id一致的数据,然后按照卫星冲突检测规则进行时间筛选
|
|
algSchemeStepWindowList = algSchemeStepWindowService.getAlgSchemeStepWindowByParentIds(demandParam.getParentIds());
|
|
algSchemeStepWindowList = algSchemeStepWindowService.getAlgSchemeStepWindowByParentIds(demandParam.getParentIds());
|
|
@@ -551,6 +553,7 @@ public class DemandService {
|
|
stripMapper.initSelectedByList(demandParam.getParentIds());
|
|
stripMapper.initSelectedByList(demandParam.getParentIds());
|
|
stepWindowControlPassRelationMapper.initSelectedByList(demandParam.getParentIds());
|
|
stepWindowControlPassRelationMapper.initSelectedByList(demandParam.getParentIds());
|
|
stepWindowDataPassRelationMapper.initSelectedByList(demandParam.getParentIds());
|
|
stepWindowDataPassRelationMapper.initSelectedByList(demandParam.getParentIds());
|
|
|
|
+ stepWindowRelationMapper.initConfirmStatusByList(demandParam.getParentIds());
|
|
}
|
|
}
|
|
//这里实现目标个数的统计
|
|
//这里实现目标个数的统计
|
|
long targetParentIdCount= algSchemeStepWindowList.stream().map(AlgSchemeStepWindow::getParentId).distinct().count();
|
|
long targetParentIdCount= algSchemeStepWindowList.stream().map(AlgSchemeStepWindow::getParentId).distinct().count();
|
|
@@ -596,6 +599,7 @@ public class DemandService {
|
|
List<String> dataWindowIds = stepWindowDataPassRelations.stream().map(StepWindowDataPassRelation::getDataStationWindowId).collect(Collectors.toList());
|
|
List<String> dataWindowIds = stepWindowDataPassRelations.stream().map(StepWindowDataPassRelation::getDataStationWindowId).collect(Collectors.toList());
|
|
stepWindowControlPassRelationMapper.batchUpdateConfirmStatus(controlWindowIds);
|
|
stepWindowControlPassRelationMapper.batchUpdateConfirmStatus(controlWindowIds);
|
|
stepWindowDataPassRelationMapper.batchUpdateConfirmStatus(dataWindowIds);
|
|
stepWindowDataPassRelationMapper.batchUpdateConfirmStatus(dataWindowIds);
|
|
|
|
+ stepWindowRelationMapper.batchUpdateConfirmStatus(windowIds);
|
|
return AjaxResult.success("方案生成成功");
|
|
return AjaxResult.success("方案生成成功");
|
|
}
|
|
}
|
|
|
|
|
|
@@ -661,14 +665,28 @@ public class DemandService {
|
|
* @return 是否冲突
|
|
* @return 是否冲突
|
|
*/
|
|
*/
|
|
private boolean isTimeConflict(List<AlgSchemeWindowPass> algSchemeWindowPassList, AlgSchemeWindowPass controlPass) {
|
|
private boolean isTimeConflict(List<AlgSchemeWindowPass> algSchemeWindowPassList, AlgSchemeWindowPass controlPass) {
|
|
|
|
+ // 判断卫星编号是否重复
|
|
|
|
+ boolean isSatelliteConflict = algSchemeWindowPassList.stream().anyMatch(obj -> obj.getSatelliteId().equals(controlPass.getSatelliteId()));
|
|
|
|
+ if(!isSatelliteConflict){
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ //判断地面站是否重复
|
|
boolean isStationConflict = algSchemeWindowPassList.stream().anyMatch(obj -> obj.getStationId().equals(controlPass.getStationId()));
|
|
boolean isStationConflict = algSchemeWindowPassList.stream().anyMatch(obj -> obj.getStationId().equals(controlPass.getStationId()));
|
|
if(!isStationConflict){
|
|
if(!isStationConflict){
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
+ for (AlgSchemeWindowPass existObj : algSchemeWindowPassList) {
|
|
|
|
+ long existPassStartTime = existObj.getStartTime().getTime() - 15 * 60 * 1000;
|
|
|
|
+ long existPassEndTime = existObj.getEndTime().getTime() + 15 * 60 * 1000;
|
|
|
|
+
|
|
|
|
+ long checkPassStartTime = controlPass.getStartTime().getTime();
|
|
|
|
+ long checkPassEndTime = controlPass.getEndTime().getTime();
|
|
|
|
|
|
- return !algSchemeWindowPassList.stream()
|
|
|
|
- .allMatch(existObj -> controlPass.getEndTime().before(existObj.getStartTime())
|
|
|
|
- || existObj.getEndTime().after(existObj.getEndTime()));
|
|
|
|
|
|
+ if(checkPassStartTime <= existPassEndTime && existPassStartTime <= checkPassEndTime){
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return true;
|
|
}
|
|
}
|
|
|
|
|
|
private Map<String, AlgSchemeStepWindow> handleSelectedRecords(List<AlgSchemeStepWindow> selectedRecords) {
|
|
private Map<String, AlgSchemeStepWindow> handleSelectedRecords(List<AlgSchemeStepWindow> selectedRecords) {
|
|
@@ -813,6 +831,7 @@ public class DemandService {
|
|
|
|
|
|
Set<String> usedParentIds = new HashSet<>();
|
|
Set<String> usedParentIds = new HashSet<>();
|
|
List<AlgSchemeStepWindow> selectedWindowList = new ArrayList<>();
|
|
List<AlgSchemeStepWindow> selectedWindowList = new ArrayList<>();
|
|
|
|
+ Map<String, List<AlgSchemeStepWindow>> recordStepWindowMap = new HashMap<>();
|
|
//设置一个数,避免死循环
|
|
//设置一个数,避免死循环
|
|
int loopCount = 0;
|
|
int loopCount = 0;
|
|
|
|
|
|
@@ -820,21 +839,30 @@ public class DemandService {
|
|
for (Map.Entry<String, List<AlgSchemeStepWindow>> entry : algSchemeStepWindowSortMap.entrySet()) {
|
|
for (Map.Entry<String, List<AlgSchemeStepWindow>> entry : algSchemeStepWindowSortMap.entrySet()) {
|
|
String satelliteId = entry.getKey();
|
|
String satelliteId = entry.getKey();
|
|
List<AlgSchemeStepWindow> satelliteData = entry.getValue();
|
|
List<AlgSchemeStepWindow> satelliteData = entry.getValue();
|
|
-
|
|
|
|
|
|
+ //获取卫星拍摄前置时间与后置时间
|
|
|
|
+ int leadTime = PropertiesUtil.getSatelliteConstraintInfo(satelliteId);
|
|
|
|
+ // 按照startTime降序排序
|
|
satelliteData.sort(Comparator.comparing(AlgSchemeStepWindow::getStartTime).reversed());
|
|
satelliteData.sort(Comparator.comparing(AlgSchemeStepWindow::getStartTime).reversed());
|
|
|
|
|
|
- List<AlgSchemeStepWindow> nonOverlappingRecords = new ArrayList<>();
|
|
|
|
|
|
+ if(recordStepWindowMap.get(satelliteId) == null){
|
|
|
|
+ List<AlgSchemeStepWindow> nonOverlappingRecords = new ArrayList<>();
|
|
|
|
+ recordStepWindowMap.put(satelliteId, nonOverlappingRecords);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ List<AlgSchemeStepWindow> nonOverlappingRecords = recordStepWindowMap.get(satelliteId);
|
|
for (AlgSchemeStepWindow record : satelliteData) {
|
|
for (AlgSchemeStepWindow record : satelliteData) {
|
|
if (usedParentIds.contains(record.getParentId())) {
|
|
if (usedParentIds.contains(record.getParentId())) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
|
|
- if (!isOverlapping(nonOverlappingRecords, record)) {
|
|
|
|
|
|
+ if (!isOverlapping(nonOverlappingRecords, record, leadTime, leadTime)) {
|
|
nonOverlappingRecords.add(record);
|
|
nonOverlappingRecords.add(record);
|
|
usedParentIds.add(record.getParentId());
|
|
usedParentIds.add(record.getParentId());
|
|
selectedWindowList.add(record);
|
|
selectedWindowList.add(record);
|
|
|
|
|
|
|
|
+ // 更新每个星对应的条带窗口数据
|
|
|
|
+ recordStepWindowMap.put(satelliteId, nonOverlappingRecords);
|
|
|
|
+
|
|
if (selectedWindowList.size() >= limit) {
|
|
if (selectedWindowList.size() >= limit) {
|
|
return selectedWindowList;
|
|
return selectedWindowList;
|
|
}
|
|
}
|
|
@@ -853,9 +881,17 @@ public class DemandService {
|
|
return selectedWindowList;
|
|
return selectedWindowList;
|
|
}
|
|
}
|
|
|
|
|
|
- private static boolean isOverlapping(List<AlgSchemeStepWindow> records, AlgSchemeStepWindow newRecord) {
|
|
|
|
|
|
+ private boolean isOverlapping(List<AlgSchemeStepWindow> records, AlgSchemeStepWindow newRecord, int leadTime, int postTime) {
|
|
|
|
+ if(newRecord.getParentId().equals("240906_XQCH_10017_0025") || newRecord.getParentId().equals("240906_XQCH_10017_0020")){
|
|
|
|
+ log.info("进入了断点");
|
|
|
|
+ }
|
|
for (AlgSchemeStepWindow record : records) {
|
|
for (AlgSchemeStepWindow record : records) {
|
|
- if (!(newRecord.getEndTime().before(record.getStartTime()))) {
|
|
|
|
|
|
+ long existStartTime = record.getStartTime().getTime() - (long) leadTime * 60 * 1000;
|
|
|
|
+ long existEndTime = record.getEndTime().getTime() + (long) postTime * 60 * 1000;
|
|
|
|
+ long checkStartTime = newRecord.getStartTime().getTime();
|
|
|
|
+ long checkEndTime = newRecord.getEndTime().getTime();
|
|
|
|
+
|
|
|
|
+ if(checkStartTime <= existEndTime && existStartTime <= checkEndTime){
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
}
|