From fd88d7b527e99bbf7272d28bf0826b05e3c175d8 Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期一, 16 十二月 2024 17:10:53 +0800 Subject: [PATCH] 代码提交 --- xinquan-modules/xinquan-user/src/main/java/com/xinquan/user/controller/client/ClientAppUserWithdrawController.java | 48 ++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 40 insertions(+), 8 deletions(-) diff --git a/xinquan-modules/xinquan-user/src/main/java/com/xinquan/user/controller/client/ClientAppUserWithdrawController.java b/xinquan-modules/xinquan-user/src/main/java/com/xinquan/user/controller/client/ClientAppUserWithdrawController.java index 1d282e1..a6529a8 100644 --- a/xinquan-modules/xinquan-user/src/main/java/com/xinquan/user/controller/client/ClientAppUserWithdrawController.java +++ b/xinquan-modules/xinquan-user/src/main/java/com/xinquan/user/controller/client/ClientAppUserWithdrawController.java @@ -9,7 +9,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.xinquan.common.core.constant.CacheConstants; +import com.xinquan.common.core.constant.SecurityConstants; import com.xinquan.common.core.domain.R; +import com.xinquan.common.core.exception.ServiceException; import com.xinquan.common.core.utils.JuHeFuUtil; import com.xinquan.common.core.utils.WebUtils; import com.xinquan.common.core.utils.page.CollUtils; @@ -21,6 +23,7 @@ import com.xinquan.meditation.api.domain.Meditation; import com.xinquan.order.api.domain.Order; import com.xinquan.system.api.domain.*; +import com.xinquan.system.api.model.AppLoginUser; import com.xinquan.user.api.domain.dto.OrderListDTO; import com.xinquan.system.api.model.LoginUser; import com.xinquan.user.domain.export.WithdrawExport; @@ -284,7 +287,8 @@ String s = UuidUtils.generateUuid(); String replace = s.replace("-", ""); - appUserWithdraw.setCode(replace); + // 商户余额充值到用户余额 + appUserWithdraw.setCode("CZ"+replace); appUserWithdraw.setWithdrawTime(LocalDateTime.now()); appUserWithdraw.setCreateTime(LocalDateTime.now()); // 先扣去余额 @@ -295,11 +299,17 @@ appUserWalletRecord.setOrderId(appUserWithdraw.getId()); appUserWalletRecord.setAmount(new BigDecimal(money)); BigDecimal bigDecimal1 = new BigDecimal(money).setScale(2, RoundingMode.HALF_DOWN); - JuHeFuUtil.updateAccount(byId.getFenzhangId(),byId1.getCardholder(),byId1.getCellPhone(),byId1.getCardNo()); - JSONObject jsonObject = JuHeFuUtil.balancePay(replace, byId.getFenzhangId(), bigDecimal1 + "" + String s1 = JuHeFuUtil.updateAccount(byId.getFenzhangId(), byId1.getCardholder(), byId1.getCellPhone(), byId1.getCardNo()); + if (s1.contains("false")){ + // 修改报错 弹出提示 + return R.fail("银行卡信息或持卡人信息有误,请核对后输入"); + } + // 从商户余额分账到用户分账接收方 + JSONObject jsonObject = JuHeFuUtil.balancePay(appUserWithdraw.getCode(), byId.getFenzhangId(), bigDecimal1 + "" , "https://xq.xqzhihui.com/api/user/client/app-user-withdraw/base/callback"); if (jsonObject.getString("error_msg")!=null){ - return R.fail(jsonObject.getString("error_msg")); + return R.fail("系统繁忙,5分钟后重试"); +// return R.fail(jsonObject.getString("error_msg")); } appUserService.updateById(byId); appUserWalletRecordService.save(appUserWalletRecord); @@ -343,11 +353,14 @@ if (jsonObject.getString("type").equals("balancePay.succeeded")){ if (one!=null){ String s = UuidUtils.generateUuid(); + String replace = "TX"+s.replace("-", ""); + // 商户余额充值到用户余额 AppUser appUser = appUserService.getById(one.getAppUserId()); if (one.getWithdrawStatus()==1 || one.getWithdrawStatus()==2){ return; } - JSONObject jsonObject2 = JuHeFuUtil.balanceWithdraw(s, one.getAmount() + "", appUser.getFenzhangId(), + + JSONObject jsonObject2 = JuHeFuUtil.balanceWithdraw(replace, one.getAmount() + "", appUser.getFenzhangId(), "https://xq.xqzhihui.com/api/user/client/app-user-withdraw/base/callbackA"); if (jsonObject2.getString("error_msg")!=null){ // 调用失败 @@ -371,6 +384,7 @@ out.flush(); out.close(); } + one.setCode(replace); withdrawService.updateById(one); } PrintWriter out = response.getWriter(); @@ -427,6 +441,9 @@ AppUserWithdraw one = withdrawService.lambdaQuery().eq(AppUserWithdraw::getCode, string).one(); if (jsonObject.getString("type").equals("withdraw.succeeded")){ if (one!=null){ + if (one.getWithdrawStatus()==1){ + return; + } System.err.println("提现成功"); one.setWithdrawStatus(1); one.setSerialNo(jsonObject1.getString("withdraw_id")); @@ -480,6 +497,19 @@ // if (!appUserWithdraw.getCode().equals(code)) { // return R.fail("验证码不正确"); // } + if (com.xinquan.common.core.utils.StringUtils.isNotBlank(appUserWithdraw.getCellPhone()) && com.xinquan.common.core.utils.StringUtils.isNotBlank(appUserWithdraw.getCode())) { + String key = CacheConstants.ADD_CARD_PHONE_CODE_PREFIX + appUserWithdraw.getCellPhone(); + String code = redisService.getCacheObject(key); + // 万能验证码 + if (appUserWithdraw.getCode().equals("123456") || (com.xinquan.common.core.utils.StringUtils.isNotBlank(code) && code.equals( + appUserWithdraw.getCode()))) { + redisService.deleteObject(key); + }else{ + return R.fail("验证码不正确"); + } + }else{ + return R.fail("请输入验证码"); + } appUserBankService.save(appUserWithdraw); // 查询是否已经开户 AppUser byId = appUserService.getById(userId); @@ -488,10 +518,12 @@ long time = new Date().getTime(); String s = RandomUtil.randomNumbers(4); String s1 = "FZ" + time + s; - JuHeFuUtil.createUser(s1, appUserWithdraw.getCardholder(), "00", + String user = JuHeFuUtil.createUser(s1, appUserWithdraw.getCardholder(), "00", appUserWithdraw.getIdentityCard(), appUserWithdraw.getCellPhone(), appUserWithdraw.getCardNo()); - byId.setFenzhangId(s1); - appUserService.updateById(byId); + if (user.equals("success")){ + byId.setFenzhangId(s1); + appUserService.updateById(byId); + } } return R.ok(); } -- Gitblit v1.7.1