use of com.kendy.entity.CurrentMoneyInfo in project financial by greatkendy123.
the class WaizhaiService method getTempNewSuperInfo.
/**
* 构造实时金额表的父节点信息
* 场景:子节点存在于实时金额表中,但父节点没有存在于实时金额表
* 效果:模拟出一条父节点信息,代替其下所有子ID信息(主要是联合额度)
* @time 2017年12月28日
* @param superId 父节点信息
* @param tempSuperMap 临时存储的父节点及子列表信息,用于计算联合额度
* @return
*/
private static CurrentMoneyInfo getTempNewSuperInfo(String superId, Map<String, List<CurrentMoneyInfo>> tempSuperMap) {
// 获取父节点信息
Player superInfo = DataConstans.membersMap.get(superId);
// 构造实时金额表的父节点信息
CurrentMoneyInfo tempNewSuperInfo = new CurrentMoneyInfo(superInfo.getPlayerName(), "0", superId, superInfo.getEdu());
return tempNewSuperInfo;
}
use of com.kendy.entity.CurrentMoneyInfo in project financial by greatkendy123.
the class WaizhaiService method copyCurrentMoneyInfo.
/**
* 复制一个实时金额表的记录
* @time 2017年12月29日
* @param info
* @param tempSuperInfoMap
* @return
*/
private static CurrentMoneyInfo copyCurrentMoneyInfo(CurrentMoneyInfo info) {
CurrentMoneyInfo copyInfo = new CurrentMoneyInfo(info.getMingzi(), info.getShishiJine(), info.getWanjiaId(), info.getCmiEdu());
copyInfo.setColor(info.getColor());
copyInfo.setCmSuperIdSum(info.getCmSuperIdSum());
return copyInfo;
}
use of com.kendy.entity.CurrentMoneyInfo in project financial by greatkendy123.
the class WaizhaiService method handlePersonWaizhai.
/**
* 处理个人外债和有联合额度的外债
* @time 2017年12月28日
* @param gudongMap
* @param ssje_map
*/
private static void handlePersonWaizhai(Map<String, List<CurrentMoneyInfo>> gudongMap, Map<String, CurrentMoneyInfo> ssje_map) {
if (MapUtil.isNullOrEmpty(gudongMap))
return;
Map<String, List<CurrentMoneyInfo>> _gudongMap = new HashMap<>();
// 临时用的变量
Map<String, List<CurrentMoneyInfo>> tempSuperMap = new HashMap<>();
// {父ID : 复制的CurrentMoneyInfo}
Map<String, CurrentMoneyInfo> tempSuperInfoMap = new HashMap<>();
// 对负数的实时金额表记录进行处理,主要是对合并ID的记录进行
Iterator<Map.Entry<String, List<CurrentMoneyInfo>>> it = gudongMap.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, List<CurrentMoneyInfo>> entry = it.next();
String gudongID = entry.getKey();
List<CurrentMoneyInfo> subList = entry.getValue();
ListIterator<CurrentMoneyInfo> ite = subList.listIterator();
// 删除有联合额度的子ID(只保留父节点信息,联合额度为负数),注意此父节点为复制的
while (ite.hasNext()) {
CurrentMoneyInfo cmiInfo = ite.next();
String playerId = cmiInfo.getWanjiaId();
boolean isSubId = DataConstans.Combine_Sub_Id_Map.containsKey(playerId);
boolean isSuperId = DataConstans.Combine_Super_Id_Map.containsKey(playerId);
// 是子节点
if (isSubId) {
String superId = DataConstans.Combine_Sub_Id_Map.get(playerId);
boolean isSuperInfo_exist_in_ssje = isExistIn_SSJE(superId, ssje_map);
if (isSuperInfo_exist_in_ssje) {
// 父节点存在于实时金额表,直接删掉子ID
log.info("外债:删除子节点(" + getPlayerName(playerId) + "),其父节点是" + getSuperPlayerName(playerId));
ite.remove();
// 特殊情况:此时父节点>=0
} else // Question:模拟的父节点是否要添加进来????
{
// //父节点不存在于实时金额表,直接删掉子ID
// CurrentMoneyInfo tempNewSuperInfo = getTempNewSuperInfo(superId,tempSuperMap);
// ite.remove();//也要删掉
// ite.add(tempNewSuperInfo);//添加一条模拟的父节点于外债表中
log.error("外债:进入未开发的代码(" + getPlayerName(playerId) + "),子节点在实时金额表,但父子点并未在金额表中!");
}
}
// 删除联合额度为正数的父节点(合并id总和为正,不提取进外债菜单显示)
if (isSuperId) {
if (isSubId) {
ErrorUtil.err(String.format("玩家ID(%s)既是子ID,又是父ID", playerId));
}
String superId = playerId;
if (superId != null && tempSuperInfoMap.get(superId) == null) {
// CurrentMoneyInfo superInfo = ssje_map.get(playerId);
CurrentMoneyInfo superInfo = cmiInfo;
if (superInfo != null && NumUtil.getNum(superInfo.getCmSuperIdSum()) >= 0) {
log.info("外债:删除父节点(" + getPlayerName(playerId) + "),其联合ID为正");
ite.remove();
}
if (superInfo != null && NumUtil.getNum(superInfo.getCmSuperIdSum()) < 0) {
log.info(String.format("外债:修改父节点%s的实时金额从%s到%s", getPlayerName(superId), superInfo.getShishiJine(), superInfo.getCmSuperIdSum()));
// 核心
superInfo.setShishiJine(superInfo.getCmSuperIdSum());
tempSuperInfoMap.put(superId, superInfo);
}
}
}
// Question:对于实时金额表中有,但其团队已经存在于左边的团队信息框中,是要加在团队信息中,而自己不显示???
}
}
}
use of com.kendy.entity.CurrentMoneyInfo in project financial by greatkendy123.
the class WaizhaiService method getSum.
/**
* 计算每个股东的外债总和
* @param gudongMap
* @return
*/
public static Map<String, String> getSum(Map<String, List<CurrentMoneyInfo>> gudongMap) {
final Map<String, String> map = new HashMap<>();
if (gudongMap != null && gudongMap.size() > 0) {
for (Map.Entry<String, List<CurrentMoneyInfo>> entry : gudongMap.entrySet()) {
Double sum = 0d;
for (CurrentMoneyInfo info : entry.getValue()) {
sum += NumUtil.getNum(info.getShishiJine());
}
map.put(entry.getKey(), NumUtil.digit0(sum));
}
}
return map;
}
Aggregations