Search in sources :

Example 21 with Huishui

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

the class MoneyService method fillTablePaiju.

public static void fillTablePaiju(TableView<WanjiaInfo> tablePaiju, ObservableList<WanjiaInfo> tableWanjiaInfoList) {
    List<WanjiaInfo> linkedList = new LinkedList<>();
    List<WanjiaInfo> noNeedPayList = new ArrayList<>();
    if (tableWanjiaInfoList != null && tableWanjiaInfoList.size() > 0) {
        for (WanjiaInfo info : tableWanjiaInfoList) {
            linkedList.add(info);
        }
        ListIterator<WanjiaInfo> it = linkedList.listIterator();
        WanjiaInfo wj = null;
        while (it.hasNext()) {
            wj = it.next();
            // //解决不时本应支付确显示成已支付的bug
            // if(!"1".equals(wj.getHasPayed())){
            // btn.setText("支付");
            // }else {
            // btn.setText("已支付");
            // }
            // setGraphic(btn);//小林:这一行解决了支付按钮消失的问题
            // 在此处增加是否要显示该按钮(如果玩家从属于某个非空或非公司的团队,则无需显示按钮)
            // 这个tempTeamId是hasPayed的内容,这里没有公司的人
            String tempTeamId = wj.getHasPayed();
            if (!StringUtil.isBlank(tempTeamId) && !"0".equals(tempTeamId)) {
                // 获取团队信息
                Huishui hs = DataConstans.huishuiMap.get(tempTeamId);
                // 情况一:有从属团队的玩家,再分两种情况
                if (hs != null) {
                    // A:若团队战绩要管理,需要显示支付按钮
                    if ("是".equals(hs.getZjManaged())) {
                    // log.info("====teamId为不为空,要显示,要战绩管理:是");
                    // setGraphic(btn);
                    // B:若团队战绩不要管理,无须显示支付按钮
                    } else {
                        noNeedPayList.add(wj);
                        it.remove();
                    // log.info("hsPayed:====================hs为空:"+hs.getZjManaged());
                    // setGraphic(null);
                    }
                }
            } else {
            // log.info("====teamId为空或为0,要显示+"+DataConstans.membersMap.get(wj.getWanjiaId()).getTeamName());
            // //情况二:对于没有从从属的团队的玩家或者团队是公司的玩家,一定需要需要显示支付按钮
            // setGraphic(btn);
            }
        }
        if (noNeedPayList.size() > 0) {
            for (WanjiaInfo info : noNeedPayList) {
                linkedList.add(info);
            }
        }
        if (noNeedPayList != null && noNeedPayList.size() > 0) {
            tableWanjiaInfoList.clear();
            for (WanjiaInfo info : linkedList) {
                tableWanjiaInfoList.add(info);
            }
        }
        // 刷新牌局表
        tablePaiju.setItems(tableWanjiaInfoList);
        tablePaiju.refresh();
    }
}
Also used : Huishui(com.kendy.entity.Huishui) WanjiaInfo(com.kendy.entity.WanjiaInfo) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList)

Example 22 with Huishui

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

the class ShangmaService method updateTeamYajinAndEdu.

/**
 * 保存实时上码中的团队押金与团队额度修改, 包括团队可上码(打勾)
 */
public static void updateTeamYajinAndEdu() {
    String teamId = shangmaTeamIdLabel.getText();
    if (StringUtil.isNotBlank(teamId)) {
        String teamAvailableValue = smTeamShangmaCheckBox.isSelected() ? "1" : "0";
        boolean updateOK = DBUtil.updateTeamYajinAndEdu(teamId, teamYajin.getText(), teamEdu.getText(), teamAvailableValue);
        if (updateOK) {
            // 更新缓存
            Huishui team = DataConstans.huishuiMap.get(teamId);
            if (team != null) {
                team.setTeamYajin(teamYajin.getText());
                team.setTeamEdu(teamEdu.getText());
                team.setTeamAvailabel(teamAvailableValue);
                // 重新加载
                loadShangmaTable(teamId, tableSM);
                ShowUtil.show("保存成功!", 2);
            } else {
                ShowUtil.show("保存实时上码中的团队押金与团队额度修改, 包括团队可上码(打勾)失败!原因:" + teamId + "找不到对应的缓存记录");
            }
        } else {
            ShowUtil.show("保存失败!");
        }
    } else {
        ShowUtil.show("保存失败,当前团队ID为空!");
    }
}
Also used : Huishui(com.kendy.entity.Huishui)

