Search in sources :

Example 1 with ExportExcel

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

the class TeamProxyService method exportExcel_with_has_teamBaoxianRate.

/**
 * 导出无团队保险比例的Excel
 * @time 2018年2月8日
 */
public static void exportExcel_with_has_teamBaoxianRate() {
    String teamId = teamIDCombox.getSelectionModel().getSelectedItem();
    boolean isManage = isZjManage.isSelected();
    String time = DataConstans.Date_Str;
    if (StringUtil.isBlank(teamId)) {
        ShowUtil.show("导出失败! 请先选择团队ID!!");
        return;
    }
    if (StringUtil.isBlank(time)) {
        ShowUtil.show("导出失败! 您今天还没导入01场次的战绩,无法确认时间!!");
        return;
    }
    List<ProxyTeamInfo> list = new ArrayList<>();
    ObservableList<ProxyTeamInfo> obList = tableProxyTeam.getItems();
    if (obList != null && obList.size() > 0) {
        for (ProxyTeamInfo info : obList) {
            list.add(info);
        }
    } else {
        ShowUtil.show("没有需要导出的数据!!");
        return;
    }
    SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
    String title = teamId + "-" + sdf.format(new Date());
    log.info(title);
    String[] rowsName = new String[] { "玩家ID", "玩家名称", "原始战绩", "战绩", "保险", "回水", "回保", "场次" };
    List<Object[]> dataList = new ArrayList<Object[]>();
    Object[] objs = null;
    for (ProxyTeamInfo info : list) {
        objs = new Object[rowsName.length];
        objs[0] = info.getProxyPlayerId();
        objs[1] = info.getProxyPlayerName();
        objs[2] = info.getProxyYSZJ();
        objs[3] = info.getProxyZJ();
        objs[4] = info.getProxyBaoxian();
        objs[5] = info.getProxyHuishui();
        objs[6] = info.getProxyHuiBao();
        objs[7] = info.getProxyTableId();
        dataList.add(objs);
    }
    String[] rowsName2 = new String[] { "合计", "0" };
    List<Object[]> sumList = new ArrayList<>();
    Object[] sumObjs = null;
    ObservableList<ProxySumInfo> ob_List = tableProxySum.getItems();
    // if(ob_List != null && ob_List.size() > 0) {
    // for(ProxySumInfo info : ob_List) {
    // sumObjs= new Object[rowsName2.length];
    // sumObjs[0] = info.getProxySumType();
    // sumObjs[1] = info.getProxySum();
    // sumList.add(sumObjs);
    // }
    // String sum = tableProxySum.getColumns().get(1).getText();
    // rowsName2[1] = sum;
    // }
    List<String> baoxianFilters = getHejiFilters();
    if (CollectUtil.isHaveValue(ob_List)) {
        for (ProxySumInfo info : ob_List) {
            if (!baoxianFilters.contains(info.getProxySumType())) {
                sumObjs = new Object[rowsName2.length];
                sumObjs[0] = info.getProxySumType();
                sumObjs[1] = info.getProxySum();
                sumList.add(sumObjs);
            }
        }
        String sum = getExportHejiSum(ob_List, baoxianFilters);
        rowsName2[1] = sum;
    }
    String out = getOutPath(title, rowsName2[1]);
    ExportExcel ex = new ExportExcel(teamId, time, isManage, title, rowsName, dataList, out, rowsName2, sumList);
    try {
        ex.export();
        log.info("代理查询导出成功");
    } catch (Exception e) {
        ErrorUtil.err("代理查询导出失败", e);
    }
}
Also used : ExportExcel(com.kendy.excel.ExportExcel) ProxyTeamInfo(com.kendy.entity.ProxyTeamInfo) ArrayList(java.util.ArrayList) Date(java.util.Date) ProxySumInfo(com.kendy.entity.ProxySumInfo) SimpleDateFormat(java.text.SimpleDateFormat)

