|
|
|
@ -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> |
|
|
|
@ -1106,335 +1102,353 @@ namespace _24Hour.Controllers.Common
|
|
|
|
|
[Route("ImportLawyerArchivesInfo")] |
|
|
|
|
public async Task<Result> ImportLawyerArchivesInfo(string path) |
|
|
|
|
{ |
|
|
|
|
if (System.IO.File.Exists(path) == false) |
|
|
|
|
{ |
|
|
|
|
result.Message = "文件丢失"; |
|
|
|
|
result.IsSucceed = false; |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
var dir = Path.Combine(Environment.CurrentDirectory, "wwwroot", "CaseFile", "imports"); |
|
|
|
|
var userdir = Path.Combine(dir, "users"); |
|
|
|
|
var lawyersvcs = Path.Combine(dir, "lawyersvcs"); |
|
|
|
|
|
|
|
|
|
var extratname = Path.GetFileNameWithoutExtension(path); |
|
|
|
|
var extratdirpath = Path.Combine(dir, extratname); |
|
|
|
|
ZipFile.ExtractToDirectory(path, extratdirpath, true); |
|
|
|
|
var zipusers = Path.Combine(extratdirpath, "users"); |
|
|
|
|
var ziplawyersvcs = Path.Combine(extratdirpath, "lawyerservices"); |
|
|
|
|
var zipjson = Path.Combine(extratdirpath, "data"); |
|
|
|
|
if (System.IO.File.Exists(zipjson) == false) |
|
|
|
|
{ |
|
|
|
|
result.Message = "文件丢失"; |
|
|
|
|
result.IsSucceed = false; |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
var json = System.IO.File.ReadAllText(zipjson); |
|
|
|
|
|
|
|
|
|
var jsonstr = Encoding.UTF8.GetString(Convert.FromBase64String(json)); |
|
|
|
|
|
|
|
|
|
var importdata = jsonstr.ConvertToAnonymousType(new |
|
|
|
|
{ |
|
|
|
|
lawyerservices = default(List<App_LawyerServicesModel>), |
|
|
|
|
users = default(List<App_Sys_UserModel>) |
|
|
|
|
}); |
|
|
|
|
foreach (var userim in importdata.users) |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
var user = await _db.Queryable<App_Sys_UserModel>() |
|
|
|
|
.Where(x => x.cardId == userim.cardId) |
|
|
|
|
.Where(x => x.IsDeleted == 0) |
|
|
|
|
.Where(x => x.isdeactivate == 0) |
|
|
|
|
.Where(x => x.identity == "律师") |
|
|
|
|
.FirstAsync(); |
|
|
|
|
var identityphotopath = Path.Combine(zipusers, userim.cardId, "identityphotos"); |
|
|
|
|
var files = new DirectoryInfo(identityphotopath) |
|
|
|
|
.GetFiles() |
|
|
|
|
.Select(x => "/CaseFile/imports/" + Path.GetRelativePath(dir, x.FullName) |
|
|
|
|
.Replace(@"\", @"/")) |
|
|
|
|
.ToList() |
|
|
|
|
.ConvertToJsonStr(); |
|
|
|
|
|
|
|
|
|
var departmentPhotos = Path.Combine(zipusers, userim.cardId, "departmentPhotos"); |
|
|
|
|
var departments = new DirectoryInfo(departmentPhotos) |
|
|
|
|
.GetFiles() |
|
|
|
|
.Select(x => "/CaseFile/imports/" + Path.GetRelativePath(dir, x.FullName) |
|
|
|
|
.Replace(@"\", @"/")) |
|
|
|
|
.ToList() |
|
|
|
|
.ConvertToJsonStr(); |
|
|
|
|
|
|
|
|
|
var cardidphotos = Path.Combine(zipusers, userim.cardId, "cardids"); |
|
|
|
|
var cardids = new DirectoryInfo(cardidphotos) |
|
|
|
|
.GetFiles() |
|
|
|
|
.Select(x => "/CaseFile/imports/" + Path.GetRelativePath(dir, x.FullName) |
|
|
|
|
.Replace(@"\", @"/")) |
|
|
|
|
.ToList() |
|
|
|
|
.ConvertToJsonStr(); |
|
|
|
|
|
|
|
|
|
if (user == null) |
|
|
|
|
if (System.IO.File.Exists(path) == false) |
|
|
|
|
{ |
|
|
|
|
userim.cardIdphoto = cardids; |
|
|
|
|
userim.identityphoto = files; |
|
|
|
|
userim.departmentPhoto = departments; |
|
|
|
|
|
|
|
|
|
_db.BeginTran(); |
|
|
|
|
var num = await _db.Insertable(userim).ExecuteCommandAsync(); |
|
|
|
|
_db.CommitTran(); |
|
|
|
|
result.Message = "文件丢失"; |
|
|
|
|
result.IsSucceed = false; |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
var dir = Path.Combine(Environment.CurrentDirectory, "wwwroot", "CaseFile", "imports"); |
|
|
|
|
var userdir = Path.Combine(dir, "users"); |
|
|
|
|
var lawyersvcs = Path.Combine(dir, "lawyersvcs"); |
|
|
|
|
|
|
|
|
|
var extratname = Path.GetFileNameWithoutExtension(path); |
|
|
|
|
var extratdirpath = Path.Combine(dir, extratname); |
|
|
|
|
ZipFile.ExtractToDirectory(path, extratdirpath, true); |
|
|
|
|
var zipusers = Path.Combine(extratdirpath, "users"); |
|
|
|
|
var ziplawyersvcs = Path.Combine(extratdirpath, "lawyerservices"); |
|
|
|
|
var zipjson = Path.Combine(extratdirpath, "data"); |
|
|
|
|
if (System.IO.File.Exists(zipjson) == false) |
|
|
|
|
{ |
|
|
|
|
user.cardIdphoto = cardids; |
|
|
|
|
user.identityphoto = files; |
|
|
|
|
user.departmentPhoto = departments; |
|
|
|
|
_db.BeginTran(); |
|
|
|
|
var num = await _db.Updateable(user) |
|
|
|
|
.UpdateColumns(x => new |
|
|
|
|
{ |
|
|
|
|
x.cardIdphoto, |
|
|
|
|
x.identityphoto, |
|
|
|
|
x.departmentPhoto |
|
|
|
|
}) |
|
|
|
|
.IgnoreColumns(ignoreAllNullColumns: true) |
|
|
|
|
.ExecuteCommandAsync(); |
|
|
|
|
_db.CommitTran(); |
|
|
|
|
result.Message = "文件丢失"; |
|
|
|
|
result.IsSucceed = false; |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
foreach (var lawyersvc in importdata.lawyerservices) |
|
|
|
|
{ |
|
|
|
|
var svc = await _db.Queryable<App_LawyerServicesModel>() |
|
|
|
|
.Where(x => x.Id == lawyersvc.Id).FirstAsync(); |
|
|
|
|
|
|
|
|
|
var annexphoto = Path.Combine(ziplawyersvcs, lawyersvc.Id, "annexs"); |
|
|
|
|
var annexs = new DirectoryInfo(annexphoto) |
|
|
|
|
.GetFiles() |
|
|
|
|
.Select(x => "/CaseFile/imports/" + Path.GetRelativePath(dir, x.FullName) |
|
|
|
|
.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<App_Sys_UserModel>() |
|
|
|
|
.Where(x => x.cardId == lawyersvc.createuserId) |
|
|
|
|
.Where(x => x.IsDeleted == 0) |
|
|
|
|
.Where(x => x.isdeactivate == 0) |
|
|
|
|
.Where(x => x.identity == "律师") |
|
|
|
|
.FirstAsync(); |
|
|
|
|
var json = System.IO.File.ReadAllText(zipjson); |
|
|
|
|
|
|
|
|
|
lawyersvc.createuserId = lawyer.Id; |
|
|
|
|
lawyersvc.annex = annexs; |
|
|
|
|
lawyersvc.legalAidPhoto = legalAidPhotos; |
|
|
|
|
lawyersvc.relationshipProofPhoto = relationshipProofPhotos; |
|
|
|
|
lawyersvc.otherPhoto = otherPhotos; |
|
|
|
|
var jsonstr = Encoding.UTF8.GetString(Convert.FromBase64String(json)); |
|
|
|
|
|
|
|
|
|
_db.BeginTran(); |
|
|
|
|
var num = await _db.Insertable(lawyersvc).ExecuteCommandAsync(); |
|
|
|
|
_db.CommitTran(); |
|
|
|
|
var importdata = jsonstr.ConvertToAnonymousType(new |
|
|
|
|
{ |
|
|
|
|
lawyerservices = default(List<App_LawyerServicesModel>), |
|
|
|
|
users = default(List<App_Sys_UserModel>) |
|
|
|
|
}); |
|
|
|
|
foreach (var userim in importdata.users) |
|
|
|
|
{ |
|
|
|
|
var user = await _db.Queryable<App_Sys_UserModel>() |
|
|
|
|
.Where(x => x.cardId == userim.cardId) |
|
|
|
|
.Where(x => x.IsDeleted == 0) |
|
|
|
|
.Where(x => x.isdeactivate == 0) |
|
|
|
|
.Where(x => x.identity == "律师") |
|
|
|
|
.FirstAsync(); |
|
|
|
|
var identityphotopath = Path.Combine(zipusers, userim.cardId, "identityphotos"); |
|
|
|
|
var files = new DirectoryInfo(identityphotopath) |
|
|
|
|
.GetFiles() |
|
|
|
|
.Select(x => "/CaseFile/imports/" + Path.GetRelativePath(dir, x.FullName) |
|
|
|
|
.Replace(@"\", @"/")) |
|
|
|
|
.ToList() |
|
|
|
|
.ConvertToJsonStr(); |
|
|
|
|
|
|
|
|
|
var departmentPhotos = Path.Combine(zipusers, userim.cardId, "departmentPhotos"); |
|
|
|
|
var departments = new DirectoryInfo(departmentPhotos) |
|
|
|
|
.GetFiles() |
|
|
|
|
.Select(x => "/CaseFile/imports/" + Path.GetRelativePath(dir, x.FullName) |
|
|
|
|
.Replace(@"\", @"/")) |
|
|
|
|
.ToList() |
|
|
|
|
.ConvertToJsonStr(); |
|
|
|
|
|
|
|
|
|
var cardidphotos = Path.Combine(zipusers, userim.cardId, "cardids"); |
|
|
|
|
var cardids = new DirectoryInfo(cardidphotos) |
|
|
|
|
.GetFiles() |
|
|
|
|
.Select(x => "/CaseFile/imports/" + Path.GetRelativePath(dir, x.FullName) |
|
|
|
|
.Replace(@"\", @"/")) |
|
|
|
|
.ToList() |
|
|
|
|
.ConvertToJsonStr(); |
|
|
|
|
|
|
|
|
|
if (user == null) |
|
|
|
|
{ |
|
|
|
|
userim.cardIdphoto = cardids; |
|
|
|
|
userim.identityphoto = files; |
|
|
|
|
userim.departmentPhoto = departments; |
|
|
|
|
|
|
|
|
|
_db.BeginTran(); |
|
|
|
|
var num = await _db.Insertable(userim).ExecuteCommandAsync(); |
|
|
|
|
_db.CommitTran(); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
user.cardIdphoto = cardids; |
|
|
|
|
user.identityphoto = files; |
|
|
|
|
user.departmentPhoto = departments; |
|
|
|
|
_db.BeginTran(); |
|
|
|
|
var num = await _db.Updateable(user) |
|
|
|
|
.UpdateColumns(x => new |
|
|
|
|
{ |
|
|
|
|
x.cardIdphoto, |
|
|
|
|
x.identityphoto, |
|
|
|
|
x.departmentPhoto |
|
|
|
|
}) |
|
|
|
|
.IgnoreColumns(ignoreAllNullColumns: true) |
|
|
|
|
.ExecuteCommandAsync(); |
|
|
|
|
_db.CommitTran(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
foreach (var lawyersvc in importdata.lawyerservices) |
|
|
|
|
{ |
|
|
|
|
var lawyer = await _db.Queryable<App_Sys_UserModel>() |
|
|
|
|
.Where(x => x.cardId == lawyersvc.createuserId) |
|
|
|
|
.Where(x => x.IsDeleted == 0) |
|
|
|
|
.Where(x => x.isdeactivate == 0) |
|
|
|
|
.Where(x => x.identity == "律师") |
|
|
|
|
.FirstAsync(); |
|
|
|
|
|
|
|
|
|
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.relationshipProofPhoto, |
|
|
|
|
x.otherPhoto, |
|
|
|
|
x.legalAidPhoto |
|
|
|
|
}) |
|
|
|
|
.IgnoreColumns(ignoreAllNullColumns: true) |
|
|
|
|
.ExecuteCommandAsync(); |
|
|
|
|
_db.CommitTran(); |
|
|
|
|
var svc = await _db.Queryable<App_LawyerServicesModel>() |
|
|
|
|
.Where(x => x.Id == lawyersvc.Id).FirstAsync(); |
|
|
|
|
|
|
|
|
|
var annexphoto = Path.Combine(ziplawyersvcs, lawyersvc.Id, "annexs"); |
|
|
|
|
var annexs = new DirectoryInfo(annexphoto) |
|
|
|
|
.GetFiles() |
|
|
|
|
.Select(x => "/CaseFile/imports/" + Path.GetRelativePath(dir, x.FullName) |
|
|
|
|
.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<App_Sys_UserModel>() |
|
|
|
|
.Where(x => x.cardId == lawyersvc.createuserId) |
|
|
|
|
.Where(x => x.IsDeleted == 0) |
|
|
|
|
.Where(x => x.isdeactivate == 0) |
|
|
|
|
.Where(x => x.identity == "律师") |
|
|
|
|
.FirstAsync(); |
|
|
|
|
|
|
|
|
|
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(); |
|
|
|
|
_db.CommitTran(); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
var lawyer = await _db.Queryable<App_Sys_UserModel>() |
|
|
|
|
.Where(x => x.cardId == lawyersvc.createuserId) |
|
|
|
|
.Where(x => x.IsDeleted == 0) |
|
|
|
|
.Where(x => x.isdeactivate == 0) |
|
|
|
|
.Where(x => x.identity == "律师") |
|
|
|
|
.FirstAsync(); |
|
|
|
|
|
|
|
|
|
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.relationshipProofPhoto, |
|
|
|
|
x.otherPhoto, |
|
|
|
|
x.legalAidPhoto |
|
|
|
|
}) |
|
|
|
|
.IgnoreColumns(ignoreAllNullColumns: true) |
|
|
|
|
.ExecuteCommandAsync(); |
|
|
|
|
_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) |
|
|
|
|
{ |
|
|
|
|
var lawyerarchives = await _db.Queryable<App_LawyerServicesModel>() |
|
|
|
|
.In(info => info.Id, ids) |
|
|
|
|
.ToListAsync(); |
|
|
|
|
var userids = lawyerarchives |
|
|
|
|
.Select(x => x.createuserId) |
|
|
|
|
.Distinct() |
|
|
|
|
.ToList(); |
|
|
|
|
var users = await _db.Queryable<App_Sys_UserModel>() |
|
|
|
|
.In(x => x.Id, userids) |
|
|
|
|
.ToListAsync(); |
|
|
|
|
|
|
|
|
|
//把创建人Id变为创建人的身份证 |
|
|
|
|
lawyerarchives.All(x => |
|
|
|
|
{ |
|
|
|
|
x.createuserId = users.FirstOrDefault(q => q.Id == x.createuserId).cardId; |
|
|
|
|
return true; |
|
|
|
|
}); |
|
|
|
|
var packegdirname = DateTime.Now.Ticks.ToString(); |
|
|
|
|
var dir = Path.Combine(Environment.CurrentDirectory, "wwwroot", "temp"); |
|
|
|
|
var packegdir = Path.Combine(dir, packegdirname); |
|
|
|
|
var packegzipname = Path.ChangeExtension(packegdir, ".zip"); |
|
|
|
|
if (Directory.Exists(packegdir) == false) Directory.CreateDirectory(packegdir); |
|
|
|
|
var jsonfilepath = Path.Combine(packegdir, "data"); |
|
|
|
|
var jsonstr = new |
|
|
|
|
{ |
|
|
|
|
lawyerservices = lawyerarchives, |
|
|
|
|
users = users |
|
|
|
|
}.ConvertToJsonStr().ConvertToBase64(); |
|
|
|
|
System.IO.File.WriteAllText(jsonfilepath, jsonstr); |
|
|
|
|
//存储预约申请的相关附件 |
|
|
|
|
foreach (var item in lawyerarchives) |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
var lawyerdir = Path.Combine(packegdir, "lawyerservices", item.Id); |
|
|
|
|
if (Directory.Exists(lawyerdir) == false) Directory.CreateDirectory(lawyerdir); |
|
|
|
|
|
|
|
|
|
var lawyerarchives = await _db.Queryable<App_LawyerServicesModel>() |
|
|
|
|
.In(info => info.Id, ids) |
|
|
|
|
.ToListAsync(); |
|
|
|
|
var userids = lawyerarchives |
|
|
|
|
.Select(x => x.createuserId) |
|
|
|
|
.Distinct() |
|
|
|
|
.ToList(); |
|
|
|
|
var users = await _db.Queryable<App_Sys_UserModel>() |
|
|
|
|
.In(x => x.Id, userids) |
|
|
|
|
.ToListAsync(); |
|
|
|
|
|
|
|
|
|
var files = item.annex.ConvertToModel<List<string>>(); |
|
|
|
|
var annecdir = Path.Combine(lawyerdir, "annexs"); |
|
|
|
|
if (Directory.Exists(annecdir) == false) Directory.CreateDirectory(annecdir); |
|
|
|
|
foreach (var file in files) |
|
|
|
|
//把创建人Id变为创建人的身份证 |
|
|
|
|
lawyerarchives.All(x => |
|
|
|
|
{ |
|
|
|
|
x.createuserId = users.FirstOrDefault(q => q.Id == x.createuserId).cardId; |
|
|
|
|
return true; |
|
|
|
|
}); |
|
|
|
|
var packegdirname = DateTime.Now.Ticks.ToString(); |
|
|
|
|
var dir = Path.Combine(Environment.CurrentDirectory, "wwwroot", "temp"); |
|
|
|
|
var packegdir = Path.Combine(dir, packegdirname); |
|
|
|
|
var packegzipname = Path.ChangeExtension(packegdir, ".zip"); |
|
|
|
|
if (Directory.Exists(packegdir) == false) Directory.CreateDirectory(packegdir); |
|
|
|
|
var jsonfilepath = Path.Combine(packegdir, "data"); |
|
|
|
|
var jsonstr = new |
|
|
|
|
{ |
|
|
|
|
var filepath = Path.Combine(Environment.CurrentDirectory, "wwwroot") + file.Replace("/", @"\"); |
|
|
|
|
if (System.IO.File.Exists(filepath)) |
|
|
|
|
lawyerservices = lawyerarchives, |
|
|
|
|
users = users |
|
|
|
|
}.ConvertToJsonStr().ConvertToBase64(); |
|
|
|
|
System.IO.File.WriteAllText(jsonfilepath, jsonstr); |
|
|
|
|
//存储预约申请的相关附件 |
|
|
|
|
foreach (var item in lawyerarchives) |
|
|
|
|
{ |
|
|
|
|
var lawyerdir = Path.Combine(packegdir, "lawyerservices", item.Id); |
|
|
|
|
if (Directory.Exists(lawyerdir) == false) Directory.CreateDirectory(lawyerdir); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) |
|
|
|
|
{ |
|
|
|
|
var targetfile = Path.Combine(annecdir, Path.GetFileName(filepath)); |
|
|
|
|
System.IO.File.Copy(filepath, targetfile); |
|
|
|
|
var filepath = Path.Combine(Environment.CurrentDirectory, "wwwroot") + file.Replace("/", @"\"); |
|
|
|
|
if (System.IO.File.Exists(filepath)) |
|
|
|
|
{ |
|
|
|
|
var targetfile = Path.Combine(annecdir, Path.GetFileName(filepath)); |
|
|
|
|
System.IO.File.Copy(filepath, targetfile); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var legalphotots = item.legalAidPhoto.ConvertToModel<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("/", @"\"); |
|
|
|
|
if (System.IO.File.Exists(filepath)) |
|
|
|
|
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 targetfile = Path.Combine(legalAidPhotoDir, Path.GetFileName(filepath)); |
|
|
|
|
System.IO.File.Copy(filepath, targetfile); |
|
|
|
|
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<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("/", @"\"); |
|
|
|
|
if (System.IO.File.Exists(filepath)) |
|
|
|
|
|
|
|
|
|
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 targetfile = Path.Combine(legalAidPhotoDir, Path.GetFileName(filepath)); |
|
|
|
|
System.IO.File.Copy(filepath, targetfile); |
|
|
|
|
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<List<string>>(); |
|
|
|
|
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 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) |
|
|
|
|
{ |
|
|
|
|
var targetfile = Path.Combine(legalAidPhotoDir, Path.GetFileName(filepath)); |
|
|
|
|
System.IO.File.Copy(filepath, targetfile); |
|
|
|
|
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) |
|
|
|
|
{ |
|
|
|
|
//["/CaseFile/card/2023-11-21/20231121200659497.jpg"] |
|
|
|
|
var userdir = Path.Combine(packegdir, "users", item.cardId); |
|
|
|
|
|
|
|
|
|
//保存身份证图片 |
|
|
|
|
var cardids = item.cardIdphoto.ConvertToModel<List<string>>(); |
|
|
|
|
var cardidDir = Path.Combine(userdir, "cardids"); |
|
|
|
|
if (Directory.Exists(cardidDir) == false) Directory.CreateDirectory(cardidDir); |
|
|
|
|
foreach (var file in cardids) |
|
|
|
|
} |
|
|
|
|
//存储用户的相关附件 |
|
|
|
|
foreach (var item in users) |
|
|
|
|
{ |
|
|
|
|
var filepath = Path.Combine(Environment.CurrentDirectory, "wwwroot") + file.Replace("/", @"\"); |
|
|
|
|
if (System.IO.File.Exists(filepath)) |
|
|
|
|
//["/CaseFile/card/2023-11-21/20231121200659497.jpg"] |
|
|
|
|
var userdir = Path.Combine(packegdir, "users", item.cardId); |
|
|
|
|
|
|
|
|
|
//保存身份证图片 |
|
|
|
|
var cardids = item.cardIdphoto.ConvertToModel<List<string>>(); |
|
|
|
|
var cardidDir = Path.Combine(userdir, "cardids"); |
|
|
|
|
if (Directory.Exists(cardidDir) == false) Directory.CreateDirectory(cardidDir); |
|
|
|
|
foreach (var file in cardids) |
|
|
|
|
{ |
|
|
|
|
System.IO.File.Copy(filepath, Path.Combine(cardidDir, Path.GetFileName(filepath))); |
|
|
|
|
var filepath = Path.Combine(Environment.CurrentDirectory, "wwwroot") + file.Replace("/", @"\"); |
|
|
|
|
if (System.IO.File.Exists(filepath)) |
|
|
|
|
{ |
|
|
|
|
System.IO.File.Copy(filepath, Path.Combine(cardidDir, Path.GetFileName(filepath))); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//保存工作证图片 律师职业证书 |
|
|
|
|
var identityphotos = item.identityphoto.ConvertToModel<List<string>>(); |
|
|
|
|
var identityphotosDir = Path.Combine(userdir, "identityphotos"); |
|
|
|
|
if (Directory.Exists(identityphotosDir) == false) Directory.CreateDirectory(identityphotosDir); |
|
|
|
|
foreach (var file in identityphotos) |
|
|
|
|
{ |
|
|
|
|
var filepath = Path.Combine(Environment.CurrentDirectory, "wwwroot") + file.Replace("/", @"\"); |
|
|
|
|
if (System.IO.File.Exists(filepath)) |
|
|
|
|
//保存工作证图片 律师职业证书 |
|
|
|
|
var identityphotos = item.identityphoto.ConvertToModel<List<string>>(); |
|
|
|
|
var identityphotosDir = Path.Combine(userdir, "identityphotos"); |
|
|
|
|
if (Directory.Exists(identityphotosDir) == false) Directory.CreateDirectory(identityphotosDir); |
|
|
|
|
foreach (var file in identityphotos) |
|
|
|
|
{ |
|
|
|
|
System.IO.File.Copy(filepath, Path.Combine(identityphotosDir, Path.GetFileName(filepath))); |
|
|
|
|
var filepath = Path.Combine(Environment.CurrentDirectory, "wwwroot") + file.Replace("/", @"\"); |
|
|
|
|
if (System.IO.File.Exists(filepath)) |
|
|
|
|
{ |
|
|
|
|
System.IO.File.Copy(filepath, Path.Combine(identityphotosDir, Path.GetFileName(filepath))); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var departmentPhotos = item.departmentPhoto.ConvertToModel<List<string>>(); |
|
|
|
|
var departmentPhotosDir = Path.Combine(userdir, "departmentPhotos"); |
|
|
|
|
if (Directory.Exists(departmentPhotosDir) == false) Directory.CreateDirectory(departmentPhotosDir); |
|
|
|
|
foreach (var file in departmentPhotos) |
|
|
|
|
{ |
|
|
|
|
var filepath = Path.Combine(Environment.CurrentDirectory, "wwwroot") + file.Replace("/", @"\"); |
|
|
|
|
if (System.IO.File.Exists(filepath)) |
|
|
|
|
var departmentPhotos = item.departmentPhoto.ConvertToModel<List<string>>(); |
|
|
|
|
var departmentPhotosDir = Path.Combine(userdir, "departmentPhotos"); |
|
|
|
|
if (Directory.Exists(departmentPhotosDir) == false) Directory.CreateDirectory(departmentPhotosDir); |
|
|
|
|
foreach (var file in departmentPhotos) |
|
|
|
|
{ |
|
|
|
|
System.IO.File.Copy(filepath, Path.Combine(departmentPhotosDir, Path.GetFileName(filepath))); |
|
|
|
|
var filepath = Path.Combine(Environment.CurrentDirectory, "wwwroot") + file.Replace("/", @"\"); |
|
|
|
|
if (System.IO.File.Exists(filepath)) |
|
|
|
|
{ |
|
|
|
|
System.IO.File.Copy(filepath, Path.Combine(departmentPhotosDir, Path.GetFileName(filepath))); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ZipFile.CreateFromDirectory(packegdir, packegzipname); |
|
|
|
|
Directory.Delete(packegdir, true); |
|
|
|
|
ZipFile.CreateFromDirectory(packegdir, packegzipname); |
|
|
|
|
Directory.Delete(packegdir, true); |
|
|
|
|
|
|
|
|
|
result.result = $"/temp/{packegdirname}.zip"; |
|
|
|
|
result.IsSucceed = true; |
|
|
|
|
return result; |
|
|
|
|
result.result = $"/temp/{packegdirname}.zip"; |
|
|
|
|
result.IsSucceed = true; |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
catch(Exception ex) |
|
|
|
|
{ |
|
|
|
|
result.IsSucceed = false; |
|
|
|
|
result.Message = ex.Message; |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[HttpPost] |
|
|
|
|
[Route("UploadSignImage")] |
|
|
|
|
/// <summary> |
|
|
|
|