use of com.kendy.entity.GDInputInfo in project financial by greatkendy123.
the class GDController method setTableMockData.
/**
* 三个表模拟数据
*
* @time 2018年1月26日
* @param tables
*/
private void setTableMockData(TableView<GDInputInfo> table, int mockRows) {
ObservableList<GDInputInfo> obList = FXCollections.observableArrayList();
if (table.getItems() != null && !table.getItems().isEmpty())
return;
if (mockRows != 9) {
for (int i = 1; i <= mockRows; i++) {
obList.add(new GDInputInfo("客服" + i, getRandomRate()));
}
}
table.setItems(obList);
table.refresh();
}
use of com.kendy.entity.GDInputInfo in project financial by greatkendy123.
the class GDController method load_KF_data_Action.
/**
* 加载客服数据(按钮)
*
* @time 2018年2月3日
* @param even
*/
public void load_KF_data_Action(ActionEvent even) {
// 从数据库获取客服数据
String kfValue = DBUtil.getValueByKey(TABLE_KF_DATA_KEY);
Map<String, String> kfMap = JSON.parseObject(kfValue, new TypeReference<Map<String, String>>() {
});
if (MapUtil.isNullOrEmpty(kfMap)) {
ShowUtil.show("数据库中无客服数据!");
return;
}
// 清空客服表数据s
if (TableUtil.isHasValue(tablekfGu)) {
tablekfGu.getItems().forEach(info -> {
info.setDescription("");
info.setId("");
info.setRate("");
info.setType("");
info.setValue("");
});
}
// 保证有20条记录
ObservableList<GDInputInfo> obList = FXCollections.observableArrayList();
kfMap.forEach((name, rate) -> {
// 本方法最关键的一行
obList.add(new GDInputInfo(name, rate));
});
// 不满足20行的补空行
Integer restEmptyCountRowSize = KF_SIZE - kfMap.size();
if (restEmptyCountRowSize > 0) {
for (int i = 0; i < restEmptyCountRowSize; i++) obList.add(new GDInputInfo());
}
// 刷新客服表
tablekfGu.setItems(obList);
tablekfGu.refresh();
}
use of com.kendy.entity.GDInputInfo in project financial by greatkendy123.
the class GDController method setTable_YSGu_data_first.
/**
* 设置第一次股东原始股
*
* @time 2018年1月28日
*/
private void setTable_YSGu_data_first() {
ObservableList<GDInputInfo> obList = FXCollections.observableArrayList();
// 获取银河股东的利润
Double yinheProfit = getYinheProfit();
// 股东列表:除了银河股东
if (tableYSGu.getItems() == null || tableYSGu.getItems().size() == 0 || StringUtil.isBlank(tableYSGu.getItems().get(0).getType())) {
tableGDSum.getItems().stream().filter(info -> !info.getGudongName().contains("银河")).map(info -> new GDInputInfo(info.getGudongName(), "", "")).forEach(info -> {
obList.add(info);
});
tableYSGu.setItems(obList);
tableYSGu.refresh();
}
// 根据股东比例计算各股东的原始利润
tableYSGu.getItems().forEach(info -> {
if (!StringUtil.isAnyBlank(info.getType(), info.getRate()))
info.setValue(NumUtil.digit0(NumUtil.getNumByPercent(info.getRate()) * yinheProfit));
else {
// info.setType("");
// info.setRate("");
info.setValue("");
}
});
// 刷新表
tableYSGu.refresh();
// 缓存明细数据
tableYSGu.getItems().forEach(info -> {
GDDetailInfo entity = new GDDetailInfo(info.getType(), info.getValue());
// 备注:此处的描述字段为实体的底薪
entity.setSalary(info.getDescription());
detailMap.put(info.getType(), entity);
});
}
use of com.kendy.entity.GDInputInfo in project financial by greatkendy123.
the class GDController method setTable_JLGu_data.
/**
* 设置股东奖励股数据
*/
private void setTable_JLGu_data() {
// 股东及股东的记录数,一个记录数就是一个人次
Map<String, List<Record>> gudongSizeMap = dataList.stream().collect(// 按股东分
Collectors.groupingBy(record -> getGudongByPlayerId((Record) record)));
ObservableList<String> gudongList = MyController.getGudongList();
for (String gudong : gudongList) {
if (!gudongSizeMap.keySet().contains(gudong)) {
gudongSizeMap.put(gudong, new ArrayList<>());
}
}
// 获取非银河的股东的所有人次利润
Double renciProfit = getRenciTotalProfit_not_yinhe();
ObservableList<GDInputInfo> obList = FXCollections.observableArrayList();
// 股东列表总和:除了银河股东,用于获取各股东的比例(比拼值),加上了总人次利润(除去银河股东)
Double sum = tableGDSum.getItems().stream().filter(info -> !info.getGudongName().contains("银河")).map(info -> NumUtil.getNum(info.getGudongProfit())).reduce(Double::sum).orElseGet(() -> 0d) + renciProfit;
// 获取可分配的奖励池
Double curragePool = getJLPoolAvailable();
// 计算各股东的奖励金额
tableGDSum.getItems().stream().filter(info -> !info.getGudongName().contains("银河")).map(info -> {
/**
******************************************************添加相应股东的人次总利润*********
*/
String gudongId = info.getGudongName().replace("股东", "");
Integer size = gudongSizeMap.get(gudongId).size();
Double gudongTotalRenciProfit = NumUtil.getNumTimes(size.toString(), getRenci());
/**
***************************************************************
*/
Double rate = divide((NumUtil.getNum(info.getGudongProfit()) + gudongTotalRenciProfit), sum);
Double currageMoney = curragePool * rate;
// 明细缓存
GDDetailInfo gdDetailInfo = detailMap.get(info.getGudongName());
gdDetailInfo.setJl7(NumUtil.digit0(currageMoney));
// 返回
return new GDInputInfo(info.getGudongName(), NumUtil.getPercentStr(rate), NumUtil.digit0(currageMoney));
}).forEach(info -> obList.add(info));
// 设置数据并刷新表
tableEncourageGu.setItems(obList);
tableEncourageGu.refresh();
}
Aggregations