Browse Source

添加非空判断

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

36
24Hour/Controllers/Common/LawyerArchivesController.cs

@ -80,7 +80,6 @@ namespace _24Hour.Controllers.Common
res.result = data;
return res;
}
/// <summary>
/// 修改内网律师信息
/// </summary>
@ -815,8 +814,6 @@ namespace _24Hour.Controllers.Common
};
return result;
}
/// <summary>
/// 统计阅卷信息
/// </summary>
@ -989,7 +986,6 @@ namespace _24Hour.Controllers.Common
};
return result;
}
/// <summary>
/// 按律师分类
/// </summary>
@ -1105,6 +1101,8 @@ namespace _24Hour.Controllers.Common
[HttpGet]
[Route("ImportLawyerArchivesInfo")]
public async Task<Result> ImportLawyerArchivesInfo(string path)
{
try
{
if (System.IO.File.Exists(path) == false)
{
@ -1283,14 +1281,21 @@ namespace _24Hour.Controllers.Common
_db.CommitTran();
}
}
}
catch(Exception ex)
{
result.Message = ex.Message;
result.IsSucceed = false;
return result;
}
result.IsSucceed = true;
return result;
}
[HttpPost]
[Route("ExportLawyerArchivesInfo")]
public async Task<Result> ExportLawyerArchivesInfo(List<string> ids)
{
try
{
var lawyerarchives = await _db.Queryable<App_LawyerServicesModel>()
.In(info => info.Id, ids)
@ -1328,7 +1333,7 @@ namespace _24Hour.Controllers.Common
if (Directory.Exists(lawyerdir) == false) Directory.CreateDirectory(lawyerdir);
var files = item.annex.ConvertToModel<List<string>>();
var files = item.annex.ConvertToModel<List<string>>() ?? new List<string>();
var annecdir = Path.Combine(lawyerdir, "annexs");
if (Directory.Exists(annecdir) == false) Directory.CreateDirectory(annecdir);
foreach (var file in files)
@ -1342,9 +1347,10 @@ namespace _24Hour.Controllers.Common
}
var legalphotots = item.legalAidPhoto.ConvertToModel<List<string>>();
var legalphotots = item.legalAidPhoto.ConvertToModel<List<string>>() ?? new List<string>();
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("/", @"\");
@ -1356,9 +1362,11 @@ namespace _24Hour.Controllers.Common
}
var relationshipProofPhotos = item.relationshipProofPhoto.ConvertToModel<List<string>>();
var relationshipProofPhotos = item.relationshipProofPhoto.ConvertToModel<List<string>>() ?? new List<string>();
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("/", @"\");
@ -1369,7 +1377,7 @@ namespace _24Hour.Controllers.Common
}
}
var otherPhotos = item.otherPhoto.ConvertToModel<List<string>>();
var otherPhotos = item.otherPhoto.ConvertToModel<List<string>>() ?? new List<string>();
var otherPhotoDir = Path.Combine(lawyerdir, "otherPhoto");
if (Directory.Exists(otherPhotoDir) == false) Directory.CreateDirectory(otherPhotoDir);
foreach (var otherPhoto in otherPhotos)
@ -1434,7 +1442,13 @@ namespace _24Hour.Controllers.Common
result.IsSucceed = true;
return result;
}
catch(Exception ex)
{
result.IsSucceed = false;
result.Message = ex.Message;
return result;
}
}
[HttpPost]
[Route("UploadSignImage")]
/// <summary>

Loading…
Cancel
Save