Search in sources :

Example 1 with TGTeamInfo

use of com.kendy.entity.TGTeamInfo in project financial by greatkendy123.

the class TGFwfService method setFwfDetail.

public void setFwfDetail(String tgCompany, TableView<TGFwfinfo> tableTGFwf, TableView<TypeValueInfo> tableTGFwfSum) {
    if (StringUtil.isBlank(tgCompany)) {
        ShowUtil.show("请选择托管公司");
    // return;
    }
    TGController tgController = MyController.tgController;
    List<TGCompanyModel> tgCompanys = DBUtil.get_all_tg_company();
    Set<String> teamSet = new HashSet<>();
    if (CollectUtil.isHaveValue(tgCompanys)) {
        teamSet = tgCompanys.stream().filter(info -> tgCompany.equals(info.getTgCompanyName())).flatMap((TGCompanyModel info) -> Stream.of(info.getTgTeamsStr().split("#"))).collect(Collectors.toSet());
    }
    if (CollectUtil.isNullOrEmpty(teamSet)) {
        ShowUtil.show("没有托管团队!", 2);
        return;
    }
    List<TGTeamInfo> companyProxyTeamInfo = new ArrayList<>();
    for (String teamId : teamSet) {
        // 获取代理查询的团队数据
        final List<ProxyTeamInfo> proxyTeamInfoList = tgController.getProxyTeamInfoList(teamId);
        companyProxyTeamInfo.addAll(convert2TGTeamInfo(proxyTeamInfoList));
    }
    int renci = companyProxyTeamInfo.size();
    if (CollectUtil.isNullOrEmpty(companyProxyTeamInfo)) {
        ShowUtil.show("没有代理数据!", 2);
        return;
    }
    // 转化为托管公司的团队数据
    Map<String, List<TGTeamInfo>> teamProxys = companyProxyTeamInfo.stream().collect(Collectors.groupingBy(TGTeamInfo::getTgTeamId));
    List<TGFwfinfo> tgFwfInfoList = new ArrayList<>();
    teamProxys.forEach((teamID, tgTeamInfoList) -> {
        // 1 战绩2.5%:
        double zjRate25Sum = tgTeamInfoList.stream().mapToDouble(info -> NumUtil.getNum(info.getTgZJ25())).sum();
        // 2 战绩未知
        double zjRateUnknowSum = tgTeamInfoList.stream().mapToDouble(info -> NumUtil.getNum(info.getTgZJUnknow())).sum();
        // 3 保险
        double zjBaoxianSum = tgTeamInfoList.stream().mapToDouble(info -> NumUtil.getNum(info.getTgBaoxian())).sum() * (-0.975);
        // 4 回保
        double zjHuibaoSum = tgTeamInfoList.stream().mapToDouble(info -> NumUtil.getNum(info.getTgHuiBao())).sum();
        // 5 总和
        double zjProfitSum = zjRate25Sum - zjRateUnknowSum + zjBaoxianSum - zjHuibaoSum;
        double huibaoDouble = zjBaoxianSum * tgController.getTgTeamHuibaoRate(teamID);
        double teamFwfRate = tgController.getTgTeamFwfRate(teamID);
        TGFwfinfo fwfInfo = new TGFwfinfo(tgCompany, teamID, // 服务回水 = 战绩2.5% - 战绩未知
        NumUtil.digit2(zjRate25Sum - zjRateUnknowSum + ""), // 服务回保 = 保险 - 回保
        NumUtil.digit2(huibaoDouble + ""), // 单个总利润
        NumUtil.digit2(zjProfitSum + ""), // 服务返水
        NumUtil.digit2(zjRateUnknowSum + ""), // 服务返保
        NumUtil.digit2(zjHuibaoSum + ""), // 服务全水
        NumUtil.digit2(zjRate25Sum + ""), // 服务全保
        NumUtil.digit2(zjBaoxianSum + ""), // 服务合计
        NumUtil.digit2((zjRate25Sum + zjBaoxianSum) * teamFwfRate + ""));
        tgFwfInfoList.add(fwfInfo);
    });
    // 排序
    sort(tgFwfInfoList);
    // 设值
    tableTGFwf.setItems(FXCollections.observableArrayList(tgFwfInfoList));
    // 设总和表
    setTableTGFwfSumData(tableTGFwf, tableTGFwfSum, renci);
}
Also used : Arrays(java.util.Arrays) NumUtil(com.kendy.util.NumUtil) FXCollections(javafx.collections.FXCollections) TypeValueInfo(com.kendy.entity.TypeValueInfo) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) StringUtil(com.kendy.util.StringUtil) Map(java.util.Map) TGTeamModel(com.kendy.entity.TGTeamModel) MyController(application.MyController) TableView(javafx.scene.control.TableView) DBUtil(com.kendy.db.DBUtil) TGFwfinfo(com.kendy.entity.TGFwfinfo) TGTeamInfo(com.kendy.entity.TGTeamInfo) Set(java.util.Set) TGController(com.kendy.controller.TGController) Collectors(java.util.stream.Collectors) TGCompanyModel(com.kendy.entity.TGCompanyModel) List(java.util.List) Stream(java.util.stream.Stream) CollectUtil(com.kendy.util.CollectUtil) ShowUtil(com.kendy.util.ShowUtil) ProxyTeamInfo(com.kendy.entity.ProxyTeamInfo) ObservableList(javafx.collections.ObservableList) Comparator(java.util.Comparator) Collections(java.util.Collections) ProxyTeamInfo(com.kendy.entity.ProxyTeamInfo) TGController(com.kendy.controller.TGController) ArrayList(java.util.ArrayList) TGTeamInfo(com.kendy.entity.TGTeamInfo) TGFwfinfo(com.kendy.entity.TGFwfinfo) TGCompanyModel(com.kendy.entity.TGCompanyModel) ArrayList(java.util.ArrayList) List(java.util.List) ObservableList(javafx.collections.ObservableList) HashSet(java.util.HashSet)

