Commit 6640e265 authored by cq990612's avatar cq990612

修改user业务逻辑

parent 96afd609
......@@ -215,8 +215,8 @@ WHERE
u.rank,
a.id_number,
u.phone,
if(ur.totalRecharge is NULL,0.00, round(ur.totalRecharge,2)) 'totalRecharge',
if(uw.totalWithdrawal is NULL,0.00,round(uw.totalWithdrawal,2)) 'totalWithdrawal',
if(ur.totalRecharge is NULL,0, round(ur.totalRecharge,2)) 'totalRecharge',
if(uw.totalWithdrawal is NULL,0,round(uw.totalWithdrawal,2)) 'totalWithdrawal',
u.parent_id,
aa.real_name 'parentName'
FROM users u
......
......@@ -2,10 +2,7 @@ package cn.wisenergy.service.app.impl;
import cn.wisenergy.common.enums.RespCodeEnum;
import cn.wisenergy.common.utils.exception.BaseCustomException;
import cn.wisenergy.mapper.ActivesMapper;
import cn.wisenergy.mapper.UserRechargeMapper;
import cn.wisenergy.mapper.UserWithdrawsMapper;
import cn.wisenergy.mapper.UsersMapper;
import cn.wisenergy.mapper.*;
import cn.wisenergy.model.app.Actives;
import cn.wisenergy.model.app.Users;
import cn.wisenergy.model.dto.UserSimpleInfoDto;
......@@ -38,15 +35,21 @@ public class TestUserServiceImpl implements TestUserService {
@Autowired
private ActivesMapper activesMapper;
@Autowired
private UsdtOrderDetailsMapper usdtOrderDetailsMapper;
private final String MONEYISEMPTY = "0";
/**
* 查询下级用户的基本信息
*
* @param userId 用户id
* @return
*/
@Override
public List<UserSimpleInfoDto> getDownUserInfoById(Long userId) {
log.info("TestUserServiceImpl[]getDownUserInfoById[]input.param.userId:" + userId);
long startTime=System.currentTimeMillis();
long startTime = System.currentTimeMillis();
// 1.判断用户是否存在
userIsEmpty(userId);
// 2.获取用户伞下所有用户的信息
......@@ -56,6 +59,7 @@ public class TestUserServiceImpl implements TestUserService {
/**
* 查询用户详细信息
*
* @param userId 用户id
* @return
*/
......@@ -71,24 +75,25 @@ public class TestUserServiceImpl implements TestUserService {
// 4.查询用户充值和提现总额
Double totalRecharge = userRechargeMapper.getTotalRecharge(userId);
Double totalWithdrawal = userWithdrawsMapper.getTotalWithdrawal(userId);
// 5.计算OTC买入卖出
Double buyTotal = usdtOrderDetailsMapper.getBuyTotal(userId);
Double saleTotal = usdtOrderDetailsMapper.getSaleTotal(userId);
// 5.将查询出来的信息整合到dto类
BeanUtils.copyProperties(user,userInfoDto);
BeanUtils.copyProperties(user, userInfoDto);
if (null != userInfo) {
BeanUtils.copyProperties(userInfo,userInfoDto);
}
if (null != totalRecharge) {
userInfoDto.setTotalRecharge(totalRecharge.toString());
}
if (null != totalWithdrawal) {
userInfoDto.setTotalWithdrawal(totalWithdrawal.toString());
BeanUtils.copyProperties(userInfo, userInfoDto);
}
userInfoDto.setTotalRecharge(totalRecharge == null ? MONEYISEMPTY : totalRecharge.toString());
userInfoDto.setTotalWithdrawal(totalWithdrawal == null ? MONEYISEMPTY : totalWithdrawal.toString());
userInfoDto.setBuyTotal(buyTotal == null ? MONEYISEMPTY : buyTotal.toString());
userInfoDto.setSaleTotal(saleTotal == null ? MONEYISEMPTY : saleTotal.toString());
return userInfoDto;
}
/**
* 判断用户是否存在,存在并返回user信息
*
* @param userId
* @return
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment