package cn.iocoder.yudao.module.system.job;

import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
@Slf4j
public class BpmBusinessClosureJob implements JobHandler {

    private final static Logger logger = LoggerFactory.getLogger(BpmBusinessClosureJob.class);

    @Resource
    private BpmProcessInstanceApi processInstanceApi;

    @Override
    @TenantJob
    public String execute(String param) {


        Boolean b = processInstanceApi.timedClosureProcess();
        logger.info("租户{}月底取消未审批事项情况{}", TenantContextHolder.getTenantId(), b);

        return String.format("租户{}月底取消未审批事项情况{}", TenantContextHolder.getTenantId(), b);
    }

}
