|
@@ -99,7 +99,7 @@ public class ProjectFileServiceImpl extends ServiceImpl<ProjectFileMapper, Proje
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public HttpRespMsg dowloadFile(ProjectFile projectFile, String token,String downLoadpath,HttpServletResponse response) {
|
|
|
+ public HttpRespMsg dowloadFile(ProjectFile projectFile, String token,String downLoadpath,HttpServletResponse response,String path) throws FileNotFoundException {
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
User user = userMapper.selectOne(new QueryWrapper<User>().eq("head_imgurl", token));
|
|
|
//添加上传记录
|
|
@@ -111,9 +111,10 @@ public class ProjectFileServiceImpl extends ServiceImpl<ProjectFileMapper, Proje
|
|
|
dynamics.setOperator(user.getUsername());
|
|
|
dynamics.setProjectId(file.getProjectId());
|
|
|
projectOperationDynamicsMapper.insert(dynamics);
|
|
|
+ downloadLocal(response,downLoadpath,file,path);
|
|
|
return msg;
|
|
|
}
|
|
|
- public void downloadLocal(HttpServletResponse response, String downLoadpath,ProjectFile file) throws FileNotFoundException {
|
|
|
+ public void downloadLocal(HttpServletResponse response, String downLoadpath,ProjectFile file,String path) throws FileNotFoundException {
|
|
|
// 下载本地文件
|
|
|
String fileName = file.getFileName().toString(); // 文件的默认保存名
|
|
|
// 读到流中
|
|
@@ -123,7 +124,7 @@ public class ProjectFileServiceImpl extends ServiceImpl<ProjectFileMapper, Proje
|
|
|
if (!dir.exists()) {
|
|
|
dir.mkdirs();
|
|
|
}
|
|
|
- InputStream inStream = new FileInputStream(downLoadpath);// 文件的存放路径
|
|
|
+ InputStream inStream = new FileInputStream(path.substring(0, path.length() - "/upload/".length())+file.getUrl());// 文件的存放路径
|
|
|
// 设置输出的格式
|
|
|
response.reset();
|
|
|
response.setContentType("bin");
|