use of com.kendy.entity.Huishui in project financial by greatkendy123.
the class ShangmaService method setTeamAvailabe.
/**
* 设置打勾:团队可上码
* @time 2018年3月26日
* @param teamId
*/
public static void setTeamAvailabe(String teamId) {
Huishui huishui = DataConstans.huishuiMap.get(teamId);
String teamAvailabel = huishui.getTeamAvailabel();
if (StringUtil.isBlank(teamAvailabel) || "0".equals(teamAvailabel)) {
smTeamShangmaCheckBox.setSelected(false);
} else {
smTeamShangmaCheckBox.setSelected(true);
}
}
use of com.kendy.entity.Huishui in project financial by greatkendy123.
the class ShangmaService method getDataAfterloadShangmaTable.
/**
********************************************************************************************************
*
* 自动上码部分
*
*********************************************************************************************************
*/
/**
* 获取加载上码主表后的数据
*
* @param teamId
* @param tableShangma
*/
public static SMResultModel getDataAfterloadShangmaTable(String teamId, String playerID) {
SMResultModel resultModel = new SMResultModel();
double teamSumYiSM, teamSumZJ;
try {
ObservableList<ShangmaInfo> obList = FXCollections.observableArrayList();
List<String> wanjiaIdList = teamIdAndPlayerIdMap.get(teamId);
String playerName, edu, yicunJifen, sumAvailableEdu, sumYiSM, sumZJ;
teamSumYiSM = 0d;
teamSumZJ = 0d;
if (wanjiaIdList != null) {
// if(cmiMap == null)
// 加载cmiMap估计
refresh_cmiMap_if_null();
ShangmaInfo smInfo;
for (String playerId : wanjiaIdList) {
// 根据玩家ID找名称和额度和已存积分
CurrentMoneyInfo cmiInfo = cmiMap.get(playerId);
if (cmiInfo == null) {
Player player = DataConstans.membersMap.get(playerId);
if (player == null) {
int a = 0;
}
playerName = player.getPlayerName();
edu = player.getEdu();
// 最关键的区别
yicunJifen = "";
} else {
playerName = cmiInfo.getMingzi();
edu = cmiInfo.getCmiEdu();
// 实时金额就是已存积分
yicunJifen = cmiInfo.getShishiJine();
}
// 根据玩家ID找个人详情
Double[] sumArr = getSumDetail(playerId, edu, yicunJifen);
sumAvailableEdu = MoneyService.digit0(sumArr[0]);
sumYiSM = MoneyService.digit0(sumArr[1]);
sumZJ = MoneyService.digit0(sumArr[2]);
// 组装实体
smInfo = new ShangmaInfo(playerName, edu, sumAvailableEdu, sumYiSM, sumZJ, playerId, yicunJifen, "");
obList.add(smInfo);
// 设置团队总和
teamSumYiSM += sumArr[1];
teamSumZJ += sumArr[2];
}
}
// 重新加载合并ID进去
LinkedList<ShangmaInfo> combineSMDataList = getCombineSMDataList(obList);
resultModel.setSmList(combineSMDataList);
resultModel.setPlayerId(playerID);
resultModel.setTeamId(teamId);
setSelectedSMInfo(resultModel, playerID, combineSMDataList);
// 赋新值
// 获取团队信息
Huishui hs = DataConstans.huishuiMap.get(teamId);
if (hs != null) {
String _teamYajin = hs.getTeamYajin();
String _teamEdu = hs.getTeamEdu();
// 计算团队可上码
// 计算公式: 团队可上码= 押金 + 额度 + 团队战绩 - 团队已上码
Double teamSMAvailable = NumUtil.getNum(NumUtil.getSum(_teamYajin, _teamEdu, MoneyService.digit0(teamSumZJ))) - NumUtil.getNum(MoneyService.digit0(teamSumYiSM));
resultModel.setTeamTotalAvailabel(teamSMAvailable.intValue() + "");
}
} catch (Exception e1) {
ErrorUtil.err("自动上码:加载上码主表失败", e1);
}
return resultModel;
}
use of com.kendy.entity.Huishui in project financial by greatkendy123.
the class TeamProxyService method getTeamFWF_GD.
/**
* 股东贡献值用到(根据团队ID获取团队服务费)
*
* @time 2018年1月20日
* @param teamId
* @param list
* @return
*/
public static String getTeamFWF_GD(String teamId, List<Record> list) {
if (StringUtil.isBlank(teamId))
return "0";
Huishui hs = DataConstans.huishuiMap.get(teamId);
if (hs == null) {
ErrorUtil.err(String.format("根据团队ID%s获取团队服务费出错!", teamId));
hs = new Huishui();
}
// 加载数据{teamId={}}
double sumHS = 0d;
double sumHB = 0d;
for (Record info : list) {
String yszj = info.getScore();
String chuHuishui = NumUtil.digit1(MoneyService.getChuhuishui(yszj, teamId));
String baohui = NumUtil.digit1(MoneyService.getHuiBao(info.getInsuranceEach(), teamId));
sumHS += (MoneyService.getNum(chuHuishui)) * (-1);
sumHB += MoneyService.getNum(baohui);
}
double HSRate = getNumByPercent(hs.getProxyHSRate());
double HBRate = getNumByPercent(hs.getProxyHBRate());
// 服务费有效值
double FWFValid = NumUtil.getNum(hs.getProxyFWF());
// 计算服务费
double proxyFWFVal = calculateProxSumFWF(sumHS, HSRate, sumHB, HBRate, FWFValid);
return NumUtil.digit0(proxyFWFVal);
}
use of com.kendy.entity.Huishui in project financial by greatkendy123.
the class WaizhaiService method get_SSJE_Gudong_Map.
/**
* 获取每个股东的实时金额
* 包括个人和存在于左边的团队
* @time 2017年12月27日
* @param tableCurrentMoneyInfo
* @param tableTeam
* @return
*/
public static Map<String, List<CurrentMoneyInfo>> get_SSJE_Gudong_Map(TableView<CurrentMoneyInfo> tableCurrentMoneyInfo, TableView<TeamInfo> tableTeam) {
int pageIndex = DataConstans.Index_Table_Id_Map.size();
if (pageIndex < 0) {
return new HashMap<>();
}
// 获取实时金额数据
Map<String, String> map = DataConstans.All_Locked_Data_Map.get(pageIndex + "");
List<CurrentMoneyInfo> CurrentMoneyInfoList = null;
List<TeamInfo> teamInfoList = null;
// 情况1:从最新的表中获取数据
if (tableTeam != null && tableTeam.getItems() != null) {
CurrentMoneyInfoList = new ArrayList<>();
for (CurrentMoneyInfo infos : tableCurrentMoneyInfo.getItems()) {
CurrentMoneyInfoList.add(infos);
}
teamInfoList = new ArrayList<>();
for (TeamInfo infos : tableTeam.getItems()) {
teamInfoList.add(infos);
}
} else // 情况2:从最新的锁定表中获取数据
{
CurrentMoneyInfoList = JSON.parseObject(MoneyService.getJsonString(map, "实时金额"), new TypeReference<List<CurrentMoneyInfo>>() {
});
teamInfoList = JSON.parseObject(MoneyService.getJsonString(map, "团队回水"), new TypeReference<List<TeamInfo>>() {
});
}
List<CurrentMoneyInfo> SSJE_obList = new LinkedList<>();
for (CurrentMoneyInfo infos : CurrentMoneyInfoList) {
if (!StringUtil.isBlank(infos.getWanjiaId()) && !StringUtil.isBlank(infos.getMingzi())) {
SSJE_obList.add(infos);
}
}
// 获取每个股东的实时金额数据
List<String> gudongList = DataConstans.gudongList;
int gudongSize = gudongList.size();
List<CurrentMoneyInfo> eachGudongList = null;
Map<String, List<CurrentMoneyInfo>> gudongMap = new HashMap<>();
String playerId;
Player player;
// 步骤1:添加玩家
for (CurrentMoneyInfo infos : SSJE_obList) {
boolean isSuperId = DataConstans.Combine_Super_Id_Map.containsKey(infos.getWanjiaId());
if (!isSuperId) {
// 为解决联合ID的问题,在这里把父节点信息加了进来,后面会把父节点的联合额度为0或空的清除掉,问题:能否在此处就过滤过??
if (StringUtil.isBlank(infos.getShishiJine()) || "0".equals(infos.getShishiJine()) || !infos.getShishiJine().contains("-")) {
continue;
}
}
// if(StringUtil.isBlank(infos.getShishiJine())
// || "0".equals(infos.getShishiJine())
// || !infos.getShishiJine().contains("-")) {
// continue;
// }
playerId = infos.getWanjiaId();
if (!StringUtil.isBlank(playerId)) {
player = DataConstans.membersMap.get(playerId);
if (player == null) {
ShowUtil.show("名单列表中匹配不到该玩家!玩家名称:" + infos.getMingzi() + " ID是" + infos.getWanjiaId());
continue;
}
if (gudongList.contains(player.getGudong())) {
for (String gudong : gudongList) {
if (gudong.equals(player.getGudong())) {
if (gudongMap.get(gudong) == null) {
eachGudongList = new ArrayList<>();
// eachGudongList.add(infos);
} else {
eachGudongList = gudongMap.get(gudong);
// eachGudongList.add(infos);
}
/**
***2018-01-01 add***
*/
CurrentMoneyInfo tempInfo = copyCurrentMoneyInfo(infos);
eachGudongList.add(tempInfo);
/**
******
*/
gudongMap.put(gudong, eachGudongList);
break;
}
}
} else {
ShowUtil.show("玩家的股东不存在于股东表中!玩家名称:" + infos.getMingzi() + " ID是" + infos.getWanjiaId());
break;
}
} else {
ShowUtil.show("玩家ID为空!玩家名称:" + infos.getMingzi() + " ID是" + infos.getWanjiaId());
}
}
// 步骤2:处理个人外债和有联合额度的外债
Map<String, CurrentMoneyInfo> ssje_map = get_SSJE_Map(SSJE_obList);
handlePersonWaizhai(gudongMap, ssje_map);
System.out.println("===============================================以上外债信息为:处理个人外债和有联合额度的外债finishes");
// 步骤3:添加团队
for (TeamInfo infos : teamInfoList) {
String teamId = infos.getTeamID();
Huishui hsInfo = DataConstans.huishuiMap.get(teamId);
if (hsInfo == null) {
ErrorUtil.err("外债信息:添加负数团队时检测到缓存中没有该团队信息,团队ID:" + teamId);
continue;
}
String isManaged = hsInfo.getZjManaged();
String gudong = hsInfo.getGudong();
String hasJiesuan = infos.getHasJiesuaned();
String zhanji = infos.getTeamZJ();
if (// 战绩非管理的团队
!"是".equals(isManaged) && // 未结算的团队
!"1".equals(hasJiesuan) && zhanji.contains("-")) {
// 战绩为负数的团队
CurrentMoneyInfo cmi = new CurrentMoneyInfo();
cmi.setMingzi("团队" + teamId);
cmi.setShishiJine(infos.getTeamZJ());
if (gudongMap.get(gudong) == null) {
eachGudongList = new ArrayList<>();
eachGudongList.add(cmi);
} else {
eachGudongList = gudongMap.get(gudong);
eachGudongList.add(cmi);
}
gudongMap.put(gudong, eachGudongList);
}
}
/*
* A、负数个人(若其父节点的联合额度为正则不显示 )
* B、公司(不显示团队;若其父节点的联合额度为正则不显示,否则不显示子ID,只显示联合额度;其他节点不变
* C、非公司团队(全部累加到相应团队;若其父节点的联合额度为正则只累加联合额度;其他节点累加实时金额)
*/
if (MapUtil.isHavaValue(gudongMap)) {
// LMController.allClubMap.keySet().forEach(clubID -> log.info(LMController.allClubMap.keySet()));
Iterator<Map.Entry<String, List<CurrentMoneyInfo>>> it = gudongMap.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, List<CurrentMoneyInfo>> entry = it.next();
String gudongName = entry.getKey();
// if(!"B".equals(gudongName)) continue;//只测试股东B
List<CurrentMoneyInfo> eachList = entry.getValue();
// 深层复制
List<CurrentMoneyInfo> tempEachList = copyListCurrentMoneyInfo(eachList);
List<CurrentMoneyInfo> tempSuperList = new ArrayList<>();
// 过滤掉没有负数团队的股东,过滤掉没有联合ID的股东
if (CollectUtil.isNullOrEmpty(eachList))
continue;
// if(eachList.stream().filter(cmi->cmi.getMingzi().startsWith("团队")).count() == 0) continue;
if (eachList.stream().filter(cmi -> DataConstans.Combine_Super_Id_Map.containsKey(cmi.getWanjiaId())).count() == 0)
continue;
// 处理包含有负数团队的股东(既有联合ID,又有负数团队)
ListIterator<CurrentMoneyInfo> ite = eachList.listIterator();
while (ite.hasNext()) {
CurrentMoneyInfo cmi = ite.next();
String pId = cmi.getWanjiaId();
// TODO 对下面的特殊情况进行分析
if (pId == null && cmi.getMingzi() != null && cmi.getMingzi().startsWith("团队")) {
continue;
}
boolean isSuperId = DataConstans.Combine_Super_Id_Map.containsKey(pId);
// 1528833636
Player _player = DataConstans.membersMap.get(pId);
// 如ST,公司
String teamID = _player.getTeamName();
// 将联合ID的金额设置到对应的团队里
if (isSuperId) {
String playerName = DataConstans.membersMap.get(pId).getPlayerName();
if ("公司".equals(teamID)) {
final String _cmSuperIdSum = cmi.getCmSuperIdSum();
cmi.setShishiJine(_cmSuperIdSum);
log.info(String.format("外债:股东%s--属于公司的父节点%s(%s)设置联合额度%s为实时金额", gudongName, playerName, pId, _cmSuperIdSum));
continue;
}
final String _teamId = "团队" + DataConstans.membersMap.get(pId).getTeamName();
Optional<CurrentMoneyInfo> teamInfoOpt = eachList.stream().filter(info -> info.getMingzi().equals(_teamId)).findFirst();
if (teamInfoOpt.isPresent()) {
CurrentMoneyInfo teamInfo = teamInfoOpt.get();
teamInfo.setShishiJine(NumUtil.getSum(teamInfo.getShishiJine(), cmi.getShishiJine()));
ite.remove();
log.info(String.format("外债:股东%s--有联合ID的父节点%s(%s)将%s转移到%s,并删除父节点", gudongName, playerName, pId, cmi.getShishiJine(), teamInfo.getMingzi()));
} else {
// 新增一个所属团队信息
ite.remove();
CurrentMoneyInfo cmiInfo = new CurrentMoneyInfo(_teamId, cmi.getCmSuperIdSum(), "", "");
ite.add(cmiInfo);
log.info(String.format("外债:股东%s--根据父点(%s)新建团队外债信息(%s),联合额度(团队的实时金额)为%s,并删除父节点", gudongName, playerName, _teamId, cmi.getCmSuperIdSum()));
}
} else // 非公司团队,非父节点,累加进其所属的团队中
if (!"公司".equals(teamID)) {
String playerName = DataConstans.membersMap.get(pId).getPlayerName();
final String _teamId = "团队" + DataConstans.membersMap.get(pId).getTeamName();
Optional<CurrentMoneyInfo> teamInfoOpt = eachList.stream().filter(info -> info.getMingzi().equals(_teamId)).findFirst();
if (teamInfoOpt.isPresent()) {
CurrentMoneyInfo teamInfo = teamInfoOpt.get();
teamInfo.setShishiJine(NumUtil.getSum(teamInfo.getShishiJine(), cmi.getShishiJine()));
ite.remove();
log.info(String.format("外债:股东%s--非父节点%s(%s)将%s转移到%s,并删除非父节点", gudongName, playerName, pId, cmi.getShishiJine(), teamInfo.getMingzi()));
} else {
// 新增一个所属团队信息
ite.remove();
CurrentMoneyInfo cmiInfo = new CurrentMoneyInfo(_teamId, cmi.getShishiJine(), "", "");
ite.add(cmiInfo);
log.info(String.format("外债:股东%s--根据非父点(%s)新建团队外债信息(%s),联合额度(团队的实时金额)为%s,并删除非父节点", gudongName, playerName, _teamId, cmi.getShishiJine()));
}
}
}
}
}
return gudongMap;
}
use of com.kendy.entity.Huishui in project financial by greatkendy123.
the class DBUtil method insertTeamHS.
/**
* 团队回水入库
*
* @time 2017年11月19日
* @param map
*/
public static void insertTeamHS(final Map<String, Huishui> map) {
if (map != null && map.size() > 0) {
try {
con = DBConnection.getConnection();
if (map != null && map.size() > 0) {
sql = "delete from teamhs";
ps = con.prepareStatement(sql);
ps.execute();
}
Huishui hs;
String sql;
log.info("团队回水进数据库开始...");
for (Map.Entry<String, Huishui> entry : map.entrySet()) {
hs = entry.getValue();
// 10列
sql = "insert into teamhs values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
ps = con.prepareStatement(sql);
ps.setString(1, hs.getTeamId().toUpperCase());
ps.setString(2, hs.getTeamName());
ps.setString(3, hs.getHuishuiRate());
ps.setString(4, hs.getInsuranceRate());
ps.setString(5, hs.getGudong());
ps.setString(6, hs.getZjManaged());
ps.setString(7, hs.getBeizhu());
ps.setString(8, hs.getProxyHSRate());
ps.setString(9, hs.getProxyHBRate());
ps.setString(10, hs.getProxyFWF());
ps.setString(11, hs.getShowInsure());
ps.setString(12, hs.getTeamYajin());
ps.setString(13, hs.getTeamEdu());
ps.setString(14, hs.getTeamAvailabel());
ps.execute();
}
log.info("团队回水进数据库结束!size:" + map.size());
} catch (SQLException e) {
ErrorUtil.err("批量团队回水进数据库失败", e);
} finally {
close(con, ps);
}
}
}
Aggregations