Browse Source

Merge remote-tracking branch 'origin/master'

master
Bruce.Deng 5 years ago
parent
commit
1c8ed614d7
  1. 1
      readme.md
  2. 68
      src/main/java/com/fanruan/api/report/ActorKit.java
  3. 38
      src/main/java/com/fanruan/api/report/executor/BaseWorkBookExecutor.java
  4. 33
      src/main/java/com/fanruan/api/report/executor/PageWorkBookExecutor.java
  5. 33
      src/main/java/com/fanruan/api/report/executor/ViewWorkBookExecutor.java
  6. 33
      src/main/java/com/fanruan/api/report/executor/WriteWorkBookExecutor.java
  7. 37
      src/main/java/com/fanruan/api/report/submit/BaseSubmitTask.java
  8. 31
      src/main/java/com/fanruan/api/report/view/BaseViewActor.java

1
readme.md

@ -94,3 +94,4 @@ mvn javadoc:javadoc
|http认证简化插件|https://git.fanruan.com/fanruan/demo-auth-http| |http认证简化插件|https://git.fanruan.com/fanruan/demo-auth-http|
|xml导出插件|https://git.fanruan.com/fanruan/demo-export-xml| |xml导出插件|https://git.fanruan.com/fanruan/demo-export-xml|
|echarts图表插件|https://git.fanruan.com/fanruan/demo-chart-pie| |echarts图表插件|https://git.fanruan.com/fanruan/demo-chart-pie|
|多sheet懒加载|https://git.fanruan.com/fanruan/plugin-report-lazy-sheet|

68
src/main/java/com/fanruan/api/report/ActorKit.java

@ -0,0 +1,68 @@
package com.fanruan.api.report;
import com.fr.report.stable.fun.Actor;
import com.fr.stable.ActorFactory;
import javax.servlet.http.HttpServletRequest;
/**
* @author richie
* @version 10.0
* Created by richie on 2019/10/12
* 预览类型工具类
*/
public class ActorKit {
private ActorKit() {
}
/**
* 获取指定类型的预览类型对象
*
* @param type 指定的类型
*/
public static Actor getActor(String type) {
return ActorFactory.getActor(type);
}
/**
* 根据预览类型对象获取表示预览类型的字符串
*
* @param actor 预览类型对象
* @return 表示预览类型的字符串
*/
public static String getType(Actor actor) {
return ActorFactory.getType(actor);
}
/**
* 获取指定类型的预览类型对象
*
* @param type 指定的类型
* @param isMobile 是否为移动端预览
* @param isNoPage 是否为不分页预览
*/
public static Actor getActor(String type, boolean isMobile, boolean isNoPage) {
return ActorFactory.getActor(type, isMobile, isNoPage);
}
/**
* 从http请求中获取预览类型对象
*
* @param req http请求
*/
public static Actor getActor(HttpServletRequest req) {
return ActorFactory.getActor(req);
}
/**
* 从http请求中获取预览类型对象
*
* @param req http请求
* @param defaultActor 默认的预览类型
*/
public static Actor getActor(HttpServletRequest req, Actor defaultActor) {
return ActorFactory.getActor(req, defaultActor);
}
}

38
src/main/java/com/fanruan/api/report/executor/BaseWorkBookExecutor.java

@ -0,0 +1,38 @@
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.stable.fun.Actor;
import java.util.Map;
/**
* @author richie
* @version 10.0
* Created by richie on 2019/10/12
* 将模板按指定的预览方式计算成结果集的执行器
*/
public abstract class BaseWorkBookExecutor extends AbstractWorkBookExecutor {
public BaseWorkBookExecutor(TemplateWorkBook templateWorkBook, Map<String, Object> map) {
super(templateWorkBook, map);
}
/**
* 预览的方式通常包括分页预览分析预览填报预览
*
* @return 预览方式
*/
@Override
public abstract Actor getExeType();
/**
* 初始化用于装在结果集的对象
*
* @param map 报表参数
* @return 结果集
*/
@Override
public abstract ResultWorkBook initResultBook(Map<String, Object> map);
}

33
src/main/java/com/fanruan/api/report/executor/PageWorkBookExecutor.java

