0
This commit is contained in:
@@ -66,6 +66,13 @@ namespace Gatedge.K3Cloud.Utils
|
||||
orgNum: orgNum
|
||||
);
|
||||
this._userInfo = User;
|
||||
|
||||
_cloudApi.LoginByAppSecret(
|
||||
DBID,
|
||||
userName,
|
||||
kingdeeOption?.AppID,
|
||||
kingdeeOption?.AppSec,
|
||||
lcId);
|
||||
}
|
||||
|
||||
|
||||
@@ -157,16 +164,34 @@ namespace Gatedge.K3Cloud.Utils
|
||||
public ListResult QueryList(Query queryParam)
|
||||
{
|
||||
var datastr = queryParam.ToString();
|
||||
var resultString = _cloudApi.BillQuery(datastr);
|
||||
var ApiResult = _cloudApi.ExecuteBillQuery(datastr);
|
||||
|
||||
var resultString = Newtonsoft.Json.JsonConvert.SerializeObject(ApiResult);
|
||||
// 包含ErrorCode认定为失败
|
||||
if (resultString.Contains("ErrorCode"))
|
||||
{
|
||||
var errorResult = JsonSerializer.Deserialize<KingdeeResult>(resultString);
|
||||
var errResultString = Newtonsoft.Json.JsonConvert.SerializeObject(ApiResult.First().First());
|
||||
var errorResult = JsonSerializer.Deserialize<KingdeeResult>(errResultString);
|
||||
var responseStatus = errorResult?.Result?.ResponseStatus;
|
||||
Exception error = new K3CloudException("查看单据列表出错", responseStatus);
|
||||
throw error;
|
||||
}
|
||||
List<Dictionary<string, object>>? result = JsonSerializer.Deserialize<List<Dictionary<string, object>>>(resultString);
|
||||
var fieldKeys = queryParam?.FieldKeys?.Split(',').ToList();
|
||||
if (fieldKeys == null || fieldKeys.Count == 0)
|
||||
{
|
||||
return new ListResult(new List<Dictionary<string, object>>());
|
||||
}
|
||||
List<Dictionary<string, object>> result = new List<Dictionary<string, object>>();
|
||||
foreach (var item in ApiResult)
|
||||
{
|
||||
var line = new Dictionary<string, object>();
|
||||
foreach (var fieldkey in fieldKeys)
|
||||
{
|
||||
var index = fieldKeys.IndexOf(fieldkey);
|
||||
line.Add(fieldkey, item[index]);
|
||||
}
|
||||
result.Add(line);
|
||||
}
|
||||
return new ListResult(result);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Gatedge.K3Cloud.Utils.Model.K3Request
|
||||
/// 过滤条件
|
||||
/// </summary>
|
||||
//public List<FilterItem>? FilterString { get; set; }
|
||||
public List<FilterItem>? FilterString { get; set; }
|
||||
public string? FilterString { get; set; }
|
||||
/// <summary>
|
||||
/// 排序字段
|
||||
/// </summary>
|
||||
|
||||
@@ -139,19 +139,14 @@ namespace Gatedge.ScanCode.Controllers
|
||||
{
|
||||
return AjaxResult.Error(500, "配置文件没有对应的第三方授权登录信息!");
|
||||
}
|
||||
|
||||
//组装登录信息
|
||||
K3CloudApi client = new K3CloudApi();
|
||||
client.InitClient(
|
||||
acctID: kingdeeOption.AcctID,
|
||||
appID: kingdeeOption.AppID,
|
||||
appSec: kingdeeOption.AppSec,
|
||||
serverUrl: kingdeeOption.ServerUrl,
|
||||
userName: kingdeeOption.UserName,
|
||||
lcid: kingdeeOption.LCID,
|
||||
orgNum: kingdeeOption.OrgNumber
|
||||
);
|
||||
client.LoginByAppSecret(kingdeeOption.AcctID, kingdeeOption.UserName, kingdeeOption.AppID, kingdeeOption.AppSec, kingdeeOption.LCID);
|
||||
_utils.InitCloudApi(new LoginInfo()
|
||||
{
|
||||
DBID = kingdeeOption.AcctID,
|
||||
UserName = kingdeeOption.UserName,
|
||||
LCId = kingdeeOption.LCID,
|
||||
OrgNum = kingdeeOption.OrgNumber,
|
||||
ServerUrl = kingdeeOption.ServerUrl,
|
||||
});
|
||||
Query queryParam = new Query()
|
||||
{
|
||||
FormId = "SEC_User",
|
||||
@@ -160,41 +155,9 @@ namespace Gatedge.ScanCode.Controllers
|
||||
FilterList filterString = new FilterList();
|
||||
FilterItem FNameItem = new FilterItem("FUserAccount", "67", dataCenter.UserName, "0");
|
||||
filterString.AddFilterItem(FNameItem);
|
||||
queryParam.FilterString = filterString.GetFilterString();
|
||||
|
||||
//queryParam.FilterString += @$"FUserAccount = '{dataCenter.UserName}'";
|
||||
var requestInfo = queryParam.ToString();
|
||||
var resultList = client.ExecuteBillQuery(requestInfo);
|
||||
//var resultString = client.BillQuery(queryParam.ToString());
|
||||
//// 包含ErrorCode认定为失败
|
||||
//if (resultString.Contains("ErrorCode"))
|
||||
//{
|
||||
// var errorResult = JsonSerializer.Deserialize<KingdeeResult>(resultString);
|
||||
// var responseStatus = errorResult?.Result?.ResponseStatus;
|
||||
// Exception error = new K3CloudException("查看单据列表出错", responseStatus);
|
||||
// throw error;
|
||||
//}
|
||||
|
||||
//List<dynamic>? result = JsonSerializer.Deserialize<List<dynamic>>(resultString);
|
||||
//if (result?.Count == 0)
|
||||
//{
|
||||
// return AjaxResult.Error(500, "用户名没有组织权限,或用户名不存在!");
|
||||
//}
|
||||
List<Dictionary<string, string>> result = new List<Dictionary<string, string>>();
|
||||
foreach (var item in resultList)
|
||||
{
|
||||
Dictionary<string, string> ResultItem = new Dictionary<string, string>();
|
||||
ResultItem.Add("FUserID", item[0].ToString());
|
||||
ResultItem.Add("FName", item[1].ToString());
|
||||
ResultItem.Add("FUserAccount", item[2].ToString());
|
||||
ResultItem.Add("FOrgOrgId", item[3].ToString());
|
||||
ResultItem.Add("FOrgOrgNumber", item[4].ToString());
|
||||
ResultItem.Add("FOrgOrgName", item[5].ToString());
|
||||
result.Add(ResultItem);
|
||||
}
|
||||
|
||||
|
||||
return AjaxResult.Success(result);
|
||||
queryParam.FilterString = $"FUserAccount = '{dataCenter.UserName}'";
|
||||
var resultList = _utils.QueryList(queryParam);
|
||||
return AjaxResult.Success(resultList.List);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
BIN
Library/Kingdee.BOS.WebApi.Client.dll
Normal file
BIN
Library/Kingdee.BOS.WebApi.Client.dll
Normal file
Binary file not shown.
Reference in New Issue
Block a user