修改文件导出

This commit is contained in:
haozq 2024-09-09 11:23:20 +08:00
parent 315f81b22a
commit b7201ffd54
2 changed files with 8 additions and 4 deletions

View File

@ -114,7 +114,7 @@ public class SysLogController extends BaseController {
try {
String dateTimeNow=exportSqlService.export("2");
String path=filePath + ExportSqlService.TABLE_NAME + dateTimeNow+ SystemGlobal.TEXT_FIX;
WordUtils.fileDown(path, "sys_log"+ dateTimeNow+".sql",response);
WordUtils.fileDown(path, "sys_log"+ dateTimeNow+SystemGlobal.TEXT_FIX,response);
} catch (Exception e) {
logger.error("文件下载失败", e);
}
@ -127,7 +127,7 @@ public class SysLogController extends BaseController {
try {
String dateTimeNow=exportSqlService.export("1");
String path=filePath + ExportSqlService.TABLE_NAME + dateTimeNow+ SystemGlobal.TEXT_FIX;
WordUtils.fileDown(path, "sys_log"+ dateTimeNow+".sql",response);
WordUtils.fileDown(path, "sys_log"+ dateTimeNow+SystemGlobal.TEXT_FIX,response);
} catch (Exception e) {
logger.error("文件下载失败", e);
}
@ -140,7 +140,7 @@ public class SysLogController extends BaseController {
try {
String dateTimeNow=exportSqlService.export("0");
String path=filePath + ExportSqlService.TABLE_NAME + dateTimeNow+ SystemGlobal.TEXT_FIX;
WordUtils.fileDown(path, "sys_log"+ dateTimeNow+".sql",response);
WordUtils.fileDown(path, "sys_log"+ dateTimeNow+SystemGlobal.TEXT_FIX,response);
} catch (Exception e) {
logger.error("文件下载失败", e);
}

View File

@ -47,7 +47,11 @@ public class ExportSqlService {
@SneakyThrows
public String export(String logType ) {
File folder = new File(filePath);
if (folder.exists() && folder.isDirectory()) {
} else {
folder.mkdir();
}
String dateTimeNow=DateTimeHelper.dateTimeNow();
String path=filePath + TABLE_NAME + dateTimeNow;