package org.cs.web.weixin.ws;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import java.rmi.RemoteException;

@Service
public class HrmUserWsInvok {

    private Logger logger = LoggerFactory.getLogger(HrmUserWsInvok.class);

    public JSONObject getUserRet(String userId)  throws RemoteException {

        /***调用网络服务axis调用webservice**/
        HrmUserServiceStub hrmUserServiceStub = new HrmUserServiceStub("http://192.168.3.77/services/HrmUserService");

        //getUserByInfo，参数userid，类型字符串，返回值为string，格式为json，
        //{ret:成功标识,msg:返回信息,personcode:工号,status:状态}
        HrmUserServiceStub.GetUserByInfo userByInfo = new HrmUserServiceStub.GetUserByInfo();
        userByInfo.setIn0(userId);

        HrmUserServiceStub.GetUserByInfoResponse userByInfoResponse = hrmUserServiceStub.getUserByInfo(userByInfo);

        String result = userByInfoResponse.getOut();

        logger.info("result:================="+result);

        return JSON.parseObject(result);
    }
}
