feat 增加券导入,获取设备数据权限的人员
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
<Solution>
|
||||
<Solution>
|
||||
<Folder Name="/Basic/">
|
||||
<Project Path="Src\Dlhis.Basic.Api\Dlhis.Basic.Api.csproj" />
|
||||
<Project Path="Src\Dlhis.Basic\Dlhis.Basic.csproj" />
|
||||
<Project Path="Src\Dlhis.Dh.Api\Dlhis.Dh.Api.csproj" Type="Classic C#" />
|
||||
<Project Path="Src\Dlhis.InfoCheck.Api\Dlhis.InfoCheck.Api.csproj" Type="Classic C#" />
|
||||
<Project Path="Src\Dlhis.Dh.Api\Dlhis.Dh.Api.csproj" />
|
||||
<Project Path="Src\Dlhis.InfoCheck.Api\Dlhis.InfoCheck.Api.csproj" />
|
||||
<Project Path="Src\Dlhis.InfoCheck\Dlhis.InfoCheck.csproj" />
|
||||
<Project Path="Src\Dlhis.Jip.Api\Dlhis.Jip.Api.csproj" Type="Classic C#" />
|
||||
<Project Path="Src\Dlhis.Jip.Api\Dlhis.Jip.Api.csproj" />
|
||||
</Folder>
|
||||
<Folder Name="/Canteen/">
|
||||
<Project Path="Src\Dlhis.Canteen.Api\Dlhis.Canteen.Api.csproj" Type="Classic C#" />
|
||||
<Project Path="Src\Dlhis.Canteen.Api\Dlhis.Canteen.Api.csproj" />
|
||||
<Project Path="Src\Dlhis.Canteen\Dlhis.Canteen.csproj" />
|
||||
</Folder>
|
||||
<Folder Name="/External/">
|
||||
@@ -18,16 +18,16 @@
|
||||
<Project Path="Src\Dlhis.Message\Dlhis.Message.csproj" />
|
||||
</Folder>
|
||||
<Folder Name="/Scheduled/">
|
||||
<Project Path="Src\Dlhis.Dormitory.Api\Dlhis.Dormitory.Api.csproj" Type="Classic C#" />
|
||||
<Project Path="Src\Dlhis.Dormitory.Api\Dlhis.Dormitory.Api.csproj" />
|
||||
<Project Path="Src\Dlhis.ScheduledTask\Dlhis.ScheduledTask.csproj" />
|
||||
</Folder>
|
||||
<Folder Name="/Sys/">
|
||||
<Project Path="Src\Dlhis.Sys.Api\Dlhis.Sys.Api.csproj" />
|
||||
<Project Path="Src\Dlhis.Sys\Dlhis.Sys.csproj" />
|
||||
</Folder>
|
||||
<Project Path="Src\Dlhis.Constants\Dlhis.Constants.csproj" Type="Classic C#" />
|
||||
<Project Path="Src\Dlhis.Constants\Dlhis.Constants.csproj" />
|
||||
<Project Path="Src\Dlhis.DataPermission.Model\Dlhis.DataPermission.Model.csproj" />
|
||||
<Project Path="Src\Dlhis.Entity\Dlhis.Entity.csproj" />
|
||||
<Project Path="Src\Dlhis.ExcelHelper\Dlhis.ExcelHelper.csproj" Type="Classic C#" />
|
||||
<Project Path="Src\Dlhis.ExcelHelper\Dlhis.ExcelHelper.csproj" />
|
||||
<Project Path="Src\Dlhis.Middle\Dlhis.Middle.csproj" />
|
||||
</Solution>
|
||||
@@ -77,6 +77,28 @@ public class VouchersController : ControllerBase
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建生日券
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost("birthday/import")]
|
||||
public async Task ImportBirthdayVoucherAsync(VoucherByBirthdayRequest request)
|
||||
{
|
||||
//判断Begin和End要大于2025年,并且不能大于当前年
|
||||
(request.Begin.Year < 2025).ThrowIfTrue("年份必须大于等于2025年,并且小于等于当前年");
|
||||
(request.End.Year > DateTime.Now.Year).ThrowIfTrue("年份必须大于等于2025年,并且小于等于当前年");
|
||||
|
||||
var srv = _namedResolver.GetService<IVoucherService>(VoucherEnumType.Birthday.ToString() + "VoucherService");
|
||||
srv.ThrowIfNull("不支持的券类型");
|
||||
await srv.CreateAsync(new Dictionary<string, object>
|
||||
{
|
||||
["userCodes"] = request.UserCodes,
|
||||
["begin"] = request.Begin,
|
||||
["end"] = request.End,
|
||||
["remark"] = request.Remark
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 餐券消费分页
|
||||
/// </summary>
|
||||
|
||||
@@ -7,21 +7,36 @@ using SqlSugar.DbConvert;
|
||||
|
||||
namespace Dlhis.Entity.Sys.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD>Ȩ<EFBFBD><C8A8>
|
||||
/// </summary>
|
||||
[SugarTable(TableName = "DataPermissions")]
|
||||
public class DataPermissionEntity : SugarBaseEntity, ITenantId
|
||||
{
|
||||
/// <summary>
|
||||
/// <20>û<EFBFBD>UserNo
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = false)]
|
||||
public string AssignValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// <20><>ȡȨ<C8A1><EFBFBD><DEB5><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = false, ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))]
|
||||
public DataPermissionAssignmentEnumType UniqueType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// <20><>ȡȨ<C8A1><C8A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ψһֵ
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = false)]
|
||||
public Guid UniqueValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// <20>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true, ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))]
|
||||
public DeviceTypeEnumType? DeviceType { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
public string TenantId { get; set; }
|
||||
}
|
||||
@@ -5,7 +5,7 @@ using Dlhis.Entity.Visitor.Entity;
|
||||
using Dlhis.Entity.Visitor.Enums;
|
||||
using Dlhis.ScheduledTask.Attributes;
|
||||
|
||||
namespace Dlhis.ScheduledTask.Jobs;
|
||||
namespace Dlhis.ScheduledTask.Jobs.Visitor;
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -6,7 +6,7 @@ using Dlhis.Entity.Visitor.Enums;
|
||||
using Dlhis.ScheduledTask.Attributes;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
|
||||
namespace Dlhis.ScheduledTask.Jobs;
|
||||
namespace Dlhis.ScheduledTask.Jobs.Visitor;
|
||||
|
||||
/// <summary>
|
||||
/// 访客预约移除
|
||||
@@ -5,7 +5,7 @@ using Dlhis.Entity.Visitor.Enums;
|
||||
using Dlhis.ScheduledTask.Attributes;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
|
||||
namespace Dlhis.ScheduledTask.Jobs;
|
||||
namespace Dlhis.ScheduledTask.Jobs.Visitor;
|
||||
|
||||
/// <summary>
|
||||
/// 每天10点提醒访客预约到期
|
||||
@@ -2,6 +2,7 @@
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Dlhis.Entity.Sys.Enums;
|
||||
using Dlhis.Sys.DataPermission.Request;
|
||||
using Dlhis.Sys.DataPermission.Response;
|
||||
using Dlhis.Sys.DataPermission.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -37,4 +38,15 @@ public class DataPermissionsController : ControllerBase
|
||||
{
|
||||
return await _dataPermissionService.GetAssignmentsAsync(assignValue, uniqueType, type);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户的设备数据权限
|
||||
/// </summary>
|
||||
/// <param name="deviceCode"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("userDevicePermissions")]
|
||||
public async Task<List<GainfoResponse>> GetUsersDeviceDataPermissionsAsync(Guid deviceCode)
|
||||
{
|
||||
return await _dataPermissionService.GetUsersDeviceDataPermissionsAsync(deviceCode);
|
||||
}
|
||||
}
|
||||
7
Src/Dlhis.Sys/DataPermission/Response/GainfoResponse.cs
Normal file
7
Src/Dlhis.Sys/DataPermission/Response/GainfoResponse.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Dlhis.Sys.DataPermission.Response;
|
||||
|
||||
public class GainfoResponse
|
||||
{
|
||||
public string UserCode { get; set; }
|
||||
public string UserName { get; set; }
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Dlhis.Entity.Sys.Enums;
|
||||
using Dlhis.Sys.DataPermission.Request;
|
||||
using Dlhis.Sys.DataPermission.Response;
|
||||
|
||||
namespace Dlhis.Sys.DataPermission.Services;
|
||||
|
||||
@@ -9,4 +10,6 @@ public interface IDataPermissionService : IScopeDependency
|
||||
Task SaveAsync(DataPermissionSaveRequest request);
|
||||
|
||||
Task<List<Guid>> GetAssignmentsAsync(string assignValue, DataPermissionAssignmentEnumType uniqueType, DeviceTypeEnumType? type);
|
||||
|
||||
Task<List<GainfoResponse>> GetUsersDeviceDataPermissionsAsync(Guid deviceCode);
|
||||
}
|
||||
@@ -1,7 +1,10 @@
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Device.Entities;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Dlhis.Entity.Sys.Entities;
|
||||
using Dlhis.Entity.Sys.Enums;
|
||||
using Dlhis.Sys.DataPermission.Request;
|
||||
using Dlhis.Sys.DataPermission.Response;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
|
||||
@@ -25,8 +28,8 @@ public class DataPermissionService : IDataPermissionService
|
||||
.WhereIF(request.Type.HasValue, x => x.DeviceType == request.Type)
|
||||
.ToListAsync();
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>д<EFBFBD><D0B4>
|
||||
await _dbContext.DeleteReallyAsync(data);
|
||||
|
||||
if (request.Codes.IsPresent())
|
||||
{
|
||||
await _dbContext.InsertAsync(request.Codes.Select(x => new DataPermissionEntity
|
||||
@@ -48,4 +51,30 @@ public class DataPermissionService : IDataPermissionService
|
||||
.Select(x => x.UniqueValue)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<List<GainfoResponse>> GetUsersDeviceDataPermissionsAsync(Guid deviceCode)
|
||||
{
|
||||
var deviceGroupCodes = await _dbContext.Queryable<DeviceGroupRelationshipEntity>()
|
||||
.Where(x => x.DeviceCode == deviceCode)
|
||||
.Select(x => x.GroupCode)
|
||||
.Distinct()
|
||||
.ToListAsync();
|
||||
|
||||
var userNos = await _dbContext.Queryable<DataPermissionEntity>()
|
||||
.Where(x => (x.UniqueValue == deviceCode && x.UniqueType == DataPermissionAssignmentEnumType.Device)
|
||||
|| (deviceGroupCodes.Contains(x.UniqueValue) && x.UniqueType == DataPermissionAssignmentEnumType.Group)
|
||||
)
|
||||
.Select(x => x.AssignValue)
|
||||
.ToListAsync();
|
||||
|
||||
|
||||
return await _dbContext.Queryable<GainfoEntity>()
|
||||
.Where(x => userNos.Contains(x.No))
|
||||
.Select(x => new GainfoResponse
|
||||
{
|
||||
UserCode = x.Code,
|
||||
UserName = x.Name
|
||||
})
|
||||
.ToListAsync();
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,6 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="DataPermission\Response\" />
|
||||
<Folder Include="Server\Request\" />
|
||||
<Folder Include="Server\Response\" />
|
||||
<Folder Include="Server\Services\Implements\" />
|
||||
|
||||
Reference in New Issue
Block a user