1
zj
2024-05-21 0e20a4ee1fb4f46598948e9a42c350e7486f73b4
1
24 files modified
2 files added
530 ■■■■ changed files
src/main/java/com/nq/common/ServerResponse.java 6 ●●●● patch | view | raw | blame | history
src/main/java/com/nq/controller/agent/AgentController.java 21 ●●●●● patch | view | raw | blame | history
src/main/java/com/nq/controller/backend/AdminController.java 13 ●●●● patch | view | raw | blame | history
src/main/java/com/nq/controller/backend/AdminLogsController.java 2 ●●● patch | view | raw | blame | history
src/main/java/com/nq/dao/AgentUserMapper.java 3 ●●●● patch | view | raw | blame | history
src/main/java/com/nq/dao/UserRechargeMapper.java 2 ●●● patch | view | raw | blame | history
src/main/java/com/nq/dao/UserWithdrawMapper.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/com/nq/pojo/AgentUser.java 3 ●●●●● patch | view | raw | blame | history
src/main/java/com/nq/pojo/UserOptionLog.java 3 ●●●● patch | view | raw | blame | history
src/main/java/com/nq/pojo/UserWithdraw.java 8 ●●●● patch | view | raw | blame | history
src/main/java/com/nq/service/ISiteAdminService.java 4 ●●● patch | view | raw | blame | history
src/main/java/com/nq/service/ISiteUserOptionLogService.java 2 ●●● patch | view | raw | blame | history
src/main/java/com/nq/service/impl/PayServiceImpl.java 1 ●●●● patch | view | raw | blame | history
src/main/java/com/nq/service/impl/SiteAdminServiceImpl.java 240 ●●●●● patch | view | raw | blame | history
src/main/java/com/nq/service/impl/SiteUserOptionLogServiceImpl.java 5 ●●●● patch | view | raw | blame | history
src/main/java/com/nq/service/impl/UserAssetsServices.java 2 ●●● patch | view | raw | blame | history
src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java 10 ●●●●● patch | view | raw | blame | history
src/main/java/com/nq/utils/ConverterUtil.java 44 ●●●●● patch | view | raw | blame | history
src/main/java/com/nq/utils/task/stock/StockTask.java 2 ●●● patch | view | raw | blame | history
src/main/java/com/nq/vo/agent/AgentUserNodeVO.java 64 ●●●●● patch | view | raw | blame | history
src/main/java/com/nq/vo/user/UserOptionLogVO.java 17 ●●●● patch | view | raw | blame | history
src/main/resources/mapper/UserOptionLogMapper.xml 2 ●●● patch | view | raw | blame | history
src/main/resources/mapper/UserRechargeMapper.xml 12 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/UserWithdrawMapper.xml 25 ●●●● patch | view | raw | blame | history
target/classes/mapper/UserRechargeMapper.xml 12 ●●●●● patch | view | raw | blame | history
target/classes/mapper/UserWithdrawMapper.xml 25 ●●●● patch | view | raw | blame | history
src/main/java/com/nq/common/ServerResponse.java
@@ -74,7 +74,7 @@
    public static <T> ServerResponse<T> createBySuccessMsg(String msg,HttpServletRequest request) {
        return new ServerResponse(ResponseCode.SUCCESS.getCode(), new GoogleTranslateUtil().translate(msg,request.getHeader(LANG)));
        return new ServerResponse(ResponseCode.SUCCESS.getCode(), msg);
    }
    public static <T> ServerResponse<T> createBySuccess(T data) {
@@ -83,7 +83,7 @@
    public static <T> ServerResponse<T> createBySuccess(String data,HttpServletRequest request) {
        return new ServerResponse(ResponseCode.SUCCESS.getCode(), new GoogleTranslateUtil().translate(data,request.getHeader(LANG)));
        return new ServerResponse(ResponseCode.SUCCESS.getCode(),data);
    }
    public static <T> ServerResponse<T> createBySuccess(String msg, T data) {
@@ -103,7 +103,7 @@
        return new ServerResponse(ResponseCode.ERROR.getCode(), errormsg);
    }
    public static <T> ServerResponse<T> createByErrorMsg(String errormsg, HttpServletRequest request) {
        return new ServerResponse(ResponseCode.ERROR.getCode(), new GoogleTranslateUtil().translate(errormsg,request.getHeader(LANG)));
        return new ServerResponse(ResponseCode.ERROR.getCode(),errormsg);
    }
src/main/java/com/nq/controller/agent/AgentController.java
@@ -31,6 +31,8 @@
    @Autowired
    IAgentAgencyFeeService iAgentAgencyFeeService;
    @Autowired
    ISiteUserOptionLogService iSiteUserOptionLogService;
    @Autowired
    ISiteAdminService iSiteAdminService;
@@ -42,6 +44,12 @@
        return this.iAgentUserService.getAgentInfo(request);
    }
    @RequestMapping("optionList.do")
    @ResponseBody
    public ServerResponse optionList(@RequestParam(value = "agentId", required = false) Integer agentId,@RequestParam(value = "userId", required = false) Integer userId, @RequestParam(value = "pageNum", defaultValue = "1") int pageNum, @RequestParam(value = "pageSize", defaultValue = "10") int pageSize){
        return this.iSiteUserOptionLogService.list(agentId,userId,pageNum,pageSize);
    }
    //修改代理用户密码
    @RequestMapping({"updatePwd.do"})
    @ResponseBody