Example 2 with TGTeamInfo

use of com.kendy.entity.TGTeamInfo in project financial by greatkendy123.

the class TGFwfService method convert2TGTeamInfo.

/**
 * 代理查询中的数据转成托管中的团队信息数据
 * @time 2018年3月7日
 * @param teamId
 * @param proxyTeamInfoList
 * @return
 */
private List<TGTeamInfo> convert2TGTeamInfo(List<ProxyTeamInfo> proxyTeamInfoList) {
    List<TGTeamInfo> list = new ArrayList<>();
    TGController tgController = MyController.tgController;
    Map<String, TGTeamModel> tgTeamRateMap = tgController.getTgTeamModelMap();
    if (CollectUtil.isHaveValue(proxyTeamInfoList)) {
        list = proxyTeamInfoList.stream().map(info -> {
            TGTeamInfo tgTeam = new TGTeamInfo();
            tgTeam.setTgPlayerId(info.getProxyPlayerId());
            tgTeam.setTgPlayerName(info.getProxyPlayerName());
            tgTeam.setTgYSZJ(info.getProxyYSZJ());
            tgTeam.setTgBaoxian(info.getProxyBaoxian());
            tgTeam.setTgChangci(info.getProxyTableId());
            // 设置战绩2.5%
            String percent25Str = NumUtil.digit2(Math.abs(NumUtil.getNum(info.getProxyYSZJ())) * 0.025 + "");
            tgTeam.setTgZJ25(percent25Str);
            // 设置战绩未知%
            String teamId = info.getProxyTeamId();
            TGTeamModel tgTeamModel = tgTeamRateMap.get(teamId);
            String teamUnknowValue = tgTeamModel == null ? "0.0" : tgTeamModel.getTgHuishui();
            String teamUnknowStr = NumUtil.digit2(Math.abs(NumUtil.getNumTimes(info.getProxyYSZJ(), teamUnknowValue)) + "");
            tgTeam.setTgZJUnknow(teamUnknowStr);
            // 设置回保
            String teamHuibaoRateValue = tgTeamModel == null ? "0.0" : tgTeamModel.getTgHuiBao();
            String teamHuibaoRateStr = NumUtil.digit2(-0.975 * NumUtil.getNumTimes(tgTeam.getTgBaoxian(), teamHuibaoRateValue) + "");
            if (tgTeam.getTgBaoxian().equals("0")) {
                teamHuibaoRateStr = "0";
            }
            tgTeam.setTgHuiBao(teamHuibaoRateStr);
            // 设置利润
            String profit = tgController.getRecordProfit(tgTeam);
            tgTeam.setTgProfit(profit);
            // 设置团队
            tgTeam.setTgTeamId(teamId);
            return tgTeam;
        }).collect(Collectors.toList());
    }
    return list;
}
Also used : TGController(com.kendy.controller.TGController) ArrayList(java.util.ArrayList) TGTeamModel(com.kendy.entity.TGTeamModel) TGTeamInfo(com.kendy.entity.TGTeamInfo)

