代码提交

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/ target/
*.iml *.iml

View File

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

View File

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

View File

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

View File

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