Search in sources :

Example 1 with ExportMembersExcel

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

the class MoneyService method exportMemberExcel.

/**
 ***********************   导出人员表Excel   ***********************************
 */
public static void exportMemberExcel() {
    SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
    String title = "名单登记表-德扑圈" + sdf.format(new Date());
    log.info("导出人员表Excel:" + title);
    String[] rowsName = new String[] { "玩家ID", "股东", "团队", "游戏名字", "额度" };
    List<Object[]> dataList = new ArrayList<Object[]>();
    Object[] objs = null;
    Map<String, Player> memberMap = DataConstans.membersMap;
    String pId;
    Player player;
    for (Map.Entry<String, Player> entry : memberMap.entrySet()) {
        pId = entry.getKey();
        player = entry.getValue();
        objs = new Object[rowsName.length];
        objs[0] = pId;
        objs[1] = player.getGudong();
        objs[2] = player.getTeamName();
        objs[3] = player.getPlayerName();
        objs[4] = player.getEdu();
        dataList.add(objs);
    }
    String out = "D:/" + title;
    ExportMembersExcel ex = new ExportMembersExcel(title, rowsName, dataList, out);
    try {
        ex.export();
        log.info("导出人员表Excel成功");
    } catch (Exception e) {
        ErrorUtil.err("导出人员表Excel失败", e);
    }
}
Also used : Player(com.kendy.entity.Player) ArrayList(java.util.ArrayList) Date(java.util.Date) ExportMembersExcel(com.kendy.excel.ExportMembersExcel) SimpleDateFormat(java.text.SimpleDateFormat) Map(java.util.Map) HashMap(java.util.HashMap)

Example 2 with ExportMembersExcel

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

the class MoneyService method exportSSJEAction.

/**
 ***********************   导出实时金额Excel   ***********************************
 */
public static void exportSSJEAction(TableView<CurrentMoneyInfo> tableCurrentMoneyInfo) {
    SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
    String title = "实时金额表" + sdf.format(new Date());
    log.info("导出实时金额表Excel:" + title);
    String[] rowsName = new String[] { "总和", "玩家ID", "名字", "实时金额", "额度" };
    List<Object[]> dataList = new ArrayList<Object[]>();
    Object[] objs = null;
    ObservableList<CurrentMoneyInfo> currentInfoList = tableCurrentMoneyInfo.getItems();
    for (CurrentMoneyInfo info : currentInfoList) {
        objs = new Object[rowsName.length];
        objs[0] = info.getCmSuperIdSum();
        objs[1] = info.getWanjiaId();
        objs[2] = info.getMingzi();
        objs[3] = info.getShishiJine();
        objs[4] = info.getCmiEdu();
        // objs[4] = info.getWanjiaId();
        dataList.add(objs);
    }
    String out = "D:/" + title;
    ExportMembersExcel ex = new ExportMembersExcel(title, rowsName, dataList, out);
    try {
        ex.export();
        log.debug("导出实时金额表Excel成功");
    } catch (Exception e) {
        ErrorUtil.err("导出实时金额表Excel失败", e);
    }
}
Also used : ArrayList(java.util.ArrayList) ExportMembersExcel(com.kendy.excel.ExportMembersExcel) CurrentMoneyInfo(com.kendy.entity.CurrentMoneyInfo) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date)

Example 3 with ExportMembersExcel

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

the class MoneyService method exportCombineIDAction.

/**
 ***********************   导出合并ID列表   ***********************************
 */
public static void exportCombineIDAction() {
    SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
    String title = "数据库中的合并ID表" + sdf.format(new Date());
    String[] rowsName = new String[] { "父ID", "子ID列表(请用#隔开)" };
    List<Object[]> dataList = new ArrayList<Object[]>();
    Object[] objs = null;
    Map<String, Set<String>> combineIdMap = DBUtil.getCombineData();
    if (combineIdMap == null || combineIdMap.size() == 0) {
        ShowUtil.show("数据库中无合并ID数据");
        return;
    }
    StringBuffer sb = new StringBuffer();
    for (Map.Entry<String, Set<String>> entry : combineIdMap.entrySet()) {
        String parentId = entry.getKey();
        Set<String> subIdSet = entry.getValue();
        sb.delete(0, sb.length());
        for (String subId : subIdSet) {
            sb.append(subId).append("#");
        }
        String subIdString = sb.substring(0, sb.lastIndexOf("#"));
        objs = new Object[rowsName.length];
        if (!StringUtil.isBlank(parentId) && !StringUtil.isBlank(subIdString)) {
            objs[0] = parentId;
            objs[1] = subIdString;
            dataList.add(objs);
        }
    }
    String out = "D:/" + title;
    ExportMembersExcel ex = new ExportMembersExcel(title, rowsName, dataList, out);
    try {
        ex.export();
        log.info("导出合并ID表Excel成功");
    } catch (Exception e) {
        ErrorUtil.err("导出合并ID表Excel失败", e);
    }
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) ArrayList(java.util.ArrayList) Date(java.util.Date) ExportMembersExcel(com.kendy.excel.ExportMembersExcel) SimpleDateFormat(java.text.SimpleDateFormat) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

ExportMembersExcel (com.kendy.excel.ExportMembersExcel)3 SimpleDateFormat (java.text.SimpleDateFormat)3 ArrayList (java.util.ArrayList)3 Date (java.util.Date)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2 CurrentMoneyInfo (com.kendy.entity.CurrentMoneyInfo)1 Player (com.kendy.entity.Player)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1