Browse Source

添加全局路径

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

82
24Hour/Controllers/Common/LawyerArchivesController.cs

@ -14,6 +14,7 @@ using Elight.Utility.Extensions;
using Elight.Utility.logs;
using java.io;
using java.lang;
using java.nio.file;
using java.time;
using javax.xml.crypto;
using Microsoft.AspNetCore.Authorization;
@ -33,6 +34,7 @@ using static _24Hour.TwentySystemProxyClient;
using static com.sun.tools.@internal.xjc.reader.xmlschema.bindinfo.BIConversion;
using static NPOI.HSSF.Util.HSSFColor;
using Exception = System.Exception;
using Path = System.IO.Path;
using User = Elight.Utility.User;
namespace _24Hour.Controllers.Common
@ -2070,7 +2072,87 @@ namespace _24Hour.Controllers.Common
return result;
}
[HttpPost]
[Route("SyncLawyerInfoFromTwentySys")]
public async Task<Result> SyncLawyerInfoFromTwentySys()
{
var data = await twentyClient.GetAllLsList();
if (data.IsSucceed == true)
{
if (data?.result?.content?.Any() == true)
{
var datas = data.result.content
.Where(x => x.zjlxmc == "律师执业证")
.Select(x => new App_Sys_UserModel
{
Id = Guid.NewGuid().ToString(),
name = x?.sqrxm,
phone = x?.lxdh?.ToString(),
departmentName = x?.szlssws,
identitycardId = x?.zjhm,
cardId = x?.jmsfzh,
unitCode = _userdata?.unitCode,
createtime = DateTime.Now,
createuserId = _userdata?.createuserId,
createusername = _userdata?.name,
identity = "律师",
usertype = 1,
audit = 0,
isdeactivate = 0,
IsDeleted = 0,
}).ToList();
var lawyers = datas
.GroupBy(x => new
{
x.cardId
})
.Select(x => x.FirstOrDefault())
.ToList();
var ids = lawyers.Select(x => x.cardId).ToList();
var lawyerindb = _db.Queryable<App_Sys_UserModel>()
.Where(x => ids.Contains(x.cardId))
.ToList();
var addlist = new List<App_Sys_UserModel>();
var editlist = new List<App_Sys_UserModel>();
foreach (var item in lawyers)
{
var editentity = lawyerindb.FirstOrDefault(x => x.cardId == item.cardId);
if (editentity == null)
{
addlist.Add(item);
}
else
{
editentity.unitCode = _userdata.unitCode;
editentity.phone = item.phone;
editentity.phone = item.phone;
editentity.departmentName = item.departmentName;
editentity.identitycardId = item.identitycardId;
editentity.identity = item.identitycardId;
editentity.usertype = 1;
editentity.audit = 0;
editentity.isdeactivate = 0;
editentity.IsDeleted = 0;
editlist.Add(editentity);
}
}
_db.BeginTran();
var num = await _db.Insertable(addlist).ExecuteCommandAsync();
var nums = await _db.Updateable(editlist).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
_db.CommitTran();
result.result = new
{
updated = nums,
added = num
};
}
}
return result;
}
public class DecodeQRDataModel
{

Loading…
Cancel
Save