Browse Source

添加空置判断

develop
胡超1 2 years ago
parent
commit
e4e05dd0c9
  1. 24
      24Hour/Controllers/Common/LawyerArchivesController.cs

24
24Hour/Controllers/Common/LawyerArchivesController.cs

@ -1437,7 +1437,7 @@ namespace _24Hour.Controllers.Common
lawyerservices = default(List<App_LawyerServicesModel>), lawyerservices = default(List<App_LawyerServicesModel>),
users = default(List<App_Sys_UserModel>) users = default(List<App_Sys_UserModel>)
}); });
foreach (var userim in importdata.users) foreach (var userim in importdata.users.Where(x => x != null))
{ {
var user = await _db.Queryable<App_Sys_UserModel>() var user = await _db.Queryable<App_Sys_UserModel>()
.Where(x => x.cardId == userim.cardId) .Where(x => x.cardId == userim.cardId)
@ -1497,7 +1497,7 @@ namespace _24Hour.Controllers.Common
_db.CommitTran(); _db.CommitTran();
} }
} }
foreach (var lawyersvc in importdata.lawyerservices) foreach (var lawyersvc in importdata.lawyerservices.Where(x => x != null))
{ {
var svc = await _db.Queryable<App_LawyerServicesModel>() var svc = await _db.Queryable<App_LawyerServicesModel>()
.Where(x => x.Id == lawyersvc.Id).FirstAsync(); .Where(x => x.Id == lawyersvc.Id).FirstAsync();
@ -1609,7 +1609,6 @@ namespace _24Hour.Controllers.Common
var users = await _db.Queryable<App_Sys_UserModel>() var users = await _db.Queryable<App_Sys_UserModel>()
.In(x => x.Id, userids) .In(x => x.Id, userids)
.ToListAsync(); .ToListAsync();
//把创建人Id变为创建人的身份证 //把创建人Id变为创建人的身份证
lawyerarchives.All(x => lawyerarchives.All(x =>
{ {
@ -1634,11 +1633,10 @@ namespace _24Hour.Controllers.Common
var lawyerdir = Path.Combine(packegdir, "lawyerservices", item.Id); var lawyerdir = Path.Combine(packegdir, "lawyerservices", item.Id);
if (Directory.Exists(lawyerdir) == false) Directory.CreateDirectory(lawyerdir); if (Directory.Exists(lawyerdir) == false) Directory.CreateDirectory(lawyerdir);
var files = item.annex.ConvertToModel<List<string>>() ?? new List<string>(); var files = item.annex.ConvertToModel<List<string>>() ?? new List<string>();
var annecdir = Path.Combine(lawyerdir, "annexs"); var annecdir = Path.Combine(lawyerdir, "annexs");
if (Directory.Exists(annecdir) == false) Directory.CreateDirectory(annecdir); if (Directory.Exists(annecdir) == false) Directory.CreateDirectory(annecdir);
foreach (var file in files) foreach (var file in files.Where(x => x != null))
{ {
var filepath = Path.Combine(Environment.CurrentDirectory, "wwwroot") + file.Replace("/", @"\"); var filepath = Path.Combine(Environment.CurrentDirectory, "wwwroot") + file.Replace("/", @"\");
if (System.IO.File.Exists(filepath)) if (System.IO.File.Exists(filepath))
@ -1648,13 +1646,13 @@ namespace _24Hour.Controllers.Common
} }
} }
var legalphotots = item.legalAidPhoto.ConvertToModel<List<string>>() ?? new List<string>(); var legalphotots = item.legalAidPhoto.ConvertToModel<List<string>>() ?? new List<string>();
var legalAidPhotoDir = Path.Combine(lawyerdir, "legalAidPhoto"); var legalAidPhotoDir = Path.Combine(lawyerdir, "legalAidPhoto");
if (Directory.Exists(legalAidPhotoDir) == false) Directory.CreateDirectory(legalAidPhotoDir); if (Directory.Exists(legalAidPhotoDir) == false) Directory.CreateDirectory(legalAidPhotoDir);
foreach (var legalphotot in legalphotots) foreach (var legalphotot in legalphotots.Where(x=>x!=null))
{ {
logger.LogInformation(legalphotot);
var filepath = Path.Combine(Environment.CurrentDirectory, "wwwroot") + legalphotot.Replace("/", @"\"); var filepath = Path.Combine(Environment.CurrentDirectory, "wwwroot") + legalphotot.Replace("/", @"\");
if (System.IO.File.Exists(filepath)) if (System.IO.File.Exists(filepath))
{ {
@ -1664,12 +1662,10 @@ namespace _24Hour.Controllers.Common
} }
var relationshipProofPhotos = item.relationshipProofPhoto.ConvertToModel<List<string>>() ?? new List<string>(); var relationshipProofPhotos = item.relationshipProofPhoto.ConvertToModel<List<string>>() ?? new List<string>();
var relationshipProofPhotoDir = Path.Combine(lawyerdir, "relationshipProofPhoto"); var relationshipProofPhotoDir = Path.Combine(lawyerdir, "relationshipProofPhoto");
if (Directory.Exists(relationshipProofPhotoDir) == false) Directory.CreateDirectory(relationshipProofPhotoDir); if (Directory.Exists(relationshipProofPhotoDir) == false) Directory.CreateDirectory(relationshipProofPhotoDir);
foreach (var relationshipProofPhoto in relationshipProofPhotos.Where(x => x != null))
foreach (var relationshipProofPhoto in relationshipProofPhotos)
{ {
var filepath = Path.Combine(Environment.CurrentDirectory, "wwwroot") + relationshipProofPhoto.Replace("/", @"\"); var filepath = Path.Combine(Environment.CurrentDirectory, "wwwroot") + relationshipProofPhoto.Replace("/", @"\");
if (System.IO.File.Exists(filepath)) if (System.IO.File.Exists(filepath))
@ -1678,11 +1674,10 @@ namespace _24Hour.Controllers.Common
System.IO.File.Copy(filepath, targetfile); System.IO.File.Copy(filepath, targetfile);
} }
} }
var otherPhotos = item.otherPhoto.ConvertToModel<List<string>>() ?? new List<string>(); var otherPhotos = item.otherPhoto.ConvertToModel<List<string>>() ?? new List<string>();
var otherPhotoDir = Path.Combine(lawyerdir, "otherPhoto"); var otherPhotoDir = Path.Combine(lawyerdir, "otherPhoto");
if (Directory.Exists(otherPhotoDir) == false) Directory.CreateDirectory(otherPhotoDir); if (Directory.Exists(otherPhotoDir) == false) Directory.CreateDirectory(otherPhotoDir);
foreach (var otherPhoto in otherPhotos) foreach (var otherPhoto in otherPhotos.Where(x => x != null))
{ {
var filepath = Path.Combine(Environment.CurrentDirectory, "wwwroot") + otherPhoto.Replace("/", @"\"); var filepath = Path.Combine(Environment.CurrentDirectory, "wwwroot") + otherPhoto.Replace("/", @"\");
if (System.IO.File.Exists(filepath)) if (System.IO.File.Exists(filepath))
@ -1736,12 +1731,13 @@ namespace _24Hour.Controllers.Common
} }
} }
} }
logger.LogInformation("step4");
ZipFile.CreateFromDirectory(packegdir, packegzipname); ZipFile.CreateFromDirectory(packegdir, packegzipname);
Directory.Delete(packegdir, true); Directory.Delete(packegdir, true);
result.result = $"/temp/{packegdirname}.zip"; result.result = $"/temp/{packegdirname}.zip";
result.IsSucceed = true; result.IsSucceed = true;
logger.LogInformation("step5");
return result; return result;
} }
catch (Exception ex) catch (Exception ex)

Loading…
Cancel
Save