This commit is contained in:
Xy
2021-04-23 10:40:07 +00:00
parent c2ed43238b
commit bd18dd95b7
9 changed files with 32 additions and 32 deletions

View File

@@ -15,9 +15,9 @@ namespace Dilon.Core
private readonly IRepository<SysEmp> _sysEmpRep; // 员工表
private readonly IHttpContextAccessor _httpContextAccessor;
public long UserId
public string UserId
{
get => long.Parse(_httpContextAccessor.HttpContext.User.FindFirst(ClaimConst.CLAINM_USERID)?.Value);
get => _httpContextAccessor.HttpContext.User.FindFirst(ClaimConst.CLAINM_USERID)?.Value;
}
public string Account

View File

@@ -30,10 +30,10 @@ namespace Dilon.Core.Service
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
public async Task<List<long>> GetDataScope(long userId)
public async Task<List<string>> GetDataScope(string userId)
{
var cacheKey = CommonConst.CACHE_KEY_DATASCOPE + $"{userId}";
return await _cache.GetAsync<List<long>>(cacheKey);
return await _cache.GetAsync<List<string>>(cacheKey);
}
/// <summary>
@@ -43,7 +43,7 @@ namespace Dilon.Core.Service
/// <param name="dataScopes"></param>
/// <returns></returns>
[NonAction]
public async Task SetDataScope(long userId, List<long> dataScopes)
public async Task SetDataScope(string userId, List<string> dataScopes)
{
var cacheKey = CommonConst.CACHE_KEY_DATASCOPE + $"{userId}";
await _cache.SetAsync(cacheKey, dataScopes);
@@ -55,7 +55,7 @@ namespace Dilon.Core.Service
/// <param name="userId"></param>
/// <param name="appCode"></param>
/// <returns></returns>
public async Task<List<AntDesignTreeNode>> GetMenu(long userId, string appCode)
public async Task<List<AntDesignTreeNode>> GetMenu(string userId, string appCode)
{
var cacheKey = CommonConst.CACHE_KEY_MENU + $"{userId}-{appCode}";
return await _cache.GetAsync<List<AntDesignTreeNode>>(cacheKey);
@@ -69,7 +69,7 @@ namespace Dilon.Core.Service
/// <param name="menus"></param>
/// <returns></returns>
[NonAction]
public async Task SetMenu(long userId, string appCode, List<AntDesignTreeNode> menus)
public async Task SetMenu(string userId, string appCode, List<AntDesignTreeNode> menus)
{
var cacheKey = CommonConst.CACHE_KEY_MENU + $"{userId}-{appCode}";
await _cache.SetAsync(cacheKey, menus);
@@ -80,7 +80,7 @@ namespace Dilon.Core.Service
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
public async Task<List<string>> GetPermission(long userId)
public async Task<List<string>> GetPermission(string userId)
{
var cacheKey = CommonConst.CACHE_KEY_PERMISSION + $"{userId}";
return await _cache.GetAsync<List<string>>(cacheKey);
@@ -93,7 +93,7 @@ namespace Dilon.Core.Service
/// <param name="permissions"></param>
/// <returns></returns>
[NonAction]
public async Task SetPermission(long userId, List<string> permissions)
public async Task SetPermission(string userId, List<string> permissions)
{
var cacheKey = CommonConst.CACHE_KEY_PERMISSION + $"{userId}";
await _cache.SetAsync(cacheKey, permissions);

View File

@@ -8,7 +8,7 @@
/// <summary>
/// 附属机构id
/// </summary>
public long OrgId { get; set; }
public string OrgId { get; set; }
/// <summary>
/// 附属机构编码
@@ -23,7 +23,7 @@
/// <summary>
/// 附属职位id
/// </summary>
public long PosId { get; set; }
public string PosId { get; set; }
/// <summary>
/// 附属职位编码

View File

@@ -35,6 +35,6 @@ namespace Dilon.Core.Service
/// <summary>
/// 职位集合
/// </summary>
public List<long> PosIdList { get; set; } = new List<long>();
public List<string> PosIdList { get; set; } = new List<string>();
}
}

View File

@@ -8,7 +8,7 @@
/// <summary>
/// 职位Id
/// </summary>
public long PosId { get; set; }
public string PosId { get; set; }
/// <summary>
/// 职位编码

View File

@@ -5,9 +5,9 @@ namespace Dilon.Core.Service
{
public interface ISysEmpPosService
{
Task AddOrUpdate(long empId, List<long> posIdList);
Task DeleteEmpPosInfoByUserId(long empId);
Task<List<EmpPosOutput>> GetEmpPosList(long empId);
Task<bool> HasPosEmp(long posId);
Task AddOrUpdate(string empId, List<string> posIdList);
Task DeleteEmpPosInfoByUserId(string empId);
Task<List<EmpPosOutput>> GetEmpPosList(string empId);
Task<bool> HasPosEmp(string posId);
}
}

View File

@@ -25,7 +25,7 @@ namespace Dilon.Core.Service
/// </summary>
/// <returns></returns>
[UnitOfWork]
public async Task AddOrUpdate(long empId, List<EmpExtOrgPosOutput> extIdList)
public async Task AddOrUpdate(string empId, List<EmpExtOrgPosOutput> extIdList)
{
// 先删除
await DeleteEmpExtInfoByUserId(empId);
@@ -48,7 +48,7 @@ namespace Dilon.Core.Service
/// </summary>
/// <param name="empId"></param>
/// <returns></returns>
public async Task<List<EmpExtOrgPosOutput>> GetEmpExtOrgPosList(long empId)
public async Task<List<EmpExtOrgPosOutput>> GetEmpExtOrgPosList(string empId)
{
return await _sysEmpExtOrgPosRep.DetachedEntities
.Where(u => u.SysEmpId == empId)
@@ -68,7 +68,7 @@ namespace Dilon.Core.Service
/// </summary>
/// <param name="orgId"></param>
/// <returns></returns>
public async Task<bool> HasExtOrgEmp(long orgId)
public async Task<bool> HasExtOrgEmp(string orgId)
{
return await _sysEmpExtOrgPosRep.DetachedEntities.AnyAsync(u => u.SysOrgId == orgId);
}
@@ -78,7 +78,7 @@ namespace Dilon.Core.Service
/// </summary>
/// <param name="posId"></param>
/// <returns></returns>
public async Task<bool> HasExtPosEmp(long posId)
public async Task<bool> HasExtPosEmp(string posId)
{
return await _sysEmpExtOrgPosRep.DetachedEntities.AnyAsync(u => u.SysPosId == posId);
}
@@ -88,7 +88,7 @@ namespace Dilon.Core.Service
/// </summary>
/// <param name="empId"></param>
/// <returns></returns>
public async Task DeleteEmpExtInfoByUserId(long empId)
public async Task DeleteEmpExtInfoByUserId(string empId)
{
var empExtOrgPos = await _sysEmpExtOrgPosRep.Where(u => u.SysEmpId == empId).ToListAsync();
empExtOrgPos.ForEach(u =>

View File

@@ -27,7 +27,7 @@ namespace Dilon.Core.Service
/// <param name="posIdList">职位id集合</param>
/// <returns></returns>
[UnitOfWork]
public async Task AddOrUpdate(long empId, List<long> posIdList)
public async Task AddOrUpdate(string empId, List<string> posIdList)
{
// 先删除
await DeleteEmpPosInfoByUserId(empId);
@@ -46,7 +46,7 @@ namespace Dilon.Core.Service
/// 获取所属职位信息
/// </summary>
/// <param name="empId">员工Id用户Id</param>
public async Task<List<EmpPosOutput>> GetEmpPosList(long empId)
public async Task<List<EmpPosOutput>> GetEmpPosList(string empId)
{
return await _sysEmpPosRep.DetachedEntities
.Where(u => u.SysEmpId == empId)
@@ -63,7 +63,7 @@ namespace Dilon.Core.Service
/// </summary>
/// <param name="posId"></param>
/// <returns></returns>
public async Task<bool> HasPosEmp(long posId)
public async Task<bool> HasPosEmp(string posId)
{
return await _sysEmpPosRep.DetachedEntities.AnyAsync(u => u.SysPosId == posId);
}
@@ -73,7 +73,7 @@ namespace Dilon.Core.Service
/// </summary>
/// <param name="empId"></param>
/// <returns></returns>
public async Task DeleteEmpPosInfoByUserId(long empId)
public async Task DeleteEmpPosInfoByUserId(string empId)
{
var empPos = await _sysEmpPosRep.Where(u => u.SysEmpId == empId).ToListAsync();
empPos.ForEach(u =>

View File

@@ -31,7 +31,7 @@ namespace Dilon.Core.Service
/// </summary>
/// <param name="empId"></param>
/// <returns></returns>
public async Task<EmpOutput> GetEmpInfo(long empId)
public async Task<EmpOutput> GetEmpInfo(string empId)
{
var empInfoOutput = new EmpOutput();
var sysEmp = await _sysEmpRep.FirstOrDefaultAsync(u => u.Id == empId, false);
@@ -51,7 +51,7 @@ namespace Dilon.Core.Service
public async Task AddOrUpdate(EmpOutput2 sysEmpParam)
{
// 先删除员工信息
var emps = await _sysEmpRep.Where(u => u.Id == long.Parse(sysEmpParam.Id)).ToListAsync();
var emps = await _sysEmpRep.Where(u => u.Id == sysEmpParam.Id).ToListAsync();
emps.ForEach(u =>
{
u.DeleteNow();
@@ -74,7 +74,7 @@ namespace Dilon.Core.Service
/// <param name="orgId"></param>
/// <param name="orgName"></param>
/// <returns></returns>
public async Task UpdateEmpOrgInfo(long orgId, string orgName)
public async Task UpdateEmpOrgInfo(string orgId, string orgName)
{
var emps = await _sysEmpRep.Where(u => u.OrgId == orgId).ToListAsync();
emps.ForEach(u =>
@@ -88,7 +88,7 @@ namespace Dilon.Core.Service
/// </summary>
/// <param name="orgId"></param>
/// <returns></returns>
public async Task<bool> HasOrgEmp(long orgId)
public async Task<bool> HasOrgEmp(string orgId)
{
return await _sysEmpRep.DetachedEntities.AnyAsync(u => u.OrgId == orgId);
}
@@ -99,7 +99,7 @@ namespace Dilon.Core.Service
/// <param name="empId"></param>
/// <returns></returns>
[UnitOfWork]
public async Task DeleteEmpInfoByUserId(long empId)
public async Task DeleteEmpInfoByUserId(string empId)
{
// 删除员工信息
var emp = await _sysEmpRep.FirstOrDefaultAsync(u => u.Id == empId);
@@ -117,7 +117,7 @@ namespace Dilon.Core.Service
/// </summary>
/// <param name="empId"></param>
/// <returns></returns>
public async Task<long> GetEmpOrgId(long empId)
public async Task<string> GetEmpOrgId(string empId)
{
return (await _sysEmpRep.FirstOrDefaultAsync(u => u.Id == empId, false)).OrgId;
}