Search in sources :

Example 1 with TGTeamModel

use of com.kendy.entity.TGTeamModel 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 2 with TGTeamModel

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

the class TGController method saveTGTeamAction.

/**
 * 保存托管团的各个比例
 * @time 2018年3月11日
 */
public void saveTGTeamAction() {
    String tgTeamId = currentTGTeamLabel.getText();
    if (StringUtil.isBlank(tgTeamId)) {
        ShowUtil.show("请先选择托管团队!");
        return;
    }
    // 托管团队回水比例
    String teamHSRate = StringUtil.nvl(tgTeamHSRate.getText(), "0%");
    // 托管团队回保比例
    String teamHBRate = StringUtil.nvl(tgTeamHBRate.getText(), "0%");
    // 托管团队服务费
    String teamFWFRate = StringUtil.nvl(tgTeamFwfRate.getText(), "0%");
    // 托管团队是否代理 并 保存
    TGTeamModel team = new TGTeamModel(tgTeamId, teamHSRate, teamHBRate, teamFWFRate, getTeamProxyChecked());
    DBUtil.saveOrUpdate_tg_team(team);
    ShowUtil.show("保存成功", 2);
}
Also used : TGTeamModel(com.kendy.entity.TGTeamModel)

Example 3 with TGTeamModel

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

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

the class TGController method getTgTeamFwfRate.

/**
 * 获取团队的服务费比例
 * @param teamId
 * @return
 */
public double getTgTeamFwfRate(String teamId) {
    List<TGTeamModel> tgTeams = DBUtil.get_all_tg_team();
    if (CollectUtil.isHaveValue(tgTeams)) {
        Optional<TGTeamModel> teamInfoOpt = tgTeams.stream().filter(info -> teamId.equals(info.getTgTeamId())).findFirst();
        if (teamInfoOpt.isPresent()) {
            TGTeamModel teamInfo = teamInfoOpt.get();
            String fwfRate = teamInfo.getTgFwfRate();
            if (StringUtil.isBlank(fwfRate) || "0%".equals(fwfRate)) {
                return 0.0;
            } else {
                // if("1".equals(teamInfo.getTgTeamProxy()))
                return NumUtil.getNumByPercent(fwfRate);
            }
        }
    }
    return 0.0;
}
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) TGTeamModel(com.kendy.entity.TGTeamModel)

Example 5 with TGTeamModel

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

the class DBUtil method get_tg_team_by_id.

public static TGTeamModel get_tg_team_by_id(String teamId) {
    TGTeamModel model = null;
    try {
        con = DBConnection.getConnection();
        String sql = "select * from tg_team where tg_team_id = '" + teamId + "'";
        ps = con.prepareStatement(sql);
        ResultSet rs = ps.executeQuery();
        while (rs.next()) {
            // id,  tg_date,  tg_player_id,  tg_player_name,  tg_type, tg_id,  tg_name,  tg_beizhu
            model = new TGTeamModel(rs.getString(1), rs.getString(2), rs.getString(3), rs.getString(4), rs.getString(5));
        }
    } catch (SQLException e) {
        ErrorUtil.err(teamId + ", 获有团队比例失败", e);
    } finally {
        close(con, ps);
    }
    return model;
}
Also used : SQLException(java.sql.SQLException) TGTeamModel(com.kendy.entity.TGTeamModel) ResultSet(java.sql.ResultSet)

Aggregations

TGTeamModel (com.kendy.entity.TGTeamModel)9 ArrayList (java.util.ArrayList)6 TGTeamInfo (com.kendy.entity.TGTeamInfo)5 Constants (application.Constants)3 DataConstans (application.DataConstans)3 Main (application.Main)3 MyController (application.MyController)3 JSON (com.alibaba.fastjson.JSON)3 TypeReference (com.alibaba.fastjson.TypeReference)3 DBUtil (com.kendy.db.DBUtil)3 Huishui (com.kendy.entity.Huishui)3 ProxyTeamInfo (com.kendy.entity.ProxyTeamInfo)3 TGCommentInfo (com.kendy.entity.TGCommentInfo)3 TGCompanyModel (com.kendy.entity.TGCompanyModel)3 TGFwfinfo (com.kendy.entity.TGFwfinfo)3 TGKaixiaoInfo (com.kendy.entity.TGKaixiaoInfo)3 TGLirunInfo (com.kendy.entity.TGLirunInfo)3 TypeValueInfo (com.kendy.entity.TypeValueInfo)3 Entity (com.kendy.interfaces.Entity)3 TGExportExcelService (com.kendy.service.TGExportExcelService)3