Search in sources :

Example 6 with ShangmaInfo

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

the class ShangmaService method addNewRecord_nextday_HT.

/**
 ***************************************************新增次日上码*************************
 */
/**
 * 新增玩家的次日数据
 *
 * @time 2018年2月5日
 * @param table
 * @param nextday
 */
public static void addNewRecord_nextday_HT(SMResultModel model, ShangmaNextday nextday) {
    ShangmaInfo selectedSMInfo = model.getSelectedSMInfo();
    String playerId = nextday.getPlayerId();
    String playerName = nextday.getPlayerName();
    String changci = nextday.getChangci();
    String shangma = nextday.getShangma();
    ShangmaDetailInfo shangmaDetailInfo = new ShangmaDetailInfo(playerId, playerName, changci, shangma);
    // 先判断是否重复
    ShangmaDetailInfo duplicateDetail = checkIfDuplicateInNextday_HT(playerId, changci);
    if (duplicateDetail != null) {
        log.info("新增时重复而续增次日上码值");
        resetNextDayDetailInfo_HT(selectedSMInfo, duplicateDetail, shangma);
        return;
    }
    // 以下为不重复项
    // 1 保存到数据库
    DBUtil.saveOrUpdate_SM_nextday(nextday);
    // 2 保存到缓存
    List<ShangmaDetailInfo> currentNextdayList = SM_NextDay_Map.getOrDefault(playerId, new ArrayList<>());
    currentNextdayList.add(shangmaDetailInfo);
    SM_NextDay_Map.put(playerId, currentNextdayList);
    // 刷新左表对应记录
    updateRowByPlayerId_HT(selectedSMInfo, shangma);
}
Also used : ShangmaInfo(com.kendy.entity.ShangmaInfo) ShangmaDetailInfo(com.kendy.entity.ShangmaDetailInfo)

Example 7 with ShangmaInfo

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

the class ShangmaService method addNewShangma2DetailTable_HT.

/**
 *******************************************新增当日上码*********************************
 */
/**
 * 新增个人上码详情记录到详情表(后台)
 * @param smInfo
 * @param shangmaJu 第几局
 * @param shangmaVal 上码值
 */
public static void addNewShangma2DetailTable_HT(SMResultModel model, String shangmaJu, String shangmaVal) {
    // 判断是否重复
    ShangmaInfo selectedSMInfo = model.getSelectedSMInfo();
    String playerId = selectedSMInfo.getShangmaPlayerId();
    String palyerName = selectedSMInfo.getShangmaName();
    if (checkIfDuplicate(playerId, shangmaJu)) {
        ShangmaDetailInfo detailInfo = updateDuplicateDetailInfo(playerId, shangmaJu);
        if (detailInfo != null) {
            log.info("新增时重复而续增今日上码值");
            // 桌号重复时则续增值
            addDuplicateSM_HT(selectedSMInfo, detailInfo, shangmaVal);
        }
        return;
    }
    // 以下不重复
    // save SM_Detail_Map
    List<ShangmaDetailInfo> SMDlist = DataConstans.SM_Detail_Map.getOrDefault(playerId, new ArrayList<>());
    SMDlist.add(new ShangmaDetailInfo(palyerName, shangmaVal, "", playerId, shangmaJu, "", "否"));
    DataConstans.SM_Detail_Map.put(playerId, SMDlist);
    // 刷新左表对应记录
    updateRowByPlayerId_HT(selectedSMInfo, shangmaVal);
}
Also used : ShangmaInfo(com.kendy.entity.ShangmaInfo) ShangmaDetailInfo(com.kendy.entity.ShangmaDetailInfo)

Example 8 with ShangmaInfo

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

the class ShangmaService method loadShangmaTable.

/**
 * 加载上码主表
 *
 * @param teamId
 * @param tableShangma
 */
