Search in sources :

Example 26 with CurrentMoneyInfo

use of com.kendy.entity.CurrentMoneyInfo in project financial by greatkendy123.

the class MoneyService method fillTableCurrentMoneyInfo.

// *****************************************************************************
/**
 * 将前一次的实时金额数据备份到第二张表 2017-01-01
 * @param table
 * @param userInfoList
 */
public static void fillTableCurrentMoneyInfo(TableView<CurrentMoneyInfo> table, TableView<ZijinInfo> tableZijin, TableView<ProfitInfo> tableProfit, TableView<KaixiaoInfo> tableKaixiao, Label LMLabel) {
    Map<String, String> map = DataConstans.preDataMap;
    /**
     ********************************************** 实时金额表  *************
     */
    // 1清空表数据
    table.setItems(null);
    // 2匹配ID和额度
    ObservableList<CurrentMoneyInfo> observableList1 = FXCollections.observableArrayList();
    String name = "实时金额";
    Map<String, String> jineMap = JSON.parseObject(map.get(name), new TypeReference<Map<String, String>>() {
    });
    final String FLAG = "###";
    jineMap.forEach((mingziAndID, shishsijine) -> {
        // mingziAndID 之前是mingzi
        String mingzi = "";
        String playerId = "";
        if (mingziAndID.contains(FLAG)) {
            mingzi = mingziAndID.split(FLAG)[0];
            playerId = mingziAndID.split(FLAG)[1];
            // playerId中含有#号,则删除#号(不严谨)
            playerId = playerId.replace("#", "");
        } else {
            mingzi = mingziAndID;
        }
        // add 现在根据玩家去匹配
        Player player = DataConstans.membersMap.get(playerId);
        CurrentMoneyInfo cmi;
        if (player == null || StringUtil.isBlank(player.getgameId())) {
            // 实时金额中的人名找不到对应的玩家ID
            cmi = new CurrentMoneyInfo(mingzi, shishsijine, "", "");
        } else {
            cmi = new CurrentMoneyInfo(mingzi, shishsijine, player.getgameId(), player.getEdu());
        }
        observableList1.add(cmi);
    });
    table.setItems(observableList1);
    table.refresh();
    // 刷新合并ID操作
    flush_SSJE_table();
    // 加载其他几个表
    fillTables(tableZijin, tableProfit, tableKaixiao, LMLabel, map);
}
Also used : Player(com.kendy.entity.Player) CurrentMoneyInfo(com.kendy.entity.CurrentMoneyInfo) Map(java.util.Map) HashMap(java.util.HashMap)

Example 27 with CurrentMoneyInfo

use of com.kendy.entity.CurrentMoneyInfo in project financial by greatkendy123.

the class MoneyService method reCovery10TablesByPage.

/**
 * 根据分页自动恢复该页锁定的10个表数据
 */
