Search in sources :

Example 11 with Huishui

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

the class ExcelReaderUtil method readHuishuiRecord.

/**
 * 导入回水
 * @param file
 * @return
 */
public static Wrap readHuishuiRecord(File file) {
    Map<String, Huishui> huishuiMap = new HashMap<>();
    Wrap wrap = new Wrap();
    try {
        FileInputStream is = new FileInputStream(file);
        log.info("读取团队回水开始...");
        Workbook workbook = getWeebWork(file.getAbsolutePath());
        // 回水对应的sheet
        Sheet sheet = workbook.getSheetAt(0);
        Iterator<Row> rowIterator = sheet.iterator();
        while (rowIterator.hasNext()) {
            Row row = rowIterator.next();
            if (row.getRowNum() >= 2) {
                // 团队id
                String teamId = "";
                // 团队名称
                String teamName = "";
                // 回水比例
                String huishuiRate = "";
                // 备注
                String beizhu = "";
                // 保险比例
                String insuranceRate = "";
                // 股东
                String gudong = "";
                // 是否代理
                String zjManage = "";
                // 代理回水比例
                String proxyHsRate = "";
                // 代理回保比例
                String proxyHbRate = "";
                // 代理服务费
                String proxyFWF = "";
                // 积分比例
                String jfPercent = "";
                for (int i = 1; i < 11; i++) {
                    Cell cell = row.getCell(i);
                    cell.setCellType(HSSFCell.CELL_TYPE_STRING);
                    String value = cell.getStringCellValue();
                    if (i == 1) {
                        // 团ID====="+value);
                        if (!StringUtil.isBlank(value))
                            value = value.toUpperCase();
                        teamId = value;
                    } else if (i == 2) {
                        // 团队名字====="+value);
                        teamName = StringUtil.isBlank(value) ? "" : value;
                    } else if (i == 3) {
                        if (!StringUtil.isBlank(value) && value.contains("E")) {
                            value = Double.valueOf(value) + "";
                        }
                        // 回水比例====="+value);
                        if (value.contains("%")) {
                            value = NumUtil.getNumByPercent(value) + "";
                        }
                        huishuiRate = value;
                    } else if (i == 4) {
                        // 保险比例====="+value);
                        if (value.contains("%")) {
                            value = NumUtil.getNumByPercent(value) + "";
                        }
                        insuranceRate = StringUtil.isBlank(value) ? "0" : NumUtil.digit4(value);
                    } else if (i == 5) {
                        // 股东====="+value);
                        gudong = value;
                    } else if (i == 6) {
                        // 战绩是否代理管====="+value);
                        zjManage = StringUtil.isBlank(value) ? "否" : value;
                    } else if (i == 7) {
                        // 备注====="+value);
                        beizhu = value;
                    } else if (i == 8) {
                        if (StringUtil.isBlank(value)) {
                            value = "0";
                        }
                        if (value.contains("%")) {
                            proxyHsRate = value;
                        } else {
                            // 回水比例====="+NumUtil.getPercentStr(Double.valueOf(value)));
                            proxyHsRate = NumUtil.getPercentStr(Double.valueOf(value));
                        }
                    } else if (i == 9) {
                        if (StringUtil.isBlank(value)) {
                            value = "0";
                        }
                        if (value.contains("%")) {
                            proxyHbRate = value;
                        } else {
                            // 回保比例====="+NumUtil.getPercentStr(Double.valueOf(value)));
                            proxyHbRate = NumUtil.getPercentStr(Double.valueOf(value));
                        }
                    } else if (i == 10) {
                        // 服务费====="+value);
                        proxyFWF = value;
                    } else if (i == 11) {
                        // 积分比例====="+value);
                        if (StringUtil.isBlank(value)) {
                            value = "0";
                        }
                        jfPercent = NumUtil.getPercentStr(Double.valueOf(value));
                    }
                }
                if (!StringUtil.isBlank(teamId))
                    huishuiMap.put(teamId, new Huishui(teamId, teamName, huishuiRate, insuranceRate, gudong, zjManage, beizhu, proxyHsRate, proxyHbRate, proxyFWF));
            }
        }
        is.close();
        wrap = new Wrap(true, huishuiMap);
        log.info("读取团队回水结束!size:" + huishuiMap.size());
    } catch (Exception e) {
        wrap = new Wrap();
        e.printStackTrace();
    }
    return wrap;
}
Also used : Huishui(com.kendy.entity.Huishui) Wrap(com.kendy.other.Wrap) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) FileInputStream(java.io.FileInputStream) XSSFWorkbook(org.apache.poi.xssf.usermodel.XSSFWorkbook) Workbook(org.apache.poi.ss.usermodel.Workbook) HSSFWorkbook(org.apache.poi.hssf.usermodel.HSSFWorkbook) IOException(java.io.IOException) XSSFRow(org.apache.poi.xssf.usermodel.XSSFRow) Row(org.apache.poi.ss.usermodel.Row) Sheet(org.apache.poi.ss.usermodel.Sheet) XSSFSheet(org.apache.poi.xssf.usermodel.XSSFSheet) HSSFCell(org.apache.poi.hssf.usermodel.HSSFCell) Cell(org.apache.poi.ss.usermodel.Cell) XSSFCell(org.apache.poi.xssf.usermodel.XSSFCell)

