package com.ssm.task;

import com.ssm.manage.entity.BaseStore;
import com.ssm.manage.service.SsmBaseStoreService;
import com.ssm.manage.service.SsmCallNumberService;

import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.QuartzJobBean;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class SsmCallNumTask extends QuartzJobBean {
    @Autowired
    private SsmBaseStoreService ssmBaseStoreService;
    @Autowired
    private SsmCallNumberService ssmCallNumberService;

    @Override
    protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        //查询所有门店
        List<BaseStore> storeList = ssmBaseStoreService.selectAll();
        for (BaseStore baseStore : storeList) {
            //删除门店下未开单缓存记录
            ssmCallNumberService.deleteCallNum(baseStore.getId());
        }
    }
}
