@ -1,6 +1,12 @@
package club.joylink.rtss.services.mapFunction ;
import club.joylink.rtss.constants.MapPrdTypeEnum ;
import club.joylink.rtss.dao.MapDataDAO ;
import club.joylink.rtss.dao.MapInfoDAO ;
import club.joylink.rtss.dao.MapSystemDAO ;
import club.joylink.rtss.dao.RtsMapFunctionDAO ;
import club.joylink.rtss.entity.MapSystem ;
import club.joylink.rtss.entity.MapSystemExample ;
import club.joylink.rtss.entity.RtsMapFunction ;
import club.joylink.rtss.entity.RtsMapFunctionExample ;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum ;
@ -16,10 +22,12 @@ import club.joylink.rtss.vo.map.MapVO;
import club.joylink.rtss.vo.map.graph.MapMemberVO ;
import com.github.pagehelper.Page ;
import com.github.pagehelper.PageHelper ;
import org.jetbrains.annotations.Nullable ;
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.stereotype.Service ;
import org.springframework.transaction.annotation.Propagation ;
import org.springframework.transaction.annotation.Transactional ;
import org.springframework.util.CollectionUtils ;
import org.springframework.util.StringUtils ;
import java.time.LocalDateTime ;
@ -88,7 +96,7 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
return PageVO . convert ( page , list ) ;
}
@Transactional ( rollbackFor = Exception . class , propagation = Propagation . REQUIRES_NEW )
@Transactional ( rollbackFor = Exception . class , propagation = Propagation . REQUIRES_NEW )
@Override
public List < String > generate ( long mapId , RtsMapFunctionGenerateParamVO paramVO , long creatorId ) {
BusinessExceptionAssertEnum . ARGUMENT_ILLEGAL . assertCollectionNotEmpty ( paramVO . getSimTypes ( ) ,
@ -135,7 +143,7 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
return msgList ;
}
@Transactional ( rollbackFor = Exception . class , propagation = Propagation . REQUIRES_NEW )
@Transactional ( rollbackFor = Exception . class , propagation = Propagation . REQUIRES_NEW )
@Override
public List < String > generateLpf ( long mapId , long creatorId ) {
List < MapPassengerFlowVO > pfDataList = mapPassengerFlowDataService . queryAllPassengerFlowBaseDataOfMap ( mapId ) ;
@ -176,6 +184,118 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
rtsMapFunctionDAO . deleteByExample ( rtsMapFunctionExample ) ;
}
@Autowired
private MapInfoDAO mapInfoDAO ;
@Autowired
private MapSystemDAO mapSystemDAO ;
@Autowired
private MapDataDAO mapDataDAO ;
@Transactional
@Override
public List < String > transferOldData ( Long mapId ) {
List < String > msgList = new ArrayList < > ( ) ;
MapVO mapDetail = iMapService . getMapDetail ( mapId ) ;
Set < String > systemNameSet = new HashSet < > ( ) ;
Simulation . Type simType ;
if ( mapDetail . getConfigVO ( ) . isRailway ( ) ) {
simType = Simulation . Type . RAILWAY ;
} else {
simType = Simulation . Type . METRO ;
}
MapSystemExample mapSystemExample = new MapSystemExample ( ) ;
mapSystemExample . createCriteria ( ) . andMapIdEqualTo ( mapDetail . getId ( ) ) ;
List < MapSystem > mapSystems = mapSystemDAO . selectByExample ( mapSystemExample ) ;
Map < Simulation . Type , List < MapMemberVO > > memberMap = mapDetail . getGraphDataNew ( ) . getMemberMap ( ) ;
String prefixMsg = String . format ( " 地图[id:%s] " , mapDetail . getId ( ) ) ;
if ( CollectionUtils . isEmpty ( memberMap ) ) {
msgList . add ( String . format ( " %s无成员数据 " , prefixMsg ) ) ;
return msgList ;
}
List < MapMemberVO > mapMemberVOS = memberMap . get ( simType ) ;
if ( CollectionUtils . isEmpty ( mapMemberVOS ) ) {
msgList . add ( String . format ( " %s无%s成员数据 " , prefixMsg , simType ) ) ;
return msgList ;
}
Optional < MapMemberVO > dispatcherOptional = mapMemberVOS . stream ( )
. filter ( member - > Objects . equals ( member . getType ( ) , SimulationMember . Type . DISPATCHER ) )
. findFirst ( ) ;
Optional < MapMemberVO > stationOptional = mapMemberVOS . stream ( )
. filter ( member - > Objects . equals ( member . getType ( ) , SimulationMember . Type . STATION_SUPERVISOR ) )
. findFirst ( ) ;
boolean hasTraining = false ;
boolean hasExam = false ;
for ( MapSystem mapSystem : mapSystems ) {
Supplier < RtsMapFunctionCreateVO > supplier ;
if ( mapSystem . getType ( ) . equals ( " Simulation " ) ) {
MapPrdTypeEnum prdType = MapPrdTypeEnum . getMapPrdTypeEnumByCode ( mapSystem . getPrdType ( ) ) ;
switch ( prdType ) {
case LOCAL :
supplier = getStationFunctionSupplier ( mapSystem . getMapId ( ) , systemNameSet , msgList , prefixMsg , simType , stationOptional ) ;
break ;
case CENTER :
supplier = getDispatcherFunctionSupplier ( mapId , systemNameSet , msgList , prefixMsg , simType , dispatcherOptional ) ;
break ;
case JOINT :
supplier = getJointFunctionSupplier ( mapId , systemNameSet , msgList , prefixMsg , simType , dispatcherOptional ) ;
break ;
case DRIVER :
supplier = getDriverFunctionSupplier ( mapId , systemNameSet , msgList , prefixMsg , simType , mapMemberVOS ) ;
break ;
case SCHEDULING :
supplier = getSchedulingFunctionSupplier ( mapId , systemNameSet , msgList , prefixMsg , simType , dispatcherOptional ) ;
break ;
case ISCS :
supplier = ( ) - > null ;
break ;
case BIG_SCREEN :
supplier = ( ) - > null ;
break ;
case RUN_PLAN_MAKE :
supplier = getRunPlanDesignFunctionSupplier ( mapId , systemNameSet , msgList , simType ) ;
break ;
case DEPOT_IL :
supplier = getDepotILFunctionSupplier ( mapId , systemNameSet , msgList , prefixMsg , simType , mapMemberVOS ) ;
break ;
case YJDDZH :
supplier = getEmergencyFunctionSupplier ( mapId , systemNameSet , msgList , Simulation . Type . EMERGENCY ) ;
break ;
default :
throw new RuntimeException ( ) ;
}
RtsMapFunctionCreateVO rtsMapFunctionCreateVO = supplier . get ( ) ;
if ( rtsMapFunctionCreateVO ! = null ) {
create ( rtsMapFunctionCreateVO , 1 ) ;
}
} else if ( mapSystem . getType ( ) . equals ( " Lesson " ) ) {
if ( ! hasTraining ) {
hasTraining = true ;
RtsMapFunctionCreateVO rtsMapFunctionCreateVO = getSingleOperationTrainingFunctionSupplier ( mapId , systemNameSet , msgList , simType ) . get ( ) ;
if ( rtsMapFunctionCreateVO ! = null ) {
create ( rtsMapFunctionCreateVO , 1 ) ;
}
}
} else if ( mapSystem . getType ( ) . equals ( " Exam " ) ) {
if ( ! hasExam ) {
hasExam = true ;
RtsMapFunctionCreateVO rtsMapFunctionCreateVO = getExamFunctionSupplier ( mapId , systemNameSet , msgList , simType ) . get ( ) ;
if ( rtsMapFunctionCreateVO ! = null ) {
create ( rtsMapFunctionCreateVO , 1 ) ;
}
}
} else {
throw new RuntimeException ( ) ;
}
}
return msgList ;
}
private RtsMapFunctionCreateVO buildCreateVO ( long mapId , String name , String desc , Simulation . Type simType ,
Map < SimulationWorkParamVO . Item , String > itemMap , SimulationWorkParamVO . DomConfigVO domConfig ) {
RtsMapFunctionCreateVO createVO = new RtsMapFunctionCreateVO ( ) ;
@ -209,47 +329,120 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
Optional < MapMemberVO > stationSupervisorOptional = mapMemberVOS . stream ( )
. filter ( member - > Objects . equals ( member . getType ( ) , SimulationMember . Type . STATION_SUPERVISOR ) )
. findFirst ( ) ;
/ / ATS行调工作站
Supplier < RtsMapFunctionCreateVO > dispatchSystem = ( ) - > {
String name = " 行调仿真系统 " ;
Supplier < RtsMapFunctionCreateVO > dispatchSystem = getDispatcherFunctionSupplier ( mapId , systemNameSet , msgList , msgPrefix , simType , dispatcherOptional ) ;
Supplier < RtsMapFunctionCreateVO > stationSystem = getStationFunctionSupplier ( mapId , systemNameSet , msgList , msgPrefix , simType , stationSupervisorOptional ) ;
Supplier < RtsMapFunctionCreateVO > driveSystem = getDriverFunctionSupplier ( mapId , systemNameSet , msgList , msgPrefix , simType , mapMemberVOS ) ;
Supplier < RtsMapFunctionCreateVO > dispatchTrainingSystem = getSingleOperationTrainingFunctionSupplier ( mapId , systemNameSet , msgList , simType ) ;
Supplier < RtsMapFunctionCreateVO > stationTrainingSystem = getSceneTrainingFunctionSupplier ( mapId , systemNameSet , msgList , simType ) ;
Supplier < RtsMapFunctionCreateVO > stationExamSystem = getExamFunctionSupplier ( mapId , systemNameSet , msgList , simType ) ;
Supplier < RtsMapFunctionCreateVO > joint = getJointFunctionSupplier ( mapId , systemNameSet , msgList , msgPrefix , simType , dispatcherOptional ) ;
Supplier < RtsMapFunctionCreateVO > trainingDesign = getTrainingDesignFunctionSupplier ( mapId , systemNameSet , msgList , msgPrefix , simType , dispatcherOptional ) ;
fillFunctions . add ( dispatchSystem ) ;
fillFunctions . add ( stationSystem ) ;
fillFunctions . add ( driveSystem ) ;
fillFunctions . add ( dispatchTrainingSystem ) ;
fillFunctions . add ( stationTrainingSystem ) ;
fillFunctions . add ( stationExamSystem ) ;
fillFunctions . add ( joint ) ;
fillFunctions . add ( trainingDesign ) ;
return fillFunctions ;
}
private Supplier < RtsMapFunctionCreateVO > getTrainingDesignFunctionSupplier ( long mapId , Set < String > systemNameSet , List < String > msgList , String msgPrefix , Simulation . Type simType , Optional < MapMemberVO > dispatcherOptional ) {
/ / 实训设计
return ( ) - > {
String name = " 实训设计 " ;
if ( systemNameSet . contains ( name ) ) {
msgList . add ( String . format ( " %s已存在, 不生成 " , name ) ) ;
return null ;
}
Map < SimulationWorkParamVO . Item , String > itemMap = null ;
if ( dispatcherOptional . isEmpty ( ) ) {
msgList . add ( String . format ( " %s无行调成员, 未生成%s " , msgPrefix , name ) ) ;
return null ;
msgList . add ( String . format ( " %s无行调成员, 未设置%s默认扮演成员 " , msgPrefix , name ) ) ;
} else {
itemMap = new HashMap < > ( ) ;
itemMap . put ( SimulationWorkParamVO . Item . DEFAULT_MEMBER , dispatcherOptional . get ( ) . getId ( ) ) ;
}
SimulationWorkParamVO . DomConfigVO domConfig = SimulationWorkParamVO . DomConfigVO . builder ( )
. singleMember ( true )
. trainingDesign ( true )
. hasMemberManager ( true )
. build ( ) ;
Map < SimulationWorkParamVO . Item , String > itemMap = new HashMap < > ( ) ;
itemMap . put ( SimulationWorkParamVO . Item . DEFAULT_MEMBER , dispatcherOptional . get ( ) . getId ( ) ) ;
return buildCreateVO ( mapId , name , name , simType , itemMap , domConfig ) ;
} ;
/ / ATS现地工作站
Supplier < RtsMapFunctionCreateVO > stationSystem = ( ) - > {
String name = " 行值仿真系统 " ;
}
private Supplier < RtsMapFunctionCreateVO > getJointFunctionSupplier ( long mapId , Set < String > systemNameSet , List < String > msgList , String msgPrefix , Simulation . Type simType , Optional < MapMemberVO > dispatcherOptional ) {
/ / 综合演练
return ( ) - > {
String name = " 综合演练 " ;
if ( systemNameSet . contains ( name ) ) {
msgList . add ( String . format ( " %s已存在, 不生成 " , name ) ) ;
return null ;
}
if ( stationSupervisorOptional . isEmpty ( ) ) {
msgList . add ( String . format ( " %s无行值成员, 未生成%s " , msgPrefix , name ) ) ;
Map < SimulationWorkParamVO . Item , String > itemMap = null ;
if ( dispatcherOptional . isEmpty ( ) ) {
msgList . add ( String . format ( " %s无行调成员, 未设置%s默认扮演成员 " , msgPrefix , name ) ) ;
} else {
itemMap = new HashMap < > ( ) ;
itemMap . put ( SimulationWorkParamVO . Item . DEFAULT_MEMBER , dispatcherOptional . get ( ) . getId ( ) ) ;
}
SimulationWorkParamVO . DomConfigVO domConfig = SimulationWorkParamVO . DomConfigVO . builder ( )
. isJoint ( true )
. hasMemberManager ( true )
. build ( ) ;
return buildCreateVO ( mapId , name , name , simType , itemMap , domConfig ) ;
} ;
}
private Supplier < RtsMapFunctionCreateVO > getExamFunctionSupplier ( long mapId , Set < String > systemNameSet , List < String > msgList , Simulation . Type simType ) {
return ( ) - > {
String name = " 考试 " ;
if ( systemNameSet . contains ( name ) ) {
msgList . add ( String . format ( " %s已存在, 不生成 " , name ) ) ;
return null ;
}
SimulationWorkParamVO . DomConfigVO domConfig = SimulationWorkParamVO . DomConfigVO . builder ( )
. singleMember ( true )
. hasExam ( true )
. build ( ) ;
return buildCreateVO ( mapId , name , name , simType , null , domConfig ) ;
} ;
}
private Supplier < RtsMapFunctionCreateVO > getSceneTrainingFunctionSupplier ( long mapId , Set < String > systemNameSet , List < String > msgList , Simulation . Type simType ) {
return ( ) - > {
String name = " 场景实训 " ;
if ( systemNameSet . contains ( name ) ) {
msgList . add ( String . format ( " %s已存在, 不生成 " , name ) ) ;
return null ;
}
SimulationWorkParamVO . DomConfigVO domConfig = SimulationWorkParamVO . DomConfigVO . builder ( )
. hasTraining ( true )
. hasMemberManager ( true )
. build ( ) ;
Map < SimulationWorkParamVO . Item , String > itemMap = new HashMap < > ( ) ;
itemMap . put ( SimulationWorkParamVO . Item . DEFAULT_MEMBER , stationSupervisorOptional . get ( ) . getId ( ) ) ;
return buildCreateVO ( mapId , name , name , simType , itemMap , domConfig ) ;
return buildCreateVO ( mapId , name , name , simType , null , domConfig ) ;
} ;
/ / 司机模拟驾驶系统
Supplier < RtsMapFunctionCreateVO > driveSystem = ( ) - > {
String name = " 司机仿真 " ;
}
private Supplier < RtsMapFunctionCreateVO > getSingleOperationTrainingFunctionSupplier ( long mapId , Set < String > systemNameSet , List < String > msgList , Simulation . Type simType ) {
return ( ) - > {
String name = " 单操实训 " ;
if ( systemNameSet . contains ( name ) ) {
msgList . add ( String . format ( " %s已存在, 不生成 " , name ) ) ;
return null ;
}
SimulationWorkParamVO . DomConfigVO domConfig = SimulationWorkParamVO . DomConfigVO . builder ( )
. hasTraining ( true )
. build ( ) ;
return buildCreateVO ( mapId , name , name , simType , null , domConfig ) ;
} ;
}
private Supplier < RtsMapFunctionCreateVO > getDriverFunctionSupplier ( long mapId , Set < String > systemNameSet , List < String > msgList , String msgPrefix ,
Simulation . Type simType , List < MapMemberVO > mapMemberVOS ) {
return ( ) - > {
String name = " 模拟驾驶 " ;
if ( systemNameSet . contains ( name ) ) {
msgList . add ( String . format ( " %s已存在, 不生成 " , name ) ) ;
return null ;
@ -269,29 +462,13 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
itemMap . put ( SimulationWorkParamVO . Item . DEFAULT_MEMBER , memberOptional . get ( ) . getId ( ) ) ;
return buildCreateVO ( mapId , name , name , simType , itemMap , domConfig ) ;
} ;
/ / ATS行调实训系统
Supplier < RtsMapFunctionCreateVO > dispatchTrainingSystem = ( ) - > {
String name = " 行调实训系统 " ;
if ( systemNameSet . contains ( name ) ) {
msgList . add ( String . format ( " %s已存在, 不生成 " , name ) ) ;
return null ;
}
if ( dispatcherOptional . isEmpty ( ) ) {
msgList . add ( String . format ( " %s无行调成员, 未生成%s " , msgPrefix , name ) ) ;
return null ;
}
SimulationWorkParamVO . DomConfigVO domConfig = SimulationWorkParamVO . DomConfigVO . builder ( )
. singleMember ( true )
. hasTraining ( true )
. hasMemberManager ( true )
. build ( ) ;
Map < SimulationWorkParamVO . Item , String > itemMap = new HashMap < > ( ) ;
itemMap . put ( SimulationWorkParamVO . Item . DEFAULT_MEMBER , dispatcherOptional . get ( ) . getId ( ) ) ;
return buildCreateVO ( mapId , name , name , simType , itemMap , domConfig ) ;
} ;
/ / ATS现地实训系统
Supplier < RtsMapFunctionCreateVO > stationTrainingSystem = ( ) - > {
String name = " 行值实训系统 " ;
}
private Supplier < RtsMapFunctionCreateVO > getStationFunctionSupplier ( long mapId , Set < String > systemNameSet , List < String > msgList , String msgPrefix ,
Simulation . Type simType , Optional < MapMemberVO > stationSupervisorOptional ) {
/ / ATS现地工作站
return ( ) - > {
String name = " 车站仿真 " ;
if ( systemNameSet . contains ( name ) ) {
msgList . add ( String . format ( " %s已存在, 不生成 " , name ) ) ;
return null ;
@ -302,16 +479,19 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
}
SimulationWorkParamVO . DomConfigVO domConfig = SimulationWorkParamVO . DomConfigVO . builder ( )
. singleMember ( true )
. hasTraining ( true )
. hasMemberManager ( true )
. build ( ) ;
Map < SimulationWorkParamVO . Item , String > itemMap = new HashMap < > ( ) ;
itemMap . put ( SimulationWorkParamVO . Item . DEFAULT_MEMBER , stationSupervisorOptional . get ( ) . getId ( ) ) ;
return buildCreateVO ( mapId , name , name , simType , itemMap , domConfig ) ;
} ;
/ / ATS行调考试系统
Supplier < RtsMapFunctionCreateVO > dispatchExamSystem = ( ) - > {
String name = " 行调考试系统 " ;
}
private Supplier < RtsMapFunctionCreateVO > getDispatcherFunctionSupplier ( long mapId , Set < String > systemNameSet , List < String > msgList , String msgPrefix ,
Simulation . Type simType , Optional < MapMemberVO > dispatcherOptional ) {
/ / ATS行调工作站
return ( ) - > {
String name = " 调度仿真 " ;
if ( systemNameSet . contains ( name ) ) {
msgList . add ( String . format ( " %s已存在, 不生成 " , name ) ) ;
return null ;
@ -321,82 +501,13 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
return null ;
}
SimulationWorkParamVO . DomConfigVO domConfig = SimulationWorkParamVO . DomConfigVO . builder ( )
. hasExam ( true )
. singleMember ( true )
. hasMemberManager ( true )
. build ( ) ;
Map < SimulationWorkParamVO . Item , String > itemMap = new HashMap < > ( ) ;
itemMap . put ( SimulationWorkParamVO . Item . DEFAULT_MEMBER , dispatcherOptional . get ( ) . getId ( ) ) ;
return buildCreateVO ( mapId , name , name , simType , itemMap , domConfig ) ;
} ;
/ / ATS现地考试系统
Supplier < RtsMapFunctionCreateVO > stationExamSystem = ( ) - > {
String name = " 行值考试系统 " ;
if ( systemNameSet . contains ( name ) ) {
msgList . add ( String . format ( " %s已存在, 不生成 " , name ) ) ;
return null ;
}
if ( stationSupervisorOptional . isEmpty ( ) ) {
msgList . add ( String . format ( " %s无行值成员, 未生成%s " , msgPrefix , name ) ) ;
return null ;
}
SimulationWorkParamVO . DomConfigVO domConfig = SimulationWorkParamVO . DomConfigVO . builder ( )
. hasExam ( true )
. build ( ) ;
Map < SimulationWorkParamVO . Item , String > itemMap = new HashMap < > ( ) ;
itemMap . put ( SimulationWorkParamVO . Item . DEFAULT_MEMBER , stationSupervisorOptional . get ( ) . getId ( ) ) ;
return buildCreateVO ( mapId , name , name , simType , itemMap , domConfig ) ;
} ;
/ / 综合演练
Supplier < RtsMapFunctionCreateVO > joint = ( ) - > {
String name = " 综合演练 " ;
if ( systemNameSet . contains ( name ) ) {
msgList . add ( String . format ( " %s已存在, 不生成 " , name ) ) ;
return null ;
}
Map < SimulationWorkParamVO . Item , String > itemMap = null ;
if ( dispatcherOptional . isEmpty ( ) ) {
msgList . add ( String . format ( " %s无行调成员, 未设置%s默认扮演成员 " , msgPrefix , name ) ) ;
} else {
itemMap = new HashMap < > ( ) ;
itemMap . put ( SimulationWorkParamVO . Item . DEFAULT_MEMBER , dispatcherOptional . get ( ) . getId ( ) ) ;
}
SimulationWorkParamVO . DomConfigVO domConfig = SimulationWorkParamVO . DomConfigVO . builder ( )
. isJoint ( true )
. hasMemberManager ( true )
. build ( ) ;
return buildCreateVO ( mapId , name , name , simType , itemMap , domConfig ) ;
} ;
/ / 实训设计
Supplier < RtsMapFunctionCreateVO > trainingDesign = ( ) - > {
String name = " 实训设计 " ;
if ( systemNameSet . contains ( name ) ) {
msgList . add ( String . format ( " %s已存在, 不生成 " , name ) ) ;
return null ;
}
Map < SimulationWorkParamVO . Item , String > itemMap = null ;
if ( dispatcherOptional . isEmpty ( ) ) {
msgList . add ( String . format ( " %s无行调成员, 未设置%s默认扮演成员 " , msgPrefix , name ) ) ;
} else {
itemMap = new HashMap < > ( ) ;
itemMap . put ( SimulationWorkParamVO . Item . DEFAULT_MEMBER , dispatcherOptional . get ( ) . getId ( ) ) ;
}
SimulationWorkParamVO . DomConfigVO domConfig = SimulationWorkParamVO . DomConfigVO . builder ( )
. trainingDesign ( true )
. hasMemberManager ( true )
. build ( ) ;
return buildCreateVO ( mapId , name , name , simType , itemMap , domConfig ) ;
} ;
fillFunctions . add ( dispatchSystem ) ;
fillFunctions . add ( stationSystem ) ;
fillFunctions . add ( driveSystem ) ;
fillFunctions . add ( dispatchTrainingSystem ) ;
fillFunctions . add ( stationTrainingSystem ) ;
fillFunctions . add ( dispatchExamSystem ) ;
fillFunctions . add ( stationExamSystem ) ;
fillFunctions . add ( joint ) ;
fillFunctions . add ( trainingDesign ) ;
return fillFunctions ;
}
/ * *
@ -417,27 +528,29 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
Optional < MapMemberVO > stationSupervisorOptional = mapMemberVOS . stream ( )
. filter ( member - > Objects . equals ( member . getType ( ) , SimulationMember . Type . STATION_SUPERVISOR ) )
. findFirst ( ) ;
/ / 调度台
Supplier < RtsMapFunctionCreateVO > dispatchSystem = ( ) - > {
String name = " 调度台 " ;
if ( systemNameSet . contains ( name ) ) {
msgList . add ( String . format ( " %s已存在, 不生成 " , name ) ) ;
return null ;
}
if ( dispatcherOptional . isEmpty ( ) ) {
msgList . add ( String . format ( " %s无行调成员, 未生成%s " , msgPrefix , name ) ) ;
return null ;
}
SimulationWorkParamVO . DomConfigVO domConfig = SimulationWorkParamVO . DomConfigVO . builder ( )
. singleMember ( true )
. hasMemberManager ( true )
. build ( ) ;
Map < SimulationWorkParamVO . Item , String > itemMap = new HashMap < > ( ) ;
itemMap . put ( SimulationWorkParamVO . Item . DEFAULT_MEMBER , dispatcherOptional . get ( ) . getId ( ) ) ;
return buildCreateVO ( mapId , name , name , simType , itemMap , domConfig ) ;
} ;
Supplier < RtsMapFunctionCreateVO > dispatchSystem = getRailDispatcherFunctionSupplier ( mapId , systemNameSet , msgList , msgPrefix , simType , dispatcherOptional ) ;
Supplier < RtsMapFunctionCreateVO > stationSystem = getRailStationFunctionSupplier ( mapId , systemNameSet , msgList , msgPrefix , simType , stationSupervisorOptional ) ;
Supplier < RtsMapFunctionCreateVO > singleOperationTrainingFunctionSupplier = getSingleOperationTrainingFunctionSupplier ( mapId , systemNameSet , msgList , simType ) ;
Supplier < RtsMapFunctionCreateVO > sceneTrainingFunctionSupplier = getSceneTrainingFunctionSupplier ( mapId , systemNameSet , msgList , simType ) ;
Supplier < RtsMapFunctionCreateVO > examFunctionSupplier = getExamFunctionSupplier ( mapId , systemNameSet , msgList , simType ) ;
Supplier < RtsMapFunctionCreateVO > joint = getJointFunctionSupplier ( mapId , systemNameSet , msgList , msgPrefix , simType , dispatcherOptional ) ;
Supplier < RtsMapFunctionCreateVO > trainingDesign = getTrainingDesignFunctionSupplier ( mapId , systemNameSet , msgList , msgPrefix , simType , dispatcherOptional ) ;
fillFunctions . add ( dispatchSystem ) ;
fillFunctions . add ( stationSystem ) ;
fillFunctions . add ( singleOperationTrainingFunctionSupplier ) ;
fillFunctions . add ( sceneTrainingFunctionSupplier ) ;
fillFunctions . add ( examFunctionSupplier ) ;
fillFunctions . add ( joint ) ;
fillFunctions . add ( trainingDesign ) ;
return fillFunctions ;
}
private Supplier < RtsMapFunctionCreateVO > getRailStationFunctionSupplier ( long mapId , Set < String > systemNameSet , List < String > msgList , String msgPrefix ,
Simulation . Type simType , Optional < MapMemberVO > stationSupervisorOptional ) {
/ / 车站
Supplier < RtsMapFunctionCreateVO > stationSystem = ( ) - > {
return ( ) - > {
String name = " 车站 " ;
if ( systemNameSet . contains ( name ) ) {
msgList . add ( String . format ( " %s已存在, 不生成 " , name ) ) ;
@ -455,76 +568,147 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
itemMap . put ( SimulationWorkParamVO . Item . DEFAULT_MEMBER , stationSupervisorOptional . get ( ) . getId ( ) ) ;
return buildCreateVO ( mapId , name , name , simType , itemMap , domConfig ) ;
} ;
/ / 综合演练
Supplier < RtsMapFunctionCreateVO > joint = ( ) - > {
String name = " 综合演练 " ;
}
private Supplier < RtsMapFunctionCreateVO > getRailDispatcherFunctionSupplier ( long mapId , Set < String > systemNameSet , List < String > msgList , String msgPrefix ,
Simulation . Type simType , Optional < MapMemberVO > dispatcherOptional ) {
/ / 调度台
return ( ) - > {
String name = " 调度台 " ;
if ( systemNameSet . contains ( name ) ) {
msgList . add ( String . format ( " %s已存在, 不生成 " , name ) ) ;
return null ;
}
Map < SimulationWorkParamVO . Item , String > itemMap = null ;
if ( dispatcherOptional . isEmpty ( ) ) {
msgList . add ( String . format ( " %s无行调成员, 未设置%s默认扮演成员 " , msgPrefix , name ) ) ;
} else {
itemMap = new HashMap < > ( ) ;
itemMap . put ( SimulationWorkParamVO . Item . DEFAULT_MEMBER , dispatcherOptional . get ( ) . getId ( ) ) ;
msgList . add ( String . format ( " %s无行调成员, 未生成%s " , msgPrefix , name ) ) ;
return null ;
}
SimulationWorkParamVO . DomConfigVO domConfig = SimulationWorkParamVO . DomConfigVO . builder ( )
. isJoint ( true )
. singleMember ( true )
. hasMemberManager ( true )
. build ( ) ;
Map < SimulationWorkParamVO . Item , String > itemMap = new HashMap < > ( ) ;
itemMap . put ( SimulationWorkParamVO . Item . DEFAULT_MEMBER , dispatcherOptional . get ( ) . getId ( ) ) ;
return buildCreateVO ( mapId , name , name , simType , itemMap , domConfig ) ;
} ;
/ / 实训设计
Supplier < RtsMapFunctionCreateVO > trainingDesign = ( ) - > {
String name = " 实训设计 " ;
}
private Supplier < RtsMapFunctionCreateVO > getSchedulingFunctionSupplier ( long mapId , Set < String > systemNameSet , List < String > msgList , String msgPrefix ,
Simulation . Type simType , Optional < MapMemberVO > dispatcherOptional ) {
return ( ) - > {
String name = " 派班 " ;
if ( systemNameSet . contains ( name ) ) {
msgList . add ( String . format ( " %s已存在, 不生成 " , name ) ) ;
return null ;
}
Map < SimulationWorkParamVO . Item , String > itemMap = null ;
if ( dispatcherOptional . isEmpty ( ) ) {
msgList . add ( String . format ( " %s无行调成员, 未设置%s默认扮演成员 " , msgPrefix , name ) ) ;
} else {
itemMap = new HashMap < > ( ) ;
itemMap . put ( SimulationWorkParamVO . Item . DEFAULT_MEMBER , dispatcherOptional . get ( ) . getId ( ) ) ;
msgList . add ( String . format ( " %s无行调成员, 未生成%s " , msgPrefix , name ) ) ;
return null ;
}
SimulationWorkParamVO . DomConfigVO domConfig = SimulationWorkParamVO . DomConfigVO . builder ( )
. trainingDesign ( true )
. hasMemberManager( true )
. singleClient ( true )
. client( Simulation . Client . SCHEDULING . name ( ) )
. build ( ) ;
Map < SimulationWorkParamVO . Item , String > itemMap = new HashMap < > ( ) ;
itemMap . put ( SimulationWorkParamVO . Item . DEFAULT_MEMBER , dispatcherOptional . get ( ) . getId ( ) ) ;
return buildCreateVO ( mapId , name , name , simType , itemMap , domConfig ) ;
} ;
}
fillFunctions . add ( dispatchSystem ) ;
fillFunctions . add ( stationSystem ) ;
fillFunctions . add ( joint ) ;
fillFunctions . add ( trainingDesign ) ;
private Supplier < RtsMapFunctionCreateVO > getIscsFunctionSupplier ( long mapId , Set < String > systemNameSet , List < String > msgList , String msgPrefix ,
Simulation . Type simType , Optional < MapMemberVO > dispatcherOptional ) {
return ( ) - > {
String name = " 综合监控 " ;
if ( systemNameSet . contains ( name ) ) {
msgList . add ( String . format ( " %s已存在, 不生成 " , name ) ) ;
return null ;
}
if ( dispatcherOptional . isEmpty ( ) ) {
msgList . add ( String . format ( " %s无行调成员, 未生成%s " , msgPrefix , name ) ) ;
return null ;
}
SimulationWorkParamVO . DomConfigVO domConfig = SimulationWorkParamVO . DomConfigVO . builder ( )
. singleClient ( true )
. client ( Simulation . Client . ISCS . name ( ) )
. build ( ) ;
Map < SimulationWorkParamVO . Item , String > itemMap = new HashMap < > ( ) ;
itemMap . put ( SimulationWorkParamVO . Item . DEFAULT_MEMBER , dispatcherOptional . get ( ) . getId ( ) ) ;
return buildCreateVO ( mapId , name , name , simType , itemMap , domConfig ) ;
} ;
}
return fillFunctions ;
private Supplier < RtsMapFunctionCreateVO > getRunPlanDesignFunctionSupplier ( long mapId , Set < String > systemNameSet , List < String > msgList , Simulation . Type simType ) {
return ( ) - > {
String name = " 运行图编制 " ;
if ( systemNameSet . contains ( name ) ) {
msgList . add ( String . format ( " %s已存在, 不生成 " , name ) ) ;
return null ;
}
SimulationWorkParamVO . DomConfigVO domConfig = SimulationWorkParamVO . DomConfigVO . builder ( )
. singleClient ( true )
. client ( Simulation . Client . RUN_PLAN_DESIGN . name ( ) )
. build ( ) ;
return buildCreateVO ( mapId , name , name , simType , null , domConfig ) ;
} ;
}
private Supplier < RtsMapFunctionCreateVO > getBigScreenFunctionSupplier ( long mapId , Set < String > systemNameSet , List < String > msgList , Simulation . Type simType ) {
return ( ) - > {
String name = " 中心大屏 " ;
if ( systemNameSet . contains ( name ) ) {
msgList . add ( String . format ( " %s已存在, 不生成 " , name ) ) ;
return null ;
}
SimulationWorkParamVO . DomConfigVO domConfig = SimulationWorkParamVO . DomConfigVO . builder ( )
. singleClient ( true )
. client ( Simulation . Client . C_ATS_BS . name ( ) )
. build ( ) ;
return buildCreateVO ( mapId , name , name , simType , null , domConfig ) ;
} ;
}
private Supplier < RtsMapFunctionCreateVO > getDepotILFunctionSupplier ( long mapId , Set < String > systemNameSet , List < String > msgList , String msgPrefix ,
Simulation . Type simType , List < MapMemberVO > mapMemberVOS ) {
return ( ) - > {
String name = " 车辆段联锁 " ;
if ( systemNameSet . contains ( name ) ) {
msgList . add ( String . format ( " %s已存在, 不生成 " , name ) ) ;
return null ;
}
Optional < MapMemberVO > optional = mapMemberVOS . stream ( ) . filter ( member - > SimulationMember . Type . DEPOT_DISPATCHER . equals ( member . getType ( ) ) )
. findFirst ( ) ;
if ( optional . isEmpty ( ) ) {
msgList . add ( String . format ( " %s无车辆段行调成员, 未生成%s " , msgPrefix , name ) ) ;
return null ;
}
SimulationWorkParamVO . DomConfigVO domConfig = SimulationWorkParamVO . DomConfigVO . builder ( )
. build ( ) ;
Map < SimulationWorkParamVO . Item , String > itemMap = new HashMap < > ( ) ;
itemMap . put ( SimulationWorkParamVO . Item . DEFAULT_MEMBER , optional . get ( ) . getId ( ) ) ;
return buildCreateVO ( mapId , name , name , simType , itemMap , domConfig ) ;
} ;
}
private List < Supplier < RtsMapFunctionCreateVO > > buildEmergencyFillCreateVOSuppliers ( long mapId , Set < String > systemNameSet ,
List < String > msgList , String msgPrefix ,
Simulation . Type simType , List < MapMemberVO > mapMemberVOS ) {
List < Supplier < RtsMapFunctionCreateVO > > fillFunctions = new ArrayList < > ( ) ;
/ / Optional < MapMemberVO > dispatcherOptional = mapMemberVOS . stream ( )
/ / . filter ( member - > Objects . equals ( member . getType ( ) , SimulationMember . Type . DISPATCHER ) )
/ / . findFirst ( ) ;
/ / Optional < MapMemberVO > stationSupervisorOptional = mapMemberVOS . stream ( )
/ / . filter ( member - > Objects . equals ( member . getType ( ) , SimulationMember . Type . STATION_SUPERVISOR ) )
/ / . findFirst ( ) ;
Supplier < RtsMapFunctionCreateVO > system = getEmergencyFunctionSupplier ( mapId , systemNameSet , msgList , simType ) ;
fillFunctions . add ( system ) ;
return fillFunctions ;
}
@Nullable
private Supplier < RtsMapFunctionCreateVO > getEmergencyFunctionSupplier ( long mapId , Set < String > systemNameSet , List < String > msgList , Simulation . Type simType ) {
/ / 应急调度指挥系统
Supplier < RtsMapFunctionCreateVO > system = ( ) - > {
String name = " 应急调度指挥系统 " ;
String name = " 应急调度指挥 仿真 " ;
if ( systemNameSet . contains ( name ) ) {
msgList . add ( String . format ( " %s已存在, 不生成 " , name ) ) ;
return null ;
}
/ / if ( dispatcherOptional . isEmpty ( ) ) {
/ / msgList . add ( String . format ( " %s无行调成员, 未生成%s " , msgPrefix , name ) ) ;
/ / return null ;
/ / }
SimulationWorkParamVO . DomConfigVO domConfig = SimulationWorkParamVO . DomConfigVO . builder ( )
. singleClient ( true )
. client ( SimulationWorkParamVO . DomConfigVO . EMERGENCY )
@ -532,10 +716,7 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
Map < SimulationWorkParamVO . Item , String > itemMap = new HashMap < > ( ) ;
return buildCreateVO ( mapId , name , name , simType , itemMap , domConfig ) ;
} ;
fillFunctions . add ( system ) ;
return fillFunctions ;
return system ;
}
private Optional < RtsMapFunction > findEntityOptional ( long id ) {