Search in sources :

Example 1 with TGFwfinfo

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

the class TGExportExcelService method getFwfExcelModel.

/**
 * 导出服务费明细
 * @return
 */
private TGExcelModel getFwfExcelModel() {
    TGExcelModel excelModel = new TGExcelModel();
    List<String> titleList = new LinkedList<>();
    List<Object[]> data = new LinkedList<>();
    List<String> titleSumList = new LinkedList<>();
    List<Object[]> dataSum = new LinkedList<>();
    titleList = new LinkedList<>(Arrays.asList("托管公司", "托管团队", "回水", "回保", "总利润合计", "返水", "返保", "全水", "全保", "合计"));
    ObservableList<TGFwfinfo> items = tgController.tableTGFwf.getItems();
    if (CollectUtil.isHaveValue(items)) {
        data = items.stream().map(info -> {
            Object[] obj = new Object[10];
            obj[0] = info.getTgFwfCompany();
            obj[1] = info.getTgFwfTeamId();
            obj[2] = info.getTgFwfHuishui();
            obj[3] = info.getTgFwfHuiBao();
            obj[4] = info.getTgFwfProfit();
            obj[5] = info.getTgFwfFanshui();
            obj[6] = info.getTgFwfFanbao();
            obj[7] = info.getTgFwfQuanshui();
            obj[8] = info.getTgFwfQuanbao();
            obj[9] = info.getTgFwfHeji();
            return obj;
        }).collect(Collectors.toList());
    }
    ObservableList<TypeValueInfo> sumItems = tgController.tableTGFwfSum.getItems();
    if (CollectUtil.isHaveValue(sumItems)) {
        dataSum = sumItems.stream().map(info -> {
            Object[] obj = new Object[2];
            obj[0] = info.getType();
            obj[1] = info.getValue();
            return obj;
        }).collect(Collectors.toList());
    }
    excelModel.setColumnList(titleList);
    excelModel.setData(data);
    excelModel.setColumnSumList(titleSumList);
    excelModel.setDataSum(dataSum);
    excelModel.setSheetName("服务费");
    return excelModel;
}
Also used : TypeValueInfo(com.kendy.entity.TypeValueInfo) TGExcelModel(com.kendy.entity.TGExcelModel) TGFwfinfo(com.kendy.entity.TGFwfinfo) LinkedList(java.util.LinkedList)

Example 2 with TGFwfinfo

use of com.kendy.entity.TGFwfinfo 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 3 with TGFwfinfo

use of com.kendy.entity.TGFwfinfo 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

TGFwfinfo (com.kendy.entity.TGFwfinfo)3 TGTeamInfo (com.kendy.entity.TGTeamInfo)2 TypeValueInfo (com.kendy.entity.TypeValueInfo)2 MyController (application.MyController)1 TGController (com.kendy.controller.TGController)1 DBUtil (com.kendy.db.DBUtil)1 ProxyTeamInfo (com.kendy.entity.ProxyTeamInfo)1 TGCompanyModel (com.kendy.entity.TGCompanyModel)1 TGExcelModel (com.kendy.entity.TGExcelModel)1 TGLirunInfo (com.kendy.entity.TGLirunInfo)1 TGTeamModel (com.kendy.entity.TGTeamModel)1 CollectUtil (com.kendy.util.CollectUtil)1 NumUtil (com.kendy.util.NumUtil)1 ShowUtil (com.kendy.util.ShowUtil)1 StringUtil (com.kendy.util.StringUtil)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collections (java.util.Collections)1 Comparator (java.util.Comparator)1 HashSet (java.util.HashSet)1