richie
5 years ago
7 changed files with 92 additions and 11 deletions
Binary file not shown.
@ -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<String, Object> 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); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -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(); |
||||
} |
||||
} |
Loading…
Reference in new issue