Selaa lähdekoodia

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

Dun.Jason 1 vuosi sitten
vanhempi
commit
483c14de10

+ 2 - 2
src/Hotline.Api/Controllers/DataSharing/ProvinceController.cs

@@ -852,8 +852,8 @@ namespace Hotline.Api.Controllers.DataSharing
                     AreaCode = tmpCaseMaterialInfo.AreaCode,
                     FileName = file.FileName,
                     FileSize = file.Length,
-                    Additions = businessFileDto.path,
-                    FileId = businessFileDto.id,
+                    Additions = businessFileDto.id,
+                    Path = businessFileDto.path,
                     Direction = "2",
                     SyncState = "1"
                 };

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

@@ -43,25 +43,25 @@ namespace Hotline.Api.Controllers
 		/// </summary>
 		/// <param name="dtos"></param>
 		/// <returns></returns>
-		//[Permission(EPermission.AddFile)]
-		//[HttpPost]
-		//public async Task Add([FromBody] List<FileDto> dtos)
-		//{
-		//	List<File.File>  files = new List<File.File>();
-  //          foreach (var dto in dtos)
-  //          {
-		//		if (string.IsNullOrEmpty(dto.Key))
-		//			throw UserFriendlyException.SameMessage("请上传附件关联Key");
+		[Permission(EPermission.AddFile)]
+		[HttpPost]
+		public async Task Add([FromBody] List<FileDto> dtos)
+		{
+			List<File.File> files = new List<File.File>();
+			foreach (var dto in dtos)
+			{
+				if (string.IsNullOrEmpty(dto.Key))
+					throw UserFriendlyException.SameMessage("请上传附件关联Key");
 
-		//		var model = _mapper.Map<File.File>(dto);
-		//		model.OrgName = _sessionContext.OrgName;
-		//		model.OrgId = _sessionContext.OrgId;
-		//		model.UserId = _sessionContext.UserId;
-		//		model.UserName = _sessionContext.UserName;
-		//		files.Add(model);
-		//	}
-		//	await _fileRepository.AddRangeAsync(files, HttpContext.RequestAborted);
-		//}
+				var model = _mapper.Map<File.File>(dto);
+				model.OrgName = _sessionContext.OrgName;
+				model.OrgId = _sessionContext.OrgId;
+				model.UserId = _sessionContext.UserId;
+				model.UserName = _sessionContext.UserName;
+				files.Add(model);
+			}
+			await _fileRepository.AddRangeAsync(files, HttpContext.RequestAborted);
+		}
 
 		/// <summary>
 		/// 删除附件

+ 7 - 5
src/Hotline.Api/Controllers/OrderController.cs

@@ -1483,7 +1483,7 @@ public class OrderController : BaseController
             model.CrUser = _sessionContext.UserName;
             model.State = 0;
             model.InitId();
-            if (dto.Files.Any()) await _fileRepository.AddFileAsync(dto.Files, model.Id, HttpContext.RequestAborted);
+            if (dto.Files.Any()) model.FileJson = await _fileRepository.AddFileAsync(dto.Files, model.Id, HttpContext.RequestAborted);
 			await _orderUrgeRepository.AddAsync(model, HttpContext.RequestAborted);
             if (dto.AcceptSms)
             {
@@ -1530,7 +1530,7 @@ public class OrderController : BaseController
         urge.ReplyContent = dto.ReplyContent;
         urge.ReplyTime = DateTime.Now;
         urge.State = 1;
-        if (dto.Files.Any()) await _fileRepository.AddFileAsync(dto.Files, urge.Id, HttpContext.RequestAborted);
+        if (dto.Files.Any()) urge.ReplyFileJson = await _fileRepository.AddFileAsync(dto.Files, urge.Id, HttpContext.RequestAborted);
         await _orderUrgeRepository.UpdateAsync(urge, HttpContext.RequestAborted);
     }
 
@@ -2025,9 +2025,11 @@ public class OrderController : BaseController
         if ((int)order.Source <= 1)
             throw UserFriendlyException.SameMessage("工单来源无效,请确认当前工单来源");
         var model = _mapper.Map<OrderSendBack>(dto);
-        var id = await _orderSendBackRepository.AddAsync(model, HttpContext.RequestAborted);
-        if (dto.Files.Any()) await _fileRepository.AddFileAsync(dto.Files, id, HttpContext.RequestAborted);
-        if (!string.IsNullOrEmpty(id))
+        model.InitId();
+        if (dto.Files.Any()) model.FileJson = await _fileRepository.AddFileAsync(dto.Files, model.Id, HttpContext.RequestAborted);
+		await _orderSendBackRepository.AddAsync(model, HttpContext.RequestAborted);
+      
+        if (!string.IsNullOrEmpty(model.Id))
         {
             order = await _orderRepository.GetAsync(dto.OrderId, HttpContext.RequestAborted);
             order.Status = EOrderStatus.BackToProvince;

+ 7 - 4
src/Hotline.Repository.SqlSugar/File/FileRepository.cs

@@ -23,23 +23,26 @@ namespace Hotline.Repository.SqlSugar.File
 			_mapper = mapper;
 		}
 
