Search in sources :

Example 1 with GDInputInfo

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

Example 2 with GDInputInfo

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();
}
Also used : GDInputInfo(com.kendy.entity.GDInputInfo) Map(java.util.Map) HashMap(java.util.HashMap)

Example 3 with GDInputInfo

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);
    });
}
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 4 with GDInputInfo

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();
}
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

GDInputInfo (com.kendy.entity.GDInputInfo)4 HashMap (java.util.HashMap)3 Map (java.util.Map)3 DataConstans (application.DataConstans)2 Main (application.Main)2 MyController (application.MyController)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 CurrentMoneyInfo (com.kendy.entity.CurrentMoneyInfo)2 GDDetailInfo (com.kendy.entity.GDDetailInfo)2 GudongRateInfo (com.kendy.entity.GudongRateInfo)2 KaixiaoInfo (com.kendy.entity.KaixiaoInfo)2 Player (com.kendy.entity.Player)2 ProfitInfo (com.kendy.entity.ProfitInfo)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