use of com.kendy.entity.TypeValueInfo 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;
}
use of com.kendy.entity.TypeValueInfo 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.entity.TypeValueInfo 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);
}
use of com.kendy.entity.TypeValueInfo in project financial by greatkendy123.
the class TGController method AddTGTeamRateBtnAction.
/**
* 添加托管团队
*/
public void AddTGTeamRateBtnAction(ActionEvent event) {
InputDialog dialog = new InputDialog("添加托管团队", "托管团队", "团队比例");
Optional<Pair<String, String>> result = dialog.getResult();
if (result.isPresent()) {
try {
Pair<String, String> map = result.get();
String teamId = map.getKey().trim();
String teamRate = map.getValue().trim();
// 是否重复
List<TypeValueInfo> tableTGTeams = getTableTGTeams();
boolean repeatTeamId = tableTGTeams.stream().anyMatch(info -> teamId.equals(info.getType()));
if (repeatTeamId) {
ShowUtil.show(teamId + "团队已经存在!");
return;
}
if (!teamRate.endsWith("%")) {
ShowUtil.show("比例必须包含百分比符号%");
return;
}
// 添加
tableTGTeams.add(new TypeValueInfo(teamId, teamRate));
String teamsJson = JSON.toJSONString(tableTGTeams);
DBUtil.saveOrUpdateOthers(TG_TEAM_RATE_DB_KEY, teamsJson);
// 刷新当前表(战绩) TODO
refreshTableTGTeam();
} catch (Exception e) {
e.printStackTrace();
}
}
}
use of com.kendy.entity.TypeValueInfo in project financial by greatkendy123.
the class TGController method delTGTeamRateBtnAction.
/**
* 删除托管团队比例
*/
public void delTGTeamRateBtnAction(ActionEvent event) {
TypeValueInfo selectedItem = tableTGTeamRate.getSelectionModel().getSelectedItem();
if (selectedItem == null) {
ShowUtil.show("请先选择记录!");
return;
}
tableTGTeamRate.getItems().remove(selectedItem);
ObservableList<TypeValueInfo> items = tableTGTeamRate.getItems();
String teamsJson = JSON.toJSONString(items);
DBUtil.saveOrUpdateOthers(TG_TEAM_RATE_DB_KEY, teamsJson);
// 刷新当前表(战绩) TODO
refreshTableTGTeam();
}
Aggregations