-		public async Task<string> AddFileAsync(List<FileDto> files, string id, CancellationToken cancellationToken) 
+		public async Task<List<FileJson>> AddFileAsync(List<FileDto> files, string id,CancellationToken cancellationToken, string flowId = "") 
 		{
 			List<Hotline.File.File> newFiles =  new List<Hotline.File.File>();
-			files = files.Where(x => string.IsNullOrEmpty(x.Id)).ToList();
+			var query = Db.Queryable<Hotline.File.File>().Where(x => x.Key == id);
+			if (!string.IsNullOrEmpty(flowId)) query.Where(x => x.FlowKey == flowId);
+			var deleteFilesId = await query.Select(x=>x.Id).ToListAsync(cancellationToken);
+			await Db.Deleteable<Hotline.File.File>().In(x=>x.Id , deleteFilesId).ExecuteCommandAsync(cancellationToken);
 			foreach (FileDto file in files)
 			{
 				file.OrgName = _sessionContext.OrgName;
 				file.OrgId = _sessionContext.OrgId;
 				file.UserId = _sessionContext.UserId;
 				file.UserName = _sessionContext.UserName;
+				file.FlowKey = flowId;
 				file.Key = id;
 				var model = _mapper.Map<Hotline.File.File>(file);
 				newFiles.Add(model);
 			}
 			await AddRangeAsync(newFiles, cancellationToken);
-			var array = from item in newFiles select new { item.Id, item.Path };
-			return array.Any() ? JsonConvert.SerializeObject(array) : string.Empty;
+			return newFiles.Select(x=> new FileJson { Id = x.Id,Path = x.Path}).ToList();
 		}
 	}
 }

+ 0 - 1
src/Hotline.Share/Dtos/DataSharing/Enterprise/EnterpriseResponse.cs

@@ -47,7 +47,6 @@ namespace Sharing.Share.Dtos.DataSharing.Enterprise
         /// <summary>
         /// 成功
         /// </summary>
-        /// <param name="data"></param>
         /// <param name="description"></param>
         /// <returns></returns>
         public static EnterpriseDeResponse Success(string? description = "")

+ 9 - 2
src/Hotline.Share/Dtos/File/FileDto.cs

@@ -10,7 +10,6 @@ namespace Hotline.Share.Dtos.File
 	public class FileDto
 	{
 
-		public string? Id { get; set; }
 
 		/// <summary>
 		/// 附件名称
@@ -22,6 +21,13 @@ namespace Hotline.Share.Dtos.File
 		/// </summary>
 		public string? Key { get; set; }
 
+
+		/// <summary>
+		/// 附件流程KEY
+		/// </summary>
+		public string? FlowKey { get; set; }
+
+
 		/// <summary>
 		/// 附件类型
 		/// </summary>
@@ -68,7 +74,8 @@ namespace Hotline.Share.Dtos.File
 		/// 附件路径
 		/// </summary>
 		public string? Path { get; set; }
-	}
+
+}
 	public class UpdateFileDto: FileDto
 	{
 		public string Id { get; set; }

+ 27 - 18
src/Hotline/DataSharing/Province/Services/ProvinceService.cs

@@ -948,6 +948,21 @@ namespace Hotline.DataSharing.Province.Services
                 default:
                     break;
             }
+
+            //将未接通未做评价的默认为满意
+            switch (dto.SubjectResultSatifyCode)
+            {
+                case "1":
+                case "2":
+                case "3":
+                case "4":
+                case "5":
+                    break;
+                default:
+                    dto.SubjectResultSatifyCode = "3";
+                    break;
+            }
+
             //如果省上下来的工单走服务工单交办评价接口,不是省上派下来的工单,走服务工单评价接口
             if (dto.Order.IsProvince && dto.Order.Source == ESource.ProvinceStraight)
             {
@@ -975,16 +990,7 @@ namespace Hotline.DataSharing.Province.Services
                 data.Id = await _submitVisitInfoRepository.AddAsync(data, cancellationToken);
 
                 //将待推送数据写入待推送表
-                DsWaitingPushData pushData = new()
-                {
-                    ServiceInterface = "SubmitVisitInfo",
-                    Data = System.Text.Json.JsonSerializer.Serialize(data),
-                    Priority = 0,
-                    PushUrl = "submit_visit_info",
-                    Method = HttpMethods.Post,
-                    SyncID = data.Id
-                };
-                await _waitingPushDataRepository.AddAsync(pushData, cancellationToken);
+                await InitPushData("SubmitVisitInfo", System.Text.Json.JsonSerializer.Serialize(data), "submit_visit_info", data.Id, 0, cancellationToken);
 
                 //组装110数据
                 if (dto.Order.Source == ESource.Police110)
@@ -1637,6 +1643,7 @@ namespace Hotline.DataSharing.Province.Services
                         Key = item.Key,
                         Type = item.Type,
                         Additions = item.Additions,
+                        Path = item.Path,
                         Direction = "1",
                         SyncState = "0"
                     };