Example 12 with Huishui

use of com.kendy.entity.Huishui 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 13 with Huishui

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

the class MyController method updateTeamHsRateAction.

/**
 * 修改团队回水
 *
 * @time 2017年11月17日
 * @param event
 */
public void updateTeamHsRateAction(ActionEvent event) {
    InputDialog inputDlg = new InputDialog("修改", "待修改的团队ID:", "团队新回水比例:");
    Optional<Pair<String, String>> result = inputDlg.getResult();
    result.ifPresent(teamId_and_hsRate -> {
        // 获取到原始的有效的团队ID及团队回水率
        String teamID = teamId_and_hsRate.getKey();
        String teamHsRate = teamId_and_hsRate.getValue();
        if (StringUtil.isBlank(teamID) || StringUtil.isBlank(teamHsRate)) {
            ShowUtil.show("修改失败!原因:团队ID或团队回水不能为空!!");
            return;
        }
        teamID = teamID.trim().toUpperCase();
        teamHsRate = teamHsRate.trim();
        // 判断是否有此团队
        Huishui hs = DataConstans.huishuiMap.get(teamID);
        if (hs == null) {
            ShowUtil.show("修改失败!原因:不存在此团队ID,请检查!");
            return;
        }
        if (!teamHsRate.endsWith("%")) {
            ShowUtil.show("修改失败!原因:团队回水必须中有百分号!");
            return;
        }
        // 开始修改
        // 1修改数据库
        Double _hsRate = NumUtil.getNumByPercent(teamHsRate);
        int size = (_hsRate + "").length();
        if (size > 6) {
            _hsRate = NumUtil.getNum(NumUtil.digit4(_hsRate.toString()));
        }
        if (!DBUtil.updateTeamHsRate(teamID, _hsRate + "")) {
            return;
        }
        // 2修改缓存
        // 地址引用,会修改值
        hs.setHuishuiRate(NumUtil.getNumByPercent(teamHsRate) + "");
        ShowUtil.show("修改成功!", 2);
    });
}
Also used : Huishui(com.kendy.entity.Huishui) TextInputDialog(javafx.scene.control.TextInputDialog) InputDialog(com.kendy.util.InputDialog) Pair(javafx.util.Pair)

Example 14 with Huishui

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

the class MyController method openTimeInputAction.

/**
 * 开始新一天的统计
 */
public void openTimeInputAction(ActionEvent event) {
    Alert alert = new Alert(AlertType.CONFIRMATION);
    alert.setTitle("提示");
    alert.setHeaderText(null);
    alert.setContentText("\r\n即将初始化所有配置项,点击确定开始操作新一天报表!");
    Optional<ButtonType> result = alert.showAndWait();
    if (result.get() == ButtonType.OK) {
        // 从数据库中判断是否符合从中途继续条件
        if (2 == DBUtil.newStaticOrContinue()) {
            ShowUtil.show("开始新一天的统计条件不满足,请点击中途继续按钮!");
            return;
        }
        // 清空所有缓存数据
        DataConstans.clearAllData();
        // 加载必要的原始数据(人员和回水)
        DataConstans.initMetaData();
        // 加载昨日数据
        DataConstans.loadPreData();
        // 渲染表格数据
        LMLabel.setText(getLMValFirstTime());
        fillTables(tableCurrentMoneyInfo, tableZijin, tableProfit, tableKaixiao, LMLabel);
        ShowUtil.show("加载数据成功", 2);
        // 转到场次信息页面
        tabs.getSelectionModel().select(1);
        // 代理查询:
        List<Huishui> list = DBUtil.getAllTeamHS();
        list.forEach(hs -> {
            DataConstans.huishuiMap.put(hs.getTeamId(), hs);
        });
        TeamProxyService.initTeamSelectAndZjManage(teamIDCombox);
        // 积分查询初始化团队ID
        JifenService.init_Jifen_TeamIdCombox();
        // 实时上码表:清空所有SM_Detail
        // 新一天统计时应该清空昨日数据
        DataConstans.SM_Detail_Map = new HashMap<>();
        // 实时上码表:获取最新的团队ID与玩家ID列表的映射
        // ConsUtil.refreshTeamIdAndPlayerId();
        // ConsUtil.refresh_SM_Detail_Map();//新一天统计时应该清空昨日数据
        // 初始化股东列表
        DataConstans.initGudong();
    }
}
Also used : Huishui(com.kendy.entity.Huishui) Alert(javafx.scene.control.Alert) ButtonType(javafx.scene.control.ButtonType)

Example 15 with Huishui

use of com.kendy.entity.Huishui 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)

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