|
|
|
@ -6,6 +6,7 @@ import cn.chjyj.szwh.service.UserService; |
|
|
|
import cn.chjyj.szwh.utils.ProperUtils; |
|
|
|
import cn.chjyj.szwh.utils.RequestUtils; |
|
|
|
import cn.chjyj.szwh.utils.SignUtils; |
|
|
|
import cn.chjyj.szwh.utils.SzwhApiUtils; |
|
|
|
import com.alibaba.fastjson2.JSONObject; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.commons.logging.Log; |
|
|
|
@ -46,29 +47,12 @@ public class UserServiceImpl implements UserService { |
|
|
|
/** |
|
|
|
* 远程获取用户信息 |
|
|
|
* @param userIsli 用户 |
|
|
|
* @param token 用户请求凭据 |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public Map<String,Object> getApiUser(String userIsli,String token) { |
|
|
|
String userHost= ProperUtils.getSzwhProp("REAL_URL");//用户主机
|
|
|
|
if(StringUtils.isEmpty(userHost)){ |
|
|
|
userHost=""; |
|
|
|
} |
|
|
|
// 远程获取用户的信息
|
|
|
|
///users/usermgt/v1/user-info/
|
|
|
|
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,true); |
|
|
|
public Map<String,Object> getApiUser(String userIsli) { |
|
|
|
// 查询到用户信息,完成json 到map 的转换
|
|
|
|
JSONObject json = SzwhApiUtils.getApiUser(userIsli); |
|
|
|
log.info("request result:"+json); |
|
|
|
// json 内容转为map
|
|
|
|
Map rmap = JSONObject.parseObject(json.getString("data")); |
|
|
|
@ -82,8 +66,7 @@ public class UserServiceImpl implements UserService { |
|
|
|
|
|
|
|
@Override |
|
|
|
public Map<String, Object> getUserInfo(String userIsli) { |
|
|
|
String token = SignUtils.createSign("user_real"); |
|
|
|
Map apimap = getApiUser(userIsli,token); |
|
|
|
Map apimap = getApiUser(userIsli); |
|
|
|
if(apimap==null){ |
|
|
|
return null; |
|
|
|
} |
|
|
|
|