创建考试时的权限校验逻辑修改
This commit is contained in:
parent
02078eb039
commit
0faa785f90
@ -5,6 +5,7 @@ import club.joylink.rtss.dao.*;
|
||||
import club.joylink.rtss.entity.*;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.services.training.ITrainingV1Service;
|
||||
import club.joylink.rtss.simulation.cbtc.GroupSimulationService;
|
||||
import club.joylink.rtss.vo.UserVO;
|
||||
import club.joylink.rtss.vo.client.*;
|
||||
import club.joylink.rtss.vo.client.training.TrainingResultVO;
|
||||
@ -50,6 +51,9 @@ public class UserExamService implements IUserExamService {
|
||||
@Autowired
|
||||
private LsLessonDAO lessonDAO;
|
||||
|
||||
@Autowired
|
||||
private GroupSimulationService groupSimulationService;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public UserExamVO generateExamInstance(long examId, UserVO userVO) {
|
||||
@ -63,8 +67,9 @@ public class UserExamService implements IUserExamService {
|
||||
calendar.setTime(new Date());
|
||||
calendar.add(Calendar.SECOND, examDef.getDuration());
|
||||
LsLesson lesson = this.lessonDAO.selectByPrimaryKey(examDef.getLessonId());
|
||||
List<UserPermissionVO> examPermission = iUserPermissionService.getExamUserPermission(userVO, lesson.getMapId(), lesson.getPrdType(), lesson.getId());
|
||||
BusinessExceptionAssertEnum.SIMULATION_PERMISSION_NOT_AVAILABLE.assertCollectionNotEmpty(examPermission);
|
||||
groupSimulationService.confirmHasPermission(userVO, lesson.getMapId(), lesson.getPrdType());
|
||||
// List<UserPermissionVO> examPermission = iUserPermissionService.getExamUserPermission(userVO, lesson.getMapId(), lesson.getPrdType(), lesson.getId());
|
||||
// BusinessExceptionAssertEnum.SIMULATION_PERMISSION_NOT_AVAILABLE.assertCollectionNotEmpty(examPermission);
|
||||
}
|
||||
// 判断是否在考试时间之内
|
||||
if (examDef.getStartTime() != null) {
|
||||
|
@ -276,5 +276,7 @@ public interface GroupSimulationService {
|
||||
|
||||
void changePassengerFlow(String group, Long passengerFlowId);
|
||||
|
||||
void confirmHasPermission(UserVO userVO, Long mapId, String prdType);
|
||||
|
||||
boolean hasPermission(UserVO userVO, Long mapId, String prdType);
|
||||
}
|
||||
|
@ -952,7 +952,8 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
||||
/**
|
||||
* 确认该用户有权限进入该仿真
|
||||
*/
|
||||
private void confirmHasPermission(UserVO userVO, Long mapId, String prdType) {
|
||||
@Override
|
||||
public void confirmHasPermission(UserVO userVO, Long mapId, String prdType) {
|
||||
BusinessExceptionAssertEnum.INSUFFICIENT_PERMISSIONS.assertTrue(hasPermission(userVO, mapId, prdType));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user