deason 1 năm trước cách đây
mục cha
commit
5cefdbc2bc

+ 60 - 0
src/main/java/cn/com/qmth/examcloud/tool/service/exam_record_audit/ExamRecordDataAuditTask.java

@@ -0,0 +1,60 @@
+package cn.com.qmth.examcloud.tool.service.exam_record_audit;
+
+import cn.com.qmth.examcloud.tool.config.SysProperty;
+import cn.com.qmth.examcloud.tool.service.CommonService;
+import cn.com.qmth.examcloud.tool.utils.HttpHelper;
+import cn.com.qmth.examcloud.tool.vo.user.User;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+@Component
+public class ExamRecordDataAuditTask {
+
+    private final static Logger log = LoggerFactory.getLogger(ExamRecordDataAuditTask.class);
+
+    @Autowired
+    private SysProperty sysProperty;
+
+    @Autowired
+    private CommonService commonService;
+
+    public void start(User user) {
+        Set<Long> examRecordDataIds = new HashSet<>();
+        // examRecordDataIds.add(52801472L);
+        // examRecordDataIds.add(52796160L);
+        // examRecordDataIds.add(52794061L);
+        // examRecordDataIds.add(52791705L);
+        // examRecordDataIds.add(52801046L);
+        // examRecordDataIds.add(52793413L);
+        this.execute(user, examRecordDataIds);
+    }
+
+    /**
+     * 将某些考试记录重审为违纪
+     */
+    private void execute(User user, Set<Long> examRecordDataIds) {
+        String url = user.getServerUrl() + "/api/ecs_oe_admin/exam/audit/redoAudit";
+
+        Map<String, String> headers = new HashMap<>();
+        headers.put("key", user.getKey());
+        headers.put("token", user.getToken());
+
+        Map<String, Object> params = new HashMap<>();
+        params.put("examRecordDataIds", examRecordDataIds);
+        params.put("illegallyTypeId", 6L);// 违纪ID,通过页面查询获取
+        params.put("disciplineDetail", "sys");// 选填
+        params.put("isPass", false);// 审核是否通过
+        params.put("skip", true);
+
+        String result = HttpHelper.post(url, headers, params);
+        log.info(result);
+    }
+
+}

+ 5 - 0
src/test/java/cn/com/qmth/examcloud/tool/ToolTest.java

@@ -6,6 +6,7 @@ import cn.com.qmth.examcloud.tool.config.SysProperty;
 import cn.com.qmth.examcloud.tool.entity.TaskEntity;
 import cn.com.qmth.examcloud.tool.service.CommonService;
 import cn.com.qmth.examcloud.tool.service.create_random_paper_template.CreateRandomPaperTemplateTask;
+import cn.com.qmth.examcloud.tool.service.exam_record_audit.ExamRecordDataAuditTask;
 import cn.com.qmth.examcloud.tool.service.export_student_photo.ExportStudentPhotoTask;
 import cn.com.qmth.examcloud.tool.service.query_paper_struct.QueryPaperStructTask;
 import cn.com.qmth.examcloud.tool.service.reset_student_password.ResetStudentPasswordTask;
@@ -39,6 +40,9 @@ public class ToolTest {
     @Autowired
     private QueryPaperStructTask queryPaperStructTask;
 
+    @Autowired
+    private ExamRecordDataAuditTask examRecordDataAuditTask;
+
     @Test
     public void demo() throws Exception {
         User user = doLogin();
@@ -46,6 +50,7 @@ public class ToolTest {
         // resetStudentPasswordTask.start(user, 0L);
         // queryPaperStructTask.start(user, 0L);
         // exportStudentPhotoTask.start(user);
+        // examRecordDataAuditTask.start(user);
         // createRandomPaperTemplate(user);
     }