@ -0,0 +1,33 @@
package com.fanruan.api.report.executor;
import com.fr.main.TemplateWorkBook;
import com.fr.main.workbook.PageRWorkBook;
import com.fr.main.workbook.ResultWorkBook;
import com.fr.report.stable.fun.Actor;
import com.fr.stable.ActorConstants;
import com.fr.stable.ActorFactory;
import java.util.Map;
/**
* @author richie
* @version 10.0
* Created by richie on 2019/10/12
* 分页预览执行器
*/
public class PageWorkBookExecutor extends BaseWorkBookExecutor {
public PageWorkBookExecutor(TemplateWorkBook templateWorkBook, Map<String, Object> map) {
super(templateWorkBook, map);
}
@Override
public Actor getExeType() {
return ActorFactory.getActor(ActorConstants.TYPE_PAGE);
}
@Override
public ResultWorkBook initResultBook(Map<String, Object> map) {
return new PageRWorkBook(map);
}
}

33
src/main/java/com/fanruan/api/report/executor/ViewWorkBookExecutor.java

@ -0,0 +1,33 @@
package com.fanruan.api.report.executor;
import com.fanruan.api.report.executor.BaseWorkBookExecutor;
import com.fr.main.TemplateWorkBook;
import com.fr.main.workbook.AnalyRWorkBook;
import com.fr.main.workbook.ResultWorkBook;
import com.fr.report.stable.fun.Actor;
import com.fr.stable.ActorFactory;
import java.util.Map;
/**
* @author richie
* @version 10.0
* Created by richie on 2019/10/12
* 分析预览执行器
*/
public class ViewWorkBookExecutor extends BaseWorkBookExecutor {
public ViewWorkBookExecutor(TemplateWorkBook templateWorkBook, Map<String, Object> map) {
super(templateWorkBook, map);
}
@Override
public Actor getExeType() {
return ActorFactory.getActor("view");
}
@Override
public ResultWorkBook initResultBook(Map<String, Object> map) {
return new AnalyRWorkBook(map);
}
}

33
src/main/java/com/fanruan/api/report/executor/WriteWorkBookExecutor.java

@ -0,0 +1,33 @@
package com.fanruan.api.report.executor;
import com.fr.main.TemplateWorkBook;
import com.fr.main.workbook.ResultWorkBook;
import com.fr.report.stable.fun.Actor;
import com.fr.stable.ActorConstants;
import com.fr.stable.ActorFactory;
import com.fr.write.main.WriteRWorkBook;
import java.util.Map;
/**
* @author richie
* @version 10.0
* Created by richie on 2019/10/12
* 填报预览执行器
*/
public class WriteWorkBookExecutor extends BaseWorkBookExecutor {
public WriteWorkBookExecutor(TemplateWorkBook templateWorkBook, Map<String, Object> map) {
super(templateWorkBook, map);
}
@Override
public Actor getExeType() {
return ActorFactory.getActor(ActorConstants.TYPE_WRITE);
}
@Override
public ResultWorkBook initResultBook(Map<String, Object> map) {
return new WriteRWorkBook(map);
}
}

37
src/main/java/com/fanruan/api/report/submit/BaseSubmitTask.java

@ -0,0 +1,37 @@
package com.fanruan.api.report.submit;
import com.fr.data.AbstractSubmitTask;
import com.fr.script.Calculator;
/**
* @author richie
* @version 10.0
* Created by richie on 2019/10/12
* 数据提交接口
*/
public abstract class BaseSubmitTask extends AbstractSubmitTask {
/**
* 提交类型
*
* @return 用于表示提交类型的字符串
*/
public abstract String getJobType();
/**
* 提交操作
*
* @param calculator 算子
* @throws Exception 提交发生错误则抛出此异常
*/
public abstract void doJob(Calculator calculator) throws Exception;
/**
* 提交结束之后的操作
*
* @param calculator 算子
* @throws Exception 提交结束处理过程中发生错误则抛出此异常
*/
public abstract void doFinish(Calculator calculator) throws Exception;
}

31
src/main/java/com/fanruan/api/report/view/BaseViewActor.java

@ -0,0 +1,31 @@
package com.fanruan.api.report.view;
import com.fr.main.TemplateWorkBook;
import com.fr.main.workbook.ResultWorkBook;
import com.fr.stable.ViewActor;
import java.util.Map;
/**
* @author richie
* @version 10.0
* Created by richie on 2019/10/12
* 分析预览接口
*/
public abstract class BaseViewActor extends ViewActor {
@Override
public final ResultWorkBook executeWorkBook(TemplateWorkBook templateWorkBook, Map map, int sheetIndex) {
return run(templateWorkBook, map, sheetIndex);
}
/**
* 将模板计算为结果结果集
*
* @param templateWorkBook 模板
* @param map 参数
* @param sheetIndex sheet编号
* @return 结果集
*/
public abstract ResultWorkBook run(TemplateWorkBook templateWorkBook, Map map, int sheetIndex);
}
Loading…
Cancel
Save