use of com.kendy.entity.TeamHuishuiInfo 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.TeamHuishuiInfo in project financial by greatkendy123.
the class TeamProxyService method getTotalTeamHuishuiMap.
/**
* 获取最新锁定数据(指导入战绩)+可能已经导入的战绩
*/
public static Map<String, List<TeamHuishuiInfo>> getTotalTeamHuishuiMap() {
Map<String, List<TeamHuishuiInfo>> teamMap = new HashMap<>();
// 复制锁定数据(putAll方法不影响已锁定的数据)
// teamMap.putAll(DataConstans.Total_Team_Huishui_Map);//锁定就保留信息,不减(此方法不是深层复制,会影响DataConstans.Total_Team_Huishui_Map)
// 深层复制(代替以上代码)
teamMap = copy_Total_Team_Huishui_Map();
// 加上最新导入的当局信息(可能没有)
if (DataConstans.Dangju_Team_Huishui_List.size() > 0) {
for (TeamHuishuiInfo info : DataConstans.Dangju_Team_Huishui_List) {
String teamId = info.getTuan();
System.out.println(teamId);
List<TeamHuishuiInfo> teamHuishuiList = teamMap.get(teamId);
if (teamHuishuiList == null) {
teamHuishuiList = new ArrayList<>();
}
// add 去重
boolean isExist = false;
for (TeamHuishuiInfo teamInfo : teamHuishuiList) {
if (teamInfo.getTableId().equals(info.getTableId()) && teamInfo.getWanjia().equals(info.getWanjia())) {
isExist = true;
}
}
if (!isExist) {
teamHuishuiList.add(info);
}
teamMap.put(teamId, teamHuishuiList);
}
}
return teamMap;
}
use of com.kendy.entity.TeamHuishuiInfo in project financial by greatkendy123.
the class TeamProxyService method copy_Total_Team_Huishui_Map.
/**
* add 深层克隆Total_Team_Huishui_Map对象
*
* @time 2017年10月29日
* @return
*/
private static Map<String, List<TeamHuishuiInfo>> copy_Total_Team_Huishui_Map() {
Map<String, List<TeamHuishuiInfo>> teamMap = new HashMap<>();
// 深层复制(代替以上代码)
for (Map.Entry<String, List<TeamHuishuiInfo>> entry : DataConstans.Total_Team_Huishui_Map.entrySet()) {
String teamId = entry.getKey();
List<TeamHuishuiInfo> list = entry.getValue();
List<TeamHuishuiInfo> tempList = new ArrayList<>();
for (TeamHuishuiInfo tInfo : list) {
TeamHuishuiInfo tempHs = new TeamHuishuiInfo();
tempHs.setTuan(tInfo.getTuan());
tempHs.setWanjiaId(tInfo.getWanjiaId());
tempHs.setWanjia(tInfo.getWanjia());
tempHs.setShishou(tInfo.getShishou());
tempHs.setBaoxian(tInfo.getBaoxian());
tempHs.setChuHuishui(tInfo.getChuHuishui());
tempHs.setTableId(tInfo.getTableId());
tempHs.setZj(tInfo.getZj());
tempHs.setHuibao(tInfo.getHuibao());
tempHs.setShouHuishui(tInfo.getShouHuishui());
tempHs.setUpdateTime(tInfo.getUpdateTime());
tempList.add(tempHs);
}
teamMap.put(teamId, tempList);
}
return teamMap;
}
use of com.kendy.entity.TeamHuishuiInfo in project financial by greatkendy123.
the class MemberService method updateMemberTable.
/**
* 更新人员表
*
* @time 2017年10月28日
* @param tableMemberZJ
* @param wanjiaId
* @param memberSumOfZJ
*/
public static void updateMemberTable(TableView<MemberZJInfo> tableMemberZJ, String wanjiaId, Label memberSumOfZJ) {
// 根据名称获取团队ID
Player wanjia = DataConstans.membersMap.get(wanjiaId);
String teamId = "";
if (wanjia != null && !StringUtil.isBlank(wanjia.getTeamName())) {
teamId = wanjia.getTeamName();
}
ObservableList<MemberZJInfo> obList = FXCollections.observableArrayList();
// 战绩
String zj = "";
// 战绩总和
Double sumOfZJ = 0d;
if (DataConstans.Total_Team_Huishui_Map.size() != 0) {
List<TeamHuishuiInfo> list = DataConstans.Total_Team_Huishui_Map.get(teamId);
if (list != null) {
for (TeamHuishuiInfo info : list) {
if (info.getWanjiaId().equals(wanjiaId)) {
zj = info.getShishou();
obList.add(new MemberZJInfo(info.getTableId(), zj));
sumOfZJ += MoneyService.getNum(zj);
}
}
}
}
// 赋值总和
memberSumOfZJ.setText(MoneyService.digit0(sumOfZJ));
// 刷新表
tableMemberZJ.setItems(obList);
tableMemberZJ.refresh();
}
use of com.kendy.entity.TeamHuishuiInfo in project financial by greatkendy123.
the class MyController method saveHistoryRecord.
/**
* 保存当前导入的战绩表,用于会员查询和积分查询
* @throws Exception
*/
public void saveHistoryRecord() throws Exception {
List<TeamHuishuiInfo> list = DataConstans.Dangju_Team_Huishui_List;
List<HistoryRecord> ls = new ArrayList<>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if (list != null && list.size() > 0) {
for (TeamHuishuiInfo hs : list) {
/**
* @param playerId
* @param playerName
* @param teamId
* @param shishou
* @param yszj
* @param chuHuishui
* @param shouHuishui
* @param updateTime
*/
ls.add(new HistoryRecord(hs.getWanjiaId(), hs.getWanjia(), hs.getTuan(), hs.getShishou(), hs.getZj(), hs.getChuHuishui(), hs.getShouHuishui(), hs.getUpdateTime()));
}
if (!ls.isEmpty()) {
DBUtil.saveHistoryRecord(ls);
}
}
}
Aggregations