1
zj
2024-09-04 071782e764516c6c63c9c4fceb8fafe3fc546444
src/main/java/com/nq/service/impl/UserPositionServiceImpl.java
@@ -683,11 +683,17 @@
            end_time = DateTimeUtil.searchStrToTimestamp(endTime);
        }
        List<Integer> ids = new ArrayList<>();
        if(null != searchId){
            ids = getSubordinates(searchId);
            ids.add(searchId);
        }
        PageHelper.startPage(pageNum, pageSize);
        List<UserPosition> userPositions = this.userPositionMapper.listByAgent(positionType, state,
                userId, searchId, positionSn, begin_time, end_time,null);
                userId, ids, positionSn, begin_time, end_time,null);
        List<AgentPositionVO> agentPositionVOS = Lists.newArrayList();
        for (UserPosition position : userPositions) {
@@ -716,8 +722,14 @@
        }
        List<Integer> ids = new ArrayList<>();
        if(null != agentId){
            ids = getSubordinates(agentId);
            ids.add(agentId);
        }
        List<UserPosition> userPositions = this.userPositionMapper.listByAgent(positionType, Integer.valueOf(1),
                null, agentId, null, begin_time, end_time,null);
                null, ids, null, begin_time, end_time,null);
        BigDecimal order_fee_amt = new BigDecimal("0");
@@ -749,15 +761,38 @@
        if (StringUtils.isNotBlank(endTime)) {
            end_time = DateTimeUtil.searchStrToTimestamp(endTime);
        }
        List<UserPosition> userPositions = this.userPositionMapper.listByAgent(positionType, state, userId, agentId, positionSn, begin_time, end_time,phone);
        List<Integer> ids = new ArrayList<>();
        if(null != agentId){
            ids = getSubordinates(agentId);
            ids.add(agentId);
        }
        List<UserPosition> userPositions = this.userPositionMapper.listByAgent(positionType, state, userId, ids, positionSn, begin_time, end_time,phone);
        List<AdminPositionVO> adminPositionVOS = Lists.newArrayList();
        for (UserPosition position : userPositions) {
            AdminPositionVO adminPositionVO = assembleAdminPositionVO(position);
            AgentUser agentUser = agentUserMapper.selectById(adminPositionVO.getAgentId());
            adminPositionVO.setAgentName(agentUser.getAgentName());
            User user = userMapper.selectById(adminPositionVO.getUserId());
            adminPositionVO.setPhone(user.getPhone());
            adminPositionVOS.add(adminPositionVO);
        }
        PageInfo pageInfo = new PageInfo(userPositions);
        pageInfo.setList(adminPositionVOS);
        return ServerResponse.createBySuccess(pageInfo);
    }
    public List<Integer> getSubordinates(Integer id) {
        List<AgentUser> agentUsers = agentUserMapper.selectList(new LambdaQueryWrapper<AgentUser>());
        List<Integer> subordinates = new ArrayList<>();
        for (AgentUser user : agentUsers) {
            if (id.equals(user.getParentId())) {
                subordinates.add(user.getId());
                subordinates.addAll(getSubordinates(user.getId()));
            }
        }
        return subordinates;
    }
    public int CountPositionNum(Integer state, Integer accountType) {
@@ -1099,7 +1134,14 @@
    private AgentPositionVO assembleAgentPositionVO(UserPosition position) {
        AgentPositionVO agentPositionVO = new AgentPositionVO();
        User user = userMapper.selectById(position.getUserId());
        if(null != user){
            AgentUser agentUser = agentUserMapper.selectById(user.getAgentId());
            agentPositionVO.setPhone(user.getPhone());
            if(null != agentUser){
                agentPositionVO.setAgentName(agentUser.getAgentName());
            }
        }
        agentPositionVO.setId(position.getId());
        agentPositionVO.setPositionSn(position.getPositionSn());
        agentPositionVO.setPositionType(position.getPositionType());