package com.bonus.tcp.task.job;

import com.bonus.common.core.utils.DateUtils;
import com.bonus.tcp.smartIdentify.mapper.BraceletImageMapper;
import com.bonus.tcp.websocket.handle.AqdSocketHandler;
import lombok.extern.slf4j.Slf4j;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 定时任务实现层
 * 进行自己的业务处理
 * 其他的不用操作
 */
@Slf4j
@Component
public class TestJob implements Job {
    @Autowired
    AqdSocketHandler aqdSocketHandler;

    @Autowired
    private BraceletImageMapper mapper;
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        try {
            System.err.println(DateUtils.getTime());
            mapper.updateVerdateStatusAll();
            aqdSocketHandler.sendMessageToAll("open");
            System.err.println(context.getTrigger().getJobDataMap().get("taskId"));
            log.info(context.getTrigger().getJobDataMap().get("taskId").toString());
           log.info("文件下载中....");
        } catch (Exception e) {
            throw new JobExecutionException(e);
        }
    }
}
