|
@@ -868,80 +868,80 @@ namespace Hotline.Api.Controllers.DataSharing
|
|
|
/// <summary>
|
|
|
/// 服务工单材料接口--测试
|
|
|
/// </summary>
|
|
|
- /// <param name="params">工单材料信息</param>
|
|
|
- /// <param name="files">材料文件</param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost]
|
|
|
[Route("get_case_material_info_test")]
|
|
|
[AllowAnonymous]
|
|
|
public async Task<OpenResponse> GetCaseMaterialInfotest()
|
|
|
{
|
|
|
- var businessFile = _channelConfigurationManager.GetConfigurationBusinessFile();
|
|
|
-
|
|
|
- string result = "";
|
|
|
- byte[] fileContentBytes = null;
|
|
|
- try
|
|
|
- {
|
|
|
- string url = string.Format("{0}{1}?Source={2}&Id={3}", businessFile.BaseUrl, businessFile.DownloadUrlAddress, businessFile.Source, "08dbf49c-85cd-414b-8f1d-c16a811ed96e");
|
|
|
- using (var client = _httpClientFactory.CreateClient())
|
|
|
- using (var response = await client.GetAsync(url))
|
|
|
- {
|
|
|
- if (response.StatusCode == HttpStatusCode.OK)
|
|
|
- {
|
|
|
- using var memoryStream = new MemoryStream();
|
|
|
- //await file.CopyToAsync(memoryStream);
|
|
|
- //memoryStream.Seek(0, SeekOrigin.Begin);
|
|
|
- //byte[] fileContentBytes = memoryStream.ToArray();
|
|
|
-
|
|
|
- await response.Content.CopyToAsync(memoryStream);
|
|
|
- memoryStream.Seek(0, SeekOrigin.Begin);
|
|
|
- fileContentBytes = memoryStream.ToArray();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- catch (Exception)
|
|
|
- { }
|
|
|
|
|
|
- GetCaseMaterialInfoModel dto = new GetCaseMaterialInfoModel()
|
|
|
- {
|
|
|
- CaseSerial = "1111111111",
|
|
|
- MaterialType = "10",
|
|
|
- CliengGuid = "1122222",
|
|
|
- AreaCode = "510000"
|
|
|
- };
|
|
|
-
|
|
|
- //组装请求参数
|
|
|
- var model = new GetCaseMaterialInfoRequest
|
|
|
- {
|
|
|
- paras = dto,
|
|
|
- token = new ClientInfo("11111", "22222")
|
|
|
- };
|
|
|
+ return OpenResponse.Ok(Reponse.Success("成功"));
|
|
|
+ //var businessFile = _channelConfigurationManager.GetConfigurationBusinessFile();
|
|
|
|
|
|
+ //string result = "";
|
|
|
+ //byte[] fileContentBytes = null;
|
|
|
+ //try
|
|
|
+ //{
|
|
|
+ // string url = string.Format("{0}{1}?Source={2}&Id={3}", businessFile.BaseUrl, businessFile.DownloadUrlAddress, businessFile.Source, "08dbf49c-85cd-414b-8f1d-c16a811ed96e");
|
|
|
+ // using (var client = _httpClientFactory.CreateClient())
|
|
|
+ // using (var response = await client.GetAsync(url))
|
|
|
+ // {
|
|
|
+ // if (response.StatusCode == HttpStatusCode.OK)
|
|
|
+ // {
|
|
|
+ // using var memoryStream = new MemoryStream();
|
|
|
+ // //await file.CopyToAsync(memoryStream);
|
|
|
+ // //memoryStream.Seek(0, SeekOrigin.Begin);
|
|
|
+ // //byte[] fileContentBytes = memoryStream.ToArray();
|
|
|
+
|
|
|
+ // await response.Content.CopyToAsync(memoryStream);
|
|
|
+ // memoryStream.Seek(0, SeekOrigin.Begin);
|
|
|
+ // fileContentBytes = memoryStream.ToArray();
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ //catch (Exception)
|
|
|
+ //{ }
|
|
|
|
|
|
- Dictionary<string, object> dicParam = new Dictionary<string, object>();
|
|
|
+ //GetCaseMaterialInfoModel dto = new GetCaseMaterialInfoModel()
|
|
|
//{
|
|
|
- // { "params", "111111" } // 第一个接口参数,json格式字符串
|
|
|
+ // CaseSerial = "1111111111",
|
|
|
+ // MaterialType = "10",
|
|
|
+ // CliengGuid = "1122222",
|
|
|
+ // AreaCode = "510000"
|
|
|
//};
|
|
|
|
|
|
- // 文件内容
|
|
|
- // byte[] file = Convert.FromBase64String(result);//这里需要获取附件的流
|
|
|
+ ////组装请求参数
|
|
|
+ //var model = new GetCaseMaterialInfoRequest
|
|
|
+ //{
|
|
|
+ // paras = dto,
|
|
|
+ // token = new ClientInfo("11111", "22222")
|
|
|
+ //};
|
|
|
|
|
|
- // 构造字典文件数据
|
|
|
- // 接口参数名称为files
|
|
|
- CFormUpload.FileParameter fileParameter = new CFormUpload.FileParameter("files", fileContentBytes, "测试", null);
|
|
|
- dicParam.Add("测试", fileParameter);
|
|
|
- dicParam.Add("params", System.Text.Json.JsonSerializer.Serialize(model));
|
|
|
- string strUrl = "http://localhost:7051/api/receive/get_case_material_info";
|
|
|
- // 上传附件
|
|
|
- string strResult = CFormUpload.MultipartFormDataPost(strUrl, null, dicParam, "");
|
|
|
-
|
|
|
- var responseData = Newtonsoft.Json.JsonConvert.DeserializeObject<ProvinceResponse>(strResult);
|
|
|
- if (responseData != null && responseData.ReturnInfo != null)
|
|
|
- {
|
|
|
|
|
|
- }
|
|
|
+ //Dictionary<string, object> dicParam = new Dictionary<string, object>();
|
|
|
+ ////{
|
|
|
+ //// { "params", "111111" } // 第一个接口参数,json格式字符串
|
|
|
+ ////};
|
|
|
+
|
|
|
+ //// 文件内容
|
|
|
+ //// byte[] file = Convert.FromBase64String(result);//这里需要获取附件的流
|
|
|
+
|
|
|
+ //// 构造字典文件数据
|
|
|
+ //// 接口参数名称为files
|
|
|
+ //CFormUpload.FileParameter fileParameter = new CFormUpload.FileParameter("files", fileContentBytes, "测试", null);
|
|
|
+ //dicParam.Add("测试", fileParameter);
|
|
|
+ //dicParam.Add("params", System.Text.Json.JsonSerializer.Serialize(model));
|
|
|
+ //string strUrl = "http://localhost:7051/api/receive/get_case_material_info";
|
|
|
+ //// 上传附件
|
|
|
+ //string strResult = CFormUpload.MultipartFormDataPost(strUrl, null, dicParam, "");
|
|
|
+
|
|
|
+ //var responseData = Newtonsoft.Json.JsonConvert.DeserializeObject<ProvinceResponse>(strResult);
|
|
|
+ //if (responseData != null && responseData.ReturnInfo != null)
|
|
|
+ //{
|
|
|
|
|
|
+ //}
|
|
|
|
|
|
+ //return OpenResponse.Ok(Reponse.Failed("成功"));
|
|
|
|
|
|
|
|
|
|
|
@@ -973,11 +973,10 @@ namespace Hotline.Api.Controllers.DataSharing
|
|
|
// dicParam.Add(fileName, fileParameter);
|
|
|
// var a = CFormUpload.MultipartFormDataPost("http://localhost:50100/api/v1/Province/get_case_material_info", null, dicParam, null);
|
|
|
//}
|
|
|
- return OpenResponse.Ok(Reponse.Failed("成功"));
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
+ }
|
|
|
|
|
|
+ #region 私有方法
|
|
|
/// <summary>
|
|
|
/// 将文件流上传到附件服务器
|
|
|
/// </summary>
|
|
@@ -1016,15 +1015,7 @@ namespace Hotline.Api.Controllers.DataSharing
|
|
|
return new BusinessFileDto();
|
|
|
|
|
|
}
|
|
|
+ #endregion
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- public class test
|
|
|
- {
|
|
|
-
|
|
|
- [JsonPropertyName("params")]
|
|
|
- public string Params { get; set; }
|
|
|
-
|
|
|
- public List<IFormFile> files { get; set; }
|
|
|
- }
|
|
|
}
|