Search in sources :

Example 6 with ShangmaDetailInfo

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

the class ShangmaService method addNewRecord_nextday.

/**
 * 新增玩家的次日数据
 *
 * @time 2018年2月5日
 * @param table
 * @param nextday
 */
public static void addNewRecord_nextday(TableView<ShangmaDetailInfo> table, ShangmaNextday 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);
    // 先判断是否重复
    if (checkIfDuplicateInNextday(playerId, changci)) {
        ShangmaDetailInfo duplicateDetail = getDuplicateDetail(playerId, changci);
        if (duplicateDetail != null) {
            log.info("新增时重复而续增次日上码值");
            resetNextDayDetailInfo(duplicateDetail, shangma);
        }
        // ShowUtil.show("请勿重复添加"+changci+"!,该场次已存在!");
        return;
    }
    // 1 保存到数据库
    DBUtil.saveOrUpdate_SM_nextday(nextday);
    // 2 保存到缓存
    List<ShangmaDetailInfo> currentNextdayList = SM_NextDay_Map.getOrDefault(playerId, new ArrayList<>());
    currentNextdayList.add(shangmaDetailInfo);
    SM_NextDay_Map.put(playerId, currentNextdayList);
    // 3 刷新到当前的玩家次日表
    tableND.getItems().add(shangmaDetailInfo);
    tableND.refresh();
    // 4 修改主表的可上码额度 TODO
    refreshTableSM();
}
Also used : ShangmaDetailInfo(com.kendy.entity.ShangmaDetailInfo)

Example 7 with ShangmaDetailInfo

use of com.kendy.entity.ShangmaDetailInfo 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 8 with ShangmaDetailInfo

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

the class ShangmaService method addNewShangma2DetailTable.

/**
 * 新增个人上码详情记录到详情表
 * @param smInfo
 * @param shangmaJu 第几局
 * @param shangmaVal 上码值
 */
public static void addNewShangma2DetailTable(ShangmaInfo smInfo, String shangmaJu, String shangmaVal) {
    // 判断是否重复
    String playerId = smInfo.getShangmaPlayerId();
    String palyerName = smInfo.getShangmaName();
    if (checkIfDuplicate(playerId, shangmaJu)) {
        ShangmaDetailInfo detailInfo = updateDuplicateDetailInfo(playerId, shangmaJu);
        if (detailInfo != null) {
            log.info("新增时重复而续增今日上码值");
            // 桌号重复时则续增值
            addDuplicateSM(detailInfo, shangmaVal);
        }
        // ShowUtil.show("请勿重复添加第"+shangmaJu+"场次!!,该场次已存在!");
        return;
    }
    // 根据ID加载个人详细数据
    ShangmaService.loadSMDetailTable(playerId);
    // 添加表记录
    shangmaJu = getShangmaPaiju(shangmaJu);
    if (tableSMD.getItems() == null) {
        ObservableList<ShangmaDetailInfo> obList = FXCollections.observableArrayList();
        obList.add(new ShangmaDetailInfo(palyerName, shangmaVal, "", playerId, shangmaJu, "", "否"));
        tableSMD.setItems(obList);
    } else {
        tableSMD.getItems().add(new ShangmaDetailInfo(palyerName, shangmaVal, "", playerId, shangmaJu, "", "否"));
    }
    tableSMD.refresh();
    // save
    saveSMDetail(playerId);
    // 刷新左表对应记录
    updateRowByPlayerId(playerId, shangmaVal);
    // 2018-2-22
    updateTeamYajinAndEdu();
}
Also used : ShangmaDetailInfo(com.kendy.entity.ShangmaDetailInfo)

Example 9 with ShangmaDetailInfo

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

the class ShangmaService method loadNextDayDataAction.

/**
 * 实时上码开始新的一天由用户自行点击加载次日的数据
 *
 * @time 2018年2月4日
 */
