|
|
@@ -13,9 +13,9 @@ import top.haijunit.train.simulation.TrainSimulationHolder;
|
|
|
import top.haijunit.train.socket.CommandEnum;
|
|
|
import top.haijunit.train.socket.TrainWebSocketUtils;
|
|
|
|
|
|
-import java.util.HashMap;
|
|
|
import java.util.LinkedList;
|
|
|
import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @author zhanghaijun
|
|
|
@@ -40,11 +40,18 @@ public class ReportTimeHandle {
|
|
|
}
|
|
|
|
|
|
/** 定时发送进路占用数据 */
|
|
|
- // @Async
|
|
|
- // @Scheduled(fixedRate = 50)
|
|
|
+ @Async
|
|
|
+ @Scheduled(fixedRate = 5000)
|
|
|
public void sendRouterStatus() {
|
|
|
Map<Long, LinkedList<RouteEntity>> routeMap = TrainSimulationHolder.getRouteMap();
|
|
|
- TrainWebSocketUtils.sendMessage(CommandEnum.ROUTE_STATUS, new HashMap<>(routeMap));
|
|
|
+ // TrainWebSocketUtils.sendMessage(CommandEnum.ROUTE_STATUS, new HashMap<>(routeMap));
|
|
|
+ log.info("------------");
|
|
|
+ for (Map.Entry<Long, LinkedList<RouteEntity>> entry : routeMap.entrySet()) {
|
|
|
+ log.info("进路资源, 列车:{},进路:{}", entry.getKey(), entry.getValue().stream().map(item -> {
|
|
|
+ return item.getId() + "--" + item.getRouteStatus().getDescribe();
|
|
|
+ }).collect(Collectors.joining(",")));
|
|
|
+ }
|
|
|
+ log.info("------------");
|
|
|
}
|
|
|
|
|
|
@Async
|
|
|
@@ -54,7 +61,7 @@ public class ReportTimeHandle {
|
|
|
|
|
|
/** 定时计算进路 */
|
|
|
@Async
|
|
|
- @Scheduled(fixedRate = 10000)
|
|
|
+ @Scheduled(fixedRate = 1000)
|
|
|
public void runRouteCompute() {
|
|
|
for (TrainItem trainItem : TrainSimulationHolder.getTrainItem()) {
|
|
|
routeComputerService.run(trainItem);
|