use of com.kendy.entity.Player in project financial by greatkendy123.
the class MoneyService method exportMemberExcel.
/**
*********************** 导出人员表Excel ***********************************
*/
public static void exportMemberExcel() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
String title = "名单登记表-德扑圈" + sdf.format(new Date());
log.info("导出人员表Excel:" + title);
String[] rowsName = new String[] { "玩家ID", "股东", "团队", "游戏名字", "额度" };
List<Object[]> dataList = new ArrayList<Object[]>();
Object[] objs = null;
Map<String, Player> memberMap = DataConstans.membersMap;
String pId;
Player player;
for (Map.Entry<String, Player> entry : memberMap.entrySet()) {
pId = entry.getKey();
player = entry.getValue();
objs = new Object[rowsName.length];
objs[0] = pId;
objs[1] = player.getGudong();
objs[2] = player.getTeamName();
objs[3] = player.getPlayerName();
objs[4] = player.getEdu();
dataList.add(objs);
}
String out = "D:/" + title;
ExportMembersExcel ex = new ExportMembersExcel(title, rowsName, dataList, out);
try {
ex.export();
log.info("导出人员表Excel成功");
} catch (Exception e) {
ErrorUtil.err("导出人员表Excel失败", e);
}
}
use of com.kendy.entity.Player in project financial by greatkendy123.
the class MoneyService method fillTablerAfterImportZJ.
/**
* 导入战绩成功后
* 自动填充玩家信息表、牌局表、团队表以及当局
* 备注:这些表数据在当局范围内是固定不变的
*
* @param table 玩家信息表
* @param tablePaiju 牌局表
* @param userInfoList 导入的玩家战绩列表
*/
public static void fillTablerAfterImportZJ(TableView<TotalInfo> table, TableView<WanjiaInfo> tablePaiju, TableView<DangjuInfo> tableDangju, TableView<JiaoshouInfo> tableJiaoshou, TableView<TeamInfo> tableTeam, List<UserInfos> userInfoList, String tableId) {
// 1清空 表数据
table.setItems(null);
// 2获取InfoList
ObservableList<TotalInfo> tableTotalInfoList = FXCollections.observableArrayList();
ObservableList<WanjiaInfo> tableWanjiaInfoList = FXCollections.observableArrayList();
TotalInfo info = null;
Player player;
WanjiaInfo wanjia;
// 用于缓存和计算团累计团队回水
List<TeamHuishuiInfo> teamHuishuiList = null;
// 用于只展示本次战绩的团队信息
Set<String> relatedTeamIdSet = new HashSet<>();
// 每次导入都去初始化当局团队战绩信息
DataConstans.Dangju_Team_Huishui_List = new LinkedList<>();
for (UserInfos zj : userInfoList) {
/**
************************************************* 填充信息表 ****************
*/
info = new TotalInfo();
// 团 ID 玩家 计分 实收 保险
String playerId = zj.getPlayerId();
player = DataConstans.membersMap.get(playerId);
String teamId = "";
if (player != null) {
teamId = player.getTeamName();
teamId = StringUtil.isBlank(teamId) ? "" : teamId.toUpperCase();
} else // add 2017-10-26
{
Player tempPlayer = DBUtil.getMemberById(playerId);
if (tempPlayer != null && !StringUtil.isBlank(tempPlayer.getTeamName())) {
DataConstans.membersMap.put(playerId, tempPlayer);
teamId = tempPlayer.getTeamName();
teamId = StringUtil.isBlank(teamId) ? "" : teamId.toUpperCase();
}
}
String name = zj.getPlayerName();
String baoxian = zj.getinsurance();
String shishou = getShiShou(zj.getZj());
String chuHuishui = digit1(getChuhuishui(zj.getZj(), teamId));
String shuihouxian = digit1((-1) * Double.valueOf(zj.getinsurance()) * 0.975 + "");
String shouHuishui = digit1(Math.abs(Double.valueOf(zj.getZj())) * 0.025 + "");
String baohui = digit1(getHuiBao(baoxian, teamId));
String heLirun = digit2(getHeLirun(shouHuishui, chuHuishui, shuihouxian, baohui));
// 团(团ID)
info.setTuan(teamId);
// ID
info.setWanjiaId(playerId);
// 玩家
info.setWanjia(name);
// 计分
// ?计分 = 战绩?
info.setJifen(zj.getZj());
// 实收
info.setShishou(shishou);
// 保险
info.setBaoxian(baoxian);
// 出回水
info.setChuHuishui(chuHuishui);
// 保回
info.setBaohui(baohui);
// 水后险
info.setShuihouxian(shuihouxian);
// 收回水
info.setShouHuishui(shouHuishui);
// 合利润
info.setHeLirun(heLirun);
tableTotalInfoList.add(info);
/**
************************************************* 填充牌局表 ****************
*/
wanjia = new WanjiaInfo();
String yicunJifen = getYicunJifen(zj.getPlayerId());
String heji = digit0(getNum(yicunJifen) + getNum(shishou) + "");
wanjia.setPaiju("第" + tableId + "局");
wanjia.setWanjiaName(zj.getPlayerName());
wanjia.setYicunJifen(yicunJifen);
wanjia.setZhangji(shishou);
wanjia.setHeji(heji);
wanjia.setWanjiaId(playerId);
/**
************************************************* 缓存各团队回水记录 ****************
*/
teamId = teamId.toUpperCase();
// if(!StringUtil.isBlank(teamId) && !"公司".equals(teamId)) {
if (!StringUtil.isBlank(teamId)) {
// 缓存到当局团队战绩信息中
TeamHuishuiInfo teamHuishuiInfo = new TeamHuishuiInfo(teamId, playerId, name, shishou, baoxian, chuHuishui, "第" + tableId + "局", zj.getZj(), baohui, shouHuishui, zj.getDay());
DataConstans.Dangju_Team_Huishui_List.add(teamHuishuiInfo);
if (!"公司".equals(teamId)) {
relatedTeamIdSet.add(teamId);
}
// 缓存到总团队回水中(结算按钮后从中减少)
teamHuishuiList = DataConstans.Team_Huishui_Map.get(teamId);
if (teamHuishuiList == null) {
teamHuishuiList = new ArrayList<>();
}
teamHuishuiList.add(teamHuishuiInfo);
DataConstans.Team_Huishui_Map.put(teamId, teamHuishuiList);
// //缓存到总团队回水中(不会从中减少)
// teamHuishuiList = DataConstans.Total_Team_Huishui_Map.get(teamId);
// if( teamHuishuiList == null ) {
// teamHuishuiList = new ArrayList<>();
// }
// teamHuishuiList.add(
// new TeamHuishuiInfo(teamId,playerId,name,shishou,baoxian,chuHuishui,"第"+tableId+"局")
// );
// DataConstans.Total_Team_Huishui_Map.put(teamId,teamHuishuiList);
} else {
log.warn("检测到团队ID是空或为公司,玩家是:" + name);
}
// 是否显示支付按钮
wanjia.setHasPayed(relatedTeamIdSet.contains(teamId) ? teamId : "");
tableWanjiaInfoList.add(wanjia);
}
// 3填充
table.setItems(tableTotalInfoList);
table.refresh();
// tablePaiju.setItems(tableWanjiaInfoList);
// 添加需要支付的按钮靠前排
fillTablePaiju(tablePaiju, tableWanjiaInfoList);
// 缓存当局固定总和
DataConstans.SumMap.putAll(getSums(tableTotalInfoList));
// 填充当局表和交收表
initTableDangjuAndTableJiaoshou(tableDangju, tableJiaoshou);
// 填充团队表
fillTableTeam(tableTeam, relatedTeamIdSet);
// 更新实时上码表的个人详情
ShangmaService.updateShangDetailMap(tablePaiju);
}
use of com.kendy.entity.Player in project financial by greatkendy123.
the class ShangmaService method shangmaSearch.
/**
* 上码搜索
* @param keyWord
* @param shangmaTeamId
*/
public static void shangmaSearch(String keyWord, Label shangmaTeamId) {
// 1根据模糊人名匹配到人员信息获取玩家ID
// Player player = getPlayerIdByName(keyWord);
Player player = getNextSelectedPlayer(keyWord);
if (player == null) {
ShowUtil.show("查无数据:" + keyWord, 1);
return;
}
// 2从人员信息中获取团队ID
String playerId = player.getgameId();
String teamId = player.getTeamName();
// 3加载数据
// 勾选团队
setTeamAvailabe(teamId);
shangmaTeamId.setText(teamId);
ShangmaService.loadShangmaTable(teamId, tableSM);
// 4匹配人名(ID)后置为选中样式
ShangmaService.scrollByPlayerId(playerId, tableSM);
// 根据个人ID加载个人信息
ShangmaService.loadSMDetailTable(playerId);
}
use of com.kendy.entity.Player 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;
}
use of com.kendy.entity.Player in project financial by greatkendy123.
the class ShangmaService method refreshTeamIdAndPlayerId.
// 获取最新的团队ID与玩家ID列表的映射
public static void refreshTeamIdAndPlayerId() {
final Map<String, Player> memberMap = DataConstans.membersMap;
Map<String, List<String>> teamWanjiaMap = new HashMap<>();
if (memberMap != null && memberMap.size() > 0) {
List<String> list = null;
String teamId = "";
for (Map.Entry<String, Player> entry : memberMap.entrySet()) {
Player wanjia = entry.getValue();
teamId = wanjia.getTeamName();
if (!StringUtil.isBlank(teamId)) {
list = teamWanjiaMap.get(teamId);
list = list == null ? new ArrayList<>() : list;
list.add(entry.getKey());
teamWanjiaMap.put(teamId, list);
}
}
}
teamIdAndPlayerIdMap = teamWanjiaMap;
}
Aggregations