package cc.smtweb.system.bpm.web.sys.oneTimeService;

import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.EntityHelper;
import cc.smtweb.framework.core.systask.BaseSysService;
import cc.smtweb.framework.core.util.DateUtil;

/**
 * Created by Akmm at 2021/12/6 19:19
 * 清除当前已结束任务, 10分钟一次
 */
public class OneTimeTaskCleanService extends BaseSysService {
    @Override
    public String getTitle() {
        return "清理后台任务";
    }

    @Override
    public int getInterval() {
        return 600;
    }

    @Override
    public void work() {
        String t = DateUtil.getNowYm() + "01000000";
        DbEngine.getInstance().update("delete from " + EntityHelper.getSchemaTableName(OnetimeTask.ENTITY_NAME) + " where sot_statu=? and sot_create_time<?", OneTimeStatu.SUCCESS.value, t);
    }
}
