use of javafx.collections.ObservableList in project financial by greatkendy123.
the class TGController method refreshProfitTab.
/**
* 刷新月利润表
* @time 2018年3月17日
*/
public void refreshProfitTab() {
String tgCompany = currentTGCompanyLabel.getText();
if (StringUtil.isBlank(tgCompany)) {
ShowUtil.show("请先选择托管公司!");
return;
}
System.out.println("===========================刷新月利润表");
List<TGLirunInfo> list = new ArrayList<>();
TGLirunInfo lirun = new TGLirunInfo();
// 获取数据库的历史日利润表 TODO
List<TGLirunInfo> liruns = DBUtil.get_all_tg_lirun(tgCompany);
if (CollectUtil.isHaveValue(liruns)) {
// liruns = liruns.stream()
// .filter(info->tgCompany.equals(info.getTgLirunCompanyName())) // 获取当前托管公司的数据,但剔除今天已经保存过的数据,因为下面会重新计算
// .filter(info-> !(TimeUtil.getDateString().equals(info.getTgLirunDate()) && tgCompany.equals(info.getTgLirunCompanyName())))
// .collect(Collectors.toList());
list.addAll(liruns);
String today = getDateString();
boolean isTodayContains = list.stream().anyMatch(info -> today.equals(info.getTgLirunDate()));
if (isTodayContains) {
log.info("刷新月利润表时已经存在了今天" + today + "的数据了!所以不重复计算");
tableTGLirun.setItems(FXCollections.observableArrayList(list));
return;
}
}
// 刷新服务费
refreshFwfTab();
// 获取日期(日期与当前托管公司为主键)
String dateString = getDateString();
lirun.setTgLirunDate(dateString);
lirun.setTgLirunCompanyName(tgCompany);
// 获取总利润(即服务费明细中的总利润)
ObservableList<TypeValueInfo> fwfList = tableTGFwfSum.getItems();
String tgLirunTotalProfit = fwfList.stream().filter(info -> "总利润".equals(info.getType())).map(TypeValueInfo::getValue).findFirst().orElse("0");
lirun.setTgLirunTotalProfit(tgLirunTotalProfit);
// 获取总开销
List<TGKaixiaoInfo> allTGKaixiaos = DBUtil.get_all_tg_kaixiao();
double sumOfKaixiao = allTGKaixiaos.stream().filter(info -> tgCompany.equals(info.getTgKaixiaoCompany())).map(TGKaixiaoInfo::getTgKaixiaoMoney).mapToDouble(NumUtil::getNum).sum();
lirun.setTgLirunTotalKaixiao(NumUtil.digit0(sumOfKaixiao + ""));
// 设置Rest合计
lirun.setTgLirunRestHeji(NumUtil.digit2(NumUtil.getSum(tgLirunTotalProfit, sumOfKaixiao + "")));
// 设置公司占股
TGCompanyModel companyModel = DBUtil.get_tg_company_by_id(tgCompany);
String companyRate = companyModel.getCompanyRate();
companyRate = companyRate.endsWith("%") ? NumUtil.getNumByPercent(companyRate) + "" : NumUtil.getNum(companyRate) / 100.0 + "";
Double atmCompanyProfit = NumUtil.getNumTimes(lirun.getTgLirunRestHeji(), companyRate);
lirun.setTgLirunATMCompany(NumUtil.digit2(atmCompanyProfit + ""));
// 设置托管公司占股
String tgCompanyRate = StringUtil.nvl(companyModel.getTgCompanyRate(), "0%");
tgCompanyRate = tgCompanyRate.endsWith("%") ? NumUtil.getNumByPercent(tgCompanyRate) + "" : NumUtil.getNum(tgCompanyRate) / 100.0 + "";
Double tgCompanyProfit = NumUtil.getNumTimes(lirun.getTgLirunRestHeji(), tgCompanyRate);
lirun.setTgLirunTGCompany(NumUtil.digit2(tgCompanyProfit + ""));
// 设置团队服务费 TODO
Double tgCompanyProxy = 0.0d;
List<TGTeamModel> tgTeamInfos = DBUtil.get_all_tg_team();
Set<String> proxyTeamSet = tgTeamInfos.stream().filter(info -> "1".equals(info.getTgTeamProxy())).map(TGTeamModel::getTgTeamId).collect(Collectors.toSet());
tgCompanyProxy = tableTGFwf.getItems().stream().filter(info -> proxyTeamSet.contains(info.getTgFwfTeamId())).mapToDouble(info -> NumUtil.getNum(info.getTgFwfFanshui()) + NumUtil.getNum(info.getTgFwfFanbao())).sum();
lirun.setTgLirunTeamProfit(NumUtil.digit2(tgCompanyProxy + ""));
// 设置托管公司合计 = 托管公司占股 + 托管公司代理
Double tgCompanyHeji = tgCompanyProfit + tgCompanyProxy;
lirun.setTgLirunHeji(NumUtil.digit2(tgCompanyHeji + ""));
list.add(lirun);
tableTGLirun.setItems(FXCollections.observableArrayList(list));
}
use of javafx.collections.ObservableList in project financial by greatkendy123.
the class MoneyService method reCovery10TablesByPage.
/**
* 根据分页自动恢复该页锁定的10个表数据
*/
public static void reCovery10TablesByPage(TableView<TotalInfo> tableTotal, TableView<WanjiaInfo> tableWanjia, TableView<TeamInfo> tableTeam, TableView<CurrentMoneyInfo> tableCurrentMoney, TableView<ZijinInfo> tableZijin, TableView<KaixiaoInfo> tableKaixiao, TableView<ProfitInfo> tableProfit, TableView<DangjuInfo> tableDangju, TableView<JiaoshouInfo> tableJiaoshou, TableView<PingzhangInfo> tablePingzhang, Label LMLabel, int pageIndex) throws Exception {
// 获取该页所有数据
Map<String, String> map = DataConstans.All_Locked_Data_Map.get(pageIndex + "");
/**
*****************************************************
*/
// List<TotalInfo> TotalInfoList = JSON.parseObject(map.get("战绩"), new TypeReference<List<TotalInfo>>() {});
List<TotalInfo> TotalInfoList = JSON.parseObject(getJsonString(map, "战绩"), new TypeReference<List<TotalInfo>>() {
});
ObservableList<TotalInfo> obList = FXCollections.observableArrayList();
for (TotalInfo infos : TotalInfoList) {
obList.add(infos);
}
tableTotal.setItems(obList);
tableTotal.refresh();
/**
*********************************************************
*/
List<WanjiaInfo> WanjiaInfoList = JSON.parseObject(getJsonString(map, "玩家"), new TypeReference<List<WanjiaInfo>>() {
});
ObservableList<WanjiaInfo> WanjiaInfo_OB_List = FXCollections.observableArrayList();
for (WanjiaInfo infos : WanjiaInfoList) {
WanjiaInfo_OB_List.add(infos);
}
tableWanjia.setItems(WanjiaInfo_OB_List);
tableWanjia.refresh();
/**
*************************************************************************
*/
List<TeamInfo> TeamInfoList = JSON.parseObject(getJsonString(map, "团队回水"), new TypeReference<List<TeamInfo>>() {
});
ObservableList<TeamInfo> TeamInfo_OB_List = FXCollections.observableArrayList();
for (TeamInfo infos : TeamInfoList) {
TeamInfo_OB_List.add(infos);
}
tableTeam.setItems(TeamInfo_OB_List);
tableTeam.getColumns().get(4).setText(getJsonString(map, "团队回水总和"));
tableTeam.refresh();
/**
*************************************************************************
*/
List<CurrentMoneyInfo> CurrentMoneyInfoList = JSON.parseObject(getJsonString(map, "实时金额"), new TypeReference<List<CurrentMoneyInfo>>() {
});
ObservableList<CurrentMoneyInfo> CurrentMoneyInfo_OB_List = FXCollections.observableArrayList();
for (CurrentMoneyInfo infos : CurrentMoneyInfoList) {
CurrentMoneyInfo_OB_List.add(infos);
}
tableCurrentMoney.setItems(CurrentMoneyInfo_OB_List);
String sumOfCurrentMoney = getJsonString(map, "实时金额总和");
tableCurrentMoney.getColumns().get(2).setText(sumOfCurrentMoney);
tableCurrentMoney.refresh();
/**
**********************************************************
*/
List<ZijinInfo> ZijinInfoList = JSON.parseObject(getJsonString(map, "资金"), new TypeReference<List<ZijinInfo>>() {
});
ObservableList<ZijinInfo> ZijinInfo_OB_List = FXCollections.observableArrayList();
for (ZijinInfo infos : ZijinInfoList) {
ZijinInfo_OB_List.add(infos);
}
tableZijin.getColumns().get(1).setText(getJsonString(map, "资金总和"));
tableZijin.setItems(ZijinInfo_OB_List);
tableZijin.refresh();
/**
***************************************************************
*/
List<ProfitInfo> ProfitInfoList = JSON.parseObject(getJsonString(map, "利润"), new TypeReference<List<ProfitInfo>>() {
});
ObservableList<ProfitInfo> ProfitInfo_OB_List = FXCollections.observableArrayList();
for (ProfitInfo infos : ProfitInfoList) {
ProfitInfo_OB_List.add(infos);
}
tableProfit.getColumns().get(1).setText(getJsonString(map, "利润总和"));
tableProfit.setItems(ProfitInfo_OB_List);
tableProfit.refresh();
/**
**********************************************************
*/
List<KaixiaoInfo> KaixiaoInfoList = JSON.parseObject(getJsonString(map, "实时开销"), new TypeReference<List<KaixiaoInfo>>() {
});
ObservableList<KaixiaoInfo> KaixiaoInfo_OB_List = FXCollections.observableArrayList();
for (KaixiaoInfo infos : KaixiaoInfoList) {
KaixiaoInfo_OB_List.add(infos);
}
tableKaixiao.getColumns().get(1).setText(getJsonString(map, "实时开销总和"));
tableKaixiao.setItems(KaixiaoInfo_OB_List);
tableKaixiao.refresh();
/**
************************************************************
*/
List<DangjuInfo> DangjuInfoList = JSON.parseObject(getJsonString(map, "当局"), new TypeReference<List<DangjuInfo>>() {
});
ObservableList<DangjuInfo> DangjuInfo_OB_List = FXCollections.observableArrayList();
for (DangjuInfo infos : DangjuInfoList) {
DangjuInfo_OB_List.add(infos);
}
tableDangju.getColumns().get(1).setText(getJsonString(map, "当局总和"));
tableDangju.setItems(DangjuInfo_OB_List);
tableDangju.refresh();
/**
*************************************************************
*/
List<JiaoshouInfo> JiaoshouInfoList = JSON.parseObject(getJsonString(map, "交收"), new TypeReference<List<JiaoshouInfo>>() {
});
ObservableList<JiaoshouInfo> JiaoshouInfo_OB_List = FXCollections.observableArrayList();
for (JiaoshouInfo infos : JiaoshouInfoList) {
JiaoshouInfo_OB_List.add(infos);
}
tableJiaoshou.getColumns().get(1).setText(getJsonString(map, "交收总和"));
tableJiaoshou.setItems(JiaoshouInfo_OB_List);
tableJiaoshou.refresh();
/**
***************************************************************
*/
List<PingzhangInfo> PingzhangInfoList = JSON.parseObject(getJsonString(map, "平帐"), new TypeReference<List<PingzhangInfo>>() {
});
ObservableList<PingzhangInfo> PingzhangInfo_OB_List = FXCollections.observableArrayList();
for (PingzhangInfo infos : PingzhangInfoList) {
PingzhangInfo_OB_List.add(infos);
}
tablePingzhang.getColumns().get(1).setText(getJsonString(map, "平帐总和"));
tablePingzhang.setItems(PingzhangInfo_OB_List);
tablePingzhang.refresh();
/**
***************************************************************
*/
LMLabel.setText(getJsonString(map, "联盟对帐"));
}
use of javafx.collections.ObservableList in project financial by greatkendy123.
the class MoneyService method flush_SSJE_table.
/**
* 刷新最新的实时金额(最重要!!!!)
* 即添加进合并ID
*
* @time 2017年11月1日
* @throws Exception
*/
public static void flush_SSJE_table() {
LinkedList<CurrentMoneyInfo> srcList = new LinkedList<>();
if (!isTableNotNull()) {
return;
} else {
for (CurrentMoneyInfo info : tableCurrentMoneyInfo.getItems()) srcList.add(info);
}
// 组装数据为空
// 对组装的数据列表进行处理,空行直接删除,父ID删除,子ID删除后缓存
ListIterator<CurrentMoneyInfo> it = srcList.listIterator();
// 存放父ID那条记录的信息
Map<String, CurrentMoneyInfo> superIdInfoMap = new HashMap<>();
// 存放父ID下的所有子记录信息
Map<String, List<CurrentMoneyInfo>> superIdSubListMap = new HashMap<>();
String playerId = "";
while (it.hasNext()) {
CurrentMoneyInfo item = it.next();
// 删除空行
if (StringUtil.isBlank(item.getWanjiaId()) && StringUtil.isBlank(item.getMingzi()) && StringUtil.isBlank(item.getShishiJine())) {
// 没有玩家ID的就是空行
it.remove();
continue;
}
// 删除父ID
playerId = item.getWanjiaId();
if (DataConstans.Combine_Super_Id_Map.get(playerId) != null) {
superIdInfoMap.put(playerId, item);
it.remove();
continue;
}
// 删除子ID
if (DataConstans.Combine_Sub_Id_Map.get(playerId) != null) {
// 是子ID节点
String parentID = DataConstans.Combine_Sub_Id_Map.get(playerId);
List<CurrentMoneyInfo> childList = superIdSubListMap.get(parentID);
if (childList == null) {
childList = new ArrayList<>();
}
childList.add(item);
superIdSubListMap.put(parentID, childList);
it.remove();
continue;
}
}
// 添加子ID不在实时金额表中的父ID记录(单条父记录)
superIdInfoMap.forEach((superId, info) -> {
if (!superIdSubListMap.containsKey(superId)) {
info.setCmSuperIdSum("");
// 添加父记录
srcList.add(info);
}
});
// 添加父ID不在实时金额表中的子ID记录
Iterator<Map.Entry<String, List<CurrentMoneyInfo>>> ite = superIdSubListMap.entrySet().iterator();
while (ite.hasNext()) {
Map.Entry<String, List<CurrentMoneyInfo>> entry = ite.next();
String superId = entry.getKey();
CurrentMoneyInfo superInfo = superIdInfoMap.get(superId);
if (superInfo == null) {
for (CurrentMoneyInfo info : entry.getValue()) {
// 添加子记录
srcList.add(info);
}
// 删除
ite.remove();
}
}
// 计算总和并填充父子节点和空行
String superId = "";
// 空开一行
srcList.add(new CurrentMoneyInfo());
for (Map.Entry<String, List<CurrentMoneyInfo>> entry : superIdSubListMap.entrySet()) {
superId = entry.getKey();
CurrentMoneyInfo superInfo = superIdInfoMap.get(superId);
// 计算父节点总和
List<CurrentMoneyInfo> subInfoList = entry.getValue();
// 合并ID节点总和
Double superIdSum = 0d;
for (CurrentMoneyInfo info : subInfoList) {
superIdSum += NumUtil.getNum(info.getShishiJine());
}
superInfo.setCmSuperIdSum(NumUtil.digit0(superIdSum + NumUtil.getNum(superInfo.getShishiJine())));
// 添加空行和子节点
// 先添加父节点
srcList.add(superInfo);
for (CurrentMoneyInfo info : subInfoList) {
// 再添加子节点
srcList.add(info);
}
// 空开一行
srcList.add(new CurrentMoneyInfo());
}
// 更新
ObservableList<CurrentMoneyInfo> obList = FXCollections.observableArrayList();
for (CurrentMoneyInfo cmi : srcList) {
obList.add(cmi);
}
tableCurrentMoneyInfo.setItems(obList);
tableCurrentMoneyInfo.refresh();
}
use of javafx.collections.ObservableList in project financial by greatkendy123.
the class ShangmaService method updateShangDetailMap.
/**
* 导入战绩时更新上码系统的个人信息
*/
public static void updateShangDetailMap(TableView<WanjiaInfo> table) {
// final List<TeamHuishuiInfo> list = DataConstans.Dangju_Team_Huishui_List;
ObservableList<WanjiaInfo> obList = table.getItems();
Map<String, List<ShangmaDetailInfo>> detailMap = DataConstans.SM_Detail_Map;
List<ShangmaDetailInfo> detailList = null;
String playerId = "", preYSM, yiSM, tableId, ju;
if (obList != null && obList.size() > 0) {
// 遍历当局
for (WanjiaInfo info : obList) {
playerId = info.getWanjiaId();
detailList = detailMap.get(playerId);
if (detailList != null) {
// getRealTableId(info.getPaiju());//不是第X局了,而是X
tableId = info.getPaiju();
// 遍历个人信息
for (ShangmaDetailInfo sdi : detailList) {
ju = sdi.getShangmaJu();
if (!StringUtil.isBlank(ju) && ju.equals(tableId)) {
// 设置原先上码值,以及清空当局上码
preYSM = sdi.getShangmaSM();
sdi.setShangmaPreSM(preYSM);
sdi.setShangmaSM("");
// 设置实收
sdi.setShangmaShishou(info.getZhangji());
// add2017-09-24 加载主表
loadShangmaTable(DataConstans.membersMap.get(playerId).getTeamName(), tableSM);
// }
break;
}
}
detailMap.put(playerId, detailList);
}
}
}
}
use of javafx.collections.ObservableList in project financial by greatkendy123.
the class TGExportExcelService method getTGWaizhaiExcelModel.
/**
* 导出托管公司的团队外债与团队外债明细
* @return
*/
private TGExcelModel getTGWaizhaiExcelModel() {
TGExcelModel excelModel = new TGExcelModel();
List<String> titleList = new LinkedList<>();
List<Object[]> data = new LinkedList<>();
List<String> titleSumList = new LinkedList<>();
List<Object[]> dataSum = new LinkedList<>();
// 取值
// 传给Excel的外债数据
Map<String, List<Object[]>> teamMap = new LinkedHashMap<>();
ObservableList<Node> items = tgController.tgWZTeamHBox.getChildren();
// 存放总和表
ObservableList<TypeValueInfo> sumItems = tgController.tgWZTeam.getItems();
if (CollectUtil.isHaveValue(sumItems)) {
List<Object[]> teamList = tgController.tgWZTeam.getItems().stream().map(info -> {
Object[] obj = new Object[2];
obj[0] = info.getType();
obj[1] = info.getValue();
return obj;
}).collect(Collectors.toList());
String key = tgController.tgWZTeam.getColumns().get(0).getText() + "#" + tgController.tgWZTeam.getColumns().get(1).getText();
teamMap.put(key, teamList);
}
// 存放明细表
if (CollectUtil.isHaveValue(items)) {
for (Node node : items) {
TableView<CurrentMoneyInfo> table = (TableView<CurrentMoneyInfo>) node;
List<Object[]> teamList = table.getItems().stream().map(info -> {
Object[] obj = new Object[2];
obj[0] = info.getMingzi();
obj[1] = info.getShishiJine();
return obj;
}).collect(Collectors.toList());
String key = table.getColumns().get(0).getText() + "#" + table.getColumns().get(1).getText();
teamMap.put(key, teamList);
}
}
excelModel.setColumnList(titleList);
excelModel.setData(data);
excelModel.setColumnSumList(titleSumList);
excelModel.setDataSum(dataSum);
excelModel.setSheetName("外债");
// 设值
excelModel.setWaiZai(true);
excelModel.setWaizhaiMap(teamMap);
return excelModel;
}
Aggregations