Browse Source

获取本机组织信息接口

dev
jianjun 3 years ago
parent
commit
47c5a4d4bc
  1. 45
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/api/yt/YantaiApi.java

45
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/api/yt/YantaiApi.java

@ -50,6 +50,49 @@ public class YantaiApi {
*/
//private static final String SSO_BACKGROUND_SERVER_URL = "http://120.220.248.247:8081/";
/**
* desc:根据组织id获取本级组织信息
*
* @param organizationId
* @return
*/
public static OrgData getOuInfoByOuGuid(String organizationId) {
try {
if (StringUtils.isBlank(organizationId)) {
throw new EpmetException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg());
}
//加密
String organizationIdEn = SM4UtilsForYanTai.dealEncryptData(organizationId);
//pwd = URLEncoder.encode(pwd, "UTF-8");
String url = SSO_BACKGROUND_SERVER_URL + "person/ouinfo/getOuInfoByOuGuid";
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("organizationId",organizationIdEn);
log.info("getOuInfoByOuGuid request param:{} url:{}",paramMap, url);
Result<String> result = HttpClientManager.getInstance().sendGet(url, paramMap, getApiHeaderMap());
log.info("getOuInfoByOuGuid request result:{}", result);
if (!result.success()){
return new OrgData();
}
JSONObject jsonObject = JSONObject.parseObject(result.getData());
String secondCode = jsonObject.getString("code");
String secondMessage = jsonObject.getString("message");
if (!"200".equals(secondCode)) {
log.warn("getOuInfoByOuGuid 接口错误");
return new OrgData();
}
//解密
String data = SM4UtilsForYanTai.dealDecryptData(jsonObject.getString("data"));
OrgData orgData = JSON.parseObject(data, OrgData.class);
log.info("getChildOuInfoByGuid request real result:{}", JSON.toJSONString(orgData));
return orgData;
} catch (Exception e) {
log.error("getChildOuInfoByGuid exception", e);
}
return new OrgData();
}
/**
* desc:根据组织id获取下级组织
*
@ -245,6 +288,8 @@ public class YantaiApi {
//getLoginToken("0d554bccfbac4be3846d643252daf92b");
String organizationId = "44e05de9-34fa-48f6-b89f-02838d792cf9";
OrgData ouInfoByOuGuid = getOuInfoByOuGuid(organizationId);
System.out.println("ouInfoByOuGuid:"+JSON.toJSONString(ouInfoByOuGuid));
List<OrgData> childOuInfoByGuid = getChildOuInfoByGuid(organizationId);
System.out.println("childOuInfoByGuid:"+JSON.toJSONString(childOuInfoByGuid));
//先用他说的有人的组织id联调

Loading…
Cancel
Save