From 4d2d47577b5d6f27288bfcfc60b74435d464dde0 Mon Sep 17 00:00:00 2001
From: zj <1772600164@qq.com>
Date: Sun, 29 Sep 2024 17:33:39 +0800
Subject: [PATCH] 1
---
src/main/java/com/nq/service/impl/UserServiceImpl.java | 78 +++++++++++++++++++++++++++++++--------
1 files changed, 62 insertions(+), 16 deletions(-)
diff --git a/src/main/java/com/nq/service/impl/UserServiceImpl.java b/src/main/java/com/nq/service/impl/UserServiceImpl.java
index d22ca98..f35eced 100644
--- a/src/main/java/com/nq/service/impl/UserServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/UserServiceImpl.java
@@ -1,5 +1,6 @@
package com.nq.service.impl;
+import cn.hutool.core.convert.Convert;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
@@ -29,18 +30,21 @@
import com.nq.vo.position.PositionProfitVO;
import com.nq.vo.position.PositionVO;
import com.nq.vo.position.UserPositionVO;
+import com.nq.vo.stock.StockAdminListVO;
import com.nq.vo.stock.StockListVO;
import com.nq.vo.user.UserInfoVO;
import java.math.BigDecimal;
import java.math.RoundingMode;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.stream.Collectors;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
+import com.nq.vo.user.UserOut;
+import org.apache.commons.lang3.Conversion;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -127,6 +131,9 @@
@Autowired
IPriceServices priceServices;
+
+ @Autowired
+ IUserService iUserService;
public ServerResponse reg(String yzmCode, String agentCode, String phone, String userPwd, HttpServletRequest request) {
@@ -556,6 +563,8 @@
rUserAssets.setHandlingChargeUSD(handlingChargeUSD.setScale(s,BigDecimal.ROUND_UP).toString());
rUserAssets.setProfitAndLossUSD(profitAndLossUSD.setScale(s,BigDecimal.ROUND_UP).toString());
rUserAssets.setProfitAndLoss(getProfitAndLose(userId).toString());
+ BigDecimal decimal = new BigDecimal(rUserAssets.getTotalMoney()).add(new BigDecimal(rUserAssets.getProfitAndLoss()));
+ rUserAssets.setTotalMoney(decimal.toString());
AllProfitAndLose = AllProfitAndLose.add(profitAndLossUSD);
allTotalAssets = allTotalAssets.add(totleMoneyUSD);
allAmt = allAmt.add(availableBalanceUSD);
@@ -737,10 +746,24 @@
List<User> users = this.userMapper.listByAgent(realName, phone, searchId, accountType);
List<AgentUserListVO> agentUserListVOS = Lists.newArrayList();
+
for (User user : users) {
+
+ ServerResponse money = iUserService.getMoney(user.getId());
+ List<RUserAssets> rUserAssetsList = (List<RUserAssets>) money.getData();
+ RUserAssets rUserAssets = rUserAssetsList.stream()
+ .filter(stock -> "IN".equals(stock.getAccectType()))
+ .findFirst()
+ .orElse(null);
+
AgentUserListVO agentUserListVO = assembleAgentUserListVO(user, siteSetting
.getForceStopPercent(), siteIndexSetting
.getForceSellPercent(), siteFuturesSetting.getForceSellPercent());
+ if (rUserAssets != null) {
+ agentUserListVO.setUserAmt(rUserAssets.getTotalMoney().equals("0E-8") ? new BigDecimal("0") : new BigDecimal(rUserAssets.getTotalMoney()));
+ agentUserListVO.setFreezeMoney(rUserAssets.getFreezeMoney().equals("0E-8") ? "0" : rUserAssets.getFreezeMoney());
+ agentUserListVO.setAvailableBalance(rUserAssets.getAvailableBalance().equals("0E-8") ? "0" : rUserAssets.getAvailableBalance());
+ }
agentUserListVOS.add(agentUserListVO);
}
@@ -796,15 +819,44 @@
}
- public ServerResponse listByAdmin(String realName, String phone, Integer agentId, Integer accountType, int pageNum, int pageSize, HttpServletRequest request) {
+ public ServerResponse listByAdmin(String realName, String phone, Integer agentId, Integer accountType, int pageNum, int pageSize, Integer isLock, Integer isLogin, String regTime, Integer isActive, HttpServletRequest request) throws ParseException {
PageHelper.startPage(pageNum, pageSize);
+ SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd");
+ SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd");
+ String formattedDateString = null;
+ if (StringUtils.isNotEmpty(regTime)) {
+ formattedDateString = outputFormat.format(inputFormat.parse(regTime));
+ }
+ List<User> users = this.userMapper.listByAdmin(realName, phone, agentId, accountType, isLock, isLogin, formattedDateString, isActive);
+ List<UserOut> userOuts = new ArrayList<>();
- List<User> users = this.userMapper.listByAdmin(realName, phone, agentId, accountType);
+ // 获取用户资产信息并构建返回结果
+ Map<Integer, UserOut> userOutMap = new HashMap<>();
+ for (User user : users) {
+ ServerResponse money = iUserService.getMoney(user.getId());
+ List<RUserAssets> rUserAssetsList = (List<RUserAssets>) money.getData();
+ RUserAssets rUserAssets = rUserAssetsList.stream()
+ .filter(stock -> "IN".equals(stock.getAccectType()))
+ .findFirst()
+ .orElse(null);
+
+ UserOut userOut = Convert.convert(UserOut.class, user);
+ if (rUserAssets != null) {
+ userOut.setTotalMoney(rUserAssets.getTotalMoney().equals("0E-8") ? "0" : rUserAssets.getTotalMoney());
+ userOut.setFreezeMoney(rUserAssets.getFreezeMoney().equals("0E-8") ? "0" : rUserAssets.getFreezeMoney());
+ userOut.setAvailableBalance(rUserAssets.getAvailableBalance().equals("0E-8") ? "0" : rUserAssets.getAvailableBalance());
+ }
+
+ userOutMap.put(user.getId(), userOut);
+ userOuts.add(userOut);
+ }
PageInfo pageInfo = new PageInfo(users);
-
+ pageInfo.setList(userOuts);
return ServerResponse.createBySuccess(pageInfo);
}
+
+
public ServerResponse findByUserId(Integer userId) {
@@ -1015,7 +1067,9 @@
agentUserListVO.setIsLogin(user.getIsLogin());
agentUserListVO.setRegAddress(user.getRegAddress());
agentUserListVO.setIsActive(user.getIsActive());
-
+ agentUserListVO.setImg1Key(user.getImg1Key());
+ agentUserListVO.setImg2Key(user.getImg2Key());
+ agentUserListVO.setImg3Key(user.getImg3Key());
@@ -1046,14 +1100,6 @@
BigDecimal futuresForceLine = futuresForcePercent.multiply(futuresPositionVO.getAllFuturesDepositAmt());
agentUserListVO.setFuturesForceLine(futuresForceLine);
-
-
- UserBank userBank = this.iUserBankService.findUserBankByUserId(user.getId());
- if (userBank != null) {
- agentUserListVO.setBankName(userBank.getBankName());
- agentUserListVO.setBankNo(userBank.getBankNo());
- agentUserListVO.setBankAddress(userBank.getBankAddress());
- }
return agentUserListVO;
}
--
Gitblit v1.9.3