Selaa lähdekoodia

计算分红增加本级用户数据

dos 3 kuukautta sitten
vanhempi
commit
7a9635ddca

+ 4 - 0
game-business/src/main/java/com/game/business/service/IAppUserCountService.java

@@ -32,4 +32,8 @@ public interface IAppUserCountService extends IService<AppUserCount> {
 
     public void staticsUserBetting(AppGameBetting appGameBetting,List<AppGameCommission> gameRateList);
 
+    /**
+     * 查询用户代理统计
+     * */
+    public List<AppUserCount> getListByUserId(long userId,String beginTime,String endTIme);
 }

+ 13 - 0
game-business/src/main/java/com/game/business/service/impl/AppUserCountServiceImpl.java

@@ -217,6 +217,19 @@ public class AppUserCountServiceImpl extends ServiceImpl<AppUserCountMapper, App
         }
     }
 
+    @Override
+    public List<AppUserCount> getListByUserId(long userId, String beginTime, String endTIme) {
+        LambdaQueryWrapper<AppUserCount> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(AppUserCount::getUserId, userId);
+        if(StringUtils.isNotBlank(beginTime)){
+            queryWrapper.ge(AppUserCount::getStrDate,beginTime);
+        }
+        if(StringUtils.isNotBlank(endTIme)){
+            queryWrapper.le(AppUserCount::getStrDate,endTIme);
+        }
+        return appUserCountMapper.selectList(queryWrapper);
+    }
+
     /**
      * 金额为负数则转为正数
      * */

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

@@ -266,7 +266,17 @@ public class AppUserCountTask {
                     queryWrapper.le(AppUserCount::getStrDate, endTime);
                     queryWrapper.eq(AppUserCount::getAgentUserId, appUser.getUserid());
                     List<AppUserCount> appUserCountList = appUserCountService.list(queryWrapper);*/
-                    List<AppUserCount> appUserCountList = appUserCountService.getAppUserCountNew(appUser.getUserid(),DateUtil.format(beginTime,"yyyy-MM-dd"),DateUtil.format(endTime,"yyyy-MM-dd"));
+                    String beginTimeStr = DateUtil.format(beginTime,"yyyy-MM-dd");
+                    String endTimeStr = DateUtil.format(endTime,"yyyy-MM-dd");
+                    List<AppUserCount> appUserCountList = appUserCountService.getAppUserCountNew(appUser.getUserid(),beginTimeStr,endTimeStr);
+                    //查询当前用户盈亏
+                    List<AppUserCount> curUserCouts = appUserCountService.getListByUserId(appUser.getUserid(),beginTimeStr,endTimeStr);
+                    if(null!=curUserCouts && curUserCouts.size()>0){
+                        if(null == appUserCountList){
+                            appUserCountList = new ArrayList<>();
+                        }
+                        appUserCountList.addAll(curUserCouts);
+                    }
                     if (null != appUserCountList && appUserCountList.size() > 0) {
                         //游戏输钱
                         double loseAmount = appUserCountList.stream().mapToDouble(e -> e.getGameLoseAmount()).sum();