Search in sources :

Example 1 with TGCompanyModel

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

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

the class TgWaizhaiService method getTGTeamId.

/**
 * 获取托管团队ID
 *
 * @time 2018年3月8日
 * @return
 */
public static Set<String> getTGTeamId() {
    Set<String> tgTeamSet = new HashSet<>();
    try {
        TGController tgController = MyController.tgController;
        TGCompanyModel currentCompany = DBUtil.get_tg_company_by_id(tgController.getCurrentTGCompany());
        String tgTeamsStr = currentCompany.getTgTeamsStr();
        if (StringUtil.isNotBlank(tgTeamsStr)) {
            tgTeamSet = Stream.of(tgTeamsStr.split("#")).collect(Collectors.toSet());
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    log.info("托管团队:" + tgTeamSet);
    return tgTeamSet;
}
Also used : TGController(com.kendy.controller.TGController) TGCompanyModel(com.kendy.entity.TGCompanyModel) HashSet(java.util.HashSet)

Example 3 with TGCompanyModel

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

the class TGController method setTGCompanyInfo.

/**
 * 设置公司的托管押金、额度。其他?
 * @time 2018年3月11日
 * @param teamId
 */
private void setTGCompanyInfo(String tgCompany) {
    TGCompanyModel tgCompanyModel = DBUtil.get_tg_company_by_id(tgCompany);
    if (tgCompanyModel == null) {
        return;
    }
    // 设置
    tgCompanyYajin.setText(tgCompanyModel.getYajin());
    tgCompanyEdu.setText(tgCompanyModel.getEdu());
    tgYifenhong.setText(tgCompanyModel.getYifenhong());
// 其他更新
}
Also used : TGCompanyModel(com.kendy.entity.TGCompanyModel)

Example 4 with TGCompanyModel

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

the class TGAddCompanyController method addNewTGCompanyOKBtnAction.

/**
 * 按钮:确认添加新托管公司
 *
 * @time 2018年3月3日
 * @param event
 */
public void addNewTGCompanyOKBtnAction(ActionEvent event) {
    // 检验参数
    if (hasAnyParamBlank()) {
        ShowUtil.show("Sorry, 提交信息不完整,请查看!");
        return;
    }
    // 传递给主控制类处理逻辑 TODO
    // 保存到数据库由主控制类去刷新全部
    TGCompanyModel tgCompanyModel = getSubmitData();
    DBUtil.saveOrUpdate_tg_company(tgCompanyModel);
    ShowUtil.show("添加成功", 1);
    TGController tgController = MyController.tgController;
    tgController.loadDataLastest();
// ObservableList<Node> companyList = tgController.TG_Company_VBox.getChildren();
// if(CollectUtil.isHaveValue(companyList)) {
// companyList.add(new Button(tgCompanyModel.getTgCompanyName()));
// }
}
Also used : TGCompanyModel(com.kendy.entity.TGCompanyModel)

Example 5 with TGCompanyModel

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

the class TGAddCompanyController method getSubmitData.

/**
 * 获取待提交的数据
 * @time 2018年3月3日
 * @return
 */
private TGCompanyModel getSubmitData() {
    TGCompanyModel tgCompnayModel = new TGCompanyModel(tg_company_field.getText().trim(), companyRateField.getText(), tgCompanyRateField.getText(), yajin.getText(), edu.getText(), "", MyController.currentClubId.getText(), "0");
    tgCompnayModel.setBeizhu(gudongChoice.getSelectionModel().getSelectedItem());
    ObservableList<String> items = tg_team_view.getItems();
    if (CollectUtil.isHaveValue(items)) {
        tgCompnayModel.setTgTeamsStr(items.stream().collect(Collectors.joining("#")));
        tgCompnayModel.setTgTeamList(items.stream().collect(Collectors.toList()));
    }
    return tgCompnayModel;
}
Also used : TGCompanyModel(com.kendy.entity.TGCompanyModel)

Aggregations

TGCompanyModel (com.kendy.entity.TGCompanyModel)11 ArrayList (java.util.ArrayList)4 ResultSet (java.sql.ResultSet)3 SQLException (java.sql.SQLException)3 MyController (application.MyController)2 TGController (com.kendy.controller.TGController)2 DBUtil (com.kendy.db.DBUtil)2 ProxyTeamInfo (com.kendy.entity.ProxyTeamInfo)2 TGFwfinfo (com.kendy.entity.TGFwfinfo)2 TGTeamInfo (com.kendy.entity.TGTeamInfo)2 TGTeamModel (com.kendy.entity.TGTeamModel)2 TypeValueInfo (com.kendy.entity.TypeValueInfo)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 HashSet (java.util.HashSet)2 List (java.util.List)2 Map (java.util.Map)2 Node (javafx.scene.Node)2