Search in sources :

Example 1 with CurrentMoneyInfo

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

the class MoneyService method getNextSelectedIndex.

/**
 * 获取下一个要展示的位置
 *
 * @time 2017年11月12日
 * @param table
 * @param searchText
 * @return
 */
private static Integer getNextSelectedIndex(TableView<CurrentMoneyInfo> table, String searchText) {
    List<Integer> indexList = new LinkedList<>();
    if (!StringUtil.isBlank(searchText)) {
        if (table == null || table.getItems() == null) {
            return -1;
        }
        ObservableList<CurrentMoneyInfo> list = table.getItems();
        String tempName = "";
        int selectedIndex = table.getSelectionModel().getSelectedIndex();
        for (CurrentMoneyInfo moneyInfo : list) {
            tempName = moneyInfo.getMingzi();
            if (!StringUtil.isBlank(tempName)) {
                if (tempName.contains(searchText.trim()) || tempName.toLowerCase().contains(searchText.trim().toLowerCase()) || tempName.toUpperCase().contains(searchText.trim().toUpperCase())) {
                    int index = list.indexOf(moneyInfo);
                    indexList.add(index);
                }
            }
        }
        ;
        int size = indexList.size();
        // 返回排序序号
        if (size == 0) {
            return -1;
        } else if (size == 1) {
            // 返回第一个
            return indexList.get(0);
        } else {
            if (indexList.contains(selectedIndex)) {
                int i = indexList.indexOf(selectedIndex);
                if (i == (size - 1)) {
                    // 返回第一个
                    return indexList.get(0);
                } else {
                    // 返回下一个
                    return indexList.get(i + 1);
                }
            } else {
                // 返回第一个
                return indexList.get(0);
            }
        }
    }
    return -1;
}
Also used : CurrentMoneyInfo(com.kendy.entity.CurrentMoneyInfo) LinkedList(java.util.LinkedList)

Example 2 with CurrentMoneyInfo

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

the class MoneyService method del_SSJE_byId.

/**
 * 根据玩家ID删除实时金额记录
 *
 * @time 2017年11月12日
 * @param playerId
 */
public static void del_SSJE_byId(String playerId) {
    if (!StringUtil.isBlank(playerId) && tableCurrentMoneyInfo != null && tableCurrentMoneyInfo.getItems().size() > 0) {
        update_Table_CMI_Map();
        CurrentMoneyInfo ssjeInfo = Table_CMI_Map.get(playerId);
        if (ssjeInfo == null) {
            return;
        }
        CurrentMoneyInfo info = null;
        for (CurrentMoneyInfo moneyInfo : tableCurrentMoneyInfo.getItems()) {
            if (playerId.equals(moneyInfo.getWanjiaId())) {
                info = moneyInfo;
            }
        }
        if (info != null) {
            tableCurrentMoneyInfo.getItems().remove(info);
        }
    }
}
Also used : CurrentMoneyInfo(com.kendy.entity.CurrentMoneyInfo)

Example 3 with CurrentMoneyInfo

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

the class MoneyService method get_SSJE_byId.

/**
 * 根据玩家ID获取实时金额(在少量的情况下可以用);
 *
 * @time 2017年11月12日
 * @param playerId
 * @return
 */
public static String get_SSJE_byId(String playerId) {
    update_Table_CMI_Map();
    CurrentMoneyInfo ssjeInfo = Table_CMI_Map.get(playerId);
    if (ssjeInfo == null) {
        return "0";
    }
    return StringUtil.isBlank(ssjeInfo.getShishiJine()) ? "0" : ssjeInfo.getShishiJine();
}
Also used : CurrentMoneyInfo(com.kendy.entity.CurrentMoneyInfo)

Example 4 with CurrentMoneyInfo

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

the class MoneyService method fillTableCurrentMoneyInfo2.

/**
 * 将前一次的实时金额数据备份到第01表=== 非2017-01-01
 * @param table
 * @param userInfoList
 */
