😎1、修复租户域名不能为空 2、代码整理
This commit is contained in:
parent
4c7fc4506c
commit
74d4253501
@ -1,215 +1,215 @@
|
|||||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||||
//
|
//
|
||||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||||
//
|
//
|
||||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||||
|
|
||||||
namespace Admin.NET.Core;
|
namespace Admin.NET.Core;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 枚举转字典
|
/// 枚举转字典
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JobDetail("job_EnumToDictJob", Description = "枚举转字典", GroupName = "default", Concurrent = false)]
|
[JobDetail("job_EnumToDictJob", Description = "枚举转字典", GroupName = "default", Concurrent = false)]
|
||||||
[PeriodSeconds(1, TriggerId = "trigger_EnumToDictJob", Description = "枚举转字典", MaxNumberOfRuns = 1, RunOnStart = true)]
|
[PeriodSeconds(1, TriggerId = "trigger_EnumToDictJob", Description = "枚举转字典", MaxNumberOfRuns = 1, RunOnStart = true)]
|
||||||
public class EnumToDictJob : IJob
|
public class EnumToDictJob : IJob
|
||||||
{
|
{
|
||||||
private readonly IServiceScopeFactory _scopeFactory;
|
private readonly IServiceScopeFactory _scopeFactory;
|
||||||
private const int OrderOffset = 10;
|
private const int OrderOffset = 10;
|
||||||
private const string DefaultTagType = "info";
|
private const string DefaultTagType = "info";
|
||||||
|
|
||||||
public EnumToDictJob(IServiceScopeFactory scopeFactory)
|
public EnumToDictJob(IServiceScopeFactory scopeFactory)
|
||||||
{
|
{
|
||||||
_scopeFactory = scopeFactory;
|
_scopeFactory = scopeFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task ExecuteAsync(JobExecutingContext context, CancellationToken stoppingToken)
|
public async Task ExecuteAsync(JobExecutingContext context, CancellationToken stoppingToken)
|
||||||
{
|
{
|
||||||
using var serviceScope = _scopeFactory.CreateScope();
|
using var serviceScope = _scopeFactory.CreateScope();
|
||||||
var sysEnumService = serviceScope.ServiceProvider.GetRequiredService<SysEnumService>();
|
var sysEnumService = serviceScope.ServiceProvider.GetRequiredService<SysEnumService>();
|
||||||
// 获取数据库连接
|
// 获取数据库连接
|
||||||
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().CopyNew();
|
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().CopyNew();
|
||||||
|
|
||||||
// 获取枚举类型列表
|
// 获取枚举类型列表
|
||||||
var enumTypeList = sysEnumService.GetEnumTypeList();
|
var enumTypeList = sysEnumService.GetEnumTypeList();
|
||||||
var enumCodeList = enumTypeList.Select(u => u.TypeName);
|
var enumCodeList = enumTypeList.Select(u => u.TypeName);
|
||||||
// 查询数据库中已存在的枚举类型代码
|
// 查询数据库中已存在的枚举类型代码
|
||||||
//var exp = Expressionable.Create<SysDictType, SingleColumnEntity<string>>().And((t1, t2) => t1.Code == t2.ColumnName).ToExpression();
|
//var exp = Expressionable.Create<SysDictType, SingleColumnEntity<string>>().And((t1, t2) => t1.Code == t2.ColumnName).ToExpression();
|
||||||
//var sysDictTypeList = await db.Queryable<SysDictType>().Includes(t1 => t1.Children).BulkListQuery(exp, enumCodeList, stoppingToken);
|
//var sysDictTypeList = await db.Queryable<SysDictType>().Includes(t1 => t1.Children).BulkListQuery(exp, enumCodeList, stoppingToken);
|
||||||
var sysDictTypeList = await db.Queryable<SysDictType>().Includes(u => u.Children)
|
var sysDictTypeList = await db.Queryable<SysDictType>().Includes(u => u.Children)
|
||||||
.Where(u => enumCodeList.Contains(u.Code)).ToListAsync(stoppingToken);
|
.Where(u => enumCodeList.Contains(u.Code)).ToListAsync(stoppingToken);
|
||||||
// 更新的枚举转换字典
|
// 更新的枚举转换字典
|
||||||
var updatedEnumCodes = sysDictTypeList.Select(u => u.Code);
|
var updatedEnumCodes = sysDictTypeList.Select(u => u.Code);
|
||||||
var updatedEnumType = enumTypeList.Where(u => updatedEnumCodes.Contains(u.TypeName)).ToList();
|
var updatedEnumType = enumTypeList.Where(u => updatedEnumCodes.Contains(u.TypeName)).ToList();
|
||||||
var sysDictTypeDict = sysDictTypeList.ToDictionary(u => u.Code, u => u);
|
var sysDictTypeDict = sysDictTypeList.ToDictionary(u => u.Code, u => u);
|
||||||
var (updatedDictTypes, updatedDictDatas, newSysDictDatas) = GetUpdatedDicts(updatedEnumType, sysDictTypeDict);
|
var (updatedDictTypes, updatedDictDatas, newSysDictDatas) = GetUpdatedDicts(updatedEnumType, sysDictTypeDict);
|
||||||
|
|
||||||
// 新增的枚举转换字典
|
// 新增的枚举转换字典
|
||||||
var newEnumType = enumTypeList.Where(u => !updatedEnumCodes.Contains(u.TypeName)).ToList();
|
var newEnumType = enumTypeList.Where(u => !updatedEnumCodes.Contains(u.TypeName)).ToList();
|
||||||
var (newDictTypes, newDictDatas) = GetNewSysDicts(newEnumType);
|
var (newDictTypes, newDictDatas) = GetNewSysDicts(newEnumType);
|
||||||
|
|
||||||
// 执行数据库操作
|
// 执行数据库操作
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await db.BeginTranAsync();
|
await db.BeginTranAsync();
|
||||||
|
|
||||||
if (updatedDictTypes.Count > 0)
|
if (updatedDictTypes.Count > 0)
|
||||||
await db.Updateable(updatedDictTypes).ExecuteCommandAsync(stoppingToken);
|
await db.Updateable(updatedDictTypes).ExecuteCommandAsync(stoppingToken);
|
||||||
|
|
||||||
if (updatedDictDatas.Count > 0)
|
if (updatedDictDatas.Count > 0)
|
||||||
await db.Updateable(updatedDictDatas).ExecuteCommandAsync(stoppingToken);
|
await db.Updateable(updatedDictDatas).ExecuteCommandAsync(stoppingToken);
|
||||||
|
|
||||||
if (newSysDictDatas.Count > 0)
|
if (newSysDictDatas.Count > 0)
|
||||||
{
|
{
|
||||||
//达梦 下用db.Insertable(newDictTypes).ExecuteCommandAsync(stoppingToken);插入400条以上会内容溢出错误,所以改用逐条插入
|
// 达梦:用db.Insertable(newDictTypes).ExecuteCommandAsync(stoppingToken);插入400条以上会内容溢出错误,所以改用逐条插入
|
||||||
//达梦 下不支持storageable2.BulkUpdateAsync 功能,注意使用
|
// 达梦:不支持storageable2.BulkUpdateAsync 功能
|
||||||
foreach (var dd in newSysDictDatas)
|
foreach (var dd in newSysDictDatas)
|
||||||
await db.Insertable(dd).ExecuteCommandAsync(stoppingToken);
|
await db.Insertable(dd).ExecuteCommandAsync(stoppingToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newDictTypes.Count > 0)
|
if (newDictTypes.Count > 0)
|
||||||
await db.Insertable(newDictTypes).ExecuteCommandAsync(stoppingToken);
|
await db.Insertable(newDictTypes).ExecuteCommandAsync(stoppingToken);
|
||||||
|
|
||||||
if (newDictDatas.Count > 0)
|
if (newDictDatas.Count > 0)
|
||||||
{
|
{
|
||||||
//达梦 下用db.Insertable(newDictTypes).ExecuteCommandAsync(stoppingToken);插入400条以上会内容溢出错误,所以改用逐条插入
|
// 达梦:用db.Insertable(newDictTypes).ExecuteCommandAsync(stoppingToken);插入400条以上会内容溢出错误,所以改用逐条插入
|
||||||
//达梦 下不支持storageable2.BulkUpdateAsync 功能,注意使用
|
// 达梦:不支持storageable2.BulkUpdateAsync 功能
|
||||||
foreach (var dd in newDictDatas)
|
foreach (var dd in newDictDatas)
|
||||||
await db.Insertable(dd).ExecuteCommandAsync(stoppingToken);
|
await db.Insertable(dd).ExecuteCommandAsync(stoppingToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
await db.CommitTranAsync();
|
await db.CommitTranAsync();
|
||||||
}
|
}
|
||||||
catch (Exception error)
|
catch (Exception error)
|
||||||
{
|
{
|
||||||
await db.RollbackTranAsync();
|
await db.RollbackTranAsync();
|
||||||
Log.Error($"系统枚举转换字典操作错误:{error.Message}\n堆栈跟踪:{error.StackTrace}", error);
|
Log.Error($"系统枚举转换字典操作错误:{error.Message}\n堆栈跟踪:{error.StackTrace}", error);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
var originColor = Console.ForegroundColor;
|
var originColor = Console.ForegroundColor;
|
||||||
Console.ForegroundColor = ConsoleColor.Green;
|
Console.ForegroundColor = ConsoleColor.Green;
|
||||||
Console.WriteLine($"【{DateTime.Now}】系统枚举转换字典");
|
Console.WriteLine($"【{DateTime.Now}】系统枚举转换字典");
|
||||||
Console.ForegroundColor = originColor;
|
Console.ForegroundColor = originColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取需要新增的字典列表
|
/// 获取需要新增的字典列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="addEnumType"></param>
|
/// <param name="addEnumType"></param>
|
||||||
/// <returns>
|
/// <returns>
|
||||||
/// 一个元组,包含以下元素:
|
/// 一个元组,包含以下元素:
|
||||||
/// <list type="table">
|
/// <list type="table">
|
||||||
/// <item><term>SysDictTypes</term><description>字典类型列表</description></item>
|
/// <item><term>SysDictTypes</term><description>字典类型列表</description></item>
|
||||||
/// <item><term>SysDictDatas</term><description>字典数据列表</description></item>
|
/// <item><term>SysDictDatas</term><description>字典数据列表</description></item>
|
||||||
/// </list>
|
/// </list>
|
||||||
/// </returns>
|
/// </returns>
|
||||||
private (List<SysDictType>, List<SysDictData>) GetNewSysDicts(List<EnumTypeOutput> addEnumType)
|
private (List<SysDictType>, List<SysDictData>) GetNewSysDicts(List<EnumTypeOutput> addEnumType)
|
||||||
{
|
{
|
||||||
var newDictType = new List<SysDictType>();
|
var newDictType = new List<SysDictType>();
|
||||||
var newDictData = new List<SysDictData>();
|
var newDictData = new List<SysDictData>();
|
||||||
if (addEnumType.Count <= 0)
|
if (addEnumType.Count <= 0)
|
||||||
return (newDictType, newDictData);
|
return (newDictType, newDictData);
|
||||||
|
|
||||||
// 新增字典类型
|
// 新增字典类型
|
||||||
newDictType = addEnumType.Select(u => new SysDictType
|
newDictType = addEnumType.Select(u => new SysDictType
|
||||||
{
|
{
|
||||||
Id = YitIdHelper.NextId(),
|
Id = YitIdHelper.NextId(),
|
||||||
Code = u.TypeName,
|
Code = u.TypeName,
|
||||||
Name = u.TypeDescribe,
|
Name = u.TypeDescribe,
|
||||||
Remark = u.TypeRemark,
|
Remark = u.TypeRemark,
|
||||||
Status = StatusEnum.Enable
|
Status = StatusEnum.Enable
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
// 新增字典数据
|
// 新增字典数据
|
||||||
newDictData = addEnumType.Join(newDictType, t1 => t1.TypeName, t2 => t2.Code, (t1, t2) => new
|
newDictData = addEnumType.Join(newDictType, t1 => t1.TypeName, t2 => t2.Code, (t1, t2) => new
|
||||||
{
|
{
|
||||||
Data = t1.EnumEntities.Select(u => new SysDictData
|
Data = t1.EnumEntities.Select(u => new SysDictData
|
||||||
{
|
{
|
||||||
Id = YitIdHelper.NextId(),
|
Id = YitIdHelper.NextId(),
|
||||||
DictTypeId = t2.Id,
|
DictTypeId = t2.Id,
|
||||||
Name = u.Describe,
|
Name = u.Describe,
|
||||||
Value = u.Value.ToString(),
|
Value = u.Value.ToString(),
|
||||||
Code = u.Name,
|
Code = u.Name,
|
||||||
Remark = t2.Remark,
|
Remark = t2.Remark,
|
||||||
OrderNo = u.Value + OrderOffset,
|
OrderNo = u.Value + OrderOffset,
|
||||||
TagType = u.Theme != "" ? u.Theme : DefaultTagType,
|
TagType = u.Theme != "" ? u.Theme : DefaultTagType,
|
||||||
}).ToList()
|
}).ToList()
|
||||||
}).SelectMany(x => x.Data).ToList();
|
}).SelectMany(x => x.Data).ToList();
|
||||||
|
|
||||||
return (newDictType, newDictData);
|
return (newDictType, newDictData);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取需要更新的字典列表
|
/// 获取需要更新的字典列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="updatedEnumType"></param>
|
/// <param name="updatedEnumType"></param>
|
||||||
/// <param name="sysDictTypeDict"></param>
|
/// <param name="sysDictTypeDict"></param>
|
||||||
/// <returns>
|
/// <returns>
|
||||||
/// 一个元组,包含以下元素:
|
/// 一个元组,包含以下元素:
|
||||||
/// <list type="table">
|
/// <list type="table">
|
||||||
/// <item><term>SysDictTypes</term><description>更新字典类型列表</description>
|
/// <item><term>SysDictTypes</term><description>更新字典类型列表</description>
|
||||||
/// </item>
|
/// </item>
|
||||||
/// <item><term>SysDictDatas</term><description>更新字典数据列表</description>
|
/// <item><term>SysDictDatas</term><description>更新字典数据列表</description>
|
||||||
/// </item>
|
/// </item>
|
||||||
/// <item><term>SysDictDatas</term><description>新增字典数据列表</description>
|
/// <item><term>SysDictDatas</term><description>新增字典数据列表</description>
|
||||||
/// </item>
|
/// </item>
|
||||||
/// </list>
|
/// </list>
|
||||||
/// </returns>
|
/// </returns>
|
||||||
private (List<SysDictType>, List<SysDictData>, List<SysDictData>) GetUpdatedDicts(List<EnumTypeOutput> updatedEnumType, Dictionary<string, SysDictType> sysDictTypeDict)
|
private (List<SysDictType>, List<SysDictData>, List<SysDictData>) GetUpdatedDicts(List<EnumTypeOutput> updatedEnumType, Dictionary<string, SysDictType> sysDictTypeDict)
|
||||||
{
|
{
|
||||||
var updatedSysDictTypes = new List<SysDictType>();
|
var updatedSysDictTypes = new List<SysDictType>();
|
||||||
var updatedSysDictData = new List<SysDictData>();
|
var updatedSysDictData = new List<SysDictData>();
|
||||||
var newSysDictData = new List<SysDictData>();
|
var newSysDictData = new List<SysDictData>();
|
||||||
foreach (var e in updatedEnumType)
|
foreach (var e in updatedEnumType)
|
||||||
{
|
{
|
||||||
if (!sysDictTypeDict.TryGetValue(e.TypeName, out var value))
|
if (!sysDictTypeDict.TryGetValue(e.TypeName, out var value))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var updatedDictType = value;
|
var updatedDictType = value;
|
||||||
updatedDictType.Name = e.TypeDescribe;
|
updatedDictType.Name = e.TypeDescribe;
|
||||||
updatedDictType.Remark = e.TypeRemark;
|
updatedDictType.Remark = e.TypeRemark;
|
||||||
updatedSysDictTypes.Add(updatedDictType);
|
updatedSysDictTypes.Add(updatedDictType);
|
||||||
var updatedDictData = updatedDictType.Children.Where(u => u.DictTypeId == updatedDictType.Id).ToList();
|
var updatedDictData = updatedDictType.Children.Where(u => u.DictTypeId == updatedDictType.Id).ToList();
|
||||||
|
|
||||||
// 遍历需要更新的字典数据
|
// 遍历需要更新的字典数据
|
||||||
foreach (var dictData in updatedDictData)
|
foreach (var dictData in updatedDictData)
|
||||||
{
|
{
|
||||||
var enumData = e.EnumEntities.FirstOrDefault(u => dictData.Code == u.Name);
|
var enumData = e.EnumEntities.FirstOrDefault(u => dictData.Code == u.Name);
|
||||||
if (enumData != null)
|
if (enumData != null)
|
||||||
{
|
{
|
||||||
dictData.Value = enumData.Value.ToString();
|
dictData.Value = enumData.Value.ToString();
|
||||||
dictData.OrderNo = enumData.Value + OrderOffset;
|
dictData.OrderNo = enumData.Value + OrderOffset;
|
||||||
dictData.Name = enumData.Describe;
|
dictData.Name = enumData.Describe;
|
||||||
dictData.TagType = enumData.Theme != "" ? enumData.Theme : dictData.TagType != "" ? dictData.TagType : DefaultTagType;
|
dictData.TagType = enumData.Theme != "" ? enumData.Theme : dictData.TagType != "" ? dictData.TagType : DefaultTagType;
|
||||||
updatedSysDictData.Add(dictData);
|
updatedSysDictData.Add(dictData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增的枚举值名称列表
|
// 新增的枚举值名称列表
|
||||||
var newEnumDataNameList = e.EnumEntities.Select(u => u.Name).Except(updatedDictData.Select(u => u.Code));
|
var newEnumDataNameList = e.EnumEntities.Select(u => u.Name).Except(updatedDictData.Select(u => u.Code));
|
||||||
foreach (var newEnumDataName in newEnumDataNameList)
|
foreach (var newEnumDataName in newEnumDataNameList)
|
||||||
{
|
{
|
||||||
var enumData = e.EnumEntities.FirstOrDefault(u => newEnumDataName == u.Name);
|
var enumData = e.EnumEntities.FirstOrDefault(u => newEnumDataName == u.Name);
|
||||||
if (enumData != null)
|
if (enumData != null)
|
||||||
{
|
{
|
||||||
var dictData = new SysDictData
|
var dictData = new SysDictData
|
||||||
{
|
{
|
||||||
Id = YitIdHelper.NextId(),
|
Id = YitIdHelper.NextId(),
|
||||||
DictTypeId = updatedDictType.Id,
|
DictTypeId = updatedDictType.Id,
|
||||||
Name = enumData.Describe,
|
Name = enumData.Describe,
|
||||||
Value = enumData.Value.ToString(),
|
Value = enumData.Value.ToString(),
|
||||||
Code = enumData.Name,
|
Code = enumData.Name,
|
||||||
Remark = updatedDictType.Remark,
|
Remark = updatedDictType.Remark,
|
||||||
OrderNo = enumData.Value + OrderOffset,
|
OrderNo = enumData.Value + OrderOffset,
|
||||||
TagType = enumData.Theme != "" ? enumData.Theme : DefaultTagType,
|
TagType = enumData.Theme != "" ? enumData.Theme : DefaultTagType,
|
||||||
};
|
};
|
||||||
dictData.TagType = enumData.Theme != "" ? enumData.Theme : dictData.TagType != "" ? dictData.TagType : DefaultTagType;
|
dictData.TagType = enumData.Theme != "" ? enumData.Theme : dictData.TagType != "" ? dictData.TagType : DefaultTagType;
|
||||||
newSysDictData.Add(dictData);
|
newSysDictData.Add(dictData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除的情况暂不处理
|
// 删除的情况暂不处理
|
||||||
}
|
}
|
||||||
|
|
||||||
return (updatedSysDictTypes, updatedSysDictData, newSysDictData);
|
return (updatedSysDictTypes, updatedSysDictData, newSysDictData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -28,7 +28,7 @@ public class LoginInput
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 租户域名
|
/// 租户域名
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Required(ErrorMessage = "租户域名不能为空")]
|
//[Required(ErrorMessage = "租户域名不能为空")]
|
||||||
public string Host { get; set; }
|
public string Host { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -67,8 +67,8 @@ public class LoginPhoneInput
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 租户域名
|
/// 租户域名
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Required(ErrorMessage = "租户域名不能为空")]
|
//[Required(ErrorMessage = "租户域名不能为空")]
|
||||||
public string? Host { get; set; }
|
public string Host { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 登录模式
|
/// 登录模式
|
||||||
|
|||||||
@ -153,26 +153,24 @@ public class SysAuthService : IDynamicApiController, ITransient
|
|||||||
/// <param name="user"></param>
|
/// <param name="user"></param>
|
||||||
private void VerifyPassword(string password, string keyPasswordErrorTimes, int passwordErrorTimes, SysUser user)
|
private void VerifyPassword(string password, string keyPasswordErrorTimes, int passwordErrorTimes, SysUser user)
|
||||||
{
|
{
|
||||||
if (CryptogramUtil.CryptoType == CryptogramEnum.MD5.ToString())
|
// 国密SM2解密(前端密码传输SM2加密后的)
|
||||||
|
try
|
||||||
{
|
{
|
||||||
// 国密SM2解密(前端密码传输SM2加密后的)
|
password = CryptogramUtil.SM2Decrypt(password);
|
||||||
try
|
}
|
||||||
{
|
catch
|
||||||
password = CryptogramUtil.SM2Decrypt(password);
|
{
|
||||||
}
|
throw Oops.Oh(ErrorCodeEnum.D0010);
|
||||||
catch
|
|
||||||
{
|
|
||||||
throw Oops.Oh(ErrorCodeEnum.D0010);
|
|
||||||
}
|
|
||||||
if (user.Password.Equals(MD5Encryption.Encrypt(password))) return;
|
|
||||||
|
|
||||||
_sysCacheService.Set(keyPasswordErrorTimes, ++passwordErrorTimes, TimeSpan.FromMinutes(30));
|
|
||||||
throw Oops.Oh(ErrorCodeEnum.D1000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 国密SM2解密(前端密码传输SM2加密后的)
|
if (CryptogramUtil.CryptoType == CryptogramEnum.MD5.ToString())
|
||||||
password = CryptogramUtil.SM2Decrypt(password);
|
{
|
||||||
if (CryptogramUtil.Decrypt(user.Password).Equals(password)) return;
|
if (user.Password.Equals(MD5Encryption.Encrypt(password))) return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (CryptogramUtil.Decrypt(user.Password).Equals(password)) return;
|
||||||
|
}
|
||||||
|
|
||||||
_sysCacheService.Set(keyPasswordErrorTimes, ++passwordErrorTimes, TimeSpan.FromMinutes(30));
|
_sysCacheService.Set(keyPasswordErrorTimes, ++passwordErrorTimes, TimeSpan.FromMinutes(30));
|
||||||
throw Oops.Oh(ErrorCodeEnum.D1000);
|
throw Oops.Oh(ErrorCodeEnum.D1000);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -68,6 +68,7 @@ public static class CodeGenUtil
|
|||||||
{
|
{
|
||||||
return ConvertDataType_OracleSQL(dataType, length, scale); //达梦兼容Oracle,目前先这样实现
|
return ConvertDataType_OracleSQL(dataType, length, scale); //达梦兼容Oracle,目前先这样实现
|
||||||
}
|
}
|
||||||
|
|
||||||
// OracleSQL数据类型对应的字段类型
|
// OracleSQL数据类型对应的字段类型
|
||||||
public static string ConvertDataType_OracleSQL(string dataType, int? length, int? scale)
|
public static string ConvertDataType_OracleSQL(string dataType, int? length, int? scale)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user