use of com.kendy.entity.ShangmaDetailInfo in project financial by greatkendy123.
the class ShangmaService method getSumDetail.
/**
* 获取个人详情总和
*
* @time 2017年10月28日
* @param playerId
* @param edu
* @param yicunJifen
* @return
*/
public static Double[] getSumDetail(String playerId, String edu, String yicunJifen) {
Double[] sumDetail = { 0d, 0d, 0d, 0d };
// List<ShangmaDetailInfo> detailList = DataConstans.SM_Detail_Map.get(playerId);
// add 2018-2-5 新增次日
List<ShangmaDetailInfo> detailList = new ArrayList<>();
List<ShangmaDetailInfo> _detailList = DataConstans.SM_Detail_Map.get(playerId);
detailList.addAll(_detailList);
detailList.addAll(SM_NextDay_Map.getOrDefault(playerId, new ArrayList<>()));
if (detailList != null) {
Double sumAvailableEdu = 0d, sumYiSM = 0d, sumZJ = 0d, sumZJ_hasPayed = 0d;
for (ShangmaDetailInfo info : detailList) {
if ("否".equals(info.getShangmaHasPayed())) {
// 如果该战绩导入后按了支付按钮,则不计算(即未支付)
sumZJ_hasPayed += MoneyService.getNum(info.getShangmaShishou());
}
sumZJ += MoneyService.getNum(info.getShangmaShishou());
sumYiSM += MoneyService.getNum(info.getShangmaSM());
}
sumAvailableEdu = getSumAvailableEdu(edu, sumZJ_hasPayed + "", sumYiSM + "", playerId, yicunJifen);
sumDetail[0] = sumAvailableEdu;
sumDetail[1] = sumYiSM;
sumDetail[2] = sumZJ;
sumDetail[3] = sumZJ_hasPayed;
}
return sumDetail;
}
use of com.kendy.entity.ShangmaDetailInfo in project financial by greatkendy123.
the class ShangmaService method checkIfDuplicate.
// 判断加入的新牌局是否跟之前的有重复
private static boolean checkIfDuplicate(String playerId, String ju) {
boolean ifDuplicate = false;
List<ShangmaDetailInfo> list = DataConstans.SM_Detail_Map.get(playerId);
if (list != null && list.size() > 0) {
for (ShangmaDetailInfo info : list) {
if (info.getShangmaJu() != null && info.getShangmaJu().equals(getShangmaPaiju(ju))) {
return true;
}
}
}
return ifDuplicate;
}
use of com.kendy.entity.ShangmaDetailInfo in project financial by greatkendy123.
the class ShangmaService method resetNextDayDetailInfo_HT.
/**
* 新增次日上码时,若重复,则续增
* @time 2018年4月1日
* @param detail
* @param nextDayShangmaVal
*/
public static void resetNextDayDetailInfo_HT(ShangmaInfo selectedSMInfo, ShangmaDetailInfo detail, String nextDayShangmaVal) {
String oddSM = StringUtil.isBlank(detail.getShangmaSM()) ? "0" : detail.getShangmaSM();
detail.setShangmaSM(MoneyService.digit0(MoneyService.getNum(oddSM) + MoneyService.getNum(nextDayShangmaVal)));
String playerId = detail.getShangmaPlayerId();
String changci = detail.getShangmaJu();
// 1保存到数据库
ShangmaNextday nextday = new ShangmaNextday();
nextday.setPlayerId(playerId);
nextday.setPlayerName(detail.getShangmaDetailName());
nextday.setChangci(detail.getShangmaJu());
nextday.setShangma(detail.getShangmaSM());
DBUtil.saveOrUpdate_SM_nextday(nextday);
// 2保存到缓存
List<ShangmaDetailInfo> currentNextdayList = SM_NextDay_Map.getOrDefault(playerId, new ArrayList<>());
ShangmaDetailInfo shangmaDetailInfo = currentNextdayList.stream().filter(info -> changci.equals(info.getShangmaJu())).findFirst().get();
shangmaDetailInfo.setShangmaSM(detail.getShangmaSM());
SM_NextDay_Map.put(playerId, currentNextdayList);
// 刷新左表对应记录
try {
updateRowByPlayerId_HT(selectedSMInfo, nextDayShangmaVal);
} catch (Exception e) {
ErrorUtil.err("自动上码:刷新左表对应记录失败", e);
}
}
use of com.kendy.entity.ShangmaDetailInfo in project financial by greatkendy123.
the class ShangmaService method copyShangmaDetailInfo.
/**
* 复制
* @time 2018年2月5日
* @param source
* @return
*/
private static ShangmaDetailInfo copyShangmaDetailInfo(ShangmaDetailInfo source) {
ShangmaDetailInfo target = new ShangmaDetailInfo();
target.setShangmaDetailName(source.getShangmaDetailName());
target.setShangmaSM(source.getShangmaSM());
target.setShangmaPlayerId(source.getShangmaPlayerId());
target.setShangmaHasPayed(source.getShangmaHasPayed());
target.setShangmaPreSM(source.getShangmaPreSM());
target.setShangmaJu(source.getShangmaJu());
return target;
}
use of com.kendy.entity.ShangmaDetailInfo in project financial by greatkendy123.
the class ShangmaService method resetNextDayDetailInfo.
/**
* 新增次日上码时,若重复,则续增
* @time 2018年3月28日
* @param detail
* @param nextDayShangmaVal
*/
public static void resetNextDayDetailInfo(ShangmaDetailInfo detail, String nextDayShangmaVal) {
String oddSM = StringUtil.isBlank(detail.getShangmaSM()) ? "0" : detail.getShangmaSM();
detail.setShangmaSM(MoneyService.digit0(MoneyService.getNum(oddSM) + MoneyService.getNum(nextDayShangmaVal)));
String playerId = detail.getShangmaPlayerId();
String changci = detail.getShangmaJu();
// 1保存到数据库
ShangmaNextday nextday = new ShangmaNextday();
nextday.setPlayerId(playerId);
nextday.setPlayerName(detail.getShangmaDetailName());
nextday.setChangci(detail.getShangmaJu());
nextday.setShangma(detail.getShangmaSM());
DBUtil.saveOrUpdate_SM_nextday(nextday);
// 2保存到缓存
List<ShangmaDetailInfo> currentNextdayList = SM_NextDay_Map.getOrDefault(playerId, new ArrayList<>());
ShangmaDetailInfo shangmaDetailInfo = currentNextdayList.stream().filter(info -> changci.equals(info.getShangmaJu())).findFirst().get();
shangmaDetailInfo.setShangmaSM(detail.getShangmaSM());
// 3刷新到当前的玩家次日表
tableND.refresh();
// 刷新左表对应记录
try {
updateRowByPlayerId(playerId, nextDayShangmaVal);
} catch (Exception e) {
ErrorUtil.err("刷新左表对应记录失败", e);
}
}
Aggregations