feat: 在线编辑保存10份

This commit is contained in:
2024-01-24 09:22:43 +08:00
parent 8a161f9cab
commit b28cf1b1e5
5 changed files with 347 additions and 346 deletions
@@ -1,5 +1,6 @@
package com.jero.modules.oss.service;
import java.io.File;
import java.io.IOException;
import java.util.List;
@@ -1,24 +1,28 @@
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.enums.LanguageEnum;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.vo.LoginUser;
import com.jero.common.util.CommonUtils;
import com.jero.common.util.MinioUtil;
import com.jero.common.util.UUIDUtils;
import com.jero.common.util.oss.OssBootUtil;
import com.jero.modules.oss.entity.OSSFile;
import com.jero.modules.oss.mapper.OSSFileMapper;
import com.jero.modules.oss.service.IOSSFileService;
import com.jero.modules.system.util.MyStringUtils;
import me.zhyd.oauth.utils.UuidUtils;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
@@ -27,80 +31,81 @@ import java.util.List;
@Service("ossFileService")
public class OSSFileServiceImpl extends ServiceImpl<OSSFileMapper, OSSFile> implements IOSSFileService {
@Value(value = "${jero.path.upload}")
private String uploadpath;
@Value(value = "${jero.path.uploadCos}")
private String uploadCospath;
@Value(value = "${jero.path.upload}")
private String uploadpath;
@Value(value = "${jero.path.uploadCos}")
private String uploadCospath;
/**
* 文件后缀黑名单
*/
@Value(value = "${jero.fileSuffixLimits}")
private String[] fileSuffixLimits;
/**
* 文件后缀黑名单
*/
@Value(value = "${jero.fileSuffixLimits}")
private String[] fileSuffixLimits;
// 文档拆分条款图片访问路径
@Value(value = "${jero.splitUrl}")
private String splitUrl;
// 文档拆分条款图片访问路径
@Value(value = "${jero.splitUrl}")
private String splitUrl;
@Override
public void upload(MultipartFile multipartFile) throws IOException {
String fileName = multipartFile.getOriginalFilename();
fileName = CommonUtils.getFileName(fileName);
OSSFile ossFile = new OSSFile();
ossFile.setFileName(fileName);
String url = OssBootUtil.upload(multipartFile,"upload/test");
//update-begin--Author:scott Date:20201227 forJT-361【文件预览】阿里云原生域名可以文件预览,自己映射域名kkfileview提示文件下载失败-------------------
// 返回阿里云原生域名前缀URL
ossFile.setUrl(OssBootUtil.getOriginalUrl(url));
//update-end--Author:scott Date:20201227 forJT-361【文件预览】阿里云原生域名可以文件预览,自己映射域名kkfileview提示文件下载失败-------------------
this.save(ossFile);
}
@Override
public void upload(MultipartFile multipartFile) throws IOException {
String fileName = multipartFile.getOriginalFilename();
fileName = CommonUtils.getFileName(fileName);
OSSFile ossFile = new OSSFile();
ossFile.setFileName(fileName);
String url = OssBootUtil.upload(multipartFile, "upload/test");
//update-begin--Author:scott Date:20201227 forJT-361【文件预览】阿里云原生域名可以文件预览,自己映射域名kkfileview提示文件下载失败-------------------
// 返回阿里云原生域名前缀URL
ossFile.setUrl(OssBootUtil.getOriginalUrl(url));
//update-end--Author:scott Date:20201227 forJT-361【文件预览】阿里云原生域名可以文件预览,自己映射域名kkfileview提示文件下载失败-------------------
this.save(ossFile);
}
@Override
public boolean delete(OSSFile ossFile) {
try {
this.removeById(ossFile.getId());
OssBootUtil.deleteUrl(ossFile.getUrl());
}
catch (Exception ex) {
return false;
}
return true;
}
@Override
public List<OSSFile> getFileInfosByConnectId(String connectId) {
if(StringUtils.isBlank(connectId)){
return new ArrayList<>();
}
LambdaQueryWrapper<OSSFile> wrapper = new LambdaQueryWrapper<>();
if (connectId.contains(",")) {
wrapper.in(OSSFile::getConnectId, Arrays.asList(connectId.split(",")));
} else {
wrapper.eq(OSSFile::getConnectId, connectId);
}
@Override
public boolean delete(OSSFile ossFile) {
try {
this.removeById(ossFile.getId());
OssBootUtil.deleteUrl(ossFile.getUrl());
} catch (Exception ex) {
return false;
}
return true;
}
List<OSSFile> list = this.list(wrapper);
return list;
}
@Override
public List<OSSFile> getFileInfosByConnectId(String connectId) {
if (StringUtils.isBlank(connectId)) {
return new ArrayList<>();
}
LambdaQueryWrapper<OSSFile> wrapper = new LambdaQueryWrapper<>();
if (connectId.contains(",")) {
wrapper.in(OSSFile::getConnectId, Arrays.asList(connectId.split(",")));
} else {
wrapper.eq(OSSFile::getConnectId, connectId);
}
@Override
public void deleteByConnectIdList(List<String> connectIdList) {
if (connectIdList.size() != 0) {
LambdaQueryWrapper<OSSFile> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(OSSFile::getConnectId, connectIdList);
this.remove(lambdaQueryWrapper);
}
}
/**
* 本地文件上传-文档拆分专用
*
* @param mf 文件
* @param bizPath 自定义路径
* @return
*/
@Override
public OSSFile uploadLocalForSplit(MultipartFile mf, String bizPath, String state, String cut) {
List<OSSFile> list = this.list(wrapper);
return list;
}
//处理文件大小,大于100M抛出异常
@Override
public void deleteByConnectIdList(List<String> connectIdList) {
if (connectIdList.size() != 0) {
LambdaQueryWrapper<OSSFile> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(OSSFile::getConnectId, connectIdList);
this.remove(lambdaQueryWrapper);
}
}
/**
* 本地文件上传-文档拆分专用
*
* @param mf 文件
* @param bizPath 自定义路径
* @return
*/
@Override
public OSSFile uploadLocalForSplit(MultipartFile mf, String bizPath, String state, String cut) {
//处理文件大小,大于100M抛出异常
// long fileSize = mf.getSize() / 1024 / 1024;
// String originalFilename = mf.getOriginalFilename();
// if (fileSize >= 100) {
@@ -111,129 +116,130 @@ public class OSSFileServiceImpl extends ServiceImpl<OSSFileMapper, OSSFile> impl
// }
// }
OSSFile oSSFile = new OSSFile();
String ctxPath = uploadCospath;
String fileName = null;
String fileType = null;
OSSFile oSSFile = new OSSFile();
String ctxPath = uploadCospath;
String fileName = null;
String fileType = null;
String orgName = mf.getOriginalFilename();// 获取文件名
orgName = CommonUtils.getFileName(orgName);
if (orgName.indexOf(".") != -1) {
fileName = orgName.substring(0, orgName.lastIndexOf(".")) + "_" + System.currentTimeMillis() + orgName.substring(orgName.lastIndexOf("."));
} else {
fileName = orgName + "_" + System.currentTimeMillis();
}
String orgName = mf.getOriginalFilename();// 获取文件名
orgName = CommonUtils.getFileName(orgName);
if (orgName.indexOf(".") != -1) {
fileName = orgName.substring(0, orgName.lastIndexOf(".")) + "_" + System.currentTimeMillis() + orgName.substring(orgName.lastIndexOf("."));
} else {
fileName = orgName + "_" + System.currentTimeMillis();
}
String filePath = ctxPath + "/" + fileName;
fileType = orgName.substring(orgName.lastIndexOf("."));
String fileTypeStr = ".doc,.DOC,.docx,.DOCX,.xls, .XLS,.xlsx,.XLSX,.pdf,.PDF";
//判断文件类型
if ("1".equals(state)) {
//固定文件
if (!fileTypeStr.contains(fileType)) {
if (cut.equals(LanguageEnum.CN.getValue())) {
throw new JeroBootException("只能够上传pdf,word,excel类型的文件。请重新选择文件!");
} else {
throw new JeroBootException("Only upload pdf,word,excel type of file Please select the file again");
}
}
} else {
if (CommonUtils.limitFileSuffix(orgName, fileSuffixLimits)) {
if (cut.equals(LanguageEnum.CN.getValue())) {
throw new JeroBootException("不能上传" + StringUtils.join(fileSuffixLimits, ",") + "类型的文件。请重新选择文件!");
} else {
throw new JeroBootException("Can't upload" + StringUtils.join(fileSuffixLimits, ",") + "type of file Please select the file again");
}
}
}
String filePath = ctxPath + "/" + fileName;
fileType = orgName.substring(orgName.lastIndexOf("."));
String fileTypeStr = ".doc,.DOC,.docx,.DOCX,.xls, .XLS,.xlsx,.XLSX,.pdf,.PDF";
//判断文件类型
if ("1".equals(state)) {
//固定文件
if (!fileTypeStr.contains(fileType)) {
if (cut.equals(LanguageEnum.CN.getValue())) {
throw new JeroBootException("只能够上传pdf,word,excel类型的文件。请重新选择文件!");
} else {
throw new JeroBootException("Only upload pdf,word,excel type of file Please select the file again");
}
}
} else {
if (CommonUtils.limitFileSuffix(orgName, fileSuffixLimits)) {
if (cut.equals(LanguageEnum.CN.getValue())) {
throw new JeroBootException("不能上传" + StringUtils.join(fileSuffixLimits, ",") + "类型的文件。请重新选择文件!");
} else {
throw new JeroBootException("Can't upload" + StringUtils.join(fileSuffixLimits, ",") + "type of file Please select the file again");
}
}
}
if (StringUtils.isNotEmpty(fileType)) {
String[] fileTypeArr = {".doc", ".DOC", ".txt", ".TXT", ".docx", ".DOCX",
".xls", ".XLS", ".xlsx", ".XLSX", ".pdf", ".PDF", ".png", ".PNG",
".jfif", ".JFIF", ".pjpeg", ".PJPEG", ".jpeg", ".JPEG", ".pjp", ".PJP",
".jpg", ".JPG", ".swf", ".SWF", ".bmp", ".BMP", ".rar", ".RAR", ".zip", ".ZIP", ".ppt", ".PPT", ".pptx", ".PPTX", ".csv", ".CSV"};
boolean flag = true;
for (String fileTypeTemp : fileTypeArr) {
if (fileTypeTemp.equalsIgnoreCase(fileType)) {
flag = false;
}
}
if (flag) {
if (cut.equals(LanguageEnum.CN.getValue())) {
throw new JeroBootException("只能够上传pdf/word/excel/csv/ppt/txt/zip/rar/静态图片类型的文件。请重新选择文件!");
} else {
throw new JeroBootException("Only upload pdf/word/excel/csv/ppt/txt/zip/rar/Static image type file. Please re select the file!");
}
}
}
if (StringUtils.isNotEmpty(fileType)) {
String[] fileTypeArr = {".doc", ".DOC", ".txt", ".TXT", ".docx", ".DOCX",
".xls", ".XLS", ".xlsx", ".XLSX", ".pdf", ".PDF", ".png", ".PNG",
".jfif", ".JFIF", ".pjpeg", ".PJPEG", ".jpeg", ".JPEG", ".pjp", ".PJP",
".jpg", ".JPG", ".swf", ".SWF", ".bmp", ".BMP", ".rar", ".RAR", ".zip", ".ZIP", ".ppt", ".PPT", ".pptx", ".PPTX", ".csv", ".CSV"};
boolean flag = true;
for (String fileTypeTemp : fileTypeArr) {
if (fileTypeTemp.equalsIgnoreCase(fileType)) {
flag = false;
}
}
if (flag) {
if (cut.equals(LanguageEnum.CN.getValue())) {
throw new JeroBootException("只能够上传pdf/word/excel/csv/ppt/txt/zip/rar/静态图片类型的文件。请重新选择文件!");
} else {
throw new JeroBootException("Only upload pdf/word/excel/csv/ppt/txt/zip/rar/Static image type file. Please re select the file!");
}
}
}
// 将文件上传至腾讯云 cos
String upload = MinioUtil.upload(mf, "/" + uploadCospath);
// 将文件上传至腾讯云 cos
String upload = MinioUtil.upload(mf, "/" + uploadCospath);
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//存入文件表
oSSFile.setFileName(orgName);
oSSFile.setId(UuidUtils.getUUID());
oSSFile.setCreateBy(loginUser.getUsername());
oSSFile.setCreateTime(new Date());
this.save(oSSFile);
// 文件路径做特殊处理
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//存入文件表
oSSFile.setFileName(orgName);
oSSFile.setId(UuidUtils.getUUID());
oSSFile.setCreateBy(loginUser.getUsername());
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);
return oSSFile;
}
String imgUrl = upload.split("/")[1];
oSSFile.setUrl(splitUrl + imgUrl);
return oSSFile;
}
@Override
public List<OSSFile> getFileInfos(String id) {
if (MyStringUtils.isEmpty(id)) {
return new ArrayList<>();
}
LambdaQueryWrapper<OSSFile> wrapper = new LambdaQueryWrapper<>();
wrapper.in(OSSFile::getId, id.split(","));
wrapper.orderByAsc(OSSFile::getCreateTime);
List<OSSFile> list = this.list(wrapper);
if (list.size() == 0) {
LambdaQueryWrapper<OSSFile> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(OSSFile::getConnectId, id.split(","));
lambdaQueryWrapper.orderByAsc(OSSFile::getCreateTime);
list = this.list(lambdaQueryWrapper);
}
return list;
}
@Override
public List<OSSFile> getFileInfoAll(String id) {
if (MyStringUtils.isEmpty(id)) {
return new ArrayList<>();
}
LambdaQueryWrapper<OSSFile> wrapper = new LambdaQueryWrapper<>();
wrapper.in(OSSFile::getId, id.split(","));
List<OSSFile> list = this.list(wrapper);
LambdaQueryWrapper<OSSFile> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(OSSFile::getConnectId, id.split(","));
list.addAll(this.list(lambdaQueryWrapper));
return list;
}
@Override
public List<OSSFile> getFileInfos(String id) {
if (MyStringUtils.isEmpty(id)) {
return new ArrayList<>();
}
LambdaQueryWrapper<OSSFile> wrapper = new LambdaQueryWrapper<>();
wrapper.in(OSSFile::getId, id.split(","));
wrapper.orderByAsc(OSSFile::getCreateTime);
List<OSSFile> list = this.list(wrapper);
if (list.size() == 0) {
LambdaQueryWrapper<OSSFile> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(OSSFile::getConnectId, id.split(","));
lambdaQueryWrapper.orderByAsc(OSSFile::getCreateTime);
list = this.list(lambdaQueryWrapper);
}
return list;
}
@Override
public List<OSSFile> getFileInfoAll(String id) {
if (MyStringUtils.isEmpty(id)) {
return new ArrayList<>();
}
LambdaQueryWrapper<OSSFile> wrapper = new LambdaQueryWrapper<>();
wrapper.in(OSSFile::getId, id.split(","));
List<OSSFile> list = this.list(wrapper);
LambdaQueryWrapper<OSSFile> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(OSSFile::getConnectId, id.split(","));
list.addAll(this.list(lambdaQueryWrapper));
return list;
}
@Override
public void updateFileInfo(List<OSSFile> ossFileList) {
this.updateBatchById(ossFileList);
}
@Override
public void updateFileInfo(List<OSSFile> ossFileList) {
this.updateBatchById(ossFileList);
}
/**
* 本地文件上传 cos
*
* @param mf 文件
* @param bizPath 自定义路径
* @return
*/
@Override
public OSSFile uploadLocalOfCos(MultipartFile mf, String bizPath, String state, String cut) {
/**
* 本地文件上传 cos
*
* @param mf 文件
* @param bizPath 自定义路径
* @return
*/
@Override
public OSSFile uploadLocalOfCos(MultipartFile mf, String bizPath, String state, String cut) {
//处理文件大小,大于100M抛出异常
//处理文件大小,大于100M抛出异常
// long fileSize = mf.getSize() / 1024 / 1024;
// String originalFilename = mf.getOriginalFilename();
// if (fileSize >= 100) {
@@ -244,90 +250,90 @@ public class OSSFileServiceImpl extends ServiceImpl<OSSFileMapper, OSSFile> impl
// }
// }
OSSFile oSSFile = new OSSFile();
String ctxPath = uploadCospath;
if (StringUtils.isNotBlank(bizPath)) {
ctxPath += bizPath;
}
String fileName = null;
String fileType = null;
OSSFile oSSFile = new OSSFile();
String ctxPath = uploadCospath;
if (StringUtils.isNotBlank(bizPath)) {
ctxPath += bizPath;
}
String fileName = null;
String fileType = null;
String orgName = mf.getOriginalFilename();// 获取文件名
orgName = CommonUtils.getFileName(orgName);
if (orgName.indexOf(".") != -1) {
fileName = orgName.substring(0, orgName.lastIndexOf(".")) + "_" + System.currentTimeMillis() + orgName.substring(orgName.lastIndexOf("."));
} else {
fileName = orgName + "_" + System.currentTimeMillis();
}
String orgName = mf.getOriginalFilename();// 获取文件名
orgName = CommonUtils.getFileName(orgName);
if (orgName.indexOf(".") != -1) {
fileName = orgName.substring(0, orgName.lastIndexOf(".")) + "_" + System.currentTimeMillis() + orgName.substring(orgName.lastIndexOf("."));
} else {
fileName = orgName + "_" + System.currentTimeMillis();
}
String filePath = ctxPath + "/" + fileName;
fileType = orgName.substring(orgName.lastIndexOf("."));
String fileTypeStr = ".doc,.DOC,.docx,.DOCX,.xls, .XLS,.xlsx,.XLSX,.pdf,.PDF";
//判断文件类型
if ("1".equals(state)) {
//固定文件
if (!fileTypeStr.contains(fileType)) {
if (cut.equals(LanguageEnum.CN.getValue())) {
throw new JeroBootException("只能够上传pdf,word,excel类型的文件。请重新选择文件!");
} else {
throw new JeroBootException("Only upload pdf,word,excel type of file Please select the file again");
}
}
} else if ("2".equals(state)) { // 认证-参数导出模板上传 专用
String fileTypeStrTwo = ".docx,.DOCX,.xlsx,.XLSX";
List<String> fileTypeStrTwoList = Arrays.asList(fileTypeStrTwo.split(","));
//固定文件
if (!fileTypeStrTwoList.contains(fileType)) {
if (cut.equals(LanguageEnum.CN.getValue())) {
throw new JeroBootException("只能够上传.docx,.DOCX,.xlsx,.XLSX后缀类型的文件。请重新选择文件!");
} else {
throw new JeroBootException("Only upload .docx,.DOCX,.xlsx,.XLSX suffix type of file Please select the file again");
}
}
} else {
if (CommonUtils.limitFileSuffix(orgName, fileSuffixLimits)) {
if (cut.equals(LanguageEnum.CN.getValue())) {
throw new JeroBootException("不能上传" + StringUtils.join(fileSuffixLimits, ",") + "类型的文件。请重新选择文件!");
} else {
throw new JeroBootException("Can't upload" + StringUtils.join(fileSuffixLimits, ",") + "type of file Please select the file again");
}
}
}
String filePath = ctxPath + "/" + fileName;
fileType = orgName.substring(orgName.lastIndexOf("."));
String fileTypeStr = ".doc,.DOC,.docx,.DOCX,.xls, .XLS,.xlsx,.XLSX,.pdf,.PDF";
//判断文件类型
if ("1".equals(state)) {
//固定文件
if (!fileTypeStr.contains(fileType)) {
if (cut.equals(LanguageEnum.CN.getValue())) {
throw new JeroBootException("只能够上传pdf,word,excel类型的文件。请重新选择文件!");
} else {
throw new JeroBootException("Only upload pdf,word,excel type of file Please select the file again");
}
}
} else if ("2".equals(state)) { // 认证-参数导出模板上传 专用
String fileTypeStrTwo = ".docx,.DOCX,.xlsx,.XLSX";
List<String> fileTypeStrTwoList = Arrays.asList(fileTypeStrTwo.split(","));
//固定文件
if (!fileTypeStrTwoList.contains(fileType)) {
if (cut.equals(LanguageEnum.CN.getValue())) {
throw new JeroBootException("只能够上传.docx,.DOCX,.xlsx,.XLSX后缀类型的文件。请重新选择文件!");
} else {
throw new JeroBootException("Only upload .docx,.DOCX,.xlsx,.XLSX suffix type of file Please select the file again");
}
}
} else {
if (CommonUtils.limitFileSuffix(orgName, fileSuffixLimits)) {
if (cut.equals(LanguageEnum.CN.getValue())) {
throw new JeroBootException("不能上传" + StringUtils.join(fileSuffixLimits, ",") + "类型的文件。请重新选择文件!");
} else {
throw new JeroBootException("Can't upload" + StringUtils.join(fileSuffixLimits, ",") + "type of file Please select the file again");
}
}
}
if (StringUtils.isNotEmpty(fileType)) {
String[] fileTypeArr = {".doc", ".DOC", ".txt", ".TXT", ".docx", ".DOCX",
".xls", ".XLS", ".xlsx", ".XLSX", ".pdf", ".PDF", ".png", ".PNG",
".jfif", ".JFIF", ".pjpeg", ".PJPEG", ".jpeg", ".JPEG", ".pjp", ".PJP",
".jpg", ".JPG", ".swf", ".SWF", ".bmp", ".BMP", ".rar", ".RAR", ".zip",
".ZIP", ".ppt", ".PPT", ".pptx", ".PPTX", ".csv", ".CSV", ".gif", ".GIF",
".msg", ".MSG"};
boolean flag = true;
for (String fileTypeTemp : fileTypeArr) {
if (fileTypeTemp.equalsIgnoreCase(fileType)) {
flag = false;
}
}
if (flag) {
if (cut.equals(LanguageEnum.CN.getValue())) {
throw new JeroBootException("只能够上传pdf/word/excel/csv/ppt/txt/zip/rar/msg/gif/静态图片类型的文件。请重新选择文件!");
} else {
throw new JeroBootException("Only upload pdf/word/excel/csv/ppt/txt/zip/rar/msg/gif/Static image type file. Please re select the file!");
}
}
}
if (StringUtils.isNotEmpty(fileType)) {
String[] fileTypeArr = {".doc", ".DOC", ".txt", ".TXT", ".docx", ".DOCX",
".xls", ".XLS", ".xlsx", ".XLSX", ".pdf", ".PDF", ".png", ".PNG",
".jfif", ".JFIF", ".pjpeg", ".PJPEG", ".jpeg", ".JPEG", ".pjp", ".PJP",
".jpg", ".JPG", ".swf", ".SWF", ".bmp", ".BMP", ".rar", ".RAR", ".zip",
".ZIP", ".ppt", ".PPT", ".pptx", ".PPTX", ".csv", ".CSV", ".gif", ".GIF",
".msg", ".MSG"};
boolean flag = true;
for (String fileTypeTemp : fileTypeArr) {
if (fileTypeTemp.equalsIgnoreCase(fileType)) {
flag = false;
}
}
if (flag) {
if (cut.equals(LanguageEnum.CN.getValue())) {
throw new JeroBootException("只能够上传pdf/word/excel/csv/ppt/txt/zip/rar/msg/gif/静态图片类型的文件。请重新选择文件!");
} else {
throw new JeroBootException("Only upload pdf/word/excel/csv/ppt/txt/zip/rar/msg/gif/Static image type file. Please re select the file!");
}
}
}
// 将文件上传至腾讯云 cos
MinioUtil.upload(mf, filePath);
// 将文件上传至腾讯云 cos
MinioUtil.upload(mf, filePath);
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//存入文件表
oSSFile.setFileName(orgName);
oSSFile.setId(UuidUtils.getUUID());
oSSFile.setUrl(filePath);
oSSFile.setCreateBy(loginUser.getUsername());
oSSFile.setCreateTime(new Date());
this.save(oSSFile);
oSSFile.setUrl(null);
return oSSFile;
}
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//存入文件表
oSSFile.setFileName(orgName);
oSSFile.setId(UuidUtils.getUUID());
oSSFile.setUrl(filePath);
oSSFile.setCreateBy(loginUser.getUsername());
oSSFile.setCreateTime(new Date());
this.save(oSSFile);
oSSFile.setUrl(null);
return oSSFile;
}
}