public static void reCovery10TablesByPage(TableView<TotalInfo> tableTotal, TableView<WanjiaInfo> tableWanjia, TableView<TeamInfo> tableTeam, TableView<CurrentMoneyInfo> tableCurrentMoney, TableView<ZijinInfo> tableZijin, TableView<KaixiaoInfo> tableKaixiao, TableView<ProfitInfo> tableProfit, TableView<DangjuInfo> tableDangju, TableView<JiaoshouInfo> tableJiaoshou, TableView<PingzhangInfo> tablePingzhang, Label LMLabel, int pageIndex) throws Exception {
    // 获取该页所有数据
    Map<String, String> map = DataConstans.All_Locked_Data_Map.get(pageIndex + "");
    /**
     *****************************************************
     */
    // List<TotalInfo> TotalInfoList = JSON.parseObject(map.get("战绩"), new TypeReference<List<TotalInfo>>() {});
    List<TotalInfo> TotalInfoList = JSON.parseObject(getJsonString(map, "战绩"), new TypeReference<List<TotalInfo>>() {
    });
    ObservableList<TotalInfo> obList = FXCollections.observableArrayList();
    for (TotalInfo infos : TotalInfoList) {
        obList.add(infos);
    }
    tableTotal.setItems(obList);
    tableTotal.refresh();
    /**
     *********************************************************
     */
    List<WanjiaInfo> WanjiaInfoList = JSON.parseObject(getJsonString(map, "玩家"), new TypeReference<List<WanjiaInfo>>() {
    });
    ObservableList<WanjiaInfo> WanjiaInfo_OB_List = FXCollections.observableArrayList();
    for (WanjiaInfo infos : WanjiaInfoList) {
        WanjiaInfo_OB_List.add(infos);
    }
    tableWanjia.setItems(WanjiaInfo_OB_List);
    tableWanjia.refresh();
    /**
     *************************************************************************
     */
    List<TeamInfo> TeamInfoList = JSON.parseObject(getJsonString(map, "团队回水"), new TypeReference<List<TeamInfo>>() {
    });
    ObservableList<TeamInfo> TeamInfo_OB_List = FXCollections.observableArrayList();
    for (TeamInfo infos : TeamInfoList) {
        TeamInfo_OB_List.add(infos);
    }
    tableTeam.setItems(TeamInfo_OB_List);
    tableTeam.getColumns().get(4).setText(getJsonString(map, "团队回水总和"));
    tableTeam.refresh();
    /**
     *************************************************************************
     */
    List<CurrentMoneyInfo> CurrentMoneyInfoList = JSON.parseObject(getJsonString(map, "实时金额"), new TypeReference<List<CurrentMoneyInfo>>() {
    });
    ObservableList<CurrentMoneyInfo> CurrentMoneyInfo_OB_List = FXCollections.observableArrayList();
    for (CurrentMoneyInfo infos : CurrentMoneyInfoList) {
        CurrentMoneyInfo_OB_List.add(infos);
    }
    tableCurrentMoney.setItems(CurrentMoneyInfo_OB_List);
    String sumOfCurrentMoney = getJsonString(map, "实时金额总和");
    tableCurrentMoney.getColumns().get(2).setText(sumOfCurrentMoney);
    tableCurrentMoney.refresh();
    /**
     **********************************************************
     */
    List<ZijinInfo> ZijinInfoList = JSON.parseObject(getJsonString(map, "资金"), new TypeReference<List<ZijinInfo>>() {
    });
    ObservableList<ZijinInfo> ZijinInfo_OB_List = FXCollections.observableArrayList();
    for (ZijinInfo infos : ZijinInfoList) {
        ZijinInfo_OB_List.add(infos);
    }
    tableZijin.getColumns().get(1).setText(getJsonString(map, "资金总和"));
    tableZijin.setItems(ZijinInfo_OB_List);
    tableZijin.refresh();
    /**
     ***************************************************************
     */
    List<ProfitInfo> ProfitInfoList = JSON.parseObject(getJsonString(map, "利润"), new TypeReference<List<ProfitInfo>>() {
    });
    ObservableList<ProfitInfo> ProfitInfo_OB_List = FXCollections.observableArrayList();
    for (ProfitInfo infos : ProfitInfoList) {
        ProfitInfo_OB_List.add(infos);
    }
    tableProfit.getColumns().get(1).setText(getJsonString(map, "利润总和"));
    tableProfit.setItems(ProfitInfo_OB_List);
    tableProfit.refresh();
    /**
     **********************************************************
     */
    List<KaixiaoInfo> KaixiaoInfoList = JSON.parseObject(getJsonString(map, "实时开销"), new TypeReference<List<KaixiaoInfo>>() {
    });
    ObservableList<KaixiaoInfo> KaixiaoInfo_OB_List = FXCollections.observableArrayList();
    for (KaixiaoInfo infos : KaixiaoInfoList) {
        KaixiaoInfo_OB_List.add(infos);
    }
    tableKaixiao.getColumns().get(1).setText(getJsonString(map, "实时开销总和"));
    tableKaixiao.setItems(KaixiaoInfo_OB_List);
    tableKaixiao.refresh();
    /**
     ************************************************************
     */
    List<DangjuInfo> DangjuInfoList = JSON.parseObject(getJsonString(map, "当局"), new TypeReference<List<DangjuInfo>>() {
    });
    ObservableList<DangjuInfo> DangjuInfo_OB_List = FXCollections.observableArrayList();
    for (DangjuInfo infos : DangjuInfoList) {
        DangjuInfo_OB_List.add(infos);
    }
    tableDangju.getColumns().get(1).setText(getJsonString(map, "当局总和"));
    tableDangju.setItems(DangjuInfo_OB_List);
    tableDangju.refresh();
    /**
     *************************************************************
     */
    List<JiaoshouInfo> JiaoshouInfoList = JSON.parseObject(getJsonString(map, "交收"), new TypeReference<List<JiaoshouInfo>>() {
    });
    ObservableList<JiaoshouInfo> JiaoshouInfo_OB_List = FXCollections.observableArrayList();
    for (JiaoshouInfo infos : JiaoshouInfoList) {
        JiaoshouInfo_OB_List.add(infos);
    }
    tableJiaoshou.getColumns().get(1).setText(getJsonString(map, "交收总和"));
    tableJiaoshou.setItems(JiaoshouInfo_OB_List);
    tableJiaoshou.refresh();
    /**
     ***************************************************************
     */
    List<PingzhangInfo> PingzhangInfoList = JSON.parseObject(getJsonString(map, "平帐"), new TypeReference<List<PingzhangInfo>>() {
    });
    ObservableList<PingzhangInfo> PingzhangInfo_OB_List = FXCollections.observableArrayList();
    for (PingzhangInfo infos : PingzhangInfoList) {
        PingzhangInfo_OB_List.add(infos);
    }
    tablePingzhang.getColumns().get(1).setText(getJsonString(map, "平帐总和"));
    tablePingzhang.setItems(PingzhangInfo_OB_List);
    tablePingzhang.refresh();
    /**
     ***************************************************************
     */
    LMLabel.setText(getJsonString(map, "联盟对帐"));
}
Also used : JiaoshouInfo(com.kendy.entity.JiaoshouInfo) KaixiaoInfo(com.kendy.entity.KaixiaoInfo) CurrentMoneyInfo(com.kendy.entity.CurrentMoneyInfo) ProfitInfo(com.kendy.entity.ProfitInfo) WanjiaInfo(com.kendy.entity.WanjiaInfo) List(java.util.List) ObservableList(javafx.collections.ObservableList) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) PingzhangInfo(com.kendy.entity.PingzhangInfo) DangjuInfo(com.kendy.entity.DangjuInfo) TeamInfo(com.kendy.entity.TeamInfo) ZijinInfo(com.kendy.entity.ZijinInfo) TotalInfo(com.kendy.entity.TotalInfo)

