瀏覽代碼

优化转出失败场景

dos 1 月之前
父節點
當前提交
a06e3b771f

+ 19 - 0
game-business/src/main/java/com/game/business/controller/AppUsersCashrecordController.java

@@ -278,6 +278,25 @@ public class AppUsersCashrecordController extends BaseController
                 }
                 //更新状态
                 update.setCashOutStatus(2L);
+            }else{
+                AppUser appUser = appUserService.selectAppUserByUserid(appUsersCashrecord.getUid());
+                if(null == appUser){
+                    return "failed";
+                }
+                if(null != appUsersCashrecord.getCashOutStatus() && appUsersCashrecord.getCashOutStatus().intValue() == 3) {
+                    FinTranAddedInfo addedInfo = FinTranAddedInfo.createTranInfo(appUser.getUserid(), 0, 0, AppSceneType.Scene_None, "");
+                    FinTranRecord tran = FinTranRecord.initFinTranRecordSomeParams(addedInfo, FinTranType3.CASH_DIAMOND_INCOME_BACK, FinTranType1.U_Income_Coin_Balance, appUser);
+                    tran.setDiamondCoinChange(appUsersCashrecord.getVotes().doubleValue());
+                    tran.setAfterDiamondCoin(appUser.getDiamondCoin());
+                    tran.setCurrencyType(TranCurrencyType.Balance.getType());
+                    tran.setTranGroupId(IdUtil.getSnowflakeNextId());
+                    tran.setRemarks("转出失败:回退金额");
+                    appUserService.updateUserAmount(tran,true);
+                }else{
+                    logger.info("订单{},当前状态非转出中,停止更新失败逻辑",orderNo);
+                }
+                //更新状态
+                update.setCashOutStatus(2L);
             }
             appUsersCashrecordService.updateAppUsersCashrecord(update);
             //更新用户可提现余额