Search in sources :

Example 16 with Player

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

the class DelController method updateNewPlayerEduAction.

/**
 * 修改用户额度功能
 *
 * @time 2017年10月29日
 * @param event
 */
public void updateNewPlayerEduAction(ActionEvent event) {
    String newEdu = newPlayerEdu.getText();
    newEdu = StringUtil.isBlank(newEdu) ? "" : newEdu.trim();
    if (StringUtil.isBlank(newEdu)) {
        ShowUtil.show("请先输入玩家的新额度!!");
        return;
    }
    String selectedMemberName = (String) delMemberListView.getFocusModel().getFocusedItem();
    if (StringUtil.isBlank(selectedMemberName)) {
        ShowUtil.show("请先选择要修改名称的玩家!!");
        return;
    }
    Alert alert = new Alert(AlertType.CONFIRMATION);
    alert.setTitle("警告");
    alert.setHeaderText(null);
    alert.setContentText(selectedMemberName + " 哥,你确定要修改该玩家额度为" + newEdu + "??");
    Optional<ButtonType> result = alert.showAndWait();
    if (result.get() == ButtonType.OK) {
        try {
            String playerId = getIdFromStr(selectedMemberName);
            // 1 理新常量表中的member
            Player player = DataConstans.membersMap.get(playerId);
            if (player != null) {
                player.setEdu(newEdu);
            } else {
                ShowUtil.show("用户不存在!");
                return;
            }
            // 2 更新实时金额表
            CurrentMoneyInfo info = MoneyService.getInfoById(playerId);
            if (info != null) {
                info.setCmiEdu(newEdu);
                MoneyService.saveOrUpdate(info);
                MoneyService.refreshRecord();
                MoneyService.flush_SSJE_table();
            }
            // 3 更新数据库
            DBUtil.updateMember(player);
            // 4 更新其他(特补充)
            // 修改实时上码额度
            // 5 提示成功
            ShowUtil.show("修改成功", 2);
        } catch (Exception e) {
            ShowUtil.show("修改失败,原因:" + e.getMessage());
            e.printStackTrace();
        }
    }
}
Also used : Player(com.kendy.entity.Player) Alert(javafx.scene.control.Alert) CurrentMoneyInfo(com.kendy.entity.CurrentMoneyInfo) ButtonType(javafx.scene.control.ButtonType)

Example 17 with Player

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

the class SMAutoController method handleAutoShangma.

/**
 * 处理自动上码的逻辑(核心代码)
 * 备注:申请数量过两道关之后程序会去实时上码Tab中自动上码
 *
 * @time 2018年3月26日
 * @param buyinList
 */
