|
@@ -66,8 +66,9 @@ public class ApplyProjectService {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public void batchDownloadFiles(BatchDownloadFilesRequest request, HttpServletResponse response) {
|
|
public void batchDownloadFiles(BatchDownloadFilesRequest request, HttpServletResponse response) {
|
|
- String filePrefix = "";
|
|
|
|
- String rootPrefix = "";
|
|
|
|
|
|
+ int number = (int) (Math.random() * 1000);
|
|
|
|
+ String filePrefix = APPLY_PROJECT_FILE_PATH + number + "/";
|
|
|
|
+ String rootPrefix = APPLY_PROJECT_ROOT_PATH + number + "/";
|
|
try {
|
|
try {
|
|
// 1、先根据从前端选择的条件去数据库查找对应的记录
|
|
// 1、先根据从前端选择的条件去数据库查找对应的记录
|
|
Map<String, String> item = new HashMap<>();
|
|
Map<String, String> item = new HashMap<>();
|
|
@@ -83,9 +84,6 @@ public class ApplyProjectService {
|
|
MarketingImage image = marketingImageList.get(i);
|
|
MarketingImage image = marketingImageList.get(i);
|
|
item.put(i+"_"+image.getName(), image.getImageUrl());
|
|
item.put(i+"_"+image.getName(), image.getImageUrl());
|
|
}
|
|
}
|
|
- int number = (int) (Math.random() * 1000);
|
|
|
|
- filePrefix = APPLY_PROJECT_FILE_PATH + number + "/";
|
|
|
|
- rootPrefix = APPLY_PROJECT_ROOT_PATH + number + "/";
|
|
|
|
|
|
|
|
// 2、遍历记录去下载对应的文件到服务器;
|
|
// 2、遍历记录去下载对应的文件到服务器;
|
|
List<String> fileUrl = new ArrayList<>();
|
|
List<String> fileUrl = new ArrayList<>();
|
|
@@ -100,11 +98,10 @@ public class ApplyProjectService {
|
|
downloadSingleFile(urlLink, pathName);
|
|
downloadSingleFile(urlLink, pathName);
|
|
fileUrl.add(pathName);
|
|
fileUrl.add(pathName);
|
|
}
|
|
}
|
|
-
|
|
|
|
// 3、将下载的文件打包
|
|
// 3、将下载的文件打包
|
|
String zipFileName = "资料";
|
|
String zipFileName = "资料";
|
|
- if (!Checker.isNone(request.getUploadTimeStart()) && !Checker.isNone(request.getUploadTimeEnd())) {
|
|
|
|
- zipFileName += request.getUploadTimeStart().replace("-", "") + "~" + request.getUploadTimeEnd().replace("-", "");
|
|
|
|
|
|
+ if (!Checker.isNone(request.getCreateTimeStart()) && !Checker.isNone(request.getCreateTimeEnd())) {
|
|
|
|
+ zipFileName += request.getCreateTimeStart().replace("-", "") + "~" + request.getCreateTimeEnd().replace("-", "");
|
|
}
|
|
}
|
|
zipFileName += ".zip";
|
|
zipFileName += ".zip";
|
|
FileUtil.createFoldersIfNotExit(rootPrefix + zipFileName);
|
|
FileUtil.createFoldersIfNotExit(rootPrefix + zipFileName);
|
|
@@ -116,8 +113,8 @@ public class ApplyProjectService {
|
|
logger.error("ApplyProjectService#batchDownloadFiles(request:{}){}", JsonSerializer.toJson(request), e.getMessage(), e);
|
|
logger.error("ApplyProjectService#batchDownloadFiles(request:{}){}", JsonSerializer.toJson(request), e.getMessage(), e);
|
|
} finally {
|
|
} finally {
|
|
// 5、删掉之前所有的文件;
|
|
// 5、删掉之前所有的文件;
|
|
- FileUtil.deleteFolders(filePrefix);
|
|
|
|
- FileUtil.deleteFolders(rootPrefix);
|
|
|
|
|
|
+// FileUtil.deleteFolders(filePrefix);
|
|
|
|
+// FileUtil.deleteFolders(rootPrefix);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -134,13 +131,13 @@ public class ApplyProjectService {
|
|
String formatDate = "yyyy-MM-dd";
|
|
String formatDate = "yyyy-MM-dd";
|
|
SimpleDateFormat format = new SimpleDateFormat(formatDate);
|
|
SimpleDateFormat format = new SimpleDateFormat(formatDate);
|
|
try {
|
|
try {
|
|
- String createTime = request.getUploadTimeStart();
|
|
|
|
|
|
+ String createTime = request.getCreateTimeStart();
|
|
if (!Checker.isNull(createTime)) {
|
|
if (!Checker.isNull(createTime)) {
|
|
whereSql += " and (create_time >= ?)";
|
|
whereSql += " and (create_time >= ?)";
|
|
Date date = format.parse(createTime);
|
|
Date date = format.parse(createTime);
|
|
paramList.add(date);
|
|
paramList.add(date);
|
|
}
|
|
}
|
|
- String createEndTime = request.getUploadTimeEnd();
|
|
|
|
|
|
+ String createEndTime = request.getCreateTimeEnd();
|
|
if (!Checker.isNull(createEndTime)) {
|
|
if (!Checker.isNull(createEndTime)) {
|
|
whereSql += " and ( create_time < ? )";
|
|
whereSql += " and ( create_time < ? )";
|
|
Date date = format.parse(createEndTime);
|
|
Date date = format.parse(createEndTime);
|