class SeatServiceImpl extends ServiceImpl<SeatMapper, Seat> implements SeatService {


    @Autowired
    private SeatTokenGenerate seatTokenGenerate;

    @Autowired
    private Cache<String> cache;

    /**
     * 快捷登录缓存前缀
     */
    private static String prefix = "{quick_login}_";


    @Override
    public List<SeatVO> seatVoList(String storeId) {

        LambdaQueryWrapper<Seat> seatLambdaQueryWrapper = new LambdaQueryWrapper<>();
        seatLambdaQueryWrapper.eq(Seat::getTenantId, storeId);
        List<Seat> list = this.list(seatLambdaQueryWrapper);

        //转换模型为VO
        List<SeatVO> results = list.stream().map(item -> (SeatVO) item).collect(Collectors.toList());
        //填充坐席当前状态
        //todo
        results.forEach(item -> {
            item.setOnlineStatus(OnlineStatusEnum.ONLINE.name());
        });
        return results;
    }

    @Override
    public Token usernameLogin(String username, String password) {<FILL_FUNCTION_BODY>}

    @Override
    public String createQuickLoginCode(String username) {
        String code = UUID.randomUUID().toString();
        cache.put(prefix + code, username, 20L);
        return code;
    }

    @Override
    public Token quickLogin(String code) {
        String username = cache.get(prefix + code);
        cache.remove(prefix + code);
        if (StringUtils.isEmpty(username)) {
            throw new ServiceException(ResultCode.ERROR);
        }
        return seatTokenGenerate.createToken(findByUsername(username), true);
    }

    /**
     * 查询坐席
     *
     * @param username
     * @return
     */
    @Override
    public Seat findByUsername(String username) {
        LambdaQueryWrapper<Seat> seatLambdaQueryWrapper = new LambdaQueryWrapper<>();
        seatLambdaQueryWrapper.eq(Seat::getUsername, username);
        return this.getOne(seatLambdaQueryWrapper);
    }


}


        Seat seat = this.findByUsername(username);
        //判断用户是否存在
        if (seat == null || !seat.getDisabled()) {
            throw new ServiceException(ResultCode.ERROR);
        }
        //判断密码是否输入正确
        if (!new BCryptPasswordEncoder().matches(password, seat.getPassword())) {
            throw new ServiceException(ResultCode.ERROR);
        }
        return seatTokenGenerate.createToken(seat, true);
    
<no_super_class>