package com.ruoyi.cai.mq.handle;

import com.alibaba.fastjson2.JSON;
import com.ruoyi.cai.mq.dto.CommonConsumerEnum;
import com.ruoyi.cai.mq.handle.dto.RankDTO;
import com.ruoyi.cai.rank.RankManager;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class RankHandle implements IHandle {

    @Autowired
    private RankManager rankManager;
    @Override
    public void run(String message) {
        RankDTO rank = JSON.parseObject(message, RankDTO.class);
        rankManager.addRank(rank);
    }

    @Override
    public CommonConsumerEnum getType() {
        return CommonConsumerEnum.RANK;
    }
}
