增加查询“我”加入的仿真接口
This commit is contained in:
parent
c77ef0b669
commit
65eef78e42
@ -614,4 +614,12 @@ public class SimulationV1Controller {
|
||||
public void monitor(@PathVariable String simulationId, @RequestAttribute AccountVO user) {
|
||||
simulationService.monitor(simulationId, user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询"我"已加入的仿真
|
||||
*/
|
||||
@GetMapping("/joined/by/me")
|
||||
public SimulationVO querySimulationJoinedByMe(@RequestAttribute LoginUserInfoVO loginInfo) {
|
||||
return simulationService.querySimulationJoinedByUser(loginInfo.getAccountVO().getId());
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
package club.joylink.rtss.simulation.cbtc;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.data.vo.SimulationVO;
|
||||
import club.joylink.rtss.simulation.cbtc.vo.SimulationWorkParamVO;
|
||||
import club.joylink.rtss.vo.AccountVO;
|
||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.client.simulationv1.RunAsPlanParam;
|
||||
import club.joylink.rtss.vo.permission.PermissionSubjectTypeEnum;
|
||||
import lombok.NonNull;
|
||||
|
||||
import java.util.List;
|
||||
@ -73,4 +73,6 @@ public interface SimulationService {
|
||||
Simulation createSimulationPojo(Long mapFunctionId, LoginUserInfoVO loginInfo, boolean checkAuth);
|
||||
|
||||
void loadDraftRunPlan(String simulationId, long draftRunPlanId);
|
||||
|
||||
SimulationVO querySimulationJoinedByUser(long userId);
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ 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.data.vo.SimulationVO;
|
||||
import club.joylink.rtss.simulation.cbtc.discriminate.IVoiceDiscriminateRule;
|
||||
import club.joylink.rtss.simulation.cbtc.discriminate.VoiceDiscriminateRule;
|
||||
import club.joylink.rtss.simulation.cbtc.event.SimulationCreateSuccessEvent;
|
||||
@ -212,8 +213,8 @@ public class SimulationServiceImpl implements SimulationService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addItems(@NonNull String simulationId, Map<SimulationWorkParamVO.Item, String> functionInfoMap) {
|
||||
if (!CollectionUtils.isEmpty(functionInfoMap)) {
|
||||
public void addItems(@NonNull String simulationId, Map<SimulationWorkParamVO.Item, String> itemMap) {
|
||||
if (!CollectionUtils.isEmpty(itemMap)) {
|
||||
Simulation simulation = simulationManager.getById(simulationId, Simulation.class);
|
||||
Simulation.Type simulationType = simulation.getType();
|
||||
SimulationWorkService initService = simulationWorkServiceManager.getWorkService(simulationType);
|
||||
@ -221,7 +222,7 @@ public class SimulationServiceImpl implements SimulationService {
|
||||
// BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertEquals(loginInfo.getAccountVO().getIdStr(), simulation.getCreatorId(),
|
||||
// "非仿真创建者不能使用该功能");
|
||||
// }
|
||||
initService.addItems(simulation, functionInfoMap);
|
||||
initService.addItems(simulation, itemMap);
|
||||
SocketMessageVO<SimulationWorkParamVO> workParamMessage = SocketMessageFactory
|
||||
.buildSimulationWorkParamMessage(simulationId, simulation.getBuildParams().getWorkParamVO());
|
||||
Set<String> users = simulation.getSimulationUserIds();
|
||||
@ -366,4 +367,12 @@ public class SimulationServiceImpl implements SimulationService {
|
||||
this.simulationLifeCycleService.reloadRunPlan(simulation, runPlanVO, null);
|
||||
simulation.getRepository().clearChangeTrips(); //清除掉之前的车次计划变化信息
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimulationVO querySimulationJoinedByUser(long userId) {
|
||||
Optional<club.joylink.rtss.simulation.Simulation> optional = simulationManager.getSimulationStream()
|
||||
.filter(simulation -> simulation.querySimulationUserById(String.valueOf(userId)) != null)
|
||||
.findFirst();
|
||||
return optional.map(simulation -> groupSimulationService.getSimulationBasicInfo(simulation.getId())).orElse(null);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user