public static void loadShangmaTable(String teamId, TableView<ShangmaInfo> tableShangma) {
    double teamSumYiSM, teamSumZJ;
    try {
        ObservableList<ShangmaInfo> obList = FXCollections.observableArrayList();
        List<String> wanjiaIdList = teamIdAndPlayerIdMap.get(teamId);
        String playerName, edu, yicunJifen, sumAvailableEdu, sumYiSM, sumZJ;
        teamSumYiSM = 0d;
        teamSumZJ = 0d;
        if (wanjiaIdList != null) {
            if (cmiMap == null)
                // 加载cmiMap估计
                refresh_cmiMap_if_null();
            ShangmaInfo smInfo;
            for (String playerId : wanjiaIdList) {
                // 根据玩家ID找名称和额度和已存积分
                CurrentMoneyInfo cmiInfo = cmiMap.get(playerId);
                if (cmiInfo == null) {
                    Player player = DataConstans.membersMap.get(playerId);
                    if (player == null) {
                        int a = 0;
                    }
                    playerName = player.getPlayerName();
                    edu = player.getEdu();
                    // 最关键的区别
                    yicunJifen = "";
                } else {
                    playerName = cmiInfo.getMingzi();
                    edu = cmiInfo.getCmiEdu();
                    // 实时金额就是已存积分
                    yicunJifen = cmiInfo.getShishiJine();
                }
                // 根据玩家ID找个人详情
                Double[] sumArr = getSumDetail(playerId, edu, yicunJifen);
                sumAvailableEdu = MoneyService.digit0(sumArr[0]);
                sumYiSM = MoneyService.digit0(sumArr[1]);
                sumZJ = MoneyService.digit0(sumArr[2]);
                // 组装实体
                smInfo = new ShangmaInfo(playerName, edu, sumAvailableEdu, sumYiSM, sumZJ, playerId, yicunJifen, "");
                obList.add(smInfo);
                // 设置团队总和
                teamSumYiSM += sumArr[1];
                teamSumZJ += sumArr[2];
            }
        }
        // 刷新表
        tableShangma.setItems(obList);
        tableShangma.refresh();
        // 重新加载合并ID进去
        render_Shangma_info_talbe_0();
        // 设置团队总和
        labelZSM.setText(MoneyService.digit0(teamSumYiSM));
        labelZZJ.setText(MoneyService.digit0(teamSumZJ));
        // add 2018-2-19 设置团队押金与团队额度
        resetTeamYajinAndEdu();
    // System.out.println("设置团队押金与团队额度"+TimeUtil.getTime());
    } catch (Exception e1) {
        ErrorUtil.err("加载上码主表", e1);
    }
}
Also used : ShangmaInfo(com.kendy.entity.ShangmaInfo) Player(com.kendy.entity.Player) CurrentMoneyInfo(com.kendy.entity.CurrentMoneyInfo)

Example 9 with ShangmaInfo

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

the class ShangmaService method addNextDaySMDetailAction.

/**
 * 实时上码新增次日上码
 *
 * @time 2018年2月4日
 */
