use of com.kendy.controller.TGController 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);
}
use of com.kendy.controller.TGController 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;
}
use of com.kendy.controller.TGController 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;
}
Aggregations