拆分中图片内容处理
This commit is contained in:
+11
-12
@@ -33,8 +33,11 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import sun.misc.BASE64Encoder;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.InetAddress;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -1220,19 +1223,12 @@ public class FileSpiltService {
|
||||
|
||||
// 处理段落生成编号不识别问题
|
||||
String paragraphString = p.getText();
|
||||
if (StringUtils.isNotBlank(paragraphString)) {
|
||||
if (!StringUtils.isEmpty(paragraphString)) {
|
||||
paragraphString = paragraphString.replace((char) 12288, ' ');
|
||||
paragraphString = paragraphString.replaceAll("\r\n","");
|
||||
paragraphString = paragraphString.replaceAll("\n","");
|
||||
paragraphString = paragraphString.trim();
|
||||
}
|
||||
if(StringUtils.isEmpty(paragraphString)){
|
||||
continue;
|
||||
}
|
||||
paragraphString = paragraphString.replaceAll("\r\n","");
|
||||
paragraphString = paragraphString.replaceAll("\n","");
|
||||
paragraphString = paragraphString.trim();
|
||||
if(StringUtils.isEmpty(paragraphString)){
|
||||
continue;
|
||||
}
|
||||
// if (StringUtils.isNotEmpty(p.getNumLevelText())&& p.getNumLevelText().indexOf(".")>0) {
|
||||
// String numberParent = p.getNumLevelText().substring(0,p.getNumLevelText().lastIndexOf("."));
|
||||
// if (numberMap.containsKey(numberParent)){
|
||||
@@ -2570,13 +2566,16 @@ public class FileSpiltService {
|
||||
try {
|
||||
FileOutputStream fos = new FileOutputStream(filepathandname);
|
||||
fos.write(bytev);
|
||||
String path = splitUrl + "/" + imageName;
|
||||
// String fileUrl = splitUrl + "/" + filepathandname;
|
||||
BASE64Encoder base64Encoder = new BASE64Encoder();
|
||||
String encode = base64Encoder.encode(filepathandname.getBytes(StandardCharsets.UTF_8));
|
||||
String path = splitUrl+"/jero-boot/sys/split/file/getImage?fileUrl="+encode;
|
||||
String imgCon = path;
|
||||
String imgConVal = "<img class=\'wordImg\' src=\'" + path + "\'>";
|
||||
message.getItemsCondi().add(imgConVal);
|
||||
message.setItermsConditions(message.getItermsConditions() + imgConVal);
|
||||
itemsValList.add(getSplitItemsValObject(message.getId(), SplitFilePragraTypeEnum.IMG.getValue(), imgCon, message.getItemsCondi().size(), null));
|
||||
} catch (IOException e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user