|
@@ -4,6 +4,7 @@ import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
import cn.hutool.core.util.RandomUtil;
|
|
|
import cn.hutool.http.HttpRequest;
|
|
@@ -387,7 +388,11 @@ public class AppUserController extends BaseController
|
|
|
//流水 余额
|
|
|
FinTranAddedInfo addedInfo = FinTranAddedInfo.createTranInfo(appUser.getUserid(), 0, 0, AppSceneType.Scene_None, "");
|
|
|
FinTranRecord tran = null;
|
|
|
- tran = FinTranRecord.initFinTranRecordSomeParams(addedInfo, FinTranType3.CONSUM_GAME_ANCHOR_WITHDRAW, withdrawDto.getAmount()<0?FinTranType1.U_Income_Coin_Balance:FinTranType1.U_Outcome_Balance, appUser);
|
|
|
+ FinTranType3 type3 = FinTranType3.CONSUM_GAME_ANCHOR_WITHDRAW;
|
|
|
+ if(withdrawDto.getAmount().doubleValue()<0){
|
|
|
+ type3 = FinTranType3.CONSUM_GAME_ANCHOR_WITHDRAW_OUT;
|
|
|
+ }
|
|
|
+ tran = FinTranRecord.initFinTranRecordSomeParams(addedInfo, type3, withdrawDto.getAmount()<0?FinTranType1.U_Income_Coin_Balance:FinTranType1.U_Outcome_Balance, appUser);
|
|
|
tran.setDiamondCoinChange(withdrawDto.getAmount()*-1);
|
|
|
tran.setAfterDiamondCoin(appUser.getDiamondCoin());
|
|
|
tran.setCurrencyType(TranCurrencyType.Balance.getType());
|
|
@@ -463,17 +468,51 @@ public class AppUserController extends BaseController
|
|
|
{
|
|
|
RechargeAmountVo amountVo = finTranRecordService.selectRechargeAmount(userid,0);
|
|
|
if(null == amountVo){
|
|
|
- return R.ok(new RechargeAmountVo());
|
|
|
+ amountVo = new RechargeAmountVo();
|
|
|
}
|
|
|
//查询用户已下注金额
|
|
|
Date time = finTranRecordService.selectRechargeDate(userid,0);
|
|
|
- String type3s = FinTranType3.CONSUM_GAME_ANCHOR_ZHUANPAN.getType() + "," + FinTranType3.CONSUM_GAME_ANCHOR_WITHDRAW.getType();
|
|
|
- List<FinTranRecord> curTranList = finTranRecordService.selectUserTran(null,type3s,userid,time,new Date(),0);
|
|
|
- double bettingAmount = curTranList.stream().filter(e->
|
|
|
- e.getCurrencyType().intValue() == 4
|
|
|
- ).mapToDouble(FinTranRecord::getDiamondCoinChange).sum() * -1;
|
|
|
- amountVo.setGameAmount(bettingAmount);
|
|
|
- double amount = (amountVo.getAmount() + amountVo.getGiveAmount()) * 2 - amountVo.getGameAmount();
|
|
|
+ double amount = 0;
|
|
|
+ double bettingAmount = 0;
|
|
|
+ if(null != time){
|
|
|
+ //查询本次充值下注金额
|
|
|
+ double outAmount = finTranRecordService.sumCoinByType(userid,Arrays.asList(FinTranType3.CONSUM_GAME_ANCHOR_ZHUANPAN.getType(),
|
|
|
+ FinTranType3.CONSUM_GAME_ANCHOR_WITHDRAW.getType(),
|
|
|
+ FinTranType3.CONSUM_GAME_ANCHOR_WITHDRAW_OUT.getType()), DateUtil.format(time,"yyyy-MM-dd HH:mm:ss")) * -1;
|
|
|
+ amount = (amountVo.getAmount() + amountVo.getGiveAmount()) * 2 - outAmount;
|
|
|
+ }else{
|
|
|
+ //查询最近一次满足提现流水时间
|
|
|
+ FinTranRecord finTranRecord = finTranRecordService.getFinByUserId(userid);
|
|
|
+ if(null != finTranRecord){
|
|
|
+ double outAmount = finTranRecordService.sumCoinByType(userid,Arrays.asList(FinTranType3.CONSUM_GAME_ANCHOR_ZHUANPAN.getType(),
|
|
|
+ FinTranType3.CONSUM_GAME_ANCHOR_WITHDRAW.getType(),
|
|
|
+ FinTranType3.CONSUM_GAME_ANCHOR_WITHDRAW_OUT.getType()), DateUtil.format(finTranRecord.getCreateTime(),"yyyy-MM-dd HH:mm:ss")) * -1;
|
|
|
+ if(outAmount < 0){
|
|
|
+ amount = outAmount * -1;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ double outAmount = finTranRecordService.sumCoinByType(userid,Arrays.asList(FinTranType3.CONSUM_GAME_ANCHOR_ZHUANPAN.getType(),
|
|
|
+ FinTranType3.CONSUM_GAME_ANCHOR_WITHDRAW.getType(),
|
|
|
+ FinTranType3.CONSUM_GAME_ANCHOR_WITHDRAW_OUT.getType()), null);
|
|
|
+ if(outAmount < 0){
|
|
|
+ amount = outAmount * -1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //查询总打码量
|
|
|
+ bettingAmount = finTranRecordService.sumCoinByType(userid,Arrays.asList(FinTranType3.CONSUM_GAME_ANCHOR_ZHUANPAN.getType(),
|
|
|
+ FinTranType3.CONSUM_GAME_ANCHOR_WITHDRAW.getType(),
|
|
|
+ FinTranType3.CONSUM_GAME_ANCHOR_WITHDRAW_OUT.getType()),null) * -1;
|
|
|
+ //查询已提现金额
|
|
|
+ double withdrawAmount = finTranRecordService.sumCoinByType(userid,Arrays.asList(FinTranType3.CASH_DIAMOND_INCOME_BACK.getType(),
|
|
|
+ FinTranType3.CASH_DIAMOND_INCOME.getType()), null);
|
|
|
+ double totalAmount = bettingAmount-(withdrawAmount*-1*2);
|
|
|
+ amountVo.setGameAmount(totalAmount<0?0:totalAmount);
|
|
|
+ /*//查询额外补足流水
|
|
|
+ double outAmount = finTranRecordService.sumCoinByType(userid,Arrays.asList(FinTranType3.CONSUM_GAME_ANCHOR_ZHUANPAN.getType(),
|
|
|
+ FinTranType3.CONSUM_GAME_ANCHOR_WITHDRAW.getType(),
|
|
|
+ FinTranType3.CONSUM_GAME_ANCHOR_WITHDRAW_OUT.getType()), DateUtil.format(time,"yyyy-MM-dd HH:mm:ss"));
|
|
|
+ amount += outAmount;*/
|
|
|
amountVo.setLackAmount(amount>0?amount:0);
|
|
|
return R.ok(amountVo);
|
|
|
}
|