dos 4 сар өмнө
parent
commit
0627f1a24b

+ 6 - 0
game-business/src/main/java/com/game/business/service/IAppUsersCashrecordService.java

@@ -65,6 +65,12 @@ public interface IAppUsersCashrecordService extends IService<AppUsersCashrecord>
      * */
     public List<AppUsersCashrecord> getUserCashList(Long userId,String beginTime,String endTime);
 
+    /**
+     *  根据日期查询用户提现记录
+     *
+     * */
+    public List<AppUsersCashrecord> getUserCashListByIds(List<Long> userIds,String beginTime,String endTime);
+
     public Double sumWithdraw(Long userId);
 
     public AppUsersCashrecord getByOrderNo(String orderNo);

+ 15 - 1
game-business/src/main/java/com/game/business/service/impl/AppUsersCashrecordServiceImpl.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 
 import java.util.Collections;
+import java.util.Date;
 import java.util.List;
 
 import com.game.common.annotation.DataSource;
@@ -70,6 +71,7 @@ public class AppUsersCashrecordServiceImpl extends ServiceImpl<AppUsersCashrecor
     @Override
     @DataSource(DataSourceType.SLAVE)
     public int updateAppUsersCashrecord(AppUsersCashrecord appUsersCashrecord) {
+        appUsersCashrecord.setUptime(new Date());
         return appUsersCashrecordMapper.updateAppUsersCashrecord(appUsersCashrecord);
     }
 
@@ -102,9 +104,21 @@ public class AppUsersCashrecordServiceImpl extends ServiceImpl<AppUsersCashrecor
     public List<AppUsersCashrecord> getUserCashList(Long userId, String beginTime, String endTime) {
         LambdaQueryWrapper<AppUsersCashrecord> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(AppUsersCashrecord::getStatus,"1");
+        queryWrapper.in(AppUsersCashrecord::getCashOutStatus,0,1);
         queryWrapper.eq(AppUsersCashrecord::getCashType,"7");//余额提现
         queryWrapper.eq(AppUsersCashrecord::getUid,userId);
-        queryWrapper.between(AppUsersCashrecord::getAddtime,beginTime,endTime);
+        queryWrapper.between(AppUsersCashrecord::getUptime,beginTime,endTime);
+        return appUsersCashrecordMapper.selectList(queryWrapper);
+    }
+
+    @Override
+    public List<AppUsersCashrecord> getUserCashListByIds(List<Long> userIds, String beginTime, String endTime) {
+        LambdaQueryWrapper<AppUsersCashrecord> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(AppUsersCashrecord::getStatus,"1");
+        queryWrapper.in(AppUsersCashrecord::getCashOutStatus,0,1);
+        queryWrapper.eq(AppUsersCashrecord::getCashType,"7");//余额提现
+        queryWrapper.in(AppUsersCashrecord::getUid,userIds);
+        queryWrapper.between(AppUsersCashrecord::getUptime,beginTime,endTime);
         return appUsersCashrecordMapper.selectList(queryWrapper);
     }
 

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

@@ -497,7 +497,9 @@ public class AppUserCountTask {
                         return e.getGameWinAmount() - (e.getGameBetting() - e.getGameLoseAmount()); //实际赢钱 = 赢 - 中奖本金
                     }).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();
                     //游戏佣金