Merge branch 'test-training2' of https://git.code.tencent.com/lian-cbtc/rtss-server into test-training2
This commit is contained in:
commit
e865770a4b
@ -1,6 +1,6 @@
|
|||||||
package club.joylink.rtss.entity.training2;
|
package club.joylink.rtss.entity.training2;
|
||||||
|
|
||||||
import club.joylink.rtss.vo.client.training2.Expression;
|
import club.joylink.rtss.simulation.cbtc.training2.Expression;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@ -478,7 +478,7 @@ public class DraftMapRouteServiceImpl implements DraftMapRouteService {
|
|||||||
MapRouteNewVO departureRoute = routeVOMap.get(startEndSignalCode); //发车进路
|
MapRouteNewVO departureRoute = routeVOMap.get(startEndSignalCode); //发车进路
|
||||||
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(departureRoute.getName().startsWith("L"),
|
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(departureRoute.getName().startsWith("L"),
|
||||||
String.format("信号机[%s]的通过进路的发车进路[%s]不是列车进路", signal.getCode(), departureRoute.getCode()));
|
String.format("信号机[%s]的通过进路的发车进路[%s]不是列车进路", signal.getCode(), departureRoute.getCode()));
|
||||||
routeAspectVOS.add(new MapRouteAspectVO(departureRoute.getCode(), departureRoute.getSignalAspect()));
|
routeAspectVOS.add(new MapRouteAspectVO(departureRoute.getCode(), getAspectIndex(SignalAspect.Y)));
|
||||||
routeVO.setEndSectionCode(departureRoute.getEndSectionCode());
|
routeVO.setEndSectionCode(departureRoute.getEndSectionCode());
|
||||||
List<MapSignalButtonVO> buttons = signalCode_button_map.get(destination.getCode());
|
List<MapSignalButtonVO> buttons = signalCode_button_map.get(destination.getCode());
|
||||||
MapSignalButtonVO endButton = buttons.stream().filter(vo -> MapSignalButtonVO.Type.PICK.equals(vo.getType()))
|
MapSignalButtonVO endButton = buttons.stream().filter(vo -> MapSignalButtonVO.Type.PICK.equals(vo.getType()))
|
||||||
@ -494,7 +494,7 @@ public class DraftMapRouteServiceImpl implements DraftMapRouteService {
|
|||||||
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(receivingRoute,
|
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(receivingRoute,
|
||||||
String.format("[%s]接车进路不存在", startEndSignalCode));
|
String.format("[%s]接车进路不存在", startEndSignalCode));
|
||||||
routeVO.setStartSectionCode(receivingRoute.getStartSectionCode());
|
routeVO.setStartSectionCode(receivingRoute.getStartSectionCode());
|
||||||
routeAspectVOS.add(new MapRouteAspectVO(receivingRoute.getCode(), receivingRoute.getSignalAspect()));
|
routeAspectVOS.add(new MapRouteAspectVO(receivingRoute.getCode(), getAspectIndex(SignalAspect.GY)));
|
||||||
outboundSignal = section.getSignalOf(right);
|
outboundSignal = section.getSignalOf(right);
|
||||||
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(outboundSignal,
|
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(outboundSignal,
|
||||||
String.format("股道[%s]无出站信号机", section.getCode()));
|
String.format("股道[%s]无出站信号机", section.getCode()));
|
||||||
|
@ -0,0 +1,132 @@
|
|||||||
|
package club.joylink.rtss.simulation.cbtc.training2;
|
||||||
|
|
||||||
|
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表达式
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class Expression<T> implements Valuable<Boolean> {
|
||||||
|
Valuable<T> v1;
|
||||||
|
|
||||||
|
Operator operator;
|
||||||
|
|
||||||
|
Valuable<T> v2;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean getValue() throws IllegalAccessException {
|
||||||
|
BusinessExceptionAssertEnum.DATA_ERROR.assertNotNull(operator);
|
||||||
|
switch (operator) {
|
||||||
|
//逻辑运算符
|
||||||
|
case AND:
|
||||||
|
return (Boolean) v1.getValue() && (Boolean) v2.getValue();
|
||||||
|
case OR:
|
||||||
|
return (Boolean) v1.getValue() || (Boolean) v2.getValue();
|
||||||
|
case NOT: //还是觉得不要这个好
|
||||||
|
return !(Boolean) v1.getValue();
|
||||||
|
//关系运算符
|
||||||
|
case EQUALS:
|
||||||
|
return Objects.equals(v1.getValue(), v2.getValue());
|
||||||
|
case NOT_EQUALS:
|
||||||
|
return !Objects.equals(v1.getValue(), v2.getValue());
|
||||||
|
case GREATER_THAN:
|
||||||
|
return ((Comparable)v1.getValue()).compareTo(v2.getValue()) > 0;
|
||||||
|
case GREATER_THAN_OR_EQUALS:
|
||||||
|
return ((Comparable)v1.getValue()).compareTo(v2.getValue()) >= 0;
|
||||||
|
case LESS_THAN:
|
||||||
|
return ((Comparable)v1.getValue()).compareTo(v2.getValue()) < 0;
|
||||||
|
case LESS_THAN_OR_EQUALS:
|
||||||
|
return ((Comparable)v1.getValue()).compareTo(v2.getValue()) <= 0;
|
||||||
|
default:
|
||||||
|
throw new IllegalStateException("Unexpected value: " + operator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum Operator {
|
||||||
|
AND(1),
|
||||||
|
OR(2),
|
||||||
|
NOT(3),
|
||||||
|
EQUALS(4),
|
||||||
|
NOT_EQUALS(5),
|
||||||
|
GREATER_THAN(6),
|
||||||
|
GREATER_THAN_OR_EQUALS(7),
|
||||||
|
LESS_THAN(8),
|
||||||
|
LESS_THAN_OR_EQUALS(9),
|
||||||
|
;
|
||||||
|
private final int code;
|
||||||
|
|
||||||
|
Operator(int code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 逻辑表达式
|
||||||
|
*/
|
||||||
|
public static class Expression1 extends Expression<Boolean> {
|
||||||
|
@Override
|
||||||
|
public Boolean getValue() throws IllegalAccessException {
|
||||||
|
BusinessExceptionAssertEnum.DATA_ERROR.assertNotNull(operator);
|
||||||
|
switch (operator) {
|
||||||
|
//逻辑运算符
|
||||||
|
case AND:
|
||||||
|
return v1.getValue() && v2.getValue();
|
||||||
|
case OR:
|
||||||
|
return v1.getValue() || v2.getValue();
|
||||||
|
case NOT: //还是觉得不要这个好
|
||||||
|
return !v1.getValue();
|
||||||
|
default:
|
||||||
|
throw new IllegalStateException("Unexpected value: " + operator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关系表达式1
|
||||||
|
*/
|
||||||
|
public static class Expression2 extends Expression<Object> {
|
||||||
|
@Override
|
||||||
|
public Boolean getValue() throws IllegalAccessException {
|
||||||
|
BusinessExceptionAssertEnum.DATA_ERROR.assertNotNull(operator);
|
||||||
|
switch (operator) {
|
||||||
|
//关系运算符
|
||||||
|
case EQUALS:
|
||||||
|
return Objects.equals(v1.getValue(), v2.getValue());
|
||||||
|
case NOT_EQUALS:
|
||||||
|
return !Objects.equals(v1.getValue(), v2.getValue());
|
||||||
|
default:
|
||||||
|
throw new IllegalStateException("Unexpected value: " + operator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关系表达式1
|
||||||
|
*/
|
||||||
|
public static class Expression3<T extends Comparable<T>> extends Expression<T> {
|
||||||
|
@Override
|
||||||
|
public Boolean getValue() throws IllegalAccessException {
|
||||||
|
BusinessExceptionAssertEnum.DATA_ERROR.assertNotNull(operator);
|
||||||
|
switch (operator) {
|
||||||
|
//关系运算符
|
||||||
|
case GREATER_THAN:
|
||||||
|
return v1.getValue().compareTo(v2.getValue()) > 0;
|
||||||
|
case GREATER_THAN_OR_EQUALS:
|
||||||
|
return v1.getValue().compareTo(v2.getValue()) >= 0;
|
||||||
|
case LESS_THAN:
|
||||||
|
return v1.getValue().compareTo(v2.getValue()) < 0;
|
||||||
|
case LESS_THAN_OR_EQUALS:
|
||||||
|
return v1.getValue().compareTo(v2.getValue()) <= 0;
|
||||||
|
default:
|
||||||
|
throw new IllegalStateException("Unexpected value: " + operator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
package club.joylink.rtss.simulation.cbtc.training2;
|
||||||
|
|
||||||
|
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
|
public class StatusValue<T> implements Valuable<T>{
|
||||||
|
private MapElement element;
|
||||||
|
|
||||||
|
private String fieldName;
|
||||||
|
|
||||||
|
private Field field;
|
||||||
|
|
||||||
|
public StatusValue(MapElement element, String fieldName) throws NoSuchFieldException {
|
||||||
|
|
||||||
|
this.element = element;
|
||||||
|
this.fieldName = fieldName;
|
||||||
|
Class<?> aClass = element.getClass();
|
||||||
|
while (true) {
|
||||||
|
try {
|
||||||
|
field = aClass.getDeclaredField(fieldName);
|
||||||
|
} catch (NoSuchFieldException e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
}
|
||||||
|
if (field != null)
|
||||||
|
break;
|
||||||
|
aClass = aClass.getSuperclass();
|
||||||
|
if (aClass == null) {
|
||||||
|
throw new NoSuchFieldException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
field.setAccessible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public T getValue() throws IllegalAccessException {
|
||||||
|
return (T) field.get(element);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
package club.joylink.rtss.simulation.cbtc.training2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 有值的
|
||||||
|
*/
|
||||||
|
public interface Valuable<T> {
|
||||||
|
T getValue() throws IllegalAccessException;
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
package club.joylink.rtss.vo.client.training2;
|
package club.joylink.rtss.vo.client.training2;
|
||||||
|
|
||||||
import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation;
|
import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.training2.Expression;
|
||||||
import club.joylink.rtss.util.JsonUtils;
|
import club.joylink.rtss.util.JsonUtils;
|
||||||
import club.joylink.rtss.vo.map.graph.Point;
|
import club.joylink.rtss.vo.map.graph.Point;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
@ -12,8 +12,6 @@ import java.util.List;
|
|||||||
public class Step2VO {
|
public class Step2VO {
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
private List<String> operaIds;
|
private List<String> operaIds;
|
||||||
|
@ -57,9 +57,9 @@ public class MapArrowVO {
|
|||||||
*/
|
*/
|
||||||
private String color;
|
private String color;
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 显示条件 01:现地&行调 / 02:行调 / 03:现地
|
// * 显示条件 01:现地&行调 / 02:行调 / 03:现地
|
||||||
*/
|
// */
|
||||||
@NotBlank(message="显示条件不能为空")
|
// @NotBlank(message="显示条件不能为空")
|
||||||
private String showConditions;
|
// private String showConditions;
|
||||||
}
|
}
|
||||||
|
@ -50,11 +50,11 @@ public class MapLineVO {
|
|||||||
*/
|
*/
|
||||||
private String lineColor;
|
private String lineColor;
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 显示条件 01:现地&行调 / 02:行调 / 03:现地
|
// * 显示条件 01:现地&行调 / 02:行调 / 03:现地
|
||||||
*/
|
// */
|
||||||
@NotBlank(message="显示条件不能为空")
|
// @NotBlank(message="显示条件不能为空")
|
||||||
private String showConditions;
|
// private String showConditions;
|
||||||
|
|
||||||
private Integer offsetX;
|
private Integer offsetX;
|
||||||
|
|
||||||
|
@ -43,9 +43,9 @@ public class MapOuterFrameVO {
|
|||||||
@NotNull(message="位置不能为空")
|
@NotNull(message="位置不能为空")
|
||||||
private Point position;
|
private Point position;
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 显示条件 01:现地&行调 / 02:行调 / 03:现地
|
// * 显示条件 01:现地&行调 / 02:行调 / 03:现地
|
||||||
*/
|
// */
|
||||||
@NotBlank(message="显示条件不能为空")
|
// @NotBlank(message="显示条件不能为空")
|
||||||
private String showConditions;
|
// private String showConditions;
|
||||||
}
|
}
|
||||||
|
@ -35,10 +35,10 @@ public class MapPowerLineVO {
|
|||||||
*/
|
*/
|
||||||
private boolean rightTerminal;
|
private boolean rightTerminal;
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
*显示工作站类型
|
// *显示工作站类型
|
||||||
*/
|
// */
|
||||||
private String showConditions;
|
// private String showConditions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*端点坐标
|
*端点坐标
|
||||||
|
@ -39,9 +39,9 @@ public class MapStationSplitVO {
|
|||||||
@NotNull
|
@NotNull
|
||||||
private Point position;
|
private Point position;
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 显示条件 01:现地&行调 / 02:行调 / 03:现地
|
// * 显示条件 01:现地&行调 / 02:行调 / 03:现地
|
||||||
*/
|
// */
|
||||||
@NotBlank(message="显示条件不能为空")
|
// @NotBlank(message="显示条件不能为空")
|
||||||
private String showConditions;
|
// private String showConditions;
|
||||||
}
|
}
|
||||||
|
@ -50,9 +50,9 @@ public class MapTextVO {
|
|||||||
@NotNull(message="坐标不能为空")
|
@NotNull(message="坐标不能为空")
|
||||||
private Point position;
|
private Point position;
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 显示条件 01:现地&行调 / 02:行调 / 03:现地
|
// * 显示条件 01:现地&行调 / 02:行调 / 03:现地
|
||||||
*/
|
// */
|
||||||
@NotBlank(message="显示条件不能为空")
|
// @NotBlank(message="显示条件不能为空")
|
||||||
private String showConditions;
|
// private String showConditions;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user