diff --git a/src/main/java/club/joylink/xiannccda/service/LineDeviceStatusService.java b/src/main/java/club/joylink/xiannccda/service/LineDeviceStatusService.java index 231fe2f..6620aa1 100644 --- a/src/main/java/club/joylink/xiannccda/service/LineDeviceStatusService.java +++ b/src/main/java/club/joylink/xiannccda/service/LineDeviceStatusService.java @@ -1,9 +1,6 @@ package club.joylink.xiannccda.service; -import club.joylink.xiannccda.ats.message.MessageData; -import club.joylink.xiannccda.ats.message.MessageId; import club.joylink.xiannccda.ats.message.collect.DeviceStatusConvertorManager; - import club.joylink.xiannccda.ats.message.collect.convertor.DeviceChangeStatusConvertor; import club.joylink.xiannccda.ats.message.collect.convertor.DeviceInitConvertor; import club.joylink.xiannccda.ats.message.collect.convertor.LineNetTrainInitConvertor; @@ -20,11 +17,6 @@ import club.joylink.xiannccda.ws.LineNetMessageServer; import club.joylink.xiannccda.ws.LineTrainMessageServer; import club.joylink.xiannccda.ws.WsMessageServerManager; import jakarta.annotation.PostConstruct; - -import java.util.List; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicLong; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; @@ -55,9 +47,6 @@ public class LineDeviceStatusService { wsMessageServerManager.registerMessageServer(new LineNetMessageServer()); wsMessageServerManager.registerMessageServer(new LineTrainMessageServer()); wsMessageServerManager.registerMessageServer(new LineDeviceMessageServer()); - - // 加载数据 - refreshTestData(); } private void createDataConvertor() { @@ -69,34 +58,4 @@ public class LineDeviceStatusService { DeviceStatusConvertorManager.addStatusConvertor(new TrainRecordConvertor()); DeviceStatusConvertorManager.addStatusConvertor(new TrainUpdateConvertor()); } - - public void refreshTestData() { - List allMockData = nccMockDataService.loadAllTrainInitData(); - DeviceStatusConvertorManager.doConvertor(allMockData); - int frequency = 1500, stopTime = 30000; - AtomicLong id = new AtomicLong(0); - AtomicLong resetTimes = new AtomicLong(stopTime); - Executors.newSingleThreadScheduledExecutor() - .scheduleWithFixedDelay( - () -> { - boolean isEmpty = true; - if (resetTimes.get() == stopTime) { // 代表还没有停顿,不相等说明已经进入空循环 - List updateMockData = - nccMockDataService.loadUpdateData(id, MessageId.TRAIN_RECORD.name(), 2); - DeviceStatusConvertorManager.doConvertor(updateMockData); - isEmpty = updateMockData.size() == 0; - } - if (isEmpty) { // 假数据已经用完了,开始重复使用,中间停顿30000ms - if (resetTimes.get() <= 0) { - id.set(0); - resetTimes.set(stopTime); - } else { - resetTimes.set(resetTimes.get() - frequency); - } - } - }, - frequency, - frequency, - TimeUnit.MILLISECONDS); - } }