Example 28 with CurrentMoneyInfo

use of com.kendy.entity.CurrentMoneyInfo in project financial by greatkendy123.

the class MoneyService method updateOrAdd_SSJE_after_Pay.

/**
 * 支付时修改玩家实时金额  或 添加 实时金额
 *
 * @time 2017年11月12日
 * @param wj 支付时的玩家信息
 * @return
 * @throws Exception
 */
public static void updateOrAdd_SSJE_after_Pay(WanjiaInfo wj) throws Exception {
    // 1判断玩家是否在该金额表中
    String playerId = wj.getWanjiaId();
    if (StringUtil.isBlank(playerId)) {
        ShowUtil.show("支付按钮时找不到玩家" + wj.getWanjiaName() + "的ID!!请确认!");
    }
    // 修改金额表中的玩家金额
    for (CurrentMoneyInfo moneyInfo : tableCurrentMoneyInfo.getItems()) {
        if (playerId.equals(moneyInfo.getWanjiaId())) {
            // 设置新的实时金额的值
            moneyInfo.setShishiJine(wj.getHeji());
            return;
        }
    }
    // 2 到这里,说明玩家不存在于金额表中,需要新增记录
    Player p = DataConstans.membersMap.get(playerId);
    if (p == null) {
        throw new Exception("该玩家不存在于名单中,且匹配不到团ID!玩家名称:" + wj.getWanjiaName() + ",玩家ID:" + playerId);
    }
    CurrentMoneyInfo tempMoneyInfo = new CurrentMoneyInfo(wj.getWanjiaName(), wj.getHeji(), playerId, DataConstans.membersMap.get(playerId).getEdu());
    addInfo(tempMoneyInfo);
}
Also used : Player(com.kendy.entity.Player) CurrentMoneyInfo(com.kendy.entity.CurrentMoneyInfo)

