去除后台下载文件中包含的bak备份目录
This commit is contained in:
@@ -42,7 +42,7 @@ public class DownLoadController {
|
||||
return "download/dodownload";
|
||||
}*/
|
||||
|
||||
@GetMapping("/download/findall")
|
||||
@GetMapping("/home/admin/download/findall")
|
||||
@ResponseBody
|
||||
public List<TbFile> toDownloadAll() {
|
||||
List<TbFile> files = fileService.findAllFile();//此处做空指针判断并抛出错误
|
||||
@@ -52,7 +52,7 @@ public class DownLoadController {
|
||||
return null;
|
||||
}
|
||||
|
||||
@GetMapping("/download/findone")
|
||||
@GetMapping("/home/download/findone")
|
||||
@ResponseBody
|
||||
public List<TbFile> toDownloadOne() {
|
||||
TbUser user = (TbUser) request.getSession().getAttribute(USER_SESSION_KEY);
|
||||
@@ -65,7 +65,7 @@ public class DownLoadController {
|
||||
return null;
|
||||
}
|
||||
|
||||
@RequestMapping("/download/dodownload")
|
||||
@RequestMapping("/home/download/dodownload")
|
||||
public String download(@RequestParam Integer fileId, HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
response.setContentType("text/html;charset=utf-8");
|
||||
@@ -124,11 +124,12 @@ public class DownLoadController {
|
||||
|
||||
/**
|
||||
* 传入课程名和文件夹名称,打包下载目录下所有文件
|
||||
*
|
||||
* @param courseName
|
||||
* @param folder
|
||||
* @param response
|
||||
*/
|
||||
@GetMapping("/download/downloadzip")
|
||||
@GetMapping("/home/admin/download/downloadzip")
|
||||
public void batDownload(@RequestParam(value = "courseName") String courseName,
|
||||
@RequestParam(value = "Folder") String folder, HttpServletResponse response) {
|
||||
//获取文件夹名称
|
||||
@@ -159,6 +160,7 @@ public class DownLoadController {
|
||||
for (int i = 0; i < path.length; i++) {
|
||||
File file = new File(path[i]);
|
||||
//将需要压缩的文件格式化为输入流
|
||||
if (!file.isDirectory()){
|
||||
zipSource = new FileInputStream(file);
|
||||
//压缩条目不是具体独立的文件,而是压缩包文件列表中的列表项,称为条目,就像索引一样
|
||||
ZipEntry zipEntry = new ZipEntry(file.getName());
|
||||
@@ -171,11 +173,11 @@ public class DownLoadController {
|
||||
int read = 0;
|
||||
//创建读写缓冲区
|
||||
byte[] buf = new byte[1024 * 10];
|
||||
while((read = bufferStream.read(buf, 0, 1024 * 10)) != -1)
|
||||
{
|
||||
while ((read = bufferStream.read(buf, 0, 1024 * 10)) != -1) {
|
||||
zipStream.write(buf, 0, read);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -226,6 +228,7 @@ public class DownLoadController {
|
||||
|
||||
/**
|
||||
* 获取目录下所有文件的路径
|
||||
*
|
||||
* @param fileDir
|
||||
* @return
|
||||
*/
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
/*@Configuration*/
|
||||
@Configuration
|
||||
public class WebAppConfig implements WebMvcConfigurer {
|
||||
|
||||
/**
|
||||
|
||||
@@ -62,7 +62,7 @@ var Main = {
|
||||
},
|
||||
methods: {
|
||||
uploadURL(row) {
|
||||
return getRootPath_web()+"/moreUpload?rename=false";
|
||||
return getRootPath_web()+"/home/moreUpload?rename=false";
|
||||
},
|
||||
submitUpload() {
|
||||
this.$refs.upload.submit();
|
||||
|
||||
@@ -200,7 +200,7 @@ var Main = {
|
||||
methods: {
|
||||
getFileList(){
|
||||
let that = this;
|
||||
axios.get(getRootPath_web()+'/download/findone')
|
||||
axios.get(getRootPath_web()+'/home/download/findone')
|
||||
.then(function (response) {
|
||||
//console.log(response.data);
|
||||
that.DownloadList = response.data;
|
||||
@@ -230,7 +230,7 @@ var Main = {
|
||||
});
|
||||
},
|
||||
uploadURL(row) {
|
||||
return getRootPath_web()+"/moreUpload?courseName=" + row.coursename + "&folder=" + row.workfolder+"&rename=true";
|
||||
return getRootPath_web()+"/home/moreUpload?courseName=" + row.coursename + "&folder=" + row.workfolder+"&rename=true";
|
||||
},
|
||||
limitTime(row) {
|
||||
return DateDiff(row.worktime.replace(/([^\s]+)\s.*/, "$1"), cur);
|
||||
@@ -300,7 +300,7 @@ var Main = {
|
||||
},
|
||||
handleDownload(row) {
|
||||
/*var url = window.location.protocol+"://"+window.location.host+":"+window.location.port+"/"*/
|
||||
window.open(getRootPath_web()+"/download/dodownload?fileId=" + row.colfileid);
|
||||
window.open(getRootPath_web()+"/home/download/dodownload?fileId=" + row.colfileid);
|
||||
},
|
||||
handleDelete(row) {
|
||||
let that = this;
|
||||
|
||||
@@ -51,14 +51,6 @@ var Main = {
|
||||
.catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
axios.get(getRootPath_web()+'/home/findallvhomework')
|
||||
.then(function (response) {
|
||||
console.log(response.data);
|
||||
that.homeworkData = response.data;
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
@@ -111,7 +103,7 @@ var Main = {
|
||||
},
|
||||
handleDownload(row) {
|
||||
/*var url = window.location.protocol+"://"+window.location.host+":"+window.location.port+"/"*/
|
||||
window.open(getRootPath_web()+"/download/downloadzip?courseName="
|
||||
window.open(getRootPath_web()+"/home/admin/download/downloadzip?courseName="
|
||||
+ row.courseName+"&Folder="+row.folder);
|
||||
},
|
||||
handleSelect(key, keyPath) {
|
||||
|
||||
Reference in New Issue
Block a user