package com.xunmei.job.task;


import com.alibaba.fastjson.JSON;
import com.xunmei.common.core.constant.SecurityConstants;
import com.xunmei.common.core.domain.R;
import com.xunmei.common.core.utils.SpringUtils;
import com.xunmei.system.api.RemoteUserService;
import com.xunmei.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 定时任务调度测试
 *
 * @author xunmei
 */

@Component("TestTask")
public class TestTask {

    @Autowired
    private RemoteUserService remoteUserService;

    /**
     * 无参数调用
     */
    public void noParams()
    {
        System.out.println("执行无参方法");
        R<LoginUser> userResult = remoteUserService.getUserInfo("admin", SecurityConstants.INNER);
        System.out.println(JSON.toJSONString(userResult));
    }

    /**
     * 有参数调用
     * @param userName
     */
    public void yesParams(String userName)
    {
        System.out.println("执行单个参方法");
        R<LoginUser> userResult = remoteUserService.getUserInfo(userName, SecurityConstants.INNER);
        System.out.println(JSON.toJSONString(userResult));
    }

    /**
     * 多个参数调用
     * @param userName
     */
    public void manyParams(String userName,String source)
    {
        System.out.println("执行多个方法");
        System.out.println(source);
        R<LoginUser> userResult = remoteUserService.getUserInfo(userName, SecurityConstants.INNER);
        System.out.println(JSON.toJSONString(userResult));
    }


}
