|
@@ -81,7 +81,7 @@ public class AppUserCountTask {
|
|
* 统计用户前一天
|
|
* 统计用户前一天
|
|
* */
|
|
* */
|
|
public void statistics(String dateTime){
|
|
public void statistics(String dateTime){
|
|
- if(!taskSwitch){
|
|
|
|
|
|
+ if(!taskSwitch && org.apache.commons.lang3.StringUtils.isBlank(dateTime)){
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
String redisKey = CacheConstants.USER_STATICS_COUNT.concat("statistics");
|
|
String redisKey = CacheConstants.USER_STATICS_COUNT.concat("statistics");
|
|
@@ -325,7 +325,7 @@ public class AppUserCountTask {
|
|
* */
|
|
* */
|
|
@DSTransactional
|
|
@DSTransactional
|
|
public void calculateDividends(String dateTime){
|
|
public void calculateDividends(String dateTime){
|
|
- if(!taskSwitch){
|
|
|
|
|
|
+ if(!taskSwitch && org.apache.commons.lang3.StringUtils.isBlank(dateTime)){
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
String redisKey = CacheConstants.USER_STATICS_COUNT.concat("calculateDividends");
|
|
String redisKey = CacheConstants.USER_STATICS_COUNT.concat("calculateDividends");
|
|
@@ -461,7 +461,7 @@ public class AppUserCountTask {
|
|
beginTime = DateUtil.beginOfMonth(curDate);
|
|
beginTime = DateUtil.beginOfMonth(curDate);
|
|
endTime = DateUtil.parse(DateUtil.format(curDate,"yyyy-MM-".concat("15").concat(" 23:59:59")),"yyyy-MM-dd HH:mm:ss");
|
|
endTime = DateUtil.parse(DateUtil.format(curDate,"yyyy-MM-".concat("15").concat(" 23:59:59")),"yyyy-MM-dd HH:mm:ss");
|
|
}else{
|
|
}else{
|
|
- beginTime = DateUtil.parse(DateUtil.format(curDate,"yyyy-MM-".concat("15").concat(" 00:00:00")),"yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
+ beginTime = DateUtil.parse(DateUtil.format(curDate,"yyyy-MM-".concat("16").concat(" 00:00:00")),"yyyy-MM-dd HH:mm:ss");
|
|
endTime = DateUtil.endOfMonth(curDate);
|
|
endTime = DateUtil.endOfMonth(curDate);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -476,10 +476,10 @@ public class AppUserCountTask {
|
|
Date finalEndTime = endTime;
|
|
Date finalEndTime = endTime;
|
|
list.forEach(appUser -> {
|
|
list.forEach(appUser -> {
|
|
AppUserAgent userAgent = appUserAgentService.selectInfo(appUser.getUserid());
|
|
AppUserAgent userAgent = appUserAgentService.selectInfo(appUser.getUserid());
|
|
- if (userAgent.getDividendGuaranteeRate() <= 0.00) {
|
|
|
|
|
|
+ /*if (userAgent.getDividendGuaranteeRate() <= 0.00) {
|
|
log.info("用户{},未设置分红比例,停止分红", userAgent.getUserId());
|
|
log.info("用户{},未设置分红比例,停止分红", userAgent.getUserId());
|
|
return;
|
|
return;
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
String beginTimeStr = DateUtil.format(finalBeginTime,"yyyy-MM-dd");
|
|
String beginTimeStr = DateUtil.format(finalBeginTime,"yyyy-MM-dd");
|
|
String endTimeStr = DateUtil.format(finalEndTime,"yyyy-MM-dd");
|
|
String endTimeStr = DateUtil.format(finalEndTime,"yyyy-MM-dd");
|
|
//查询用户所有下级本周盈亏
|
|
//查询用户所有下级本周盈亏
|
|
@@ -497,7 +497,9 @@ public class AppUserCountTask {
|
|
return e.getGameWinAmount() - (e.getGameBetting() - e.getGameLoseAmount()); //实际赢钱 = 赢 - 中奖本金
|
|
return e.getGameWinAmount() - (e.getGameBetting() - e.getGameLoseAmount()); //实际赢钱 = 赢 - 中奖本金
|
|
}).sum();
|
|
}).sum();
|
|
//提现手续费
|
|
//提现手续费
|
|
- double withdrawalCommission = appUserCountList.stream().mapToDouble(e -> e.getWithdrawalCommission()).sum();
|
|
|
|
|
|
+ List<AppUsersCashrecord> usersCashrecords = appUsersCashrecordService.getUserCashListByIds(appUserCountList.stream().map(AppUserCount::getUserId).collect(Collectors.toList()), beginTimeStr.concat(" 00:00:00"),endTimeStr.concat(" 23:59:59"));
|
|
|
|
+// double withdrawalCommission = appUserCountList.stream().mapToDouble(e -> e.getWithdrawalCommission()).sum();
|
|
|
|
+ double withdrawalCommission = null==usersCashrecords?0.00:usersCashrecords.stream().mapToDouble(e->{return null==e.getPlatformService()?0.00:e.getPlatformService().doubleValue();}).sum();
|
|
//充值手续费
|
|
//充值手续费
|
|
double rechargeCommission = appUserCountList.stream().mapToDouble(e -> e.getRechargeCommission()).sum();
|
|
double rechargeCommission = appUserCountList.stream().mapToDouble(e -> e.getRechargeCommission()).sum();
|
|
//游戏佣金
|
|
//游戏佣金
|
|
@@ -582,6 +584,9 @@ public class AppUserCountTask {
|
|
public void calculationWithdraw(Long userId){
|
|
public void calculationWithdraw(Long userId){
|
|
if(null != userId && userId.longValue() == -1){
|
|
if(null != userId && userId.longValue() == -1){
|
|
userId = null;
|
|
userId = null;
|
|
|
|
+ if(!taskSwitch){
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
//查询所有未满足提现的充值、转账
|
|
//查询所有未满足提现的充值、转账
|
|
String chargeType3 = FinTranType3.ON_LINE_CHARGE.getType() + "," + FinTranType3.CHARGE_IN.getType()+ "," + FinTranType3.CHARGE_IN_Back.getType()
|
|
String chargeType3 = FinTranType3.ON_LINE_CHARGE.getType() + "," + FinTranType3.CHARGE_IN.getType()+ "," + FinTranType3.CHARGE_IN_Back.getType()
|
|
@@ -632,7 +637,7 @@ public class AppUserCountTask {
|
|
double bettingAmount = curTranList.stream().filter(e->
|
|
double bettingAmount = curTranList.stream().filter(e->
|
|
e.getCurrencyType().intValue() == 4
|
|
e.getCurrencyType().intValue() == 4
|
|
).mapToDouble(FinTranRecord::getDiamondCoinChange).sum() * -1;
|
|
).mapToDouble(FinTranRecord::getDiamondCoinChange).sum() * -1;
|
|
- log.info("用户{},充值:{} 以满足流水:{}",userId,money,bettingAmount);
|
|
|
|
|
|
+ log.info("用户{},充值:{} 已满足流水:{}",userId,money,bettingAmount);
|
|
if(bettingAmount >= money * 2){
|
|
if(bettingAmount >= money * 2){
|
|
//更新为已满足提现
|
|
//更新为已满足提现
|
|
userChargeList.forEach(e->{
|
|
userChargeList.forEach(e->{
|
|
@@ -654,6 +659,9 @@ public class AppUserCountTask {
|
|
public void updateWithdrawAble(Long userId){
|
|
public void updateWithdrawAble(Long userId){
|
|
if(null != userId && userId.longValue() == -1){
|
|
if(null != userId && userId.longValue() == -1){
|
|
userId = null;
|
|
userId = null;
|
|
|
|
+ if(!taskSwitch){
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
//查询所有已满足提现的充值、转账
|
|
//查询所有已满足提现的充值、转账
|
|
String chargeType3 = FinTranType3.ON_LINE_CHARGE.getType() + "," + FinTranType3.CHARGE_IN.getType()+ "," + FinTranType3.CHARGE_IN_Back.getType()
|
|
String chargeType3 = FinTranType3.ON_LINE_CHARGE.getType() + "," + FinTranType3.CHARGE_IN.getType()+ "," + FinTranType3.CHARGE_IN_Back.getType()
|
|
@@ -689,8 +697,9 @@ public class AppUserCountTask {
|
|
|
|
|
|
}
|
|
}
|
|
//查询用户这段时间流水记录
|
|
//查询用户这段时间流水记录
|
|
- List<FinTranRecord> curTranList = finTranRecordService.selectUserTran(null, null, uid, null, endDate, null);
|
|
|
|
- withdrawAble += curTranList.stream().filter(e->FinTranType3.CONSUM_GAME_ANCHOR_WITHDRAW.getType()!=e.getTranType3().intValue()).mapToDouble(FinTranRecord::getDiamondCoinChange).sum();
|
|
|
|
|
|
+ /*List<FinTranRecord> curTranList = finTranRecordService.selectUserTran(null, null, uid, null, endDate, null);
|
|
|
|
+ withdrawAble += curTranList.stream().filter(e->FinTranType3.CONSUM_GAME_ANCHOR_WITHDRAW.getType()!=e.getTranType3().intValue()).mapToDouble(FinTranRecord::getDiamondCoinChange).sum();*/
|
|
|
|
+ withdrawAble = finTranRecordService.sumUserTran(null, null, uid, null, endDate, null);
|
|
AppUser updateUser = new AppUser();
|
|
AppUser updateUser = new AppUser();
|
|
updateUser.setUserid(uid);
|
|
updateUser.setUserid(uid);
|
|
updateUser.setWithdrawAble(withdrawAble);
|
|
updateUser.setWithdrawAble(withdrawAble);
|
|
@@ -699,10 +708,31 @@ public class AppUserCountTask {
|
|
//清除用户缓存
|
|
//清除用户缓存
|
|
redisCache.deleteObject("U:UserInfo:".concat(String.valueOf(uid)));
|
|
redisCache.deleteObject("U:UserInfo:".concat(String.valueOf(uid)));
|
|
}
|
|
}
|
|
|
|
+ }else if(null != userId){
|
|
|
|
+ //查询所有未满足提现的充值、转账
|
|
|
|
+ List<FinTranRecord> notchargeList = finTranRecordService.selectUserTran(FinTranType1.U_Income_Coin_Balance.getType(),chargeType3,userId,null,null,0);
|
|
|
|
+ if(null != notchargeList && notchargeList.size() > 0) {
|
|
|
|
+ log.info("用户{},有为满足提现订单,停止更新可提现余额",userId);
|
|
|
|
+ }else{
|
|
|
|
+ //查询用户这段时间流水记录
|
|
|
|
+ /* List<FinTranRecord> curTranList = finTranRecordService.selectUserTran(null, null, userId, null, null, null);
|
|
|
|
+ double withdrawAble = curTranList.stream().filter(e->FinTranType3.CONSUM_GAME_ANCHOR_WITHDRAW.getType()!=e.getTranType3().intValue()).mapToDouble(FinTranRecord::getDiamondCoinChange).sum();*/
|
|
|
|
+ double withdrawAble = finTranRecordService.sumUserTran(null, null, userId, null, null, null);
|
|
|
|
+ AppUser updateUser = new AppUser();
|
|
|
|
+ updateUser.setUserid(userId);
|
|
|
|
+ updateUser.setWithdrawAble(withdrawAble);
|
|
|
|
+ appUserService.updateAppUser(updateUser);
|
|
|
|
+ log.info("用户{},可提现额度{}",userId,withdrawAble);
|
|
|
|
+ //清除用户缓存
|
|
|
|
+ redisCache.deleteObject("U:UserInfo:".concat(String.valueOf(userId)));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public void dealOffLive(){
|
|
public void dealOffLive(){
|
|
|
|
+ if(!taskSwitch){
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
List<OffLineUserVo> list = appUserService.selectOffLineUser();
|
|
List<OffLineUserVo> list = appUserService.selectOffLineUser();
|
|
if(null != list && list.size() > 0){
|
|
if(null != list && list.size() > 0){
|
|
Date now = DateUtil.date();
|
|
Date now = DateUtil.date();
|
|
@@ -710,12 +740,12 @@ public class AppUserCountTask {
|
|
if(now.getTime() - e.getOffTime().getTime() >= 1*60*1000){
|
|
if(now.getTime() - e.getOffTime().getTime() >= 1*60*1000){
|
|
log.info("{}离线已超过1分钟,自动关播",e.getUserId());
|
|
log.info("{}离线已超过1分钟,自动关播",e.getUserId());
|
|
//离线超过一分钟 自动关播
|
|
//离线超过一分钟 自动关播
|
|
- String url = sysConfigService.selectConfigByKey("sys_live_apiurl").concat("/api/live/httpOpenCloseLive");
|
|
|
|
|
|
+ String url = sysConfigService.selectConfigByKey("sys_live_apiurl").concat("/api/live/httpClose");
|
|
Map<String, String> map = new HashMap<>();
|
|
Map<String, String> map = new HashMap<>();
|
|
map.put("roomId", String.valueOf(e.getRoomId()));
|
|
map.put("roomId", String.valueOf(e.getRoomId()));
|
|
map.put("liveType", "1");
|
|
map.put("liveType", "1");
|
|
map.put("isLive", String.valueOf(e.getIsLive()));
|
|
map.put("isLive", String.valueOf(e.getIsLive()));
|
|
- map.put("description", "关播");
|
|
|
|
|
|
+ map.put("description", "主播已离线,自动关播");
|
|
|
|
|
|
String res = HttpClientUtils.ajaxPost(url,map);
|
|
String res = HttpClientUtils.ajaxPost(url,map);
|
|
if(org.apache.commons.lang3.StringUtils.isBlank(res) || !JSONObject.parseObject(res).getString("code").equals("1")){
|
|
if(org.apache.commons.lang3.StringUtils.isBlank(res) || !JSONObject.parseObject(res).getString("code").equals("1")){
|