init:微信账单下载到本地

This commit is contained in:
Yuan
2025-12-23 09:29:57 +08:00
parent b0817ee3d5
commit d113ff8827

View File

@@ -921,6 +921,23 @@ public class GetDateController {
return responseMap;
}
// 将原始账单内容落地,便于后续人工核对或重复导入
try {
File csvFile = FileUtil.file(localPath, trade_date + ".csv");
File txtFile = FileUtil.file(localPath, trade_date + ".txt");
FileUtil.mkParentDirs(csvFile);
FileUtil.writeUtf8String(body1, csvFile);
FileUtil.writeUtf8String(body1, txtFile);
log.info("微信账单已保存到本地: {}, {}", csvFile.getAbsolutePath(), txtFile.getAbsolutePath());
} catch (IORuntimeException e) {
log.error("微信账单保存本地失败,路径: {}, 错误: {}", localPath, e.getMessage(), e);
errCode = "999";
errMsg = "微信账单保存本地失败:" + e.getMessage();
responseMap.put("errCode", errCode);
responseMap.put("errMsg", errMsg);
return responseMap;
}
String[] split = body1.split("\n");
for (int i = 1; i < split.length - 2; i++) {
String[] split1 = split[i].split(",");