一个用户同时只能存在一个仿真

This commit is contained in:
tiger_zhou 2023-05-06 17:06:11 +08:00
parent b85ac76d3d
commit 2e630d6916

View File

@ -194,10 +194,20 @@ public class SimulationServiceImpl implements SimulationService {
@Override
public String createSimulation(Long mapFunctionId, LoginUserInfoVO loginInfo) {
List<String> userExistGroup = this.groupSimulationService.getUserRunningSimulationGroups(loginInfo.getAccountVO());
BusinessExceptionAssertEnum.OPERATION_REPEAT.assertNotTrue(!CollectionUtils.isEmpty(userExistGroup),"用户重复创建仿真");
MapFunctionVO mapFunctionVO = rtsMapFunctionService.get(mapFunctionId);
List<String> userExistGroup = this.groupSimulationService.getUserRunningSimulationGroups(loginInfo.getAccountVO());
if(!CollectionUtils.isEmpty(userExistGroup)){
String group = userExistGroup.get(0);
Simulation simulation = this.groupSimulationService.getSimulationByGroup(group);
if(Objects.equals(simulation.getMapFunctionId(), mapFunctionId)){
BusinessExceptionAssertEnum.OPERATION_REPEAT.assertNotTrue(mapFunctionVO.getParamVO().getDomConfig().isHasExam(),"考试只能单独用户操作");
return group;
}else{
BusinessExceptionAssertEnum.OPERATION_REPEAT.assertNotTrue(!CollectionUtils.isEmpty(userExistGroup),"用户重复创建仿真");
}
}
Long mapId = mapFunctionVO.getMapId();
Map<String,Boolean> createUserType = this.checkUserPermission(mapFunctionVO,loginInfo);