public void handleAutoShangma(List<WanjiaApplyInfo> buyinList) {
    for (WanjiaApplyInfo wanjiaApplyInfo : buyinList) {
        /*
        	 * 玩家相关信息
        	 */
        String paijuStr = wanjiaApplyInfo.getGameRoomName();
        // 本系统桌号
        String paijuString = paijuStr.substring(wanjiaApplyInfo.getGameRoomName().lastIndexOf("-") + 1);
        // 购买数量
        String buyStack = wanjiaApplyInfo.getBuyStack().toString();
        String playerId = wanjiaApplyInfo.getShowId();
        String playerName = wanjiaApplyInfo.getStrNick();
        Player player = DataConstans.membersMap.get(playerId);
        if (player == null) {
            logInfo("玩家(" + playerName + ")未录入到系统中!!!");
            continue;
        }
        String teamId = player.getTeamName();
        Huishui huishui = DataConstans.huishuiMap.get(teamId);
        // 是否勾选了团队上码:1是  0否
        String selectTeamAvailabel = huishui.getTeamAvailabel();
        logInfo(playerName + "正在模拟更新实时上码...");
        // 模拟更新实时上码
        SMResultModel resultModel = ShangmaService.getDataAfterloadShangmaTable(teamId, playerId);
        ShangmaInfo selectedSMInfo = resultModel.getSelectedSMInfo();
        if (selectedSMInfo == null) {
            logInfo("玩家(" + playerName + ")在上码系统中不存在!!");
            continue;
        }
        // 获取团队可上码
        String teamAvailabel = resultModel.getTeamTotalAvailabel();
        // 获取可上码
        String calcAvailable = getAvailable(resultModel, selectTeamAvailabel, playerId, playerName);
        // 是否为次日上码:
        boolean isTodaySM = judgeIsTodaySM(paijuString);
        // 是否同意
        boolean passCheck = checkInRange(selectTeamAvailabel, buyStack, teamAvailabel, calcAvailable);
        /**
         *************************************
         */
        List<String> testList = new ArrayList<>();
        boolean addOK = false;
        if (hasFilterPlayerIds())
            testList = Arrays.stream(filterPlayIdFields.getText().trim().split("##")).collect(Collectors.toList());
        if (CollectUtil.isNullOrEmpty(testList) || testList.contains(playerId)) {
            // 添加上码到软件中,同时发送后台请求
            // 用户ID
            Long userUuid = wanjiaApplyInfo.getUuid();
            // 房间号
            Long roomId = wanjiaApplyInfo.getGameRoomId();
            addOK = addShangma(resultModel, isTodaySM, passCheck, playerId, playerName, paijuString, buyStack, userUuid, roomId);
        }
        /**
         *************************************
         */
        SMAutoInfo smAutoInfo = new SMAutoInfo(getTimeString(), playerId, playerName, paijuString, buyStack, // 团队可上码 (第一关)
        teamAvailabel, // 计算可上码(第二关)
        calcAvailable, // smAutoIsCurrentDay
        "1".equals(selectTeamAvailabel) ? "是" : "否", // smAutoIsCurrentDay
        isTodaySM ? "是" : "否", // smAutoIsNextDay
        isTodaySM ? "否" : "是", // smAutoIsAgree
        passCheck ? "是" : "否", // smAutoIsAgreeSuccess
        (passCheck) ? (addOK ? "成功" : "失败") : "-");
        addItem(smAutoInfo);
    }
}
Also used : Huishui(com.kendy.entity.Huishui) ShangmaInfo(com.kendy.entity.ShangmaInfo) WanjiaApplyInfo(com.kendy.spider.WanjiaApplyInfo) Player(com.kendy.entity.Player) SMResultModel(com.kendy.model.SMResultModel) ArrayList(java.util.ArrayList) SMAutoInfo(com.kendy.entity.SMAutoInfo)

Example 18 with Player

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

the class MyController method delTeamAction.

/**
 * 删除团队ID
 * 备注:此方法的界面按钮已经删除,但后台代码仍保留着(以备后期要重新开发)
 *
 * @time 2017年11月14日
 * @param event
 */
public void delTeamAction(ActionEvent event) {
    // 注册界面
    TextInputDialog dialog = new TextInputDialog("");
    dialog.setTitle("注册");
    dialog.setHeaderText(null);
    dialog.setContentText("删除团队ID:");
    // dialog.getDialogPane().getButtonTypes().removeAll(ButtonType.CANCEL);
    Optional<String> result = dialog.showAndWait();
    result.ifPresent(_teamId -> {
        try {
            String teamId = _teamId.trim().toUpperCase();
            // 判断是否有此团队
            Huishui hs = DataConstans.huishuiMap.get(teamId);
            if (hs == null) {
                ShowUtil.show("哥,不存在此团队ID,请检查!");
                return;
            }
            // 清空数据库与缓存中回水表中的团队记录
            DBUtil.delHuishui(teamId);
            DataConstans.huishuiMap.remove(teamId);
            // 清空数据库与缓存中属于该团队的人员记录
            DBUtil.delMembers_after_delTeam(teamId);
            synchronized (DataConstans.membersMap) {
                Iterator<Map.Entry<String, Player>> ite = DataConstans.membersMap.entrySet().iterator();
                while (ite.hasNext()) {
                    Map.Entry<String, Player> entry = ite.next();
                    Player player = entry.getValue();
                    if (player.getTeamName().trim().toUpperCase().equals(teamId)) {
                        // 删除
                        ite.remove();
                    }
                }
            }
            // 以下清除代码
            // A 清空代理查询中的团队下拉框
            String selected_team = teamIDCombox.getSelectionModel().getSelectedItem();
            teamIDCombox.getItems().remove(teamId);
            if (teamId.equals(selected_team) && teamIDCombox.getItems().size() > 0) {
                teamIDCombox.getSelectionModel().select(0);
            }
            // B 积分查询中的团队下拉框
            String selected_jifen = jfTeamIDCombox.getSelectionModel().getSelectedItem();
            jfTeamIDCombox.getItems().remove(teamId);
            if (teamId.equals(selected_jifen) && jfTeamIDCombox.getItems().size() > 0) {
                jfTeamIDCombox.getSelectionModel().select(0);
            }
            // C 实时上码中的团队下拉框
            ShangmaService.initShangmaButton();
            ((Button) shangmaVBox.getChildren().get(0)).fire();
            ShowUtil.show("删除成功!", 2);
        } catch (Exception e) {
            log.error("删除团队ID失败", e);
        }
    });
}
Also used : Huishui(com.kendy.entity.Huishui) Player(com.kendy.entity.Player) RadioButton(javafx.scene.control.RadioButton) MouseButton(javafx.scene.input.MouseButton) Button(javafx.scene.control.Button) Map(java.util.Map) LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) IOException(java.io.IOException) TextInputDialog(javafx.scene.control.TextInputDialog)

