package cn.iocoder.yudao.server.job;

import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.server.rest.CrmRest;
import com.google.common.collect.ImmutableMap;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class CrmPersonJob {
    private final CrmRest crmRest;

    public CrmPersonJob(CrmRest crmRest) {
        this.crmRest = crmRest;
    }

    @Scheduled(cron = "0 0 1 * * ?")
    @TenantIgnore
    @DataPermission(enable = false)
    public String executeCrmPerson() throws Exception {
        ImmutableMap<String, String> stringStringImmutableMap = crmRest.refreshToken("ec301168-d9d7-4f0c-a73c-03f50e952a3a");
        crmRest.querySqlUserJob(String.valueOf(stringStringImmutableMap.get("access")));
        return "";
    }
}
