package com.zcloud.primeport.plan;

import com.jjb.saas.framework.job.Job;
import com.jjb.saas.framework.job.annotation.JobRegister;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.zcloud.primeport.plan.mjDevice.TwoPersonUtil;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class TwoLevelPersonXxlJob implements Job {

    @Resource
    private TwoPersonUtil twoPersonUtil;

    @Override
    @JobRegister(cron = "0 20 0 * * ?", jobDesc = "闭区定时任务，每日00:20进行当日二级门禁可进门人员推送", triggerStatus = 1)
    @XxlJob("com.zcloud.plan.TwoLevelPersonDockXxlJob")
    public ReturnT<String> execute(String param) {
        try {
            // 二级门禁人员定时对接（含同步一级门禁）
            twoPersonUtil.scheduledPeopleCompany();
        } catch (Exception e) {
            e.printStackTrace();
            return ReturnT.FAIL;
        }
        return ReturnT.SUCCESS;
    }
}