@@ -49,6 +57,19 @@
        return this.iAgentUserService.updatePwd(oldPwd, newPwd, request);
    }
    //查询首页充值,提现,注册统计
    @RequestMapping({"moneyCount.do"})
    @ResponseBody
    public ServerResponse moneyCount(@RequestParam(value = "agentId", required = false) String agentId,@RequestParam(value = "startTime", required = false) String startTime,@RequestParam(value = "entTime", required = false) String entTime) {
        return this.iSiteAdminService.moneyCount(agentId,startTime,entTime);
    }
    //查询代理总资金
    @RequestMapping({"totalAgencyFunds.do"})
    @ResponseBody
    public ServerResponse totalAgencyFunds(@RequestParam(value = "agentId", required = false) String agentId) {
        return this.iSiteAdminService.totalAgencyFunds(agentId);
    }
    //查询首页 资金情况、持仓情况、盈亏信息、提现情况、股票信息、代理信息
    @RequestMapping({"count.do"})
src/main/java/com/nq/controller/backend/AdminController.java
@@ -112,11 +112,18 @@
        return this.iSiteAdminService.count();
    }
    //查询首页 资金情况、持仓情况、盈亏信息、提现情况、股票信息、代理信息
    //查询首页充值,提现,注册统计
    @RequestMapping({"moneyCount.do"})
    @ResponseBody
    public ServerResponse moneyCount(@RequestParam(value = "startTime", required = false) String startTime,@RequestParam(value = "entTime", required = false) String entTime) {
        return this.iSiteAdminService.moneyCount(startTime,entTime);
    public ServerResponse moneyCount(@RequestParam(value = "agentId", required = false) String agentId,@RequestParam(value = "startTime", required = false) String startTime,@RequestParam(value = "entTime", required = false) String entTime) {
        return this.iSiteAdminService.moneyCount(agentId,startTime,entTime);
    }
    //查询代理总资金
    @RequestMapping({"totalAgencyFunds.do"})
    @ResponseBody
    public ServerResponse totalAgencyFunds(@RequestParam(value = "agentId", required = false) String agentId) {
        return this.iSiteAdminService.totalAgencyFunds(agentId);
    }
    //处理图片上传
src/main/java/com/nq/controller/backend/AdminLogsController.java
@@ -62,7 +62,7 @@
    @RequestMapping("optionList.do")
    @ResponseBody
    public ServerResponse optionList(@RequestParam(value = "userId", required = false) Integer userId, @RequestParam(value = "pageNum", defaultValue = "1") int pageNum, @RequestParam(value = "pageSize", defaultValue = "10") int pageSize){
        return this.iSiteUserOptionLogService.list(userId,pageNum,pageSize);
        return this.iSiteUserOptionLogService.list(null,userId,pageNum,pageSize);
    }
    //分页查询日志管理 所有短信日志信息
src/main/java/com/nq/dao/AgentUserMapper.java
@@ -2,11 +2,12 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nq.pojo.AgentUser;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface AgentUserMapper {
public interface AgentUserMapper extends BaseMapper<AgentUser> {
  int deleteByPrimaryKey(Integer paramInteger);
  
  int insert(AgentUser paramAgentUser);
src/main/java/com/nq/dao/UserRechargeMapper.java
@@ -9,7 +9,7 @@
public interface UserRechargeMapper extends BaseMapper<UserRecharge> {
  int insert(UserRecharge paramUserRecharge);
//  int insert(UserRecharge paramUserRecharge);
  
  int insertSelective(UserRecharge paramUserRecharge);
  
src/main/java/com/nq/dao/UserWithdrawMapper.java
@@ -10,8 +10,6 @@
public interface UserWithdrawMapper extends BaseMapper<UserWithdraw> {
  int deleteByPrimaryKey(Integer paramInteger);
  
  int insert(UserWithdraw paramUserWithdraw);
  int insertSelective(UserWithdraw paramUserWithdraw);
  
  UserWithdraw selectByPrimaryKey(Integer paramInteger);
src/main/java/com/nq/pojo/AgentUser.java
@@ -1,5 +1,7 @@
package com.nq.pojo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import java.math.BigDecimal;
@@ -8,6 +10,7 @@
@Data
public class AgentUser {
    @TableId(value = "id",type = IdType.AUTO)
    private Integer id;
    private String agentName;
    private String agentPwd;
src/main/java/com/nq/pojo/UserOptionLog.java
@@ -10,6 +10,7 @@
import org.joda.time.DateTime;
import java.math.BigDecimal;
import java.util.Date;
@Data
@@ -30,6 +31,6 @@
    private Integer userAccectId;
    private DateTime createTime;
    private Date createTime;
}
src/main/java/com/nq/pojo/UserWithdraw.java
@@ -1,16 +1,20 @@
package com.nq.pojo;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class UserWithdraw {
    @TableId(type= IdType.AUTO)
    private Integer id;
    @Excel(name = "用户id")
    private Integer userId;
@@ -44,7 +48,7 @@
    @TableField(exist = false)
    private String userPhone;
    private String assetsType;
    public UserWithdraw(Integer id, Integer userId, String nickName, Integer agentId, BigDecimal withAmt, Date applyTime, Date transTime, String withName, String bankNo, String bankName, String bankAddress, Integer withStatus, BigDecimal withFee, String withMsg) {
src/main/java/com/nq/service/ISiteAdminService.java
@@ -28,5 +28,7 @@
  ServerResponse deleteAdmin(Integer adminId);
  ServerResponse moneyCount(String startTime, String entTime);
  ServerResponse moneyCount(String agentId,String startTime, String entTime);
  ServerResponse totalAgencyFunds(String agentId);
}
src/main/java/com/nq/service/ISiteUserOptionLogService.java
@@ -8,6 +8,6 @@
import javax.servlet.http.HttpServletRequest;
public interface ISiteUserOptionLogService {
  ServerResponse<PageInfo> list(Integer userId, int pageNum, int pageSize);
  ServerResponse<PageInfo> list( Integer agentId,Integer userId, int pageNum, int pageSize);
  
}
src/main/java/com/nq/service/impl/PayServiceImpl.java
@@ -247,6 +247,7 @@
        userRecharge.setAddTime(new Date());
        userRecharge.setPayId(payType);
        userRecharge.setImg(currency);
        userRecharge.setAssetsType(sitePay.getAssetsType());
        userRechargeMapper.insert(userRecharge);
        return ServerResponse.createBySuccess("");
    }
src/main/java/com/nq/service/impl/SiteAdminServiceImpl.java
@@ -1,22 +1,17 @@
package com.nq.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.nq.dao.SiteAdminMapper;
import com.nq.dao.*;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.nq.common.ServerResponse;
import com.nq.dao.UserMapper;
import com.nq.dao.UserRechargeMapper;
import com.nq.dao.UserWithdrawMapper;
import com.nq.pojo.SiteAdmin;
import com.nq.pojo.*;
import com.nq.pojo.UserRecharge;
import com.nq.pojo.UserWithdraw;
import com.nq.service.IAgentUserService;
import com.nq.service.ISiteAdminService;
@@ -31,6 +26,7 @@
import com.nq.service.IUserWithdrawService;
import com.nq.utils.ConverterUtil;
import com.nq.utils.PropertiesUtil;
import com.nq.utils.SymmetricCryptoUtil;
@@ -43,16 +39,17 @@
import java.math.BigDecimal;
import java.util.Date;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import com.nq.vo.agent.AgentUserNodeVO;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
@@ -62,6 +59,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.xmlunit.util.Convert;
@Service("iSiteAdminServiceImpl")
@@ -110,6 +108,8 @@
    @Autowired
    UserWithdrawMapper userWithdrawMapper;
    @Autowired
    AgentUserMapper agentUserMapper;
    public ServerResponse login(String adminPhone, String adminPwd, String verifyCode, HttpServletRequest request) {
@@ -377,16 +377,83 @@
    }
    @Override
    public ServerResponse moneyCount(String startTime, String entTime) {
        BigDecimal rechargeTotalAmount = BigDecimal.ZERO;
        BigDecimal withdrawalTotalAmount = BigDecimal.ZERO;
    public ServerResponse moneyCount(String agentId,String startTime, String entTime) {
        BigDecimal todayRechargeAmount = BigDecimal.ZERO;//今日充值金额
        BigDecimal todayWithdrawAmount = BigDecimal.ZERO;//今日提现金额
        Long todayRegister = 0L;//今日注册
        Long todayWithdraw = 0L;//今日充值总人数
        BigDecimal rechargeTotalAmount = BigDecimal.ZERO;//总充值金额
        BigDecimal withdrawalTotalAmount = BigDecimal.ZERO;//总提现金额
        Map<String, Object> map = new HashMap<>();
        map.put("todayRechargeAmount", todayRechargeAmount);
        map.put("todayWithdrawAmount", todayWithdrawAmount);
        map.put("todayRegister", todayRegister);
        map.put("todayWithdraw", todayWithdraw);
        map.put("rechargeTotalAmount", rechargeTotalAmount);
        map.put("withdrawalTotalAmount", withdrawalTotalAmount);
        //今日开始结束时间
        LocalDate currentDate  = LocalDate.now();
        LocalDate  nextDay = currentDate.plusDays(1);
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        String start = currentDate.format(formatter);
        String end = nextDay.format(formatter);
        List<Integer> userIds  = null;
        if(StringUtils.isNotEmpty(agentId)){
            //当前代理
            AgentUser agentUser = agentUserMapper.selectById(agentId);
            if(null == agentUser){
                return ServerResponse.createBySuccess(map);
            }
            List<AgentUser> lowerAgentUsers = agentUserMapper.selectList(new LambdaQueryWrapper<AgentUser>());
            AgentUserNodeVO userNodeVO = ConverterUtil.convert(agentUser, AgentUserNodeVO.class);
            List<AgentUserNodeVO> agentUserNodeVOS = ConverterUtil.convertToList(lowerAgentUsers, AgentUserNodeVO.class);
            List<AgentUserNodeVO> nodeJson = getNodeJson(userNodeVO, agentUserNodeVOS);
            userNodeVO.setChildList(nodeJson);
            //当前节点和子节点的id
            List<Integer>  ids  =  getAllChildrenIds(userNodeVO);
            //查询代理id下面所有的用户
            List<User> users = userMapper.selectList(new LambdaQueryWrapper<User>().in(User::getAgentId, ids));
            userIds = users.stream().map(User::getId).collect(Collectors.toList());
        }
        //今日充值
        List<UserRecharge> todayRecharges = userRechargeMapper.selectList(new LambdaQueryWrapper<UserRecharge>().eq(UserRecharge::getOrderStatus, 1)
                .ge(UserRecharge::getPayTime, start)
                .le(UserRecharge::getPayTime, end)
                .in(CollectionUtil.isNotEmpty(userIds),UserRecharge::getUserId,userIds));
        //今日提现
        List<UserWithdraw> todayWithdraws = userWithdrawMapper.selectList(new LambdaQueryWrapper<UserWithdraw>().eq(UserWithdraw::getWithStatus, 1)
                .ge(UserWithdraw::getTransTime, start)
                .le(UserWithdraw::getTransTime, end)
                .in(CollectionUtil.isNotEmpty(userIds),UserWithdraw::getUserId,userIds));
        //总充值
        List<UserRecharge> userRecharges = userRechargeMapper.selectList(new LambdaQueryWrapper<UserRecharge>().eq(UserRecharge::getOrderStatus, 1)
                .ge(StringUtils.isNotBlank(startTime), UserRecharge::getPayTime, startTime)
                .le(StringUtils.isNotBlank(entTime), UserRecharge::getPayTime, entTime));
                .le(StringUtils.isNotBlank(entTime), UserRecharge::getPayTime, entTime)
                .in(CollectionUtil.isNotEmpty(userIds),UserRecharge::getUserId,userIds));
        //总提现
        List<UserWithdraw> userWithdraws = userWithdrawMapper.selectList(new LambdaQueryWrapper<UserWithdraw>().eq(UserWithdraw::getWithStatus, 1)
                .ge(StringUtils.isNotBlank(startTime), UserWithdraw::getTransTime, startTime)
                .le(StringUtils.isNotBlank(entTime), UserWithdraw::getTransTime, entTime));
                .le(StringUtils.isNotBlank(entTime), UserWithdraw::getTransTime, entTime)
                .in(CollectionUtil.isNotEmpty(userIds),UserWithdraw::getUserId,userIds));
        //今日注册数量
        todayRegister = userMapper.selectCount(new LambdaQueryWrapper<User>()
                .ge(User::getRegTime, start)
                .le(User::getRegTime, end)
                .in(CollectionUtil.isNotEmpty(userIds),User::getId,userIds));
        for (UserRecharge userRecharge : todayRecharges) {
            todayRechargeAmount = todayRechargeAmount.add(userRecharge.getPayAmt());
        }
        for (UserWithdraw userWithdraw : todayWithdraws) {
            todayWithdrawAmount = todayWithdrawAmount.add(userWithdraw.getWithAmt());
        }
        for (UserRecharge userRecharge : userRecharges) {
            rechargeTotalAmount = rechargeTotalAmount.add(userRecharge.getPayAmt());
@@ -396,13 +463,150 @@
            withdrawalTotalAmount = withdrawalTotalAmount.add(userWithdraw.getWithAmt());
        }
        Map<String, BigDecimal> map = new HashMap<>();
        List<UserRecharge> distinctCustomers = todayRecharges.stream()
                .collect(Collectors.toMap(UserRecharge::getUserId, c -> c, (c1, c2) -> c1))
                .values().stream()
                .collect(Collectors.toList());
        todayWithdraw = Long.valueOf(distinctCustomers.size());
        map.put("todayRechargeAmount", todayRechargeAmount);
        map.put("todayWithdrawAmount", todayWithdrawAmount);
        map.put("todayRegister", todayRegister);
        map.put("todayWithdraw", todayWithdraw);
        map.put("rechargeTotalAmount", rechargeTotalAmount);
        map.put("withdrawalTotalAmount", withdrawalTotalAmount);
        return ServerResponse.createBySuccess(map);
    }
    @Override
    public ServerResponse totalAgencyFunds(String agentId) {
        BigDecimal inTotalAmount = BigDecimal.ZERO;
        BigDecimal usTotalAmount = BigDecimal.ZERO;
        BigDecimal inTotalWithdrawAmount = BigDecimal.ZERO;
        BigDecimal usTotalWithdrawAmount = BigDecimal.ZERO;
        Map<String, Object> map = new HashMap<>();
        //入金
        map.put("inTotalAmount", inTotalAmount);
        map.put("usTotalAmount", usTotalAmount);
        //出金
        map.put("inTotalWithdrawAmount", inTotalWithdrawAmount);
        map.put("usTotalWithdrawAmount", usTotalWithdrawAmount);
        //查询所有代理用户(管理员)
        List<AgentUser> agentUsers = agentUserMapper.selectList(new LambdaQueryWrapper<AgentUser>()
                .eq(AgentUser::getAgentLevel,0)
                .eq(StringUtils.isNotBlank(agentId),AgentUser::getId,agentId));
        List<AgentUser> lowerAgentUsers = agentUserMapper.selectList(new LambdaQueryWrapper<AgentUser>()
                .ne(AgentUser::getAgentLevel,0));
        if(CollectionUtil.isEmpty(agentUsers)){
            return ServerResponse.createBySuccess(map);
        }
        for (AgentUser agentUser : agentUsers) {
            AgentUserNodeVO userNodeVO = ConverterUtil.convert(agentUser, AgentUserNodeVO.class);
            List<AgentUserNodeVO> agentUserNodeVOS = ConverterUtil.convertToList(lowerAgentUsers, AgentUserNodeVO.class);
            List<AgentUserNodeVO> nodeJson = getNodeJson(userNodeVO, agentUserNodeVOS);
            userNodeVO.setChildList(nodeJson);
            //当前节点和子节点的id
            List<Integer>  ids  =  getAllChildrenIds(userNodeVO);
            //查询代理id下面所有的用户
            List<User> users = userMapper.selectList(new LambdaQueryWrapper<User>().in(User::getAgentId, ids));
            //查询用户充值
            List<Integer> userIds = users.stream().map(User::getId).collect(Collectors.toList());
            List<UserRecharge> userRecharges = userRechargeMapper.selectList(new LambdaQueryWrapper<UserRecharge>()
                    .eq(UserRecharge::getOrderStatus, 1)
                    .in(CollectionUtil.isNotEmpty(userIds),UserRecharge::getUserId,userIds));
            Map<String, List<UserRecharge>> typeList = userRecharges.stream().collect(Collectors.groupingBy(UserRecharge::getAssetsType));
            List<UserRecharge> inUserRecharge = typeList.get("IN");
            List<UserRecharge> usUserRecharge = typeList.get("US");
            if(CollectionUtil.isNotEmpty(inUserRecharge)){
                for (UserRecharge userRecharge : inUserRecharge) {
                    inTotalAmount = inTotalAmount.add(userRecharge.getPayAmt());
                }
            }
            if(CollectionUtil.isNotEmpty(usUserRecharge)){
                for (UserRecharge userRecharge : usUserRecharge) {
                    usTotalAmount = usTotalAmount.add(userRecharge.getPayAmt());
                }
            }
            //总提现
            List<UserWithdraw> userWithdraws = userWithdrawMapper.selectList(new LambdaQueryWrapper<UserWithdraw>()
                    .eq(UserWithdraw::getWithStatus, 1)
                    .in(CollectionUtil.isNotEmpty(userIds),UserWithdraw::getUserId,userIds));
            Map<String, List<UserWithdraw>> typeWithdrawsList = userWithdraws.stream().collect(Collectors.groupingBy(UserWithdraw::getAssetsType));
            List<UserWithdraw> inUserWithdraws = typeWithdrawsList.get("IN");
            List<UserWithdraw> usUserWithdraws = typeWithdrawsList.get("US");
            if(CollectionUtil.isNotEmpty(inUserWithdraws)){
                for (UserWithdraw userWithdraw : inUserWithdraws) {
                    inTotalWithdrawAmount = inTotalWithdrawAmount.add(userWithdraw.getWithAmt());
                }
            }
            if(CollectionUtil.isNotEmpty(usUserWithdraws)){
                for (UserWithdraw userWithdraw : usUserWithdraws) {
                    usTotalWithdrawAmount = usTotalWithdrawAmount.add(userWithdraw.getWithAmt());
                }
            }
        }
        map.put("inTotalAmount", inTotalAmount);
        map.put("usTotalAmount", usTotalAmount);
        map.put("inTotalWithdrawAmount", inTotalWithdrawAmount);
        map.put("usTotalWithdrawAmount", usTotalWithdrawAmount);
        return ServerResponse.createBySuccess(map);
    }
    public  static  List<Integer>  getAllChildrenIds(AgentUserNodeVO  parent)  {
        List<Integer>  allChildrenIds  =  new  ArrayList<>();
        getAllChildrenIdsHelper(parent,  allChildrenIds);
        return  allChildrenIds;
    }
    private  static  void  getAllChildrenIdsHelper(AgentUserNodeVO  node,  List<Integer>  allChildrenIds)  {
        allChildrenIds.add(node.getId());
        if(CollectionUtil.isNotEmpty(node.getChildList())){
            for  (AgentUserNodeVO  child  :  node.getChildList())  {
                getAllChildrenIdsHelper(child,  allChildrenIds);
            }
        }
    }
    public List<AgentUserNodeVO> getNodeJson(AgentUserNodeVO agentUser, List<AgentUserNodeVO> nodes){
        //当前层级当前点下的所有子节点
        List<AgentUserNodeVO> childList = getChildNodes(agentUser.getId(),nodes);
        List<AgentUserNodeVO> list = new ArrayList<>();
        childList.forEach(f->{
            List<AgentUserNodeVO> childs = getNodeJson(f,nodes);  //递归调用该方法
            if(!childs.isEmpty()) {
                f.setChildList(childs);
            }
            list.add(f);
        });
        return list;
    }
    /**
     * 获取当前节点的所有子节点
     * @param nodeId
     * @param nodes
     * @return
     */
    public List<AgentUserNodeVO> getChildNodes(Integer nodeId, List<AgentUserNodeVO> nodes){
        List<AgentUserNodeVO> list = new ArrayList<>();
        nodes.forEach(f->{
            if(f.getParentId().equals(nodeId)){
                list.add(f);
            }
        });
        return list;
    }
    public String getDate(){
        LocalDate currentDate  =  LocalDate.now();
        DateTimeFormatter  formatter  =  DateTimeFormatter.ofPattern("yyyy-MM-dd");
        return currentDate.format(formatter);
    }
    public SiteAdmin findAdminByName(String name) {
        return this.siteAdminMapper.findAdminByName(name);
src/main/java/com/nq/service/impl/SiteUserOptionLogServiceImpl.java
@@ -40,7 +40,10 @@
    UserOptionLogMapper userOptionLogMapper;
    @Override
    public ServerResponse<PageInfo> list(Integer userId, int pageNum, int pageSize) {
    public ServerResponse<PageInfo> list( Integer agentId,Integer userId, int pageNum, int pageSize) {
        if(null != agentId){
        }
        PageHelper.startPage(pageNum, pageSize);
        List<UserOptionLogVO> list = userOptionLogMapper.selective(userId);
        PageInfo pageInfo = new PageInfo(list);
src/main/java/com/nq/service/impl/UserAssetsServices.java
@@ -70,7 +70,7 @@
                    .userId(userAssets.getUserId())
                    .money(bigAmt)
                    .userAccectId(userAssets.getId())
                    .createTime(new DateTime())
                    .createTime(new Date())
                    .type(amt.contains("-")?0:1)
                    .build());
            return ServerResponse.createBySuccess();
src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java
@@ -83,6 +83,8 @@
    @Autowired
    SiteSettingServiceImpl siteSettingService;
    @Resource
    UserAssetsMapper userAssetsMapper;
    @Transactional
@@ -144,6 +146,7 @@
            userWithdraw.setWithStatus(Integer.valueOf(0));
            BigDecimal withfee = siteSetting.getWithFeePercent().multiply(new BigDecimal(amt)).add(new BigDecimal(siteSetting.getWithFeeSingle().intValue()));
            userWithdraw.setWithFee(withfee);
            userWithdraw.setAssetsType(accsetType);
            int insertCount = this.userWithdrawMapper.insert(userWithdraw);
            if (insertCount > 0) {
                return ServerResponse.createBySuccessMsg("提现成功",request);
@@ -325,7 +328,12 @@
            if (user == null) {
                return ServerResponse.createByErrorMsg("用户不存在");
            }
            int updateCount = this.userMapper.updateById(user);
            UserAssets userAssets = iUserAssetsServices.assetsByTypeAndUserId(userWithdraw.getAssetsType(), 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 {
src/main/java/com/nq/utils/ConverterUtil.java
New file
@@ -0,0 +1,44 @@
package com.nq.utils;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
/**
 * @program: dabao
 * @description:
 * @create: 2024-04-01 14:10
 **/
public class ConverterUtil {
    public static <T, V> V convert(T pojo, Class<V> voClass) {
        try {
            V vo = voClass.newInstance();
            Field[] pojoFields = pojo.getClass().getDeclaredFields();
            Field[] voFields = voClass.getDeclaredFields();
            for (Field pojoField : pojoFields) {
                pojoField.setAccessible(true);
                for (Field voField : voFields) {
                    voField.setAccessible(true);
                    if (pojoField.getName().equals(voField.getName()) && pojoField.getType().equals(voField.getType())) {
                        voField.set(vo, pojoField.get(pojo));
                        break;
                    }
                }
            }
            return vo;
        } catch (InstantiationException | IllegalAccessException e) {
            e.printStackTrace();
            return null;
        }
    }
    public static <T, V> List<V> convertToList(List<T> pojoList, Class<V> voClass) {
        List<V> voList = new ArrayList<>();
        for (T pojo : pojoList) {
            V vo = convert(pojo, voClass);
            voList.add(vo);
        }
        return voList;
    }
}
src/main/java/com/nq/utils/task/stock/StockTask.java
@@ -244,7 +244,7 @@
    /**
     * 强制平仓
     */
    @Scheduled(cron = "0/1 * * * * ?")
//    @Scheduled(cron = "0/1 * * * * ?")
    public void stockConstraint(){
        if (stockConstraintLock.tryLock()) {
            log.info("强制平仓任务:--------->开始");
src/main/java/com/nq/vo/agent/AgentUserNodeVO.java
New file
@@ -0,0 +1,64 @@
package com.nq.vo.agent;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
 * @program: dabao
 * @description:
 * @create: 2024-05-21 11:00
 **/
@Data
public class AgentUserNodeVO {
    private Integer id;
    private String agentName;
    private String agentPwd;
    private String agentRealName;
    private String agentPhone;
    private String agentCode;
    private Date addTime;
    private Integer isLock;
    private Integer parentId;
    private String parentName;
    //代理级别
    private Integer agentLevel;
    /**
     * 手续费比例
     */
    private BigDecimal poundageScale;
    /**
     * 递延费比例
     */
    private BigDecimal deferredFeesScale;
    /**
     * 分红比例
     */
    private BigDecimal receiveDividendsScale;
    /**
     * 总资金
     */
    private BigDecimal totalMoney;
    /**
     * 杠杆倍数,多个用/分割
     */
    private String siteLever;
    /**
     * 在先客服
     * */
    private String onLineServices;
    /**
     * 子节点
     */
    private List<AgentUserNodeVO> childList;
}
src/main/java/com/nq/vo/user/UserOptionLogVO.java
@@ -5,24 +5,25 @@
import org.joda.time.DateTime;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class UserOptionLogVO {
    private Integer id;
    //操作金额
    private BigDecimal money;
    //类型,0扣款,1入款
    private Integer type;
    //用户id
    private Integer userId;
    //资产id
    private Integer userAccectId;
    private DateTime createTime;
    //操作时间
    private Date createTime;
    //资产账户类型
    private String userAccectType;
    //用户名
    private String userName;
}
src/main/resources/mapper/UserOptionLogMapper.xml
@@ -6,7 +6,7 @@
        SELECT
            t1.*,
            t2.accect_type AS userAccectType,
            t3.nick_name AS userName
            t3.real_name AS userName
        FROM
            user_option_log t1
                LEFT JOIN user_assets t2 ON t1.user_accect_id = t2.id
src/main/resources/mapper/UserRechargeMapper.xml
@@ -22,18 +22,6 @@
    id, user_id, nick_name, agent_id, order_sn, pay_sn, pay_channel, pay_amt, order_status,
    order_desc, add_time, pay_time, pay_id,img
  </sql>
  <insert id="insert" parameterType="com.nq.pojo.UserRecharge" >
    insert into user_recharge (id, user_id, nick_name,
      agent_id, order_sn, pay_sn,
      pay_channel, pay_amt, order_status,
      order_desc, add_time, pay_time,pay_id,img
      )
    values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{nickName,jdbcType=VARCHAR},
      #{agentId,jdbcType=INTEGER}, #{orderSn,jdbcType=VARCHAR}, #{paySn,jdbcType=VARCHAR},
      #{payChannel,jdbcType=VARCHAR}, #{payAmt,jdbcType=DECIMAL}, #{orderStatus,jdbcType=INTEGER},
      #{orderDesc,jdbcType=VARCHAR}, #{addTime,jdbcType=TIMESTAMP}, #{payTime,jdbcType=TIMESTAMP}, #{payId,jdbcType=INTEGER}, #{img,jdbcType=VARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.nq.pojo.UserRecharge" >
    insert into user_recharge
    <trim prefix="(" suffix=")" suffixOverrides="," >
src/main/resources/mapper/UserWithdrawMapper.xml
@@ -17,13 +17,9 @@
      <result column="with_fee"  property="withFee"/>
      <result column="with_msg"  property="withMsg"/>
  </resultMap>
  <sql id="Base_Column_List" >
    id, user_id, nick_name, agent_id, with_amt, apply_time, trans_time, with_name, bank_no,
    bank_name, bank_address, with_status, with_fee, with_msg
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    *
    from user_withdraw
    where id = #{id,jdbcType=INTEGER}
  </select>
@@ -31,18 +27,7 @@
    delete from user_withdraw
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.nq.pojo.UserWithdraw" >
    insert into user_withdraw (id, user_id, nick_name,
      agent_id, with_amt, apply_time,
      trans_time, with_name, bank_no,
      bank_name, bank_address, with_status,
      with_fee, with_msg)
    values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{nickName,jdbcType=VARCHAR},
      #{agentId,jdbcType=INTEGER}, #{withAmt,jdbcType=DECIMAL}, #{applyTime,jdbcType=TIMESTAMP},
      #{transTime,jdbcType=TIMESTAMP}, #{withName,jdbcType=VARCHAR}, #{bankNo,jdbcType=VARCHAR},
      #{bankName,jdbcType=VARCHAR}, #{bankAddress,jdbcType=VARCHAR}, #{withStatus,jdbcType=INTEGER},
      #{withFee,jdbcType=DECIMAL}, #{withMsg,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.nq.pojo.UserWithdraw" >
    insert into user_withdraw
    <trim prefix="(" suffix=")" suffixOverrides="," >
@@ -201,7 +186,7 @@
  <select id="findUserWithList" parameterType="map" resultMap="BaseResultMap">
    SELECT
    <include refid="Base_Column_List"/>
*
    FROM user_withdraw
    <where>
      user_id = #{uid}
@@ -217,7 +202,7 @@
  <select id="listByAgent" resultMap="BaseResultMap" parameterType="map">
    SELECT
    <include refid="Base_Column_List"/>
   *
    FROM user_withdraw
    <where>
      agent_id = #{searchId}
@@ -233,7 +218,7 @@
  <select id="listByAdmin" resultMap="BaseResultMap" parameterType="map">
    SELECT
    <include refid="Base_Column_List"/>
   *
    FROM user_withdraw
    where agent_id != 1
      <if test="agentId != null">
target/classes/mapper/UserRechargeMapper.xml
@@ -22,18 +22,6 @@
    id, user_id, nick_name, agent_id, order_sn, pay_sn, pay_channel, pay_amt, order_status,
    order_desc, add_time, pay_time, pay_id,img
  </sql>
  <insert id="insert" parameterType="com.nq.pojo.UserRecharge" >
    insert into user_recharge (id, user_id, nick_name,
      agent_id, order_sn, pay_sn,
      pay_channel, pay_amt, order_status,
      order_desc, add_time, pay_time,pay_id,img
      )
    values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{nickName,jdbcType=VARCHAR},
      #{agentId,jdbcType=INTEGER}, #{orderSn,jdbcType=VARCHAR}, #{paySn,jdbcType=VARCHAR},
      #{payChannel,jdbcType=VARCHAR}, #{payAmt,jdbcType=DECIMAL}, #{orderStatus,jdbcType=INTEGER},
      #{orderDesc,jdbcType=VARCHAR}, #{addTime,jdbcType=TIMESTAMP}, #{payTime,jdbcType=TIMESTAMP}, #{payId,jdbcType=INTEGER}, #{img,jdbcType=VARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.nq.pojo.UserRecharge" >
    insert into user_recharge
    <trim prefix="(" suffix=")" suffixOverrides="," >
target/classes/mapper/UserWithdrawMapper.xml
@@ -17,13 +17,9 @@
      <result column="with_fee"  property="withFee"/>
      <result column="with_msg"  property="withMsg"/>
  </resultMap>
  <sql id="Base_Column_List" >
    id, user_id, nick_name, agent_id, with_amt, apply_time, trans_time, with_name, bank_no,
    bank_name, bank_address, with_status, with_fee, with_msg
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    *
    from user_withdraw
    where id = #{id,jdbcType=INTEGER}
  </select>
@@ -31,18 +27,7 @@
    delete from user_withdraw
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.nq.pojo.UserWithdraw" >
    insert into user_withdraw (id, user_id, nick_name,
      agent_id, with_amt, apply_time,
      trans_time, with_name, bank_no,
      bank_name, bank_address, with_status,
      with_fee, with_msg)
    values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{nickName,jdbcType=VARCHAR},
      #{agentId,jdbcType=INTEGER}, #{withAmt,jdbcType=DECIMAL}, #{applyTime,jdbcType=TIMESTAMP},
      #{transTime,jdbcType=TIMESTAMP}, #{withName,jdbcType=VARCHAR}, #{bankNo,jdbcType=VARCHAR},
      #{bankName,jdbcType=VARCHAR}, #{bankAddress,jdbcType=VARCHAR}, #{withStatus,jdbcType=INTEGER},
      #{withFee,jdbcType=DECIMAL}, #{withMsg,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.nq.pojo.UserWithdraw" >
    insert into user_withdraw
    <trim prefix="(" suffix=")" suffixOverrides="," >
@@ -201,7 +186,7 @@
  <select id="findUserWithList" parameterType="map" resultMap="BaseResultMap">
    SELECT
    <include refid="Base_Column_List"/>
*
    FROM user_withdraw
    <where>
      user_id = #{uid}
@@ -217,7 +202,7 @@
  <select id="listByAgent" resultMap="BaseResultMap" parameterType="map">
    SELECT
    <include refid="Base_Column_List"/>
   *
    FROM user_withdraw
    <where>
      agent_id = #{searchId}
@@ -233,7 +218,7 @@
  <select id="listByAdmin" resultMap="BaseResultMap" parameterType="map">
    SELECT
    <include refid="Base_Column_List"/>
   *
    FROM user_withdraw
    where agent_id != 1
      <if test="agentId != null">