Search in sources :

Example 1 with ShangmaNextday

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

the class ShangmaService method resetNextDayDetailInfo_HT.

/**
 * 新增次日上码时,若重复,则续增
 * @time 2018年4月1日
 * @param detail
 * @param nextDayShangmaVal
 */
public static void resetNextDayDetailInfo_HT(ShangmaInfo selectedSMInfo, ShangmaDetailInfo detail, String nextDayShangmaVal) {
    String oddSM = StringUtil.isBlank(detail.getShangmaSM()) ? "0" : detail.getShangmaSM();
    detail.setShangmaSM(MoneyService.digit0(MoneyService.getNum(oddSM) + MoneyService.getNum(nextDayShangmaVal)));
    String playerId = detail.getShangmaPlayerId();
    String changci = detail.getShangmaJu();
    // 1保存到数据库
    ShangmaNextday nextday = new ShangmaNextday();
    nextday.setPlayerId(playerId);
    nextday.setPlayerName(detail.getShangmaDetailName());
    nextday.setChangci(detail.getShangmaJu());
    nextday.setShangma(detail.getShangmaSM());
    DBUtil.saveOrUpdate_SM_nextday(nextday);
    // 2保存到缓存
    List<ShangmaDetailInfo> currentNextdayList = SM_NextDay_Map.getOrDefault(playerId, new ArrayList<>());
    ShangmaDetailInfo shangmaDetailInfo = currentNextdayList.stream().filter(info -> changci.equals(info.getShangmaJu())).findFirst().get();
    shangmaDetailInfo.setShangmaSM(detail.getShangmaSM());
    SM_NextDay_Map.put(playerId, currentNextdayList);
    // 刷新左表对应记录
    try {
        updateRowByPlayerId_HT(selectedSMInfo, nextDayShangmaVal);
    } catch (Exception e) {
        ErrorUtil.err("自动上码:刷新左表对应记录失败", e);
    }
}
Also used : ShangmaDetailInfo(com.kendy.entity.ShangmaDetailInfo) ShangmaNextday(com.kendy.entity.ShangmaNextday)

Example 2 with ShangmaNextday

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

the class ShangmaService method resetNextDayDetailInfo.

/**
 * 新增次日上码时,若重复,则续增
 * @time 2018年3月28日
 * @param detail
 * @param nextDayShangmaVal
 */
public static void resetNextDayDetailInfo(ShangmaDetailInfo detail, String nextDayShangmaVal) {
    String oddSM = StringUtil.isBlank(detail.getShangmaSM()) ? "0" : detail.getShangmaSM();
    detail.setShangmaSM(MoneyService.digit0(MoneyService.getNum(oddSM) + MoneyService.getNum(nextDayShangmaVal)));
    String playerId = detail.getShangmaPlayerId();
    String changci = detail.getShangmaJu();
    // 1保存到数据库
    ShangmaNextday nextday = new ShangmaNextday();
    nextday.setPlayerId(playerId);
    nextday.setPlayerName(detail.getShangmaDetailName());
    nextday.setChangci(detail.getShangmaJu());
    nextday.setShangma(detail.getShangmaSM());
    DBUtil.saveOrUpdate_SM_nextday(nextday);
    // 2保存到缓存
    List<ShangmaDetailInfo> currentNextdayList = SM_NextDay_Map.getOrDefault(playerId, new ArrayList<>());
    ShangmaDetailInfo shangmaDetailInfo = currentNextdayList.stream().filter(info -> changci.equals(info.getShangmaJu())).findFirst().get();
    shangmaDetailInfo.setShangmaSM(detail.getShangmaSM());
    // 3刷新到当前的玩家次日表
    tableND.refresh();
    // 刷新左表对应记录
    try {
        updateRowByPlayerId(playerId, nextDayShangmaVal);
    } catch (Exception e) {
        ErrorUtil.err("刷新左表对应记录失败", e);
    }
}
Also used : ShangmaDetailInfo(com.kendy.entity.ShangmaDetailInfo) ShangmaNextday(com.kendy.entity.ShangmaNextday)

Example 3 with ShangmaNextday

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

the class ShangmaService method init_SM_NextDay_Map.

/**
 * 加载数据库中玩家的次日信息
 * @time 2018年2月5日
 */
