|
@@ -0,0 +1,66 @@
|
|
|
+package com.keao.edu.controller;
|
|
|
+
|
|
|
+import com.keao.edu.auth.api.client.SysUserFeignService;
|
|
|
+import com.keao.edu.auth.api.entity.SysUser;
|
|
|
+import com.keao.edu.common.controller.BaseController;
|
|
|
+import com.keao.edu.common.entity.HttpResponseResult;
|
|
|
+import com.keao.edu.common.page.PageInfo;
|
|
|
+import com.keao.edu.user.api.entity.ExamRoom;
|
|
|
+import com.keao.edu.user.dto.ExamRoomListDto;
|
|
|
+import com.keao.edu.user.entity.Teacher;
|
|
|
+import com.keao.edu.user.page.ExamRoomListQueryInfo;
|
|
|
+import com.keao.edu.user.service.EmployeeService;
|
|
|
+import com.keao.edu.user.service.ExamRoomService;
|
|
|
+import com.keao.edu.user.service.TeacherService;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.util.Objects;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping("examRoom")
|
|
|
+@Api(tags = "考场服务")
|
|
|
+public class ExamRoomController extends BaseController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ExamRoomService examRoomService;
|
|
|
+ @Autowired
|
|
|
+ private SysUserFeignService sysUserFeignService;
|
|
|
+ @Autowired
|
|
|
+ private EmployeeService employeeService;
|
|
|
+ @Autowired
|
|
|
+ private TeacherService teacherService;
|
|
|
+
|
|
|
+ @ApiOperation("分页查询监考列表")
|
|
|
+ @GetMapping(value = "/list")
|
|
|
+ public HttpResponseResult<PageInfo<ExamRoomListDto>> getList(ExamRoomListQueryInfo queryInfo) {
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
+ if(!sysUser.getIsSuperAdmin() && Objects.isNull(queryInfo.getOrganId())){
|
|
|
+ Teacher teacher = teacherService.get(sysUser.getId());
|
|
|
+ if(Objects.isNull(teacher)){
|
|
|
+ return failed("用户信息异常");
|
|
|
+ }
|
|
|
+ queryInfo.setOrganId(teacher.getOrganId());
|
|
|
+ }
|
|
|
+ return succeed(examRoomService.queryExamRoomPage(queryInfo));
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("教室状态变更(关闭教室,开启教室)")
|
|
|
+ @PostMapping(value = "/changeExamRoom")
|
|
|
+ public HttpResponseResult changeExamRoom(Long examRoomId,Integer openFlag){
|
|
|
+ examRoomService.changeExamRoom(examRoomId,openFlag);
|
|
|
+ return succeed();
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("获取教室")
|
|
|
+ @GetMapping(value = "/get")
|
|
|
+ public HttpResponseResult<ExamRoom> getExamRoom(Long id){
|
|
|
+ return succeed(examRoomService.get(id));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|