|
|
|
@ -196,107 +196,107 @@ namespace _24Hour.Controllers.Common
|
|
|
|
|
int updated = 0, added = 0; |
|
|
|
|
var ext = Path.GetExtension(path).ToLower(); |
|
|
|
|
|
|
|
|
|
if (ext == ".xlsx" || ext == ".xls") |
|
|
|
|
var excelpath = System.IO.Path.ChangeExtension(path, ".xlsx"); |
|
|
|
|
if (System.IO.File.Exists(path)) |
|
|
|
|
{ |
|
|
|
|
if (System.IO.File.Exists(path)) |
|
|
|
|
|
|
|
|
|
Elight.Utility.Encrypt.DataEncryption.Decryption(path, excelpath); |
|
|
|
|
var reader = new ExcelReader(excelpath); |
|
|
|
|
var dt = reader.ExcelToDataTable(); |
|
|
|
|
if (dt != null) |
|
|
|
|
{ |
|
|
|
|
var reader = new ExcelReader(path); |
|
|
|
|
var dt = reader.ExcelToDataTable(); |
|
|
|
|
if (dt != null) |
|
|
|
|
var lawyers = new List<App_Sys_UserModel>(); |
|
|
|
|
foreach (DataRow dr in dt.Rows) |
|
|
|
|
{ |
|
|
|
|
var cardid = dr.Field<string>("证件编号"); |
|
|
|
|
if (string.IsNullOrEmpty(cardid)) |
|
|
|
|
{ |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
lawyers.Add(new() |
|
|
|
|
{ |
|
|
|
|
Id = Guid.NewGuid().ToString(), |
|
|
|
|
name = dr.Field<string>("姓名"), |
|
|
|
|
sex = dr?.Field<string>("性别")?.Contains('男') == true ? 0 : 1, |
|
|
|
|
phone = dr.Field<string>("手机号码"), |
|
|
|
|
departmentName = dr.Field<string>("执业机构"), |
|
|
|
|
identitycardId = dr.Field<string>("执业证号"), |
|
|
|
|
cardId = dr.Field<string>("证件编号"), |
|
|
|
|
unitCode = _userdata.unitCode, |
|
|
|
|
|
|
|
|
|
createtime = DateTime.Now, |
|
|
|
|
createuserId = _userdata.createuserId, |
|
|
|
|
createusername = _userdata.name, |
|
|
|
|
identity = "律师", |
|
|
|
|
usertype = 1, |
|
|
|
|
audit = 0, |
|
|
|
|
|
|
|
|
|
isdeactivate = 0, |
|
|
|
|
IsDeleted = 0, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
var cardids = lawyers.Select(e => e.cardId).ToList(); |
|
|
|
|
var lawyersInDb = await _db.Queryable<App_Sys_UserModel>().In(x => x.cardId, cardids).ToListAsync(); |
|
|
|
|
if (lawyersInDb.Any()) |
|
|
|
|
{ |
|
|
|
|
var lawyers = new List<App_Sys_UserModel>(); |
|
|
|
|
foreach (DataRow dr in dt.Rows) |
|
|
|
|
var updatelist = new List<App_Sys_UserModel>(); |
|
|
|
|
foreach (var item in lawyersInDb) |
|
|
|
|
{ |
|
|
|
|
var cardid = dr.Field<string>("证件编号"); |
|
|
|
|
if (string.IsNullOrEmpty(cardid)) |
|
|
|
|
var lawyerinfo = lawyers.FirstOrDefault(x => x.cardId == item.cardId); |
|
|
|
|
if (lawyerinfo == null) |
|
|
|
|
{ |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
lawyers.Add(new() |
|
|
|
|
{ |
|
|
|
|
Id = Guid.NewGuid().ToString(), |
|
|
|
|
name = dr.Field<string>("姓名"), |
|
|
|
|
sex = dr?.Field<string>("性别")?.Contains('男') == true ? 0 : 1, |
|
|
|
|
phone = dr.Field<string>("手机号码"), |
|
|
|
|
departmentName = dr.Field<string>("执业机构"), |
|
|
|
|
identitycardId = dr.Field<string>("执业证号"), |
|
|
|
|
cardId = dr.Field<string>("证件编号"), |
|
|
|
|
unitCode = _userdata.unitCode, |
|
|
|
|
|
|
|
|
|
createtime = DateTime.Now, |
|
|
|
|
createuserId = _userdata.createuserId, |
|
|
|
|
createusername = _userdata.name, |
|
|
|
|
identity = "律师", |
|
|
|
|
usertype = 1, |
|
|
|
|
audit = 0, |
|
|
|
|
|
|
|
|
|
isdeactivate = 0, |
|
|
|
|
IsDeleted = 0, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
var cardids = lawyers.Select(e => e.cardId).ToList(); |
|
|
|
|
var lawyersInDb = await _db.Queryable<App_Sys_UserModel>().In(x => x.cardId, cardids).ToListAsync(); |
|
|
|
|
if (lawyersInDb.Any()) |
|
|
|
|
{ |
|
|
|
|
var updatelist = new List<App_Sys_UserModel>(); |
|
|
|
|
foreach (var item in lawyersInDb) |
|
|
|
|
if (item.name != lawyerinfo.name || |
|
|
|
|
item.sex != lawyerinfo.sex || |
|
|
|
|
item.phone != lawyerinfo.phone || |
|
|
|
|
item.departmentName != lawyerinfo.departmentName || |
|
|
|
|
item.cardId != lawyerinfo.cardId) |
|
|
|
|
{ |
|
|
|
|
var lawyerinfo = lawyers.FirstOrDefault(x => x.cardId == item.cardId); |
|
|
|
|
if (lawyerinfo == null) |
|
|
|
|
{ |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if (item.name != lawyerinfo.name || |
|
|
|
|
item.sex != lawyerinfo.sex || |
|
|
|
|
item.phone != lawyerinfo.phone || |
|
|
|
|
item.departmentName != lawyerinfo.departmentName || |
|
|
|
|
item.cardId != lawyerinfo.cardId) |
|
|
|
|
{ |
|
|
|
|
item.name = lawyerinfo.name; |
|
|
|
|
item.sex = lawyerinfo.sex; |
|
|
|
|
item.identity = "律师"; |
|
|
|
|
item.phone = lawyerinfo.phone; |
|
|
|
|
item.departmentName = lawyerinfo.departmentName; |
|
|
|
|
item.cardId = lawyerinfo.cardId; |
|
|
|
|
updatelist.Add(item); |
|
|
|
|
} |
|
|
|
|
item.name = lawyerinfo.name; |
|
|
|
|
item.sex = lawyerinfo.sex; |
|
|
|
|
item.identity = "律师"; |
|
|
|
|
item.phone = lawyerinfo.phone; |
|
|
|
|
item.departmentName = lawyerinfo.departmentName; |
|
|
|
|
item.cardId = lawyerinfo.cardId; |
|
|
|
|
updatelist.Add(item); |
|
|
|
|
} |
|
|
|
|
if (updatelist.Any()) |
|
|
|
|
updated = await _db.Updateable(updatelist) |
|
|
|
|
.IgnoreColumns(ignoreAllNullColumns: true) |
|
|
|
|
.ExecuteCommandAsync(); |
|
|
|
|
} |
|
|
|
|
var addlawyers = lawyers.Where(x => lawyersInDb.Any(e => e.cardId == x.cardId) == false).ToList(); |
|
|
|
|
if (updatelist.Any()) |
|
|
|
|
updated = await _db.Updateable(updatelist) |
|
|
|
|
.IgnoreColumns(ignoreAllNullColumns: true) |
|
|
|
|
.ExecuteCommandAsync(); |
|
|
|
|
} |
|
|
|
|
var addlawyers = lawyers.Where(x => lawyersInDb.Any(e => e.cardId == x.cardId) == false).ToList(); |
|
|
|
|
|
|
|
|
|
if (addlawyers.Any()) |
|
|
|
|
added = await _db.Insertable(addlawyers).ExecuteCommandAsync(); |
|
|
|
|
if (addlawyers.Any()) |
|
|
|
|
added = await _db.Insertable(addlawyers).ExecuteCommandAsync(); |
|
|
|
|
|
|
|
|
|
res.IsSucceed = true; |
|
|
|
|
res.result = new |
|
|
|
|
{ |
|
|
|
|
updated, |
|
|
|
|
added |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
res.IsSucceed = true; |
|
|
|
|
res.result = new |
|
|
|
|
{ |
|
|
|
|
res.IsSucceed = false; |
|
|
|
|
res.Message = "数据格式不正确"; |
|
|
|
|
} |
|
|
|
|
updated, |
|
|
|
|
added |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
res.IsSucceed = false; |
|
|
|
|
res.Message = "文件上传失败"; |
|
|
|
|
res.Message = "数据格式不正确"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
res.IsSucceed = false; |
|
|
|
|
res.Message = "文件格式不支持"; |
|
|
|
|
res.Message = "文件上传失败"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (System.IO.File.Exists(path)) |
|
|
|
|
System.IO.File.Delete(path); |
|
|
|
|
|
|
|
|
|
if (System.IO.File.Exists(excelpath)) |
|
|
|
|
System.IO.File.Delete(excelpath); |
|
|
|
|
|
|
|
|
|
return res; |
|
|
|
|
} |
|
|
|
|
/// <summary> |
|
|
|
@ -1051,8 +1051,8 @@ namespace _24Hour.Controllers.Common
|
|
|
|
|
foreach (var item in identityphotos) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
var path = item.Replace(@"/", @"\"); |
|
|
|
|
var filepath = Environment.CurrentDirectory+@"\wwwroot"+path; |
|
|
|
|
var path = item.Replace(@"/", @"\"); |
|
|
|
|
var filepath = Environment.CurrentDirectory + @"\wwwroot" + path; |
|
|
|
|
if (System.IO.File.Exists(filepath)) |
|
|
|
|
{ |
|
|
|
|
var basestr = Convert.ToBase64String(System.IO.File.ReadAllBytes(filepath)); |
|
|
|
@ -1067,20 +1067,20 @@ namespace _24Hour.Controllers.Common
|
|
|
|
|
ImageStr = basestr |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
/// 1423000000100-律师执业证书,1423000000200-律师事务所证, 1423000000300- 授权委托书, 1423000000400- 法律援助公函,1423000000500-身份证件 ,1423000000600-关系证明材料, 1423000000700- 其他 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await UploadPhoto(lawyer.identityphoto, "1423000000100"); |
|
|
|
|
await UploadPhoto(lawyer.departmentPhoto, "1423000000200"); |
|
|
|
|
await UploadPhoto(lawyersvc.annex, "1423000000300"); |
|
|
|
|
await UploadPhoto(lawyersvc.legalAidPhoto, "1423000000400"); |
|
|
|
|
await UploadPhoto(lawyer.cardIdphoto, "1423000000500"); |
|
|
|
|
await UploadPhoto(lawyersvc.relationshipProofPhoto, "1423000000600"); |
|
|
|
|
await UploadPhoto(lawyersvc.otherPhoto, "1423000000700"); |
|
|
|
|
await UploadPhoto(lawyer.identityphoto, "1423000000100"); |
|
|
|
|
await UploadPhoto(lawyer.departmentPhoto, "1423000000200"); |
|
|
|
|
await UploadPhoto(lawyersvc.annex, "1423000000300"); |
|
|
|
|
await UploadPhoto(lawyersvc.legalAidPhoto, "1423000000400"); |
|
|
|
|
await UploadPhoto(lawyer.cardIdphoto, "1423000000500"); |
|
|
|
|
await UploadPhoto(lawyersvc.relationshipProofPhoto, "1423000000600"); |
|
|
|
|
await UploadPhoto(lawyersvc.otherPhoto, "1423000000700"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var markinginput = new ApplyMarKingDto() |
|
|
|
@ -1100,8 +1100,8 @@ namespace _24Hour.Controllers.Common
|
|
|
|
|
sxlxdm = "1405187400001", |
|
|
|
|
sxlxmc = "申请阅卷", |
|
|
|
|
zrrmc = party, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
var applymarkingrequest = await ApplyMarKing(markinginput); |
|
|
|
|
|
|
|
|
@ -1742,7 +1742,7 @@ namespace _24Hour.Controllers.Common
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 导入律师信息 |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="path"></param> |
|
|
|
|
/// <param name="secpath"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
[HttpGet] |
|
|
|
|
[Route("ImportLawyerArchivesInfo")] |
|
|
|
@ -1756,13 +1756,16 @@ namespace _24Hour.Controllers.Common
|
|
|
|
|
result.IsSucceed = false; |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
var decrypath = System.IO.Path.ChangeExtension(path, ".zip"); |
|
|
|
|
Elight.Utility.Encrypt.DataEncryption.Decryption(path, decrypath); |
|
|
|
|
|
|
|
|
|
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 extratname = Path.GetFileNameWithoutExtension(decrypath); |
|
|
|
|
var extratdirpath = Path.Combine(dir, extratname); |
|
|
|
|
ZipFile.ExtractToDirectory(path, extratdirpath, true); |
|
|
|
|
ZipFile.ExtractToDirectory(decrypath, extratdirpath, true); |
|
|
|
|
var zipusers = Path.Combine(extratdirpath, "users"); |
|
|
|
|
var ziplawyersvcs = Path.Combine(extratdirpath, "lawyerservices"); |
|
|
|
|
var zipjson = Path.Combine(extratdirpath, "data"); |
|
|
|
@ -2098,7 +2101,12 @@ namespace _24Hour.Controllers.Common
|
|
|
|
|
ZipFile.CreateFromDirectory(packegdir, packegzipname); |
|
|
|
|
Directory.Delete(packegdir, true); |
|
|
|
|
|
|
|
|
|
result.result = $"/temp/{packegdirname}.zip"; |
|
|
|
|
FileInfo fi = new FileInfo(packegzipname); //xx/xx/aa.rar |
|
|
|
|
|
|
|
|
|
var akspath = System.IO.Path.ChangeExtension(packegzipname, ".aks"); |
|
|
|
|
fi.MoveTo(akspath); //xx/xx/xx.rar |
|
|
|
|
|
|
|
|
|
result.result = $"/temp/{packegdirname}.aks"; |
|
|
|
|
result.IsSucceed = true; |
|
|
|
|
logger.LogInformation("step5"); |
|
|
|
|
return result; |
|
|
|
|