v3.4.6
This commit is contained in:
@@ -28,6 +28,17 @@ public class KeyVariable
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 多租户模式.
|
||||
/// </summary>
|
||||
public static string MultiTenancyType
|
||||
{
|
||||
get
|
||||
{
|
||||
return _tenant.MultiTenancyType;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 系统文件路径.
|
||||
/// </summary>
|
||||
|
||||
@@ -42,4 +42,9 @@ public class ClaimConst
|
||||
/// 单一登录方式(1:后登录踢出先登录 2:同时登录).
|
||||
/// </summary>
|
||||
public const string SINGLELOGIN = "SingleLogin";
|
||||
|
||||
/// <summary>
|
||||
/// 单点登录标识.
|
||||
/// </summary>
|
||||
public const string OnlineTicket = "OnlineTicket";
|
||||
}
|
||||
@@ -17,7 +17,7 @@ public class CommonConst
|
||||
ContractResolver = new DefaultContractResolver(),
|
||||
|
||||
// 设置时区为 UTC
|
||||
DateTimeZoneHandling = DateTimeZoneHandling.Utc,
|
||||
DateTimeZoneHandling = DateTimeZoneHandling.Local,
|
||||
|
||||
// 格式化json输出的日期格式
|
||||
DateFormatString = "yyyy-MM-dd HH:mm:ss",
|
||||
@@ -41,7 +41,7 @@ public class CommonConst
|
||||
/// <summary>
|
||||
/// 用户缓存.
|
||||
/// </summary>
|
||||
public const string CACHEKEYUSER = "user_";
|
||||
public const string CACHEKEYUSER = "jnpf:permission:user";
|
||||
|
||||
/// <summary>
|
||||
/// 菜单缓存.
|
||||
@@ -102,4 +102,19 @@ public class CommonConst
|
||||
/// 第三方登录 票据缓存key.
|
||||
/// </summary>
|
||||
public const string PARAMS_JNPF_TICKET = "jnpf_ticket";
|
||||
|
||||
/// <summary>
|
||||
/// Cas Key.
|
||||
/// </summary>
|
||||
public const string CAS_Ticket = "ticket";
|
||||
|
||||
/// <summary>
|
||||
/// Code.
|
||||
/// </summary>
|
||||
public const string Code = "code";
|
||||
|
||||
/// <summary>
|
||||
/// 外链密码开关(1:开 , 0:关).
|
||||
/// </summary>
|
||||
public const int OnlineDevData_State_Enable = 1;
|
||||
}
|
||||
@@ -52,7 +52,7 @@ public abstract class CDEntityBase : EntityBase<string>, ICreatorTime, IDeleteTi
|
||||
/// </summary>
|
||||
public virtual void Creator()
|
||||
{
|
||||
var userId = App.User.FindFirst(ClaimConst.CLAINMUSERID)?.Value;
|
||||
var userId = App.User?.FindFirst(ClaimConst.CLAINMUSERID)?.Value;
|
||||
this.CreatorTime = DateTime.Now;
|
||||
this.Id = SnowflakeIdHelper.NextId();
|
||||
this.EnabledMark = this.EnabledMark == null ? 1 : this.EnabledMark;
|
||||
@@ -67,7 +67,7 @@ public abstract class CDEntityBase : EntityBase<string>, ICreatorTime, IDeleteTi
|
||||
/// </summary>
|
||||
public virtual void Create()
|
||||
{
|
||||
var userId = App.User.FindFirst(ClaimConst.CLAINMUSERID)?.Value;
|
||||
var userId = App.User?.FindFirst(ClaimConst.CLAINMUSERID)?.Value;
|
||||
this.CreatorTime = DateTime.Now;
|
||||
this.Id = this.Id == null ? SnowflakeIdHelper.NextId() : this.Id;
|
||||
this.EnabledMark = this.EnabledMark == null ? 1 : this.EnabledMark;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using JNPF.Common.Const;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.Extras.DatabaseAccessor.SqlSugar.Models;
|
||||
using SqlSugar;
|
||||
|
||||
namespace JNPF.Common.Contracts;
|
||||
@@ -28,7 +29,7 @@ public abstract class CEntityBase : EntityBase<string>, ICreatorTime
|
||||
/// </summary>
|
||||
public virtual void Creator()
|
||||
{
|
||||
var userId = App.User.FindFirst(ClaimConst.CLAINMUSERID)?.Value;
|
||||
var userId = App.User?.FindFirst(ClaimConst.CLAINMUSERID)?.Value;
|
||||
this.CreatorTime = DateTime.Now;
|
||||
this.Id = SnowflakeIdHelper.NextId();
|
||||
if (!string.IsNullOrEmpty(userId))
|
||||
|
||||
@@ -64,7 +64,7 @@ public abstract class CLDEntityBase : EntityBase<string>, ICreatorTime, IDeleteT
|
||||
/// </summary>
|
||||
public virtual void Creator()
|
||||
{
|
||||
var userId = App.User.FindFirst(ClaimConst.CLAINMUSERID)?.Value;
|
||||
var userId = App.User?.FindFirst(ClaimConst.CLAINMUSERID)?.Value;
|
||||
this.CreatorTime = DateTime.Now;
|
||||
this.Id = SnowflakeIdHelper.NextId();
|
||||
this.EnabledMark = this.EnabledMark == null ? 1 : this.EnabledMark;
|
||||
|
||||
@@ -40,7 +40,7 @@ public class CLEntityBase : EntityBase<string>, ICreatorTime
|
||||
/// </summary>
|
||||
public virtual void Creator()
|
||||
{
|
||||
var userId = App.User.FindFirst(ClaimConst.CLAINMUSERID)?.Value;
|
||||
var userId = App.User?.FindFirst(ClaimConst.CLAINMUSERID)?.Value;
|
||||
this.CreatorTime = DateTime.Now;
|
||||
this.Id = SnowflakeIdHelper.NextId();
|
||||
if (!string.IsNullOrEmpty(userId))
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.Extras.DatabaseAccessor.SqlSugar.Models;
|
||||
using SqlSugar;
|
||||
|
||||
namespace JNPF.Common.Contracts;
|
||||
@@ -7,7 +8,7 @@ namespace JNPF.Common.Contracts;
|
||||
/// 实体类基类.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public abstract class EntityBase<TKey> : IEntity<TKey>
|
||||
public abstract class EntityBase<TKey> : ITenantFilter, IEntity<TKey>
|
||||
where TKey : IEquatable<TKey>
|
||||
{
|
||||
/// <summary>
|
||||
@@ -15,4 +16,10 @@ public abstract class EntityBase<TKey> : IEntity<TKey>
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "F_Id", ColumnDescription = "主键", IsPrimaryKey = true)]
|
||||
public TKey Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置 租户id.
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "F_TenantId", ColumnDescription = "租户id")]
|
||||
public string TenantId { get; set; }
|
||||
}
|
||||
@@ -670,6 +670,11 @@ public enum ErrorCode
|
||||
[ErrorCodeItemMetadata("第三方登录未配置!")]
|
||||
D5025,
|
||||
|
||||
/// <summary>
|
||||
/// 修改失败,新建密码不能与旧密码一样.
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("修改失败,新建密码不能与旧密码一样")]
|
||||
D5026,
|
||||
#endregion
|
||||
|
||||
#region 岗位 6
|
||||
@@ -968,6 +973,11 @@ public enum ErrorCode
|
||||
[ErrorCodeItemMetadata("验证码限定范围:3 - 6位")]
|
||||
D9009,
|
||||
|
||||
/// <summary>
|
||||
/// 打印模板不存在.
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("打印模板不存在")]
|
||||
D9010,
|
||||
#endregion
|
||||
|
||||
#region 单据规则 10
|
||||
@@ -1107,12 +1117,28 @@ public enum ErrorCode
|
||||
D1417,
|
||||
|
||||
/// <summary>
|
||||
/// 该功能不存在,可能已被删除.
|
||||
/// 密码错误.
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("该功能( id: {0} )不存在,可能已被删除")]
|
||||
[ErrorCodeItemMetadata("密码错误")]
|
||||
D1418,
|
||||
|
||||
/// <summary>
|
||||
/// 缺少租户信息.
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("缺少租户信息")]
|
||||
D1419,
|
||||
|
||||
/// <summary>
|
||||
/// 无效链接.
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("无效链接")]
|
||||
D1420,
|
||||
|
||||
/// <summary>
|
||||
/// 发布失败,流程未设计.
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("发布失败,流程未设计")]
|
||||
D1421,
|
||||
#endregion
|
||||
|
||||
#region 数据建模 15
|
||||
@@ -1201,6 +1227,18 @@ public enum ErrorCode
|
||||
[ErrorCodeItemMetadata("Sql不能为空")]
|
||||
D1513,
|
||||
|
||||
/// <summary>
|
||||
/// 表名超过规定长度.
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("表名超过规定长度")]
|
||||
D1514,
|
||||
|
||||
/// <summary>
|
||||
/// 列名超过规定长度.
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("列名超过规定长度")]
|
||||
D1515,
|
||||
|
||||
#endregion
|
||||
|
||||
#region 角色 16
|
||||
@@ -1425,9 +1463,9 @@ public enum ErrorCode
|
||||
D2104,
|
||||
|
||||
/// <summary>
|
||||
/// 表缺失流程Id.
|
||||
/// 表缺失流程Id字段.
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("表缺失流程Id")]
|
||||
[ErrorCodeItemMetadata("表缺失流程Id字段:F_FLowId")]
|
||||
D2105,
|
||||
|
||||
/// <summary>
|
||||
@@ -1454,6 +1492,12 @@ public enum ErrorCode
|
||||
[ErrorCodeItemMetadata("模板主键策略与表主键策略不同")]
|
||||
D2109,
|
||||
|
||||
/// <summary>
|
||||
/// 表缺失逻辑删除字段.
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("表缺失逻辑删除字段:F_DeleteMark")]
|
||||
D2110,
|
||||
|
||||
#endregion
|
||||
|
||||
#region 大屏 22
|
||||
@@ -1772,11 +1816,46 @@ public enum ErrorCode
|
||||
WF0045,
|
||||
|
||||
/// <summary>
|
||||
/// 退回至您的审批,不能再撤回审批.
|
||||
/// 此流程已被挂起,无法操作!.
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("退回至您的审批,不能再撤回审批!")]
|
||||
[ErrorCodeItemMetadata("流程处于挂起状态,不可操作!")]
|
||||
WF0046,
|
||||
|
||||
/// <summary>
|
||||
/// {0}流程已被挂起,无法操作!.
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("{0}流程已被挂起不能删除!")]
|
||||
WF0047,
|
||||
|
||||
/// <summary>
|
||||
/// 退回至您的审批,不能再撤回审批.
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("退回至您的审批,不能再撤回审批!")]
|
||||
WF0048,
|
||||
|
||||
/// <summary>
|
||||
/// 您没有该流程的发起权限.
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("您没有该流程的发起权限")]
|
||||
WF0049,
|
||||
|
||||
/// <summary>
|
||||
/// 下一节点已审批,不能撤回!
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("下一节点已审批,不能撤回!")]
|
||||
WF0050,
|
||||
|
||||
/// <summary>
|
||||
/// 流程已撤回,不能重复操作!.
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("流程已撤回,不能重复操作!")]
|
||||
WF0051,
|
||||
|
||||
/// <summary>
|
||||
/// 该流程由在线开发生成的,无法直接删除,请在功能设计中删除相关功能!.
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("该流程由在线开发生成的,无法直接删除,请在功能设计中删除相关功能!")]
|
||||
WF0052,
|
||||
#endregion
|
||||
|
||||
#region 扩展 Ex
|
||||
@@ -2018,9 +2097,9 @@ public enum ErrorCode
|
||||
COM1015,
|
||||
|
||||
/// <summary>
|
||||
/// 未找到流程引擎.
|
||||
/// 流程未设计,请先设计流程.
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("未找到流程引擎")]
|
||||
[ErrorCodeItemMetadata("流程未设计,请先设计流程")]
|
||||
COM1016,
|
||||
|
||||
/// <summary>
|
||||
@@ -2028,5 +2107,23 @@ public enum ErrorCode
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("该功能配置的流程处于停用状态")]
|
||||
COM1017,
|
||||
|
||||
/// <summary>
|
||||
/// 该功能配置的流程处于停用状态.
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("接口请求失败")]
|
||||
COM1018,
|
||||
|
||||
/// <summary>
|
||||
/// 该功能未导入流程表单!.
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("该功能未导入流程表单!")]
|
||||
COM1019,
|
||||
|
||||
/// <summary>
|
||||
/// 接口数据异常!.
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("接口数据异常!")]
|
||||
COM1020,
|
||||
#endregion
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.Common.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// 工艺路线类型
|
||||
/// </summary>
|
||||
public enum RouteType
|
||||
{
|
||||
/// <summary>
|
||||
/// 标准途程
|
||||
/// </summary>
|
||||
[Description("标准途程")]
|
||||
Standard=1,
|
||||
/// <summary>
|
||||
/// 返工途程
|
||||
/// </summary>
|
||||
[Description("返工途程")]
|
||||
Rework=2,
|
||||
/// <summary>
|
||||
/// 试制途程
|
||||
/// </summary>
|
||||
[Description("试制途程")]
|
||||
Trial=4,
|
||||
/// <summary>
|
||||
/// 返修途程
|
||||
/// </summary>
|
||||
[Description("返修途程")]
|
||||
RMA =8,
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ public static class BooleanExtensions
|
||||
/// </summary>
|
||||
private static bool? GetBool(this object data)
|
||||
{
|
||||
switch (data.ToString()?.Trim().ToLower())
|
||||
switch (data.ToString().Trim().ToLower())
|
||||
{
|
||||
case "0":
|
||||
return false;
|
||||
|
||||
@@ -16,7 +16,7 @@ public static class DictionaryExtensions
|
||||
/// <param name="dictionary">要操作的字典.</param>
|
||||
/// <param name="key">指定键名.</param>
|
||||
/// <returns>获取到的值.</returns>
|
||||
public static TValue? GetOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key)
|
||||
public static TValue GetOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key)
|
||||
{
|
||||
return dictionary.TryGetValue(key, out TValue value) ? value : default(TValue);
|
||||
}
|
||||
|
||||
@@ -693,4 +693,25 @@ public static partial class Extensions
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region List
|
||||
|
||||
/// <summary>
|
||||
/// 嵌套List解析
|
||||
/// 仅限于列表查询条件多选.
|
||||
/// </summary>
|
||||
/// <param name="list"></param>
|
||||
/// <returns></returns>
|
||||
public static List<string> ParseToNestedList(this List<List<string>> list)
|
||||
{
|
||||
List<string> result = new List<string>();
|
||||
if (list != null && list.Count > 0)
|
||||
{
|
||||
foreach (var item in list)
|
||||
result.Add(item.Last());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -67,7 +67,7 @@ public static class RandomExtensions
|
||||
public static T NextItem<T>(this Random random, T[] items)
|
||||
{
|
||||
if (items == null || items.Length == 0)
|
||||
return default(T)!;
|
||||
return default(T);
|
||||
|
||||
return items[random.Next(items.Length)];
|
||||
}
|
||||
|
||||
@@ -354,7 +354,7 @@ public static class StringExtensions
|
||||
/// 指示指定的字符串是 null、空或者仅由空白字符组成.
|
||||
/// </summary>
|
||||
[DebuggerStepThrough]
|
||||
public static bool IsNullOrWhiteSpace(this string value)
|
||||
public static bool IsNullOrWhiteSpace(this string? value)
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(value);
|
||||
}
|
||||
|
||||
@@ -41,4 +41,20 @@ public class CodeGenAuthorizeModuleResource
|
||||
/// 权限条件.
|
||||
/// </summary>
|
||||
public List<object> conditionalModel { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 代码生成 数据过滤.
|
||||
/// </summary>
|
||||
public class CodeGenDataRuleModuleResourceModel : CodeGenAuthorizeModuleResourceModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 请求类型 pc 和 app.
|
||||
/// </summary>
|
||||
public string UserOrigin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 权限条件 json.
|
||||
/// </summary>
|
||||
public string conditionalModelJson { get; set; }
|
||||
}
|
||||
@@ -86,4 +86,19 @@ public class ChunkModel
|
||||
/// 文件.
|
||||
/// </summary>
|
||||
public IFormFile file { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 路径类型 defaultPath(默认路径) selfPath(自定义路径).
|
||||
/// </summary>
|
||||
public string pathType { get; set; } = "defaultPath";
|
||||
|
||||
/// <summary>
|
||||
/// 是否用户存储(0否1是).
|
||||
/// </summary>
|
||||
public string isAccount { get; set; } = "0";
|
||||
|
||||
/// <summary>
|
||||
/// 自定义文件夹路径.
|
||||
/// </summary>
|
||||
public string folder { get; set; }
|
||||
}
|
||||
|
||||
@@ -32,4 +32,9 @@ public class FileControlsModel
|
||||
/// 文件后缀.
|
||||
/// </summary>
|
||||
public string? fileExtension { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 文件名称.
|
||||
/// </summary>
|
||||
public string? fileName { get; set; }
|
||||
}
|
||||
@@ -6,7 +6,8 @@ namespace JNPF.Common.Models.NPOI;
|
||||
/// <summary>
|
||||
/// Excel导出列名
|
||||
/// 版 本:V3.0.0
|
||||
/// 版 权:拓通智联科技有限公司(http://www.tuotong-tech.com)
|
||||
/// 版 权:引迈信息技术有限公司(https://www.jnpfsoft.com)
|
||||
/// 作 者:JNPF开发平台组
|
||||
/// 日 期:2017.03.09.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
|
||||
@@ -6,7 +6,8 @@ namespace JNPF.Common.Models.NPOI;
|
||||
/// <summary>
|
||||
/// Excel导出配置
|
||||
/// 版 本:V3.0.0
|
||||
/// 版 权:拓通智联科技有限公司(http://www.tuotong-tech.com)
|
||||
/// 版 权:引迈信息技术有限公司(https://www.jnpfsoft.com)
|
||||
/// 作 者:JNPF开发平台组
|
||||
/// 日 期:2017.03.09.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
|
||||
@@ -5,7 +5,8 @@ namespace JNPF.Common.Models.NPOI;
|
||||
/// <summary>
|
||||
/// Excel导出模板
|
||||
/// 版 本:V3.0.0
|
||||
/// 版 权:拓通智联科技有限公司(http://www.tuotong-tech.com)
|
||||
/// 版 权:引迈信息技术有限公司(https://www.jnpfsoft.com)
|
||||
/// 作 者:JNPF开发平台组
|
||||
/// 日 期:2017.03.09.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace JNPF.Common.Models.User
|
||||
/// <summary>
|
||||
/// 登录者信息
|
||||
/// 版 本:V3.2.0
|
||||
/// 版 权:拓通智联科技有限公司(http://www.tuotong-tech.com)
|
||||
/// 版 权:引迈信息技术有限公司(https://www.jnpfsoft.com)
|
||||
/// 作 者:JNPF开发平台组.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
@@ -51,6 +51,11 @@ namespace JNPF.Common.Models.User
|
||||
/// </summary>
|
||||
public string organizeId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属组织 Id 树.
|
||||
/// </summary>
|
||||
public List<string> organizeIdList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 组织名称.
|
||||
/// </summary>
|
||||
@@ -225,6 +230,11 @@ namespace JNPF.Common.Models.User
|
||||
/// </summary>
|
||||
public string signImg { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 默认签名.
|
||||
/// </summary>
|
||||
public DateTime? changePasswordDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 系统集合.
|
||||
/// </summary>
|
||||
|
||||
@@ -53,6 +53,11 @@ public class UserOnlineModel
|
||||
/// </summary>
|
||||
public string token { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单点登录标识.
|
||||
/// </summary>
|
||||
public string onlineTicket { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否移动端.
|
||||
/// </summary>
|
||||
|
||||
@@ -46,5 +46,10 @@
|
||||
/// 流程类型.
|
||||
/// </summary>
|
||||
public int? type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属流程名称.
|
||||
/// </summary>
|
||||
public string? flowName { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
103
common/Tnb.Common/Options/OauthOptions.cs
Normal file
103
common/Tnb.Common/Options/OauthOptions.cs
Normal file
@@ -0,0 +1,103 @@
|
||||
using Aspose.Cells;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.ConfigurableOptions;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
|
||||
namespace JNPF.Common.Options;
|
||||
|
||||
/// <summary>
|
||||
/// 单点登录配置.
|
||||
/// </summary>
|
||||
public sealed class OauthOptions : IConfigurableOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// 是否启用.
|
||||
/// </summary>
|
||||
public bool Enabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 前端登录页面访问登录接口进行单点登录页面跳转, 需要与身份管理系统中的 JNPF-Auth2、JNPF-CAS中的认证地址一致.
|
||||
/// </summary>
|
||||
public string LoginPath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 从单点登录中心直接访问JNPF时登录成功后跳转的前端页面.
|
||||
/// </summary>
|
||||
public string SucessFrontUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 默认接口.
|
||||
/// </summary>
|
||||
public string DefaultSSO { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 缓存过期时间 / 分钟.
|
||||
/// </summary>
|
||||
public int TicketTimeout { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否前端输出消息.
|
||||
/// </summary>
|
||||
public bool TicketOutMessage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登录模式.
|
||||
/// </summary>
|
||||
public SSO SSO { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户推送.
|
||||
/// </summary>
|
||||
public Pull Pull { get; set; }
|
||||
}
|
||||
|
||||
public class SSO
|
||||
{
|
||||
public Auth2 Auth2 { get; set; }
|
||||
|
||||
public Cas Cas { get; set; }
|
||||
}
|
||||
|
||||
public class Auth2
|
||||
{
|
||||
public bool Enabled { get; set; }
|
||||
|
||||
public string ClientId { get; set; }
|
||||
|
||||
public string ClientSecret { get; set; }
|
||||
|
||||
public string AuthorizeUrl { get; set; }
|
||||
|
||||
public string AccessTokenUrl { get; set; }
|
||||
|
||||
public string UserInfoUrl { get; set; }
|
||||
}
|
||||
|
||||
public class Cas
|
||||
{
|
||||
public bool Enabled { get; set; }
|
||||
|
||||
public string ServerLoginUrl { get; set; }
|
||||
|
||||
public string ServerValidateUrl { get; set; }
|
||||
}
|
||||
|
||||
public class Pull
|
||||
{
|
||||
public bool Enabled { get; set; }
|
||||
|
||||
public string CreateRestAddress { get; set; }
|
||||
|
||||
public string ReplaceRestAddress { get; set; }
|
||||
|
||||
public string ChangePasswordRestAddress { get; set; }
|
||||
|
||||
public string DeleteRestAddress { get; set; }
|
||||
|
||||
public string CredentialType { get; set; }
|
||||
|
||||
public string UserName { get; set; }
|
||||
|
||||
public string Password { get; set; }
|
||||
|
||||
}
|
||||
@@ -54,7 +54,7 @@ public static class CodeGenExportDataHelper
|
||||
|
||||
var len = rowChildDatas.Select(x => x.Value.Count()).OrderByDescending(x => x).FirstOrDefault();
|
||||
|
||||
if (len > 0)
|
||||
if (len != null && len > 0)
|
||||
{
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
|
||||
@@ -160,6 +160,79 @@ public static class CodeGenHelper
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 数据列表生成树形表格.
|
||||
/// </summary>
|
||||
/// <param name="realList">数据列表.</param>
|
||||
/// <param name="parentField">树形父级字段.</param>
|
||||
/// <param name="treeShowField">树形显示字段.</param>
|
||||
/// <returns></returns>
|
||||
public static List<Dictionary<string, object>> GetTreeList(List<Dictionary<string, object>> realList, string parentField, string treeShowField)
|
||||
{
|
||||
var res = new List<Dictionary<string, object>>();
|
||||
if (realList.Any())
|
||||
{
|
||||
var parentFieldId = SnowflakeIdHelper.NextId();
|
||||
|
||||
foreach (var item in realList)
|
||||
{
|
||||
if (realList.Any(x => x["id"].Equals(item[parentField]))) item[parentFieldId] = item[parentField];
|
||||
else item[parentFieldId] = null;
|
||||
item[parentField] = realList.Find(x => x["id"] == item["id"])[treeShowField];
|
||||
}
|
||||
var parentFieldRep = parentField.Substring(0, parentField.Length - 4);
|
||||
for (int i = 0; i < realList.Count; i++)
|
||||
{
|
||||
if (realList[i][parentFieldId].IsNullOrEmpty())
|
||||
{
|
||||
if (realList[i][parentFieldRep] == null) realList[i][parentFieldRep] = realList[i][treeShowField];
|
||||
var childList = realList.Where(x => x[parentFieldId] != null && x[parentFieldId].Equals(realList[i]["id"])).ToList();
|
||||
if (childList.Any()) GetTreeList(realList, realList[i], parentFieldId);
|
||||
res.Add(realList[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
private static void GetTreeList(List<Dictionary<string, object>> allList, Dictionary<string, object> currentItem, string pId)
|
||||
{
|
||||
var childList = allList.Where(x => x[pId] != null && x[pId].Equals(currentItem["id"])).ToList();
|
||||
if (childList.Any()) childList.ForEach(x => GetTreeList(allList, x, pId));
|
||||
if (childList.Any())
|
||||
{
|
||||
var item = allList.Find(x => x["id"].Equals(currentItem["id"]));
|
||||
item["children"] = childList;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据集合捞取所有子集id.
|
||||
/// </summary>
|
||||
/// <param name="allList">key : 主键Id , value : 父亲Id.</param>
|
||||
/// <param name="currentId">当前id.</param>
|
||||
/// <param name="resList">res.</param>
|
||||
public static List<string> GetChildIdList(Dictionary<string, string> allList, string currentId, List<string> resList)
|
||||
{
|
||||
if (resList == null) resList = new List<string>() { currentId };
|
||||
else resList.Add(currentId);
|
||||
if (allList.Any())
|
||||
{
|
||||
var cItemList = allList.Where(x => x.Value.IsNotEmptyOrNull() && x.Value.Equals(currentId)).ToList();
|
||||
if (cItemList.Any())
|
||||
{
|
||||
foreach (var item in cItemList)
|
||||
{
|
||||
var cIdList = GetChildIdList(allList, item.Key, resList);
|
||||
resList.Add(item.Key);
|
||||
if (cIdList.Any()) resList.AddRange(cIdList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return resList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取排序真实字段.
|
||||
/// </summary>
|
||||
@@ -190,7 +263,7 @@ public static class CodeGenHelper
|
||||
field = entityInfo.Columns.Find(it => it.PropertyName.Equals(sort.ToUpperCase()))?.DbColumnName;
|
||||
break;
|
||||
}
|
||||
return string.IsNullOrEmpty(field) ? "" : field;
|
||||
return string.IsNullOrEmpty(field) ? null : field;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System.Drawing;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using JNPF.Common.Helper;
|
||||
using JNPF.Common.Models.NPOI;
|
||||
using JNPF.DependencyInjection;
|
||||
using NPOI.HPSF;
|
||||
@@ -9,8 +8,6 @@ using NPOI.HSSF.UserModel;
|
||||
using NPOI.SS.UserModel;
|
||||
using NPOI.SS.Util;
|
||||
using NPOI.XSSF.UserModel;
|
||||
using Spire.Doc;
|
||||
using static Microsoft.AspNetCore.Razor.Language.TagHelperMetadata;
|
||||
|
||||
namespace JNPF.Common.Security;
|
||||
|
||||
|
||||
@@ -49,6 +49,17 @@ public static class JsonHelper
|
||||
return _jsonSerializer.Deserialize<T>(json);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// JSON 字符串转 Object.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">动态类型.</typeparam>
|
||||
/// <param name="json">对象.</param>
|
||||
/// <returns></returns>
|
||||
public static T ToObjectOld<T>(this string json)
|
||||
{
|
||||
return _ = JsonConvert.DeserializeObject<T>(json) ?? default(T);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// JSON 字符串转 Object.
|
||||
/// </summary>
|
||||
|
||||
@@ -28,7 +28,9 @@ public static class NetHelper
|
||||
string result = string.Empty;
|
||||
if (App.HttpContext != null)
|
||||
result = GetWebClientIp();
|
||||
return result.Equals("::1") ? "127.0.0.1" : result;
|
||||
result = result.Equals("::1") ? "127.0.0.1" : result;
|
||||
result = result.Replace(":", string.Empty).Replace("ffff", string.Empty);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -4,11 +4,11 @@ namespace JNPF.Common.Security;
|
||||
|
||||
public static class XmlHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 反序列化
|
||||
/// </summary>
|
||||
/// <param name="type">类型</param>
|
||||
/// <param name="xml">XML字符串</param>
|
||||
/// <summary>
|
||||
/// 反序列化.
|
||||
/// </summary>
|
||||
/// <param name="type">类型.</param>
|
||||
/// <param name="xml">XML字符串.</param>
|
||||
/// <returns></returns>
|
||||
public static object Deserialize(Type type, string xml)
|
||||
{
|
||||
@@ -19,13 +19,12 @@ public static class XmlHelper
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 反序列化
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="xml"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
/// <summary>
|
||||
/// 反序列化.
|
||||
/// </summary>
|
||||
/// <param name="type">类型.</param>
|
||||
/// <param name="stream">XML流.</param>
|
||||
/// <returns></returns>
|
||||
public static object Deserialize(Type type, Stream stream)
|
||||
{
|
||||
XmlSerializer xmldes = new XmlSerializer(type);
|
||||
|
||||
Reference in New Issue
Block a user