fix 权限重发增加是否离职处理
This commit is contained in:
@@ -3,6 +3,7 @@ using Dlhis.Basic.Device.Response;
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Basic.Organization.Services;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -72,6 +73,7 @@ public class GainfoPermissionsController : ControllerBase
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("reset")]
|
||||
[IgnoreTenant]
|
||||
public async Task ResetPermissionsAsync(GainfoPermissionResetRequest request)
|
||||
{
|
||||
await _gainfoPermissions.ResetPermissionsAsync(request);
|
||||
|
||||
@@ -9,4 +9,9 @@ public class GainfoPermissionResetRequest
|
||||
/// </summary>
|
||||
[Required]
|
||||
public string UserNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否是离职
|
||||
/// </summary>
|
||||
public bool IsLeave { get; set; }
|
||||
}
|
||||
|
||||
@@ -199,7 +199,17 @@ public class GainfoPermissionService : IGainfoPermissionService
|
||||
|
||||
public async Task ResetPermissionsAsync(GainfoPermissionResetRequest request)
|
||||
{
|
||||
var gainfo = await _dbContext.Queryable<GainfoEntity>().Where(x => x.No == request.UserNo).SingleAsync();
|
||||
var gainfo = await _dbContext.Queryable<GainfoEntity>()
|
||||
.Where(x => x.No == request.UserNo)
|
||||
.SingleAsync();
|
||||
|
||||
if (request.IsLeave)
|
||||
{
|
||||
gainfo = await _dbContext.Queryable<GainfoEntity>().AS("GainfoLeave")
|
||||
.Where(x => x.No == request.UserNo)
|
||||
.SingleAsync();
|
||||
}
|
||||
|
||||
gainfo.ThrowIfNull("档案数据不存在");
|
||||
|
||||
var deviceCodes = await _devicePermissionService.GetAssignDeviceCodesAsync(request.UserNo);
|
||||
@@ -212,7 +222,7 @@ public class GainfoPermissionService : IGainfoPermissionService
|
||||
DeviceUniqueNo = x.UniqueNo,
|
||||
Status = DeviceTaskStatusEnumType.Wait,
|
||||
UserNo = request.UserNo,
|
||||
Type = DeviceTaskEnumType.Add,
|
||||
Type = request.IsLeave ? DeviceTaskEnumType.Delete : DeviceTaskEnumType.Add,
|
||||
TenantId = gainfo.Factory,
|
||||
})
|
||||
.ToList();
|
||||
|
||||
@@ -75,12 +75,12 @@ public class SummaryService : ISummaryService
|
||||
Unemployed = leaveGainfos.Count,
|
||||
GainfoTrend = new GainfoTrendResponse
|
||||
{
|
||||
EmployedTrend = FixTrend(workingGainfos.Where(x => x.CreateTime >= before7Day && x.CreateTime <= currentDay)
|
||||
.GroupBy(x => x.CreateTime.Date)
|
||||
.Select(x => new TrendDto { Date = x.Key, Count = x.Count() }), before7Day, currentDay),
|
||||
UnemployedTrend = FixTrend(leaveGainfos.Where(x => x.CreateTime >= before7Day && x.CreateTime <= currentDay)
|
||||
.GroupBy(x => x.CreateTime.Date)
|
||||
.Select(x => new TrendDto { Date = x.Key, Count = x.Count() }), before7Day, currentDay),
|
||||
EmployedTrend = FixTrend(workingGainfos.Where(x => x.EntryDate >= before7Day && x.EntryDate <= currentDay)
|
||||
.GroupBy(x => x.EntryDate)
|
||||
.Select(x => new TrendDto { Date = x.Key.Value, Count = x.Count() }), before7Day, currentDay),
|
||||
UnemployedTrend = FixTrend(leaveGainfos.Where(x => x.ResignationDate >= before7Day && x.ResignationDate <= currentDay)
|
||||
.GroupBy(x => x.ResignationDate)
|
||||
.Select(x => new TrendDto { Date = x.Key.Value, Count = x.Count() }), before7Day, currentDay),
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user