public static void loadNextDayDataAction() {
    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) {
        Map<String, List<ShangmaDetailInfo>> detailMap = DataConstans.SM_Detail_Map;
        boolean isHasValue = detailMap.values().stream().anyMatch(list -> list.size() > 0);
        if (isHasValue) {
            ShowUtil.show("中途不能加载次日数据!!!");
            return;
        } else {
            int playerCount = SM_NextDay_Map.size();
            // 将次日数据的值复制给DataConstans.SM_Detail_Map
            SM_NextDay_Map.forEach((playerId, nextdayList) -> {
                List<ShangmaDetailInfo> detailList = new ArrayList<>();
                for (ShangmaDetailInfo nextday : nextdayList) {
                    detailList.add(copyShangmaDetailInfo(nextday));
                }
                detailMap.put(playerId, detailList);
            });
            // 将数据表中的删除
            DBUtil.setNextDayLoaded();
            // 清空SM_NextDay_Map
            SM_NextDay_Map.clear();
            // 清空当前的次日信息
            tableND.setItems(null);
            // 重新加载主表 TODO
            refreshTableSM();
            // 提示加载成功
            ShowUtil.show("加载次日数据成功!加载了" + playerCount + "个玩家数据", 4);
        }
    }
}
Also used : ShangmaDetailInfo(com.kendy.entity.ShangmaDetailInfo) ArrayList(java.util.ArrayList) Alert(javafx.scene.control.Alert) List(java.util.List) ObservableList(javafx.collections.ObservableList) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) ButtonType(javafx.scene.control.ButtonType)

Example 10 with ShangmaDetailInfo

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

the class ConsUtil method lock_SM_Detail_Map.

// 锁定当局备份上码表的个人详情
public static void lock_SM_Detail_Map() {
    // 复制当前上码的人个详情表,缓存到锁定中
    // 开启线程异步执行
    new Thread(new Runnable() {

        @Override
        public void run() {
            Map<String, List<ShangmaDetailInfo>> map = new HashMap<>();
            List<ShangmaDetailInfo> list = null;
            List<ShangmaDetailInfo> srcList = null;
            ShangmaDetailInfo info = null;
            for (Map.Entry<String, List<ShangmaDetailInfo>> entry : DataConstans.SM_Detail_Map.entrySet()) {
                srcList = entry.getValue();
                if (srcList == null || srcList.size() == 0) {
                    list = new ArrayList<ShangmaDetailInfo>();
                    map.put(entry.getKey(), list);
                } else {
                    list = new ArrayList<ShangmaDetailInfo>();
                    for (ShangmaDetailInfo detail : srcList) {
                        info = new ShangmaDetailInfo();
                        info.setShangmaDetailName(detail.getShangmaDetailName());
                        info.setShangmaJu(detail.getShangmaJu());
                        info.setShangmaPlayerId(detail.getShangmaPlayerId());
                        info.setShangmaShishou(detail.getShangmaShishou());
                        info.setShangmaSM(detail.getShangmaSM());
                        info.setShangmaPreSM(detail.getShangmaPreSM());
                        info.setShangmaHasPayed(detail.getShangmaHasPayed());
                        list.add(info);
                    }
                    map.put(entry.getKey(), list);
                }
            }
            DataConstans.SM_Detail_Map_Locked = null;
            DataConstans.SM_Detail_Map_Locked = map;
        }
    }).start();
}
Also used : LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) ShangmaDetailInfo(com.kendy.entity.ShangmaDetailInfo) List(java.util.List) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

ShangmaDetailInfo (com.kendy.entity.ShangmaDetailInfo)15 ArrayList (java.util.ArrayList)5 List (java.util.List)4 ShangmaInfo (com.kendy.entity.ShangmaInfo)3 ShangmaNextday (com.kendy.entity.ShangmaNextday)3 WanjiaInfo (com.kendy.entity.WanjiaInfo)2 HashMap (java.util.HashMap)2 LinkedHashMap (java.util.LinkedHashMap)2 LinkedList (java.util.LinkedList)2 Map (java.util.Map)2 ObservableList (javafx.collections.ObservableList)2 GDController (com.kendy.controller.GDController)1 QuotaController (com.kendy.controller.QuotaController)1 CurrentMoneyInfo (com.kendy.entity.CurrentMoneyInfo)1 DangjuInfo (com.kendy.entity.DangjuInfo)1 DangtianHuizongInfo (com.kendy.entity.DangtianHuizongInfo)1 JiaoshouInfo (com.kendy.entity.JiaoshouInfo)1 KaixiaoInfo (com.kendy.entity.KaixiaoInfo)1 MemberZJInfo (com.kendy.entity.MemberZJInfo)1 PingzhangInfo (com.kendy.entity.PingzhangInfo)1