package cn.ibizlab.core.util.job;

import com.baomidou.jobs.api.JobsResponse;
import com.baomidou.jobs.exception.JobsException;
import com.baomidou.jobs.handler.IJobsHandler;
import org.springframework.stereotype.Component;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@Component("AnalysisBuildJobHandler")
public class AnalysisBuildJobHandler implements IJobsHandler {

    @Autowired
    @Lazy
    protected cn.ibizlab.core.analysis.service.IDABuildService dabuildService;

    @Override
    public JobsResponse execute(String tenantId, String param) throws JobsException {
        cn.ibizlab.core.analysis.domain.DABuild entity=new cn.ibizlab.core.analysis.domain.DABuild();
        entity.set("tenantid",tenantId);
        entity.set("param",param);
        dabuildService.run(entity);
        log.info("执行 DemoJobHandler tenantId=" + tenantId + ",param=" + param);
        return JobsResponse.ok();
    }
}
