package com.persagy.adm.server.backstage.jobhandler;

import com.persagy.adm.server.algorithm.constant.AdmServerConstant;
import com.persagy.adm.server.backstage.service.impl.AdmAnalysisFacade;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * 执行器类
 * @author : lijie
 * Update By 2022/1/24 20:32
 */
@Slf4j
@Component
public class CommonTimeRuleJob {
	/**
	 * 模型解析任务
	 * return : void
	 * @author : lijie
	 * Update By 2022/1/25 13:52
	 */
    @XxlJob(AdmServerConstant.MODEL_ANALYSIS_TIME_RULE_JOB)
    public void modelAnalysisJobHandler() throws Exception {
        XxlJobHelper.log("modelAnalysisTimeRuleJob start ...");
        log.info("modelAnalysisTimeRuleJob start ...");
        try {
			AdmAnalysisFacade.analysisAdmModelFile();
			XxlJobHelper.handleSuccess();
		} catch (Exception e) {
			log.error("模型解析定时任务执行失败", e);
			XxlJobHelper.handleFail(e.getMessage());
		} finally {
			log.info("modelAnalysisTimeRuleJob end ... ");
		}
    }

}
