From 434138d49775e2d712e4b2aaf9fd16492836e4f9 Mon Sep 17 00:00:00 2001 From: zhanglei Date: Wed, 16 Aug 2023 11:41:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=81=E4=BF=A1pboc=E5=AF=B9=E6=8E=A5-?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AD=98=E5=82=A8=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/tenwa/httpclient/pboc/FileUtils.java | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) 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();