Example 23 with Huishui

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

the class TeamProxyService method initTeamSelectAction.

@SuppressWarnings("unchecked")
public static void initTeamSelectAction(ComboBox<String> teamIDCombox, CheckBox isZjManage, TableView<ProxyTeamInfo> tableProxyTeam, HBox proxySumHBox) {
    teamIDCombox.getSelectionModel().selectedItemProperty().addListener(new ChangeListener() {

        @Override
        public void changed(ObservableValue observable, Object oldValue, Object newValue) {
            refresh_TableTeamProxy_TableProxySum(newValue);
            // add 团队保险比例为0默认将hasTeamBaoxian打勾
            if (newValue != null && StringUtil.isNotBlank(newValue.toString())) {
                Huishui huishui = DataConstans.huishuiMap.get(newValue);
                if (huishui != null) {
                    if ("0".equals(huishui.getShowInsure()) || StringUtil.isBlank(huishui.getShowInsure())) {
                        hasTeamBaoxian.setSelected(false);
                    } else {
                        hasTeamBaoxian.setSelected(true);
                    }
                } else {
                    ShowUtil.show("团队" + newValue + "对应的huishui字段为空!");
                    hasTeamBaoxian.setSelected(false);
                }
            }
        }
    });
    isZjManage.selectedProperty().addListener(new ChangeListener<Boolean>() {

        public void changed(ObservableValue<? extends Boolean> ov, Boolean old_val, Boolean new_val) {
            String teamId = teamIDCombox.getSelectionModel().getSelectedItem();
            if (!StringUtil.isBlank(teamId)) {
                Huishui hs = DataConstans.huishuiMap.get(teamId);
                if (hs != null) {
                    hs.setZjManaged(new_val ? "是" : "否");
                    DataConstans.huishuiMap.put(teamId, hs);
                }
            }
        }
    });
    hasTeamBaoxian.selectedProperty().addListener(new ChangeListener<Boolean>() {

        public void changed(ObservableValue<? extends Boolean> ov, Boolean old_val, Boolean new_val) {
            String teamId = teamIDCombox.getSelectionModel().getSelectedItem();
            if (!StringUtil.isBlank(teamId)) {
                Huishui hs = DataConstans.huishuiMap.get(teamId);
                if (hs != null) {
                    // 修改缓存
                    String showInsure = new_val ? "1" : "0";
                    hs.setShowInsure(showInsure);
                    DataConstans.huishuiMap.put(teamId, hs);
                    // 更新到数据库
                    DBUtil.updateTeamHsShowInsure(teamId, showInsure);
                }
            }
        }
    });
}
Also used : Huishui(com.kendy.entity.Huishui) ObservableValue(javafx.beans.value.ObservableValue) ChangeListener(javafx.beans.value.ChangeListener)

Example 24 with Huishui

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

the class TeamProxyService method refresh_TableTeamProxy_TableProxySum.

/**
 * 刷新两个表,共用代码(选择团下拉框和点击刷新按钮时共用的代码)
 *
 * @param newValue teamID
 */
