package org.wfc.job.task;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.wfc.common.core.domain.R;
import org.wfc.common.core.utils.MessageUtils;
import org.wfc.system.api.RemoteUserService;
import org.wfc.user.api.RemoteUUserService;

/**
 * @description: omada任务
 * @author: cyc
 * @since: 2025-01-16
 */
@Slf4j
@Component("omadaTask")
public class OmadaTask {

    @Autowired
    private RemoteUUserService remoteUUserService;

    @Autowired
    private RemoteUserService remoteUserService;

    public void syncJob() {
        long startTime = System.currentTimeMillis();
        remoteUserService.deviceJob();
        remoteUUserService.addCdrInfoByOmadaApi();
        long endTime = System.currentTimeMillis();
        log.info(MessageUtils.message("job.execute.success", endTime - startTime));
    }

    public R<String> testOmadaApi() {
        return remoteUserService.testJob();
    }

    public R<Boolean> initJob() {
        return remoteUserService.settingJob();
    }
}
