From 46e2581109aed96ca447ee3076d1611f67023e35 Mon Sep 17 00:00:00 2001 From: richie Date: Mon, 14 Oct 2019 14:51:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A1=AB=E6=8A=A5=E9=A2=84=E8=A7=88=E7=9A=84AP?= =?UTF-8?q?I?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../report/executor/BaseWorkBookExecutor.java | 22 +++++++++++++ .../api/report/write/BaseWriteActor.java | 31 +++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 src/main/java/com/fanruan/api/report/write/BaseWriteActor.java diff --git a/src/main/java/com/fanruan/api/report/executor/BaseWorkBookExecutor.java b/src/main/java/com/fanruan/api/report/executor/BaseWorkBookExecutor.java index c57e0ec..4e617af 100644 --- a/src/main/java/com/fanruan/api/report/executor/BaseWorkBookExecutor.java +++ b/src/main/java/com/fanruan/api/report/executor/BaseWorkBookExecutor.java @@ -3,6 +3,8 @@ package com.fanruan.api.report.executor; import com.fr.main.TemplateWorkBook; import com.fr.main.workbook.ResultWorkBook; import com.fr.report.core.sheet.AbstractWorkBookExecutor; +import com.fr.report.report.ResultReport; +import com.fr.report.report.TemplateReport; import com.fr.report.stable.fun.Actor; import java.util.Map; @@ -35,4 +37,24 @@ public abstract class BaseWorkBookExecutor extends AbstractWorkBookExecutor { */ @Override public abstract ResultWorkBook initResultBook(Map map); + + @Override + protected final void _execute() { + executeOnce(); + } + + /** + * 多个sheet分别执行成结果报表 + */ + public void executeOnce() { + TemplateReport report; + for (int i = 0, len = this.nameListMap.size(); i < len; i++) { + report = (TemplateReport) this.nameListMap.getByIndex(i); + Actor actor = getExeType(); + ResultReport resultReport = report.execute(parameterMap, actor); + if (null != resultReport) { + this.listForResultReport.set(i, resultReport); + } + } + } } diff --git a/src/main/java/com/fanruan/api/report/write/BaseWriteActor.java b/src/main/java/com/fanruan/api/report/write/BaseWriteActor.java new file mode 100644 index 0000000..fa8583c --- /dev/null +++ b/src/main/java/com/fanruan/api/report/write/BaseWriteActor.java @@ -0,0 +1,31 @@ +package com.fanruan.api.report.write; + +import com.fr.main.TemplateWorkBook; +import com.fr.main.workbook.ResultWorkBook; +import com.fr.stable.WriteActor; + +import java.util.Map; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019/10/14 + * 填报预览接口 + */ +public abstract class BaseWriteActor extends WriteActor { + + @Override + public ResultWorkBook executeWorkBook(TemplateWorkBook templateWorkBook, Map map, int i) { + return run(templateWorkBook, map, i); + } + + /** + * 将模板计算为结果结果集 + * + * @param templateWorkBook 模板 + * @param map 参数 + * @param sheetIndex sheet编号 + * @return 结果集 + */ + public abstract ResultWorkBook run(TemplateWorkBook templateWorkBook, Map map, int sheetIndex); +}