ExamRoomStudentRelationController.java 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. package com.keao.edu.user.controller;
  2. import com.keao.edu.auth.api.client.SysUserFeignService;
  3. import com.keao.edu.auth.api.entity.SysUser;
  4. import com.keao.edu.common.controller.BaseController;
  5. import com.keao.edu.common.entity.HttpResponseResult;
  6. import com.keao.edu.common.page.PageInfo;
  7. import com.keao.edu.im.api.entity.PublishMessageDto;
  8. import com.keao.edu.user.api.entity.ExamRoomStudentRelation;
  9. import com.keao.edu.user.dto.ExamRoomStudentRelationDto;
  10. import com.keao.edu.user.dto.StuRecordDetailDto;
  11. import com.keao.edu.user.entity.Employee;
  12. import com.keao.edu.user.page.ExamRoomStudentRelationQueryInfo;
  13. import com.keao.edu.user.service.EmployeeService;
  14. import com.keao.edu.user.service.ExamRoomStudentRelationService;
  15. import io.swagger.annotations.Api;
  16. import io.swagger.annotations.ApiOperation;
  17. import org.springframework.beans.factory.annotation.Autowired;
  18. import org.springframework.web.bind.annotation.GetMapping;
  19. import org.springframework.web.bind.annotation.PostMapping;
  20. import org.springframework.web.bind.annotation.RequestMapping;
  21. import org.springframework.web.bind.annotation.RestController;
  22. import java.util.Objects;
  23. @RestController
  24. @RequestMapping("examRoomStudentRelation")
  25. @Api(tags = "考场与学生关联服务")
  26. public class ExamRoomStudentRelationController extends BaseController {
  27. @Autowired
  28. private ExamRoomStudentRelationService examRoomStudentRelationService;
  29. @Autowired
  30. private SysUserFeignService sysUserFeignService;
  31. @Autowired
  32. private EmployeeService employeeService;
  33. /*@ApiOperation("开启/关闭教室")
  34. @GetMapping(value = "/switchClassRoom")
  35. public HttpResponseResult switchClassRoom(Integer openFlag,Integer examinationBasicId,Integer studentId) {
  36. examRoomStudentRelationService.switchClassRoom(openFlag,examinationBasicId,studentId);
  37. return succeed();
  38. }*/
  39. @ApiOperation("签到")
  40. @PostMapping(value = "/signIn")
  41. public HttpResponseResult signIn(Long examRegistrationId) {
  42. examRoomStudentRelationService.signIn(examRegistrationId);
  43. return succeed();
  44. }
  45. @ApiOperation("下一位")
  46. @PostMapping(value = "/nextBit")
  47. public HttpResponseResult nextBit(Integer examStatus,Long roomId) {
  48. examRoomStudentRelationService.nextBit(examStatus,roomId);
  49. return succeed();
  50. }
  51. @ApiOperation("开始考试")
  52. @PostMapping(value = "/actionExam")
  53. public HttpResponseResult actionExam(Long roomId) {
  54. examRoomStudentRelationService.actionExam(roomId);
  55. return succeed();
  56. }
  57. @ApiOperation("监考端选择去录播")
  58. @PostMapping(value = "/webRecorded")
  59. public HttpResponseResult webRecorded(Long roomId) {
  60. examRoomStudentRelationService.recorded(roomId);
  61. return succeed();
  62. }
  63. /*@ApiOperation("学生选择去录播")
  64. @PostMapping(value = "/stuRecorded")
  65. public HttpResponseResult<NeedCheckingDetailDto> stuRecorded(Long examRegistrationId) {
  66. return succeed(examRoomStudentRelationService.stuRecorded(examRegistrationId));
  67. }*/
  68. @ApiOperation("学生端录播详情页面")
  69. @GetMapping(value = "/stuRecordDetail")
  70. public HttpResponseResult<StuRecordDetailDto> stuRecordDetail(Long examRegistrationId) {
  71. return succeed(examRoomStudentRelationService.stuRecordDetail(examRegistrationId));
  72. }
  73. @ApiOperation("学生端完成录播")
  74. @PostMapping(value = "/stuEndRecord")
  75. public HttpResponseResult stuEndRecord(Long examRegistrationId,String videoUrl) {
  76. examRoomStudentRelationService.stuEndRecord(examRegistrationId,videoUrl);
  77. return succeed();
  78. }
  79. /*@ApiOperation("学生选择重新排队")
  80. @PostMapping(value = "/againQueue")
  81. public HttpResponseResult<NeedCheckingDetailDto> againQueue(Long examRegistrationId) {
  82. return succeed(examRoomStudentRelationService.againQueue(examRegistrationId));
  83. }*/
  84. @ApiOperation("获取后台考场待考队列")
  85. @PostMapping(value = "/queryNeedCheckingList")
  86. public HttpResponseResult queryNeedCheckingList(Long roomId) {
  87. return succeed(examRoomStudentRelationService.queryNeedCheckingList(roomId));
  88. }
  89. @ApiOperation("获取推送消息内容")
  90. @PostMapping(value = "api/getPublishMessage")
  91. public PublishMessageDto getPublishMessage(Long examRegistrationId) {
  92. return examRoomStudentRelationService.getPublishMessage(examRegistrationId);
  93. }
  94. @ApiOperation("获取教室学员关联")
  95. @PostMapping(value = "api/getExamRoomStudentRelation")
  96. public ExamRoomStudentRelation getExamRoomStudentRelation(Long registrationId) {
  97. return examRoomStudentRelationService.getExamRoomStudentRelation(registrationId);
  98. }
  99. @ApiOperation("给教室分配学员")
  100. @PostMapping(value = "/addStudentForRoom")
  101. public HttpResponseResult addStudentForRoom(Long examRoomId, String registIds){
  102. SysUser sysUser = sysUserFeignService.queryUserInfo();
  103. Integer organId=null;
  104. if(!sysUser.getIsSuperAdmin()){
  105. Employee employee = employeeService.get(sysUser.getId());
  106. if(Objects.isNull(employee)){
  107. return failed("用户信息异常");
  108. }
  109. organId=employee.getOrganId();
  110. }
  111. examRoomStudentRelationService.addStudentForRoom(examRoomId, registIds, organId);
  112. return succeed();
  113. }
  114. @ApiOperation("更换学员考场")
  115. @PostMapping(value = "/changeStudentExamRoom")
  116. public HttpResponseResult changeStudentExamRoom(Long registId, Long examRoomId){
  117. SysUser sysUser = sysUserFeignService.queryUserInfo();
  118. Integer organId=null;
  119. if(!sysUser.getIsSuperAdmin()){
  120. Employee employee = employeeService.get(sysUser.getId());
  121. if(Objects.isNull(employee)){
  122. return failed("用户信息异常");
  123. }
  124. organId=employee.getOrganId();
  125. }
  126. examRoomStudentRelationService.changeStudentExamRoom(registId, examRoomId, organId);
  127. return succeed();
  128. }
  129. @ApiOperation("获取教室学员")
  130. @GetMapping(value = "/findExamRoomStudents")
  131. public HttpResponseResult<PageInfo<ExamRoomStudentRelationDto>> findExamRoomStudents(ExamRoomStudentRelationQueryInfo queryInfo){
  132. SysUser sysUser = sysUserFeignService.queryUserInfo();
  133. if(!sysUser.getIsSuperAdmin()){
  134. Employee employee = employeeService.get(sysUser.getId());
  135. if(Objects.nonNull(employee)){
  136. queryInfo.setOrganId(employee.getOrganId());
  137. }
  138. }
  139. return succeed(examRoomStudentRelationService.findExamRoomStudents(queryInfo));
  140. }
  141. @ApiOperation("删除指定教室学员")
  142. @PostMapping(value = "/deleteStudentFromRoom")
  143. public HttpResponseResult deleteStudentFromRoom(Long examRoomId, String registIds){
  144. SysUser sysUser = sysUserFeignService.queryUserInfo();
  145. Integer organId=null;
  146. if(!sysUser.getIsSuperAdmin()){
  147. Employee employee = employeeService.get(sysUser.getId());
  148. if(Objects.isNull(employee)){
  149. return failed("用户信息异常");
  150. }
  151. organId=employee.getOrganId();
  152. }
  153. examRoomStudentRelationService.deleteStudentFromRoom(examRoomId, registIds, organId);
  154. return succeed();
  155. }
  156. }