【运行日志参数修改】
This commit is contained in:
parent
3e16b48761
commit
1ca1b5372b
@ -4,12 +4,12 @@ import club.joylink.rtss.simulation.cbtc.CTC.data.CtcStationRunPlanLog;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
import java.util.ArrayList;
|
import java.util.HashMap;
|
||||||
import java.util.Collections;
|
import java.util.Map;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@ -134,7 +134,7 @@ public class CtcRunPlanParam implements Cloneable {
|
|||||||
/**
|
/**
|
||||||
* 列车运行计划作业
|
* 列车运行计划作业
|
||||||
*/
|
*/
|
||||||
private List<CtcStationRunPlanLog.RunPlanTask> runPlanTaskList = new ArrayList<>();
|
private Map<CtcStationRunPlanLog.RunPlanTask, Integer> runPlanTaskMap = new HashMap();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除时构造实体
|
* 删除时构造实体
|
||||||
@ -146,7 +146,7 @@ public class CtcRunPlanParam implements Cloneable {
|
|||||||
p.setRunPlanCode(this.runPlanCode);
|
p.setRunPlanCode(this.runPlanCode);
|
||||||
p.setStationCode(this.stationCode);
|
p.setStationCode(this.stationCode);
|
||||||
p.setTripNumber(this.tripNumber);
|
p.setTripNumber(this.tripNumber);
|
||||||
p.setRunPlanTaskList(null);
|
p.setRunPlanTaskMap(null);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,10 +232,15 @@ public class CtcRunPlanParam implements Cloneable {
|
|||||||
change = true;
|
change = true;
|
||||||
}
|
}
|
||||||
// 存在不一样的选项
|
// 存在不一样的选项
|
||||||
long modifyNum = modify.getRunPlanTaskList().stream().filter(task -> !this.runPlanTaskList.contains(task)).count();
|
Map<CtcStationRunPlanLog.RunPlanTask, Integer> modifyMap = new HashMap<>();
|
||||||
if (modifyNum > 0 || (this.runPlanTaskList.size() != modify.getRunPlanTaskList().size())) { // 长度不一致直接赋值
|
modify.getRunPlanTaskMap().forEach((k, v) -> {
|
||||||
this.runPlanTaskList = modify.getRunPlanTaskList();
|
if (!this.runPlanTaskMap.containsKey(k) || !Objects.equals(this.runPlanTaskMap.get(k), v)) {
|
||||||
runPlanParam.setRunPlanTaskList(modify.getRunPlanTaskList());
|
modifyMap.put(k, v);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (this.runPlanTaskMap.size() != modify.getRunPlanTaskMap().size() || !CollectionUtils.isEmpty(modifyMap)) {
|
||||||
|
this.runPlanTaskMap.putAll(modify.getRunPlanTaskMap());
|
||||||
|
runPlanParam.setRunPlanTaskMap(modifyMap);
|
||||||
change = true;
|
change = true;
|
||||||
}
|
}
|
||||||
return change ? runPlanParam : null;
|
return change ? runPlanParam : null;
|
||||||
@ -266,9 +271,9 @@ public class CtcRunPlanParam implements Cloneable {
|
|||||||
public CtcRunPlanParam clone() {
|
public CtcRunPlanParam clone() {
|
||||||
try {
|
try {
|
||||||
CtcRunPlanParam clone = (CtcRunPlanParam) super.clone();
|
CtcRunPlanParam clone = (CtcRunPlanParam) super.clone();
|
||||||
List<CtcStationRunPlanLog.RunPlanTask> list = new ArrayList<>(this.runPlanTaskList.size());
|
Map<CtcStationRunPlanLog.RunPlanTask, Integer> map = new HashMap(this.runPlanTaskMap.size());
|
||||||
Collections.copy(list, this.runPlanTaskList);
|
map.putAll(this.runPlanTaskMap);
|
||||||
clone.setRunPlanTaskList(list);
|
clone.setRunPlanTaskMap(map);
|
||||||
return clone;
|
return clone;
|
||||||
} catch (CloneNotSupportedException e) {
|
} catch (CloneNotSupportedException e) {
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
|
@ -19,10 +19,7 @@ import org.springframework.util.CollectionUtils;
|
|||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@ -484,9 +481,14 @@ public class CtcStationRunPlanLogService {
|
|||||||
original.setDepartDirectionCode(modify.getDepartDirectionCode());
|
original.setDepartDirectionCode(modify.getDepartDirectionCode());
|
||||||
}
|
}
|
||||||
// 存在不一样的选项
|
// 存在不一样的选项
|
||||||
long modifyNum = modify.getRunPlanTaskList().stream().filter(task -> !original.getRunPlanTaskList().contains(task)).count();
|
Map<CtcStationRunPlanLog.RunPlanTask, Integer> modifyMap = new HashMap<>();
|
||||||
if (modifyNum > 0 || (original.getRunPlanTaskList().size() != modify.getRunPlanTaskList().size())) { // 长度不一致直接赋值
|
modify.getRunPlanTaskMap().forEach((k, v) -> {
|
||||||
original.setRunPlanTaskList(modify.getRunPlanTaskList());
|
if (!original.getRunPlanTaskMap().containsKey(k) && !Objects.equals(original.getRunPlanTaskMap().get(k), v)) {
|
||||||
|
modifyMap.put(k, v);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (original.getRunPlanTaskMap().size() != modify.getRunPlanTaskMap().size() || !CollectionUtils.isEmpty(modifyMap)) {
|
||||||
|
original.getRunPlanTaskMap().putAll(modify.getRunPlanTaskMap());
|
||||||
}
|
}
|
||||||
if (!Objects.equals(original.getStatus(), modify.getStatus())) {
|
if (!Objects.equals(original.getStatus(), modify.getStatus())) {
|
||||||
original.setStatus(modify.getStatus());
|
original.setStatus(modify.getStatus());
|
||||||
|
@ -131,8 +131,8 @@ public class CtcStationRunPlanLog {
|
|||||||
this.trackDiscordant = paramInfo.getTrackDiscordant(); // 运行股道与基本径路不一致
|
this.trackDiscordant = paramInfo.getTrackDiscordant(); // 运行股道与基本径路不一致
|
||||||
this.entryOutDiscordant = paramInfo.getEntryOutDiscordant(); // 出入口与基本径路不一致
|
this.entryOutDiscordant = paramInfo.getEntryOutDiscordant(); // 出入口与基本径路不一致
|
||||||
this.transfinite = paramInfo.getTransfinite(); // 超限等级
|
this.transfinite = paramInfo.getTransfinite(); // 超限等级
|
||||||
if (CollectionUtils.isEmpty(paramInfo.getRunPlanTaskList())) { // 运行计划任务
|
if (CollectionUtils.isEmpty(paramInfo.getRunPlanTaskMap())) { // 运行计划任务
|
||||||
this.runPlanTaskItemMap = paramInfo.getRunPlanTaskList().stream()
|
this.runPlanTaskItemMap = paramInfo.getRunPlanTaskMap().keySet().stream()
|
||||||
.collect(Collectors.toMap(t -> t, t -> new RunPlanTaskItem(t)));
|
.collect(Collectors.toMap(t -> t, t -> new RunPlanTaskItem(t)));
|
||||||
} else {
|
} else {
|
||||||
this.runPlanTaskItemMap = new HashMap<>(0);
|
this.runPlanTaskItemMap = new HashMap<>(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user