模拟设备状态变更接口调整
This commit is contained in:
parent
ab9643c61f
commit
d042470c8f
@ -3,7 +3,10 @@ package club.joylink.xiannccda.ats.message.collect;
|
||||
import club.joylink.xiannccda.ats.message.collect.datasource.AbstractData;
|
||||
import club.joylink.xiannccda.ats.message.collect.datasource.DeviceStatusData;
|
||||
import club.joylink.xiannccda.ats.message.collect.datasource.TrainDataSource;
|
||||
import com.google.common.collect.HashBasedTable;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Table;
|
||||
import com.google.common.collect.Tables;
|
||||
import com.google.protobuf.GeneratedMessageV3.Builder;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -17,19 +20,20 @@ import lombok.Getter;
|
||||
public class DeviceDataRepository {
|
||||
|
||||
/**
|
||||
* key = lineId
|
||||
* key1 = lineId
|
||||
* <p>
|
||||
* key2 = 类型
|
||||
* <p>
|
||||
* val = 对应的数据源
|
||||
*/
|
||||
static Map<String, AbstractData> device_data = Maps.newConcurrentMap();
|
||||
|
||||
static Table<String, String, AbstractData> DEVICE_TABLE_DATA = Tables.synchronizedTable(HashBasedTable.create());
|
||||
|
||||
private static synchronized AbstractData find(String lineId, DataTypeEnum dataTypeEnum) {
|
||||
AbstractData ad = device_data.get(lineId);
|
||||
AbstractData ad = DEVICE_TABLE_DATA.get(lineId, dataTypeEnum.name());
|
||||
if (Objects.isNull(ad)) {
|
||||
try {
|
||||
ad = dataTypeEnum.clazz.getDeclaredConstructor(String.class).newInstance(lineId);
|
||||
device_data.put(lineId, ad);
|
||||
DEVICE_TABLE_DATA.put(lineId, dataTypeEnum.name(), ad);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -68,8 +68,8 @@ public class Status {
|
||||
// Boolean ctrlAutoMode;
|
||||
Boolean extinguish;
|
||||
Boolean approachLock;
|
||||
Boolean protectRoute;
|
||||
// Boolean autoRouteDisable;
|
||||
// Boolean protectRoute;
|
||||
Boolean autoRouteDisable;
|
||||
Boolean callon;
|
||||
Boolean yellowYellow;
|
||||
Boolean yellowGreen;
|
||||
|
@ -52,7 +52,7 @@ public class LineDeviceStatusService {
|
||||
|
||||
@PostConstruct
|
||||
public void deviceStatusRefresh() {
|
||||
this.createDataConvertor();
|
||||
// this.createDataConvertor();
|
||||
// 设备状态数据集合
|
||||
DeviceStatusData deviceStatusData = DeviceStatusDataRepository.getDeviceStatusData(DATA_KEY);
|
||||
// 添加初始化转换方法
|
||||
|
@ -22,7 +22,7 @@ public class StompTest {
|
||||
@Test
|
||||
public void subscribe() {
|
||||
|
||||
String token = "eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJzZWxmIiwic3ViIjoiOSIsImV4cCI6MTY4ODY5OTQ0OSwiaWF0IjoxNjg4NDQwMjQ5fQ.gYCTq_oPw_31MqnH3VZ71RVm659Lim8z86-VnEV9D4XIvr8GNblkN1cMNC2TH5HkqzKMUDJC_Nn-bH6n1LcJQTwJv1V4kY8cm1rCN8aedxRgq5NGIrDl5K2zLy9qvs-iOHQF8PdK2KC8zWy1RV9t34cuSsUsiCc14-KmvCRXE801YSpzLsOgF0Ulz4fl-CDX5LO2fGyFF6Lv298BOvbocfJ3KghpvocuT2tx5nl2C4tHfLV5XRxD9cQlsoRi_VOQp8Y49mRdhIe-vOv_rkOaRNuINdyAfYTyntKv0IkKj3Rh6y0wERV-ymkfsfgm-0gkeQ9qtwVIBjEK5Btq0LhlSQ";
|
||||
String token = "eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJzZWxmIiwic3ViIjoiOSIsImV4cCI6MTY4ODgwMDI5NCwiaWF0IjoxNjg4NTQxMDk0fQ.CKSypkJIsalBryUouDybKwxQAFfqPcWmDvdO8hfqItNMHHtn9EWyDUD3Tjzn-2Ljq_KCmq-EO4X75_JYtK8bFN5vGf2uhDn8XKRii0CgTvQHbNC8FeiuZ84AE0mQ5Sts4uQn9irVxfFV6mw4qzKgUEQGHcqMsssVUGEUNZNrHoiThIc-g9o09h-bVgAL5QyeC3X9E5V6WtOU774UlTXhDZlsHkc6AWxOAXwaw4MrN3uatAfOkvfDTzOgnAwsdqBX9ycW5TPgsY8OBl5a2gi6IVxwp-4fLDQ8paVLvqybEEhVsr2agVECwf1xFBNpFKwkehPZqQyAmzdOl4Y8hY_FOQ";
|
||||
|
||||
StandardWebSocketClient socketClient = new StandardWebSocketClient();
|
||||
WebSocketStompClient stompClient = new WebSocketStompClient(socketClient);
|
||||
@ -41,7 +41,7 @@ public class StompTest {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
stompSession.subscribe("/queue/line/3/device", new StompFrameHandler() {
|
||||
stompSession.subscribe("/queue/line/3/train", new StompFrameHandler() {
|
||||
@Override
|
||||
public Type getPayloadType(StompHeaders stompHeaders) {
|
||||
return byte[].class;
|
||||
|
Loading…
Reference in New Issue
Block a user