package com.ruoyi.xq.mq.handle;

import com.alibaba.fastjson2.JSON;
import com.ruoyi.xq.mq.CommonConsumerEnum;
import com.ruoyi.xq.mq.handle.dto.CalculateSalesHandleDTO;
import com.ruoyi.xq.service.ConsumeLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class CalculateSalesNotifyHandle implements IHandle{

    @Autowired
    private ConsumeLogService consumeLogService;

    @Override
    public void run(String message) {
        CalculateSalesHandleDTO calculateSalesHandle = JSON.parseObject(message, CalculateSalesHandleDTO.class);
        consumeLogService.dealFenxiao(calculateSalesHandle.getConsumerLogId(),true);
    }

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