|
@@ -1,6 +1,29 @@
|
|
|
package com.qmth.themis.business.templete.impl;
|
|
|
|
|
|
-import cn.hutool.core.date.DateUtil;
|
|
|
+import java.io.File;
|
|
|
+import java.io.FilenameFilter;
|
|
|
+import java.io.IOException;
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Collections;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Objects;
|
|
|
+import java.util.UUID;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+
|
|
|
+import org.apache.commons.io.FileUtils;
|
|
|
+import org.apache.commons.lang3.RandomStringUtils;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.qmth.themis.business.constant.SystemConstant;
|
|
@@ -25,22 +48,9 @@ import com.qmth.themis.common.exception.BusinessException;
|
|
|
import com.qmth.themis.common.util.FileUtil;
|
|
|
import com.qmth.themis.common.util.Result;
|
|
|
import com.qmth.themis.common.util.ResultUtil;
|
|
|
-import org.apache.commons.io.FileUtils;
|
|
|
-import org.apache.commons.lang3.RandomStringUtils;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.slf4j.Logger;
|
|
|
-import org.slf4j.LoggerFactory;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
-import sun.misc.BASE64Decoder;
|
|
|
|
|
|
-import javax.annotation.Resource;
|
|
|
-import java.io.File;
|
|
|
-import java.io.FilenameFilter;
|
|
|
-import java.io.IOException;
|
|
|
-import java.math.BigDecimal;
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
-import java.util.*;
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
+import sun.misc.BASE64Decoder;
|
|
|
|
|
|
/**
|
|
|
* @Description: 试卷导入
|
|
@@ -278,9 +288,8 @@ public class TaskExamPaperImportTemplete implements TaskImportTemplete {
|
|
|
structFile = paperFile;
|
|
|
} else {
|
|
|
String structPath = paper.getStructPath();
|
|
|
- String url = ossUtil.getPrivateUrl(structPath);
|
|
|
structFile = new File(rootDir + uuid() + ".json");
|
|
|
- FileUtil.saveUrlAsFile(url, structFile);
|
|
|
+ ossUtil.download(false, structPath, structFile.getAbsolutePath());
|
|
|
}
|
|
|
disposeAnswer(rootDir, paper, answerFile, structFile, attachmentDir);
|
|
|
}
|
|
@@ -659,11 +668,10 @@ public class TaskExamPaperImportTemplete implements TaskImportTemplete {
|
|
|
throw new BusinessException("科目 " + courseCode + " 试卷 " + paperCode + " 没有试卷信息,不能先导入答案");
|
|
|
}
|
|
|
String structPath = paper.getStructPath();
|
|
|
- String url = ossUtil.getPrivateUrl(structPath);
|
|
|
String name = structPath.substring(structPath.lastIndexOf("/") + 1);
|
|
|
File structFile = new File(rootDir + name);
|
|
|
try {
|
|
|
- FileUtil.saveUrlAsFile(url, structFile);
|
|
|
+ ossUtil.download(false, structPath, structFile.getAbsolutePath());
|
|
|
compareAnswerAndPaper(courseCode, paperCode, answerFile, structFile);
|
|
|
} finally {
|
|
|
if (structFile.exists()) {
|