解析的一个问题

This commit is contained in:
daihh
2023-02-02 11:43:24 +08:00
parent 22c4719cbc
commit 12de3fd451
2 changed files with 37 additions and 2 deletions

View File

@@ -176,7 +176,7 @@ public class OutSideDataServiceImpl implements IOutSideDataService {
return null;
}
if(rootNode.get("result")!=null & rootNode.get("result").isObject()) {
if(rootNode.get("result")!=null & rootNode.get("result").isArray()) {
JsonNode result = rootNode.get("result");
Iterator<JsonNode> elements = result.elements();
while (elements.hasNext()){
@@ -189,6 +189,41 @@ public class OutSideDataServiceImpl implements IOutSideDataService {
return orgIds;
}
// public static void main(String[] args) {
// List<String> orgIds = new ArrayList<>();
// String token = "eyJ0eXBlIjoidG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC91LmJvZS5jb20iLCJpYXQiOjE2NzUzMDkxMDcsImV4cCI6MTY3NTMxNjMwNywiR2l2ZW5OYW1lIjoiYm9ldSIsInVzZXJJZCI6IjdFMDY1NzQxLTkzRUItRTc1Ni02Mzk5LUIwQTA1QUY2NEE3OSIsInVJZCI6Ijk2NTM2OTU4MjM5Mjk3MTI2NCIsInBlcm1pc3Npb24iOiIifQ==.6780daf88206d3f4f2cfc184268f4c1b80f25a916105219a5a6f2e904762b1e8";
// String type="application/json";
// String[] headers=new String[] {"token",token,"Content-Type",type};
// String url= ("https://u.boe.com/userbasic/org/manageOrgIds");
// ObjectMapper mapper=new ObjectMapper();
// String responseStr=null;
// try{
// OkHttpUtil http=new OkHttpUtil();
// responseStr = http.doPostJson(url,"{}", headers);
// System.out.println(responseStr);
// JsonNode rootNode= mapper.readTree(responseStr);
// int code = rootNode.get("status").asInt();
// System.out.println("code="+code);
// if(code!=200) {
// log.error("获取当前用户拥有权限机构id错误"+responseStr);
// }
//
// if(rootNode.get("result")!=null & rootNode.get("result").isArray()) {
// JsonNode result = rootNode.get("result");
// Iterator<JsonNode> elements = result.elements();
// while (elements.hasNext()){
// orgIds.add(elements.next().toString());
// }
// }
// for(String str : orgIds) {
// System.out.println(str);
// }
// }catch (Exception e){
// log.error("获取当前用户有权限的机构id错误",e);
// }
//
// }
private String getBaseUrl(String url) {
String baseUrl=SysConstant.getConfigValue("xboe.server.userbasic.url");

View File

@@ -115,7 +115,7 @@ public class CourseManageApi extends ApiBaseController{
try {
List<String> orgIds = outSideDataService.getOrgIds();
String ids= StringUtils.join(orgIds,",");
log.info("获取到的用户的组织机构权限ids",ids);
//log.info("获取到的用户的组织机构权限ids",ids);
String aid=getCurrent().getAccountId();
//如果前端查询当前人的,这里去掉
if(StringUtils.isNotBlank( dto.getAid())) {