Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
tiger_zhou 2023-04-27 16:12:11 +08:00
commit f248c336b4
3 changed files with 26 additions and 27 deletions

View File

@ -32,6 +32,7 @@ import club.joylink.rtss.simulation.cbtc.training2.Training2;
import club.joylink.rtss.simulation.vo.SimulationInfoVO;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.client.fault.FaultRuleVO;
import club.joylink.rtss.vo.conversation.ConversationGroupVO;
import club.joylink.rtss.vo.permission.PermissionSubjectTypeEnum;
import club.joylink.rtss.vo.project.ProjectVO;
import lombok.Getter;
@ -298,7 +299,26 @@ public class Simulation extends club.joylink.rtss.simulation.Simulation<Simulati
* 初始化群组信息
* @param map 群组信息Map
*/
public void initDefaultConversationGroupMap(Map<Long, ConversationGroup> map) {
public void initDefaultConversationGroupMap() {
SimulationBuildParams buildParams = this.getBuildParams();
List<ConversationGroupVO> conversationGroupVOList = buildParams.getMap().getGraphDataNew()
.getConversationGroupMap().get(buildParams.getWorkParamVO().getType());
if (CollectionUtils.isEmpty(conversationGroupVOList)) {
return;
}
Map<Long, ConversationGroup> groupMap = conversationGroupVOList.stream().map(g ->{
ConversationGroup group = new ConversationGroup(this, g);
group.initGroupType();
return group;
}).collect(Collectors.toMap(ConversationGroup::getId, group -> group));
overCoverConversationGroupMap(groupMap);
}
/**
* 覆盖群组信息
* @param map 群组
*/
public void overCoverConversationGroupMap(Map<Long, ConversationGroup> map) {
this.simulationConversationGroupMap.clear();
this.simulationConversationGroupMap.putAll(map);
Long groupId = map.keySet().stream().max(Comparator.comparing(Long::longValue)).orElse(0L);
@ -667,6 +687,9 @@ public class Simulation extends club.joylink.rtss.simulation.Simulation<Simulati
if (this.training2 != null) {
training2.reset();
}
if (!this.simulationConversationGroupMap.isEmpty()) {
this.initDefaultConversationGroupMap();
}
}
@Override

View File

@ -6,8 +6,6 @@ import club.joylink.rtss.services.RunPlanDraftService;
import club.joylink.rtss.services.mapFunction.RtsMapFunctionService;
import club.joylink.rtss.services.permission.PermissionSubjectService;
import club.joylink.rtss.simulation.SimulationManager;
import club.joylink.rtss.simulation.cbtc.build.SimulationBuildParams;
import club.joylink.rtss.simulation.cbtc.conversation.ConversationGroup;
import club.joylink.rtss.simulation.cbtc.discriminate.IVoiceDiscriminateRule;
import club.joylink.rtss.simulation.cbtc.discriminate.VoiceDiscriminateRule;
import club.joylink.rtss.simulation.cbtc.event.SimulationCreateSuccessEvent;
@ -25,7 +23,6 @@ import club.joylink.rtss.vo.client.factory.SocketMessageFactory;
import club.joylink.rtss.vo.client.mapFunction.MapFunctionVO;
import club.joylink.rtss.vo.client.runplan.RunPlanVO;
import club.joylink.rtss.vo.client.simulationv1.RunAsPlanParam;
import club.joylink.rtss.vo.conversation.ConversationGroupVO;
import club.joylink.rtss.vo.permission.PermissionSubjectTypeEnum;
import club.joylink.rtss.vo.permission.PermissionSystemAbilityVO;
import club.joylink.rtss.vo.permission.subject.PermissionSubjectVO;
@ -329,7 +326,7 @@ public class SimulationServiceImpl implements SimulationService {
}
applicationContext.publishEvent(new SimulationCreateSuccessEvent(this, simulation));
// 群组配置信息
initConversationGroup(simulation);
simulation.initDefaultConversationGroupMap();
// 仿真开始运行
simulationManager.start(simulation.getId());
return simulation;
@ -369,25 +366,4 @@ public class SimulationServiceImpl implements SimulationService {
this.simulationLifeCycleService.reloadRunPlan(simulation, runPlanVO, null);
simulation.getRepository().clearChangeTrips(); //清除掉之前的车次计划变化信息
}
/**
* 初始化地图的群组信息
*
* @param simulation 仿真对象
*/
private void initConversationGroup(Simulation simulation) {
SimulationBuildParams buildParams = simulation.getBuildParams();
List<ConversationGroupVO> conversationGroupVOList = buildParams.getMap().getGraphDataNew()
.getConversationGroupMap().get(buildParams.getWorkParamVO().getType());
if (CollectionUtils.isEmpty(conversationGroupVOList)) {
return;
}
Map<Long, ConversationGroup> groupMap = conversationGroupVOList.stream().map(g ->{
ConversationGroup group = new ConversationGroup(simulation, g);
group.initGroupType();
return group;
}).collect(Collectors.toMap(ConversationGroup::getId, group -> group));
simulation.initDefaultConversationGroupMap(groupMap);
}
}

View File

@ -109,7 +109,7 @@ public class StorageSimulation {
if (!CollectionUtils.isEmpty(this.conversationGroupList)) {
Map<Long, ConversationGroup> conversationGroupMap = this.conversationGroupList.stream()
.map(g -> g.convert2SimulationObj(simulation)).collect(Collectors.toMap(ConversationGroup::getId, g -> g));
simulation.initDefaultConversationGroupMap(conversationGroupMap);
simulation.overCoverConversationGroupMap(conversationGroupMap);
}
}
}