From cd969de1f50903ca87deda67bff2d6fcc35b4107 Mon Sep 17 00:00:00 2001
From: zj <1772600164@qq.com>
Date: Sun, 07 Jun 2026 02:42:32 +0800
Subject: [PATCH] 1
---
src/main/java/com/nq/service/impl/UserStockSubscribeServiceImpl.java | 37 +---
target/classes/com/nq/utils/task/user/UserAssetAuditTask.class | 0
src/main/resources/mapper/UserWithdrawMapper.xml | 6
target/classes/com/nq/vo/user/UserInfoVO.class | 0
src/main/java/com/nq/utils/task/user/UserAssetAuditTask.java | 36 ++--
target/classes/com/nq/service/impl/UserRechargeServiceImpl.class | 0
src/main/java/com/nq/service/impl/UserPositionServiceImpl.java | 69 +++++--
target/classes/mapper/UserWithdrawMapper.xml | 6
target/classes/com/nq/vo/agent/AgentUserListVO.class | 0
src/main/java/com/nq/service/impl/UserServiceImpl.java | 93 ++++++++++-
src/main/java/com/nq/service/impl/UserRechargeServiceImpl.java | 24 +-
src/main/java/com/nq/vo/user/UserInfoVO.java | 2
target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst | 1
target/stock-0.0.1-SNAPSHOT.jar | 0
src/main/java/com/nq/dao/UserWithdrawMapper.java | 2
target/stock-0.0.1-SNAPSHOT.jar.original | 0
src/main/java/com/nq/service/impl/PayServiceImpl.java | 6
target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst | 1
src/main/java/com/nq/service/impl/FundsApplyServiceImpl.java | 9
src/main/resources/mapper/UserPositionMapper.xml | 12 +
target/classes/mapper/UserPositionMapper.xml | 12 +
target/classes/com/nq/dao/UserWithdrawMapper.class | 0
target/classes/com/nq/service/impl/UserStockSubscribeServiceImpl.class | 0
src/main/java/com/nq/utils/UserFundUtil.java | 107 +++++++++++++
target/classes/com/nq/service/impl/UserServiceImpl.class | 0
target/classes/com/nq/service/impl/PayServiceImpl.class | 0
target/classes/com/nq/service/impl/FundsApplyServiceImpl.class | 0
target/classes/com/nq/service/impl/UserPositionServiceImpl.class | 0
src/main/java/com/nq/vo/agent/AgentUserListVO.java | 9 +
29 files changed, 327 insertions(+), 105 deletions(-)
diff --git a/src/main/java/com/nq/dao/UserWithdrawMapper.java b/src/main/java/com/nq/dao/UserWithdrawMapper.java
index 459f225..21d968e 100644
--- a/src/main/java/com/nq/dao/UserWithdrawMapper.java
+++ b/src/main/java/com/nq/dao/UserWithdrawMapper.java
@@ -29,4 +29,6 @@
BigDecimal CountSpWithSumAmTodaytByState(Integer paramInteger);
int deleteByUserId(@Param("userId") Integer paramInteger);
+
+ BigDecimal sumPendingAmtByUserId(@Param("userId") Integer userId);
}
diff --git a/src/main/java/com/nq/service/impl/FundsApplyServiceImpl.java b/src/main/java/com/nq/service/impl/FundsApplyServiceImpl.java
index c790d7a..c776dd2 100644
--- a/src/main/java/com/nq/service/impl/FundsApplyServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/FundsApplyServiceImpl.java
@@ -10,6 +10,7 @@
import com.nq.service.IUserService;
import com.nq.utils.DateTimeUtil;
import com.nq.utils.KeyUtils;
+import com.nq.utils.UserFundUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -72,8 +73,7 @@
ret = fundsApplyMapper.insert(model);
if(ret>0){
//修改用户可用余额= 当前余额-支付金额
- BigDecimal reckon_enable = user_enable_amt.subtract(pay_amount);
- user.setEnableAmt(reckon_enable);
+ UserFundUtil.deductEnableAndWithdraw(user, pay_amount);
int updateUserCount = this.userMapper.updateByPrimaryKeySelective(user);
if (updateUserCount > 0) {
log.info("【用户交易下单】修改用户金额成功");
@@ -201,9 +201,8 @@
/* */
/* */ } else {
/* */
- /* 205 */ BigDecimal reckon_enable = user_enable_amt.add(fundsApply.getPayAmount());
- /* 206 */ user.setEnableAmt(reckon_enable);
- /* 207 */ int updateUserCount = this.userMapper.updateByPrimaryKeySelective(user);
+ /* 205 */ UserFundUtil.refundEnableAndWithdraw(user, fundsApply.getPayAmount());
+ /* 206 */ int updateUserCount = this.userMapper.updateByPrimaryKeySelective(user);
/* 208 */ if (updateUserCount > 0) {
/* 209 */ log.info("【配资审核未通过】修改用户金额成功");
/* 210 */ UserCashDetail ucd = new UserCashDetail();
diff --git a/src/main/java/com/nq/service/impl/PayServiceImpl.java b/src/main/java/com/nq/service/impl/PayServiceImpl.java
index 9372ad2..ee87fa9 100644
--- a/src/main/java/com/nq/service/impl/PayServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/PayServiceImpl.java
@@ -10,6 +10,7 @@
import com.nq.service.IUserService;
import com.nq.utils.KeyUtils;
import com.nq.utils.PropertiesUtil;
+import com.nq.utils.UserFundUtil;
import com.nq.utils.pay.CmcPayOuterRequestUtil;
import com.nq.utils.pay.CmcPayTool;
import com.nq.utils.pay.OcocnPayUtil;
@@ -291,10 +292,7 @@
if (updateCount > 0) {
log.info("后台通知,修改订单状态成功");
- BigDecimal total_amt = user.getUserAmt().add(userRecharge.getPayAmt());
- user.setUserAmt(total_amt);
- BigDecimal total_enable = user.getEnableAmt().add(userRecharge.getPayAmt());
- user.setEnableAmt(total_enable);
+ UserFundUtil.creditUserBalance(user, userRecharge.getPayAmt());
int updateUserCount = this.userMapper.updateByPrimaryKeySelective(user);
if (updateUserCount > 0) {
return ServerResponse.createBySuccessMsg("后台通知 处理成功");
diff --git a/src/main/java/com/nq/service/impl/UserPositionServiceImpl.java b/src/main/java/com/nq/service/impl/UserPositionServiceImpl.java
index 180937d..c37f859 100644
--- a/src/main/java/com/nq/service/impl/UserPositionServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/UserPositionServiceImpl.java
@@ -504,6 +504,11 @@
return ServerResponse.createBySuccess(buy_fee_amt);
}
+ /** T+0:可用资金变动时同步调整可取资金 */
+ private void applyEnableAndWithdrawChange(User user, BigDecimal enableBefore, BigDecimal enableAfter) {
+ UserFundUtil.applyEnableDelta(user, enableBefore, enableAfter);
+ }
+
/** 下单从两融可用资金扣除:保证金 + 买入手续费 */
private void deductUserEnableOnBuy(User user, BigDecimal buyDebit, BigDecimal margin, BigDecimal fee,
UserPosition position) throws Exception {
@@ -1194,7 +1199,7 @@
log.info("用戶平倉後的總資金 = {} , 可用資金 = {}", reckon_all, reckon_enable);
user.setUserAmt(reckon_all);
- user.setEnableAmt(reckon_enable);
+ applyEnableAndWithdrawChange(user, user_enable_amt, reckon_enable);
int updateUserCount = this.userMapper.updateByPrimaryKeySelective(user);
if (updateUserCount > 0) {
log.info("【用戶平倉】修改用戶金額成功");
@@ -1211,7 +1216,7 @@
ucd.setUserName(user.getRealName());
ucd.setDeType("总盈亏");
ucd.setDeAmt(all_profit);
- ucd.setDeSummary("卖出股票," + userPosition.getStockCode() + "/" + userPosition.getStockName() + ",占用本金:" + freez_amt + ",总手续费:" + all_fee_amt + ",盈亏:" + profitLoss + ",总盈亏:" + all_profit);
+ ucd.setDeSummary("卖出股票," + userPosition.getStockCode() + "/" + userPosition.getStockName() + ",占用本金:" + freez_amt + ",总手续费:" + order_fee_all + ",盈亏:" + profitLoss + ",总盈亏:" + all_profit);
ucd.setAddTime(new Date());
ucd.setIsRead(Integer.valueOf(0));
@@ -1430,7 +1435,7 @@
log.info("用戶平倉後的總資金 = {} , 可用資金 = {}", reckon_all, reckon_enable);
user.setUserAmt(reckon_all);
- user.setEnableAmt(reckon_enable);
+ applyEnableAndWithdrawChange(user, user_enable_amt, reckon_enable);
int updateUserCount = this.userMapper.updateByPrimaryKeySelective(user);
if (updateUserCount > 0) {
log.info("【用戶平倉】修改用戶金額成功");
@@ -1447,7 +1452,7 @@
ucd.setUserName(user.getRealName());
ucd.setDeType("总盈亏");
ucd.setDeAmt(all_profit);
- ucd.setDeSummary("卖出股票," + userPositionNew.getStockCode() + "/" + userPositionNew.getStockName() + ",占用本金:" + freez_amt + ",总手续费:" + all_fee_amt + ",递延费:" + 0 + ",印花稅:" + orderSpread + ",盈亏:" + profitLoss + ",总盈亏:" + all_profit);
+ ucd.setDeSummary("卖出股票," + userPositionNew.getStockCode() + "/" + userPositionNew.getStockName() + ",占用本金:" + freez_amt + ",总手续费:" + order_fee_all + ",递延费:" + 0 + ",印花稅:" + orderSpread + ",盈亏:" + profitLoss + ",总盈亏:" + all_profit);
ucd.setAddTime(new Date());
ucd.setIsRead(Integer.valueOf(0));
@@ -1540,7 +1545,7 @@
BigDecimal reckon_enable = user_enable_amt.subtract(marginAdd);
log.info("用户追加保证金后的总资金 = {} , 可用资金 = {}", user_all_amt, reckon_enable);
- user.setEnableAmt(reckon_enable);
+ applyEnableAndWithdrawChange(user, user_enable_amt, reckon_enable);
int updateUserCount = this.userMapper.updateByPrimaryKeySelective(user);
if (updateUserCount > 0) {
log.info("【用户平仓】修改用户金额成功");
@@ -2217,10 +2222,18 @@
adminPositionVO.setStockPlate(position.getStockPlate());
- PositionProfitVO positionProfitVO = getPositionProfitVO(position);
- adminPositionVO.setProfitAndLose(positionProfitVO.getProfitAndLose());
- adminPositionVO.setAllProfitAndLose(positionProfitVO.getAllProfitAndLose());
- adminPositionVO.setNow_price(positionProfitVO.getNowPrice());
+ if (position.getStatus() != null && position.getStatus().intValue() == 2) {
+ adminPositionVO.setProfitAndLose(position.getProfitAndLose());
+ adminPositionVO.setAllProfitAndLose(position.getAllProfitAndLose());
+ if (position.getSellOrderPrice() != null) {
+ adminPositionVO.setNow_price(position.getSellOrderPrice().toPlainString());
+ }
+ } else {
+ PositionProfitVO positionProfitVO = getPositionProfitVO(position);
+ adminPositionVO.setProfitAndLose(positionProfitVO.getProfitAndLose());
+ adminPositionVO.setAllProfitAndLose(positionProfitVO.getAllProfitAndLose());
+ adminPositionVO.setNow_price(positionProfitVO.getNowPrice());
+ }
return adminPositionVO;
@@ -2259,10 +2272,18 @@
agentPositionVO.setStockPlate(position.getStockPlate());
- PositionProfitVO positionProfitVO = getPositionProfitVO(position);
- agentPositionVO.setProfitAndLose(positionProfitVO.getProfitAndLose());
- agentPositionVO.setAllProfitAndLose(positionProfitVO.getAllProfitAndLose());
- agentPositionVO.setNow_price(positionProfitVO.getNowPrice());
+ if (position.getStatus() != null && position.getStatus().intValue() == 2) {
+ agentPositionVO.setProfitAndLose(position.getProfitAndLose());
+ agentPositionVO.setAllProfitAndLose(position.getAllProfitAndLose());
+ if (position.getSellOrderPrice() != null) {
+ agentPositionVO.setNow_price(position.getSellOrderPrice().toPlainString());
+ }
+ } else {
+ PositionProfitVO positionProfitVO = getPositionProfitVO(position);
+ agentPositionVO.setProfitAndLose(positionProfitVO.getProfitAndLose());
+ agentPositionVO.setAllProfitAndLose(positionProfitVO.getAllProfitAndLose());
+ agentPositionVO.setNow_price(positionProfitVO.getNowPrice());
+ }
return agentPositionVO;
@@ -2329,16 +2350,20 @@
BigDecimal orderTotalPrice = position.getOrderTotalPrice();
if (position.getSellOrderId() != null) {
-
- BigDecimal subPrice = position.getSellOrderPrice().subtract(position.getBuyOrderPrice());
-// profitAndLose = subPrice.multiply(new BigDecimal(position.getOrderNum().intValue())).multiply(new BigDecimal(position.getOrderLever())).setScale(2,4);
- profitAndLose = subPrice.multiply(new BigDecimal(position.getOrderNum().intValue())).setScale(2,4);
- if ("买跌".equals(position.getOrderDirection())) {
- profitAndLose = profitAndLose.negate();
+ if (Integer.valueOf(2).equals(position.getStatus())
+ && position.getProfitAndLose() != null
+ && position.getAllProfitAndLose() != null) {
+ profitAndLose = position.getProfitAndLose();
+ allProfitAndLose = position.getAllProfitAndLose();
+ } else {
+ BigDecimal subPrice = position.getSellOrderPrice().subtract(position.getBuyOrderPrice());
+ profitAndLose = subPrice.multiply(new BigDecimal(position.getOrderNum().intValue())).setScale(2, 4);
+ if ("买跌".equals(position.getOrderDirection())) {
+ profitAndLose = profitAndLose.negate();
+ }
+ allProfitAndLose = profitAndLose.subtract(position.getOrderFee()).subtract(position.getOrderSpread())
+ .subtract(position.getOrderStayFee()).subtract(position.getSpreadRatePrice());
}
-
-
- allProfitAndLose = profitAndLose.subtract(position.getOrderFee()).subtract(position.getOrderSpread()).subtract(position.getOrderStayFee()).subtract(position.getSpreadRatePrice());
} else {
StockListVO stockListVO = new StockListVO();
StockCoin stockCoin = new StockCoin();
diff --git a/src/main/java/com/nq/service/impl/UserRechargeServiceImpl.java b/src/main/java/com/nq/service/impl/UserRechargeServiceImpl.java
index 02364a1..983c6ef 100644
--- a/src/main/java/com/nq/service/impl/UserRechargeServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/UserRechargeServiceImpl.java
@@ -18,6 +18,7 @@
import com.nq.pojo.UserRecharge;
import com.nq.utils.DateTimeUtil;
import com.nq.utils.KeyUtils;
+import com.nq.utils.UserFundUtil;
import com.nq.utils.redis.RedisShardedPoolUtils;
import java.math.BigDecimal;
@@ -205,10 +206,8 @@
if (user == null) {
return ServerResponse.createByErrorMsg("用户不存在");
}
- BigDecimal userAmt_before = user.getUserAmt();
- BigDecimal enableAmt_before = user.getEnableAmt();
- user.setUserAmt(userAmt_before.add(userRecharge.getPayAmt()));
- user.setEnableAmt(enableAmt_before.add(userRecharge.getPayAmt()));
+ BigDecimal payAmt = userRecharge.getPayAmt();
+ UserFundUtil.creditUserBalance(user, payAmt);
int updateCount = this.userMapper.updateByPrimaryKeySelective(user);
if (updateCount > 0) {
log.info("1.修改用户资金成功");
@@ -234,8 +233,8 @@
ucd.setUserName(user.getRealName());
ucd.setDeType("用户充值");
ucd.setDeAmt(userRecharge.getPayAmt());
- ucd.setDeSummary("用户充值成功,充值前总金额:" + userAmt_before + ",充值后总金额:" + user.getUserAmt() + ",充值前可用:" + enableAmt_before + ",充值后可用:" + user
- .getEnableAmt());
+ ucd.setDeSummary("用户充值成功,充值前总金额:" + user.getUserAmt().subtract(payAmt) + ",充值后总金额:" + user.getUserAmt() + ",充值前可用:" + user.getEnableAmt().subtract(payAmt) + ",充值后可用:" + user
+ .getEnableAmt() + ",充值后可取:" + user.getEnaleWithdrawAmt());
ucd.setAddTime(new Date());
ucd.setIsRead(Integer.valueOf(0));
@@ -361,12 +360,9 @@
if (user == null) {
return ServerResponse.createByErrorMsg("用户不存在");
}
- BigDecimal user_amt = user.getUserAmt().add(userRecharge.getPayAmt());
- log.info("管理员确认订单成功,增加用户 {} 总资金,原金额 = {} , 增加后 = {}", new Object[]{user.getId(), user.getUserAmt(), user_amt});
- user.setUserAmt(user_amt);
- BigDecimal user_enable_amt = user.getEnableAmt().add(userRecharge.getPayAmt());
- log.info("管理员确认订单成功,增加用户 {} 可用资金,原金额 = {} , 增加后 = {}", new Object[]{user.getId(), user.getEnableAmt(), user_enable_amt});
- user.setEnableAmt(user_enable_amt);
+ UserFundUtil.creditUserBalance(user, userRecharge.getPayAmt());
+ log.info("管理员确认订单成功,用户 {} 总资金={} 可用={} 可取={}",
+ user.getId(), user.getUserAmt(), user.getEnableAmt(), user.getEnaleWithdrawAmt());
int updateCount = this.userMapper.updateByPrimaryKeySelective(user);
if (updateCount > 0) {
@@ -420,9 +416,7 @@
userRecharge.setPayChannel("2");
userRecharge.setOrderStatus(Integer.valueOf(1));
- user.setUserAmt(user.getUserAmt().add(new BigDecimal(amt.intValue())));
- user.setEnableAmt(user.getEnableAmt().add(new BigDecimal(amt.intValue())));
- user.setEnaleWithdrawAmt(user.getEnaleWithdrawAmt().add(new BigDecimal(amt.intValue())));
+ UserFundUtil.creditUserBalance(user, new BigDecimal(amt.intValue()));
this.userMapper.updateByPrimaryKeySelective(user);
} else if (state.intValue() == 2) {
userRecharge.setOrderStatus(Integer.valueOf(2));
diff --git a/src/main/java/com/nq/service/impl/UserServiceImpl.java b/src/main/java/com/nq/service/impl/UserServiceImpl.java
index 59ee1a7..cd96cf3 100644
--- a/src/main/java/com/nq/service/impl/UserServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/UserServiceImpl.java
@@ -14,6 +14,7 @@
import com.nq.utils.KeyUtils;
import com.nq.utils.PropertiesUtil;
import com.nq.utils.SymmetricCryptoUtil;
+import com.nq.utils.UserFundUtil;
import com.nq.utils.ip.IpUtils;
import com.nq.utils.ip.JuheIpApi;
import com.nq.utils.redis.CookieUtils;
@@ -106,6 +107,8 @@
IUserService iUserService;
@Autowired
UserPositionMapper userPositionMapper;
+ @Autowired
+ UserWithdrawMapper userWithdrawMapper;
@Autowired
IUserRechargeService userRechargeService;
@@ -388,7 +391,7 @@
User user = (User)JsonUtil.string2Obj(userJson, User.class);
User dbuser = this.userMapper.selectByPrimaryKey(user.getId());
RedisShardedPoolUtils.setEx(loginToken, JsonUtil.obj2String(dbuser), 9999);
- UserInfoVO userInfoVO = assembleUserInfoVO(dbuser);
+ UserInfoVO userInfoVO = assembleUserInfoVO(dbuser, true);
return ServerResponse.createBySuccess(userInfoVO);
}
@@ -674,7 +677,7 @@
BigDecimal enableIndexAmt = user.getEnableIndexAmt().add(new BigDecimal(amt.intValue()));
user.setUserAmt(userAmt);
- user.setEnableAmt(enableAmt);
+ UserFundUtil.debitEnableAndWithdraw(user, new BigDecimal(amt.intValue()));
user.setUserIndexAmt(userIndexAmt);
user.setEnableIndexAmt(enableIndexAmt);
int updateCount = this.userMapper.updateByPrimaryKeySelective(user);
@@ -693,12 +696,11 @@
}
BigDecimal userAmt = user.getUserAmt().add(new BigDecimal(amt.intValue()));
- BigDecimal enableAmt = user.getEnableAmt().add(new BigDecimal(amt.intValue()));
BigDecimal userIndexAmt = user.getUserIndexAmt().subtract(new BigDecimal(amt.intValue()));
BigDecimal enableIndexAmt = user.getEnableIndexAmt().subtract(new BigDecimal(amt.intValue()));
user.setUserAmt(userAmt);
- user.setEnableAmt(enableAmt);
+ UserFundUtil.creditEnableAndWithdraw(user, new BigDecimal(amt.intValue()));
user.setUserIndexAmt(userIndexAmt);
user.setEnableIndexAmt(enableIndexAmt);
int updateCount = this.userMapper.updateByPrimaryKeySelective(user);
@@ -717,12 +719,11 @@
}
BigDecimal userAmt = user.getUserAmt().subtract(new BigDecimal(amt.intValue()));
- BigDecimal enableAmt = user.getEnableAmt().subtract(new BigDecimal(amt.intValue()));
BigDecimal userFutAmt = user.getUserFutAmt().add(new BigDecimal(amt.intValue()));
BigDecimal enableFutAmt = user.getEnableFutAmt().add(new BigDecimal(amt.intValue()));
user.setUserAmt(userAmt);
- user.setEnableAmt(enableAmt);
+ UserFundUtil.debitEnableAndWithdraw(user, new BigDecimal(amt.intValue()));
user.setUserFutAmt(userFutAmt);
user.setEnableFutAmt(enableFutAmt);
int updateCount = this.userMapper.updateByPrimaryKeySelective(user);
@@ -741,12 +742,11 @@
}
BigDecimal userAmt = user.getUserAmt().add(new BigDecimal(amt.intValue()));
- BigDecimal enableAmt = user.getEnableAmt().add(new BigDecimal(amt.intValue()));
BigDecimal userFutAmt = user.getUserFutAmt().subtract(new BigDecimal(amt.intValue()));
BigDecimal enableFutAmt = user.getEnableFutAmt().subtract(new BigDecimal(amt.intValue()));
user.setUserAmt(userAmt);
- user.setEnableAmt(enableAmt);
+ UserFundUtil.creditEnableAndWithdraw(user, new BigDecimal(amt.intValue()));
user.setUserFutAmt(userFutAmt);
user.setEnableFutAmt(enableFutAmt);
@@ -1569,18 +1569,30 @@
List<User> users = this.userMapper.listByAdmin(realName, phone, agentId, accountType);
- for(User user:users){
+ List<UserInfoVO> voList = Lists.newArrayListWithCapacity(users.size());
+ for (User user : users) {
user.setUserPwd("");
+ voList.add(assembleUserInfoVO(user, false));
}
PageInfo pageInfo = new PageInfo(users);
+ pageInfo.setList(voList);
return ServerResponse.createBySuccess(pageInfo);
}
- public ServerResponse findByUserId(Integer userId) { return ServerResponse.createBySuccess(this.userMapper.selectByPrimaryKey(userId)); }
+ public ServerResponse findByUserId(Integer userId) {
+ if (userId == null) {
+ return ServerResponse.createByErrorMsg("用户ID不能为空");
+ }
+ User user = this.userMapper.selectByPrimaryKey(userId);
+ if (user == null) {
+ return ServerResponse.createByErrorMsg("用户不存在");
+ }
+ return ServerResponse.createBySuccess(assembleUserInfoVO(user, false));
+ }
@@ -1631,7 +1643,17 @@
} else {
return ServerResponse.createByErrorMsg("不存在此操作");
}
- user.setEnableAmt(sh_amt_back);
+ BigDecimal amtDecimal = new BigDecimal(amt);
+ if (direction.intValue() == 0) {
+ UserFundUtil.creditUserBalance(user, amtDecimal);
+ } else if (direction.intValue() == 1) {
+ user.setEnableAmt(sh_amt_back);
+ BigDecimal withdrawAmt = user.getEnaleWithdrawAmt() == null ? BigDecimal.ZERO : user.getEnaleWithdrawAmt();
+ BigDecimal newWithdraw = withdrawAmt.subtract(amtDecimal);
+ user.setEnaleWithdrawAmt(newWithdraw.compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : newWithdraw);
+ } else {
+ user.setEnableAmt(sh_amt_back);
+ }
// BigDecimal hk_amt = user.getHkAmt();
//
@@ -1839,6 +1861,11 @@
agentUserListVO.setUserAmt(user.getUserAmt());
agentUserListVO.setEnableAmt(user.getEnableAmt());
+ BigDecimal pendingWithdrawAmt = userWithdrawMapper.sumPendingAmtByUserId(user.getId());
+ BigDecimal resolvedWithdrawAmt = UserFundUtil.resolveWithdrawAmt(
+ user.getEnableAmt(), user.getEnaleWithdrawAmt(), pendingWithdrawAmt);
+ agentUserListVO.setEnaleWithdrawAmt(resolvedWithdrawAmt);
+
agentUserListVO.setUserIndexAmt(user.getUserIndexAmt());
agentUserListVO.setEnableIndexAmt(user.getEnableIndexAmt());
@@ -1852,6 +1879,21 @@
BigDecimal allFreezAmt = positionVO.getAllFreezAmt();
agentUserListVO.setAllProfitAndLose(allProfitAndLose);
agentUserListVO.setAllFreezAmt(allFreezAmt);
+
+ BigDecimal openBuyFees = BigDecimal.ZERO;
+ List<UserPosition> openPositions = this.iUserPositionService.findPositionByUserIdAndSellIdIsNull(user.getId());
+ if (openPositions != null) {
+ for (UserPosition position : openPositions) {
+ if (position.getOrderFee() != null) {
+ openBuyFees = openBuyFees.add(position.getOrderFee());
+ }
+ }
+ }
+ BigDecimal enableAmt = user.getEnableAmt() == null ? BigDecimal.ZERO : user.getEnableAmt();
+ BigDecimal freezAmt = allFreezAmt == null ? BigDecimal.ZERO : allFreezAmt;
+ BigDecimal profitAndLose = allProfitAndLose == null ? BigDecimal.ZERO : allProfitAndLose;
+ BigDecimal userAllAmt = enableAmt.add(freezAmt).add(profitAndLose).add(openBuyFees);
+ agentUserListVO.setUserAmt(userAllAmt.setScale(2, RoundingMode.HALF_UP));
BigDecimal forceLine = forcePercent.multiply(allFreezAmt);
forceLine = forceLine.add(user.getEnableAmt());
@@ -1890,6 +1932,11 @@
}
private UserInfoVO assembleUserInfoVO(User user) {
+ return assembleUserInfoVO(user, true);
+ }
+
+ /** 与用户端 getUserInfo 一致的账户资产展示 */
+ private UserInfoVO assembleUserInfoVO(User user, boolean persistWithdrawHeal) {
UserInfoVO userInfoVO = new UserInfoVO();
userInfoVO.setId(user.getId());
@@ -1902,6 +1949,7 @@
userInfoVO.setAccountType(user.getAccountType());
userInfoVO.setRecomPhone(user.getRecomPhone());
userInfoVO.setIsLock(user.getIsLock());
+ userInfoVO.setIsLogin(user.getIsLogin());
userInfoVO.setRegTime(user.getRegTime());
userInfoVO.setRegIp(user.getRegIp());
userInfoVO.setRegAddress(user.getRegAddress());
@@ -1914,6 +1962,15 @@
userInfoVO.setEnableAmt(user.getEnableAmt());
userInfoVO.setTradingAmount(user.getTradingAmount());
+ BigDecimal pendingWithdrawAmt = userWithdrawMapper.sumPendingAmtByUserId(user.getId());
+ BigDecimal resolvedWithdrawAmt = UserFundUtil.resolveWithdrawAmt(
+ user.getEnableAmt(), user.getEnaleWithdrawAmt(), pendingWithdrawAmt);
+ if (persistWithdrawHeal
+ && (user.getEnaleWithdrawAmt() == null || resolvedWithdrawAmt.compareTo(user.getEnaleWithdrawAmt()) != 0)) {
+ user.setEnaleWithdrawAmt(resolvedWithdrawAmt);
+ this.userMapper.updateByPrimaryKeySelective(user);
+ }
+ userInfoVO.setEnaleWithdrawAmt(resolvedWithdrawAmt);
PositionVO positionVO = this.iUserPositionService.findUserPositionAllProfitAndLose(user.getId());
userInfoVO.setAllFreezAmt(positionVO.getAllFreezAmt());
@@ -1936,7 +1993,6 @@
BigDecimal userAllAmt = enableAmt.add(allFreezAmt).add(allProfitAndLose).add(openBuyFees);
userInfoVO.setEnableIndexAmt(user.getEnableIndexAmt());
- userInfoVO.setEnaleWithdrawAmt(user.getEnaleWithdrawAmt());
userInfoVO.setIsSignedContract(user.getIsSignedContract());
userInfoVO.setIsSignedAgreement(user.getIsSignedAgreement());
userInfoVO.setHkAmt(user.getHkAmt());
@@ -2113,7 +2169,18 @@
@Override
public void updateUserAmt(Double amt, Integer user_id) {
- userMapper.updateUserAmt(amt, user_id);
+ if (amt == null || user_id == null || amt <= 0) {
+ return;
+ }
+ User user = this.userMapper.selectByPrimaryKey(user_id);
+ if (user == null) {
+ log.error("updateUserAmt 用户不存在 userId={}", user_id);
+ return;
+ }
+ UserFundUtil.creditUserBalance(user, BigDecimal.valueOf(amt));
+ this.userMapper.updateByPrimaryKeySelective(user);
+ log.info("updateUserAmt 充值入账 userId={} amt={} enable={} withdraw={}",
+ user_id, amt, user.getEnableAmt(), user.getEnaleWithdrawAmt());
}
diff --git a/src/main/java/com/nq/service/impl/UserStockSubscribeServiceImpl.java b/src/main/java/com/nq/service/impl/UserStockSubscribeServiceImpl.java
index 636d57c..f8f8740 100644
--- a/src/main/java/com/nq/service/impl/UserStockSubscribeServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/UserStockSubscribeServiceImpl.java
@@ -13,6 +13,7 @@
import com.nq.service.*;
import com.nq.utils.DateTimeUtil;
import com.nq.utils.KeyUtils;
+import com.nq.utils.UserFundUtil;
import com.nq.utils.PropertiesUtil;
import com.nq.utils.redis.CookieUtils;
import com.nq.utils.redis.JsonUtil;
@@ -146,7 +147,8 @@
if (user.getEnableAmt().compareTo(new BigDecimal(model.getApplyNums()).multiply(stockSubscribe.getPrice())) < 0) {
return ServerResponse.createByErrorMsg("用户可用余额不足,申购条件不满足");
}
- user.setEnableAmt(user.getEnableAmt().subtract(new BigDecimal(model.getApplyNums()).multiply(stockSubscribe.getPrice())));
+ BigDecimal applyAmt = new BigDecimal(model.getApplyNums()).multiply(stockSubscribe.getPrice());
+ UserFundUtil.deductEnableAndWithdraw(user, applyAmt);
if (user.getDjzj() != null) {
user.setDjzj(user.getDjzj().add(new BigDecimal(model.getApplyNums()).multiply(stockSubscribe.getPrice())));
} else {
@@ -250,7 +252,7 @@
Integer refund = refundenum * userStockSubscribe.getBuyPrice().intValue();
// log.info("退还金额"+refund);
user.setEnableAmt(user.getEnableAmt().add(BigDecimal.valueOf(refund)));
- user.setEnaleWithdrawAmt(user.getEnaleWithdrawAmt().add(BigDecimal.valueOf(refund)));
+ user.setEnaleWithdrawAmt((user.getEnaleWithdrawAmt() == null ? BigDecimal.ZERO : user.getEnaleWithdrawAmt()).add(BigDecimal.valueOf(refund)));
user.setDjzj(user.getDjzj().subtract(BigDecimal.valueOf(refund)));
int ret1 = userMapper.updateByPrimaryKey(user);
if (ret1 <= 0) {
@@ -275,7 +277,7 @@
iSiteMessageService.insert(siteMessage);
} else {
User user = userMapper.selectByPrimaryKey(userStockSubscribe.getUserId());
- user.setEnableAmt(user.getEnableAmt().add(userStockSubscribe.getBond()));
+ UserFundUtil.refundEnableAndWithdraw(user, userStockSubscribe.getBond());
user.setDjzj(user.getDjzj().subtract(userStockSubscribe.getBond()));
userMapper.updateByPrimaryKey(user);
SiteMessage siteMessage = new SiteMessage();
@@ -526,14 +528,13 @@
}
// log.info("原可用資金"+user1.getEnableAmt());
BigDecimal enableAmt = user1.getEnableAmt().subtract(userStockSubscribe.getBond());
- BigDecimal enaleWithdrawAmt = user1.getEnaleWithdrawAmt().subtract(userStockSubscribe.getBond());
- if (enaleWithdrawAmt.compareTo(userStockSubscribe.getBond()) < 0) {
- //若可取資金小於保證金,但是可用資金充足,則令當前可取資金為0
+ BigDecimal withdrawAmt = user1.getEnaleWithdrawAmt() == null ? BigDecimal.ZERO : user1.getEnaleWithdrawAmt();
+ BigDecimal bond = userStockSubscribe.getBond();
+ if (withdrawAmt.compareTo(bond) < 0) {
user1.setEnaleWithdrawAmt(BigDecimal.ZERO);
} else {
- user1.setEnaleWithdrawAmt(enaleWithdrawAmt);
+ user1.setEnaleWithdrawAmt(withdrawAmt.subtract(bond));
}
-// log.info("enableAmt" + enableAmt);
user1.setEnableAmt(enableAmt);
// log.info("可用資金" + user1.getEnableAmt()+"保證金"+userStockSubscribe.getBond()+"原djzj"+user1.getDjzj());
if (user1.getDjzj() != null) {
@@ -647,19 +648,7 @@
}
BigDecimal totalNewStockPrice = new BigDecimal(num).multiply(stockSubscribe.getPrice());
- user.setEnableAmt(user.getEnableAmt().subtract(totalNewStockPrice));
- BigDecimal user_enable_withdraw_amt = user.getEnaleWithdrawAmt();
- //修改用戶可取余額=當前可取余額-下單總金額
- int compareUserWithdrawAmtInt = user_enable_withdraw_amt.compareTo(totalNewStockPrice);
- if (compareUserWithdrawAmtInt == -1) {
- //若可取余額小於下單總額,但是可用余額充足,令可取余額為0
- user.setEnaleWithdrawAmt(BigDecimal.ZERO);
- } else {
- user_enable_withdraw_amt = user_enable_withdraw_amt.subtract(totalNewStockPrice);
- user.setEnaleWithdrawAmt(user_enable_withdraw_amt);
- }
-
- // if (user.getDjzj()!=null) {
+ UserFundUtil.deductEnableAndWithdraw(user, totalNewStockPrice);
// user.setDjzj(user.getDjzj().add(new BigDecimal(model.getApplyNums()).multiply(stockSubscribe.getPrice())));
// }else
// {
@@ -755,8 +744,7 @@
if (userStockSubscribe.getStatus() == 1) {
//审核失败退款
if ("2".equals(status)) {
- user.setEnableAmt(user.getEnableAmt().add(userStockSubscribe.getBond()));
- user.setEnaleWithdrawAmt(user.getEnaleWithdrawAmt().add(userStockSubscribe.getBond()));
+ UserFundUtil.refundEnableAndWithdraw(user, userStockSubscribe.getBond());
int ret = userMapper.updateById(user);
if (ret <= 0) {
return ServerResponse.createByErrorMsg("未知原因,审核失败");
@@ -872,8 +860,7 @@
userStockSubscribe.setApplyNumber(Integer.valueOf(num));
this.userStockSubscribeMapper.updateById(userStockSubscribe);
BigDecimal reimburse = new BigDecimal(userStockSubscribe.getApplyNums() - Integer.parseInt(num)).multiply(userStockSubscribe.getBuyPrice());
- user.setEnableAmt(user.getEnableAmt().add(reimburse));
- user.setEnaleWithdrawAmt(user.getEnaleWithdrawAmt().add(reimburse));
+ UserFundUtil.refundEnableAndWithdraw(user, reimburse);
int ret = userMapper.updateById(user);
if (ret <= 0) {
return ServerResponse.createByErrorMsg("未知原因,审核失败");
diff --git a/src/main/java/com/nq/utils/UserFundUtil.java b/src/main/java/com/nq/utils/UserFundUtil.java
new file mode 100644
index 0000000..6c948a0
--- /dev/null
+++ b/src/main/java/com/nq/utils/UserFundUtil.java
@@ -0,0 +1,107 @@
+package com.nq.utils;
+
+import com.nq.pojo.User;
+
+import java.math.BigDecimal;
+
+public final class UserFundUtil {
+
+ private UserFundUtil() {
+ }
+
+ /** T+0:充值/入款时同步增加总资金、可用、可取 */
+ public static void creditUserBalance(User user, BigDecimal amt) {
+ if (user == null || amt == null || amt.compareTo(BigDecimal.ZERO) <= 0) {
+ return;
+ }
+ BigDecimal userAmt = user.getUserAmt() == null ? BigDecimal.ZERO : user.getUserAmt();
+ BigDecimal enableAmt = user.getEnableAmt() == null ? BigDecimal.ZERO : user.getEnableAmt();
+ BigDecimal withdrawAmt = user.getEnaleWithdrawAmt() == null ? BigDecimal.ZERO : user.getEnaleWithdrawAmt();
+ user.setUserAmt(userAmt.add(amt));
+ user.setEnableAmt(enableAmt.add(amt));
+ user.setEnaleWithdrawAmt(withdrawAmt.add(amt));
+ }
+
+ /** T+0:扣款时同步减少可用与可取(可取不低于 0) */
+ public static void debitUserBalance(User user, BigDecimal amt) {
+ if (user == null || amt == null || amt.compareTo(BigDecimal.ZERO) <= 0) {
+ return;
+ }
+ BigDecimal enableAmt = user.getEnableAmt() == null ? BigDecimal.ZERO : user.getEnableAmt();
+ BigDecimal withdrawAmt = user.getEnaleWithdrawAmt() == null ? BigDecimal.ZERO : user.getEnaleWithdrawAmt();
+ user.setEnableAmt(enableAmt.subtract(amt));
+ BigDecimal newWithdraw = withdrawAmt.subtract(amt);
+ user.setEnaleWithdrawAmt(newWithdraw.compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : newWithdraw);
+ }
+
+ /** T+0:仅同步可用与可取(不动总资金),用于账户间划转等 */
+ public static void creditEnableAndWithdraw(User user, BigDecimal amt) {
+ if (user == null || amt == null || amt.compareTo(BigDecimal.ZERO) <= 0) {
+ return;
+ }
+ BigDecimal enableAmt = user.getEnableAmt() == null ? BigDecimal.ZERO : user.getEnableAmt();
+ BigDecimal withdrawAmt = user.getEnaleWithdrawAmt() == null ? BigDecimal.ZERO : user.getEnaleWithdrawAmt();
+ user.setEnableAmt(enableAmt.add(amt));
+ user.setEnaleWithdrawAmt(withdrawAmt.add(amt));
+ }
+
+ /** T+0:仅扣减可用与可取(不动总资金) */
+ public static void debitEnableAndWithdraw(User user, BigDecimal amt) {
+ debitUserBalance(user, amt);
+ }
+
+ /** T+0:可用变动时同步调整可取(平仓/追加保证金等) */
+ public static void applyEnableDelta(User user, BigDecimal enableBefore, BigDecimal enableAfter) {
+ if (user == null || enableBefore == null || enableAfter == null) {
+ return;
+ }
+ user.setEnableAmt(enableAfter);
+ BigDecimal delta = enableAfter.subtract(enableBefore);
+ BigDecimal withdrawAmt = user.getEnaleWithdrawAmt() == null ? BigDecimal.ZERO : user.getEnaleWithdrawAmt();
+ BigDecimal newWithdraw = withdrawAmt.add(delta);
+ if (newWithdraw.compareTo(BigDecimal.ZERO) < 0) {
+ newWithdraw = BigDecimal.ZERO;
+ }
+ user.setEnaleWithdrawAmt(newWithdraw);
+ }
+
+ /** T+0:扣款时同步扣减可用与可取,可取不足时归零 */
+ public static void deductEnableAndWithdraw(User user, BigDecimal amt) {
+ if (user == null || amt == null || amt.compareTo(BigDecimal.ZERO) <= 0) {
+ return;
+ }
+ BigDecimal enableAmt = user.getEnableAmt() == null ? BigDecimal.ZERO : user.getEnableAmt();
+ user.setEnableAmt(enableAmt.subtract(amt));
+ BigDecimal withdrawAmt = user.getEnaleWithdrawAmt() == null ? BigDecimal.ZERO : user.getEnaleWithdrawAmt();
+ if (withdrawAmt.compareTo(amt) < 0) {
+ user.setEnaleWithdrawAmt(BigDecimal.ZERO);
+ } else {
+ user.setEnaleWithdrawAmt(withdrawAmt.subtract(amt));
+ }
+ }
+
+ /** T+0:退款时同步增加可用与可取 */
+ public static void refundEnableAndWithdraw(User user, BigDecimal amt) {
+ creditEnableAndWithdraw(user, amt);
+ }
+
+ /**
+ * T+0 可取资金解析:可用减去待审核提现冻结为下限,避免 T+1 遗留数据导致可取为 0。
+ */
+ public static BigDecimal resolveWithdrawAmt(BigDecimal enableAmt, BigDecimal withdrawAmt, BigDecimal pendingWithdrawAmt) {
+ BigDecimal enable = enableAmt == null ? BigDecimal.ZERO : enableAmt;
+ BigDecimal withdraw = withdrawAmt == null ? BigDecimal.ZERO : withdrawAmt;
+ BigDecimal pending = pendingWithdrawAmt == null ? BigDecimal.ZERO : pendingWithdrawAmt;
+ BigDecimal floor = enable.subtract(pending);
+ if (floor.compareTo(BigDecimal.ZERO) < 0) {
+ floor = BigDecimal.ZERO;
+ }
+ if (withdraw.compareTo(floor) < 0) {
+ withdraw = floor;
+ }
+ if (withdraw.compareTo(enable) > 0) {
+ withdraw = enable;
+ }
+ return withdraw;
+ }
+}
diff --git a/src/main/java/com/nq/utils/task/user/UserAssetAuditTask.java b/src/main/java/com/nq/utils/task/user/UserAssetAuditTask.java
index 3e14b71..529f263 100644
--- a/src/main/java/com/nq/utils/task/user/UserAssetAuditTask.java
+++ b/src/main/java/com/nq/utils/task/user/UserAssetAuditTask.java
@@ -1,26 +1,23 @@
package com.nq.utils.task.user;
+import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
-import com.nq.common.ServerResponse;
import com.nq.dao.UserMapper;
import com.nq.pojo.User;
-import com.nq.service.IUserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
+import java.math.BigDecimal;
import java.util.List;
/**
- * 用户资产清算模块,每天非节假日晚上8点固定的清算可用和可取资金
+ * 用户资产清算:T+0 下仅修正可取资金超过可用的情况,不再将可用全量同步为可取
*/
@Component
public class UserAssetAuditTask {
-
- @Autowired
- private IUserService iUserService;
@Autowired
private UserMapper userMapper;
@@ -32,19 +29,22 @@
*/
@Scheduled(cron = "0 0 20 * * MON-FRI")
public void doAuditTask(){
- int pageNo=1;
- boolean hasNextPage=true;
- while (hasNextPage&&pageNo<=300){
- ServerResponse serverResponse = iUserService.listByAdmin(null, null, null, null, pageNo, 30,null);
- PageInfo pageInfo = (PageInfo) serverResponse.getData();
- hasNextPage=pageInfo.isHasNextPage();
+ int pageNo = 1;
+ boolean hasNextPage = true;
+ while (hasNextPage && pageNo <= 300) {
+ PageHelper.startPage(pageNo, 30);
+ List<User> list = userMapper.listByAdmin(null, null, null, null);
+ PageInfo<User> pageInfo = new PageInfo<>(list);
+ hasNextPage = pageInfo.isHasNextPage();
pageNo++;
- List<User> list = pageInfo.getList();
- for(User u:list){
- //可用资金复制到可取资金操作
- u.setEnaleWithdrawAmt(u.getEnableAmt());
- userMapper.updateByPrimaryKeySelective(u);
- log.info("[清算]id:{},withdraw:{}",u.getId(),u.getEnaleWithdrawAmt());
+ for (User u : list) {
+ BigDecimal enable = u.getEnableAmt() == null ? BigDecimal.ZERO : u.getEnableAmt();
+ BigDecimal withdraw = u.getEnaleWithdrawAmt() == null ? BigDecimal.ZERO : u.getEnaleWithdrawAmt();
+ if (withdraw.compareTo(enable) > 0) {
+ u.setEnaleWithdrawAmt(enable);
+ userMapper.updateByPrimaryKeySelective(u);
+ log.info("[清算]id:{},withdraw capped to:{}", u.getId(), enable);
+ }
}
}
}
diff --git a/src/main/java/com/nq/vo/agent/AgentUserListVO.java b/src/main/java/com/nq/vo/agent/AgentUserListVO.java
index 7b9160d..1ec0426 100644
--- a/src/main/java/com/nq/vo/agent/AgentUserListVO.java
+++ b/src/main/java/com/nq/vo/agent/AgentUserListVO.java
@@ -41,6 +41,7 @@
private BigDecimal userAmt;
private BigDecimal enableAmt;
+ private BigDecimal enaleWithdrawAmt;
private BigDecimal forceLine;
private BigDecimal allProfitAndLose;
private BigDecimal allFreezAmt;
@@ -113,6 +114,10 @@
public void setEnableAmt(BigDecimal enableAmt) {
this.enableAmt = enableAmt;
+ }
+
+ public void setEnaleWithdrawAmt(BigDecimal enaleWithdrawAmt) {
+ this.enaleWithdrawAmt = enaleWithdrawAmt;
}
public void setForceLine(BigDecimal forceLine) {
@@ -410,6 +415,10 @@
return this.enableAmt;
}
+ public BigDecimal getEnaleWithdrawAmt() {
+ return this.enaleWithdrawAmt;
+ }
+
public BigDecimal getForceLine() {
return this.forceLine;
}
diff --git a/src/main/java/com/nq/vo/user/UserInfoVO.java b/src/main/java/com/nq/vo/user/UserInfoVO.java
index 84445de..d9e904e 100644
--- a/src/main/java/com/nq/vo/user/UserInfoVO.java
+++ b/src/main/java/com/nq/vo/user/UserInfoVO.java
@@ -78,8 +78,8 @@
private BigDecimal historyProfitLoss;
private String isSignedContract;
-
private String isSignedAgreement;
+ private Integer isLogin;
public void setAgentId(Integer agentId) {
this.agentId = agentId;
diff --git a/src/main/resources/mapper/UserPositionMapper.xml b/src/main/resources/mapper/UserPositionMapper.xml
index 20db7a5..50034eb 100644
--- a/src/main/resources/mapper/UserPositionMapper.xml
+++ b/src/main/resources/mapper/UserPositionMapper.xml
@@ -519,7 +519,17 @@
and agent_id = #{searchId}
</if>
<if test="state != null">
- and status = #{state, jdbcType=INTEGER}
+ <choose>
+ <when test="state == 0">
+ and status = 1
+ </when>
+ <when test="state == 1">
+ and status = 2
+ </when>
+ <otherwise>
+ and status = #{state, jdbcType=INTEGER}
+ </otherwise>
+ </choose>
</if>
<if test="userId != null and userId != '' ">
and user_id = #{userId}
diff --git a/src/main/resources/mapper/UserWithdrawMapper.xml b/src/main/resources/mapper/UserWithdrawMapper.xml
index c4997e9..93fd766 100644
--- a/src/main/resources/mapper/UserWithdrawMapper.xml
+++ b/src/main/resources/mapper/UserWithdrawMapper.xml
@@ -281,5 +281,11 @@
DELETE FROM user_withdraw WHERE user_id = #{userId}
</delete>
+ <select id="sumPendingAmtByUserId" resultType="java.math.BigDecimal">
+ select ifnull(sum(with_amt), 0)
+ from user_withdraw
+ where user_id = #{userId}
+ and with_status = 0
+ </select>
</mapper>
\ No newline at end of file
diff --git a/target/classes/com/nq/dao/UserWithdrawMapper.class b/target/classes/com/nq/dao/UserWithdrawMapper.class
index df3289d..fe8bc75 100644
--- a/target/classes/com/nq/dao/UserWithdrawMapper.class
+++ b/target/classes/com/nq/dao/UserWithdrawMapper.class
Binary files differ
diff --git a/target/classes/com/nq/service/impl/FundsApplyServiceImpl.class b/target/classes/com/nq/service/impl/FundsApplyServiceImpl.class
index 420b64e..82e2a11 100644
--- a/target/classes/com/nq/service/impl/FundsApplyServiceImpl.class
+++ b/target/classes/com/nq/service/impl/FundsApplyServiceImpl.class
Binary files differ
diff --git a/target/classes/com/nq/service/impl/PayServiceImpl.class b/target/classes/com/nq/service/impl/PayServiceImpl.class
index f051090..cdca2e9 100644
--- a/target/classes/com/nq/service/impl/PayServiceImpl.class
+++ b/target/classes/com/nq/service/impl/PayServiceImpl.class
Binary files differ
diff --git a/target/classes/com/nq/service/impl/UserPositionServiceImpl.class b/target/classes/com/nq/service/impl/UserPositionServiceImpl.class
index de1e216..5cc37c5 100644
--- a/target/classes/com/nq/service/impl/UserPositionServiceImpl.class
+++ b/target/classes/com/nq/service/impl/UserPositionServiceImpl.class
Binary files differ
diff --git a/target/classes/com/nq/service/impl/UserRechargeServiceImpl.class b/target/classes/com/nq/service/impl/UserRechargeServiceImpl.class
index 6a3bb3c..996d83b 100644
--- a/target/classes/com/nq/service/impl/UserRechargeServiceImpl.class
+++ b/target/classes/com/nq/service/impl/UserRechargeServiceImpl.class
Binary files differ
diff --git a/target/classes/com/nq/service/impl/UserServiceImpl.class b/target/classes/com/nq/service/impl/UserServiceImpl.class
index 541e660..2df2063 100644
--- a/target/classes/com/nq/service/impl/UserServiceImpl.class
+++ b/target/classes/com/nq/service/impl/UserServiceImpl.class
Binary files differ
diff --git a/target/classes/com/nq/service/impl/UserStockSubscribeServiceImpl.class b/target/classes/com/nq/service/impl/UserStockSubscribeServiceImpl.class
index 0254893..b80c3e0 100644
--- a/target/classes/com/nq/service/impl/UserStockSubscribeServiceImpl.class
+++ b/target/classes/com/nq/service/impl/UserStockSubscribeServiceImpl.class
Binary files differ
diff --git a/target/classes/com/nq/utils/task/user/UserAssetAuditTask.class b/target/classes/com/nq/utils/task/user/UserAssetAuditTask.class
index 6d38e7a..a329c9a 100644
--- a/target/classes/com/nq/utils/task/user/UserAssetAuditTask.class
+++ b/target/classes/com/nq/utils/task/user/UserAssetAuditTask.class
Binary files differ
diff --git a/target/classes/com/nq/vo/agent/AgentUserListVO.class b/target/classes/com/nq/vo/agent/AgentUserListVO.class
index cf239a1..613a42b 100644
--- a/target/classes/com/nq/vo/agent/AgentUserListVO.class
+++ b/target/classes/com/nq/vo/agent/AgentUserListVO.class
Binary files differ
diff --git a/target/classes/com/nq/vo/user/UserInfoVO.class b/target/classes/com/nq/vo/user/UserInfoVO.class
index 343ed00..60880cb 100644
--- a/target/classes/com/nq/vo/user/UserInfoVO.class
+++ b/target/classes/com/nq/vo/user/UserInfoVO.class
Binary files differ
diff --git a/target/classes/mapper/UserPositionMapper.xml b/target/classes/mapper/UserPositionMapper.xml
index 20db7a5..50034eb 100644
--- a/target/classes/mapper/UserPositionMapper.xml
+++ b/target/classes/mapper/UserPositionMapper.xml
@@ -519,7 +519,17 @@
and agent_id = #{searchId}
</if>
<if test="state != null">
- and status = #{state, jdbcType=INTEGER}
+ <choose>
+ <when test="state == 0">
+ and status = 1
+ </when>
+ <when test="state == 1">
+ and status = 2
+ </when>
+ <otherwise>
+ and status = #{state, jdbcType=INTEGER}
+ </otherwise>
+ </choose>
</if>
<if test="userId != null and userId != '' ">
and user_id = #{userId}
diff --git a/target/classes/mapper/UserWithdrawMapper.xml b/target/classes/mapper/UserWithdrawMapper.xml
index c4997e9..93fd766 100644
--- a/target/classes/mapper/UserWithdrawMapper.xml
+++ b/target/classes/mapper/UserWithdrawMapper.xml
@@ -281,5 +281,11 @@
DELETE FROM user_withdraw WHERE user_id = #{userId}
</delete>
+ <select id="sumPendingAmtByUserId" resultType="java.math.BigDecimal">
+ select ifnull(sum(with_amt), 0)
+ from user_withdraw
+ where user_id = #{userId}
+ and with_status = 0
+ </select>
</mapper>
\ No newline at end of file
diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
index 791004c..c20e215 100644
--- a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
+++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
@@ -422,6 +422,7 @@
com\nq\service\impl\UserServiceImpl.class
com\nq\utils\task\stock\SaveDayMarketsTask.class
com\nq\pojo\SiteAdmin.class
+com\nq\utils\UserFundUtil.class
com\nq\utils\email\MailSender$1.class
com\nq\controller\agent\AgentUserController.class
com\nq\service\ISitePayService.class
diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
index 2a83054..85f6f20 100644
--- a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
+++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
@@ -292,6 +292,7 @@
D:\ZyaProject\A前端\A-stock\src\main\java\com\nq\service\impl\SiteNewsServiceImpl.java
D:\ZyaProject\A前端\A-stock\src\main\java\com\nq\controller\backend\AdminFundsSettingController.java
D:\ZyaProject\A前端\A-stock\src\main\java\com\nq\service\impl\SiteSettingServiceImpl.java
+D:\ZyaProject\A前端\A-stock\src\main\java\com\nq\utils\UserFundUtil.java
D:\ZyaProject\A前端\A-stock\src\main\java\com\nq\service\IUserBankService.java
D:\ZyaProject\A前端\A-stock\src\main\java\com\nq\service\IAgentAgencyFeeService.java
D:\ZyaProject\A前端\A-stock\src\main\java\com\nq\utils\pay\CmcPayTool.java
diff --git a/target/stock-0.0.1-SNAPSHOT.jar b/target/stock-0.0.1-SNAPSHOT.jar
index eb6b2e9..175a85b 100644
--- a/target/stock-0.0.1-SNAPSHOT.jar
+++ b/target/stock-0.0.1-SNAPSHOT.jar
Binary files differ
diff --git a/target/stock-0.0.1-SNAPSHOT.jar.original b/target/stock-0.0.1-SNAPSHOT.jar.original
index f5a99f2..f1fa2a6 100644
--- a/target/stock-0.0.1-SNAPSHOT.jar.original
+++ b/target/stock-0.0.1-SNAPSHOT.jar.original
Binary files differ
--
Gitblit v1.9.3