public static void addNextDaySMDetailAction() {
    ShangmaInfo smInfo = getSelectShangma();
    if (smInfo == null) {
        ShowUtil.show("请先选择要增加次日的玩家记录!");
        return;
    }
    if (smInfo != null && smInfo.getShangmaName() != null) {
        Dialog<Pair<String, String>> dialog = new Dialog<>();
        dialog.setTitle("次日上码:" + smInfo.getShangmaName());
        dialog.setHeaderText(null);
        ButtonType loginButtonType = new ButtonType("确定", ButtonData.OK_DONE);
        dialog.getDialogPane().getButtonTypes().addAll(loginButtonType, ButtonType.CANCEL);
        GridPane grid = new GridPane();
        grid.setHgap(10);
        grid.setVgap(10);
        grid.setPadding(new Insets(20, 20, 20, 20));
        TextField shangmaJu = new TextField();
        TextField shangmaVal = new TextField();
        grid.add(new Label("第X局:"), 0, 0);
        grid.add(shangmaJu, 1, 0);
        grid.add(new Label("上码:"), 0, 1);
        grid.add(shangmaVal, 1, 1);
        Node loginButton = dialog.getDialogPane().lookupButton(loginButtonType);
        loginButton.setDisable(true);
        shangmaJu.textProperty().addListener((observable, oldValue, newValue) -> {
            loginButton.setDisable(newValue.trim().isEmpty());
        });
        dialog.getDialogPane().setContent(grid);
        Platform.runLater(() -> shangmaJu.requestFocus());
        dialog.setResultConverter(dialogButton -> {
            if (dialogButton == loginButtonType) {
                return new Pair<>(shangmaJu.getText(), shangmaVal.getText());
            }
            return null;
        });
        Optional<Pair<String, String>> result = dialog.showAndWait();
        result.ifPresent(shangmaJuAndVal -> {
            log.info("新增次日上码:shangmaJu=" + shangmaJuAndVal.getKey() + ", shangmaVal=" + shangmaJuAndVal.getValue());
            try {
                Integer.valueOf(shangmaJuAndVal.getKey());
                Integer.valueOf(shangmaJuAndVal.getValue());
            } catch (NumberFormatException e) {
                ShowUtil.show("非法数值:" + shangmaJuAndVal.getKey() + "或" + shangmaJuAndVal.getValue() + "!");
                return;
            }
            ShangmaNextday nextday = new ShangmaNextday();
            nextday.setPlayerId(smInfo.getShangmaPlayerId());
            nextday.setPlayerName(smInfo.getShangmaName());
            nextday.setChangci(getShangmaPaiju(shangmaJuAndVal.getKey()));
            nextday.setShangma(shangmaJuAndVal.getValue());
            nextday.setTime(TimeUtil.getDateTime2());
            // 新增玩家的次日数据
            addNewRecord_nextday(tableND, nextday);
        });
    }
}
Also used : ShangmaInfo(com.kendy.entity.ShangmaInfo) GridPane(javafx.scene.layout.GridPane) Insets(javafx.geometry.Insets) Node(javafx.scene.Node) Label(javafx.scene.control.Label) TextInputDialog(javafx.scene.control.TextInputDialog) Dialog(javafx.scene.control.Dialog) TextField(javafx.scene.control.TextField) ShangmaNextday(com.kendy.entity.ShangmaNextday) ButtonType(javafx.scene.control.ButtonType) Pair(javafx.util.Pair)

Example 10 with ShangmaInfo

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

the class ShangmaService method scrollByPlayerId.

public static void scrollByPlayerId(String playerId, TableView<ShangmaInfo> tableShangma) {
    if (!StringUtil.isBlank(playerId)) {
        ObservableList<ShangmaInfo> list = tableShangma.getItems();
        // 待转到第一个的行数据
        ShangmaInfo shangmaInfo = null;
        // 检查该玩家是否存在
        boolean isExist = false;
        String pId = "";
        for (ShangmaInfo info : list) {
            pId = info.getShangmaPlayerId();
            if (!StringUtil.isBlank(pId)) {
                if (playerId.equals(pId)) {
                    int index = list.indexOf(info);
                    // 
                    tableShangma.scrollTo(index);
                    // table.getSelectionModel().focus(index);
                    tableShangma.getSelectionModel().select(index);
                    // 加载右边的个人详情表
                    loadSMDetailTable(playerId);
                    isExist = true;
                    break;
                }
            }
        }
        ;
        if (!isExist) {
            ShowUtil.show("查无结果!" + playerId, 1);
        } else {
        // ShowUtil.show("OK,请下拉", 1);
        }
    }
}
Also used : ShangmaInfo(com.kendy.entity.ShangmaInfo)

Aggregations

ShangmaInfo (com.kendy.entity.ShangmaInfo)13 Player (com.kendy.entity.Player)4 CurrentMoneyInfo (com.kendy.entity.CurrentMoneyInfo)3 ShangmaDetailInfo (com.kendy.entity.ShangmaDetailInfo)3 ArrayList (java.util.ArrayList)3 LinkedList (java.util.LinkedList)3 Huishui (com.kendy.entity.Huishui)2 SMResultModel (com.kendy.model.SMResultModel)2 HashMap (java.util.HashMap)2 LinkedHashMap (java.util.LinkedHashMap)2 Map (java.util.Map)2 GDController (com.kendy.controller.GDController)1 QuotaController (com.kendy.controller.QuotaController)1 DangjuInfo (com.kendy.entity.DangjuInfo)1 DangtianHuizongInfo (com.kendy.entity.DangtianHuizongInfo)1 JiaoshouInfo (com.kendy.entity.JiaoshouInfo)1 KaixiaoInfo (com.kendy.entity.KaixiaoInfo)1 MemberZJInfo (com.kendy.entity.MemberZJInfo)1 PingzhangInfo (com.kendy.entity.PingzhangInfo)1 ProfitInfo (com.kendy.entity.ProfitInfo)1