package cn.com.ty.lift.ud.task;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import cn.com.ty.lift.ud.chat.service.ILiftCaseService;

/**
 * 专家订单超时，拒绝接单
 * 
 * @author sKing
 *
 */

@Component
public class RefusedLiftCaseTask {

    private static final Logger logger = LoggerFactory.getLogger(SureLiftCaseTask.class);
    
    @Resource(type = ILiftCaseService.class)
    private ILiftCaseService liftCaseService;
    
    /**
     * 每隔5分钟，定时专家未接单，超时之后，拒绝
     * 线上必须用public ，本地用private也可以
     */
    @Scheduled(cron = "0 */5 * * * ?")
    public void refusedLiftCaseTask() {
       logger.info("开始调用确认诊单方法");
       liftCaseService.refusedLiftCaseTask();
       logger.info("调用确认诊单方法完成");
    }
    
    /**
     * 每隔3分钟，更新未接单颜色等级
     * 线上必须用public ，本地用private也可以
     */
    @Scheduled(cron = "0 */3 * * * ?")
    public void updateColorGrade() {
       logger.info("开始调用确认诊单方法");
       liftCaseService.updateColorGrade();
       logger.info("调用确认诊单方法完成");
    }
}
