use of com.kendy.entity.ShangmaNextday 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.ShangmaNextday 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);
}
}
use of com.kendy.entity.ShangmaNextday in project financial by greatkendy123.
the class ShangmaService method init_SM_NextDay_Map.
/**
* 加载数据库中玩家的次日信息
* @time 2018年2月5日
*/
public static void init_SM_NextDay_Map() {
List<ShangmaNextday> allSM_nextday = DBUtil.getAllSM_nextday();
if (!allSM_nextday.isEmpty()) {
SM_NextDay_Map = allSM_nextday.stream().map(nextday -> {
String playerId = nextday.getPlayerId();
String playerName = nextday.getPlayerName();
String changci = nextday.getChangci();
String shangma = nextday.getShangma();
ShangmaDetailInfo shangmaDetailInfo = new ShangmaDetailInfo(playerId, playerName, changci, shangma);
return shangmaDetailInfo;
}).collect(Collectors.groupingBy(ShangmaDetailInfo::getShangmaPlayerId));
}
}
use of com.kendy.entity.ShangmaNextday in project financial by greatkendy123.
the class SMAutoController method addShangma.
/**
* 本类核心 :添加上码到软件中,同时发送后台请求
*
* @time 2018年3月28日
* @param isTodaySM 是否今日上码
* @param passCheck 是否审核通过
* @param paijuString 第几局
* @param buyStack 上码值
* @param userUuid 后台用户ID
* @param roomId 房间号
*/
public boolean addShangma(SMResultModel resultModel, boolean isTodaySM, boolean passCheck, String playerId, String playerName, String paijuString, String buyStack, Long userUuid, Long roomId) {
boolean addOK = false;
try {
if (passCheck) {
// TODO 到时要根据数据量决定要不要添加此过滤条件
// 后台申请买入
HttpUtil.acceptBuy(userUuid, roomId, getToken());
if (isTodaySM) {
log.info("正在添加今日上码...");
ShangmaService.addNewShangma2DetailTable_HT(resultModel, ShangmaService.getShangmaPaiju(paijuString), buyStack);
log.info("添加今日上码结束:" + resultModel.getSelectedSMInfo().toString());
} else {
log.info("正在添加次日上码...");
ShangmaNextday nextday = new ShangmaNextday();
nextday.setPlayerId(playerId);
nextday.setPlayerName(playerName);
nextday.setChangci(ShangmaService.getShangmaPaiju(paijuString));
nextday.setShangma(buyStack);
nextday.setTime(TimeUtil.getDateTime2());
// 新增玩家的次日数据
ShangmaService.addNewRecord_nextday_HT(resultModel, nextday);
log.info("添加次日上码结束:" + nextday.toString());
}
}
addOK = true;
} catch (Exception e) {
addOK = false;
e.printStackTrace();
}
return addOK;
}
use of com.kendy.entity.ShangmaNextday in project financial by greatkendy123.
the class DBUtil method getAllSM_nextday.
/**
* 获取玩家的次日数据
* @time 2018年2月5日
* @return
*/
public static List<ShangmaNextday> getAllSM_nextday() {
List<ShangmaNextday> list = new ArrayList<>();
try {
con = DBConnection.getConnection();
String sql = "select * from shangma_nextday n where n.type = '0' ";
ps = con.prepareStatement(sql);
ResultSet rs = ps.executeQuery();
while (rs.next()) {
ShangmaNextday nextday = new ShangmaNextday();
nextday.setPlayerId(rs.getString(1));
nextday.setPlayerName(rs.getString(2));
nextday.setChangci(rs.getString(3));
nextday.setShangma(rs.getString(4));
nextday.setTime(rs.getString(5));
nextday.setType(rs.getString(6));
list.add(nextday);
}
} catch (SQLException e) {
ErrorUtil.err("获取玩家的次日数据失败", e);
} finally {
close(con, ps);
}
return list;
}
Aggregations