Quellcode durchsuchen

优化提现流水判断

dos vor 2 Monaten
Ursprung
Commit
7a1fb8f37c

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

@@ -613,13 +613,19 @@ public class AppUserCountTask {
                     }else{
                         endDate = new Date();
                     }
-                    double curMoney = tranRecord.getDiamondCoinChange();
+                    money += tranRecord.getDiamondCoinChange();
                     //查询赠送金额
                     AppUsersCharge appUsersCharge = appUsersChargeService.selectByOrderNo(String.valueOf(tranRecord.getTranGroupId()));
                     if(null != appUsersCharge && null != appUsersCharge.getCoinGive()){
-                        curMoney += appUsersCharge.getCoinGive().doubleValue();
+                        money += appUsersCharge.getCoinGive().doubleValue();
+                    }
+                    dealTranList.add(tranRecord);
+                    boolean flag = dealTran(dealTranList,beginDate,endDate,uid,money);
+                    if(flag){
+                        beginDate = null;
+                        money = 0.00;
+                        dealTranList.clear();
                     }
-                    dealTran(dealTranList,beginDate,endDate,uid,money,curMoney,tranRecord);
                     i++;
                 }
 
@@ -628,7 +634,8 @@ public class AppUserCountTask {
         }
     }
 
-    private void dealTran(List<FinTranRecord> userChargeList,Date beginDate,Date endDate,Long userId,Double money,Double curMoney,FinTranRecord tranRecord){
+    private boolean dealTran(List<FinTranRecord> userChargeList,Date beginDate,Date endDate,Long userId,Double money){
+        boolean flag = false;
         //查询用户这段时间流水记录
         String type3s = FinTranType3.CONSUM_GAME_ANCHOR_ZHUANPAN.getType() + "," + FinTranType3.CONSUM_GAME_ANCHOR_WITHDRAW.getType();
         List<FinTranRecord> curTranList = finTranRecordService.selectUserTran(null,type3s,userId,beginDate,endDate,0);
@@ -640,11 +647,12 @@ public class AppUserCountTask {
         if(null != appUser && appUser.getDiamondCoin().doubleValue() < 1 && count < 1){
             //更新为已满足提现
 //            userChargeList.forEach(e->{
-                FinTranRecord updateTran = new FinTranRecord();
+                /*FinTranRecord updateTran = new FinTranRecord();
                 updateTran.setId(tranRecord.getId());
                 updateTran.setWithdrawFlag(2);
                 finTranRecordService.updateFinTranRecord(updateTran);
-                log.info("用户{},流水单号:{} 因金额已使用完,该笔订单流水条件已作废",userId,tranRecord.getId());
+                log.info("用户{},流水单号:{} 因金额已使用完,该笔订单流水条件已作废",userId,tranRecord.getId());*/
+                flag = true;
                 //将本次之前的充值订单置为已作废
                 dealRechare(userChargeList,userId);
 //            });
@@ -652,17 +660,15 @@ public class AppUserCountTask {
             //查询本次充值到下次充值期间资产除去返佣后是否已归零
             double amount  = finTranRecordService.sumUserRechareTran(userId,beginDate,endDate);
             if(amount < 1 && count < 1){
-                FinTranRecord updateTran = new FinTranRecord();
+               /* FinTranRecord updateTran = new FinTranRecord();
                 updateTran.setId(tranRecord.getId());
                 updateTran.setWithdrawFlag(2);
                 finTranRecordService.updateFinTranRecord(updateTran);
-                log.info("用户{},流水单号:{} 因充值金额已使用完,该笔订单流水条件已作废",userId,tranRecord.getId());
+                log.info("用户{},流水单号:{} 因充值金额已使用完,该笔订单流水条件已作废",userId,tranRecord.getId());*/
+                flag = true;
                 //将本次之前的充值订单置为已作废
                 dealRechare(userChargeList,userId);
-            }else{
-                //未归零,则叠加
-                userChargeList.add(tranRecord);
-                money += curMoney;
+
             }
         }
         if(null != curTranList && curTranList.size() > 0){
@@ -679,10 +685,14 @@ public class AppUserCountTask {
                     updateTran.setWithdrawFlag(1);
                     finTranRecordService.updateFinTranRecord(updateTran);
                 });
+                flag = true;
                 //更新可提现余额
                 updateWithdrawAble(userId);
             }
+        }else{
+            log.info("用户{},充值:{} 已满足流水:{}",userId,money,0.00);
         }
+        return flag;
     }
 
     /**
@@ -800,7 +810,7 @@ public class AppUserCountTask {
                 finTranRecordService.updateFinTranRecord(updateTran2);
                 log.info("用户{},流水单号:{} 因金额已使用完,该笔订单流水条件已作废", userId, e.getId());
             });
-            userChargeList.clear();
+//            userChargeList.clear();
         }
     }
 }