Merge remote-tracking branch 'origin/master'
This commit is contained in:
+1
-1
@@ -9,7 +9,7 @@ package com.jero.common.util;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.*;
|
||||
import java.nio.file.*;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
|
||||
|
||||
+18
-3
@@ -3,6 +3,7 @@ package com.jero.modules.oss.service.impl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
import com.jero.common.constant.enums.LanguageEnum;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
@@ -35,6 +36,11 @@ public class OSSFileServiceImpl extends ServiceImpl<OSSFileMapper, OSSFile> impl
|
||||
private String uploadpath;
|
||||
@Value(value = "${jero.path.uploadCos}")
|
||||
private String uploadCospath;
|
||||
/**
|
||||
* 本地:local minio:minio 阿里:alioss
|
||||
*/
|
||||
@Value(value = "${jero.uploadType}")
|
||||
private String uploadType;
|
||||
/**
|
||||
* 文件后缀黑名单
|
||||
*/
|
||||
@@ -174,21 +180,30 @@ public class OSSFileServiceImpl extends ServiceImpl<OSSFileMapper, OSSFile> impl
|
||||
|
||||
|
||||
// 将文件上传至腾讯云 cos
|
||||
String upload = MinioUtil.upload(mf, "/" + uploadCospath);
|
||||
// String aa = MinioUtil.upload(mf, "/" + uploadCospath);
|
||||
String upload = "";
|
||||
if (CommonConstant.UPLOAD_TYPE_LOCAL.equals(uploadType)) {
|
||||
// 本地上传
|
||||
upload = CommonUtils.uploadLocal(mf, bizPath, uploadpath);
|
||||
} else {
|
||||
// minio上传
|
||||
upload = CommonUtils.upload(mf, bizPath, uploadType);
|
||||
}
|
||||
|
||||
// LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
String userId = "";
|
||||
//存入文件表
|
||||
oSSFile.setFileName(orgName);
|
||||
oSSFile.setId(UuidUtils.getUUID());
|
||||
oSSFile.setUrl(upload);
|
||||
oSSFile.setCreateBy(userId);
|
||||
oSSFile.setCreateTime(new Date());
|
||||
this.save(oSSFile);
|
||||
// 文件路径做特殊处理
|
||||
// BASE64Encoder base64Encoder = new BASE64Encoder();
|
||||
// String encode = base64Encoder.encode(filePath.getBytes(StandardCharsets.UTF_8));
|
||||
String imgUrl = upload.split("/")[1];
|
||||
oSSFile.setUrl(splitUrl + imgUrl);
|
||||
// String imgUrl = upload.split("/")[1];
|
||||
oSSFile.setUrl(splitUrl + oSSFile.getId());
|
||||
return oSSFile;
|
||||
}
|
||||
|
||||
|
||||
+16
@@ -919,6 +919,22 @@ public class FileSpiltService {
|
||||
c.selectPath("./*");
|
||||
while (c.toNextSelection()) {
|
||||
XmlObject o = c.getObject();
|
||||
if(o.getDomNode().getNodeName().equals("mc:AlternateContent")){
|
||||
String str = o.toString();
|
||||
String imgId = "";
|
||||
Pattern pattern = Pattern.compile("r:embed=\"([^\"]+)\"");
|
||||
Matcher matcher = pattern.matcher(str);
|
||||
// 查找匹配项
|
||||
if (matcher.find()) {
|
||||
// 提取捕获组中的内容
|
||||
String result = matcher.group(1);
|
||||
imgId = result;
|
||||
}
|
||||
if(StringUtils.isNotBlank(imgId)){
|
||||
imageBundleList.add(imgId);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
//如果子元素是<w:drawing>这样的形式,使用CTDrawing保存图片
|
||||
if (o instanceof CTDrawing) {
|
||||
CTDrawing drawing = (CTDrawing) o;
|
||||
|
||||
Reference in New Issue
Block a user