Example 3 with TGTeamInfo

use of com.kendy.entity.TGTeamInfo in project financial by greatkendy123.

the class TGController method convert2TGTeamInfo.

/**
 * 代理查询中的数据转成托管中的团队信息数据
 * @time 2018年3月7日
 * @param teamId
 * @param proxyTeamInfoList
 * @return
 */
private List<TGTeamInfo> convert2TGTeamInfo(String teamId, List<ProxyTeamInfo> proxyTeamInfoList) {
    List<TGTeamInfo> list = new ArrayList<>();
    TGController tgController = MyController.tgController;
    Map<String, TGTeamModel> tgTeamRateMap = tgController.getTgTeamModelMap();
    TGTeamModel tgTeamModel = tgTeamRateMap.get(teamId);
    String teamUnknowValue = tgTeamModel == null ? "0%" : tgTeamModel.getTgHuishui();
    String teamHuibaoRateValue = tgTeamModel == null ? "0.0" : tgTeamModel.getTgHuiBao();
    // 更改列名称
    changeColumnName_TeamUnknowRate(teamUnknowValue);
    if (CollectUtil.isHaveValue(proxyTeamInfoList)) {
        list = proxyTeamInfoList.stream().map(info -> {
            TGTeamInfo tgTeam = new TGTeamInfo();
            tgTeam.setTgPlayerId(info.getProxyPlayerId());
            tgTeam.setTgPlayerName(info.getProxyPlayerName());
            tgTeam.setTgYSZJ(info.getProxyYSZJ());
            tgTeam.setTgBaoxian(info.getProxyBaoxian());
            tgTeam.setTgChangci(info.getProxyTableId());
            // 设置战绩2.5%
            String percent25Str = NumUtil.digit2(Math.abs(NumUtil.getNum(info.getProxyYSZJ())) * 0.025 + "");
            tgTeam.setTgZJ25(percent25Str);
            // 设置战绩未知%
            String teamUnknowStr = NumUtil.digit2(Math.abs(NumUtil.getNumTimes(info.getProxyYSZJ(), teamUnknowValue)) + "");
            tgTeam.setTgZJUnknow(teamUnknowStr);
            // 设置回保
            String teamHuibaoRateStr = NumUtil.digit2((-1) * 0.975 * NumUtil.getNumTimes(tgTeam.getTgBaoxian(), teamHuibaoRateValue) + "");
            if (tgTeam.getTgBaoxian().equals("0")) {
                teamHuibaoRateStr = "0";
            }
            tgTeam.setTgHuiBao(teamHuibaoRateStr);
            // 设置利润
            String profit = getRecordProfit(tgTeam);
            tgTeam.setTgProfit(profit);
            return tgTeam;
        }).collect(Collectors.toList());
    }
    return list;
}
Also used : ArrayList(java.util.ArrayList) TGTeamModel(com.kendy.entity.TGTeamModel) TGTeamInfo(com.kendy.entity.TGTeamInfo)

Example 4 with TGTeamInfo

use of com.kendy.entity.TGTeamInfo in project financial by greatkendy123.

the class TGController method refreshTableTGTeamSum.

/**
 * 刷新托管团队总和数据(合计)
 */
