Search in sources :

Example 11 with CurrentMoneyInfo

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

the class TgWaizhaiService method handlePersonWaizhai.

/**
 * 处理个人外债和有联合额度的外债
 * @time 2017年12月28日
 * @param tgTeamIdMap
 * @param ssje_map
 */
private static void handlePersonWaizhai(Map<String, List<CurrentMoneyInfo>> tgTeamIdMap, Map<String, CurrentMoneyInfo> ssje_map) {
    if (MapUtil.isNullOrEmpty(tgTeamIdMap))
        return;
    Map<String, List<CurrentMoneyInfo>> _tgTeamIdMap = new HashMap<>();
    // 临时用的变量
    Map<String, List<CurrentMoneyInfo>> tempSuperMap = new HashMap<>();
    // {父ID : 复制的CurrentMoneyInfo}
    Map<String, CurrentMoneyInfo> tempSuperInfoMap = new HashMap<>();
    // 对负数的实时金额表记录进行处理,主要是对合并ID的记录进行
    Iterator<Map.Entry<String, List<CurrentMoneyInfo>>> it = tgTeamIdMap.entrySet().iterator();
    while (it.hasNext()) {
        Map.Entry<String, List<CurrentMoneyInfo>> entry = it.next();
        String gudongID = entry.getKey();
        List<CurrentMoneyInfo> subList = entry.getValue();
        ListIterator<CurrentMoneyInfo> ite = subList.listIterator();
        // 删除有联合额度的子ID(只保留父节点信息,联合额度为负数),注意此父节点为复制的
        while (ite.hasNext()) {
            CurrentMoneyInfo cmiInfo = ite.next();
            String playerId = cmiInfo.getWanjiaId();
            boolean isSubId = DataConstans.Combine_Sub_Id_Map.containsKey(playerId);
            boolean isSuperId = DataConstans.Combine_Super_Id_Map.containsKey(playerId);
            // 是子节点
            if (isSubId) {
                String superId = DataConstans.Combine_Sub_Id_Map.get(playerId);
                boolean isSuperInfo_exist_in_ssje = isExistIn_SSJE(superId, ssje_map);
                if (isSuperInfo_exist_in_ssje) {
                    // 父节点存在于实时金额表,直接删掉子ID
                    log.info("外债:删除子节点(" + getPlayerName(playerId) + "),其父节点是" + getSuperPlayerName(playerId));
                    ite.remove();
                // 特殊情况:此时父节点>=0
                } else // Question:模拟的父节点是否要添加进来????
                {
                    // //父节点不存在于实时金额表,直接删掉子ID
                    // CurrentMoneyInfo tempNewSuperInfo = getTempNewSuperInfo(superId,tempSuperMap);
                    // ite.remove();//也要删掉
                    // ite.add(tempNewSuperInfo);//添加一条模拟的父节点于外债表中
                    log.error("外债:进入未开发的代码(" + getPlayerName(playerId) + "),子节点在实时金额表,但父子点并未在金额表中!");
                }
            }
            // 删除联合额度为正数的父节点(合并id总和为正,不提取进外债菜单显示)
            if (isSuperId) {
                if (isSubId) {
                    ErrorUtil.err(String.format("玩家ID(%s)既是子ID,又是父ID", playerId));
                }
                String superId = playerId;
                if (superId != null && tempSuperInfoMap.get(superId) == null) {
                    // CurrentMoneyInfo superInfo = ssje_map.get(playerId);
                    CurrentMoneyInfo superInfo = cmiInfo;
                    if (superInfo != null && NumUtil.getNum(superInfo.getCmSuperIdSum()) >= 0) {
                        log.info("外债:删除父节点(" + getPlayerName(playerId) + "),其联合ID为正");
                        ite.remove();
                    }
                    if (superInfo != null && NumUtil.getNum(superInfo.getCmSuperIdSum()) < 0) {
                        log.info(String.format("外债:修改父节点%s的实时金额从%s到%s", getPlayerName(superId), superInfo.getShishiJine(), superInfo.getCmSuperIdSum()));
                        // 核心
                        superInfo.setShishiJine(superInfo.getCmSuperIdSum());
                        tempSuperInfoMap.put(superId, superInfo);
                    }
                }
            }
        // Question:对于实时金额表中有,但其团队已经存在于左边的团队信息框中,是要加在团队信息中,而自己不显示???
        }
    }
}
Also used : HashMap(java.util.HashMap) CurrentMoneyInfo(com.kendy.entity.CurrentMoneyInfo) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) List(java.util.List) ObservableList(javafx.collections.ObservableList) HashMap(java.util.HashMap) Map(java.util.Map)