Example 19 with Player

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

the class MyController method importMembersExcelAction.

// =======================  导入 Excel ==============================================================
/**
 * 导入人员名单文件
 */
public void importMembersExcelAction(ActionEvent even) {
    String membersFilePath = membersDir.getText();
    if (!StringUtil.isBlank(membersFilePath)) {
        // 将人员名单文件缓存起来
        try {
            Map<String, Player> allPlayers = ExcelReaderUtil.readMembersRecord(new File(membersFilePath));
            // 求并集,key相同的会被替换掉
            DataConstans.membersMap.putAll(allPlayers);
            // 插入到数据库
            DBUtil.insertMembers(allPlayers);
            ShowUtil.show("导入人员名单成功", 2);
            // 刷新相关缓存
            // ConsUtil.refreshTeamIdAndPlayerId();
            // 加载测试数据
            ConsUtil.refresh_SM_Detail_Map();
        } catch (Exception e) {
            ErrorUtil.err("导入人员名单失败", e);
        }
    } else {
        ShowUtil.warn("您未选择需要导入的Excel!");
    }
}
Also used : Player(com.kendy.entity.Player) File(java.io.File) IOException(java.io.IOException)

Example 20 with Player

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

the class AddController method add_SSJE_person_Action.

/**
 * 增加人员的实时金额
 */
public void add_SSJE_person_Action(ActionEvent event) {
    // 先对玩家ID进行判断
    String playerId = cmPlayerId.getText();
    Player player;
    if (StringUtil.isBlank(playerId)) {
        ShowUtil.show("操作失败!请详看系统说明!");
        return;
    } else {
        playerId = playerId.trim();
        // 从人员表查找相关记录
        player = DataConstans.membersMap.get(playerId);
        if (player == null) {
            ShowUtil.show("操作失败!人员表中无此ID,请先添加该人员!");
            return;
        }
        // 重复判断
        if (MoneyService.isExistIn_SSJE_Table_byId(playerId)) {
            ShowUtil.show("操作失败!实时金额表中已经存在此ID,请查检!");
            return;
        }
    }
    // 添加实时金额
    CurrentMoneyInfo tempMoneyInfo = new CurrentMoneyInfo(player.getPlayerName(), cmMoney.getText(), player.getgameId(), player.getEdu());
    MoneyService.addInfo(tempMoneyInfo);
    ShowUtil.show("添加成功", 2);
    MoneyService.flush_SSJE_table();
    MoneyService.scrolById(playerId);
    // 获取到新增人员窗口的实例
    Stage addNewPlayerStage = DataConstans.framesNameMap.get(Constants.ADD_CURRENT_MONEY_FRAME);
    DataConstans.framesNameMap.remove(Constants.ADD_CURRENT_MONEY_FRAME);
    addNewPlayerStage.close();
}
Also used : Player(com.kendy.entity.Player) Stage(javafx.stage.Stage) CurrentMoneyInfo(com.kendy.entity.CurrentMoneyInfo)

Aggregations

Player (com.kendy.entity.Player)32 CurrentMoneyInfo (com.kendy.entity.CurrentMoneyInfo)10 HashMap (java.util.HashMap)10 Map (java.util.Map)10 ArrayList (java.util.ArrayList)8 LinkedHashMap (java.util.LinkedHashMap)6 Huishui (com.kendy.entity.Huishui)4 ShangmaInfo (com.kendy.entity.ShangmaInfo)4 LinkedList (java.util.LinkedList)4 Alert (javafx.scene.control.Alert)4 ButtonType (javafx.scene.control.ButtonType)4 FileInputStream (java.io.FileInputStream)3 IOException (java.io.IOException)3 SQLException (java.sql.SQLException)3 List (java.util.List)3 ObservableList (javafx.collections.ObservableList)3 DataConstans (application.DataConstans)2 MyController (application.MyController)2 TeamHuishuiInfo (com.kendy.entity.TeamHuishuiInfo)2 TeamInfo (com.kendy.entity.TeamInfo)2