Example 29 with CurrentMoneyInfo

use of com.kendy.entity.CurrentMoneyInfo in project financial by greatkendy123.

the class MoneyService method flush_SSJE_table.

/**
 * 刷新最新的实时金额(最重要!!!!)
 * 即添加进合并ID
 *
 * @time 2017年11月1日
 * @throws Exception
 */
public static void flush_SSJE_table() {
    LinkedList<CurrentMoneyInfo> srcList = new LinkedList<>();
    if (!isTableNotNull()) {
        return;
    } else {
        for (CurrentMoneyInfo info : tableCurrentMoneyInfo.getItems()) srcList.add(info);
    }
    // 组装数据为空
    // 对组装的数据列表进行处理,空行直接删除,父ID删除,子ID删除后缓存
    ListIterator<CurrentMoneyInfo> it = srcList.listIterator();
    // 存放父ID那条记录的信息
    Map<String, CurrentMoneyInfo> superIdInfoMap = new HashMap<>();
    // 存放父ID下的所有子记录信息
    Map<String, List<CurrentMoneyInfo>> superIdSubListMap = new HashMap<>();
    String playerId = "";
    while (it.hasNext()) {
        CurrentMoneyInfo item = it.next();
        // 删除空行
        if (StringUtil.isBlank(item.getWanjiaId()) && StringUtil.isBlank(item.getMingzi()) && StringUtil.isBlank(item.getShishiJine())) {
            // 没有玩家ID的就是空行
            it.remove();
            continue;
        }
        // 删除父ID
        playerId = item.getWanjiaId();
        if (DataConstans.Combine_Super_Id_Map.get(playerId) != null) {
            superIdInfoMap.put(playerId, item);
            it.remove();
            continue;
        }
        // 删除子ID
        if (DataConstans.Combine_Sub_Id_Map.get(playerId) != null) {
            // 是子ID节点
            String parentID = DataConstans.Combine_Sub_Id_Map.get(playerId);
            List<CurrentMoneyInfo> childList = superIdSubListMap.get(parentID);
            if (childList == null) {
                childList = new ArrayList<>();
            }
            childList.add(item);
            superIdSubListMap.put(parentID, childList);
            it.remove();
            continue;
        }
    }
    // 添加子ID不在实时金额表中的父ID记录(单条父记录)
    superIdInfoMap.forEach((superId, info) -> {
        if (!superIdSubListMap.containsKey(superId)) {
            info.setCmSuperIdSum("");
            // 添加父记录
            srcList.add(info);
        }
    });
    // 添加父ID不在实时金额表中的子ID记录
    Iterator<Map.Entry<String, List<CurrentMoneyInfo>>> ite = superIdSubListMap.entrySet().iterator();
    while (ite.hasNext()) {
        Map.Entry<String, List<CurrentMoneyInfo>> entry = ite.next();
        String superId = entry.getKey();
        CurrentMoneyInfo superInfo = superIdInfoMap.get(superId);
        if (superInfo == null) {
            for (CurrentMoneyInfo info : entry.getValue()) {
                // 添加子记录
                srcList.add(info);
            }
            // 删除
            ite.remove();
        }
    }
    // 计算总和并填充父子节点和空行
    String superId = "";
    // 空开一行
    srcList.add(new CurrentMoneyInfo());
    for (Map.Entry<String, List<CurrentMoneyInfo>> entry : superIdSubListMap.entrySet()) {
        superId = entry.getKey();
        CurrentMoneyInfo superInfo = superIdInfoMap.get(superId);
        // 计算父节点总和
        List<CurrentMoneyInfo> subInfoList = entry.getValue();
        // 合并ID节点总和
        Double superIdSum = 0d;
        for (CurrentMoneyInfo info : subInfoList) {
            superIdSum += NumUtil.getNum(info.getShishiJine());
        }
        superInfo.setCmSuperIdSum(NumUtil.digit0(superIdSum + NumUtil.getNum(superInfo.getShishiJine())));
        // 添加空行和子节点
        // 先添加父节点
        srcList.add(superInfo);
        for (CurrentMoneyInfo info : subInfoList) {
            // 再添加子节点
            srcList.add(info);
        }
        // 空开一行
        srcList.add(new CurrentMoneyInfo());
    }
    // 更新
    ObservableList<CurrentMoneyInfo> obList = FXCollections.observableArrayList();
    for (CurrentMoneyInfo cmi : srcList) {
        obList.add(cmi);
    }
    tableCurrentMoneyInfo.setItems(obList);
    tableCurrentMoneyInfo.refresh();
}
Also used : HashMap(java.util.HashMap) CurrentMoneyInfo(com.kendy.entity.CurrentMoneyInfo) LinkedList(java.util.LinkedList) List(java.util.List) ObservableList(javafx.collections.ObservableList) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) Map(java.util.Map) HashMap(java.util.HashMap)

