Merge branch 'test-training2' of https://git.code.tencent.com/lian-cbtc/rtss-server into test-training2-xzb1

This commit is contained in:
xzb 2022-09-14 14:32:33 +08:00
commit 4c5225e19d
14 changed files with 89 additions and 79 deletions

View File

@ -294,7 +294,7 @@ public class Training2Service {
} }
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
throw new RuntimeException(e); throw new SimulationException(SimulationExceptionType.System_Fault, e);
} finally { } finally {
completeStepSemaphore.release(); completeStepSemaphore.release();
} }
@ -338,7 +338,7 @@ public class Training2Service {
} }
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
throw new RuntimeException(e); throw new SimulationException(SimulationExceptionType.System_Fault, e);
} finally { } finally {
completeOperationSemaphore.release(); completeOperationSemaphore.release();
} }

View File

@ -21,7 +21,7 @@ import java.util.*;
*/ */
@Getter @Getter
@Setter @Setter
@ExpConditionMaterialSrcAnno(name="Route") @ExpConditionMaterialSrcAnno(name = "Route", deviceType = MapElement.DeviceType.ROUTE)
public class Route extends MapNamedElement { public class Route extends MapNamedElement {
public Route(String code, String name) { public Route(String code, String name) {
@ -161,31 +161,31 @@ public class Route extends MapNamedElement {
/** /**
* ats自动控制 * ats自动控制
*/ */
@ExpConditionMaterialAnno(name = "atsControl",type = "boolean",desc = "ats自动控制") @ExpConditionMaterialAnno(name = "atsControl", type = "boolean", desc = "ats自动控制")
private boolean atsControl; private boolean atsControl;
/** /**
* 连续通过进路模式(联锁自动进路)开启 * 连续通过进路模式(联锁自动进路)开启
*/ */
@ExpConditionMaterialAnno(name = "fleetMode",type = "boolean",desc = "连续通过进路模式(联锁自动进路)开启") @ExpConditionMaterialAnno(name = "fleetMode", type = "boolean", desc = "连续通过进路模式(联锁自动进路)开启")
private boolean fleetMode; private boolean fleetMode;
/** /**
* 自动追踪/联锁自动触发模式开启 * 自动追踪/联锁自动触发模式开启
*/ */
@ExpConditionMaterialAnno(name = "ciControl",type = "boolean",desc = "自动追踪/联锁自动触发模式开启") @ExpConditionMaterialAnno(name = "ciControl", type = "boolean", desc = "自动追踪/联锁自动触发模式开启")
private boolean ciControl; private boolean ciControl;
/** /**
* 进路是否可以排列 * 进路是否可以排列
*/ */
@ExpConditionMaterialAnno(name = "settable",type = "boolean",desc = "进路是否可以排列") @ExpConditionMaterialAnno(name = "settable", type = "boolean", desc = "进路是否可以排列")
private boolean settable; private boolean settable;
/** /**
* 进路是否排列中 * 进路是否排列中
*/ */
@ExpConditionMaterialAnno(name = "setting",type = "boolean",desc = "进路是否排列中") @ExpConditionMaterialAnno(name = "setting", type = "boolean", desc = "进路是否排列中")
private boolean setting; private boolean setting;
/** /**
* 该进路办理成功后要开放的信号 * 该进路办理成功后要开放的信号
@ -201,13 +201,13 @@ public class Route extends MapNamedElement {
/** /**
* 是否引导进路排列中 * 是否引导进路排列中
*/ */
@ExpConditionMaterialAnno(name = "guideSetting",type = "boolean",desc = "是否引导进路排列中") @ExpConditionMaterialAnno(name = "guideSetting", type = "boolean", desc = "是否引导进路排列中")
private boolean guideSetting; private boolean guideSetting;
/** /**
* 进路是否锁闭 * 进路是否锁闭
*/ */
@ExpConditionMaterialAnno(name = "lock",type = "boolean",desc = "进路是否锁闭") @ExpConditionMaterialAnno(name = "lock", type = "boolean", desc = "进路是否锁闭")
private boolean lock; private boolean lock;
/** /**
@ -218,7 +218,7 @@ public class Route extends MapNamedElement {
/** /**
* 是否正常解锁中 * 是否正常解锁中
*/ */
@ExpConditionMaterialAnno(name = "normalUnlock",type = "boolean",desc = "是否正常解锁中") @ExpConditionMaterialAnno(name = "normalUnlock", type = "boolean", desc = "是否正常解锁中")
private boolean normalUnlock; private boolean normalUnlock;
/** /**
@ -267,13 +267,14 @@ public class Route extends MapNamedElement {
this.unlockedSection = null; this.unlockedSection = null;
this.train = null; this.train = null;
this.checkConflict = false; this.checkConflict = false;
this.settedAspect=null; this.settedAspect = null;
} }
/** /**
* 是否是组合进路 * 是否是组合进路
*/ */
public boolean isMultiRoute() { public boolean isMultiRoute() {
return null!=this.multiRouteAspects&&!this.multiRouteAspects.isEmpty(); return null != this.multiRouteAspects && !this.multiRouteAspects.isEmpty();
} }
/** /**
@ -835,7 +836,7 @@ public class Route extends MapNamedElement {
} }
} }
} }
SignalAspect rt=getSettedAspect()==null?getAspect():getSettedAspect(); SignalAspect rt = getSettedAspect() == null ? getAspect() : getSettedAspect();
return rt; return rt;
} }

View File

@ -21,7 +21,7 @@ import java.util.*;
*/ */
@Getter @Getter
@Setter @Setter
@ExpConditionMaterialSrcAnno(name = "Section") @ExpConditionMaterialSrcAnno(name = "Section", deviceType = MapElement.DeviceType.SECTION)
public class Section extends DelayUnlockDevice { public class Section extends DelayUnlockDevice {
public Section(String code, String name) { public Section(String code, String name) {
@ -186,13 +186,13 @@ public class Section extends DelayUnlockDevice {
/** /**
* 是否封锁封锁后包含区段的进路不能排列 * 是否封锁封锁后包含区段的进路不能排列
*/ */
@ExpConditionMaterialAnno(name = "blockade",type = "boolean",desc = "是否封锁(封锁后,包含区段的进路不能排列)") @ExpConditionMaterialAnno(name = "blockade", type = "boolean", desc = "是否封锁")
private boolean blockade; private boolean blockade;
/** /**
* 是否进路锁闭 * 是否进路锁闭
*/ */
@ExpConditionMaterialAnno(name = "routeLock",type = "boolean",desc = "是否进路锁闭") @ExpConditionMaterialAnno(name = "routeLock", type = "boolean", desc = "是否进路锁闭")
private boolean routeLock; private boolean routeLock;
/** /**
@ -208,43 +208,42 @@ public class Section extends DelayUnlockDevice {
/** /**
* 进路延续保护锁闭 * 进路延续保护锁闭
*/ */
@ExpConditionMaterialAnno(name = "overlapLock",type = "boolean",desc = "进路延续保护锁闭") @ExpConditionMaterialAnno(name = "overlapLock", type = "boolean", desc = "是否进路延续保护锁闭")
private boolean overlapLock; private boolean overlapLock;
/** /**
* 通信车占用 * 通信车占用
*/ */
@ExpConditionMaterialAnno(name = "ctOccupied",type = "boolean",desc = "通信车占用") @ExpConditionMaterialAnno(name = "ctOccupied", type = "boolean", desc = "是否通信车占用")
private boolean ctOccupied; private boolean ctOccupied;
/** /**
* 计轴占用-非通信车占用 * 计轴占用-非通信车占用
*/ */
@ExpConditionMaterialAnno(name = "nctOccupied",type = "boolean",desc = "计轴占用-非通信车占用") @ExpConditionMaterialAnno(name = "nctOccupied", type = "boolean", desc = "是否非通信车占用")
private boolean nctOccupied; private boolean nctOccupied;
/** /**
* 占用列车方向 * 占用列车方向
*/ */
@ExpConditionMaterialAnno(name = "trainRight",type = "boolean",desc = "占用列车方向")
private boolean trainRight; private boolean trainRight;
/** /**
* 是否切除 * 是否切除
*/ */
@ExpConditionMaterialAnno(name = "cutOff",type = "boolean",desc = "是否切除") @ExpConditionMaterialAnno(name = "cutOff", type = "boolean", desc = "是否切除")
private boolean cutOff; private boolean cutOff;
/** /**
* 计轴是否被报失效(ARB故障) * 计轴是否被报失效(ARB故障)
*/ */
@ExpConditionMaterialAnno(name = "invalid",type = "boolean",desc = "计轴是否被报失效(ARB故障)") @ExpConditionMaterialAnno(name = "invalid", type = "boolean", desc = "是否ARB")
private boolean invalid; private boolean invalid;
/** /**
* 故障锁闭 * 故障锁闭
*/ */
@ExpConditionMaterialAnno(name = "faultLock",type = "boolean",desc = "故障锁闭") @ExpConditionMaterialAnno(name = "faultLock", type = "boolean", desc = "是否故障锁闭")
private boolean faultLock; private boolean faultLock;
/** /**

View File

@ -22,7 +22,7 @@ import java.util.stream.Collectors;
*/ */
@Getter @Getter
@Setter @Setter
@ExpConditionMaterialSrcAnno(name = "Signal") @ExpConditionMaterialSrcAnno(name = "Signal", deviceType = MapElement.DeviceType.SIGNAL)
public class Signal extends DelayUnlockDevice { public class Signal extends DelayUnlockDevice {
public static int GUIDE_DELAY = 15 * 1000; //大铁首区段占用的引导进路的延时关闭时长 public static int GUIDE_DELAY = 15 * 1000; //大铁首区段占用的引导进路的延时关闭时长
@ -192,7 +192,6 @@ public class Signal extends DelayUnlockDevice {
/** /**
* 重复封锁*后期去掉* * 重复封锁*后期去掉*
*/ */
@ExpConditionMaterialAnno(name = "reblockade", type = "boolean", desc = "重复封锁")
private boolean reblockade; private boolean reblockade;
/** /**
* 侧防锁闭侧防锁闭后不能排列此信号机为始端的任何进路 * 侧防锁闭侧防锁闭后不能排列此信号机为始端的任何进路
@ -212,7 +211,6 @@ public class Signal extends DelayUnlockDevice {
/** /**
* 是否禁止联锁自动开信号 * 是否禁止联锁自动开信号
*/ */
@ExpConditionMaterialAnno(name = "forbidden", type = "boolean", desc = "是否禁止联锁自动开信号")
private boolean forbidden; private boolean forbidden;
/** /**

View File

@ -20,7 +20,7 @@ import java.util.concurrent.ConcurrentHashMap;
*/ */
@Getter @Getter
@Setter @Setter
@ExpConditionMaterialSrcAnno(name = "StationStand") @ExpConditionMaterialSrcAnno(name = "StationStand", deviceType = MapElement.DeviceType.STAND)
public class Stand extends MayOutOfOrderDevice { public class Stand extends MayOutOfOrderDevice {
public Stand(String code, String name) { public Stand(String code, String name) {

View File

@ -24,7 +24,7 @@ import java.util.stream.Collectors;
@Getter @Getter
@Setter @Setter
@ExpConditionMaterialSrcAnno(name = "Station") @ExpConditionMaterialSrcAnno(name = "Station", deviceType = MapElement.DeviceType.STATION)
public class Station extends MayOutOfOrderDevice { public class Station extends MayOutOfOrderDevice {
public Station(String code, String name) { public Station(String code, String name) {
super(code, name, DeviceType.STATION); super(code, name, DeviceType.STATION);

View File

@ -15,7 +15,7 @@ import java.util.stream.Collectors;
*/ */
@Getter @Getter
@Setter @Setter
@ExpConditionMaterialSrcAnno(name = "Switch") @ExpConditionMaterialSrcAnno(name = "Switch", deviceType = MapElement.DeviceType.SWITCH)
public class Switch extends DelayUnlockDevice { public class Switch extends DelayUnlockDevice {
public Switch(String code, String name) { public Switch(String code, String name) {
super(code, name, DeviceType.SWITCH); super(code, name, DeviceType.SWITCH);
@ -104,7 +104,7 @@ public class Switch extends DelayUnlockDevice {
/** /**
* 道岔位置表示 * 道岔位置表示
*/ */
@ExpConditionMaterialAnno(name = "pos", type = "SwitchIndication", desc = "道岔位置表示") @ExpConditionMaterialAnno(name = "pos", type = "SwitchIndication", desc = "道岔位置")
private SwitchIndication pos; private SwitchIndication pos;
/** /**

View File

@ -11,6 +11,8 @@ import club.joylink.rtss.simulation.cbtc.data.plan.TripPlan;
import club.joylink.rtss.simulation.cbtc.data.storage.vo.StorageTrainInfo; import club.joylink.rtss.simulation.cbtc.data.storage.vo.StorageTrainInfo;
import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition; import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain; import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
import club.joylink.rtss.simulation.cbtc.training2.ecm.anno.ExpConditionMaterialAnno;
import club.joylink.rtss.simulation.cbtc.training2.ecm.anno.ExpConditionMaterialSrcAnno;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -30,6 +32,7 @@ import java.util.concurrent.ConcurrentHashMap;
*/ */
@Slf4j @Slf4j
@Getter @Getter
@ExpConditionMaterialSrcAnno(name = "Train", deviceType = MapElement.DeviceType.TRAIN)
public class TrainInfo extends MapElement { public class TrainInfo extends MapElement {
private String groupNumber; private String groupNumber;
@ -80,6 +83,7 @@ public class TrainInfo extends MapElement {
/** /**
* 所处区段 * 所处区段
*/ */
@ExpConditionMaterialAnno(name = "section", type = "SECTION", desc = "所处位置")
private String section; private String section;
/** /**
@ -95,6 +99,7 @@ public class TrainInfo extends MapElement {
@Setter @Setter
private Boolean right; private Boolean right;
@ExpConditionMaterialAnno(name = "speed", type = "float", desc = "车速")
private float speed; private float speed;
private boolean doorOpen; private boolean doorOpen;
@ -102,11 +107,13 @@ public class TrainInfo extends MapElement {
/** /**
* 跟踪模式 * 跟踪模式
*/ */
@ExpConditionMaterialAnno(name = "runLevel", type = "RunLevel", desc = "列车运行级别")
private RunLevel runLevel; private RunLevel runLevel;
/** /**
* 驾驶模式 * 驾驶模式
*/ */
@ExpConditionMaterialAnno(name = "driveMode", type = "DriveMode", desc = "驾驶模式")
private DriveMode driveMode; private DriveMode driveMode;
/** /**
@ -116,6 +123,7 @@ public class TrainInfo extends MapElement {
private boolean jump; private boolean jump;
@ExpConditionMaterialAnno(name = "hold", type = "boolean", desc = "是否扣车")
private boolean hold; private boolean hold;
/** /**

View File

@ -13,8 +13,6 @@ import club.joylink.rtss.simulation.cbtc.data.support.MovementAuthority;
import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition; import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
import club.joylink.rtss.simulation.cbtc.exception.SimulationException; import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType; import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
import club.joylink.rtss.simulation.cbtc.training2.ecm.anno.ExpConditionMaterialAnno;
import club.joylink.rtss.simulation.cbtc.training2.ecm.anno.ExpConditionMaterialSrcAnno;
import club.joylink.rtss.vo.client.operation.DriveParamVO; import club.joylink.rtss.vo.client.operation.DriveParamVO;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@ -29,7 +27,6 @@ import java.util.*;
@Slf4j @Slf4j
@Getter @Getter
@Setter @Setter
@ExpConditionMaterialSrcAnno(name = "Train")
public class VirtualRealityTrain extends VirtualRealityDevice { public class VirtualRealityTrain extends VirtualRealityDevice {
// -----------列车公共属性----------- // -----------列车公共属性-----------
@ -125,13 +122,11 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
/** /**
* 列车运行级别 * 列车运行级别
*/ */
@ExpConditionMaterialAnno(name = "runLevel", type = "RunLevel", desc = "列车运行级别")
private RunLevel runLevel; private RunLevel runLevel;
/** /**
* 驾驶模式 * 驾驶模式
*/ */
@ExpConditionMaterialAnno(name = "driveMode", type = "DriveMode", desc = "驾驶模式")
private DriveMode driveMode; private DriveMode driveMode;
/** /**
@ -265,13 +260,11 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
/** /**
* 是否紧急停车信号 * 是否紧急停车信号
*/ */
@ExpConditionMaterialAnno(name = "signalEB", type = "boolean", desc = "是否紧急停车(信号)")
private boolean signalEB; private boolean signalEB;
/** /**
* 是否紧急停车电路 * 是否紧急停车电路
*/ */
@ExpConditionMaterialAnno(name = "circuitEB", type = "boolean", desc = "是否紧急停车(电路)")
private boolean circuitEB; private boolean circuitEB;
/** /**
@ -282,7 +275,6 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
/** /**
* 下一计划是否停站 * 下一计划是否停站
*/ */
@ExpConditionMaterialAnno(name = "nextParking", type = "boolean", desc = "下一计划是否停站")
private boolean nextParking; private boolean nextParking;
/** /**
@ -293,7 +285,7 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
/** /**
* 是否扣车 * 是否扣车
*/ */
@ExpConditionMaterialAnno(name = "hold", type = "boolean", desc = "是否扣车")
private boolean hold; private boolean hold;
/** /**
@ -304,13 +296,11 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
/** /**
* 是否自动折返中 * 是否自动折返中
*/ */
@ExpConditionMaterialAnno(name = "dtro", type = "boolean", desc = "是否自动折返中")
private boolean dtro; private boolean dtro;
/** /**
* 是否换端中 * 是否换端中
*/ */
@ExpConditionMaterialAnno(name = "changeEnds", type = "boolean", desc = "是否换端中")
private boolean changeEnds; private boolean changeEnds;
/** /**
@ -321,19 +311,16 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
/** /**
* ATO是否开启 * ATO是否开启
*/ */
@ExpConditionMaterialAnno(name = "atoOn", type = "boolean", desc = "ATO是否开启")
private boolean atoOn; private boolean atoOn;
/** /**
* ATP是否可用 * ATP是否可用
*/ */
@ExpConditionMaterialAnno(name = "atpOn", type = "boolean", desc = "ATP是否可用")
private boolean atpOn; private boolean atpOn;
/** /**
* 进路优先排列 * 进路优先排列
*/ */
@ExpConditionMaterialAnno(name = "priorityRouteSet", type = "boolean", desc = "进路优先排列")
private boolean priorityRouteSet; private boolean priorityRouteSet;
/** /**
@ -349,7 +336,6 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
/** /**
* 门模式 * 门模式
*/ */
@ExpConditionMaterialAnno(name = "doorMode", type = "DoorMode", desc = "门模式")
private DoorMode doorMode; private DoorMode doorMode;
/** /**
@ -424,7 +410,6 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
/** /**
* 运行类型 * 运行类型
*/ */
@ExpConditionMaterialAnno(name = "runType", type = "RunType", desc = "运行类型")
private RunType runType; private RunType runType;
/** /**
@ -461,7 +446,6 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
/** /**
* ato可以开启 * ato可以开启
*/ */
@ExpConditionMaterialAnno(name = "atoCanOpen", type = "boolean", desc = "ato可以开启")
private boolean atoCanOpen; private boolean atoCanOpen;
private VirtualRealityAudio vrAudio; private VirtualRealityAudio vrAudio;

View File

@ -11,20 +11,21 @@ import java.lang.annotation.Target;
* 设备区段道岔信号机站台车站进路列车等<br> * 设备区段道岔信号机站台车站进路列车等<br>
* 素材设备的某些字段 * 素材设备的某些字段
*/ */
@Target({ ElementType.FIELD}) @Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
public @interface ExpConditionMaterialAnno { public @interface ExpConditionMaterialAnno {
/** /**
* 素材名称即设备类定义中字段的名称 * 素材名称即设备类定义中字段的名称
*/ */
String name(); String name();
/** /**
* 素材类型即即设备类定义中字段值得类型 * 素材类型即即设备类定义中字段值得类型
*/ */
String type(); String type();
/** /**
* 素材描述即即设备类定义中字段的含义 * 素材描述即即设备类定义中字段的含义
*/ */
String desc(); String desc();
} }

View File

@ -1,5 +1,7 @@
package club.joylink.rtss.simulation.cbtc.training2.ecm.anno; package club.joylink.rtss.simulation.cbtc.training2.ecm.anno;
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
@ -10,13 +12,15 @@ import java.lang.annotation.Target;
* <p> * <p>
* 设备类如果被该注解标记则从被标记的类中收集素材 * 设备类如果被该注解标记则从被标记的类中收集素材
*/ */
@Target({ ElementType.TYPE}) @Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
public @interface ExpConditionMaterialSrcAnno { public @interface ExpConditionMaterialSrcAnno {
/** /**
* 素材来源的名称 * 素材来源的名称
* <p> * <p>
* 值为"null"时默认取素材源类名 * 值为"null"时默认取素材源类名
*/ */
String name() default "null"; String name() default "null";
MapElement.DeviceType deviceType();
} }

View File

@ -12,6 +12,7 @@ import org.springframework.context.annotation.ClassPathScanningCandidateComponen
import org.springframework.core.type.filter.AnnotationTypeFilter; import org.springframework.core.type.filter.AnnotationTypeFilter;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
@ -20,12 +21,14 @@ import java.util.Set;
@Component @Component
public class ExpConditionMaterialCollector extends ClassPathScanningCandidateComponentProvider implements ApplicationContextAware { public class ExpConditionMaterialCollector extends ClassPathScanningCandidateComponentProvider implements ApplicationContextAware {
private ApplicationContext ioc; private ApplicationContext ioc;
@Override @Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.ioc=applicationContext; this.ioc = applicationContext;
this.setEnvironment(this.ioc.getEnvironment()); this.setEnvironment(this.ioc.getEnvironment());
} }
private Set<BeanDefinition> doScan(String... basePackages) { private Set<BeanDefinition> doScan(String... basePackages) {
Assert.notEmpty(basePackages, "At least one base package must be specified"); Assert.notEmpty(basePackages, "At least one base package must be specified");
// //
@ -38,30 +41,34 @@ public class ExpConditionMaterialCollector extends ClassPathScanningCandidateCom
} }
return beanDefinitions; return beanDefinitions;
} }
public List<ExpConditionMaterialSrcVo> doCollect(){
Set<BeanDefinition> bds = this.doScan("club.joylink.rtss.simulation.cbtc.data.map","club.joylink.rtss.simulation.cbtc.data.vr"); public List<ExpConditionMaterialSrcVo> doCollect() {
List<ExpConditionMaterialSrcVo> list =new ArrayList<>(bds.size()); Set<BeanDefinition> bds = this.doScan("club.joylink.rtss.simulation.cbtc.data.map",
bds.forEach(n->{ "club.joylink.rtss.simulation.cbtc.data.vr", "club.joylink.rtss.simulation.cbtc.data.vo");
List<ExpConditionMaterialSrcVo> list = new ArrayList<>(bds.size());
bds.forEach(n -> {
list.add(this.create(n.getBeanClassName())); list.add(this.create(n.getBeanClassName()));
}); });
return list; return list;
} }
private ExpConditionMaterialSrcVo create(String clsName){
private ExpConditionMaterialSrcVo create(String clsName) {
Class<?> cls = this.getSrcCls(clsName); Class<?> cls = this.getSrcCls(clsName);
// //
ExpConditionMaterialSrcAnno srcAnno= cls.getAnnotation(ExpConditionMaterialSrcAnno.class); ExpConditionMaterialSrcAnno srcAnno = cls.getAnnotation(ExpConditionMaterialSrcAnno.class);
String srcName=cls.getSimpleName(); String srcName = cls.getSimpleName();
if(!"null".equals(srcAnno.name())){ if (!"null".equals(srcAnno.name())) {
srcName=srcAnno.name(); srcName = srcAnno.name();
} }
// //
ExpConditionMaterialSrcVo src = new ExpConditionMaterialSrcVo(); ExpConditionMaterialSrcVo src = new ExpConditionMaterialSrcVo();
src.setSrcName(srcName); src.setSrcName(srcName);
src.setDeviceType(srcAnno.deviceType());
src.setMaterials(new ArrayList<>()); src.setMaterials(new ArrayList<>());
// //
Field[] fds= cls.getDeclaredFields(); Field[] fds = cls.getDeclaredFields();
for(Field fd : fds){ for (Field fd : fds) {
if(fd.isAnnotationPresent(ExpConditionMaterialAnno.class)){ if (fd.isAnnotationPresent(ExpConditionMaterialAnno.class)) {
ExpConditionMaterialAnno ma = fd.getAnnotation(ExpConditionMaterialAnno.class); ExpConditionMaterialAnno ma = fd.getAnnotation(ExpConditionMaterialAnno.class);
ExpConditionMaterialVo m = new ExpConditionMaterialVo(); ExpConditionMaterialVo m = new ExpConditionMaterialVo();
m.setName(ma.name()); m.setName(ma.name());
@ -74,7 +81,8 @@ public class ExpConditionMaterialCollector extends ClassPathScanningCandidateCom
// //
return src; return src;
} }
private Class<?> getSrcCls(String clsName){
private Class<?> getSrcCls(String clsName) {
Class<?> cls = null; Class<?> cls = null;
try { try {
cls = Class.forName(clsName); cls = Class.forName(clsName);

View File

@ -1,5 +1,6 @@
package club.joylink.rtss.simulation.cbtc.training2.ecm.vo; package club.joylink.rtss.simulation.cbtc.training2.ecm.vo;
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;
@ -10,6 +11,12 @@ public class ExpConditionMaterialSrcVo {
* 设备类名称条件素材来源的名称 * 设备类名称条件素材来源的名称
*/ */
private String srcName; private String srcName;
/**
* 设备类型
*/
private MapElement.DeviceType deviceType;
/** /**
* 条件素材列表 * 条件素材列表
*/ */

View File

@ -7,13 +7,13 @@ public class ExpConditionMaterialVo {
/** /**
* 素材名称即设备类定义中字段的名称 * 素材名称即设备类定义中字段的名称
*/ */
private String name; private String name;
/** /**
* 素材类型即即设备类定义中字段值得类型 * 素材类型即即设备类定义中字段值得类型
*/ */
private String type; private String type;
/** /**
* 素材描述即即设备类定义中字段的含义 * 素材描述即即设备类定义中字段的含义
*/ */
private String desc; private String desc;
} }