Przeglądaj źródła

update check/assigned api

deason 9 miesięcy temu
rodzic
commit
c10649dd02

+ 44 - 25
src/main/java/cn/com/qmth/scancentral/controller/admin/CheckAssignedController.java

@@ -1,37 +1,16 @@
 package cn.com.qmth.scancentral.controller.admin;
 
-import java.io.IOException;
-import java.net.URLEncoder;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletResponse;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.task.AsyncTaskExecutor;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import com.qmth.boot.api.annotation.Aac;
-import com.qmth.boot.api.constant.ApiConstant;
-import com.qmth.boot.core.concurrent.service.ConcurrentService;
-import com.qmth.boot.core.exception.ReentrantException;
-import com.qmth.boot.tools.excel.ExcelWriter;
-import com.qmth.boot.tools.excel.enums.ExcelType;
-import com.qmth.boot.tools.iterator.PageListIterator;
-
 import cn.com.qmth.scancentral.bean.AssignedQueryDomain;
 import cn.com.qmth.scancentral.bean.User;
 import cn.com.qmth.scancentral.controller.BaseController;
 import cn.com.qmth.scancentral.entity.ExamEntity;
+import cn.com.qmth.scancentral.entity.UserEntity;
 import cn.com.qmth.scancentral.enums.GroupType;
 import cn.com.qmth.scancentral.enums.LockType;
 import cn.com.qmth.scancentral.exception.ParameterExceptions;
 import cn.com.qmth.scancentral.service.ExamService;
 import cn.com.qmth.scancentral.service.StudentService;
+import cn.com.qmth.scancentral.service.UserService;
 import cn.com.qmth.scancentral.task.thread.CheckAssignedResetThread;
 import cn.com.qmth.scancentral.vo.answerquery.AnswerQueryVo;
 import cn.com.qmth.scancentral.vo.assginedcheck.AssginedTaskResult;
@@ -39,9 +18,30 @@ import cn.com.qmth.scancentral.vo.assginedcheck.AssignedCheckExamRoomExport;
 import cn.com.qmth.scancentral.vo.assginedcheck.AssignedCheckExport;
 import cn.com.qmth.scancentral.vo.assginedcheck.AssignedTaskSaveVo;
 import cn.com.qmth.scancentral.vo.task.TaskStatusVo;
+import com.qmth.boot.api.annotation.Aac;
+import com.qmth.boot.api.constant.ApiConstant;
+import com.qmth.boot.core.concurrent.service.ConcurrentService;
+import com.qmth.boot.core.exception.ParameterException;
+import com.qmth.boot.core.exception.ReentrantException;
+import com.qmth.boot.tools.excel.ExcelWriter;
+import com.qmth.boot.tools.excel.enums.ExcelType;
+import com.qmth.boot.tools.iterator.PageListIterator;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import net.sf.json.JSONObject;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.task.AsyncTaskExecutor;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 @RestController
 @Api(tags = "人工绑定校验接口")
@@ -58,6 +58,9 @@ public class CheckAssignedController extends BaseController {
     @Autowired
     private ExamService examService;
 
+    @Autowired
+    private UserService userService;
+
     @Autowired
     private AsyncTaskExecutor taskExecutor;
 
@@ -76,7 +79,7 @@ public class CheckAssignedController extends BaseController {
     @ApiOperation(value = "导出")
     @RequestMapping(value = "/export", method = RequestMethod.POST)
     public void export(@RequestParam Long examId, @RequestParam String subjectCode, @RequestParam GroupType type,
-            HttpServletResponse response) throws IOException {
+                       HttpServletResponse response) throws IOException {
         String fileName = URLEncoder.encode("复核校验", "UTF-8");
         response.setHeader("Content-Disposition", "inline; filename=" + fileName + ".xlsx");
         response.setContentType("application/vnd.ms-excel");
@@ -143,7 +146,13 @@ public class CheckAssignedController extends BaseController {
 
     @ApiOperation(value = "重新生成")
     @RequestMapping(value = "/reset", method = RequestMethod.POST)
-    public JSONObject reset(@RequestParam Long examId, @RequestParam String subjectCode) {
+    public JSONObject reset(@RequestParam Long examId, @RequestParam String subjectCode, @RequestParam String password) {
+        User loginUser = getAccessUser();
+        UserEntity curUser = userService.getByLoginName(loginUser.getAccount());
+        if (curUser == null || !password.equals(curUser.getPassword())) {
+            throw new ParameterException("密码错误");
+        }
+
         ExamEntity exam = examService.getById(examId);
         if (exam == null) {
             throw ParameterExceptions.EXAM_NOT_FOUND;
@@ -171,4 +180,14 @@ public class CheckAssignedController extends BaseController {
         result.put("synching", concurrentService.isLocked(LockType.CHECK_ASSIGNED_RESET + "-" + examId));
         return result;
     }
+
+    @ApiOperation(value = "复核校验概况")
+    @RequestMapping(value = "/overview", method = RequestMethod.POST)
+    public JSONObject overview(@RequestParam Long examId, @RequestParam String subjectCode) {
+        JSONObject result = new JSONObject();
+        result.put("finishCount", 0);
+        result.put("todoCount", 0);
+        return result;
+    }
+
 }