Example 30 with CurrentMoneyInfo

use of com.kendy.entity.CurrentMoneyInfo in project financial by greatkendy123.

the class ShangmaService method refresh_cmiMap_if_null.

/**
 * 重新加载cmiMap如果为空
 * @time 2017年12月4日
 */
public static void refresh_cmiMap_if_null() {
    MyController mc = Main.myController;
    if (mc == null) {
        ErrorUtil.err("获取MyCtroller为空");
        return;
    }
    // 获取最新的实时金额Map {玩家ID={}}
    Map<String, CurrentMoneyInfo> lastCMIMap = new HashMap<>();
    ;
    ObservableList<CurrentMoneyInfo> obList = mc.tableCurrentMoneyInfo.getItems();
    if (obList != null) {
        String pId = "";
        for (CurrentMoneyInfo cmiInfo : obList) {
            pId = cmiInfo.getWanjiaId();
            if (!StringUtil.isBlank(pId)) {
                lastCMIMap.put(pId, cmiInfo);
            }
        }
    }
    ShangmaService.cmiMap = lastCMIMap;
}
Also used : HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) CurrentMoneyInfo(com.kendy.entity.CurrentMoneyInfo) MyController(application.MyController)

Aggregations

CurrentMoneyInfo (com.kendy.entity.CurrentMoneyInfo)39 LinkedList (java.util.LinkedList)14 ArrayList (java.util.ArrayList)13 HashMap (java.util.HashMap)13 List (java.util.List)12 ObservableList (javafx.collections.ObservableList)12 Map (java.util.Map)11 Player (com.kendy.entity.Player)10 TeamInfo (com.kendy.entity.TeamInfo)6 ProfitInfo (com.kendy.entity.ProfitInfo)5 Node (javafx.scene.Node)5 MyController (application.MyController)4 KaixiaoInfo (com.kendy.entity.KaixiaoInfo)4 ZijinInfo (com.kendy.entity.ZijinInfo)4 Alert (javafx.scene.control.Alert)4 ButtonType (javafx.scene.control.ButtonType)4 DangjuInfo (com.kendy.entity.DangjuInfo)3 JiaoshouInfo (com.kendy.entity.JiaoshouInfo)3 PingzhangInfo (com.kendy.entity.PingzhangInfo)3 ShangmaInfo (com.kendy.entity.ShangmaInfo)3