Search in sources :

Example 1 with SMAutoInfo

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

the class SMAutoController method exportSMAction.

/**
 * 导出有上码的记录
 *
 * @time 2018年3月31日
 * @param event
 */
public void exportSMAction(ActionEvent event) {
    List<SMAutoInfo> autoShangmas = getAutoShangmas(1);
    if (CollectUtil.isNullOrEmpty(autoShangmas)) {
        ShowUtil.show("没有可供导出的数据!");
        return;
    }
    String[] rowsName = new String[] { "爬取时间", "玩家ID", "玩家名称", "牌局", "申请数量", "团队可上码", "计算可上码", "勾选团队", "当天", "次日", "同意审核", "审核结果" };
    List<Object[]> dataList = new ArrayList<Object[]>();
    Object[] objs = null;
    for (SMAutoInfo info : autoShangmas) {
        objs = new Object[rowsName.length];
        objs[0] = info.getSmAutoDate();
        objs[1] = info.getSmAutoPlayerId();
        objs[2] = info.getSmAutoPlayerName();
        objs[3] = info.getSmAutoPaiju();
        objs[4] = info.getSmAutoApplyAccount();
        objs[5] = info.getSmAutoTeamTotalAvailabel();
        objs[6] = info.getSmAutoAvailabel();
        objs[7] = info.getSmAutoIsTeamAvailabel();
        objs[8] = info.getSmAutoIsCurrentDay();
        objs[9] = info.getSmAutoIsNextDay();
        objs[10] = info.getSmAutoIsAgree();
        objs[11] = info.getSmAutoIsAgreeSuccess();
        dataList.add(objs);
    }
    String title = "自动上码-" + TimeUtil.getDateTime();
    List<Integer> columnWidths = Arrays.asList(3500, 4000, 3000, 3000, 3000, 4000, 4000, 3000, 3000, 3000, 3000, 3000, 5000);
    ExportExcelTemplate ex = new ExportExcelTemplate(title, rowsName, columnWidths, dataList);
    try {
        ex.export();
        ShowUtil.show("导出完成", 1);
    } catch (Exception e) {
        ErrorUtil.err("导出自动记录失败", e);
        e.printStackTrace();
    }
}
Also used : ExportExcelTemplate(com.kendy.excel.ExportExcelTemplate) ArrayList(java.util.ArrayList) SMAutoInfo(com.kendy.entity.SMAutoInfo)

Example 2 with SMAutoInfo

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

Aggregations

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