fix: 导出文件按日期命名

文件名从 dl.suggestedFilename() 改为 "三联单列表_yyyyMMdd.xls"

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Niko 2026-05-05 15:13:08 +08:00
parent ea0f566e12
commit 0d43fbbfbb

View File

@ -158,7 +158,8 @@ public class EtsScraper {
page.evaluate("document.querySelectorAll('button').forEach(b => { if (b.textContent.trim() === '导出') b.click(); })");
});
System.out.println("[*] Waiting for download to complete...");
Path savedFile = downloadPath.resolve(dl.suggestedFilename());
String dateStr = yesterday.format(DateTimeFormatter.ofPattern("yyyyMMdd"));
Path savedFile = downloadPath.resolve("三联单列表_" + dateStr + ".xls");
dl.saveAs(savedFile);
System.out.println("[+] Download saved to: " + savedFile);
if (java.nio.file.Files.size(savedFile) == 0) {