dos 1 月之前
父節點
當前提交
0cfa5421eb
共有 1 個文件被更改,包括 13 次插入11 次删除
  1. 13 11
      game-business/src/main/java/com/game/business/task/AppUserCountTask.java

+ 13 - 11
game-business/src/main/java/com/game/business/task/AppUserCountTask.java

@@ -447,15 +447,15 @@ public class AppUserCountTask {
         Date beginTime = DateUtil.beginOfWeek(curDate);
         Date endTime = DateUtil.endOfWeek(curDate);
 
-        Date weekBegin = null;
-        Date weekend = null;
+        /*Date weekBegin = null;
+        Date weekend = null;*/
         int curDay = Integer.parseInt(DateUtil.format(curDate,"dd"));
         if(curDay <= 15){
-            weekBegin = DateUtil.beginOfMonth(curDate);
-            weekend = DateUtil.parse(DateUtil.format(curDate,"yyyy-MM-".concat("15").concat(" 23:59:59")),"yyyy-MM-dd HH:mm:ss");
+            beginTime = DateUtil.beginOfMonth(curDate);
+            endTime = DateUtil.parse(DateUtil.format(curDate,"yyyy-MM-".concat("15").concat(" 23:59:59")),"yyyy-MM-dd HH:mm:ss");
         }else{
-            weekBegin = DateUtil.parse(DateUtil.format(curDate,"yyyy-MM-".concat("15").concat(" 00:00:00")),"yyyy-MM-dd HH:mm:ss");
-            weekend = DateUtil.endOfMonth(curDate);
+            beginTime = DateUtil.parse(DateUtil.format(curDate,"yyyy-MM-".concat("15").concat(" 00:00:00")),"yyyy-MM-dd HH:mm:ss");
+            endTime = DateUtil.endOfMonth(curDate);
         }
 
         resDate = DateUtil.format(endTime, "yyyy-MM-dd");
@@ -465,14 +465,16 @@ public class AppUserCountTask {
         List<AppUser> list = appUserService.selectAppUserList(queryUser);
 //            List<AppUser> list = appUserService.selectTeamUserList();
         if (null != list && list.size() > 0) {
+            Date finalBeginTime = beginTime;
+            Date finalEndTime = endTime;
             list.forEach(appUser -> {
                 AppUserAgent userAgent = appUserAgentService.selectInfo(appUser.getUserid());
                 if (userAgent.getDividendGuaranteeRate() <= 0.00) {
                     log.info("用户{},未设置分红比例,停止分红", userAgent.getUserId());
                     return;
                 }
-                String beginTimeStr = DateUtil.format(beginTime,"yyyy-MM-dd");
-                String endTimeStr = DateUtil.format(endTime,"yyyy-MM-dd");
+                String beginTimeStr = DateUtil.format(finalBeginTime,"yyyy-MM-dd");
+                String endTimeStr = DateUtil.format(finalEndTime,"yyyy-MM-dd");
                 //查询用户所有下级本周盈亏
                     /*LambdaQueryWrapper<AppUserCount> queryWrapper = new LambdaQueryWrapper<>();
                     queryWrapper.ge(AppUserCount::getStrDate, beginTimeStr);
@@ -507,9 +509,9 @@ public class AppUserCountTask {
                         double dividends = BigDecimal.valueOf(money * rate/100).setScale(4,BigDecimal.ROUND_HALF_UP).doubleValue();
                         AppUserCountDividend appUserCountDividend = new AppUserCountDividend();
                         appUserCountDividend.setUserId(userAgent.getUserId());
-                        appUserCountDividend.setDateNo(DateUtil.format(endTime, "yyyy-MM-dd"));
-                        appUserCountDividend.setBeginTime(beginTime);
-                        appUserCountDividend.setEndTime(endTime);
+                        appUserCountDividend.setDateNo(DateUtil.format(finalEndTime, "yyyy-MM-dd"));
+                        appUserCountDividend.setBeginTime(finalBeginTime);
+                        appUserCountDividend.setEndTime(finalEndTime);
                         appUserCountDividend.setProfitLoss(money);
                         appUserCountDividend.setRate(rate);
                         appUserCountDividend.setCoin(0.00);