package com.ruoyi.system.user.service.impl;

import java.math.BigDecimal;
import java.util.HashSet;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ruoyi.common.core.domain.vo.UserVO;
import com.ruoyi.common.utils.MathUtils;
import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.common.utils.collection.CollectionUtils;
import com.ruoyi.system.user.domain.UserQuery;
import com.ruoyi.system.user.mapper.UserMapper;
import com.ruoyi.system.user.service.UserDashboard;
import com.ruoyi.system.user.service.UserValidator;

/**
 * @author wjh
 * 2024/11/22
 */
@Service
public class UserValidatorImpl implements UserValidator {

    @Autowired
    private UserDashboard userDashboard;

    @Autowired
    private UserMapper userMapper;


    @Override
    public void validate(UserVO vo) {
        ServiceUtil.assertion(vo == null, "用户不存在");

    }

    @Override
    public boolean canView(List<Long> userIds) {
        if (CollectionUtils.isEmptyElement(userIds)) {
            return true;
        }
        UserQuery query = new UserQuery();
        query.setUserIds(userIds);
        query.setScope(true);
        List<Long> ids = userMapper.selectIdList(query);
        return new HashSet<>(ids).containsAll(userIds);
    }
}

