package com.iformall.schedule;

import com.iformall.service.WxMsgRecordService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class WxMsgRecordSchedule {

    @Resource
    private WxMsgRecordService msgRecordService;

    @Value("${fm.clear_data_before_msg_record}")
    private int monthBefore;

    @Scheduled(cron = "0 0 1 1 * ?") // 每月1日凌晨01:00清理过期的wx_msg_record表
    public void clearOldData() {
        msgRecordService.clearOldData(monthBefore);
    }
}
