mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-09 10:56:50 +08:00
调用第三方接口,加用户有权限的机构列表
This commit is contained in:
@@ -18,4 +18,10 @@ public interface IOutSideDataService {
|
|||||||
*/
|
*/
|
||||||
UserData getUserInfoByUserId(String userId);
|
UserData getUserInfoByUserId(String userId);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户有权限的机构id
|
||||||
|
* */
|
||||||
|
List<String> getOrgId();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
package com.xboe.data.outside;
|
package com.xboe.data.outside;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
@@ -128,7 +125,39 @@ public class OutSideDataServiceImpl implements IOutSideDataService {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getOrgId() {
|
||||||
|
List<String> orgIds = new ArrayList<>();
|
||||||
|
String token = TokenProxy.getToken(request);
|
||||||
|
String type="application/json";
|
||||||
|
String[] headers=new String[] {"token",token,"Content-Type",type};
|
||||||
|
String url= getBaseUrl("/org/listOrgIds");
|
||||||
|
ObjectMapper mapper=new ObjectMapper();
|
||||||
|
String responseStr=null;
|
||||||
|
try{
|
||||||
|
responseStr = okHttpUtil.doPostJson(url,"{}", headers);
|
||||||
|
JsonNode rootNode= mapper.readTree(responseStr);
|
||||||
|
int code = rootNode.get("code").asInt();
|
||||||
|
if(code!=200) {
|
||||||
|
log.error("获取当前用户拥有权限机构id错误:"+responseStr);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(rootNode.get("result")!=null & rootNode.get("result").isObject()) {
|
||||||
|
JsonNode result = rootNode.get("result");
|
||||||
|
Iterator<JsonNode> elements = result.elements();
|
||||||
|
while (elements.hasNext()){
|
||||||
|
orgIds.add(elements.next().toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("获取当前用户有权限的机构id错误",e);
|
||||||
|
}
|
||||||
|
return orgIds;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private String getBaseUrl(String url) {
|
private String getBaseUrl(String url) {
|
||||||
String baseUrl=SysConstant.getConfigValue("xboe.server.userbasic.url");
|
String baseUrl=SysConstant.getConfigValue("xboe.server.userbasic.url");
|
||||||
if(StringUtils.isBlank(baseUrl)) {
|
if(StringUtils.isBlank(baseUrl)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user