Search in sources :

Example 1 with SMResultModel

use of com.kendy.model.SMResultModel 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 2 with SMResultModel

use of com.kendy.model.SMResultModel in project financial by greatkendy123.

the class ShangmaService method getDataAfterloadShangmaTable.

/**
 ********************************************************************************************************
 *
 *                          自动上码部分
 *
 *********************************************************************************************************
 */
/**
 * 获取加载上码主表后的数据
 *
 * @param teamId
 * @param tableShangma
 */
public static SMResultModel getDataAfterloadShangmaTable(String teamId, String playerID) {
    SMResultModel resultModel = new SMResultModel();
    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];
            }
        }
        // 重新加载合并ID进去
        LinkedList<ShangmaInfo> combineSMDataList = getCombineSMDataList(obList);
        resultModel.setSmList(combineSMDataList);
        resultModel.setPlayerId(playerID);
        resultModel.setTeamId(teamId);
        setSelectedSMInfo(resultModel, playerID, combineSMDataList);
        // 赋新值
        // 获取团队信息
        Huishui hs = DataConstans.huishuiMap.get(teamId);
        if (hs != null) {
            String _teamYajin = hs.getTeamYajin();
            String _teamEdu = hs.getTeamEdu();
            // 计算团队可上码
            // 计算公式:  团队可上码= 押金 + 额度 + 团队战绩 - 团队已上码
            Double teamSMAvailable = NumUtil.getNum(NumUtil.getSum(_teamYajin, _teamEdu, MoneyService.digit0(teamSumZJ))) - NumUtil.getNum(MoneyService.digit0(teamSumYiSM));
            resultModel.setTeamTotalAvailabel(teamSMAvailable.intValue() + "");
        }
    } catch (Exception e1) {
        ErrorUtil.err("自动上码:加载上码主表失败", e1);
    }
    return resultModel;
}
Also used : ShangmaInfo(com.kendy.entity.ShangmaInfo) Huishui(com.kendy.entity.Huishui) SMResultModel(com.kendy.model.SMResultModel) Player(com.kendy.entity.Player) CurrentMoneyInfo(com.kendy.entity.CurrentMoneyInfo)

Aggregations

Huishui (com.kendy.entity.Huishui)2 Player (com.kendy.entity.Player)2 ShangmaInfo (com.kendy.entity.ShangmaInfo)2 SMResultModel (com.kendy.model.SMResultModel)2 CurrentMoneyInfo (com.kendy.entity.CurrentMoneyInfo)1 SMAutoInfo (com.kendy.entity.SMAutoInfo)1 WanjiaApplyInfo (com.kendy.spider.WanjiaApplyInfo)1 ArrayList (java.util.ArrayList)1