Example 12 with CurrentMoneyInfo

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

the class TgWaizhaiService method get_SSJE_Gudong_Map.

/**
 * 获取每个托管团队的实时金额
 * 备注:不包括个人和存在于左边的团队
 */
public static Map<String, List<CurrentMoneyInfo>> get_SSJE_Gudong_Map(TableView<CurrentMoneyInfo> tableCurrentMoneyInfo) {
    int pageIndex = DataConstans.Index_Table_Id_Map.size();
    if (pageIndex < 0) {
        return new HashMap<>();
    }
    // 获取托管团队ID
    Set<String> tgTeamIdSet = getTGTeamId();
    // 获取实时金额数据
    List<CurrentMoneyInfo> CurrentMoneyInfoList = new ArrayList<>();
    for (CurrentMoneyInfo infos : tableCurrentMoneyInfo.getItems()) {
        CurrentMoneyInfoList.add(infos);
    }
    // 情况2:从最新的锁定表中获取数据
    // CurrentMoneyInfoList = JSON.parseObject(MoneyService.getJsonString(map,"实时金额"), new TypeReference<List<CurrentMoneyInfo>>() {});
    // 添加只属于托管的团队和个人信息
    List<CurrentMoneyInfo> SSJE_obList = new LinkedList<>();
    for (CurrentMoneyInfo infos : CurrentMoneyInfoList) {
        if (!StringUtil.isAnyBlank(infos.getWanjiaId(), infos.getMingzi())) {
            String playerId = infos.getWanjiaId();
            Player player = DataConstans.membersMap.get(playerId);
            if (player == null || StringUtil.isBlank(player.getTeamName()) || !tgTeamIdSet.contains(player.getTeamName().toUpperCase())) {
                continue;
            } else if (tgTeamIdSet.contains(player.getTeamName().toUpperCase())) {
                // 深层克隆
                SSJE_obList.add(copyCurrentMoneyInfo(infos));
            }
        }
    }
    // 获取每个股东的实时金额数据
    List<String> gudongList = DataConstans.gudongList;
    int gudongSize = gudongList.size();
    List<CurrentMoneyInfo> eachGudongList = null;
    // 托管团队的实时金额信息{ 托管团队:托管团队金额列表List}
    String playerId;
    Player player;
    // 步骤1:添加玩家
    Map<String, List<CurrentMoneyInfo>> tgTeamCMIMap = SSJE_obList.stream().filter(infos -> {
        boolean isSuperId = DataConstans.Combine_Super_Id_Map.containsKey(infos.getWanjiaId());
        if (!isSuperId) {
            // 为解决联合ID的问题,在这里把父节点信息加了进来,后面会把父节点的联合额度为0或空的清除掉,问题:能否在此处就过滤过??
            if (StringUtil.isBlank(infos.getShishiJine()) || "0".equals(infos.getShishiJine()) || !infos.getShishiJine().contains("-")) {
                return false;
            }
        }
        return true;
    }).collect(Collectors.groupingBy(info -> {
        CurrentMoneyInfo cmi = (CurrentMoneyInfo) info;
        Player p = DataConstans.membersMap.get(cmi.getWanjiaId());
        if (p == null) {
            return UNKNOW_TG_TEAM;
        } else {
            return p.getTeamName();
        }
    }));
    // 步骤2:处理个人外债和有联合额度的外债
    // Map<String,CurrentMoneyInfo> ssje_map = get_SSJE_Map(SSJE_obList);
    // handlePersonWaizhai(tgTeamIdMap,ssje_map); TODO
    System.out.println("===============================================以上外债信息为:处理个人外债和有联合额度的外债finishes");
    tgTeamCMIMap = getFinalTGTeamMap(SSJE_obList);
    return tgTeamCMIMap;
}
Also used : ListIterator(java.util.ListIterator) NumUtil(com.kendy.util.NumUtil) FXCollections(javafx.collections.FXCollections) HashMap(java.util.HashMap) MapUtil(com.kendy.util.MapUtil) TypeValueInfo(com.kendy.entity.TypeValueInfo) ArrayList(java.util.ArrayList) TableColumn(javafx.scene.control.TableColumn) HashSet(java.util.HashSet) Logger(org.apache.log4j.Logger) Insets(javafx.geometry.Insets) StringUtil(com.kendy.util.StringUtil) Map(java.util.Map) MyController(application.MyController) LinkedList(java.util.LinkedList) TeamInfo(com.kendy.entity.TeamInfo) TableView(javafx.scene.control.TableView) DataConstans(application.DataConstans) DBUtil(com.kendy.db.DBUtil) Player(com.kendy.entity.Player) HBox(javafx.scene.layout.HBox) Iterator(java.util.Iterator) PropertyValueFactory(javafx.scene.control.cell.PropertyValueFactory) Node(javafx.scene.Node) DecimalFormat(java.text.DecimalFormat) Set(java.util.Set) TGController(com.kendy.controller.TGController) com.kendy.entity.zhaiwuInfo(com.kendy.entity.zhaiwuInfo) Collectors(java.util.stream.Collectors) TGCompanyModel(com.kendy.entity.TGCompanyModel) List(java.util.List) ZonghuiInfo(com.kendy.entity.ZonghuiInfo) Stream(java.util.stream.Stream) CollectUtil(com.kendy.util.CollectUtil) ShowUtil(com.kendy.util.ShowUtil) ObservableList(javafx.collections.ObservableList) ErrorUtil(com.kendy.util.ErrorUtil) Collections(java.util.Collections) CurrentMoneyInfo(com.kendy.entity.CurrentMoneyInfo) Player(com.kendy.entity.Player) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) CurrentMoneyInfo(com.kendy.entity.CurrentMoneyInfo) LinkedList(java.util.LinkedList) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) List(java.util.List) ObservableList(javafx.collections.ObservableList)

