|
|
|
@ -1106,23 +1106,23 @@ namespace _24Hour.Controllers.Common
|
|
|
|
|
[Route("ImportLawyerArchivesInfo")] |
|
|
|
|
public async Task<Result> ImportLawyerArchivesInfo(string path) |
|
|
|
|
{ |
|
|
|
|
if (System.IO.File.Exists(path)==false) |
|
|
|
|
if (System.IO.File.Exists(path) == false) |
|
|
|
|
{ |
|
|
|
|
result.Message = "文件丢失"; |
|
|
|
|
result.IsSucceed = false; |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
var dir = Path.Combine(Environment.CurrentDirectory,"wwwroot","CaseFile","imports"); |
|
|
|
|
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); |
|
|
|
|
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) |
|
|
|
|
if (System.IO.File.Exists(zipjson) == false) |
|
|
|
|
{ |
|
|
|
|
result.Message = "文件丢失"; |
|
|
|
|
result.IsSucceed = false; |
|
|
|
@ -1134,8 +1134,8 @@ namespace _24Hour.Controllers.Common
|
|
|
|
|
|
|
|
|
|
var importdata = jsonstr.ConvertToAnonymousType(new |
|
|
|
|
{ |
|
|
|
|
lawyerservices=default(List<App_LawyerServicesModel>), |
|
|
|
|
users=default(List<App_Sys_UserModel>) |
|
|
|
|
lawyerservices = default(List<App_LawyerServicesModel>), |
|
|
|
|
users = default(List<App_Sys_UserModel>) |
|
|
|
|
}); |
|
|
|
|
foreach (var userim in importdata.users) |
|
|
|
|
{ |
|
|
|
@ -1169,7 +1169,7 @@ namespace _24Hour.Controllers.Common
|
|
|
|
|
.ToList() |
|
|
|
|
.ConvertToJsonStr(); |
|
|
|
|
|
|
|
|
|
if (user==null) |
|
|
|
|
if (user == null) |
|
|
|
|
{ |
|
|
|
|
userim.cardIdphoto = cardids; |
|
|
|
|
userim.identityphoto = files; |
|
|
|
@ -1199,7 +1199,7 @@ namespace _24Hour.Controllers.Common
|
|
|
|
|
} |
|
|
|
|
foreach (var lawyersvc in importdata.lawyerservices) |
|
|
|
|
{ |
|
|
|
|
var svc =await _db.Queryable<App_LawyerServicesModel>() |
|
|
|
|
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) |
|
|
|
@ -1208,21 +1208,40 @@ namespace _24Hour.Controllers.Common
|
|
|
|
|
.Replace(@"\", @"/")) |
|
|
|
|
.ToList() |
|
|
|
|
.ConvertToJsonStr(); |
|
|
|
|
if (svc==null) |
|
|
|
|
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; |
|
|
|
|
|
|
|
|
|
_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; |
|
|
|
|
|
|
|
|
|
_db.BeginTran(); |
|
|
|
|
var num = await _db.Updateable(svc) |
|
|
|
|
.UpdateColumns(x => new |
|
|
|
|
{ |
|
|
|
|
x.annex |
|
|
|
|
x.annex, |
|
|
|
|
x.createuserId |
|
|
|
|
}) |
|
|
|
|
.IgnoreColumns(ignoreAllNullColumns: true) |
|
|
|
|
.ExecuteCommandAsync(); |
|
|
|
@ -1233,22 +1252,30 @@ namespace _24Hour.Controllers.Common
|
|
|
|
|
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) |
|
|
|
|
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 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); |
|
|
|
@ -1262,15 +1289,15 @@ namespace _24Hour.Controllers.Common
|
|
|
|
|
//存储预约申请的相关附件 |
|
|
|
|
foreach (var item in lawyerarchives) |
|
|
|
|
{ |
|
|
|
|
var lawyerdir = Path.Combine(packegdir,"lawyerservices", item.Id); |
|
|
|
|
if (Directory.Exists(lawyerdir)==false) Directory.CreateDirectory(lawyerdir); |
|
|
|
|
var lawyerdir = Path.Combine(packegdir, "lawyerservices", item.Id); |
|
|
|
|
if (Directory.Exists(lawyerdir) == false) Directory.CreateDirectory(lawyerdir); |
|
|
|
|
var files = item.annex.ConvertToModel<List<string>>(); |
|
|
|
|
var annecdir = Path.Combine(lawyerdir,"annexs"); |
|
|
|
|
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("/",@"\"); |
|
|
|
|
var filepath = Path.Combine(Environment.CurrentDirectory, "wwwroot") + file.Replace("/", @"\"); |
|
|
|
|
if (System.IO.File.Exists(filepath)) |
|
|
|
|
{ |
|
|
|
|
var targetfile = Path.Combine(annecdir, Path.GetFileName(filepath)); |
|
|
|
@ -1282,7 +1309,7 @@ namespace _24Hour.Controllers.Common
|
|
|
|
|
foreach (var item in users) |
|
|
|
|
{ |
|
|
|
|
//["/CaseFile/card/2023-11-21/20231121200659497.jpg"] |
|
|
|
|
var userdir= Path.Combine(packegdir, "users", item.cardId); |
|
|
|
|
var userdir = Path.Combine(packegdir, "users", item.cardId); |
|
|
|
|
|
|
|
|
|
//保存身份证图片 |
|
|
|
|
var cardids = item.cardIdphoto.ConvertToModel<List<string>>(); |
|
|
|
|