public static void init_SM_NextDay_Map() {
    List<ShangmaNextday> allSM_nextday = DBUtil.getAllSM_nextday();
    if (!allSM_nextday.isEmpty()) {
        SM_NextDay_Map = allSM_nextday.stream().map(nextday -> {
            String playerId = nextday.getPlayerId();
            String playerName = nextday.getPlayerName();
            String changci = nextday.getChangci();
            String shangma = nextday.getShangma();
            ShangmaDetailInfo shangmaDetailInfo = new ShangmaDetailInfo(playerId, playerName, changci, shangma);
            return shangmaDetailInfo;
        }).collect(Collectors.groupingBy(ShangmaDetailInfo::getShangmaPlayerId));
    }
}
Also used : ShangmaDetailInfo(com.kendy.entity.ShangmaDetailInfo) ShangmaNextday(com.kendy.entity.ShangmaNextday)

Example 4 with ShangmaNextday

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

the class SMAutoController method addShangma.

/**
 * 本类核心 :添加上码到软件中,同时发送后台请求
 *
 * @time 2018年3月28日
 * @param isTodaySM 是否今日上码
 * @param passCheck 是否审核通过
 * @param paijuString 第几局
 * @param buyStack 上码值
 * @param userUuid 后台用户ID
 * @param roomId 房间号
 */
public boolean addShangma(SMResultModel resultModel, boolean isTodaySM, boolean passCheck, String playerId, String playerName, String paijuString, String buyStack, Long userUuid, Long roomId) {
    boolean addOK = false;
    try {
        if (passCheck) {
            // TODO 到时要根据数据量决定要不要添加此过滤条件
            // 后台申请买入
            HttpUtil.acceptBuy(userUuid, roomId, getToken());
            if (isTodaySM) {
                log.info("正在添加今日上码...");
                ShangmaService.addNewShangma2DetailTable_HT(resultModel, ShangmaService.getShangmaPaiju(paijuString), buyStack);
                log.info("添加今日上码结束:" + resultModel.getSelectedSMInfo().toString());
            } else {
                log.info("正在添加次日上码...");
                ShangmaNextday nextday = new ShangmaNextday();
                nextday.setPlayerId(playerId);
                nextday.setPlayerName(playerName);
                nextday.setChangci(ShangmaService.getShangmaPaiju(paijuString));
                nextday.setShangma(buyStack);
                nextday.setTime(TimeUtil.getDateTime2());
                // 新增玩家的次日数据
                ShangmaService.addNewRecord_nextday_HT(resultModel, nextday);
                log.info("添加次日上码结束:" + nextday.toString());
            }
        }
        addOK = true;
    } catch (Exception e) {
        addOK = false;
        e.printStackTrace();
    }
    return addOK;
}
Also used : ShangmaNextday(com.kendy.entity.ShangmaNextday)

Example 5 with ShangmaNextday

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

the class DBUtil method getAllSM_nextday.

/**
 * 获取玩家的次日数据
 * @time 2018年2月5日
 * @return
 */
public static List<ShangmaNextday> getAllSM_nextday() {
    List<ShangmaNextday> list = new ArrayList<>();
    try {
        con = DBConnection.getConnection();
        String sql = "select * from  shangma_nextday n where n.type = '0' ";
        ps = con.prepareStatement(sql);
        ResultSet rs = ps.executeQuery();
        while (rs.next()) {
            ShangmaNextday nextday = new ShangmaNextday();
            nextday.setPlayerId(rs.getString(1));
            nextday.setPlayerName(rs.getString(2));
            nextday.setChangci(rs.getString(3));
            nextday.setShangma(rs.getString(4));
            nextday.setTime(rs.getString(5));
            nextday.setType(rs.getString(6));
            list.add(nextday);
        }
    } catch (SQLException e) {
        ErrorUtil.err("获取玩家的次日数据失败", e);
    } finally {
        close(con, ps);
    }
    return list;
}
Also used : SQLException(java.sql.SQLException) ArrayList(java.util.ArrayList) ResultSet(java.sql.ResultSet) ShangmaNextday(com.kendy.entity.ShangmaNextday)

Aggregations

ShangmaNextday (com.kendy.entity.ShangmaNextday)6 ShangmaDetailInfo (com.kendy.entity.ShangmaDetailInfo)3 ShangmaInfo (com.kendy.entity.ShangmaInfo)1 ResultSet (java.sql.ResultSet)1 SQLException (java.sql.SQLException)1 ArrayList (java.util.ArrayList)1 Insets (javafx.geometry.Insets)1 Node (javafx.scene.Node)1 ButtonType (javafx.scene.control.ButtonType)1 Dialog (javafx.scene.control.Dialog)1 Label (javafx.scene.control.Label)1 TextField (javafx.scene.control.TextField)1 TextInputDialog (javafx.scene.control.TextInputDialog)1 GridPane (javafx.scene.layout.GridPane)1 Pair (javafx.util.Pair)1