commit c6a584ed54bf55b05287efe59b2a2f90af7c00ff Author: pioneer Date: Fri Apr 7 15:47:21 2023 +0800 open diff --git a/README.md b/README.md new file mode 100644 index 0000000..05dfe64 --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +# open-JSD-11676 + +JSD-11676 定时调度分sheet导出数据\ +免责说明:该源码为第三方爱好者提供,不保证源码和方案的可靠性,也不提供任何形式的源码教学指导和协助!\ +仅作为开发者学习参考使用!禁止用于任何商业用途!\ +为保护开发者隐私,开发者信息已隐去!若原开发者希望公开自己的信息,可联系【pioneer】处理。 \ No newline at end of file diff --git a/bin/main/com/fr/plugin/akfgp/PluginMonitor.class b/bin/main/com/fr/plugin/akfgp/PluginMonitor.class new file mode 100644 index 0000000..d4f6dcf Binary files /dev/null and b/bin/main/com/fr/plugin/akfgp/PluginMonitor.class differ diff --git a/bin/main/com/fr/plugin/akfgp/decision/DecisionAtom.class b/bin/main/com/fr/plugin/akfgp/decision/DecisionAtom.class new file mode 100644 index 0000000..a392657 Binary files /dev/null and b/bin/main/com/fr/plugin/akfgp/decision/DecisionAtom.class differ diff --git a/bin/main/com/fr/plugin/akfgp/decision/DecisionResourceProvider.class b/bin/main/com/fr/plugin/akfgp/decision/DecisionResourceProvider.class new file mode 100644 index 0000000..ca87857 Binary files /dev/null and b/bin/main/com/fr/plugin/akfgp/decision/DecisionResourceProvider.class differ diff --git a/bin/main/com/fr/plugin/akfgp/format/OutputExcelPlus.class b/bin/main/com/fr/plugin/akfgp/format/OutputExcelPlus.class new file mode 100644 index 0000000..629a2c6 Binary files /dev/null and b/bin/main/com/fr/plugin/akfgp/format/OutputExcelPlus.class differ diff --git a/lib/finekit-10.0.jar b/lib/finekit-10.0.jar new file mode 100644 index 0000000..f4482fc Binary files /dev/null and b/lib/finekit-10.0.jar differ diff --git a/plugin.xml b/plugin.xml new file mode 100644 index 0000000..c51b88e --- /dev/null +++ b/plugin.xml @@ -0,0 +1,26 @@ + + + com.fr.plugin.akfgp.job + + yes + 1.0.2 + 11.0~11.0 + 2021-10-19 + fr.open + + + ]]> + com.fr.plugin.akfgp + + com.fanruan.api.* + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/fr/plugin/akfgp/PluginMonitor.java b/src/main/java/com/fr/plugin/akfgp/PluginMonitor.java new file mode 100644 index 0000000..67d4456 --- /dev/null +++ b/src/main/java/com/fr/plugin/akfgp/PluginMonitor.java @@ -0,0 +1,41 @@ + /* + * Copyright (C), 2018-2021 + * Project: starter + * FileName: PluginMonitor + * Author: xx + * Date: 2022/12/18 20:10 + */ + package com.fr.plugin.akfgp; + + import com.fr.plugin.akfgp.format.OutputExcelPlus; + import com.fr.plugin.context.PluginContext; + import com.fr.plugin.observer.inner.AbstractPluginLifecycleMonitor; + import com.fr.schedule.extension.report.job.output.BaseOutputFormat; + import com.fr.schedule.extension.report.job.output.OutputExcel; + + import static com.fr.plugin.akfgp.format.OutputExcelPlus.CONVERT_TO_EXCEL_PLUS; + import static com.fr.schedule.extension.report.job.output.OutputExcel.CONVERT_TO_EXCEL; + + /** + *
+ * + * + * @author xx + * @since 1.0.0 + */ + public class PluginMonitor extends AbstractPluginLifecycleMonitor { + public PluginMonitor() { + } + + @Override + public void afterRun(PluginContext pluginContext) { + BaseOutputFormat.removeOutputFormat(CONVERT_TO_EXCEL_PLUS); + BaseOutputFormat.registerOutputFormat(new OutputExcelPlus()); + } + + @Override + public void beforeStop(PluginContext pluginContext) { + BaseOutputFormat.removeOutputFormat(CONVERT_TO_EXCEL); + BaseOutputFormat.registerOutputFormat(new OutputExcel()); + } + } \ No newline at end of file diff --git a/src/main/java/com/fr/plugin/akfgp/decision/DecisionAtom.java b/src/main/java/com/fr/plugin/akfgp/decision/DecisionAtom.java new file mode 100644 index 0000000..7f2dd51 --- /dev/null +++ b/src/main/java/com/fr/plugin/akfgp/decision/DecisionAtom.java @@ -0,0 +1,32 @@ + /* + * Copyright (C), 2018-2022 + * Project: starter + * FileName: DecisionAtom + * Author: xx + * Date: 2022/4/25 15:50 + */ + package com.fr.plugin.akfgp.decision; + + import com.fr.web.struct.Component; + import com.fr.web.struct.Filter; + import com.fr.web.struct.browser.RequestClient; + import com.fr.web.struct.category.ScriptPath; + + public class DecisionAtom extends Component { + public static final DecisionAtom KEY = new DecisionAtom(); + + @Override + public ScriptPath script(RequestClient requestClient) { + return ScriptPath.build("/com/fr/plugin/akfgp/web/akfgp.js"); + } + + @Override + public Filter filter() { + return new Filter() { + @Override + public boolean accept() { + return true; + } + }; + } + } diff --git a/src/main/java/com/fr/plugin/akfgp/decision/DecisionResourceProvider.java b/src/main/java/com/fr/plugin/akfgp/decision/DecisionResourceProvider.java new file mode 100644 index 0000000..a01c42e --- /dev/null +++ b/src/main/java/com/fr/plugin/akfgp/decision/DecisionResourceProvider.java @@ -0,0 +1,24 @@ + /* + * Copyright (C), 2018-2022 + * Project: starter + * FileName: DecisionResourceProvider + * Author: xx + * Date: 2022/4/25 15:50 + */ + package com.fr.plugin.akfgp.decision; + + import com.fr.decision.fun.impl.AbstractWebResourceProvider; + import com.fr.decision.web.MainComponent; + import com.fr.web.struct.Atom; + + public class DecisionResourceProvider extends AbstractWebResourceProvider { + @Override + public Atom attach() { + return MainComponent.KEY; + } + + @Override + public Atom client() { + return DecisionAtom.KEY; + } + } diff --git a/src/main/java/com/fr/plugin/akfgp/format/OutputExcelPlus.java b/src/main/java/com/fr/plugin/akfgp/format/OutputExcelPlus.java new file mode 100644 index 0000000..2bfa094 --- /dev/null +++ b/src/main/java/com/fr/plugin/akfgp/format/OutputExcelPlus.java @@ -0,0 +1,92 @@ + /* + * Copyright (C), 2018-2022 + * Project: starterBI + * FileName: OutputExcelPlus + * Author: xx + * Date: 2022/11/15 21:26 + */ + package com.fr.plugin.akfgp.format; + + import com.fanruan.api.log.LogKit; + import com.fr.intelli.record.Focus; + import com.fr.intelli.record.Original; + import com.fr.io.TemplateWorkBookIO; + import com.fr.io.exporter.PageExcelExporter; + import com.fr.main.TemplateWorkBook; + import com.fr.main.workbook.PageWorkBook; + import com.fr.main.workbook.ResultWorkBook; + import com.fr.record.analyzer.EnableMetrics; + import com.fr.report.core.ReportUtils; + import com.fr.report.report.PageReport; + import com.fr.schedule.extension.report.job.output.OutputExcel; + import com.fr.stable.PageActor; + import com.fr.stable.fun.Authorize; + import com.fr.web.core.SessionPoolManager; + import com.fr.web.core.TemplateSessionIDInfo; + + import java.io.OutputStream; + import java.util.Map; + + import static com.fr.plugin.akfgp.format.OutputExcelPlus.PLUGIN_ID; + + /** + *
+ * + * + * @author xx + * @since 1.0.0 + */ + @EnableMetrics + @Authorize(callSignKey = PLUGIN_ID) + public class OutputExcelPlus extends OutputExcel { + public static final String PLUGIN_ID = "com.fr.plugin.akfgp.job"; + public static final int CONVERT_TO_EXCEL_PLUS = 4096; + public static final String SESSIONID = "SESSIONID"; + + public OutputExcelPlus() { + } + + @Override + public int getFormat() { + return CONVERT_TO_EXCEL_PLUS; + } + + @Override + public String getFileSuffix() { + return ".xlsx"; + } + + @Override + @Focus(id = PLUGIN_ID, text = "Plugin-akfgp", source = Original.PLUGIN) + public void flush(OutputStream out, ResultWorkBook result) throws Exception { + LogKit.info("akfgp-OutputExcelPlus output start ..."); + try { + //定时调度配置的参数 + Map parameterMap = result.getExecuteParameters(); + String sheetParamName = parameterMap.get("paramName").toString(); + String sheetParamValue; + if (parameterMap.containsKey("paramValue")) { + sheetParamValue = parameterMap.get("paramValue").toString(); + } else { + sheetParamValue = parameterMap.get(sheetParamName).toString(); + } + String[] sheetParams = sheetParamValue.split(","); + String sessionID = parameterMap.get(SESSIONID).toString(); + TemplateSessionIDInfo sessionIDInfo = SessionPoolManager.getSessionIDInfor(sessionID, TemplateSessionIDInfo.class); + String tplPath = sessionIDInfo.getRelativePath(); + TemplateWorkBook workbook = TemplateWorkBookIO.readTemplateWorkBook(tplPath); + result.removeReport(0); + for (String sheetParam : sheetParams) { + parameterMap.put(sheetParamName, sheetParam); + PageWorkBook pageWorkBook = (PageWorkBook) workbook.execute(parameterMap, new PageActor()); + PageReport pageReport = pageWorkBook.getPageReport(0); + result.addReport(sheetParam, pageReport); + } + PageExcelExporter excelExport = new PageExcelExporter(ReportUtils.getPaperSettingListFromWorkBook(result)); + excelExport.export(out, result); + out.close(); + } catch (Exception e) { + LogKit.error(e.getMessage(), e); + } + } + } \ No newline at end of file diff --git a/src/main/resources/com/fr/plugin/akfgp/web/akfgp.js b/src/main/resources/com/fr/plugin/akfgp/web/akfgp.js new file mode 100644 index 0000000..1f5a208 --- /dev/null +++ b/src/main/resources/com/fr/plugin/akfgp/web/akfgp.js @@ -0,0 +1,8 @@ +!(function () { + BI.config("dec.provider.schedule", function (provider) { + provider.registerTaskAttached({ + value: 4096, + text: "参数分Sheet导出" + }, [DecCst.Schedule.TaskType.REPORT]); + }); +})(); \ No newline at end of file