Example 13 with CurrentMoneyInfo

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

the class WaizhaiService method generateWaizhaiTables.

/**
 * 自动生成外债信息表
 * @param tableWaizhai
 * @param hbox
 * @param tableCurrentMoneyInfo
 * @param tableTeam
 */
@SuppressWarnings("unchecked")
public static void generateWaizhaiTables(TableView<WaizhaiInfo> tableWaizhai, HBox hbox, TableView<CurrentMoneyInfo> tableCurrentMoneyInfo, TableView<TeamInfo> tableTeam) {
    // 清空数据
    ObservableList<Node> allTables = hbox.getChildren();
    if (allTables != null && allTables.size() > 0)
        hbox.getChildren().remove(0, allTables.size());
    if (DataConstans.Index_Table_Id_Map.size() == 0) {
        ShowUtil.show("你当前还未锁定任意一局,查询没有数据!", 2);
        return;
    }
    ObservableList<CurrentMoneyInfo> CurrentMoneyInfo_OB_List = FXCollections.observableArrayList();
    Map<String, List<CurrentMoneyInfo>> gudongMap = get_SSJE_Gudong_Map(tableCurrentMoneyInfo, tableTeam);
    Map<String, String> sumMap = getSum(gudongMap);
    int gudongMapSize = gudongMap.size();
    if (gudongMapSize == 0) {
        ShowUtil.show("股东列表为空或实时金额为空!");
        return;
    }
    TableView<CurrentMoneyInfo> table;
    for (Map.Entry<String, List<CurrentMoneyInfo>> entry : gudongMap.entrySet()) {
        String gudongName = entry.getKey();
        List<CurrentMoneyInfo> list = entry.getValue();
        table = new TableView<CurrentMoneyInfo>();
        // 设置列
        TableColumn firstNameCol = new TableColumn("股东" + gudongName);
        firstNameCol.setPrefWidth(110);
        firstNameCol.setCellValueFactory(new PropertyValueFactory<CurrentMoneyInfo, String>("mingzi"));
        TableColumn lastNameCol = new TableColumn(sumMap.get(gudongName));
        lastNameCol.setStyle("-fx-alignment: CENTER;");
        lastNameCol.setPrefWidth(95);
        lastNameCol.setCellValueFactory(new PropertyValueFactory<CurrentMoneyInfo, String>("shishiJine"));
        lastNameCol.setCellFactory(MyController.getColorCellFactory(new CurrentMoneyInfo()));
        table.setPrefWidth(210);
        table.getColumns().addAll(firstNameCol, lastNameCol);
        // 设置数据
        CurrentMoneyInfo_OB_List = FXCollections.observableArrayList();
        for (CurrentMoneyInfo info : list) {
            CurrentMoneyInfo_OB_List.add(info);
        }
        table.setItems(CurrentMoneyInfo_OB_List);
        hbox.setSpacing(5);
        hbox.setPadding(new Insets(0, 0, 0, 0));
        hbox.getChildren().addAll(table);
    }
    // 设置债务表
    ObservableList<WaizhaiInfo> obList = FXCollections.observableArrayList();
    for (Map.Entry<String, String> entry : sumMap.entrySet()) {
        obList.add(new WaizhaiInfo(entry.getKey(), entry.getValue()));
    }
    tableWaizhai.setItems(obList);
    setWaizhaiSum(tableWaizhai);
}
Also used : Insets(javafx.geometry.Insets) WaizhaiInfo(com.kendy.entity.WaizhaiInfo) Node(javafx.scene.Node) CurrentMoneyInfo(com.kendy.entity.CurrentMoneyInfo) TableColumn(javafx.scene.control.TableColumn) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) List(java.util.List) ObservableList(javafx.collections.ObservableList) HashMap(java.util.HashMap) Map(java.util.Map)

