|
@@ -36,6 +36,8 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import java.io.File;
|
|
|
import java.io.FileInputStream;
|
|
|
import java.io.IOException;
|
|
|
+import java.io.UnsupportedEncodingException;
|
|
|
+import java.net.URLEncoder;
|
|
|
import java.util.*;
|
|
|
|
|
|
import static cn.com.qmth.examcloud.core.print.common.Constants.*;
|
|
@@ -99,8 +101,9 @@ public class CoursePaperServiceImpl implements CoursePaperService {
|
|
|
Check.isEmpty(coursePaper.getPaperName(), "试卷名称不能为空!");
|
|
|
|
|
|
//试卷页面地址和答案页面地址
|
|
|
- String paperHtmlUrl = QUESTION_URL_PREFIX.concat("/api/ecs_ques/paper/pdf/").concat(coursePaper.getPaperId());
|
|
|
- String answerHtmlUrl = QUESTION_URL_PREFIX.concat("/api/ecs_ques/paper/answer/pdf/").concat(coursePaper.getPaperId());
|
|
|
+ //String title = urlParamEncode(coursePaper.getPaperName());
|
|
|
+ final String paperHtmlUrl = QUESTION_URL_PREFIX.concat("/api/ecs_ques/paper/pdf/").concat(coursePaper.getPaperId());
|
|
|
+ final String answerHtmlUrl = QUESTION_URL_PREFIX.concat("/api/ecs_ques/paper/answer/pdf/").concat(coursePaper.getPaperId());
|
|
|
|
|
|
//转换PDF文件
|
|
|
//final String rootDir = Constants.rootFileDir();
|
|
@@ -473,4 +476,16 @@ public class CoursePaperServiceImpl implements CoursePaperService {
|
|
|
FileUtils.saveURLToFile(pair.getValue(), new File(filePath));
|
|
|
}
|
|
|
|
|
|
+ private String urlParamEncode(String str) {
|
|
|
+ if (StringUtils.isBlank(str)) {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ return URLEncoder.encode(str, "UTF-8");
|
|
|
+ } catch (UnsupportedEncodingException e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ }
|
|
|
+ return str;
|
|
|
+ }
|
|
|
+
|
|
|
}
|