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.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.*;
|
||||||
import java.nio.file.*;
|
import java.nio.file.*;
|
||||||
import java.nio.file.attribute.BasicFileAttributes;
|
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.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
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.constant.enums.LanguageEnum;
|
||||||
import com.jero.common.exception.JeroBootException;
|
import com.jero.common.exception.JeroBootException;
|
||||||
import com.jero.common.system.vo.LoginUser;
|
import com.jero.common.system.vo.LoginUser;
|
||||||
@@ -35,6 +36,11 @@ public class OSSFileServiceImpl extends ServiceImpl<OSSFileMapper, OSSFile> impl
|
|||||||
private String uploadpath;
|
private String uploadpath;
|
||||||
@Value(value = "${jero.path.uploadCos}")
|
@Value(value = "${jero.path.uploadCos}")
|
||||||
private String uploadCospath;
|
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
|
// 将文件上传至腾讯云 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();
|
// LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||||
String userId = "";
|
String userId = "";
|
||||||
//存入文件表
|
//存入文件表
|
||||||
oSSFile.setFileName(orgName);
|
oSSFile.setFileName(orgName);
|
||||||
oSSFile.setId(UuidUtils.getUUID());
|
oSSFile.setId(UuidUtils.getUUID());
|
||||||
|
oSSFile.setUrl(upload);
|
||||||
oSSFile.setCreateBy(userId);
|
oSSFile.setCreateBy(userId);
|
||||||
oSSFile.setCreateTime(new Date());
|
oSSFile.setCreateTime(new Date());
|
||||||
this.save(oSSFile);
|
this.save(oSSFile);
|
||||||
// 文件路径做特殊处理
|
// 文件路径做特殊处理
|
||||||
// BASE64Encoder base64Encoder = new BASE64Encoder();
|
// BASE64Encoder base64Encoder = new BASE64Encoder();
|
||||||
// String encode = base64Encoder.encode(filePath.getBytes(StandardCharsets.UTF_8));
|
// String encode = base64Encoder.encode(filePath.getBytes(StandardCharsets.UTF_8));
|
||||||
String imgUrl = upload.split("/")[1];
|
// String imgUrl = upload.split("/")[1];
|
||||||
oSSFile.setUrl(splitUrl + imgUrl);
|
oSSFile.setUrl(splitUrl + oSSFile.getId());
|
||||||
return oSSFile;
|
return oSSFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+16
@@ -919,6 +919,22 @@ public class FileSpiltService {
|
|||||||
c.selectPath("./*");
|
c.selectPath("./*");
|
||||||
while (c.toNextSelection()) {
|
while (c.toNextSelection()) {
|
||||||
XmlObject o = c.getObject();
|
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保存图片
|
//如果子元素是<w:drawing>这样的形式,使用CTDrawing保存图片
|
||||||
if (o instanceof CTDrawing) {
|
if (o instanceof CTDrawing) {
|
||||||
CTDrawing drawing = (CTDrawing) o;
|
CTDrawing drawing = (CTDrawing) o;
|
||||||
|
|||||||
Reference in New Issue
Block a user