@@ -1645,22 +1652,22 @@ namespace Hotline.DataSharing.Province.Services
                     switch (item.Classify)
                     {
                         case "1":
-                            materialInfo.MaterialType = "10";
+                            materialInfo.MaterialType = "10";//受理材料
                             break;
                         case "2":
-                            materialInfo.MaterialType = "20";
+                            materialInfo.MaterialType = "20";//环节材料
                             break;
                         case "3":
-                            materialInfo.MaterialType = "30";
+                            materialInfo.MaterialType = "30";//结果材料
                             break;
                         case "4":
-                            materialInfo.MaterialType = "40";
+                            materialInfo.MaterialType = "40";//回访评价材料
                             break;
                         case "5":
-                            materialInfo.MaterialType = "50";
+                            materialInfo.MaterialType = "50";//督办材料
                             break;
                         case "6":
-                            materialInfo.MaterialType = "60";
+                            materialInfo.MaterialType = "60";//知识库材料
                             break;
                         default:
                             break;
@@ -1715,7 +1722,6 @@ namespace Hotline.DataSharing.Province.Services
             return pwd;
         }
 
-        #endregion
         #endregion
 
         /// <summary>
@@ -1728,7 +1734,7 @@ namespace Hotline.DataSharing.Province.Services
         /// <param name="Priority"></param>
         /// <param name="cancellationToken"></param>
         /// <returns></returns>
-        public async Task InitPushData(string ServiceInterface, string Data, string PushUrl, string SyncID, int Priority, CancellationToken cancellationToken)
+        private async Task InitPushData(string ServiceInterface, string Data, string PushUrl, string SyncID, int Priority, CancellationToken cancellationToken)
         {
             //将待推送数据写入待推送表
             DsWaitingPushData pushData = new()
@@ -1742,5 +1748,8 @@ namespace Hotline.DataSharing.Province.Services
             };
             await _waitingPushDataRepository.AddAsync(pushData, cancellationToken);
         }
+        #endregion
+
+
     }
 }

+ 4 - 5
src/Hotline/DataSharing/Province/Services/PusherProviderService.cs

@@ -1217,7 +1217,7 @@ namespace Hotline.DataSharing.Province.Services
                 var dataReceive = _mapper.Map<GetCaseMaterialInfoModel>(item);
 
                 //附件上传
-                var result = await SendFileData(dataReceive, item.FileName, item.FileId, cancellationToken);
+                var result = await SendFileData(dataReceive, item.FileName, item.Additions, cancellationToken);
                 if (result != null && result.ReturnInfo != null)
                 {
                     //结果处理
@@ -1335,10 +1335,9 @@ namespace Hotline.DataSharing.Province.Services
                 return Newtonsoft.Json.JsonConvert.DeserializeObject<ProvinceResponse>(strResult);
             }
             catch (Exception)
-            { }
-
-            return Newtonsoft.Json.JsonConvert.DeserializeObject<ProvinceResponse>("");
-
+            {
+                return new ProvinceResponse();
+            }
         }
 
         /// <summary>

+ 6 - 6
src/Hotline/DataSharing/Province/XieTong/Receive/DsGetCaseMaterialInfo.cs

@@ -35,12 +35,6 @@ namespace Hotline.DataSharing.Province.XieTong.Receive
         [SugarColumn(ColumnDescription = "附件名称", ColumnDataType = "varchar(100)")]
         public string? FileName { get; set; }
 
-        /// <summary>
-        /// 附件Id
-        /// </summary>
-        [SugarColumn(ColumnDescription = "附件Id", ColumnDataType = "varchar(50)")]
-        public string? FileId { get; set; }
-
         /// <summary>
         /// 附件大小
         /// </summary>
@@ -65,6 +59,12 @@ namespace Hotline.DataSharing.Province.XieTong.Receive
 		[SugarColumn(ColumnDescription = "附件")]
         public string? Additions { get; set; }
 
+        /// <summary>
+		/// 附件路径
+		/// </summary>
+		[SugarColumn(ColumnDescription = "附件路径")]
+        public string? Path { get; set; }
+
         /// <summary>
         /// 同步方向 1:市州数据向省上推送;	2:省上数据向市州推送;
         /// </summary>       

+ 12 - 0
src/Hotline/File/File.cs

