From dbfa72c8c6bb0cfb73b1b1cbfb5a2c6d61fd7329 Mon Sep 17 00:00:00 2001 From: "Bruce.Deng" Date: Thu, 16 Jul 2020 10:49:12 +0800 Subject: [PATCH 1/4] =?UTF-8?q?REPORT-35537=20=E8=B0=83=E7=94=A8=E5=AF=BC?= =?UTF-8?q?=E5=87=BAapi=EF=BC=8C=E6=8E=A7=E5=88=B6=E5=8F=B0=E6=8A=A5?= =?UTF-8?q?=E9=94=99NPE:fine=20module=20health=20clinic=20is=20null?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/fr/io/ExportApi.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/fr/io/ExportApi.java b/src/main/java/com/fr/io/ExportApi.java index 084a50b..c858618 100644 --- a/src/main/java/com/fr/io/ExportApi.java +++ b/src/main/java/com/fr/io/ExportApi.java @@ -7,6 +7,7 @@ import com.fr.config.activator.BaseDBActivator; import com.fr.config.activator.ConfigurationActivator; import com.fr.env.operator.CommonOperatorImpl; import com.fr.general.I18nResource; +import com.fr.health.activator.ModuleHealActivator; import com.fr.io.exporter.excel.stream.StreamExcel2007Exporter; import com.fr.main.impl.WorkBook; import com.fr.main.workbook.ResultWorkBook; @@ -31,6 +32,7 @@ public class ExportApi { Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(), new ConfigurationActivator(), new StandaloneModeActivator(), + new ModuleHealActivator(), new StateServiceActivator(), new SchedulerActivator(), new ReportBaseActivator(), From 81ff64e7042e7a3bd883d4648068766139db3846 Mon Sep 17 00:00:00 2001 From: "Bruce.Deng" Date: Thu, 16 Jul 2020 11:04:58 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=EF=BC=8C?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E5=90=AF=E5=8A=A8=E5=8A=A0=E4=B8=8AModuleHea?= =?UTF-8?q?lActivator=E9=81=BF=E5=85=8DNPE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/fr/demo/SaveReportToDatabase.java | 2 ++ src/main/java/com/fr/function/ReportCheck.java | 2 ++ src/main/java/com/fr/io/CreateGenericTemplate.java | 2 ++ src/main/java/com/fr/io/ExcelToCpt.java | 2 ++ src/main/java/com/fr/io/ExcuteDemo.java | 2 ++ src/main/java/com/fr/io/ExportApi_frm.java | 2 ++ src/main/java/com/fr/io/ExportBatch.java | 2 ++ src/main/java/com/fr/io/ExportExcel.java | 2 ++ src/main/java/com/fr/io/ExportReports.java | 2 ++ src/main/java/com/fr/io/JavaPrint.java | 2 ++ src/main/java/com/fr/io/SaveReportToDatabase.java | 2 ++ src/main/java/com/fr/io/SetParameterWindow.java | 2 ++ src/main/java/com/fr/io/SimpleDemo.java | 2 ++ src/test/main/java/com/fr/demo/ExportApiTest.java | 1 + src/test/main/java/com/fr/demo/ModuleStartTest.java | 1 + 15 files changed, 28 insertions(+) diff --git a/src/main/java/com/fr/demo/SaveReportToDatabase.java b/src/main/java/com/fr/demo/SaveReportToDatabase.java index 6ec5ce7..4905df5 100644 --- a/src/main/java/com/fr/demo/SaveReportToDatabase.java +++ b/src/main/java/com/fr/demo/SaveReportToDatabase.java @@ -7,6 +7,7 @@ import com.fr.config.activator.BaseDBActivator; import com.fr.config.activator.ConfigurationActivator; import com.fr.env.operator.CommonOperatorImpl; import com.fr.general.I18nResource; +import com.fr.health.activator.ModuleHealActivator; import com.fr.module.Module; import com.fr.module.tool.ActivatorToolBox; import com.fr.report.ReportActivator; @@ -35,6 +36,7 @@ public class SaveReportToDatabase { Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(), new ConfigurationActivator(), new StandaloneModeActivator(), + new ModuleHealActivator(), new StateServiceActivator(), new ChartBaseActivator(), new SchedulerActivator(), diff --git a/src/main/java/com/fr/function/ReportCheck.java b/src/main/java/com/fr/function/ReportCheck.java index b10465b..907da1b 100644 --- a/src/main/java/com/fr/function/ReportCheck.java +++ b/src/main/java/com/fr/function/ReportCheck.java @@ -9,6 +9,7 @@ import com.fr.config.activator.BaseDBActivator; import com.fr.config.activator.ConfigurationActivator; import com.fr.env.operator.CommonOperatorImpl; import com.fr.general.I18nResource; +import com.fr.health.activator.ModuleHealActivator; import com.fr.io.TemplateWorkBookIO; import com.fr.json.JSONArray; import com.fr.json.JSONObject; @@ -45,6 +46,7 @@ public class ReportCheck extends AbstractFunction { Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(), new ConfigurationActivator(), new StandaloneModeActivator(), + new ModuleHealActivator(), new StateServiceActivator(), new ChartBaseActivator(), new SchedulerActivator(), diff --git a/src/main/java/com/fr/io/CreateGenericTemplate.java b/src/main/java/com/fr/io/CreateGenericTemplate.java index cb4c296..55a8558 100644 --- a/src/main/java/com/fr/io/CreateGenericTemplate.java +++ b/src/main/java/com/fr/io/CreateGenericTemplate.java @@ -11,6 +11,7 @@ import com.fr.data.impl.NameDatabaseConnection; import com.fr.env.operator.CommonOperatorImpl; import com.fr.general.I18nResource; import com.fr.general.data.TableDataColumn; +import com.fr.health.activator.ModuleHealActivator; import com.fr.main.impl.WorkBook; import com.fr.module.Module; import com.fr.module.tool.ActivatorToolBox; @@ -37,6 +38,7 @@ public class CreateGenericTemplate { Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(), new ConfigurationActivator(), new StandaloneModeActivator(), + new ModuleHealActivator(), new StateServiceActivator(), new ChartBaseActivator(), new SchedulerActivator(), diff --git a/src/main/java/com/fr/io/ExcelToCpt.java b/src/main/java/com/fr/io/ExcelToCpt.java index f829510..0ab1d9b 100644 --- a/src/main/java/com/fr/io/ExcelToCpt.java +++ b/src/main/java/com/fr/io/ExcelToCpt.java @@ -7,6 +7,7 @@ import com.fr.config.activator.BaseDBActivator; import com.fr.config.activator.ConfigurationActivator; import com.fr.env.operator.CommonOperatorImpl; import com.fr.general.I18nResource; +import com.fr.health.activator.ModuleHealActivator; import com.fr.io.importer.Excel2007ReportImporter; import com.fr.main.TemplateWorkBook; import com.fr.main.impl.WorkBook; @@ -32,6 +33,7 @@ public class ExcelToCpt { Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(), new ConfigurationActivator(), new StandaloneModeActivator(), + new ModuleHealActivator(), new StateServiceActivator(), new ChartBaseActivator(), new SchedulerActivator(), diff --git a/src/main/java/com/fr/io/ExcuteDemo.java b/src/main/java/com/fr/io/ExcuteDemo.java index 0b2c45f..91124de 100644 --- a/src/main/java/com/fr/io/ExcuteDemo.java +++ b/src/main/java/com/fr/io/ExcuteDemo.java @@ -7,6 +7,7 @@ import com.fr.config.activator.BaseDBActivator; import com.fr.config.activator.ConfigurationActivator; import com.fr.env.operator.CommonOperatorImpl; import com.fr.general.I18nResource; +import com.fr.health.activator.ModuleHealActivator; import com.fr.io.exporter.ExcelExporter; import com.fr.main.TemplateWorkBook; import com.fr.main.workbook.ResultWorkBook; @@ -33,6 +34,7 @@ public class ExcuteDemo { Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(), new ConfigurationActivator(), new StandaloneModeActivator(), + new ModuleHealActivator(), new StateServiceActivator(), new ChartBaseActivator(), new SchedulerActivator(), diff --git a/src/main/java/com/fr/io/ExportApi_frm.java b/src/main/java/com/fr/io/ExportApi_frm.java index 16734eb..0674938 100644 --- a/src/main/java/com/fr/io/ExportApi_frm.java +++ b/src/main/java/com/fr/io/ExportApi_frm.java @@ -8,6 +8,7 @@ import com.fr.config.activator.ConfigurationActivator; import com.fr.env.operator.CommonOperatorImpl; import com.fr.form.export.FormToWBExecutor; import com.fr.general.I18nResource; +import com.fr.health.activator.ModuleHealActivator; import com.fr.io.exporter.ImageExporter; import com.fr.io.exporter.PDFExporter; import com.fr.io.exporter.excel.stream.StreamExcel2007Exporter; @@ -31,6 +32,7 @@ public class ExportApi_frm { Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(), new ConfigurationActivator(), new StandaloneModeActivator(), + new ModuleHealActivator(), new StateServiceActivator(), new SchedulerActivator(), new ReportBaseActivator(), diff --git a/src/main/java/com/fr/io/ExportBatch.java b/src/main/java/com/fr/io/ExportBatch.java index 0f78eb2..392bb66 100644 --- a/src/main/java/com/fr/io/ExportBatch.java +++ b/src/main/java/com/fr/io/ExportBatch.java @@ -7,6 +7,7 @@ import com.fr.config.activator.BaseDBActivator; import com.fr.config.activator.ConfigurationActivator; import com.fr.env.operator.CommonOperatorImpl; import com.fr.general.I18nResource; +import com.fr.health.activator.ModuleHealActivator; import com.fr.io.exporter.ExcelExporter; import com.fr.main.TemplateWorkBook; import com.fr.main.workbook.ResultWorkBook; @@ -38,6 +39,7 @@ public class ExportBatch { Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(), new ConfigurationActivator(), new StandaloneModeActivator(), + new ModuleHealActivator(), new StateServiceActivator(), new ChartBaseActivator(), new SchedulerActivator(), diff --git a/src/main/java/com/fr/io/ExportExcel.java b/src/main/java/com/fr/io/ExportExcel.java index a48200c..39d6d4e 100644 --- a/src/main/java/com/fr/io/ExportExcel.java +++ b/src/main/java/com/fr/io/ExportExcel.java @@ -8,6 +8,7 @@ import com.fr.config.activator.BaseDBActivator; import com.fr.config.activator.ConfigurationActivator; import com.fr.env.operator.CommonOperatorImpl; import com.fr.general.I18nResource; +import com.fr.health.activator.ModuleHealActivator; import com.fr.io.exporter.ExcelExporter; import com.fr.io.exporter.LargeDataPageExcelExporter; import com.fr.io.exporter.PageExcel2007Exporter; @@ -40,6 +41,7 @@ public class ExportExcel { Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(), new ConfigurationActivator(), new StandaloneModeActivator(), + new ModuleHealActivator(), new StateServiceActivator(), new ChartBaseActivator(), new SchedulerActivator(), diff --git a/src/main/java/com/fr/io/ExportReports.java b/src/main/java/com/fr/io/ExportReports.java index e70f58d..ded0225 100644 --- a/src/main/java/com/fr/io/ExportReports.java +++ b/src/main/java/com/fr/io/ExportReports.java @@ -8,6 +8,7 @@ import com.fr.config.activator.BaseDBActivator; import com.fr.config.activator.ConfigurationActivator; import com.fr.env.operator.CommonOperatorImpl; import com.fr.general.I18nResource; +import com.fr.health.activator.ModuleHealActivator; import com.fr.io.exporter.PageExcelExporter; import com.fr.main.TemplateWorkBook; import com.fr.main.workbook.PageWorkBook; @@ -35,6 +36,7 @@ public class ExportReports { Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(), new ConfigurationActivator(), new StandaloneModeActivator(), + new ModuleHealActivator(), new StateServiceActivator(), new ChartBaseActivator(), new SchedulerActivator(), diff --git a/src/main/java/com/fr/io/JavaPrint.java b/src/main/java/com/fr/io/JavaPrint.java index 5468214..f9b65ba 100644 --- a/src/main/java/com/fr/io/JavaPrint.java +++ b/src/main/java/com/fr/io/JavaPrint.java @@ -8,6 +8,7 @@ import com.fr.config.activator.BaseDBActivator; import com.fr.config.activator.ConfigurationActivator; import com.fr.env.operator.CommonOperatorImpl; import com.fr.general.I18nResource; +import com.fr.health.activator.ModuleHealActivator; import com.fr.main.TemplateWorkBook; import com.fr.module.Module; import com.fr.module.tool.ActivatorToolBox; @@ -29,6 +30,7 @@ public class JavaPrint { Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(), new ConfigurationActivator(), new StandaloneModeActivator(), + new ModuleHealActivator(), new StateServiceActivator(), new ChartBaseActivator(), new SchedulerActivator(), diff --git a/src/main/java/com/fr/io/SaveReportToDatabase.java b/src/main/java/com/fr/io/SaveReportToDatabase.java index eb20c5f..161f6ba 100644 --- a/src/main/java/com/fr/io/SaveReportToDatabase.java +++ b/src/main/java/com/fr/io/SaveReportToDatabase.java @@ -7,6 +7,7 @@ import com.fr.config.activator.BaseDBActivator; import com.fr.config.activator.ConfigurationActivator; import com.fr.env.operator.CommonOperatorImpl; import com.fr.general.I18nResource; +import com.fr.health.activator.ModuleHealActivator; import com.fr.module.Module; import com.fr.module.tool.ActivatorToolBox; import com.fr.report.ReportActivator; @@ -45,6 +46,7 @@ public class SaveReportToDatabase { Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(), new ConfigurationActivator(), new StandaloneModeActivator(), + new ModuleHealActivator(), new StateServiceActivator(), new ChartBaseActivator(), new SchedulerActivator(), diff --git a/src/main/java/com/fr/io/SetParameterWindow.java b/src/main/java/com/fr/io/SetParameterWindow.java index 3da477a..5ec569f 100644 --- a/src/main/java/com/fr/io/SetParameterWindow.java +++ b/src/main/java/com/fr/io/SetParameterWindow.java @@ -9,6 +9,7 @@ import com.fr.config.activator.ConfigurationActivator; import com.fr.env.operator.CommonOperatorImpl; import com.fr.general.Background; import com.fr.general.I18nResource; +import com.fr.health.activator.ModuleHealActivator; import com.fr.io.exporter.EmbeddedTableDataExporter; import com.fr.main.impl.WorkBook; import com.fr.main.parameter.ReportParameterAttr; @@ -33,6 +34,7 @@ public class SetParameterWindow { Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(), new ConfigurationActivator(), new StandaloneModeActivator(), + new ModuleHealActivator(), new StateServiceActivator(), new ChartBaseActivator(), new SchedulerActivator(), diff --git a/src/main/java/com/fr/io/SimpleDemo.java b/src/main/java/com/fr/io/SimpleDemo.java index 308a1c1..669f291 100644 --- a/src/main/java/com/fr/io/SimpleDemo.java +++ b/src/main/java/com/fr/io/SimpleDemo.java @@ -9,6 +9,7 @@ import com.fr.config.activator.ConfigurationActivator; import com.fr.env.operator.CommonOperatorImpl; import com.fr.general.FRFont; import com.fr.general.I18nResource; +import com.fr.health.activator.ModuleHealActivator; import com.fr.main.impl.WorkBook; import com.fr.module.Module; import com.fr.module.tool.ActivatorToolBox; @@ -33,6 +34,7 @@ public class SimpleDemo { Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(), new ConfigurationActivator(), new StandaloneModeActivator(), + new ModuleHealActivator(), new StateServiceActivator(), new ChartBaseActivator(), new SchedulerActivator(), diff --git a/src/test/main/java/com/fr/demo/ExportApiTest.java b/src/test/main/java/com/fr/demo/ExportApiTest.java index 19029e2..b73b508 100644 --- a/src/test/main/java/com/fr/demo/ExportApiTest.java +++ b/src/test/main/java/com/fr/demo/ExportApiTest.java @@ -43,6 +43,7 @@ public class ExportApiTest extends TestCase { Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(), new ConfigurationActivator(), new StandaloneModeActivator(), + new ModuleHealActivator(), new StateServiceActivator(), new ChartBaseActivator(), new SchedulerActivator(), diff --git a/src/test/main/java/com/fr/demo/ModuleStartTest.java b/src/test/main/java/com/fr/demo/ModuleStartTest.java index 034184f..cf376c1 100644 --- a/src/test/main/java/com/fr/demo/ModuleStartTest.java +++ b/src/test/main/java/com/fr/demo/ModuleStartTest.java @@ -65,6 +65,7 @@ public class ModuleStartTest extends TestCase { Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(), new ConfigurationActivator(), new StandaloneModeActivator(), + new ModuleHealActivator(), new StateServiceActivator(), new ChartBaseActivator(), new SchedulerActivator(), From 7453e186990eeb3ef445995e1ba2e0433bc983ef Mon Sep 17 00:00:00 2001 From: "Bruce.Deng" Date: Fri, 17 Jul 2020 10:21:38 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=EF=BC=8C?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/fr/io/ExportApi.java | 154 ++++++++++++++++--------- 1 file changed, 97 insertions(+), 57 deletions(-) diff --git a/src/main/java/com/fr/io/ExportApi.java b/src/main/java/com/fr/io/ExportApi.java index c858618..b4a43e5 100644 --- a/src/main/java/com/fr/io/ExportApi.java +++ b/src/main/java/com/fr/io/ExportApi.java @@ -7,11 +7,13 @@ import com.fr.config.activator.BaseDBActivator; import com.fr.config.activator.ConfigurationActivator; import com.fr.env.operator.CommonOperatorImpl; import com.fr.general.I18nResource; +import com.fr.general.log.Log4jConfig; +import com.fr.general.log.parser.ExtraPatternParserManager; import com.fr.health.activator.ModuleHealActivator; +import com.fr.io.TemplateWorkBookIO; +import com.fr.io.exporter.*; import com.fr.io.exporter.excel.stream.StreamExcel2007Exporter; import com.fr.main.impl.WorkBook; -import com.fr.main.workbook.ResultWorkBook; -import com.fr.module.Module; import com.fr.module.tool.ActivatorToolBox; import com.fr.report.ReportActivator; import com.fr.report.RestrictionActivator; @@ -19,20 +21,31 @@ import com.fr.report.module.ReportBaseActivator; import com.fr.report.write.WriteActivator; import com.fr.scheduler.SchedulerActivator; import com.fr.stable.WriteActor; +import com.fr.stable.resource.ResourceLoader; import com.fr.store.StateServiceActivator; +import com.fr.third.apache.log4j.Level; +import com.fr.third.apache.log4j.PropertyConfigurator; import com.fr.workspace.simple.SimpleWork; -import java.io.File; import java.io.FileOutputStream; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; public class ExportApi { + public static void main(String[] args) { - // 定义报表运行环境,用于执行报表 - Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(), + + initLog4j(); + + /**定义报表运行环境,用于执行报表*/ + com.fr.module.Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(), new ConfigurationActivator(), new StandaloneModeActivator(), new ModuleHealActivator(), + //2020.4.26jar包之前的版本,替换成StateServerActivator() new StateServiceActivator(), new SchedulerActivator(), new ReportBaseActivator(), @@ -41,67 +54,73 @@ public class ExportApi { new WriteActivator(), new ChartBaseActivator()); SimpleWork.supply(CommonOperator.class, new CommonOperatorImpl()); - String envpath = "E:\\默认工程\\webroot\\WEB-INF\\";//工程路径 + //定义工程路径 + String envpath = "D:\\javatools\\FineReport_10.0\\webapps\\webroot\\WEB-INF\\"; SimpleWork.checkIn(envpath); I18nResource.getInstance(); module.start(); - - ResultWorkBook rworkbook = null; + /**输出模板*/ try { - // 未执行模板工作薄 - WorkBook workbook = (WorkBook) TemplateWorkBookIO - .readTemplateWorkBook("test.cpt"); - // 获取报表参数并设置值,导出内置数据集时数据集会根据参数值查询出结果从而转为内置数据集 -// Parameter[] parameters = workbook.getParameters(); -// parameters[0].setValue("华东"); - // 定义parametermap用于执行报表,将执行后的结果工作薄保存为rworkBook - java.util.Map parameterMap = new java.util.HashMap(); -// for (int i = 0; i < parameters.length; i++) { -// parameterMap.put(parameters[i].getName(), parameters[i] -// .getValue()); -// } + // 定义输出的模板路径,以reportlets为根目录 + WorkBook workbook = (WorkBook) TemplateWorkBookIO.readTemplateWorkBook("GettingStarted.cpt"); + // 设置传入的参数 + Map parameterMap = new HashMap(); + parameterMap.put("地区","华东"); + // 定义输出流 FileOutputStream outputStream; -// // 将未执行模板工作薄导出为内置数据集模板 -// outputStream = new FileOutputStream(new File("/Users//susie//Downloads//EmbExport.cpt")); -// EmbeddedTableDataExporter templateExporter = new EmbeddedTableDataExporter(); -// templateExporter.export(outputStream, workbook); -// // 将模板工作薄导出模板文件,在导出前您可以编辑导入的模板工作薄,可参考报表调用章节 -// outputStream = new FileOutputStream(new File("/Users//susie//Downloads//TmpExport.cpt")); -// ((WorkBook) workbook).export(outputStream); -// // 将结果工作薄导出为2003Excel文件 -// outputStream = new FileOutputStream(new File("/Users//susie//Downloads//ExcelExport.xls")); -// ExcelExporter ExcelExport = new ExcelExporter(); -// ExcelExport.export(outputStream, workbook.execute(parameterMap, new WriteActor())); - // 将结果工作薄导出为Excel文件 - outputStream = new FileOutputStream(new File("D://tttt//1528.xlsx")); + String outputUrl="F:\\io\\WorkBook\\"; + + /**将模板工作薄导出为内置数据集模板文件*/ + outputStream = new FileOutputStream(new java.io.File(outputUrl+"EmbExport.cpt")); + EmbeddedTableDataExporter templateExporter = new EmbeddedTableDataExporter(); + templateExporter.export(outputStream, workbook); + + /**将模板工作薄导出为模板文件*/ + outputStream = new FileOutputStream(new java.io.File(outputUrl+"TmpExport.cpt")); + ((WorkBook) workbook).export(outputStream); + + /**将结果工作薄导出为2003Excel文件*/ + outputStream = new FileOutputStream(new java.io.File(outputUrl+"ExcelExport2003.xls")); + ExcelExporter ExcelExport = new ExcelExporter(); + ExcelExport.export(outputStream, workbook.execute(parameterMap, new WriteActor())); + + /**将结果工作薄导出为2007Excel文件*/ + outputStream = new FileOutputStream(new java.io.File(outputUrl+"ExcelExport2007.xlsx")); StreamExcel2007Exporter ExcelExport1 = new StreamExcel2007Exporter(); ExcelExport1.export(outputStream, workbook.execute(parameterMap, new WriteActor())); -// // 将结果工作薄导出为Word文件 -// outputStream = new FileOutputStream(new File("/Users//susie//Downloads//WordExport.doc")); -// WordExporter WordExport = new WordExporter(); -// WordExport.export(outputStream, workbook.execute(parameterMap, new WriteActor())); -// // 将结果工作薄导出为Pdf文件 -// outputStream = new FileOutputStream(new File("/Users//susie//Downloads//PdfExport.pdf")); -// PDFExporter PdfExport = new PDFExporter(); -// PdfExport.export(outputStream, workbook.execute(parameterMap, new WriteActor())); -// // 将结果工作薄导出为Txt文件(txt文件本身不支持表格、图表等,被导出模板一般为明细表) -// outputStream = new FileOutputStream(new File("/Users//susie//Downloads//TxtExport.txt")); -// TextExporter TxtExport = new TextExporter(); -// TxtExport.export(outputStream, workbook.execute(parameterMap, new WriteActor())); -// // 将结果工作薄导出为Csv文件 -// outputStream = new FileOutputStream(new File("/Users//susie//Downloads//CsvExport.csv")); -// CSVExporter CsvExport = new CSVExporter(); -// CsvExport.export(outputStream, workbook.execute(parameterMap, new WriteActor())); -// //将结果工作薄导出为SVG文件 -// outputStream = new FileOutputStream(new File("/Users//susie//Downloads//SvgExport.svg")); -// SVGExporter SvgExport = new SVGExporter(); -// SvgExport.export(outputStream, workbook.execute(parameterMap, new WriteActor())); -// //将结果工作薄导出为image文件 -// outputStream = new FileOutputStream(new File("/Users//susie//Downloads//PngExport.png")); -// ImageExporter ImageExport = new ImageExporter(); -// ImageExport.export(outputStream, workbook.execute(parameterMap, new WriteActor())); + + /**将结果工作薄导出为Word文件*/ + outputStream = new FileOutputStream(new java.io.File(outputUrl+"WordExport.doc")); + WordExporter WordExport = new WordExporter(); + WordExport.export(outputStream, workbook.execute(parameterMap, new WriteActor())); + + /**将结果工作薄导出为Pdf文件*/ + outputStream = new FileOutputStream(new java.io.File(outputUrl+"PdfExport.pdf")); + PDFExporter PdfExport = new PDFExporter(); + PdfExport.export(outputStream, workbook.execute(parameterMap, new WriteActor())); + + /**将结果工作薄导出为Txt文件(txt文件本身不支持表格、图表等,被导出模板一般为明细表)*/ + outputStream = new FileOutputStream(new java.io.File(outputUrl+"TxtExport.txt")); + TextExporter TxtExport = new TextExporter(); + TxtExport.export(outputStream, workbook.execute(parameterMap, new WriteActor())); + + /**将结果工作薄导出为Csv文件*/ + outputStream = new FileOutputStream(new java.io.File(outputUrl+"CsvExport.csv")); + CSVExporter CsvExport = new CSVExporter(); + CsvExport.export(outputStream, workbook.execute(parameterMap, new WriteActor())); + + /**将结果工作薄导出为SVG文件*/ + outputStream = new FileOutputStream(new java.io.File(outputUrl+"SvgExport.svg")); + SVGExporter SvgExport = new SVGExporter(); + SvgExport.export(outputStream, workbook.execute(parameterMap, new WriteActor())); + + /**将结果工作薄导出为image文件*/ + outputStream = new FileOutputStream(new java.io.File(outputUrl+"PngExport.png")); + ImageExporter ImageExport = new ImageExporter(); + ImageExport.export(outputStream, workbook.execute(parameterMap, new WriteActor())); + outputStream.close(); module.stop(); } catch (Exception e) { @@ -110,4 +129,25 @@ public class ExportApi { SimpleWork.checkOut(); } } + + private static void initLog4j() { + + PropertyConfigurator.configure(loadLog4jPropertiesFromJar(Level.toLevel("INFO"))); + } + + private static Properties loadLog4jPropertiesFromJar(Level level) { + + Properties properties = new Properties(); + + System.setProperty("LOG_HOME", System.getProperty("user.dir")); + System.setProperty("LOG_ROOT_LEVEL", level.toString()); + ExtraPatternParserManager.setSystemProperty(); + try { + properties.load(ResourceLoader.getResourceAsStream("/com/fr/general/log/log4j.properties", Log4jConfig.class)); + } catch (IOException ignore) { + //do nothing + } + + return properties; + } } \ No newline at end of file From 872fdb18a9e7de175739198629a2313aa595d76f Mon Sep 17 00:00:00 2001 From: "Bruce.Deng" Date: Fri, 17 Jul 2020 11:06:52 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=EF=BC=8C?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/fr/io/ExportApi.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/fr/io/ExportApi.java b/src/main/java/com/fr/io/ExportApi.java index b4a43e5..0d70ac1 100644 --- a/src/main/java/com/fr/io/ExportApi.java +++ b/src/main/java/com/fr/io/ExportApi.java @@ -150,4 +150,4 @@ public class ExportApi { return properties; } -} \ No newline at end of file +}