package com.sunxung.factoring.start.impl;

import com.sunxung.factoring.component.util.SpringUtil;
import com.sunxung.factoring.service.sys.workingDayManage.WorkingDayManageService;

/** 数据库初始化 */
public class WorkingDayInit {

    /**
     * 建议本地初始化时，将2116-12-31日期设置更小（如当前年份末尾），缩短初始化执行时间
     * 
     * @throws Exception
     */
    public void run() throws Exception {
        getWorkingDayManageService().addBetweenDates("2019-01-01", "2116-12-31");
    }

    private static WorkingDayManageService workingDayManageService;

    private static WorkingDayManageService getWorkingDayManageService() {
        if (workingDayManageService == null) {
            workingDayManageService = SpringUtil.getBeanByType(WorkingDayManageService.class);
        }
        return workingDayManageService;
    }
}
