use of com.kendy.entity.GDDetailInfo 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.GDDetailInfo in project financial by greatkendy123.
the class GDController method quotar_money_oneKey_Action.
/**
* 一键配额
*
* @time 2018年2月25日
* @param event
*/
public void quotar_money_oneKey_Action(ActionEvent event) {
if (has_quotar_oneKey) {
ShowUtil.show("您已经一键分配过了!");
return;
}
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) {
MyController mc = Main.myController;
// 金额表
TableView<CurrentMoneyInfo> tableMoney = mc.tableCurrentMoneyInfo;
// 利润表
TableView<ProfitInfo> tableProfit = mc.tableProfit;
// 清空利润表
tableProfit.getItems().forEach(info -> info.setProfitAccount("0"));
// 将股东值赋到金额栏
String date = StringUtil.nvl(DataConstans.Date_Str, "2017-01-01");
date = date.substring(5);
for (GDDetailInfo info : tableGDDetail.getItems()) {
String money = StringUtil.nvl(info.getTotal(), "0");
String name = date + "#" + info.getName() + "#" + money;
// mingzi, shishiJine,String wanjiaId,String cmiEdu
CurrentMoneyInfo cmi = new CurrentMoneyInfo(name, money, "", "");
tableMoney.getItems().add(cmi);
}
// 添加总利润差额
String dif = difTotalProfit.getText();
String name = date + "#贡献值差额#" + dif;
// mingzi, shishiJine,String wanjiaId,String cmiEdu
CurrentMoneyInfo difCMI = new CurrentMoneyInfo(name, dif, "", "");
tableMoney.getItems().add(difCMI);
tableMoney.refresh();
tableProfit.refresh();
has_quotar_oneKey = true;
}
}
use of com.kendy.entity.GDDetailInfo in project financial by greatkendy123.
the class GDController method setTable_KFGu_data.
/**
* 获取总公司的利润
*
* @time 2018年2月21日
* @return
*/
// @Deprecated
// private Double get_Zonggongsi_Profit() {
// Optional<GudongRateInfo> gudongRateInfoOpt = tableGDSum.getItems().stream().filter(info->info.getGudongName().contains("总公司")).findFirst();
// if(gudongRateInfoOpt.isPresent())
// return NumUtil.getNum(gudongRateInfoOpt.get().getGudongProfit());
// else
// return 0d;
// }
/**
* 设置客服股数据
*
* @time 2018年1月28日
*/
private void setTable_KFGu_data() {
tablekfGu.getItems().stream().forEach(info -> {
if (!StringUtil.isAnyBlank(info.getType(), info.getRate())) {
info.setValue(NumUtil.digit0(NumUtil.getNumByPercent(info.getRate()) * getComputeTotalProfit_mins_totalSalary()));
// 缓存明细数据
GDDetailInfo detail = new GDDetailInfo(info.getType(), info.getValue());
detail.setSalary(info.getDescription());
detail.setTotal(NumUtil.getSum(info.getValue(), info.getDescription()));
detailMap.put(info.getType(), detail);
} else {
info.setType("");
info.setRate("");
info.setValue("");
}
});
tablekfGu.refresh();
}
use of com.kendy.entity.GDDetailInfo in project financial by greatkendy123.
the class GDController method setTable_YSGu_data_Second.
/**
* 设置第二次股东原始股数据
*/
private void setTable_YSGu_data_Second() {
// 获取剩下的30%
Double currage_poor_rest = (divide(getJLPoolAvailable(), getCurrageRate())) * (1 - getCurrageRate());
// 获取原始股比例
tableYSGu.getItems().forEach(info -> {
String oldVal = info.getValue();
String rateString = StringUtil.nvl(info.getRate(), "0%");
Double rate = NumUtil.getNumByPercent(rateString);
// 与第一次计算结果进行累积
Double newVal = currage_poor_rest * rate;
info.setValue(NumUtil.digit0(NumUtil.getNum(oldVal) + newVal));
// 缓存明细数据
GDDetailInfo detail = detailMap.get(info.getType());
detail.setJl3(NumUtil.digit0(newVal));
});
// 设置数据并刷新表
tableYSGu.refresh();
}
use of com.kendy.entity.GDDetailInfo 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