public static void fillTableCurrentMoneyInfo2(TableView<TeamInfo> tableTeam, TableView<CurrentMoneyInfo> table, TableView<ZijinInfo> tableZijin, TableView<ProfitInfo> tableProfit, TableView<KaixiaoInfo> tableKaixiao, Label LMLabel) {
    Map<String, String> map = DataConstans.preDataMap;
    /**
     ********************************************** 团队回水表  *************
     */
    tableTeam.setItems(null);
    ObservableList<TeamInfo> obList = FXCollections.observableArrayList();
    List<TeamInfo> teamList = JSON.parseObject(DataConstans.preDataMap.get("团队回水"), new TypeReference<List<TeamInfo>>() {
    });
    for (TeamInfo info : teamList) {
        obList.add(info);
    }
    tableTeam.setItems(obList);
    /**
     ********************************************** 实时金额表  *************
     */
    // 1清空 表数据
    table.setItems(null);
    // 2获取InfoList
    ObservableList<CurrentMoneyInfo> obListCurrentMoney = FXCollections.observableArrayList();
    List<CurrentMoneyInfo> cmList = JSON.parseObject(DataConstans.preDataMap.get("实时金额"), new TypeReference<List<CurrentMoneyInfo>>() {
    });
    for (CurrentMoneyInfo info : cmList) {
        obListCurrentMoney.add(info);
    }
    table.setItems(obListCurrentMoney);
    table.refresh();
    // 合并ID操作
    flush_SSJE_table();
    /**
     ********************************************** 资金表  *************
     */
    // 1清空 表数据
    tableZijin.setItems(null);
    // 2获取InfoList
    ObservableList<ZijinInfo> obListZijin = FXCollections.observableArrayList();
    List<ZijinInfo> zijinList = JSON.parseObject(DataConstans.preDataMap.get("资金"), new TypeReference<List<ZijinInfo>>() {
    });
    for (ZijinInfo info : zijinList) {
        obListZijin.add(info);
    }
    tableZijin.setItems(obListZijin);
    /**
     ********************************************** 利润表  *************
     */
    // 1清空 表数据
    tableProfit.setItems(null);
    // 2获取InfoList
    ObservableList<ProfitInfo> obListProfit = FXCollections.observableArrayList();
    List<ProfitInfo> profitList = JSON.parseObject(DataConstans.preDataMap.get("利润"), new TypeReference<List<ProfitInfo>>() {
    });
    for (ProfitInfo info : profitList) {
        obListProfit.add(info);
    }
    tableProfit.setItems(obListProfit);
    /**
     ********************************************** 实时开销表  *************
     */
    tableKaixiao.setItems(null);
    // 2获取InfoList
    ObservableList<KaixiaoInfo> obListKaixiao = FXCollections.observableArrayList();
    List<KaixiaoInfo> kaixiaoList = JSON.parseObject(DataConstans.preDataMap.get("实时开销"), new TypeReference<List<KaixiaoInfo>>() {
    });
    for (KaixiaoInfo info : kaixiaoList) {
        obListKaixiao.add(info);
    }
    // add 注释掉:新一天的统计中实时开销为空
    tableKaixiao.setItems(obListKaixiao);
    // 缓存一一场的实时开销总和
    DataConstans.SumMap.put("上场开销", getSumOfTableKaixiao(tableKaixiao));
    /**
     ********************************************** 联盟对帐  *************
     */
    String lm = DataConstans.preDataMap.get("联盟对帐");
    // LMLabel.setText(LMLabel.getText());//注意这里是{联盟对帐={联盟对帐=3000}}
    // 注意这里是{联盟对帐={联盟对帐=3000}}
    LMLabel.setText(lm);
}
Also used : KaixiaoInfo(com.kendy.entity.KaixiaoInfo) TeamInfo(com.kendy.entity.TeamInfo) CurrentMoneyInfo(com.kendy.entity.CurrentMoneyInfo) ProfitInfo(com.kendy.entity.ProfitInfo) ZijinInfo(com.kendy.entity.ZijinInfo) List(java.util.List) ObservableList(javafx.collections.ObservableList) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList)

Example 5 with CurrentMoneyInfo

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

the class MoneyService method getSumOfTableCurrentMoney.

/**
 * 计算实时金额表的总和
 */
private static Double getSumOfTableCurrentMoney(TableView<CurrentMoneyInfo> table) {
    // 获取ObserableList
    ObservableList<CurrentMoneyInfo> list = table.getItems();
    Double sumOfTableCurrentMoney = 0.0;
    if (list == null)
        return sumOfTableCurrentMoney;
    // 实时金额表中每一行的具体金额
    String tempSingleVal = "";
    for (CurrentMoneyInfo moneyInfo : list) {
        tempSingleVal = moneyInfo.getShishiJine();
        if (!StringUtil.isBlank(tempSingleVal) && !"".equals(moneyInfo.getMingzi())) {
            sumOfTableCurrentMoney += getNum(tempSingleVal);
        }
    }
    ;
    return sumOfTableCurrentMoney;
}
Also used : CurrentMoneyInfo(com.kendy.entity.CurrentMoneyInfo)

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