|
@@ -16,6 +16,7 @@ import com.game.common.utils.DateUtils;
|
|
|
import com.game.common.utils.StringUtils;
|
|
|
import lombok.extern.log4j.Log4j2;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
@@ -64,16 +65,22 @@ public class AppUserCountTask {
|
|
|
@Autowired
|
|
|
private RedisCache redisCache;
|
|
|
|
|
|
+ @Value("${task.switch}")
|
|
|
+ private Boolean taskSwitch;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 统计用户前一天
|
|
|
* */
|
|
|
public void statistics(String dateTime){
|
|
|
+ if(!taskSwitch){
|
|
|
+ return;
|
|
|
+ }
|
|
|
String redisKey = CacheConstants.USER_STATICS_COUNT.concat("statistics");
|
|
|
- if(!redisCache.redisTemplate.opsForValue().setIfAbsent(redisKey,1)){
|
|
|
+ /*if(!redisCache.redisTemplate.opsForValue().setIfAbsent(redisKey,1)){
|
|
|
log.info("停止统计用户每日直播、游戏、佣金,已在其他机器执行");
|
|
|
return;
|
|
|
- }
|
|
|
+ }*/
|
|
|
log.info("开始统计用户每日直播、游戏、佣金");
|
|
|
try {
|
|
|
Date curDate = DateUtil.offsetDay(DateUtils.getNowDate(), -1);
|
|
@@ -212,11 +219,14 @@ public class AppUserCountTask {
|
|
|
* 统计用户直播/充值 (增量更新 1分钟)
|
|
|
* */
|
|
|
public void statisticsLive(){
|
|
|
+ if(!taskSwitch){
|
|
|
+ return;
|
|
|
+ }
|
|
|
String redisKey = CacheConstants.USER_STATICS_COUNT.concat("statisticsLive");
|
|
|
- if(!redisCache.redisTemplate.opsForValue().setIfAbsent(redisKey,1)){
|
|
|
+ /*if(!redisCache.redisTemplate.opsForValue().setIfAbsent(redisKey,1)){
|
|
|
log.info("停止增量更新用户每日直播、佣金,已在其他机器执行");
|
|
|
return;
|
|
|
- }
|
|
|
+ }*/
|
|
|
log.info("开始增量更新用户每日直播、佣金");
|
|
|
try {
|
|
|
Long userId = null;
|
|
@@ -303,11 +313,14 @@ public class AppUserCountTask {
|
|
|
* */
|
|
|
@DSTransactional
|
|
|
public void calculateDividends(String dateTime){
|
|
|
+ if(!taskSwitch){
|
|
|
+ return;
|
|
|
+ }
|
|
|
String redisKey = CacheConstants.USER_STATICS_COUNT.concat("calculateDividends");
|
|
|
- if(!redisCache.redisTemplate.opsForValue().setIfAbsent(redisKey,1)){
|
|
|
+ /*if(!redisCache.redisTemplate.opsForValue().setIfAbsent(redisKey,1)){
|
|
|
log.info("停止每周代理分红,已在其他机器执行");
|
|
|
return;
|
|
|
- }
|
|
|
+ }*/
|
|
|
try {
|
|
|
log.info("开始每周代理分红");
|
|
|
String dateNo = dealDividendsNew(dateTime);
|
|
@@ -513,6 +526,9 @@ public class AppUserCountTask {
|
|
|
* 更新用户下级列表
|
|
|
* */
|
|
|
public void statisticsTeam(){
|
|
|
+ if(!taskSwitch){
|
|
|
+ return;
|
|
|
+ }
|
|
|
AppUserAgent query = new AppUserAgent();
|
|
|
List<AppUserAgent> userAgents = appUserAgentService.selectAppUserAgentList(query);
|
|
|
userAgents.forEach(appUserAgent -> {
|
|
@@ -525,6 +541,9 @@ public class AppUserCountTask {
|
|
|
}
|
|
|
|
|
|
public void reloadDividendCache(String dateTime,String topUserId){
|
|
|
+ if(!taskSwitch){
|
|
|
+ return;
|
|
|
+ }
|
|
|
appUserCountDividendService.reloadCache(dateTime,StringUtils.isBlank(topUserId)?null:Arrays.asList(Long.valueOf(topUserId)));
|
|
|
}
|
|
|
|