diff --git a/src_tenwa/com/tenwa/httpclient/pboc/FileUtils.java b/src_tenwa/com/tenwa/httpclient/pboc/FileUtils.java index 85753e9c9..90f086ecf 100644 --- a/src_tenwa/com/tenwa/httpclient/pboc/FileUtils.java +++ b/src_tenwa/com/tenwa/httpclient/pboc/FileUtils.java @@ -1,9 +1,13 @@ package com.tenwa.httpclient.pboc; +import com.tenwa.reckon.util.DateUtils; import org.apache.commons.codec.binary.Base64; + import java.io.File; import java.io.FileOutputStream; import java.io.PrintStream; +import java.text.SimpleDateFormat; +import java.util.Date; public class FileUtils { @@ -17,7 +21,13 @@ public class FileUtils { public static String createXMLFile(String filePath, String reportId, String resXMLReportStr) throws Exception { // TODO: 2023/1/31 文件地址修改 // String xmlFilePath = filePath + "\\xmlHtml\\"+ reportId +".xml"; - String xmlFilePath = filePath + "/xmlHtml/"+ reportId +".xml"; + SimpleDateFormat timeFormat = new SimpleDateFormat("yyyyMM"); + filePath = filePath + "/report/"+timeFormat.format(new Date())+ "/"; + File targetFolder = new File(filePath); + if (!targetFolder.exists()) { + targetFolder.mkdirs(); + } + String xmlFilePath = filePath + reportId +".xml"; // TODO: 2023/1/31 写入xml文件 File xmlFile = new File(xmlFilePath); xmlFile.createNewFile(); @@ -37,7 +47,13 @@ public class FileUtils { byte[] byteData = new Base64().decode(htmlRptDataStr); // TODO: 2023/1/31 文件地址修改 // String htmlFilePath = filePath + "\\xmlHtml\\"+ reportId +".html"; - String htmlFilePath = filePath + "/xmlHtml/"+ reportId +".html"; + SimpleDateFormat timeFormat = new SimpleDateFormat("yyyyMM"); + filePath = filePath + "/report/"+timeFormat.format(new Date())+ "/"; + File targetFolder = new File(filePath); + if (!targetFolder.exists()) { + targetFolder.mkdirs(); + } + String htmlFilePath = filePath + reportId +".html"; // TODO: 2023/1/31 html内容写入html文件 File htmlFile = new File(htmlFilePath); htmlFile.createNewFile();