浏览代码

调整网考更新考务信息接口

宋悦 7 年之前
父节点
当前提交
70531f9359

+ 13 - 9
exam-work-api/src/main/java/cn/com/qmth/examcloud/service/examwork/api/ExamApi.java

@@ -1,5 +1,6 @@
 package cn.com.qmth.examcloud.service.examwork.api;
 
+import cn.com.qmth.examcloud.service.examwork.dao.ExamStudentRepo;
 import io.swagger.annotations.ApiOperation;
 
 import java.util.Date;
@@ -17,15 +18,7 @@ import org.springframework.data.domain.Sort;
 import org.springframework.data.domain.Sort.Direction;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.ModelAttribute;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import cn.com.qmth.examcloud.common.uac.entity.AccessUser;
 import cn.com.qmth.examcloud.common.util.ErrorMsg;
@@ -47,6 +40,9 @@ public class ExamApi {
     @Autowired
     ExamService examService;
 
+    @Autowired
+    ExamStudentRepo examStudentRepo;
+
     @ApiOperation(value="查询所有考试批次",notes = "分页带查询")
     @GetMapping("/exam/all/{curPage}/{pageSize}")
     public ResponseEntity getAllExam(HttpServletRequest request,
@@ -167,4 +163,12 @@ public class ExamApi {
         examRepo.canNotDel(id);
         return new ResponseEntity(HttpStatus.OK);
     }
+
+    @ApiOperation(value = "网考初始化更新考务信息", notes = "网考初始化更新考务信息")
+    @PutMapping("/exam/updateExamInfo")
+    public ResponseEntity disableUser(@RequestParam Long examId,@RequestParam Long examStuId) {
+        examRepo.canNotDel(examId);
+        examStudentRepo.updateForFinished(examStuId,true);
+        return new ResponseEntity(HttpStatus.OK);
+    }
 }

+ 6 - 0
exam-work-domain/src/main/java/cn/com/qmth/examcloud/service/examwork/dao/ExamStudentRepo.java

@@ -64,4 +64,10 @@ public interface ExamStudentRepo extends JpaRepository<ExamStudent, Long>, Query
 
     @Query(nativeQuery = true,value = "select org_id, org_name, finished, count(id) from ecs_exam_student  where exam_id = :examId group by org_id, org_name, finished")
     List<Object[]> countByCampusAndFinished(@Param("examId") Long examId);
+
+
+    @Transactional
+    @Modifying
+    @Query("update ExamStudent e set e.finished = ?2 where e.id = ?1")
+    void updateForFinished(Long id,Boolean finished);
 }