|
@@ -26,9 +26,12 @@ import org.apache.commons.fileupload.disk.DiskFileItem;
|
|
|
import org.apache.commons.io.FileUtils;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.apache.pdfbox.pdmodel.PDDocument;
|
|
|
+import org.apache.poi.ss.formula.FormulaShifter;
|
|
|
+import org.springblade.business.entity.ArchiveFile;
|
|
|
import org.springblade.common.constant.CommonConstant;
|
|
|
import org.springblade.common.utils.SystemUtils;
|
|
|
import org.springblade.core.cache.utils.CacheUtil;
|
|
|
+import org.springblade.core.log.exception.ServiceException;
|
|
|
import org.springblade.core.oss.model.BladeFile;
|
|
|
import org.springblade.core.secure.annotation.PreAuth;
|
|
|
import org.springblade.core.tenant.annotation.NonDS;
|
|
@@ -36,6 +39,7 @@ import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.constant.RoleConstant;
|
|
|
import org.springblade.core.tool.utils.ObjectUtil;
|
|
|
import org.springblade.resource.builder.oss.OssBuilder;
|
|
|
+import org.springblade.resource.dto.batchDownloadFileDTO;
|
|
|
import org.springblade.resource.entity.LargeFile;
|
|
|
import org.springblade.resource.feign.CommonFileClient;
|
|
|
import org.springblade.resource.service.ILargeFileService;
|
|
@@ -46,11 +50,13 @@ import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.http.MediaType;
|
|
|
+import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.util.DigestUtils;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
|
|
|
|
|
+import javax.validation.Valid;
|
|
|
import java.io.*;
|
|
|
import java.lang.reflect.Method;
|
|
|
import java.nio.MappedByteBuffer;
|
|
@@ -91,6 +97,8 @@ public class LargeFileEndpoint {
|
|
|
|
|
|
private final String endpoint = "http://oss-cn-hangzhou.aliyuncs.com";
|
|
|
|
|
|
+ private final JdbcTemplate jdbcTemplate;
|
|
|
+
|
|
|
/**
|
|
|
* 创建存储桶
|
|
|
*
|
|
@@ -265,6 +273,29 @@ public class LargeFileEndpoint {
|
|
|
return uploadByMappedByteBuffer(param);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 批量下载文件
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping("batch-download-file")
|
|
|
+ public void batchDownloadFile(@Valid @RequestBody batchDownloadFileDTO dto){
|
|
|
+ List<Long> ids = dto.getIds();
|
|
|
+ if (dto.getType() == 1){
|
|
|
+ List<ArchiveFile> files = jdbcTemplate.queryForList("select id,file_name,pdf_file_url from u_archive_file where id in(" + StringUtils.join(ids, ",") + ")", ArchiveFile.class);
|
|
|
+ if (files.size() == 0){
|
|
|
+ throw new ServiceException("从文件id中未查找到文件数据");
|
|
|
+ }
|
|
|
+ for (ArchiveFile file : files) {
|
|
|
+ if (StringUtils.isNotBlank(file.getPdfFileUrl())){
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else if (dto.getType() == 2){
|
|
|
+
|
|
|
+ }
|
|
|
+ System.out.println(7777);
|
|
|
+ }
|
|
|
+
|
|
|
public static String getSysLocalFileUrl() {
|
|
|
String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
if (SystemUtils.isMacOs()) {
|