异步导出excel表格(2)excel处理线程
? ? ? ? 上一篇文章分享了用户下载任务的提交与下载,以及系统中对任务的保存方式,这篇文章,主要分享excel处理部分。excel处理基本流程如下:
?
? ? ? ? excel处理线程首先要获得生成excel表格的基本数据(其中不包括大的查询数据),保存到新创建的beansMap中;然后对于大的数据多次查询,将多次查询结果List统一保存到一个List中,最后保存到beansMap中,通过jxls生成excel报表。
?
/** * query conditions. */private Pager pager;/** * beans map. */private Map<String, Object> beansMap;/** * order view service. */private OrderViewService orderViewService;/** * asynchrony export job parameters service. */private AsynchronyExportJobParamsService asynchronyExportService;/** * export configuration service. */private ExportConfigService exportConfigService;/** * eshop service. */private EshopService eshopService;/** * logistic service. */private LogisticService logisticService;/** * job parameters. */private AsynchronyExportJobParams jobParams;/** * the constant variable of a size per page. */private final static int SIZE_PER_PAGE = 10;public ProcessOrderExportJob(Pager pager, Map<String, Object> beansMap, AsynchronyExportJobParams jobParams) {this.pager = pager;this.beansMap = beansMap;this.jobParams = jobParams;orderViewService = Erp.context.getBean(OrderViewService.class);asynchronyExportService = Erp.context.getBean(AsynchronyExportJobParamsService.class);exportConfigService = Erp.context.getBean(ExportConfigService.class);eshopService = Erp.context.getBean(EshopService.class);logisticService = Erp.context.getBean(LogisticService.class);}
?在线程的构造函数中,完成了参数的初始化。
?