@@ -19,6 +19,12 @@ namespace Hotline.File
 		[SugarColumn(ColumnDescription = "附件Key")]
 		public string Key { get; set; }
 
+		/// <summary>
+		/// 附件流程KEY
+		/// </summary>
+		[SugarColumn(ColumnDescription = "附件流程KEY")]
+		public string? FlowKey { get; set; }
+
 		/// <summary>
 		/// 附件类型
 		/// </summary>
@@ -76,4 +82,10 @@ namespace Hotline.File
 		[SugarColumn(ColumnDescription = "附件路径")]
 		public string? Path { get; set; }
 	}
+
+	public class FileJson {
+	
+		public string Id { get; set; }
+		public string Path { get; set; }
+	}
 }

+ 1 - 1
src/Hotline/File/IFileRepository.cs

@@ -11,6 +11,6 @@ namespace Hotline.File
 {
 	public interface IFileRepository : IRepository<File>
 	{
-		Task<string> AddFileAsync(List<FileDto> order, string id, CancellationToken cancellationToken);
+		Task<List<FileJson>> AddFileAsync(List<FileDto> order, string id, CancellationToken cancellationToken, string flowId = "");
 	}
 }

+ 3 - 2
src/Hotline/Orders/Order.cs

@@ -1,4 +1,5 @@
-using Hotline.FlowEngine.Workflows;
+using Hotline.File;
+using Hotline.FlowEngine.Workflows;
 using Hotline.Settings.Hotspots;
 using Hotline.Share.Dtos;
 using Hotline.Share.Dtos.File;
@@ -579,7 +580,7 @@ namespace Hotline.Orders
 
 		#region 附件冗余
 		[SugarColumn(ColumnDataType = "json", IsJson = true, IsNullable = true)]
-		public string? FileJson { get; set; }
+		public List<FileJson>? FileJson { get; set; }
 		#endregion
 	}
 

+ 3 - 2
src/Hotline/Orders/OrderScreen.cs

@@ -1,4 +1,5 @@
-using Hotline.FlowEngine.Workflows;
+using Hotline.File;
+using Hotline.FlowEngine.Workflows;
 using Hotline.Share.Enums.Order;
 using SqlSugar;
 using System.ComponentModel;
@@ -99,7 +100,7 @@ namespace Hotline.Orders
 		public Workflow? Workflow { get; set; }
 
 		[SugarColumn(ColumnDataType = "json", IsJson = true, IsNullable = true)]
-		public string? FileJson { get; set; }
+		public List<FileJson>? FileJson { get; set; }
 
 	}
 }

+ 5 - 1
src/Hotline/Orders/OrderSendback.cs

@@ -4,6 +4,7 @@ using System.ComponentModel;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using Hotline.File;
 using Hotline.Share.Enums.Order;
 using SqlSugar;
 using XF.Domain.Repository;
@@ -71,5 +72,8 @@ namespace Hotline.Orders
 		/// 退回目的地
 		/// </summary>
 		public ESendBackDestination Destination { get; set; }
-    }
+
+		[SugarColumn(ColumnDataType = "json", IsJson = true, IsNullable = true)]
+		public List<FileJson>? FileJson { get; set; }
+	}
 }

+ 4 - 3
src/Hotline/Orders/OrderSupervise.cs

@@ -1,4 +1,5 @@
-using Hotline.Users;
+using Hotline.File;
+using Hotline.Users;
 using SqlSugar;
 using System.ComponentModel;
 using XF.Domain.Repository;
@@ -96,9 +97,9 @@ namespace Hotline.Orders {
 
 
 		[SugarColumn(ColumnDataType = "json", IsJson = true, IsNullable = true)]
-		public string? FileJson { get; set; }
+		public List<FileJson>? FileJson { get; set; }
 
 		[SugarColumn(ColumnDataType = "json", IsJson = true, IsNullable = true)]
-		public string? ReplyFileJson { get; set; }
+		public List<FileJson>? ReplyFileJson { get; set; }
 	}
 }

+ 3 - 2
src/Hotline/Orders/OrderUrge.cs

@@ -1,4 +1,5 @@
 using System.ComponentModel;
+using Hotline.File;
 using Hotline.Users;
 using SqlSugar;
 using XF.Domain.Repository;
@@ -89,10 +90,10 @@ namespace Hotline.Orders {
 		public string? SignUser { get; set; }
 
 		[SugarColumn(ColumnDataType = "json", IsJson = true, IsNullable = true)]
-		public string? FileJson { get; set; }
+		public List<FileJson>? FileJson { get; set; }
 
 		[SugarColumn(ColumnDataType = "json", IsJson = true, IsNullable = true)]
-		public string? ReplyFileJson { get; set; }
+		public List<FileJson>? ReplyFileJson { get; set; }
 	}
 }