public void refreshTableTGTeamSum() {
    ObservableList<TGTeamInfo> items = tableTGZhanji.getItems();
    // 1 战绩2.5%:
    double zjRate25Sum = items.stream().mapToDouble(info -> NumUtil.getNum(info.getTgZJ25())).sum();
    // 2 战绩未知
    String columnName = tableTGZhanji.getColumns().get(5).getText();
    double zjRateUnknowSum = tableTGZhanji.getItems().stream().mapToDouble(info -> NumUtil.getNum(info.getTgZJUnknow())).sum();
    // 3 保险
    double zjBaoxianSum = items.stream().mapToDouble(info -> NumUtil.getNum(info.getTgBaoxian())).sum() * (-0.975);
    // 4 回保
    double zjHuibaoSum = items.stream().mapToDouble(info -> NumUtil.getNum(info.getTgHuiBao())).sum();
    // 5 总和
    double zjProfitSum = zjRate25Sum - zjRateUnknowSum + zjBaoxianSum - zjHuibaoSum;
    // 6 总人次
    int size = 0;
    if (items != null) {
        size = items.size();
    }
    List<TypeValueInfo> list = new ArrayList<TypeValueInfo>();
    list.add(new TypeValueInfo("战绩2.5%合计", NumUtil.digit2(zjRate25Sum + "")));
    list.add(new TypeValueInfo(columnName + "合计", NumUtil.digit2(zjRateUnknowSum + "")));
    list.add(new TypeValueInfo("保险合计", NumUtil.digit2(zjBaoxianSum + "")));
    list.add(new TypeValueInfo("回保合计", NumUtil.digit2(zjHuibaoSum + "")));
    list.add(new TypeValueInfo("总利润合计", NumUtil.digit2(zjProfitSum + "")));
    list.add(new TypeValueInfo("总人次", size + ""));
    ObservableList<TypeValueInfo> obList = FXCollections.observableArrayList(list);
    tableZJSum.setItems(obList);
}
Also used : EventHandler(javafx.event.EventHandler) Button(javafx.scene.control.Button) Initializable(javafx.fxml.Initializable) Constants(application.Constants) NumUtil(com.kendy.util.NumUtil) URL(java.net.URL) InputDialog(com.kendy.util.InputDialog) Random(java.util.Random) VBox(javafx.scene.layout.VBox) Huishui(com.kendy.entity.Huishui) Logger(org.apache.log4j.Logger) Parent(javafx.scene.Parent) TabPane(javafx.scene.control.TabPane) AlertType(javafx.scene.control.Alert.AlertType) StringUtil(com.kendy.util.StringUtil) Map(java.util.Map) TGTeamModel(com.kendy.entity.TGTeamModel) WindowEvent(javafx.stage.WindowEvent) MyController(application.MyController) TableView(javafx.scene.control.TableView) Alert(javafx.scene.control.Alert) HBox(javafx.scene.layout.HBox) TextField(javafx.scene.control.TextField) Pair(javafx.util.Pair) PropertyValueFactory(javafx.scene.control.cell.PropertyValueFactory) Set(java.util.Set) Collectors(java.util.stream.Collectors) TgWaizhaiService(com.kendy.service.TgWaizhaiService) TGCompanyModel(com.kendy.entity.TGCompanyModel) FXML(javafx.fxml.FXML) List(java.util.List) TypeReference(com.alibaba.fastjson.TypeReference) CollectUtil(com.kendy.util.CollectUtil) ShowUtil(com.kendy.util.ShowUtil) TGKaixiaoInfo(com.kendy.entity.TGKaixiaoInfo) ProxyTeamInfo(com.kendy.entity.ProxyTeamInfo) Optional(java.util.Optional) ObservableList(javafx.collections.ObservableList) Scene(javafx.scene.Scene) TGCommentInfo(com.kendy.entity.TGCommentInfo) TGExportExcelService(com.kendy.service.TGExportExcelService) ListView(javafx.scene.control.ListView) ButtonType(javafx.scene.control.ButtonType) FXCollections(javafx.collections.FXCollections) HashMap(java.util.HashMap) TGFwfService(com.kendy.service.TGFwfService) TypeValueInfo(com.kendy.entity.TypeValueInfo) Function(java.util.function.Function) ArrayList(java.util.ArrayList) TableColumn(javafx.scene.control.TableColumn) ResourceBundle(java.util.ResourceBundle) FXMLLoader(javafx.fxml.FXMLLoader) TableUtil(com.kendy.util.TableUtil) TGLirunInfo(com.kendy.entity.TGLirunInfo) DataConstans(application.DataConstans) DBUtil(com.kendy.db.DBUtil) TGFwfinfo(com.kendy.entity.TGFwfinfo) Label(javafx.scene.control.Label) TGTeamInfo(com.kendy.entity.TGTeamInfo) Node(javafx.scene.Node) CheckBox(javafx.scene.control.CheckBox) TeamProxyService(com.kendy.service.TeamProxyService) Main(application.Main) ActionEvent(javafx.event.ActionEvent) JSON(com.alibaba.fastjson.JSON) Stage(javafx.stage.Stage) ObservableValue(javafx.beans.value.ObservableValue) ChangeListener(javafx.beans.value.ChangeListener) Entity(com.kendy.interfaces.Entity) TypeValueInfo(com.kendy.entity.TypeValueInfo) ArrayList(java.util.ArrayList) TGTeamInfo(com.kendy.entity.TGTeamInfo)

