|
@@ -318,8 +318,12 @@ public class CoursePaperServiceImpl implements CoursePaperService {
|
|
|
FileUtils.makeDirs(paperDir);
|
|
|
FileUtils.makeDirs(answerDir);
|
|
|
|
|
|
+ //下载试卷或答案文件
|
|
|
for (ExportFileInfo info : exportFiles) {
|
|
|
- //todo upyun
|
|
|
+ this.loadFile(paperDir, info.getPaperWord());
|
|
|
+ this.loadFile(paperDir, info.getPaperPdf());
|
|
|
+ this.loadFile(answerDir, info.getAnswerWord());
|
|
|
+ this.loadFile(answerDir, info.getAnswerPdf());
|
|
|
}
|
|
|
|
|
|
//压缩打包所有文件
|
|
@@ -339,4 +343,14 @@ public class CoursePaperServiceImpl implements CoursePaperService {
|
|
|
return zipFile;
|
|
|
}
|
|
|
|
|
|
+ private void loadFile(String dir, Pair<String, String> pair) {
|
|
|
+ if (pair == null) {
|
|
|
+ //未指定时则不用下载
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //key为文件名,value为文件链接地址
|
|
|
+ final String filePath = dir + "/" + pair.getKey();
|
|
|
+ FileUtils.saveURLToFile(pair.getValue(), new File(filePath));
|
|
|
+ }
|
|
|
+
|
|
|
}
|