From 3fbb53f3a4ee5f1e6428edb35fb1d5b1faa8a31d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BD=87=E9=98=B3=20=E9=82=B9?= Date: Wed, 29 Nov 2023 14:38:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E5=AF=BC=E5=87=BA=E5=85=B6?= =?UTF-8?q?=E4=BB=96=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Common/LawyerArchivesController.cs | 84 ++++++++++++++++++- 1 file changed, 81 insertions(+), 3 deletions(-) diff --git a/24Hour/Controllers/Common/LawyerArchivesController.cs b/24Hour/Controllers/Common/LawyerArchivesController.cs index ec23882..746c372 100644 --- a/24Hour/Controllers/Common/LawyerArchivesController.cs +++ b/24Hour/Controllers/Common/LawyerArchivesController.cs @@ -1201,6 +1201,7 @@ namespace _24Hour.Controllers.Common { var svc = await _db.Queryable() .Where(x => x.Id == lawyersvc.Id).FirstAsync(); + var annexphoto = Path.Combine(ziplawyersvcs, lawyersvc.Id, "annexs"); var annexs = new DirectoryInfo(annexphoto) .GetFiles() @@ -1208,6 +1209,32 @@ namespace _24Hour.Controllers.Common .Replace(@"\", @"/")) .ToList() .ConvertToJsonStr(); + + + var legalAidPhoto = Path.Combine(ziplawyersvcs, lawyersvc.Id, "legalAidPhoto"); + var legalAidPhotos = new DirectoryInfo(legalAidPhoto) + .GetFiles() + .Select(x => "/CaseFile/imports/" + Path.GetRelativePath(dir, x.FullName) + .Replace(@"\", @"/")) + .ToList() + .ConvertToJsonStr(); + + var relationshipProofPhoto = Path.Combine(ziplawyersvcs, lawyersvc.Id, "relationshipProofPhoto"); + var relationshipProofPhotos = new DirectoryInfo(relationshipProofPhoto) + .GetFiles() + .Select(x => "/CaseFile/imports/" + Path.GetRelativePath(dir, x.FullName) + .Replace(@"\", @"/")) + .ToList() + .ConvertToJsonStr(); + + var otherPhoto = Path.Combine(ziplawyersvcs, lawyersvc.Id, "otherPhoto"); + var otherPhotos = new DirectoryInfo(otherPhoto) + .GetFiles() + .Select(x => "/CaseFile/imports/" + Path.GetRelativePath(dir, x.FullName) + .Replace(@"\", @"/")) + .ToList() + .ConvertToJsonStr(); + if (svc == null) { var lawyer = await _db.Queryable() @@ -1219,6 +1246,9 @@ namespace _24Hour.Controllers.Common lawyersvc.createuserId = lawyer.Id; lawyersvc.annex = annexs; + lawyersvc.legalAidPhoto = legalAidPhotos; + lawyersvc.relationshipProofPhoto = relationshipProofPhotos; + lawyersvc.otherPhoto = otherPhotos; _db.BeginTran(); var num = await _db.Insertable(lawyersvc).ExecuteCommandAsync(); @@ -1235,13 +1265,18 @@ namespace _24Hour.Controllers.Common svc.createuserId = lawyer.Id; svc.annex = annexs; - + svc.legalAidPhoto = legalAidPhotos; + svc.relationshipProofPhoto = relationshipProofPhotos; + svc.otherPhoto = otherPhotos; _db.BeginTran(); var num = await _db.Updateable(svc) .UpdateColumns(x => new { x.annex, - x.createuserId + x.createuserId, + x.relationshipProofPhoto, + x.otherPhoto, + x.legalAidPhoto }) .IgnoreColumns(ignoreAllNullColumns: true) .ExecuteCommandAsync(); @@ -1291,10 +1326,11 @@ namespace _24Hour.Controllers.Common { var lawyerdir = Path.Combine(packegdir, "lawyerservices", item.Id); if (Directory.Exists(lawyerdir) == false) Directory.CreateDirectory(lawyerdir); + + var files = item.annex.ConvertToModel>(); var annecdir = Path.Combine(lawyerdir, "annexs"); if (Directory.Exists(annecdir) == false) Directory.CreateDirectory(annecdir); - foreach (var file in files) { var filepath = Path.Combine(Environment.CurrentDirectory, "wwwroot") + file.Replace("/", @"\"); @@ -1304,6 +1340,48 @@ namespace _24Hour.Controllers.Common System.IO.File.Copy(filepath, targetfile); } } + + + var legalphotots = item.legalAidPhoto.ConvertToModel>(); + var legalAidPhotoDir = Path.Combine(lawyerdir, "legalAidPhoto"); + if (Directory.Exists(legalAidPhotoDir) == false) Directory.CreateDirectory(legalAidPhotoDir); + foreach (var legalphotot in legalphotots) + { + var filepath = Path.Combine(Environment.CurrentDirectory, "wwwroot") + legalphotot.Replace("/", @"\"); + if (System.IO.File.Exists(filepath)) + { + var targetfile = Path.Combine(legalAidPhotoDir, Path.GetFileName(filepath)); + System.IO.File.Copy(filepath, targetfile); + } + } + + + var relationshipProofPhotos = item.relationshipProofPhoto.ConvertToModel>(); + var relationshipProofPhotoDir = Path.Combine(lawyerdir, "relationshipProofPhoto"); + if (Directory.Exists(relationshipProofPhotoDir) == false) Directory.CreateDirectory(relationshipProofPhotoDir); + foreach (var relationshipProofPhoto in relationshipProofPhotos) + { + var filepath = Path.Combine(Environment.CurrentDirectory, "wwwroot") + relationshipProofPhoto.Replace("/", @"\"); + if (System.IO.File.Exists(filepath)) + { + var targetfile = Path.Combine(legalAidPhotoDir, Path.GetFileName(filepath)); + System.IO.File.Copy(filepath, targetfile); + } + } + + var otherPhotos = item.otherPhoto.ConvertToModel>(); + var otherPhotoDir = Path.Combine(lawyerdir, "otherPhoto"); + if (Directory.Exists(otherPhotoDir) == false) Directory.CreateDirectory(otherPhotoDir); + foreach (var otherPhoto in otherPhotos) + { + var filepath = Path.Combine(Environment.CurrentDirectory, "wwwroot") + otherPhoto.Replace("/", @"\"); + if (System.IO.File.Exists(filepath)) + { + var targetfile = Path.Combine(legalAidPhotoDir, Path.GetFileName(filepath)); + System.IO.File.Copy(filepath, targetfile); + } + } + } //存储用户的相关附件 foreach (var item in users)