Search in sources :

Example 1 with ExportExcelTemplate

use of com.kendy.excel.ExportExcelTemplate in project financial by greatkendy123.

the class SMAutoController method exportSMAction.

/**
 * 导出有上码的记录
 *
 * @time 2018年3月31日
 * @param event
 */
public void exportSMAction(ActionEvent event) {
    List<SMAutoInfo> autoShangmas = getAutoShangmas(1);
    if (CollectUtil.isNullOrEmpty(autoShangmas)) {
        ShowUtil.show("没有可供导出的数据!");
        return;
    }
    String[] rowsName = new String[] { "爬取时间", "玩家ID", "玩家名称", "牌局", "申请数量", "团队可上码", "计算可上码", "勾选团队", "当天", "次日", "同意审核", "审核结果" };
    List<Object[]> dataList = new ArrayList<Object[]>();
    Object[] objs = null;
    for (SMAutoInfo info : autoShangmas) {
        objs = new Object[rowsName.length];
        objs[0] = info.getSmAutoDate();
        objs[1] = info.getSmAutoPlayerId();
        objs[2] = info.getSmAutoPlayerName();
        objs[3] = info.getSmAutoPaiju();
        objs[4] = info.getSmAutoApplyAccount();
        objs[5] = info.getSmAutoTeamTotalAvailabel();
        objs[6] = info.getSmAutoAvailabel();
        objs[7] = info.getSmAutoIsTeamAvailabel();
        objs[8] = info.getSmAutoIsCurrentDay();
        objs[9] = info.getSmAutoIsNextDay();
        objs[10] = info.getSmAutoIsAgree();
        objs[11] = info.getSmAutoIsAgreeSuccess();
        dataList.add(objs);
    }
    String title = "自动上码-" + TimeUtil.getDateTime();
    List<Integer> columnWidths = Arrays.asList(3500, 4000, 3000, 3000, 3000, 4000, 4000, 3000, 3000, 3000, 3000, 3000, 5000);
    ExportExcelTemplate ex = new ExportExcelTemplate(title, rowsName, columnWidths, dataList);
    try {
        ex.export();
        ShowUtil.show("导出完成", 1);
    } catch (Exception e) {
        ErrorUtil.err("导出自动记录失败", e);
        e.printStackTrace();
    }
}
Also used : ExportExcelTemplate(com.kendy.excel.ExportExcelTemplate) ArrayList(java.util.ArrayList) SMAutoInfo(com.kendy.entity.SMAutoInfo)

Aggregations

SMAutoInfo (com.kendy.entity.SMAutoInfo)1 ExportExcelTemplate (com.kendy.excel.ExportExcelTemplate)1 ArrayList (java.util.ArrayList)1