1 changed files with 43 additions and 0 deletions
@ -0,0 +1,43 @@ |
|||
package cn.chjyj.szwh.utils; |
|||
|
|||
import cn.chjyj.szwh.service.impl.UserServiceImpl; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.apache.commons.logging.Log; |
|||
import org.apache.commons.logging.LogFactory; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 系统操作工具集合 |
|||
*/ |
|||
public class SzwhApiUtils { |
|||
private static Log log = LogFactory.getLog(UserServiceImpl.class); |
|||
|
|||
/** |
|||
* 远程获取用户信息 |
|||
* @param userIsli |
|||
* @return |
|||
*/ |
|||
public static JSONObject getApiUser(String userIsli) { |
|||
String userHost= ProperUtils.getSzwhProp("REAL_URL");//用户主机
|
|||
if(StringUtils.isEmpty(userHost)){ |
|||
userHost=""; |
|||
} |
|||
// 远程获取用户的信息
|
|||
String userUrl=userHost+"/users/usermgt/v1/user-info/"+userIsli; |
|||
log.info("rquest url:"+userUrl); |
|||
// 创建签名
|
|||
String sign= SignUtils.createSign("user_real"); |
|||
log.info("user token:"+sign); |
|||
// 请求头
|
|||
Map<String,Object> hmap =new HashMap(); |
|||
hmap.put("token",sign); |
|||
hmap.put("Content-Type","application/json"); |
|||
//执行请求
|
|||
JSONObject json = RequestUtils.GetData(userUrl,hmap); |
|||
log.info("request result:"+json); |
|||
return json; |
|||
} |
|||
} |
|||
Loading…
Reference in new issue