package com.uas.account.timertask;

import com.uas.account.core.Logger;
import com.uas.account.dao.UserLockDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.DateFormat;
import java.text.SimpleDateFormat;

/**
 * 用户账户锁定定时任务
 *
 * @author wangmh
 */
@Component
public class UserLockTimerTask {

    @Autowired
    private UserLockDao userLockDao;

    private Logger logger = Logger.getLogger();

    @Scheduled(cron = "0 0 0 * * *")
    public void deleteAllLock() {
        try {
            userLockDao.deleteAll();
            logger.info(this.getClass(), "账户锁定", "清除所有账户锁定", null);
        } catch (Exception e) {
            logger.error(this.getClass(), "账户锁定", "清除所有账户锁定", e.getMessage());
        }
    }

}
