package com.chushang.system.consumer;

import com.alibaba.fastjson2.JSON;
import com.chushang.common.core.constant.SecurityConstants;
import com.chushang.common.core.constant.ServiceConstant;
import com.chushang.common.core.context.SecurityContextHolder;
import com.chushang.common.core.util.SpringUtils;
import com.chushang.common.core.web.AjaxResult;
import com.chushang.common.core.web.Result;
import com.chushang.common.log.entity.SysLogEntity;
import com.chushang.system.service.SysLogService;
import com.chushang.task.entity.TaskInfo;
import com.chushang.task.entity.dto.UpdateTaskDTO;
import com.chushang.task.enums.TaskStatusEnum;
import com.chushang.task.enums.TaskTypeEnum;
import com.chushang.task.feign.RemoteTaskService;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.lang.reflect.Method;
import java.time.LocalDateTime;
import java.util.Objects;

/**
 * @auther: zhao
 * @date: 2024/6/12 16:59
 */
@Slf4j
@Component
@RocketMQMessageListener(topic = ServiceConstant.QUEUE_NAME, consumerGroup = ServiceConstant.SYSTEM_CONSUMER_GROUP)
public class LogConsumerService implements RocketMQListener<SysLogEntity> {
    @Resource
    private SysLogService logService;
    /**
     *  执行 下发的 后台任务
     */
    @Override
    public void onMessage(SysLogEntity logEntity) {
        log.info("消费日志 {}", JSON.toJSONString(logEntity));
        logService.save(logEntity);
    }
}
