feat 数据敏感分配角色可见,切换基地,定时任务lock
This commit is contained in:
@@ -31,7 +31,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="MealUser\Controllers\" />
|
||||
<Folder Include="MealUser\Request\" />
|
||||
<Folder Include="MealUser\Response\" />
|
||||
<Folder Include="MealUser\Services\Implements\" />
|
||||
<Folder Include="Summary\Request\" />
|
||||
|
||||
50
Src/Dlhis.Basic/ObfuscateProviderJsonConverter.cs
Normal file
50
Src/Dlhis.Basic/ObfuscateProviderJsonConverter.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using System.Security.Claims;
|
||||
using Kurisu.AspNetCore;
|
||||
using Kurisu.AspNetCore.Authentication.Abstractions;
|
||||
using Kurisu.AspNetCore.Utils;
|
||||
using Kurisu.AspNetCore.Utils.Converters;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Dlhis.Basic;
|
||||
|
||||
public class ObfuscateProviderJsonConverter : ObfuscateJsonConverter
|
||||
{
|
||||
private readonly int _last;
|
||||
|
||||
/// <inheritdoc />
|
||||
public ObfuscateProviderJsonConverter(int last) : base(last)
|
||||
{
|
||||
_last = last;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
||||
{
|
||||
var sp = App.GetServiceProvider(true);
|
||||
var cache = sp.GetService<RedisCache>();
|
||||
var currentUser = sp.GetService<ICurrentUser>();
|
||||
var range = cache.ListRange("datapermission:role");
|
||||
if (range.Contains(currentUser.GetUserClaim(ClaimTypes.Role)))
|
||||
{
|
||||
writer.WriteValue(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
var v = value?.ToString() ?? string.Empty;
|
||||
var vc = v.ToCharArray().Reverse().ToList();
|
||||
|
||||
for (int i = 0; i < vc.Count; i++)
|
||||
{
|
||||
if (i + 1 > _last)
|
||||
{
|
||||
vc[i] = '*';
|
||||
}
|
||||
}
|
||||
|
||||
vc.Reverse();
|
||||
v = string.Join("", vc);
|
||||
|
||||
writer.WriteValue(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Basic.Organization.Services;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
@@ -37,6 +38,8 @@ public class GainfoMealController : ControllerBase
|
||||
/// 迁移
|
||||
/// </summary>
|
||||
[Authorize(Roles = "admin")]
|
||||
[Transactional]
|
||||
[Authorize(Roles = "admin,tenant-admin")]
|
||||
[HttpPost("migration")]
|
||||
public async Task MigrationAsync(GainfoBalanceMigrationRequest request)
|
||||
{
|
||||
|
||||
@@ -47,8 +47,14 @@ public class GainfoPageResponse
|
||||
/// <summary>
|
||||
/// 身份证号
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(ObfuscateJsonConverter), 6)]
|
||||
[JsonConverter(typeof(ObfuscateProviderJsonConverter), 6)]
|
||||
public string IdNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 手机号码
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(ObfuscateProviderJsonConverter), 4)]
|
||||
public string Phone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 身份证籍贯区域代码
|
||||
@@ -88,12 +94,6 @@ public class GainfoPageResponse
|
||||
/// </summary>
|
||||
public string Nation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 手机号码
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(ObfuscateJsonConverter), 4)]
|
||||
public string Phone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 学历
|
||||
/// </summary>
|
||||
|
||||
@@ -9,7 +9,6 @@ using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
using Kurisu.AspNetCore.Utils;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Services.Implements;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user