Browse Source

填报预览的API

master
richie 5 years ago
parent
commit
46e2581109
  1. 22
      src/main/java/com/fanruan/api/report/executor/BaseWorkBookExecutor.java
  2. 31
      src/main/java/com/fanruan/api/report/write/BaseWriteActor.java

22
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<String, Object> 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);
}
}
}
}

31
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);
}
Loading…
Cancel
Save