|
@@ -1,20 +1,11 @@
|
|
|
package cn.com.qmth.stmms.admin.exam;
|
|
|
|
|
|
-import cn.com.qmth.stmms.admin.dto.SubjectiveQuestionDTO;
|
|
|
-import cn.com.qmth.stmms.admin.thread.DataSyncThread;
|
|
|
-import cn.com.qmth.stmms.admin.utils.HttpUtil;
|
|
|
-import cn.com.qmth.stmms.biz.exam.model.DataSync;
|
|
|
-import cn.com.qmth.stmms.biz.exam.service.*;
|
|
|
-import cn.com.qmth.stmms.biz.file.service.FileService;
|
|
|
-import cn.com.qmth.stmms.biz.lock.LockService;
|
|
|
-import cn.com.qmth.stmms.common.annotation.Logging;
|
|
|
-import cn.com.qmth.stmms.common.annotation.RoleRequire;
|
|
|
-import cn.com.qmth.stmms.common.enums.ExamSource;
|
|
|
-import cn.com.qmth.stmms.common.enums.LockType;
|
|
|
-import cn.com.qmth.stmms.common.enums.LogType;
|
|
|
-import cn.com.qmth.stmms.common.enums.Role;
|
|
|
-import cn.com.qmth.stmms.common.utils.ExportExcel;
|
|
|
-import cn.com.qmth.stmms.common.utils.RequestUtils;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+
|
|
|
import net.sf.json.JSONArray;
|
|
|
import net.sf.json.JSONObject;
|
|
|
|
|
@@ -31,11 +22,27 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
|
|
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
-import javax.servlet.http.HttpServletResponse;
|
|
|
-
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.List;
|
|
|
+import cn.com.qmth.stmms.admin.dto.SubjectiveQuestionDTO;
|
|
|
+import cn.com.qmth.stmms.admin.thread.DataSyncThread;
|
|
|
+import cn.com.qmth.stmms.admin.thread.OnlineExamThread;
|
|
|
+import cn.com.qmth.stmms.admin.utils.HttpUtil;
|
|
|
+import cn.com.qmth.stmms.biz.exam.model.DataSync;
|
|
|
+import cn.com.qmth.stmms.biz.exam.service.DataSyncService;
|
|
|
+import cn.com.qmth.stmms.biz.exam.service.ExamQuestionService;
|
|
|
+import cn.com.qmth.stmms.biz.exam.service.ExamService;
|
|
|
+import cn.com.qmth.stmms.biz.exam.service.ExamStudentService;
|
|
|
+import cn.com.qmth.stmms.biz.exam.service.ExamSubjectService;
|
|
|
+import cn.com.qmth.stmms.biz.exam.service.MarkGroupService;
|
|
|
+import cn.com.qmth.stmms.biz.file.service.FileService;
|
|
|
+import cn.com.qmth.stmms.biz.lock.LockService;
|
|
|
+import cn.com.qmth.stmms.common.annotation.Logging;
|
|
|
+import cn.com.qmth.stmms.common.annotation.RoleRequire;
|
|
|
+import cn.com.qmth.stmms.common.enums.ExamSource;
|
|
|
+import cn.com.qmth.stmms.common.enums.LockType;
|
|
|
+import cn.com.qmth.stmms.common.enums.LogType;
|
|
|
+import cn.com.qmth.stmms.common.enums.Role;
|
|
|
+import cn.com.qmth.stmms.common.utils.ExportExcel;
|
|
|
+import cn.com.qmth.stmms.common.utils.RequestUtils;
|
|
|
|
|
|
@Controller
|
|
|
@RequestMapping("/admin/exam/data/sync")
|
|
@@ -68,6 +75,9 @@ public class DataSyncController extends BaseExamController {
|
|
|
@Autowired
|
|
|
private FileService fileService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private MarkGroupService groupService;
|
|
|
+
|
|
|
@Value("${qmth.examcloud.host}")
|
|
|
private String host;
|
|
|
|
|
@@ -124,9 +134,15 @@ public class DataSyncController extends BaseExamController {
|
|
|
public String save(HttpServletRequest request, DataSync dataSync, RedirectAttributes redirectAttributes) {
|
|
|
int examId = getSessionExamId(request);
|
|
|
if (lockService.trylock(LockType.DATA_SYNC, examId)) {
|
|
|
- DataSyncThread thread = new DataSyncThread(dataSync, pageSize, lockService, dataSyncService, examService,
|
|
|
- studentService, subjectService, fileService);
|
|
|
- taskExecutor.submit(thread);
|
|
|
+ if (dataSync.getSource().equals(ExamSource.EXAM_CLOUD)) {
|
|
|
+ DataSyncThread thread = new DataSyncThread(dataSync, pageSize, lockService, dataSyncService,
|
|
|
+ examService, studentService, subjectService, fileService);
|
|
|
+ taskExecutor.submit(thread);
|
|
|
+ } else if (dataSync.getSource().equals(ExamSource.ONLINE_EXAM)) {
|
|
|
+ OnlineExamThread thread = new OnlineExamThread(dataSync, lockService, dataSyncService, examService,
|
|
|
+ studentService, subjectService, questionService, groupService, fileService);
|
|
|
+ taskExecutor.submit(thread);
|
|
|
+ }
|
|
|
}
|
|
|
dataSync = dataSyncService.findByExamId(examId);
|
|
|
if (lockService.isLocked(LockType.DATA_SYNC, examId) || (dataSync != null && dataSync.isFinished())) {
|
|
@@ -162,7 +178,7 @@ public class DataSyncController extends BaseExamController {
|
|
|
HttpUtil subjectHttp = new HttpUtil(sync.getSubjectUrl(), sync.getAccessKey(), sync.getAppId(),
|
|
|
sync.getRootOrgId());
|
|
|
JSONObject datas = new JSONObject();
|
|
|
- datas.accumulate("examId", sync.getCloudExamId());
|
|
|
+ datas.accumulate("examId", Long.parseLong(sync.getCloudExamId()));
|
|
|
String subjectResult = subjectHttp.httpAction(null, datas.toString());
|
|
|
JSONObject subjectJson = JSONObject.fromObject(subjectResult);
|
|
|
|