...
|
...
|
@@ -95,23 +95,30 @@ func (serviceGateway *HttplibUserServiceGateway) GetCompany(companyId int64) (*t |
|
|
}
|
|
|
|
|
|
// GetDepartment 获取部门信息
|
|
|
func (serviceGateway *HttplibUserServiceGateway) GetDepartment(companyId int64, departmentId int64) (map[string]interface{}, error) {
|
|
|
companyIdStr := strconv.FormatInt(companyId, 10)
|
|
|
url := strings.Join([]string{serviceGateway.baseURL, "companies/" + companyIdStr}, "/")
|
|
|
func (serviceGateway *HttplibUserServiceGateway) GetDepartment(companyId int64, departmentId int64) (*translator.DepartmentDetail, error) {
|
|
|
departmentIdStr := strconv.FormatInt(departmentId, 10)
|
|
|
url := serviceGateway.baseURL + "/org/" + departmentIdStr
|
|
|
request := serviceGateway.createRequest(url, "get")
|
|
|
options := make(map[string]interface{})
|
|
|
options["departmentId"] = departmentId
|
|
|
_, err1 := request.JSONBody(options)
|
|
|
if err1 != nil {
|
|
|
return nil, err1
|
|
|
}
|
|
|
response := make(map[string]interface{})
|
|
|
err2 := request.ToJSON(&response)
|
|
|
if err2 != nil {
|
|
|
return nil, err2
|
|
|
byteResult, err := request.Bytes()
|
|
|
if err != nil {
|
|
|
return nil, fmt.Errorf("获取返回组织失败:%w", err)
|
|
|
}
|
|
|
data, err := serviceGateway.responseHandle(response)
|
|
|
return data, err
|
|
|
log.Logger.Debug("获取用户模块请求数据:返回部门。", map[string]interface{}{
|
|
|
"result": string(byteResult),
|
|
|
})
|
|
|
var result GatewayResponse
|
|
|
err = json.Unmarshal(byteResult, &result)
|
|
|
if err != nil {
|
|
|
return nil, fmt.Errorf("解析返回组织:%w", err)
|
|
|
}
|
|
|
var data translator.DepartmentDetail
|
|
|
err = serviceGateway.getResponseData(result, &data)
|
|
|
return &data, err
|
|
|
}
|
|
|
|
|
|
// GetOrganization 获取组织信息
|
...
|
...
|
|