public static void refresh_TableTeamProxy_TableProxySum(Object newValue) {
    if (newValue == null)
        return;
    Huishui hs = DataConstans.huishuiMap.get(newValue);
    if (hs != null) {
        if ("否".equals(hs.getZjManaged())) {
            isZjManage.setSelected(false);
        } else {
            isZjManage.setSelected(true);
        }
    } else {
        // add 2018-01-20
        return;
    }
    // 加载数据{teamId={}}
    double sumYSZJ = 0d;
    double sumZJ = 0d;
    double sumHS = 0d;
    double sumHB = 0d;
    double sumBX = 0d;
    int sumRC = 0;
    // Map<String,List<TeamHuishuiInfo>> teamMap = DataConstans.Total_Team_Huishui_Map;//锁定就保留信息,不减
    Map<String, List<TeamHuishuiInfo>> teamMap = getTotalTeamHuishuiMap();
    if (teamMap != null && teamMap.size() == 0) {
        // 这个有问题,后期再看
        log.error("----------------");
    }
    List<TeamHuishuiInfo> teamList = teamMap.get(newValue.toString().toUpperCase());
    ObservableList<ProxyTeamInfo> obList = FXCollections.observableArrayList();
    if (teamList != null) {
        for (TeamHuishuiInfo info : teamList) {
            obList.add(new ProxyTeamInfo(info.getTuan(), info.getWanjiaId(), info.getWanjia(), // yszj
            info.getZj(), info.getShishou(), // 出回水是否等于回水
            MoneyService.getNum(info.getChuHuishui()) * (-1) + "", // 保险是否等于回保
            info.getHuibao(), info.getTableId(), // 保险
            info.getBaoxian()));
            sumYSZJ += MoneyService.getNum(info.getZj());
            sumZJ += MoneyService.getNum(info.getShishou());
            sumBX += MoneyService.getNum(info.getBaoxian());
            sumHS += (MoneyService.getNum(info.getChuHuishui())) * (-1);
            sumHB += MoneyService.getNum(info.getHuibao());
            sumRC += 1;
        }
    }
    tableProxyTeam.setItems(obList);
    tableProxyTeam.refresh();
    ObservableList<Node> sumHBox = proxySumHBox.getChildren();
    for (Node node : sumHBox) {
        Label label = (Label) node;
        String labelId = label.getId();
        switch(labelId) {
            case "sumYSZJ":
                label.setText(MoneyService.digit0(sumYSZJ));
                break;
            case "sumZJ":
                label.setText(MoneyService.digit0(sumZJ));
                break;
            case "sumBX":
                label.setText(MoneyService.digit0(sumBX));
                break;
            case "sumHS":
                label.setText(MoneyService.digit1(sumHS + ""));
                break;
            case "sumHB":
                label.setText(sumHB + "");
                break;
            case "sumRC":
                label.setText(sumRC + "");
                break;
        }
    }
    // add by kendy 添加总回保比例,总回水比例,服务费和合计
    proxyHSRate.setText(hs.getProxyHSRate());
    proxyHBRate.setText(hs.getProxyHBRate());
    proxyFWF.setText(hs.getProxyFWF());
    double HSRate = getNumByPercent(hs.getProxyHSRate());
    double HBRate = getNumByPercent(hs.getProxyHBRate());
    // 服务费有效值
    double FWFValid = NumUtil.getNum(hs.getProxyFWF());
    // 计算服务费
    double proxyFWFVal = calculateProxSumFWF(sumHS, HSRate, sumHB, HBRate, FWFValid);
    // 计算合计
    double proxyHeji = sumZJ + sumHS + sumHB - proxyFWFVal;
    // 初始化合计表
    tableProxySum.setItems(null);
    ObservableList<ProxySumInfo> ob_Heji_List = FXCollections.observableArrayList();
    ob_Heji_List.addAll(new ProxySumInfo("总战绩", NumUtil.digit0(sumZJ)), new ProxySumInfo("总回水", NumUtil.digit1(sumHS + "")), new ProxySumInfo("总回保", NumUtil.digit1(sumHB + "")), new ProxySumInfo("服务费", NumUtil.digit1(proxyFWFVal + "")), new ProxySumInfo("总人次", sumRC + ""));
    tableProxySum.setItems(ob_Heji_List);
    tableProxySum.getColumns().get(1).setText(NumUtil.digit1(proxyHeji + ""));
    tableProxySum.refresh();
}
Also used : Huishui(com.kendy.entity.Huishui) ProxyTeamInfo(com.kendy.entity.ProxyTeamInfo) Node(javafx.scene.Node) Label(javafx.scene.control.Label) TeamHuishuiInfo(com.kendy.entity.TeamHuishuiInfo) ProxySumInfo(com.kendy.entity.ProxySumInfo) ArrayList(java.util.ArrayList) List(java.util.List) ObservableList(javafx.collections.ObservableList)

Aggregations

Huishui (com.kendy.entity.Huishui)24 ArrayList (java.util.ArrayList)6 HashMap (java.util.HashMap)5 Player (com.kendy.entity.Player)4 Map (java.util.Map)4 TextInputDialog (javafx.scene.control.TextInputDialog)4 InputDialog (com.kendy.util.InputDialog)3 CurrentMoneyInfo (com.kendy.entity.CurrentMoneyInfo)2 ShangmaInfo (com.kendy.entity.ShangmaInfo)2 SMResultModel (com.kendy.model.SMResultModel)2 Wrap (com.kendy.other.Wrap)2 IOException (java.io.IOException)2 SQLException (java.sql.SQLException)2 LinkedHashMap (java.util.LinkedHashMap)2 LinkedList (java.util.LinkedList)2 Pair (javafx.util.Pair)2 DataConstans (application.DataConstans)1 MyController (application.MyController)1 JSON (com.alibaba.fastjson.JSON)1 TypeReference (com.alibaba.fastjson.TypeReference)1