Example 14 with CurrentMoneyInfo

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

the class WaizhaiService method get_SSJE_Gudong_Map.

/**
 * 获取每个股东的实时金额
 * 包括个人和存在于左边的团队
 * @time 2017年12月27日
 * @param tableCurrentMoneyInfo
 * @param tableTeam
 * @return
 */
public static Map<String, List<CurrentMoneyInfo>> get_SSJE_Gudong_Map(TableView<CurrentMoneyInfo> tableCurrentMoneyInfo, TableView<TeamInfo> tableTeam) {
    int pageIndex = DataConstans.Index_Table_Id_Map.size();
    if (pageIndex < 0) {
        return new HashMap<>();
    }
    // 获取实时金额数据
    Map<String, String> map = DataConstans.All_Locked_Data_Map.get(pageIndex + "");
    List<CurrentMoneyInfo> CurrentMoneyInfoList = null;
    List<TeamInfo> teamInfoList = null;
    // 情况1:从最新的表中获取数据
    if (tableTeam != null && tableTeam.getItems() != null) {
        CurrentMoneyInfoList = new ArrayList<>();
        for (CurrentMoneyInfo infos : tableCurrentMoneyInfo.getItems()) {
            CurrentMoneyInfoList.add(infos);
        }
        teamInfoList = new ArrayList<>();
        for (TeamInfo infos : tableTeam.getItems()) {
            teamInfoList.add(infos);
        }
    } else // 情况2:从最新的锁定表中获取数据
    {
        CurrentMoneyInfoList = JSON.parseObject(MoneyService.getJsonString(map, "实时金额"), new TypeReference<List<CurrentMoneyInfo>>() {
        });
        teamInfoList = JSON.parseObject(MoneyService.getJsonString(map, "团队回水"), new TypeReference<List<TeamInfo>>() {
        });
    }
    List<CurrentMoneyInfo> SSJE_obList = new LinkedList<>();
    for (CurrentMoneyInfo infos : CurrentMoneyInfoList) {
        if (!StringUtil.isBlank(infos.getWanjiaId()) && !StringUtil.isBlank(infos.getMingzi())) {
            SSJE_obList.add(infos);
        }
    }
    // 获取每个股东的实时金额数据
    List<String> gudongList = DataConstans.gudongList;
    int gudongSize = gudongList.size();
    List<CurrentMoneyInfo> eachGudongList = null;
    Map<String, List<CurrentMoneyInfo>> gudongMap = new HashMap<>();
    String playerId;
    Player player;
    // 步骤1:添加玩家
    for (CurrentMoneyInfo infos : SSJE_obList) {
        boolean isSuperId = DataConstans.Combine_Super_Id_Map.containsKey(infos.getWanjiaId());
        if (!isSuperId) {
            // 为解决联合ID的问题,在这里把父节点信息加了进来,后面会把父节点的联合额度为0或空的清除掉,问题:能否在此处就过滤过??
            if (StringUtil.isBlank(infos.getShishiJine()) || "0".equals(infos.getShishiJine()) || !infos.getShishiJine().contains("-")) {
                continue;
            }
        }
        // if(StringUtil.isBlank(infos.getShishiJine())
        // || "0".equals(infos.getShishiJine())
        // || !infos.getShishiJine().contains("-")) {
        // continue;
        // }
        playerId = infos.getWanjiaId();
        if (!StringUtil.isBlank(playerId)) {
            player = DataConstans.membersMap.get(playerId);
            if (player == null) {
                ShowUtil.show("名单列表中匹配不到该玩家!玩家名称:" + infos.getMingzi() + " ID是" + infos.getWanjiaId());
                continue;
            }
            if (gudongList.contains(player.getGudong())) {
                for (String gudong : gudongList) {
                    if (gudong.equals(player.getGudong())) {
                        if (gudongMap.get(gudong) == null) {
                            eachGudongList = new ArrayList<>();
                        // eachGudongList.add(infos);
                        } else {
                            eachGudongList = gudongMap.get(gudong);
                        // eachGudongList.add(infos);
                        }
                        /**
                         ***2018-01-01 add***
                         */
                        CurrentMoneyInfo tempInfo = copyCurrentMoneyInfo(infos);
                        eachGudongList.add(tempInfo);
                        /**
                         ******
                         */
                        gudongMap.put(gudong, eachGudongList);
                        break;
                    }
                }
            } else {
                ShowUtil.show("玩家的股东不存在于股东表中!玩家名称:" + infos.getMingzi() + " ID是" + infos.getWanjiaId());
                break;
            }
        } else {
            ShowUtil.show("玩家ID为空!玩家名称:" + infos.getMingzi() + " ID是" + infos.getWanjiaId());
        }
    }
    // 步骤2:处理个人外债和有联合额度的外债
    Map<String, CurrentMoneyInfo> ssje_map = get_SSJE_Map(SSJE_obList);
    handlePersonWaizhai(gudongMap, ssje_map);
    System.out.println("===============================================以上外债信息为:处理个人外债和有联合额度的外债finishes");
    // 步骤3:添加团队
    for (TeamInfo infos : teamInfoList) {
        String teamId = infos.getTeamID();
        Huishui hsInfo = DataConstans.huishuiMap.get(teamId);
        if (hsInfo == null) {
            ErrorUtil.err("外债信息:添加负数团队时检测到缓存中没有该团队信息,团队ID:" + teamId);
            continue;
        }
        String isManaged = hsInfo.getZjManaged();
        String gudong = hsInfo.getGudong();
        String hasJiesuan = infos.getHasJiesuaned();
        String zhanji = infos.getTeamZJ();
        if (// 战绩非管理的团队
        !"是".equals(isManaged) && // 未结算的团队
        !"1".equals(hasJiesuan) && zhanji.contains("-")) {
            // 战绩为负数的团队
            CurrentMoneyInfo cmi = new CurrentMoneyInfo();
            cmi.setMingzi("团队" + teamId);
            cmi.setShishiJine(infos.getTeamZJ());
            if (gudongMap.get(gudong) == null) {
                eachGudongList = new ArrayList<>();
                eachGudongList.add(cmi);
            } else {
                eachGudongList = gudongMap.get(gudong);
                eachGudongList.add(cmi);
            }
            gudongMap.put(gudong, eachGudongList);
        }
    }
    /*
		 * A、负数个人(若其父节点的联合额度为正则不显示 )
		 * B、公司(不显示团队;若其父节点的联合额度为正则不显示,否则不显示子ID,只显示联合额度;其他节点不变
		 * C、非公司团队(全部累加到相应团队;若其父节点的联合额度为正则只累加联合额度;其他节点累加实时金额)
		 */
    if (MapUtil.isHavaValue(gudongMap)) {
        // LMController.allClubMap.keySet().forEach(clubID -> log.info(LMController.allClubMap.keySet()));
        Iterator<Map.Entry<String, List<CurrentMoneyInfo>>> it = gudongMap.entrySet().iterator();
        while (it.hasNext()) {
            Map.Entry<String, List<CurrentMoneyInfo>> entry = it.next();
            String gudongName = entry.getKey();
            // if(!"B".equals(gudongName)) continue;//只测试股东B
            List<CurrentMoneyInfo> eachList = entry.getValue();
            // 深层复制
            List<CurrentMoneyInfo> tempEachList = copyListCurrentMoneyInfo(eachList);
            List<CurrentMoneyInfo> tempSuperList = new ArrayList<>();
            // 过滤掉没有负数团队的股东,过滤掉没有联合ID的股东
            if (CollectUtil.isNullOrEmpty(eachList))
                continue;
            // if(eachList.stream().filter(cmi->cmi.getMingzi().startsWith("团队")).count() == 0) continue;
            if (eachList.stream().filter(cmi -> DataConstans.Combine_Super_Id_Map.containsKey(cmi.getWanjiaId())).count() == 0)
                continue;
            // 处理包含有负数团队的股东(既有联合ID,又有负数团队)
            ListIterator<CurrentMoneyInfo> ite = eachList.listIterator();
            while (ite.hasNext()) {
                CurrentMoneyInfo cmi = ite.next();
                String pId = cmi.getWanjiaId();
                // TODO 对下面的特殊情况进行分析
                if (pId == null && cmi.getMingzi() != null && cmi.getMingzi().startsWith("团队")) {
                    continue;
                }
                boolean isSuperId = DataConstans.Combine_Super_Id_Map.containsKey(pId);
                // 1528833636
                Player _player = DataConstans.membersMap.get(pId);
                // 如ST,公司
                String teamID = _player.getTeamName();
                // 将联合ID的金额设置到对应的团队里
                if (isSuperId) {
                    String playerName = DataConstans.membersMap.get(pId).getPlayerName();
                    if ("公司".equals(teamID)) {
                        final String _cmSuperIdSum = cmi.getCmSuperIdSum();
                        cmi.setShishiJine(_cmSuperIdSum);
                        log.info(String.format("外债:股东%s--属于公司的父节点%s(%s)设置联合额度%s为实时金额", gudongName, playerName, pId, _cmSuperIdSum));
                        continue;
                    }
                    final String _teamId = "团队" + DataConstans.membersMap.get(pId).getTeamName();
                    Optional<CurrentMoneyInfo> teamInfoOpt = eachList.stream().filter(info -> info.getMingzi().equals(_teamId)).findFirst();
                    if (teamInfoOpt.isPresent()) {
                        CurrentMoneyInfo teamInfo = teamInfoOpt.get();
                        teamInfo.setShishiJine(NumUtil.getSum(teamInfo.getShishiJine(), cmi.getShishiJine()));
                        ite.remove();
                        log.info(String.format("外债:股东%s--有联合ID的父节点%s(%s)将%s转移到%s,并删除父节点", gudongName, playerName, pId, cmi.getShishiJine(), teamInfo.getMingzi()));
                    } else {
                        // 新增一个所属团队信息
                        ite.remove();
                        CurrentMoneyInfo cmiInfo = new CurrentMoneyInfo(_teamId, cmi.getCmSuperIdSum(), "", "");
                        ite.add(cmiInfo);
                        log.info(String.format("外债:股东%s--根据父点(%s)新建团队外债信息(%s),联合额度(团队的实时金额)为%s,并删除父节点", gudongName, playerName, _teamId, cmi.getCmSuperIdSum()));
                    }
                } else // 非公司团队,非父节点,累加进其所属的团队中
                if (!"公司".equals(teamID)) {
                    String playerName = DataConstans.membersMap.get(pId).getPlayerName();
                    final String _teamId = "团队" + DataConstans.membersMap.get(pId).getTeamName();
                    Optional<CurrentMoneyInfo> teamInfoOpt = eachList.stream().filter(info -> info.getMingzi().equals(_teamId)).findFirst();
                    if (teamInfoOpt.isPresent()) {
                        CurrentMoneyInfo teamInfo = teamInfoOpt.get();
                        teamInfo.setShishiJine(NumUtil.getSum(teamInfo.getShishiJine(), cmi.getShishiJine()));
                        ite.remove();
                        log.info(String.format("外债:股东%s--非父节点%s(%s)将%s转移到%s,并删除非父节点", gudongName, playerName, pId, cmi.getShishiJine(), teamInfo.getMingzi()));
                    } else {
                        // 新增一个所属团队信息
                        ite.remove();
                        CurrentMoneyInfo cmiInfo = new CurrentMoneyInfo(_teamId, cmi.getShishiJine(), "", "");
                        ite.add(cmiInfo);
                        log.info(String.format("外债:股东%s--根据非父点(%s)新建团队外债信息(%s),联合额度(团队的实时金额)为%s,并删除非父节点", gudongName, playerName, _teamId, cmi.getShishiJine()));
                    }
                }
            }
        }
    }
    return gudongMap;
}
Also used : ListIterator(java.util.ListIterator) NumUtil(com.kendy.util.NumUtil) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) FXCollections(javafx.collections.FXCollections) HashMap(java.util.HashMap) MapUtil(com.kendy.util.MapUtil) Club(com.kendy.entity.Club) Huishui(com.kendy.entity.Huishui) ArrayList(java.util.ArrayList) TableColumn(javafx.scene.control.TableColumn) Logger(org.apache.log4j.Logger) Insets(javafx.geometry.Insets) WaizhaiInfo(com.kendy.entity.WaizhaiInfo) StringUtil(com.kendy.util.StringUtil) Map(java.util.Map) MyController(application.MyController) LinkedList(java.util.LinkedList) TeamInfo(com.kendy.entity.TeamInfo) TableView(javafx.scene.control.TableView) DataConstans(application.DataConstans) Player(com.kendy.entity.Player) HBox(javafx.scene.layout.HBox) Iterator(java.util.Iterator) PropertyValueFactory(javafx.scene.control.cell.PropertyValueFactory) Node(javafx.scene.Node) DecimalFormat(java.text.DecimalFormat) com.kendy.entity.zhaiwuInfo(com.kendy.entity.zhaiwuInfo) LMController(com.kendy.controller.LMController) List(java.util.List) ZonghuiInfo(com.kendy.entity.ZonghuiInfo) JSON(com.alibaba.fastjson.JSON) TypeReference(com.alibaba.fastjson.TypeReference) CollectUtil(com.kendy.util.CollectUtil) ShowUtil(com.kendy.util.ShowUtil) Optional(java.util.Optional) ObservableList(javafx.collections.ObservableList) ErrorUtil(com.kendy.util.ErrorUtil) CurrentMoneyInfo(com.kendy.entity.CurrentMoneyInfo) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) CurrentMoneyInfo(com.kendy.entity.CurrentMoneyInfo) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) List(java.util.List) ObservableList(javafx.collections.ObservableList) TypeReference(com.alibaba.fastjson.TypeReference) Huishui(com.kendy.entity.Huishui) Player(com.kendy.entity.Player) Optional(java.util.Optional) TeamInfo(com.kendy.entity.TeamInfo) LinkedList(java.util.LinkedList) HashMap(java.util.HashMap) Map(java.util.Map)

