package com.crunii.micro.domain.util;

import com.crunii.micro.domain.dto.CallHolder;
import com.crunii.micro.domain.dto.Worker;

/**
 * @author xiangjunming
 * @date 2023/9/4
 */
public class CurrWorkerUtil {

    /**
     * 获取当前登录用户对象
     *
     * @return
     */
    public static Worker getCurrWorker() {
        CallHolder callInfo = CallHolder.call.get();
        if (callInfo != null && callInfo.getWorker() != null) {
            return callInfo.getWorker();
        } else {
            return null;
        }
    }

    public static void mockCurrWorker() {
        CallHolder callInfo = CallHolder.initialCall();
        Worker worker = new Worker();
        worker.setLoginId(9999);
        worker.setOrgName("团支部");
        worker.setWorkerName("admin");
        worker.setMobile("18716571180");
        worker.setOrgId("1674703692521037822");
        /*worker.setLoginId(99991);
        worker.setOrgName("团支部");
        worker.setWorkerName("卢汉");
        worker.setMobile("18983394419");
        worker.setOrgId("1674703692521037822");*/
        callInfo.setWorker(worker);
    }
}
