21
pom.xml
21
pom.xml
@@ -71,7 +71,7 @@
|
|||||||
<url>https://github.com/YunaiV/ruoyi-vue-pro</url>
|
<url>https://github.com/YunaiV/ruoyi-vue-pro</url>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<revision>3.0.1</revision>
|
<revision>3.0.3</revision>
|
||||||
<!-- Maven 相关 -->
|
<!-- Maven 相关 -->
|
||||||
<java.version>17</java.version>
|
<java.version>17</java.version>
|
||||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||||
@@ -172,6 +172,21 @@
|
|||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
|
<version>3.2.1</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>attach-sources</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>jar</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
<resources>
|
<resources>
|
||||||
<!-- 只对 yaml 文件过滤 -->
|
<!-- 只对 yaml 文件过滤 -->
|
||||||
@@ -227,7 +242,7 @@
|
|||||||
<repository>
|
<repository>
|
||||||
<id>ZT</id>
|
<id>ZT</id>
|
||||||
<name>中铜 ZStack 私服</name>
|
<name>中铜 ZStack 私服</name>
|
||||||
<url>http://172.16.46.63:30708/repository/maven-hosted/</url>
|
<url>http://172.16.46.63:30708/repository/test/</url>
|
||||||
<releases>
|
<releases>
|
||||||
<enabled>false</enabled>
|
<enabled>false</enabled>
|
||||||
</releases>
|
</releases>
|
||||||
@@ -238,7 +253,7 @@
|
|||||||
<repository>
|
<repository>
|
||||||
<id>ZT</id>
|
<id>ZT</id>
|
||||||
<name>中铜 ZStack 私服</name>
|
<name>中铜 ZStack 私服</name>
|
||||||
<url>http://172.16.46.63:30708/repository/maven-hosted/</url>
|
<url>http://172.16.46.63:30708/repository/test/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<!-- <snapshotRepository>-->
|
<!-- <snapshotRepository>-->
|
||||||
<!-- <id>ZT</id>-->
|
<!-- <id>ZT</id>-->
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<repository>
|
<repository>
|
||||||
<id>ZT</id>
|
<id>ZT</id>
|
||||||
<name>中铜 ZStack 私服</name>
|
<name>中铜 ZStack 私服</name>
|
||||||
<url>http://172.16.46.63:30708/repository/maven-hosted/</url>
|
<url>http://172.16.46.63:30708/repository/test/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<!-- <snapshotRepository>-->
|
<!-- <snapshotRepository>-->
|
||||||
<!-- <id>ZT</id>-->
|
<!-- <id>ZT</id>-->
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
<url>https://github.com/YunaiV/ruoyi-vue-pro</url>
|
<url>https://github.com/YunaiV/ruoyi-vue-pro</url>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<revision>3.0.2</revision>
|
<revision>3.0.3</revision>
|
||||||
<flatten-maven-plugin.version>1.6.0</flatten-maven-plugin.version>
|
<flatten-maven-plugin.version>1.6.0</flatten-maven-plugin.version>
|
||||||
<!-- 统一依赖管理 -->
|
<!-- 统一依赖管理 -->
|
||||||
<spring.boot.version>3.4.5</spring.boot.version>
|
<spring.boot.version>3.4.5</spring.boot.version>
|
||||||
|
|||||||
@@ -1,35 +1,33 @@
|
|||||||
package cn.iocoder.yudao.module.infra.controller.admin.businessfile;
|
package cn.iocoder.yudao.module.infra.controller.admin.businessfile;
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
import jakarta.annotation.Resource;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
|
|
||||||
import jakarta.validation.constraints.*;
|
|
||||||
import jakarta.validation.*;
|
|
||||||
import jakarta.servlet.http.*;
|
|
||||||
import java.util.*;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
|
import cn.iocoder.yudao.module.infra.controller.admin.businessfile.vo.BusinessFilePageReqVO;
|
||||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
import cn.iocoder.yudao.module.infra.controller.admin.businessfile.vo.BusinessFileRespVO;
|
||||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
import cn.iocoder.yudao.module.infra.controller.admin.businessfile.vo.BusinessFileSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.infra.controller.admin.businessfile.vo.BusinessFileWithUrlRespVO;
|
||||||
import cn.iocoder.yudao.module.infra.controller.admin.businessfile.vo.*;
|
|
||||||
import cn.iocoder.yudao.module.infra.dal.dataobject.businessfile.BusinessFileDO;
|
import cn.iocoder.yudao.module.infra.dal.dataobject.businessfile.BusinessFileDO;
|
||||||
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
|
|
||||||
import cn.iocoder.yudao.module.infra.service.businessfile.BusinessFileService;
|
import cn.iocoder.yudao.module.infra.service.businessfile.BusinessFileService;
|
||||||
import cn.iocoder.yudao.module.infra.service.file.FileService;
|
import cn.iocoder.yudao.module.infra.service.file.FileService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
@Tag(name = "管理后台 - 业务附件关联")
|
@Tag(name = "管理后台 - 业务附件关联")
|
||||||
@RestController
|
@RestController
|
||||||
@@ -104,40 +102,7 @@ public class BusinessFileController {
|
|||||||
@Operation(summary = "获得业务附件关联分页(带URL)")
|
@Operation(summary = "获得业务附件关联分页(带URL)")
|
||||||
@PreAuthorize("@ss.hasPermission('infra:business-file:query')")
|
@PreAuthorize("@ss.hasPermission('infra:business-file:query')")
|
||||||
public CommonResult<PageResult<BusinessFileWithUrlRespVO>> getBusinessFilePageWithUrl(@Valid BusinessFilePageReqVO pageReqVO) {
|
public CommonResult<PageResult<BusinessFileWithUrlRespVO>> getBusinessFilePageWithUrl(@Valid BusinessFilePageReqVO pageReqVO) {
|
||||||
PageResult<BusinessFileDO> pageResult = businessFileService.getBusinessFilePage(pageReqVO);
|
return success(businessFileService.getBusinessFilePageWithUrl(pageReqVO));
|
||||||
PageResult<BusinessFileWithUrlRespVO> result = BeanUtils.toBean(pageResult, BusinessFileWithUrlRespVO.class);
|
|
||||||
|
|
||||||
// 批量获取文件信息并设置URL
|
|
||||||
List<Long> fileIds = result.getList().stream()
|
|
||||||
.map(BusinessFileWithUrlRespVO::getFileId)
|
|
||||||
.filter(Objects::nonNull)
|
|
||||||
.distinct()
|
|
||||||
.toList();
|
|
||||||
|
|
||||||
// 批量查询文件信息
|
|
||||||
Map<Long, FileDO> fileMap = new HashMap<>();
|
|
||||||
for (Long fileId : fileIds) {
|
|
||||||
FileDO fileDO = fileService.getActiveFileById(fileId);
|
|
||||||
if (fileDO != null) {
|
|
||||||
fileMap.put(fileId, fileDO);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置文件相关信息
|
|
||||||
for (BusinessFileWithUrlRespVO vo : result.getList()) {
|
|
||||||
if (vo.getFileId() != null) {
|
|
||||||
FileDO fileDO = fileMap.get(vo.getFileId());
|
|
||||||
if (fileDO != null) {
|
|
||||||
vo.setFilePath(fileDO.getPath());
|
|
||||||
vo.setFileUrl(fileDO.getUrl());
|
|
||||||
vo.setIsEncrypted(fileDO.getIsEncrypted());
|
|
||||||
vo.setFileType(fileDO.getType());
|
|
||||||
vo.setFileSize(fileDO.getSize());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return success(result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/export-excel")
|
@GetMapping("/export-excel")
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import cn.hutool.core.util.StrUtil;
|
|||||||
import cn.hutool.http.HttpUtil;
|
import cn.hutool.http.HttpUtil;
|
||||||
import cn.iocoder.yudao.framework.common.util.spring.SpringUtils;
|
import cn.iocoder.yudao.framework.common.util.spring.SpringUtils;
|
||||||
import cn.iocoder.yudao.module.infra.framework.file.core.client.AbstractFileClient;
|
import cn.iocoder.yudao.module.infra.framework.file.core.client.AbstractFileClient;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
|
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
|
||||||
import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
|
import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
|
||||||
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
|
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
|
||||||
@@ -47,6 +48,10 @@ public class S3FileClient extends AbstractFileClient<S3FileClientConfig> {
|
|||||||
} catch (Exception ignored) {}
|
} catch (Exception ignored) {}
|
||||||
realExpiration = Duration.ofSeconds(expireSeconds);
|
realExpiration = Duration.ofSeconds(expireSeconds);
|
||||||
}
|
}
|
||||||
|
if (path == null){
|
||||||
|
return StringUtils.EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
// 使用 S3 官方支持的 responseCacheControl 参数,强制浏览器和代理不缓存
|
// 使用 S3 官方支持的 responseCacheControl 参数,强制浏览器和代理不缓存
|
||||||
GetObjectRequest.Builder getObjectRequestBuilder = GetObjectRequest.builder()
|
GetObjectRequest.Builder getObjectRequestBuilder = GetObjectRequest.builder()
|
||||||
.bucket(config.getBucket())
|
.bucket(config.getBucket())
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.infra.service.businessfile;
|
|||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.module.infra.controller.admin.businessfile.vo.BusinessFilePageReqVO;
|
import cn.iocoder.yudao.module.infra.controller.admin.businessfile.vo.BusinessFilePageReqVO;
|
||||||
import cn.iocoder.yudao.module.infra.controller.admin.businessfile.vo.BusinessFileSaveReqVO;
|
import cn.iocoder.yudao.module.infra.controller.admin.businessfile.vo.BusinessFileSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.infra.controller.admin.businessfile.vo.BusinessFileWithUrlRespVO;
|
||||||
import cn.iocoder.yudao.module.infra.dal.dataobject.businessfile.BusinessFileDO;
|
import cn.iocoder.yudao.module.infra.dal.dataobject.businessfile.BusinessFileDO;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
|
||||||
@@ -60,6 +61,8 @@ public interface BusinessFileService {
|
|||||||
*/
|
*/
|
||||||
PageResult<BusinessFileDO> getBusinessFilePage(BusinessFilePageReqVO pageReqVO);
|
PageResult<BusinessFileDO> getBusinessFilePage(BusinessFilePageReqVO pageReqVO);
|
||||||
|
|
||||||
|
PageResult<BusinessFileWithUrlRespVO> getBusinessFilePageWithUrl(BusinessFilePageReqVO pageReqVO);
|
||||||
|
|
||||||
List<Long> batchCreateBusinessFile(List<BusinessFileSaveReqVO> createReqVOList);
|
List<Long> batchCreateBusinessFile(List<BusinessFileSaveReqVO> createReqVOList);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -6,14 +6,16 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import cn.iocoder.yudao.module.infra.controller.admin.businessfile.vo.BusinessFilePageReqVO;
|
import cn.iocoder.yudao.module.infra.controller.admin.businessfile.vo.BusinessFilePageReqVO;
|
||||||
import cn.iocoder.yudao.module.infra.controller.admin.businessfile.vo.BusinessFileSaveReqVO;
|
import cn.iocoder.yudao.module.infra.controller.admin.businessfile.vo.BusinessFileSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.infra.controller.admin.businessfile.vo.BusinessFileWithUrlRespVO;
|
||||||
import cn.iocoder.yudao.module.infra.dal.dataobject.businessfile.BusinessFileDO;
|
import cn.iocoder.yudao.module.infra.dal.dataobject.businessfile.BusinessFileDO;
|
||||||
|
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
|
||||||
import cn.iocoder.yudao.module.infra.dal.mysql.businessfile.BusinessFileMapper;
|
import cn.iocoder.yudao.module.infra.dal.mysql.businessfile.BusinessFileMapper;
|
||||||
|
import cn.iocoder.yudao.module.infra.service.file.FileService;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.BUSINESS_FILE_NOT_EXISTS;
|
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.BUSINESS_FILE_NOT_EXISTS;
|
||||||
@@ -30,6 +32,9 @@ public class BusinessFileServiceImpl implements BusinessFileService {
|
|||||||
@Resource
|
@Resource
|
||||||
private BusinessFileMapper businessFileMapper;
|
private BusinessFileMapper businessFileMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private FileService fileService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long createBusinessFile(BusinessFileSaveReqVO createReqVO) {
|
public Long createBusinessFile(BusinessFileSaveReqVO createReqVO) {
|
||||||
// 插入
|
// 插入
|
||||||
@@ -87,6 +92,43 @@ public class BusinessFileServiceImpl implements BusinessFileService {
|
|||||||
return businessFileMapper.selectPage(pageReqVO);
|
return businessFileMapper.selectPage(pageReqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<BusinessFileWithUrlRespVO> getBusinessFilePageWithUrl(BusinessFilePageReqVO pageReqVO) {
|
||||||
|
PageResult<BusinessFileDO> pageResult = getBusinessFilePage(pageReqVO);
|
||||||
|
PageResult<BusinessFileWithUrlRespVO> result = BeanUtils.toBean(pageResult, BusinessFileWithUrlRespVO.class);
|
||||||
|
|
||||||
|
// 批量获取文件信息并设置URL
|
||||||
|
List<Long> fileIds = result.getList().stream()
|
||||||
|
.map(BusinessFileWithUrlRespVO::getFileId)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
// 批量查询文件信息
|
||||||
|
Map<Long, FileDO> fileMap = new HashMap<>();
|
||||||
|
for (Long fileId : fileIds) {
|
||||||
|
FileDO fileDO = fileService.getActiveFileById(fileId);
|
||||||
|
if (fileDO != null) {
|
||||||
|
fileMap.put(fileId, fileDO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置文件相关信息
|
||||||
|
for (BusinessFileWithUrlRespVO vo : result.getList()) {
|
||||||
|
if (vo.getFileId() != null) {
|
||||||
|
FileDO fileDO = fileMap.get(vo.getFileId());
|
||||||
|
if (fileDO != null) {
|
||||||
|
vo.setFilePath(fileDO.getPath());
|
||||||
|
vo.setFileUrl(fileDO.getUrl());
|
||||||
|
vo.setIsEncrypted(fileDO.getIsEncrypted());
|
||||||
|
vo.setFileType(fileDO.getType());
|
||||||
|
vo.setFileSize(fileDO.getSize());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Long> batchCreateBusinessFile(List<BusinessFileSaveReqVO> createReqVOList) {
|
public List<Long> batchCreateBusinessFile(List<BusinessFileSaveReqVO> createReqVOList) {
|
||||||
List<BusinessFileDO> businessFileList = BeanUtils.toBean(createReqVOList, BusinessFileDO.class);
|
List<BusinessFileDO> businessFileList = BeanUtils.toBean(createReqVOList, BusinessFileDO.class);
|
||||||
|
|||||||
Reference in New Issue
Block a user