|
@@ -11,6 +11,7 @@ import com.mysql.cj.util.StringUtils;
|
|
|
import okhttp3.Response;
|
|
|
import org.apache.commons.io.IOUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.core.io.ClassPathResource;
|
|
|
import org.springframework.data.mongodb.core.MongoTemplate;
|
|
|
import org.springframework.data.mongodb.core.query.Criteria;
|
|
|
import org.springframework.data.mongodb.core.query.Query;
|
|
@@ -19,6 +20,10 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.io.BufferedInputStream;
|
|
|
+import java.io.BufferedReader;
|
|
|
+import java.io.IOException;
|
|
|
+import java.io.InputStreamReader;
|
|
|
import java.text.DecimalFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -39,7 +44,51 @@ public class FixCorrectAnswerAndResetScoreService {
|
|
|
MongoTemplate mongoTemplate;
|
|
|
|
|
|
@Async
|
|
|
- public void start(long examId, String courseCode) {
|
|
|
+ public void start() {
|
|
|
+ ClassPathResource classPathResource = new ClassPathResource("temp1.txt");
|
|
|
+ InputStreamReader isr = null;
|
|
|
+ BufferedReader br = null;
|
|
|
+
|
|
|
+ try {
|
|
|
+ isr = new InputStreamReader(classPathResource.getInputStream());
|
|
|
+ br = new BufferedReader(isr);
|
|
|
+ String strExamIdAndCourseCode = "";
|
|
|
+ while ((strExamIdAndCourseCode = br.readLine()) != null) {
|
|
|
+ Long examId = Long.valueOf(strExamIdAndCourseCode.split(",")[0]);
|
|
|
+ String courseCode = strExamIdAndCourseCode.split(",")[1];
|
|
|
+ System.out.println(String.format("examId:%s,courseCode:%s", examId, courseCode));
|
|
|
+ run(examId,courseCode);
|
|
|
+ Thread.sleep(10);
|
|
|
+ //19,"03013750"
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } finally {
|
|
|
+ if (br != null) {
|
|
|
+ try {
|
|
|
+ br.close();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (isr != null) {
|
|
|
+ try {
|
|
|
+ isr.close();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public void run(long examId, String courseCode) {
|
|
|
List<ExamRecordDataEntity> examRecordDataList = queryExamRecordDataList(examId, courseCode);
|
|
|
|
|
|
if (examRecordDataList.isEmpty()) {
|