代码提交

main
fzhang5 2025-07-14 18:17:56 +08:00
parent a71d6031d5
commit 2b4f7b7096
5 changed files with 9 additions and 12 deletions

2
.gitignore vendored
View File

@ -1,3 +1,3 @@
idea/
.idea/
target/
*.iml

View File

@ -67,6 +67,7 @@
<!--指定打包的配置文件且用filtering设置开启过滤-->
<include>application*.yml</include><!--这里使用占位符进行动态引用以确定具体的打包文件-->
<include>application.yml</include><!--主配置文件必须打包-->
<include>**/*.xml</include> <!-- 包含所有 XML -->
</includes>
<filtering>true</filtering><!--开启过滤在打包时application.yml中配置的@env@将被确定到底是什么变量-->
</resource>
@ -166,13 +167,6 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.xml.fastinfoset</groupId>
<artifactId>FastInfoset</artifactId>
<version>1.2.18</version>
</dependency>
</dependencies>
<repositories>

View File

@ -92,9 +92,12 @@ public class FileService extends ServiceImpl<FileMapper, MyFile> {
throw new ServiceException(constants.CODE_500,"文件不存在");
}
try {
ServletOutputStream os = response.getOutputStream();
response.reset();
response.addHeader("Content-Disposition","attachment;filename="+ URLEncoder.encode(fileName,"UTF-8"));
response.setContentType("application/octet-stream");
ServletOutputStream os = response.getOutputStream();
os.write(FileUtil.readBytes(file));
os.flush();
os.close();

View File

@ -23,5 +23,5 @@ spring:
connect-timeout: 30000ms
file:
file: /home/fzhang5/file/file/
avatar: /home/fzhang5/file/avatar/
file: D:/devWorkSpace/file/
avatar: D:/devWorkSpace/avatar/

View File

@ -7,4 +7,4 @@ mybatis:
map-underscore-to-camel-case: true
spring:
profiles:
active: @profile@
active: test