fix(asms): 同步问题
This commit is contained in:
+27
-18
File diff suppressed because one or more lines are too long
+25
-17
@@ -399,25 +399,33 @@ public class SynchronizationAsmsService {
|
|||||||
String articleContent = eMap.get("articleContent");
|
String articleContent = eMap.get("articleContent");
|
||||||
// 处理图片
|
// 处理图片
|
||||||
if (articleContent.contains("<img src=")){
|
if (articleContent.contains("<img src=")){
|
||||||
String urlSuffix = articleContent.substring(articleContent.indexOf("getImg"),
|
log.info("-------" + articleContent);
|
||||||
articleContent.indexOf("\" alt"));
|
// base64
|
||||||
String imageUrl = asmsPostUtil.getHost() + urlSuffix;
|
if (articleContent.contains("base64")){
|
||||||
String fileName = imageUrl.substring(imageUrl.lastIndexOf("/") + 1);
|
|
||||||
// 获取图片
|
|
||||||
HttpHeaders headers = new HttpHeaders();
|
|
||||||
headers.set(HttpHeaders.USER_AGENT, "Mozilla/5.0");
|
|
||||||
headers.set(HttpHeaders.ACCEPT, MediaType.ALL_VALUE);
|
|
||||||
HttpEntity<String> entity = new HttpEntity<>(headers);
|
|
||||||
ResponseEntity<byte[]> responseEntity = restTemplate.exchange(imageUrl, HttpMethod.GET, entity, byte[].class);
|
|
||||||
if (HttpStatus.OK == responseEntity.getStatusCode()) {
|
|
||||||
byte[] imageBytes = responseEntity.getBody();
|
|
||||||
MultipartFile file = new MockMultipartFile(fileName, fileName,"application/octet-stream" ,imageBytes);
|
|
||||||
// 上传图片
|
|
||||||
OSSFile oSSFile = ossFileService.uploadLocalForSplit(file, "", "", "");
|
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
stringBuilder.append("<p>").append("<img class=\"wordImg\" style=\"width:100%;height:100%\" src=\"")
|
stringBuilder.append("<p>").append(articleContent).append("</p>");
|
||||||
.append(oSSFile.getUrl()).append("\">").append("</p>");
|
|
||||||
articleContent = stringBuilder.toString();
|
articleContent = stringBuilder.toString();
|
||||||
|
}else {
|
||||||
|
String urlSuffix = articleContent.substring(articleContent.indexOf("getImg"),
|
||||||
|
articleContent.indexOf("\" alt"));
|
||||||
|
String imageUrl = asmsPostUtil.getHost() + urlSuffix;
|
||||||
|
String fileName = imageUrl.substring(imageUrl.lastIndexOf("/") + 1);
|
||||||
|
// 获取图片
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.set(HttpHeaders.USER_AGENT, "Mozilla/5.0");
|
||||||
|
headers.set(HttpHeaders.ACCEPT, MediaType.ALL_VALUE);
|
||||||
|
HttpEntity<String> entity = new HttpEntity<>(headers);
|
||||||
|
ResponseEntity<byte[]> responseEntity = restTemplate.exchange(imageUrl, HttpMethod.GET, entity, byte[].class);
|
||||||
|
if (HttpStatus.OK == responseEntity.getStatusCode()) {
|
||||||
|
byte[] imageBytes = responseEntity.getBody();
|
||||||
|
MultipartFile file = new MockMultipartFile(fileName, fileName, "application/octet-stream", imageBytes);
|
||||||
|
// 上传图片
|
||||||
|
OSSFile oSSFile = ossFileService.uploadLocalForSplit(file, "", "", "");
|
||||||
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
stringBuilder.append("<p>").append("<img class=\"wordImg\" style=\"width:100%;height:100%\" src=\"")
|
||||||
|
.append(oSSFile.getUrl()).append("\">").append("</p>");
|
||||||
|
articleContent = stringBuilder.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 处理表格
|
// 处理表格
|
||||||
|
|||||||
Reference in New Issue
Block a user