Example 2 with ExportExcel

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

the class TeamProxyService method exportExcel_with_no_teamBaoxianRate.

/**
 * 导出有团队保险比例的Excel
 * @time 2018年2月8日
 */
public static void exportExcel_with_no_teamBaoxianRate() {
    String teamId = teamIDCombox.getSelectionModel().getSelectedItem();
    boolean isManage = isZjManage.isSelected();
    String time = DataConstans.Date_Str;
    if (StringUtil.isBlank(teamId)) {
        ShowUtil.show("导出失败! 请先选择团队ID!!");
        return;
    }
    if (StringUtil.isBlank(time)) {
        ShowUtil.show("导出失败! 您今天还没导入01场次的战绩,无法确认时间!!");
        return;
    }
    List<ProxyTeamInfo> list = new ArrayList<>();
    ObservableList<ProxyTeamInfo> obList = tableProxyTeam.getItems();
    if (obList != null && obList.size() > 0) {
        for (ProxyTeamInfo info : obList) {
            list.add(info);
        }
    } else {
        ShowUtil.show("没有需要导出的数据!!");
        return;
    }
    SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
    String title = teamId + "-" + sdf.format(new Date());
    log.info(title);
    // String[] rowsName = new String[]{"玩家ID","玩家名称","原始战绩","战绩","保险","回水","回保","场次"};
    String[] rowsName = new String[] { "玩家ID", "玩家名称", "原始战绩", "战绩", "回水", "场次" };
    List<Object[]> dataList = new ArrayList<Object[]>();
    Object[] objs = null;
    for (ProxyTeamInfo info : list) {
        objs = new Object[rowsName.length];
        objs[0] = info.getProxyPlayerId();
        objs[1] = info.getProxyPlayerName();
        objs[2] = info.getProxyYSZJ();
        objs[3] = info.getProxyZJ();
        // objs[4] = info.getProxyBaoxian();
        objs[5 - 1] = info.getProxyHuishui();
        // objs[6] = info.getProxyHuiBao();
        objs[7 - 2] = info.getProxyTableId();
        dataList.add(objs);
    }
    String[] rowsName2 = new String[] { "合计", "0" };
    List<Object[]> sumList = new ArrayList<>();
    Object[] sumObjs = null;
    ObservableList<ProxySumInfo> ob_List = tableProxySum.getItems();
    List<String> baoxianFilters = getHejiFilters();
    if (CollectUtil.isHaveValue(ob_List)) {
        for (ProxySumInfo info : ob_List) {
            if (!baoxianFilters.contains(info.getProxySumType())) {
                sumObjs = new Object[rowsName2.length];
                sumObjs[0] = info.getProxySumType();
                sumObjs[1] = info.getProxySum();
                sumList.add(sumObjs);
            }
        }
        String sum = getExportHejiSum(ob_List, baoxianFilters);
        rowsName2[1] = sum;
    }
    String out = getOutPath(title, rowsName2[1]);
    ExportExcel ex = new ExportExcel(teamId, time, isManage, title, rowsName, dataList, out, rowsName2, sumList);
    try {
        ex.export();
        log.info("代理查询导出成功");
    } catch (Exception e) {
        ErrorUtil.err("代理查询导出失败", e);
    }
}
Also used : ExportExcel(com.kendy.excel.ExportExcel) ProxyTeamInfo(com.kendy.entity.ProxyTeamInfo) ArrayList(java.util.ArrayList) Date(java.util.Date) ProxySumInfo(com.kendy.entity.ProxySumInfo) SimpleDateFormat(java.text.SimpleDateFormat)

Aggregations

ProxySumInfo (com.kendy.entity.ProxySumInfo)2 ProxyTeamInfo (com.kendy.entity.ProxyTeamInfo)2 ExportExcel (com.kendy.excel.ExportExcel)2 SimpleDateFormat (java.text.SimpleDateFormat)2 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2