Example 5 with TGTeamInfo

use of com.kendy.entity.TGTeamInfo in project financial by greatkendy123.

the class TGController method initialize.

/**
 * DOM加载完后的事件
 */
@SuppressWarnings("unchecked")
@Override
public void initialize(URL location, ResourceBundle resources) {
    // 绑定列值属性
    MyController.bindCellValue(tgKaixiaoDate, tgKaixiaoPlayerName, tgKaixiaoPayItem, tgKaixiaoMoney, tgKaixiaoCompany);
    MyController.bindCellValue(tgCommentDate, tgCommentPlayerId, tgCommentPlayerName, tgCommentType, tgCommentId, tgCommentName, tgCommentBeizhu, tgCommentCompany);
    MyController.bindCellValue(tgFwfCompany, tgFwfTeamId, tgFwfHuishui, tgFwfHuiBao, tgFwfProfit, tgFwfFanshui, tgFwfFanbao, tgFwfQuanshui, tgFwfQuanbao, tgFwfHeji);
    MyController.bindCellValue(tgLirunDate, tgLirunTotalProfit, tgLirunTotalKaixiao, tgLirunATMCompany, tgLirunTGCompany, tgLirunTeamProfit, tgLirunRestHeji, tgLirunHeji, tgLirunCompanyName);
    binCellValueDiff(tgTeamId, "type");
    binCellValueDiff(tgTeamRate, "value");
    binCellValueDiff(tgZJSumType, "type");
    binCellValueDiff(tgZJSumValue, "value");
    binCellValueDiff(tgWZTeamId, "type");
    binCellValueDiff(tgWZTeamValue, "value");
    binCellValueDiff(tgFwfType, "type");
    binCellValueDiff(tgFwfValue, "value");
    MyController.bindCellValue(tgPlayerId, tgPlayerName, tgYSZJ, tgZJ25, tgZJUnknow, tgProfit, tgHuiBao, tgBaoxian, tgChangci);
    bindColorColumns(new TGTeamInfo(), tgYSZJ, tgZJ25, tgZJUnknow, tgProfit, tgHuiBao, tgBaoxian);
    bindColorColumns(new TGFwfinfo(), tgFwfHuishui, tgFwfHuiBao, tgFwfProfit, tgFwfFanshui, tgFwfFanbao, tgFwfQuanshui, tgFwfQuanbao, tgFwfHeji);
    bindColorColumns(new TGLirunInfo(), tgLirunTotalProfit, tgLirunTotalKaixiao, tgLirunATMCompany, tgLirunTGCompany, tgLirunTeamProfit, tgLirunRestHeji, tgLirunHeji);
    // tabs切换事件
    tabsAction();
    // 加载托管团队比例数据
    refreshTableTGTeam();
    // 加载托管公司数据
    loadDataLastest();
// 点击代理CheckBox时的事件
// initTeamProxyAction();
}
Also used : TGTeamInfo(com.kendy.entity.TGTeamInfo) TGLirunInfo(com.kendy.entity.TGLirunInfo) TGFwfinfo(com.kendy.entity.TGFwfinfo)

Aggregations

TGTeamInfo (com.kendy.entity.TGTeamInfo)7 TGTeamModel (com.kendy.entity.TGTeamModel)4 ArrayList (java.util.ArrayList)4 ProxyTeamInfo (com.kendy.entity.ProxyTeamInfo)3 TGFwfinfo (com.kendy.entity.TGFwfinfo)3 TypeValueInfo (com.kendy.entity.TypeValueInfo)3 MyController (application.MyController)2 TGController (com.kendy.controller.TGController)2 DBUtil (com.kendy.db.DBUtil)2 TGCompanyModel (com.kendy.entity.TGCompanyModel)2 TGLirunInfo (com.kendy.entity.TGLirunInfo)2 CollectUtil (com.kendy.util.CollectUtil)2 NumUtil (com.kendy.util.NumUtil)2 ShowUtil (com.kendy.util.ShowUtil)2 StringUtil (com.kendy.util.StringUtil)2 List (java.util.List)2 Map (java.util.Map)2 Set (java.util.Set)2 Collectors (java.util.stream.Collectors)2 FXCollections (javafx.collections.FXCollections)2