Example 15 with CurrentMoneyInfo

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

the class CombineIDController method CancelcombineIdAction.

// 根据父ID解散该父子ID的合并关系
public void CancelcombineIdAction(ActionEvent event) {
    String parentNameAndId = parentIdField.getText();
    if (StringUtil.isBlank(parentNameAndId)) {
        ShowUtil.show("请先选择父ID!");
        return;
    } else {
        Alert alert = new Alert(AlertType.CONFIRMATION);
        alert.setTitle(parentNameAndId);
        alert.setHeaderText(null);
        alert.setContentText("你确定要解散该合并ID吗?\r\n父ID:" + parentNameAndId);
        Optional<ButtonType> result = alert.showAndWait();
        if (result.get() == ButtonType.OK) {
            String parentId = getIdFromStr(parentNameAndId);
            Set<String> subIdSet = DataConstans.Combine_Super_Id_Map.get(parentId);
            if (subIdSet == null) {
                ShowUtil.show(parentNameAndId + "无子ID,不需要解除哦");
                return;
            } else {
                // 删除父节点
                DataConstans.Combine_Super_Id_Map.remove(parentId);
                // 删除子节点
                for (String subId : subIdSet) {
                    DataConstans.Combine_Sub_Id_Map.remove(subId);
                }
                ShowUtil.show("已解散该父子ID的合并关系", 3);
                // 刷新实时金额表
                CurrentMoneyInfo info = MoneyService.getInfoById(parentId);
                if (info != null) {
                    info.setCmSuperIdSum("");
                    MoneyService.refreshRecord();
                }
                MoneyService.flush_SSJE_table();
                // 刷新上码表
                // 更新到数据库
                DBUtil.cancelCombineId(parentId);
            }
        }
    }
}
Also used : Alert(javafx.scene.control.Alert) CurrentMoneyInfo(com.kendy.entity.CurrentMoneyInfo) ButtonType(javafx.scene.control.ButtonType)

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