幸运数字-结算-日志
This commit is contained in:
@@ -254,7 +254,6 @@ public class LuckyNumberActService {
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void settlement(String date, Integer partitionId) {
|
||||
LuckyNumberActRound round = roundService.getOrDefault(date, partitionId);
|
||||
if (null != round.getLuckyNumber()){
|
||||
@@ -262,14 +261,15 @@ public class LuckyNumberActService {
|
||||
}
|
||||
|
||||
int luckyNumber = RandomUtil.randomByRange(1, 99);
|
||||
//todo log
|
||||
log.info("[luckyNumber] luckyNumber {} date {} partitionId {}", luckyNumber, date, partitionId);
|
||||
|
||||
if (!roundService.saveLuckyNumber(date, partitionId, luckyNumber)){
|
||||
//todo log
|
||||
log.error("[luckyNumber] saveLuckyNumber failure !!! date {} partitionId {} luckyNumber {}", luckyNumber, date, partitionId);
|
||||
throw new ServiceException(BusiStatus.SERVERBUSY);
|
||||
}
|
||||
|
||||
if (BigDecimal.ZERO.compareTo(round.getJackpot()) >= 0){
|
||||
log.info("[luckyNumber] non input in round date {} partitionId {}", date, partitionId);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -287,20 +287,23 @@ public class LuckyNumberActService {
|
||||
for (Integer number : numberList){
|
||||
if (number.equals(luckyNumber)){
|
||||
luckyerMap.put(record.getUid(), luckyerMap.getOrDefault(record.getUid(), 0) + 1);
|
||||
//todo log
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//修改不幸运儿状态
|
||||
unluckyUidSet.removeAll(luckyerMap.keySet());
|
||||
playerRecordService.update(Wrappers.<LuckyNumberActInputRecord>lambdaUpdate()
|
||||
.set(LuckyNumberActInputRecord::getLuckyStatus, Constant.StatusV2.delete)
|
||||
.set(LuckyNumberActInputRecord::getUpdateTime, new Date())
|
||||
.eq(LuckyNumberActInputRecord::getDate, date)
|
||||
.in(LuckyNumberActInputRecord::getUid, unluckyUidSet)
|
||||
.eq(LuckyNumberActInputRecord::getPartitionId, partitionId)
|
||||
.eq(LuckyNumberActInputRecord::getLuckyStatus, Constant.StatusV2.invalid));
|
||||
if (!CollectionUtils.isEmpty(unluckyUidSet)){
|
||||
playerRecordService.update(Wrappers.<LuckyNumberActInputRecord>lambdaUpdate()
|
||||
.set(LuckyNumberActInputRecord::getLuckyStatus, Constant.StatusV2.delete)
|
||||
.set(LuckyNumberActInputRecord::getUpdateTime, new Date())
|
||||
.eq(LuckyNumberActInputRecord::getDate, date)
|
||||
.in(LuckyNumberActInputRecord::getUid, unluckyUidSet)
|
||||
.eq(LuckyNumberActInputRecord::getPartitionId, partitionId)
|
||||
.eq(LuckyNumberActInputRecord::getLuckyStatus, Constant.StatusV2.invalid));
|
||||
|
||||
log.info("[luckyNumber] congratulation unlucker {} date {} partitionId {}", JSON.toJSONString(unluckyUidSet), date, partitionId);
|
||||
}
|
||||
|
||||
if (!CollectionUtils.isEmpty(luckyerMap)){
|
||||
int totalInputNum = luckyerMap.values().stream().mapToInt(Integer::intValue).sum();
|
||||
@@ -309,9 +312,13 @@ public class LuckyNumberActService {
|
||||
Integer outputNum = entry.getValue();
|
||||
return BigDecimal.valueOf(outputNum).multiply(everyOutput).setScale(2, RoundingMode.HALF_DOWN);
|
||||
}));
|
||||
//todo log
|
||||
|
||||
log.info("[luckyNumber] congratulation luckyNumber {} luckerCount {} date {} partitionId {}", luckyNumber, JSON.toJSONString(luckyerMap), date, partitionId);
|
||||
|
||||
for (Map.Entry<Long, BigDecimal> entry : outputMap.entrySet()){
|
||||
long lucker = entry.getKey();
|
||||
BigDecimal output = entry.getValue();
|
||||
|
||||
boolean success = playerRecordService.update(Wrappers.<LuckyNumberActInputRecord>lambdaUpdate()
|
||||
.set(LuckyNumberActInputRecord::getOutput, entry.getValue())
|
||||
.set(LuckyNumberActInputRecord::getLuckyStatus, Constant.StatusV2.valid)
|
||||
@@ -320,11 +327,15 @@ public class LuckyNumberActService {
|
||||
.eq(LuckyNumberActInputRecord::getUid, entry.getKey())
|
||||
.eq(LuckyNumberActInputRecord::getPartitionId, partitionId)
|
||||
.eq(LuckyNumberActInputRecord::getLuckyStatus, Constant.StatusV2.invalid));
|
||||
//todo log
|
||||
|
||||
log.info("[luckyNumber] congratulation lucker {} output {} saveResult {} date {} partitionId {}", lucker, output, success, date, partitionId);
|
||||
}
|
||||
|
||||
//
|
||||
return;
|
||||
}
|
||||
|
||||
//下一轮
|
||||
//将剩余延续到下一轮
|
||||
String nextRoundDate = DateTimeUtil.convertDate(DateTimeUtil.addDays(DateTimeUtil.convertStrToDate(round.getDate()), 1), DateTimeUtil.DEFAULT_DATE_PATTERN);
|
||||
roundService.updateJackpot(nextRoundDate, partitionId, round.getJackpot());
|
||||
}
|
||||
|
Reference in New Issue
Block a user