diff --git a/lib/finekit-10.0.jar b/lib/finekit-10.0.jar index 3e35e75..7ae6882 100644 Binary files a/lib/finekit-10.0.jar and b/lib/finekit-10.0.jar differ diff --git a/plugin.xml b/plugin.xml index 636baa9..7ebfefd 100644 --- a/plugin.xml +++ b/plugin.xml @@ -3,12 +3,13 @@ com.fr.plugin.report.lazysheet yes - 3.0 + 3.1 10.0 2015-08-09 solution.richie [2019-10-12]适配10.0版本以及完全依赖FineKit。
[2016-04-11]增加插件API兼容性检测
]]>
@@ -21,5 +22,6 @@ - + + \ No newline at end of file diff --git a/src/main/java/com/fr/plugin/lazy/sheet/LazySheetActorBridge.java b/src/main/java/com/fr/plugin/lazy/sheet/LazySheetActorBridge.java index bc81a41..3c58529 100644 --- a/src/main/java/com/fr/plugin/lazy/sheet/LazySheetActorBridge.java +++ b/src/main/java/com/fr/plugin/lazy/sheet/LazySheetActorBridge.java @@ -1,6 +1,7 @@ package com.fr.plugin.lazy.sheet; -import com.fr.plugin.lazy.sheet.fun.LazySheetActor; +import com.fr.plugin.lazy.sheet.fun.LazySheetViewActor; +import com.fr.plugin.lazy.sheet.fun.LazySheetWriteActor; import com.fr.report.fun.impl.AbstractActorProvider; import com.fr.report.stable.fun.Actor; @@ -17,7 +18,8 @@ public class LazySheetActorBridge extends AbstractActorProvider { @Override public Actor[] createActor() { return new Actor[]{ - new LazySheetActor() + new LazySheetViewActor(), + new LazySheetWriteActor() }; } } \ No newline at end of file diff --git a/src/main/java/com/fr/plugin/lazy/sheet/fun/LazySheetActor.java b/src/main/java/com/fr/plugin/lazy/sheet/fun/LazySheetViewActor.java similarity index 84% rename from src/main/java/com/fr/plugin/lazy/sheet/fun/LazySheetActor.java rename to src/main/java/com/fr/plugin/lazy/sheet/fun/LazySheetViewActor.java index f4d810c..7715c63 100644 --- a/src/main/java/com/fr/plugin/lazy/sheet/fun/LazySheetActor.java +++ b/src/main/java/com/fr/plugin/lazy/sheet/fun/LazySheetViewActor.java @@ -12,7 +12,7 @@ import java.util.Map; * Created by richie on 15/7/17. */ @EnableMetrics -public class LazySheetActor extends BaseViewActor { +public class LazySheetViewActor extends BaseViewActor { @Override @Focus(id = LazyConstants.PLUGIN_ID, text = "Plugin-Lazy_Load_Sheet") @@ -25,6 +25,6 @@ public class LazySheetActor extends BaseViewActor { } private ResultWorkBook lazyExecute(TemplateWorkBook workBook, Map parameterMap, int sheetIndex) { - return new LazySheetWorkBookExecutor(workBook, parameterMap, sheetIndex).execute(); + return new LazySheetWorkBookViewExecutor(workBook, parameterMap, sheetIndex).execute(); } } \ No newline at end of file diff --git a/src/main/java/com/fr/plugin/lazy/sheet/fun/LazySheetWorkBookExecutor.java b/src/main/java/com/fr/plugin/lazy/sheet/fun/LazySheetWorkBookViewExecutor.java similarity index 81% rename from src/main/java/com/fr/plugin/lazy/sheet/fun/LazySheetWorkBookExecutor.java rename to src/main/java/com/fr/plugin/lazy/sheet/fun/LazySheetWorkBookViewExecutor.java index 472308d..0637328 100644 --- a/src/main/java/com/fr/plugin/lazy/sheet/fun/LazySheetWorkBookExecutor.java +++ b/src/main/java/com/fr/plugin/lazy/sheet/fun/LazySheetWorkBookViewExecutor.java @@ -11,24 +11,23 @@ import java.util.Map; /** * Created by richie on 15/7/17. */ -public class LazySheetWorkBookExecutor extends ViewWorkBookExecutor { +public class LazySheetWorkBookViewExecutor extends ViewWorkBookExecutor { private int sheetIndex; - public LazySheetWorkBookExecutor(TemplateWorkBook workBook, Map parameterMap, int sheetIndex) { + public LazySheetWorkBookViewExecutor(TemplateWorkBook workBook, Map parameterMap, int sheetIndex) { super(workBook, parameterMap); this.sheetIndex = sheetIndex; } @Override public Actor getExeType() { - return new LazySheetActor(); + return new LazySheetViewActor(); } - protected void _execute() { + 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(); if (i == sheetIndex) { diff --git a/src/main/java/com/fr/plugin/lazy/sheet/fun/LazySheetWorkBookWriteExecutor.java b/src/main/java/com/fr/plugin/lazy/sheet/fun/LazySheetWorkBookWriteExecutor.java new file mode 100644 index 0000000..8542c1f --- /dev/null +++ b/src/main/java/com/fr/plugin/lazy/sheet/fun/LazySheetWorkBookWriteExecutor.java @@ -0,0 +1,46 @@ +package com.fr.plugin.lazy.sheet.fun; + +import com.fanruan.api.report.executor.WriteWorkBookExecutor; +import com.fr.main.TemplateWorkBook; +import com.fr.report.report.ResultReport; +import com.fr.report.report.TemplateReport; +import com.fr.report.stable.fun.Actor; + +import java.util.Map; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019/10/14 + */ +public class LazySheetWorkBookWriteExecutor extends WriteWorkBookExecutor { + + private int sheetIndex; + + public LazySheetWorkBookWriteExecutor(TemplateWorkBook templateWorkBook, Map map, int sheetIndex) { + super(templateWorkBook, map); + this.sheetIndex = sheetIndex; + } + + @Override + public Actor getExeType() { + return new LazySheetWriteActor(); + } + + @Override + 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(); + if (i == sheetIndex) { + ResultReport resultReport = report.execute(parameterMap, actor); + if (null != resultReport) { + this.listForResultReport.set(i, resultReport); + } + } else { + this.listForResultReport.set(i, ResultReport.EMPTY); + } + } + } +} diff --git a/src/main/java/com/fr/plugin/lazy/sheet/fun/LazySheetWriteActor.java b/src/main/java/com/fr/plugin/lazy/sheet/fun/LazySheetWriteActor.java new file mode 100644 index 0000000..1388450 --- /dev/null +++ b/src/main/java/com/fr/plugin/lazy/sheet/fun/LazySheetWriteActor.java @@ -0,0 +1,32 @@ +package com.fr.plugin.lazy.sheet.fun; + +import com.fanruan.api.report.write.BaseWriteActor; +import com.fr.intelli.record.Focus; +import com.fr.main.TemplateWorkBook; +import com.fr.main.workbook.ResultWorkBook; +import com.fr.record.analyzer.EnableMetrics; + +import java.util.Map; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019/10/14 + */ +@EnableMetrics +public class LazySheetWriteActor extends BaseWriteActor { + + @Override + @Focus(id = LazyConstants.PLUGIN_ID, text = "Plugin-Lazy_Load_Sheet") + public ResultWorkBook run(TemplateWorkBook workBook, Map parameterMap, int sheetIndex) { + if (parameterMap.containsKey("__lazy__")) { + return lazyExecute(workBook, parameterMap, sheetIndex); + } else { + return super.executeWorkBook(workBook, parameterMap, sheetIndex); + } + } + + private ResultWorkBook lazyExecute(TemplateWorkBook workBook, Map parameterMap, int sheetIndex) { + return new LazySheetWorkBookWriteExecutor(workBook, parameterMap, sheetIndex).execute(); + } +}