From 47267bb39808dc4b371df933c6aa1255c32a8840 Mon Sep 17 00:00:00 2001
From: zj <1772600164@qq.com>
Date: Fri, 26 Apr 2024 11:45:46 +0800
Subject: [PATCH] 1
---
src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java | 36 +++++++++++++++++++++++++-----------
1 files changed, 25 insertions(+), 11 deletions(-)
diff --git a/src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java b/src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java
index 64192e0..db8c88e 100644
--- a/src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java
@@ -3,6 +3,7 @@
import com.google.gson.Gson;
import com.nq.dao.*;
+import com.nq.enums.EConfigKey;
import com.nq.enums.EUserAssets;
import com.nq.pay.PayUtil;
import com.nq.pojo.*;
@@ -84,6 +85,11 @@
@Autowired
SiteSettingServiceImpl siteSettingService;
+ @Autowired
+ IStockConfigServices iStockConfigServices;
+
+ @Autowired
+ UserAssetsMapper userAssetsMapper;
@Transactional
public ServerResponse outMoney(String amt, String with_Pwd,String accsetType,HttpServletRequest request) throws Exception {
@@ -102,7 +108,7 @@
if (user.getIsLogin().intValue() == 1) {
return ServerResponse.createByErrorMsg("用户被锁定",request);
}
- if (StringUtils.isBlank(user.getRealName()) || StringUtils.isBlank(user.getIdCard())) {
+ if (user.getIsActive() != 2) {
return ServerResponse.createByErrorMsg("未实名认证",request);
}
UserBank userBank = this.iUserBankService.findUserBankByUserId(user.getId());
@@ -116,14 +122,12 @@
if ((new BigDecimal(amt)).compareTo(new BigDecimal(siteSetting.getWithMinAmt().intValue())) == -1) {
return ServerResponse.createByErrorMsg("Analog users cannot withdraw funds" + siteSetting.getWithMinAmt(),request);
}
- int with_time_begin = siteSetting.getWithTimeBegin().intValue();
- int with_time_end = siteSetting.getWithTimeEnd().intValue();
- SiteProduct siteProduct = iSiteProductService.getProductSetting();
- if(siteProduct.getHolidayDisplay()){
- return ServerResponse.createByErrorMsg("周末或节假日不允许提款!",request);
- }
- if (!WithDrawUtils.checkIsWithTime(with_time_begin, with_time_end)) {
- return ServerResponse.createByErrorMsg("撤销失败了。提现时间为" + with_time_begin + "点 - " + with_time_end + "点之间的",request);
+
+
+ String time = iStockConfigServices.queryByKey(EConfigKey.WITHDRAW_TIME_SETTING.getCode()).getCValue();
+
+ if (!WithDrawUtils.checkIsWithTime( Integer.parseInt(time.split("-")[0]), Integer.parseInt(time.split("-")[1]))) {
+ return ServerResponse.createByErrorMsg("撤销失败了。提现时间为" + time.split("-")[0] + "点 - " + time.split("-")[1] + "点之间的",request);
}
BigDecimal useAmt = iUserAssetsServices.getAvailableBalance(accsetType,user.getId());
BigDecimal tAmt = new BigDecimal(amt);
@@ -217,7 +221,12 @@
User user = this.userMapper.selectById(userWithdraw.getUserId());
- int updateUserCount = this.userMapper.updateById(user);
+ UserAssets userAssets = iUserAssetsServices.assetsByTypeAndUserId("IN", user.getId());
+ if (userAssets == null) {
+ return ServerResponse.createByErrorMsg("用户资金账户不存在");
+ }
+ userAssets.setAvailableBalance(userAssets.getAvailableBalance().add(userWithdraw.getWithAmt()));
+ int updateUserCount = userAssetsMapper.updateById(userAssets);
if (updateUserCount > 0) {
@@ -325,7 +334,12 @@
if (user == null) {
return ServerResponse.createByErrorMsg("用户不存在");
}
- int updateCount = this.userMapper.updateById(user);
+ UserAssets userAssets = iUserAssetsServices.assetsByTypeAndUserId("IN", user.getId());
+ if (userAssets == null) {
+ return ServerResponse.createByErrorMsg("用户资金账户不存在");
+ }
+ userAssets.setAvailableBalance(userAssets.getAvailableBalance().add(userWithdraw.getWithAmt()));
+ int updateCount = userAssetsMapper.updateById(userAssets);
if (updateCount > 0) {
log.info("提现失败,返还用户资金成功!");
} else {
--
Gitblit v1.9.3