123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- package com.keao.edu.user.controller;
- import com.alibaba.fastjson.JSONObject;
- 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.enums.StudentExamResultApiDto;
- import com.keao.edu.user.dto.RecordNotify;
- import com.keao.edu.user.dto.StudentExamResultStatisticsDto;
- import com.keao.edu.user.entity.Employee;
- import com.keao.edu.user.entity.StudentExamResult;
- import com.keao.edu.user.page.StudentExamResultQueryInfo;
- import com.keao.edu.user.service.EmployeeService;
- import com.keao.edu.user.service.StudentExamResultService;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import java.util.Objects;
- @RestController
- @RequestMapping("studentExamResult")
- @Api(tags = "考试结果服务")
- public class StudentExamResultController extends BaseController {
- @Autowired
- private StudentExamResultService studentExamResultService;
- @Autowired
- private SysUserFeignService sysUserFeignService;
- @Autowired
- private EmployeeService employeeService;
- @RequestMapping(value = "/recordSync")
- public void recordSync(@RequestBody String body) throws Exception {
- RecordNotify recordNotify = JSONObject.parseObject(body, RecordNotify.class);
- studentExamResultService.recordSync(recordNotify);
- }
- @ApiOperation("查询考试结果")
- @GetMapping(value = "/queryStudentExamResult")
- public HttpResponseResult<PageInfo<StudentExamResult>> queryStudentExamResult(StudentExamResultQueryInfo queryInfo){
- SysUser sysUser = sysUserFeignService.queryUserInfo();
- if(!sysUser.getIsSuperAdmin()&&Objects.isNull(queryInfo.getOrganId())){
- Employee employee = employeeService.get(sysUser.getId());
- if(Objects.isNull(employee)){
- return failed("用户信息异常");
- }
- queryInfo.setOrganId(employee.getOrganId());
- }
- return succeed(studentExamResultService.queryStudentExamResult(queryInfo));
- }
- @ApiOperation("修改考试结果")
- @PostMapping(value = "/update")
- public HttpResponseResult update(StudentExamResult examResult){
- studentExamResultService.updateStudentExamResult(examResult);
- return succeed();
- }
- @ApiOperation("修改考试状态")
- @PostMapping(value = "/api/updateFinishedExam")
- public void updateFinishedExam(Long examRegistrationId,Integer finishedExam){
- studentExamResultService.updateFinishedExam(examRegistrationId,finishedExam);
- }
- @ApiOperation("修改SessionId")
- @PostMapping(value = "/api/updateSessionId")
- public void updateSessionId(Long examRegistrationId,String sessionId){
- studentExamResultService.updateSessionId(examRegistrationId,sessionId);
- }
- @ApiOperation("获取考试结果")
- @PostMapping(value = "/api/get")
- public StudentExamResultApiDto get(Long id){
- return studentExamResultService.getStudentExamResultApiDto(id);
- }
- @ApiOperation("考试结果统计信息")
- @GetMapping(value = "/getStudentExamResultStatisticsInfo")
- public HttpResponseResult<StudentExamResultStatisticsDto> getStudentExamResultStatisticsInfo(Integer examId){
- SysUser sysUser = sysUserFeignService.queryUserInfo();
- Integer organId=null;
- if(!sysUser.getIsSuperAdmin()){
- Employee employee = employeeService.get(sysUser.getId());
- if(Objects.isNull(employee)){
- return failed("用户信息异常");
- }
- organId=employee.getOrganId();
- }
- return succeed(studentExamResultService.getStudentExamResultStatisticsInfo(organId, examId));
- }
- @ApiOperation("确认考生")
- @PostMapping(value = "/confirmStudent")
- public HttpResponseResult confirmStudent(Long examRegistrationId) {
- studentExamResultService.confirmStudent(examRegistrationId);
- return succeed();
- }
-
- @RequestMapping(value = "/shieldUserId", method = RequestMethod.POST)
- public Object shieldUserId(Long roomId,Integer shieldFlag)throws Exception {
- studentExamResultService.shieldUserId(roomId,shieldFlag);
- return succeed();
- }
- }
|