|
@@ -55,6 +55,12 @@ public class CqdxService {
|
|
|
System.out.println("XML的文件数:" + files.size());
|
|
|
for (String filePath : files) {
|
|
|
System.out.println("第" + i + "个xml文件开始处理,文件名为:" + filePath);
|
|
|
+
|
|
|
+// if (i < 10) {
|
|
|
+// i++;
|
|
|
+// continue;
|
|
|
+// }
|
|
|
+
|
|
|
Map<Object, Object> paperInfoMap = this.readXml(filePath);
|
|
|
// 查询课程
|
|
|
Course course = courseService.getCourse(rootOrgId, paperInfoMap.get("courseCode").toString());
|
|
@@ -149,7 +155,9 @@ public class CqdxService {
|
|
|
Map<Object, Object> paperInfoMap = new HashedMap<Object, Object>();
|
|
|
DocumentBuilderFactory a = DocumentBuilderFactory.newInstance();
|
|
|
DocumentBuilder b = a.newDocumentBuilder();
|
|
|
- Document document = b.parse(xmlPath);
|
|
|
+
|
|
|
+ // “file:///”表示是本地计算机,否则报错“unknown protocol”
|
|
|
+ Document document = b.parse("file:///" + xmlPath);
|
|
|
NodeList exerciseDocuments = document
|
|
|
.getElementsByTagName("ExerciseDocument");
|
|
|
// 遍历exerciseDocument节点
|
|
@@ -543,10 +551,11 @@ public class CqdxService {
|
|
|
List<String> width = getTagAWid(img);
|
|
|
List<String> parseImageSrc = ImgDataUtils.parseImageSrc(img);
|
|
|
if (parseImageSrc != null && parseImageSrc.size() > 0) {
|
|
|
- String src = parseImageSrc.get(0).replace("{ResourcePath}",
|
|
|
- "http://file.5any.com/UniversityV4.0");
|
|
|
+ String src = parseImageSrc.get(0).replace("{ResourcePath}", "http://file.5any.com/UniversityV4.0");
|
|
|
String url = regexCH(src);
|
|
|
log.info("img url:" + url);
|
|
|
+ url = url.replaceAll("\\\\", "/");
|
|
|
+
|
|
|
String base64 = ImgDataUtils.loadImageToBase64(url);
|
|
|
if (base64 == null) {
|
|
|
throw new Exception("图片下载失败" + url);
|