Bläddra i källkod

Merge branch 'master' of http://git.12345lm.cn/Fengwo/hotline

Dun.Jason 1 år sedan
förälder
incheckning
03936cabe0

+ 61 - 70
src/Hotline.Api/Controllers/DataSharing/ProvinceController.cs

@@ -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; }
-    }
 }

+ 1 - 1
src/Hotline.Api/Controllers/FileController.cs

@@ -128,7 +128,7 @@ namespace Hotline.Api.Controllers
 		/// <param name="id"></param>
 		/// <returns></returns>
 		[Permission(EPermission.FileEntity)]
-		[HttpGet("/{id}")]
+		[HttpGet("{id}")]
 		public async Task<File.File> Entity(string id)
 		{
 			return await _fileRepository.Queryable()

+ 1 - 0
src/Hotline.Application/Handlers/Order/ReceiveOrderNotifyHandler.cs

@@ -41,6 +41,7 @@ namespace Hotline.Application.Handlers.Order
         public Task<AddOrderResponse?> Handle(ReceiveOrderNotify request, CancellationToken cancellationToken)
         {
             var dto = request.AddOrderDto;
+            var file = request.Files;
             switch (dto.Source)
             {
                 case ESource.ProvinceStraight:

+ 24 - 6
src/Hotline.Share/Dtos/DataSharing/Province/ProvinceResponse.cs

@@ -37,18 +37,22 @@
         public string caseid { get; set; }
     }
 
+    /// <summary>
+    /// 省接口调用返回数据
+    /// </summary>
     public class Reponse
     {
-        public int Code { get; set; }
-
-        public string Description { get; set; }
+        public ReponseBase ReturnInfo { get; set; }
 
         public static Reponse Success(string? description = "")
         {
             return new Reponse
             {
-                Code = 1,
-                Description = (description ?? "您已成功提交数据!")
+                ReturnInfo = new ReponseBase
+                {
+                    Code = "1",
+                    Description = (description ?? "您已成功提交数据!")
+                }
             };
         }
 
@@ -56,8 +60,22 @@
         {
             return new Reponse
             {
-                Description = (description ?? "接口调用失败!")
+                ReturnInfo = new ReponseBase
+                {
+                    Code = "0",
+                    Description = (description ?? "接口调用失败!")
+                }
             };
         }
     }
+
+    /// <summary>
+    /// 省调用接口返回状态
+    /// </summary>
+    public class ReponseBase
+    {
+        public string Code { get; set; }
+
+        public string Description { get; set; }
+    }
 }

+ 7 - 0
src/Hotline.Share/Dtos/File/FileDto.cs

@@ -131,4 +131,11 @@ namespace Hotline.Share.Dtos.File
 		/// </summary>
 		public string? Path { get; set; }
 	}
+
+	public class FileJsonDto
+	{
+
+		public string Id { get; set; }
+		public string Path { get; set; }
+	}
 }

+ 3 - 1
src/Hotline.Share/Dtos/Order/OrderDto.cs

@@ -412,7 +412,9 @@ namespace Hotline.Share.Dtos.Order
 
         public List<OrderVisitDto> OrderVisits { get; set; }
 
-    }
+        public List<FileJsonDto>? FileJson { get; set; }
+
+	}
 
     public class UpdateOrderDto : AddOrderDto
     {

+ 1 - 2
src/Hotline.Share/Dtos/Order/OrderScreenDto.cs

@@ -67,7 +67,7 @@ namespace Hotline.Share.Dtos.Order
 		/// </summary>
 		public List<FileDto> Files { get; set; } = new();
 
-		public string FileJson { get; set; }
+		public List<FileJsonDto>? FileJson { get; set; }
 	}
 
 	public class OrderScreenListDto
@@ -183,7 +183,6 @@ namespace Hotline.Share.Dtos.Order
 		/// </summary>
 		public string? WorkflowId { get; set; }
 
-		public string FileJson { get; set; }
 	}
 
 	public class PublishScreenDto {

+ 7 - 1
src/Hotline/DataSharing/Province/Notifications/ReceiveOrderNotify.cs

@@ -1,4 +1,5 @@
-using Hotline.Share.Dtos.Order;
+using Hotline.Share.Dtos.File;
+using Hotline.Share.Dtos.Order;
 using MediatR;
 
 namespace Hotline.DataSharing.Province.Notifications;
@@ -9,4 +10,9 @@ namespace Hotline.DataSharing.Province.Notifications;
 public class ReceiveOrderNotify : IRequest<AddOrderResponse>
 {
     public AddOrderDto AddOrderDto { get; set; }
+
+    /// <summary>
+    /// 附件列表
+    /// </summary>
+    public List<FileDto>? Files { get; set; }
 }