Search in sources :

Example 1 with GDDetailInfo

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);
    });
}
Also used : Button(javafx.scene.control.Button) Initializable(javafx.fxml.Initializable) NumUtil(com.kendy.util.NumUtil) URL(java.net.URL) Random(java.util.Random) Logger(org.apache.log4j.Logger) AlertType(javafx.scene.control.Alert.AlertType) StringUtil(com.kendy.util.StringUtil) MoneyService(com.kendy.service.MoneyService) Map(java.util.Map) KaixiaoInfo(com.kendy.entity.KaixiaoInfo) MyController(application.MyController) TableView(javafx.scene.control.TableView) Alert(javafx.scene.control.Alert) HBox(javafx.scene.layout.HBox) TextField(javafx.scene.control.TextField) GudongRateInfo(com.kendy.entity.GudongRateInfo) PropertyValueFactory(javafx.scene.control.cell.PropertyValueFactory) Set(java.util.Set) Collectors(java.util.stream.Collectors) FXML(javafx.fxml.FXML) List(java.util.List) TypeReference(com.alibaba.fastjson.TypeReference) CollectUtil(com.kendy.util.CollectUtil) ShowUtil(com.kendy.util.ShowUtil) GDDetailInfo(com.kendy.entity.GDDetailInfo) Optional(java.util.Optional) ObservableList(javafx.collections.ObservableList) CurrentMoneyInfo(com.kendy.entity.CurrentMoneyInfo) ButtonType(javafx.scene.control.ButtonType) Record(com.kendy.entity.Record) FXCollections(javafx.collections.FXCollections) HashMap(java.util.HashMap) MapUtil(com.kendy.util.MapUtil) TextFieldTableCell(javafx.scene.control.cell.TextFieldTableCell) ArrayList(java.util.ArrayList) TableColumn(javafx.scene.control.TableColumn) Insets(javafx.geometry.Insets) ResourceBundle(java.util.ResourceBundle) TableUtil(com.kendy.util.TableUtil) DataConstans(application.DataConstans) DBUtil(com.kendy.db.DBUtil) Player(com.kendy.entity.Player) Label(javafx.scene.control.Label) ClubZhuofei(com.kendy.entity.ClubZhuofei) TeamProxyService(com.kendy.service.TeamProxyService) ProfitInfo(com.kendy.entity.ProfitInfo) Main(application.Main) GDInputInfo(com.kendy.entity.GDInputInfo) ActionEvent(javafx.event.ActionEvent) JSON(com.alibaba.fastjson.JSON) Collections(java.util.Collections) GDDetailInfo(com.kendy.entity.GDDetailInfo) GDInputInfo(com.kendy.entity.GDInputInfo)

Example 2 with GDDetailInfo

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;
    }
}
Also used : GDDetailInfo(com.kendy.entity.GDDetailInfo) Alert(javafx.scene.control.Alert) CurrentMoneyInfo(com.kendy.entity.CurrentMoneyInfo) ButtonType(javafx.scene.control.ButtonType) MyController(application.MyController) ProfitInfo(com.kendy.entity.ProfitInfo)

Example 3 with GDDetailInfo

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();
}
Also used : GDDetailInfo(com.kendy.entity.GDDetailInfo)

Example 4 with GDDetailInfo

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();
}
Also used : GDDetailInfo(com.kendy.entity.GDDetailInfo)

Example 5 with GDDetailInfo

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();
}
Also used : Button(javafx.scene.control.Button) Initializable(javafx.fxml.Initializable) NumUtil(com.kendy.util.NumUtil) URL(java.net.URL) Random(java.util.Random) Logger(org.apache.log4j.Logger) AlertType(javafx.scene.control.Alert.AlertType) StringUtil(com.kendy.util.StringUtil) MoneyService(com.kendy.service.MoneyService) Map(java.util.Map) KaixiaoInfo(com.kendy.entity.KaixiaoInfo) MyController(application.MyController) TableView(javafx.scene.control.TableView) Alert(javafx.scene.control.Alert) HBox(javafx.scene.layout.HBox) TextField(javafx.scene.control.TextField) GudongRateInfo(com.kendy.entity.GudongRateInfo) PropertyValueFactory(javafx.scene.control.cell.PropertyValueFactory) Set(java.util.Set) Collectors(java.util.stream.Collectors) FXML(javafx.fxml.FXML) List(java.util.List) TypeReference(com.alibaba.fastjson.TypeReference) CollectUtil(com.kendy.util.CollectUtil) ShowUtil(com.kendy.util.ShowUtil) GDDetailInfo(com.kendy.entity.GDDetailInfo) Optional(java.util.Optional) ObservableList(javafx.collections.ObservableList) CurrentMoneyInfo(com.kendy.entity.CurrentMoneyInfo) ButtonType(javafx.scene.control.ButtonType) Record(com.kendy.entity.Record) FXCollections(javafx.collections.FXCollections) HashMap(java.util.HashMap) MapUtil(com.kendy.util.MapUtil) TextFieldTableCell(javafx.scene.control.cell.TextFieldTableCell) ArrayList(java.util.ArrayList) TableColumn(javafx.scene.control.TableColumn) Insets(javafx.geometry.Insets) ResourceBundle(java.util.ResourceBundle) TableUtil(com.kendy.util.TableUtil) DataConstans(application.DataConstans) DBUtil(com.kendy.db.DBUtil) Player(com.kendy.entity.Player) Label(javafx.scene.control.Label) ClubZhuofei(com.kendy.entity.ClubZhuofei) TeamProxyService(com.kendy.service.TeamProxyService) ProfitInfo(com.kendy.entity.ProfitInfo) Main(application.Main) GDInputInfo(com.kendy.entity.GDInputInfo) ActionEvent(javafx.event.ActionEvent) JSON(com.alibaba.fastjson.JSON) Collections(java.util.Collections) GDDetailInfo(com.kendy.entity.GDDetailInfo) GDInputInfo(com.kendy.entity.GDInputInfo) List(java.util.List) ObservableList(javafx.collections.ObservableList) ArrayList(java.util.ArrayList)

Aggregations

GDDetailInfo (com.kendy.entity.GDDetailInfo)5 MyController (application.MyController)3 CurrentMoneyInfo (com.kendy.entity.CurrentMoneyInfo)3 ProfitInfo (com.kendy.entity.ProfitInfo)3 DataConstans (application.DataConstans)2 Main (application.Main)2 JSON (com.alibaba.fastjson.JSON)2 TypeReference (com.alibaba.fastjson.TypeReference)2 DBUtil (com.kendy.db.DBUtil)2 ClubZhuofei (com.kendy.entity.ClubZhuofei)2 GDInputInfo (com.kendy.entity.GDInputInfo)2 GudongRateInfo (com.kendy.entity.GudongRateInfo)2 KaixiaoInfo (com.kendy.entity.KaixiaoInfo)2 Player (com.kendy.entity.Player)2 Record (com.kendy.entity.Record)2 MoneyService (com.kendy.service.MoneyService)2 TeamProxyService (com.kendy.service.TeamProxyService)2 CollectUtil (com.kendy.util.CollectUtil)2 MapUtil (com.kendy.util.MapUtil)2 NumUtil (com.kendy.util.NumUtil)2