😎新增manage创建流程服务
This commit is contained in:
parent
623e2326bf
commit
9d299f48de
@ -259,12 +259,61 @@ public class SolidWorksManageService : IDynamicApiController, ITransient
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 导出相关文件(全部)
|
||||
/// 创建流程
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<ManageResponse> ExportRelatedFiles(CheckDataInput input)
|
||||
public async Task<ManageResponse> CreateProcess(CreateProjectInput input)
|
||||
{
|
||||
// 获取 SolidWorksManage 地址
|
||||
string apiUrl = await _sysConfigService.GetConfigValueByCode<string>(ConfigConst.SolidWorksManageApiUrl);
|
||||
// 拼接接口地址
|
||||
string url = $"{apiUrl}/api/PropertyCard/CreateProcess";
|
||||
//获取token
|
||||
var token = await _sysConfigService.GetConfigValueByCode<string>(ConfigConst.SolidWorksManageAuthorization);
|
||||
// 将参数对象序列化为 JSON 字符串
|
||||
string jsonParameters = JsonConvert.SerializeObject(input);
|
||||
// 设置请求内容
|
||||
var content = new StringContent(jsonParameters, Encoding.UTF8, "application/json");
|
||||
client.DefaultRequestHeaders.Remove("Authorization");
|
||||
// 添加 Authorization 到请求头
|
||||
client.DefaultRequestHeaders.Add("Authorization", token);
|
||||
// 发送 POST 请求
|
||||
HttpResponseMessage response = await client.PostAsync(url, content);
|
||||
// 处理响应
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
string responseBody = await response.Content.ReadAsStringAsync();
|
||||
// 解析 JSON 数据
|
||||
var result = JsonConvert.DeserializeObject<ManageResponse>(responseBody);
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
string responseBody = await response.Content.ReadAsStringAsync();
|
||||
|
||||
var errorResponse = new ManageResponse()
|
||||
{
|
||||
Success = false,
|
||||
Message = responseBody,
|
||||
Data = "",
|
||||
CustomAction = "",
|
||||
CustomAttributes = ""
|
||||
};
|
||||
return errorResponse;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导出相关文件(全部)
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<ManageResponse> ExportRelatedFiles(CheckDataInput input)
|
||||
{
|
||||
// 获取 SolidWorksManage 地址
|
||||
string apiUrl = await _sysConfigService.GetConfigValueByCode<string>(ConfigConst.SolidWorksManageApiUrl);
|
||||
|
Loading…
Reference in New Issue
Block a user