合并
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using JNPF.Common.Configuration;
|
||||
using System.Text.RegularExpressions;
|
||||
using JNPF.Common.Configuration;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.EventBus;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using SqlSugar;
|
||||
|
||||
namespace JNPF.EventHandler;
|
||||
@@ -42,7 +44,18 @@ public class LogEventSubscriber : IEventSubscriber, ISingleton
|
||||
_sqlSugarClient.ChangeDatabase(log.ConnectionConfig.ConfigId);
|
||||
}
|
||||
|
||||
await _sqlSugarClient.CopyNew().Insertable(log.Entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandAsync();
|
||||
string pattern = @"^[0-9]*$";
|
||||
var db = _sqlSugarClient.CopyNew();
|
||||
if (!string.IsNullOrEmpty(log.Entity.ModuleId) && new Regex(pattern).IsMatch(log.Entity.ModuleId))
|
||||
{
|
||||
var module = await db.Queryable<VisualDevEntity>().Where(x => x.Id == log.Entity.ModuleId).FirstAsync();
|
||||
if (module != null)
|
||||
{
|
||||
log.Entity.ModuleName = module.FullName;
|
||||
}
|
||||
}
|
||||
|
||||
await db.Insertable(log.Entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -107,7 +107,77 @@ public class RequestActionFilter : IAsyncActionFilter
|
||||
ModuleName = module.ModuleName,
|
||||
Json = string.Format("{0}应用【{1}】【{2}】", module.Action, args, result?.ToJsonString())
|
||||
}));
|
||||
}else if (actionName == "JNPF.VisualDev.VisualDevModelDataService.Create")
|
||||
{
|
||||
var args = context.ActionArguments.ToJsonString();
|
||||
var result = (actionContext.Result as JsonResult)?.Value;
|
||||
|
||||
string moduleId = httpRequest.Path.Value.Substring(httpRequest.Path.Value.LastIndexOf("/")+1);
|
||||
|
||||
await _eventPublisher.PublishAsync(new LogEventSource("Log:CreateOpLog", options, new SysLogEntity
|
||||
{
|
||||
Id = SnowflakeIdHelper.NextId(),
|
||||
UserId = userId,
|
||||
UserName = userName,
|
||||
Category = 3,
|
||||
IPAddress = NetHelper.Ip,
|
||||
RequestURL = httpRequest.Path,
|
||||
RequestDuration = (int)sw.ElapsedMilliseconds,
|
||||
RequestMethod = "新增",
|
||||
PlatForm = string.Format("{0}-{1}", userAgent.OS.ToString(), userAgent.RawValue),
|
||||
CreatorTime = DateTime.Now,
|
||||
ModuleName = moduleId,
|
||||
ModuleId = moduleId,
|
||||
Json = string.Format("{0}应用【{1}】【{2}】", "新增", args, result?.ToJsonString())
|
||||
}));
|
||||
}else if (actionName == "JNPF.VisualDev.VisualDevModelDataService.Update")
|
||||
{
|
||||
var args = context.ActionArguments.ToJsonString();
|
||||
var result = (actionContext.Result as JsonResult)?.Value;
|
||||
string[] arr = httpRequest.Path.Value.Split("/");
|
||||
string moduleId = arr[arr.Length - 2];
|
||||
|
||||
await _eventPublisher.PublishAsync(new LogEventSource("Log:CreateOpLog", options, new SysLogEntity
|
||||
{
|
||||
Id = SnowflakeIdHelper.NextId(),
|
||||
UserId = userId,
|
||||
UserName = userName,
|
||||
Category = 3,
|
||||
IPAddress = NetHelper.Ip,
|
||||
RequestURL = httpRequest.Path,
|
||||
RequestDuration = (int)sw.ElapsedMilliseconds,
|
||||
RequestMethod = "编辑",
|
||||
PlatForm = string.Format("{0}-{1}", userAgent.OS.ToString(), userAgent.RawValue),
|
||||
CreatorTime = DateTime.Now,
|
||||
ModuleName = moduleId,
|
||||
ModuleId = moduleId,
|
||||
Json = string.Format("{0}应用【{1}】【{2}】", "编辑", args, result?.ToJsonString())
|
||||
}));
|
||||
}else if (actionName == "JNPF.VisualDev.VisualDevModelDataService.Delete")
|
||||
{
|
||||
var args = context.ActionArguments.ToJsonString();
|
||||
var result = (actionContext.Result as JsonResult)?.Value;
|
||||
string[] arr = httpRequest.Path.Value.Split("/");
|
||||
string moduleId = arr[arr.Length - 2];
|
||||
|
||||
await _eventPublisher.PublishAsync(new LogEventSource("Log:CreateOpLog", options, new SysLogEntity
|
||||
{
|
||||
Id = SnowflakeIdHelper.NextId(),
|
||||
UserId = userId,
|
||||
UserName = userName,
|
||||
Category = 3,
|
||||
IPAddress = NetHelper.Ip,
|
||||
RequestURL = httpRequest.Path,
|
||||
RequestDuration = (int)sw.ElapsedMilliseconds,
|
||||
RequestMethod = "删除",
|
||||
PlatForm = string.Format("{0}-{1}", userAgent.OS.ToString(), userAgent.RawValue),
|
||||
CreatorTime = DateTime.Now,
|
||||
ModuleName = moduleId,
|
||||
ModuleId = moduleId,
|
||||
Json = string.Format("{0}应用【{1}】【{2}】", "删除", args, result?.ToJsonString())
|
||||
}));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,3 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
// 宁波拓通e智造平台 ToTong Next Builder //
|
||||
// https://git.tuotong-tech.com/tnb/tnb.server //
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using JNPF.Common.Contracts;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace JNPF.Common.Models
|
||||
/// <summary>
|
||||
/// 附件模型
|
||||
/// 版 本:V3.3.3
|
||||
/// 版 权:拓通智联科技有限公司(http://www.tuotong-tech.com)
|
||||
|
||||
/// 作 者:JNPF开发平台组.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace JNPF.Common.Models;
|
||||
/// <summary>
|
||||
/// 文件分片模型
|
||||
/// 版 本:V3.3.3
|
||||
/// 版 权:拓通智联科技有限公司(http://www.tuotong-tech.com)
|
||||
|
||||
/// 作 者:JNPF开发平台组.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
|
||||
@@ -6,8 +6,6 @@ namespace JNPF.Common.Models.NPOI;
|
||||
/// <summary>
|
||||
/// Excel导出列名
|
||||
/// 版 本:V3.0.0
|
||||
/// 版 权:引迈信息技术有限公司(https://www.jnpfsoft.com)
|
||||
/// 作 者:JNPF开发平台组
|
||||
/// 日 期:2017.03.09.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
|
||||
@@ -6,8 +6,6 @@ namespace JNPF.Common.Models.NPOI;
|
||||
/// <summary>
|
||||
/// Excel导出配置
|
||||
/// 版 本:V3.0.0
|
||||
/// 版 权:引迈信息技术有限公司(https://www.jnpfsoft.com)
|
||||
/// 作 者:JNPF开发平台组
|
||||
/// 日 期:2017.03.09.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
|
||||
@@ -5,8 +5,6 @@ namespace JNPF.Common.Models.NPOI;
|
||||
/// <summary>
|
||||
/// Excel导出模板
|
||||
/// 版 本:V3.0.0
|
||||
/// 版 权:引迈信息技术有限公司(https://www.jnpfsoft.com)
|
||||
/// 作 者:JNPF开发平台组
|
||||
/// 日 期:2017.03.09.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
|
||||
@@ -5,8 +5,6 @@ namespace JNPF.Common.Models.User
|
||||
/// <summary>
|
||||
/// 登录者信息
|
||||
/// 版 本:V3.2.0
|
||||
/// 版 权:引迈信息技术有限公司(https://www.jnpfsoft.com)
|
||||
/// 作 者:JNPF开发平台组.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class UserInfoModel
|
||||
|
||||
@@ -291,7 +291,7 @@ public static class CodeGenHelper
|
||||
result.Add(label, "系统自动生成");
|
||||
break;
|
||||
case JnpfKeyConst.COMSELECT:
|
||||
result.Add(label, multiple ? "例:引迈信息/产品部,引迈信息/技术部" : "例:引迈信息/技术部");
|
||||
result.Add(label, multiple ? "例:卡奥斯信息/产品部,卡奥斯信息/技术部" : "例:卡奥斯信息/技术部");
|
||||
break;
|
||||
case JnpfKeyConst.DEPSELECT:
|
||||
result.Add(label, multiple ? "例:产品部/部门编码,技术部/部门编码" : "例:技术部/部门编码");
|
||||
@@ -303,7 +303,7 @@ public static class CodeGenHelper
|
||||
result.Add(label, multiple ? "例:张三/账号,李四/账号" : "例:张三/账号");
|
||||
break;
|
||||
case JnpfKeyConst.USERSSELECT:
|
||||
result.Add(label, multiple ? "例:引迈信息/产品部,产品部/部门编码,技术经理/岗位编码,研发人员/角色编码,A分组/分组编码,张三/账号" : "例:李四/账号");
|
||||
result.Add(label, multiple ? "例:卡奥斯信息/产品部,产品部/部门编码,技术经理/岗位编码,研发人员/角色编码,A分组/分组编码,张三/账号" : "例:李四/账号");
|
||||
break;
|
||||
case JnpfKeyConst.ROLESELECT:
|
||||
result.Add(label, multiple ? "例:研发人员/角色编码,测试人员/角色编码" : "例:研发人员/角色编码");
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace JNPF.Common.Security;
|
||||
/// <summary>
|
||||
/// Excel导出操作类
|
||||
/// 版 本:V3.2.0
|
||||
/// 版 权:拓通智联科技有限公司(http://www.tuotong-tech.com)
|
||||
|
||||
/// 日 期:2017.03.09.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
@@ -226,16 +226,16 @@ public class ExcelExportHelper<T>
|
||||
SummaryInformation si = PropertySetFactory.CreateSummaryInformation();
|
||||
|
||||
// 填加xls文件作者信息
|
||||
si.Author = "拓通智联科技有限公司";
|
||||
si.Author = "卡奥斯数字科技有限公司";
|
||||
|
||||
// 填加xls文件创建程序信息
|
||||
si.ApplicationName = "拓通智联科技有限公司";
|
||||
si.ApplicationName = "卡奥斯数字科技有限公司";
|
||||
|
||||
// 填加xls文件最后保存者信息
|
||||
si.LastAuthor = "拓通智联科技有限公司";
|
||||
si.LastAuthor = "卡奥斯数字科技有限公司";
|
||||
|
||||
// 填加xls文件作者信息
|
||||
si.Comments = "拓通智联科技有限公司";
|
||||
si.Comments = "卡奥斯数字科技有限公司";
|
||||
|
||||
// 填加xls文件标题信息
|
||||
si.Title = "标题信息";
|
||||
@@ -487,16 +487,16 @@ public class ExcelExportHelper<T>
|
||||
SummaryInformation si = PropertySetFactory.CreateSummaryInformation();
|
||||
|
||||
// 填加xls文件作者信息
|
||||
si.Author = "拓通智联科技有限公司";
|
||||
si.Author = "卡奥斯数字科技有限公司";
|
||||
|
||||
// 填加xls文件创建程序信息
|
||||
si.ApplicationName = "拓通智联科技有限公司";
|
||||
si.ApplicationName = "卡奥斯数字科技有限公司";
|
||||
|
||||
// 填加xls文件最后保存者信息
|
||||
si.LastAuthor = "拓通智联科技有限公司";
|
||||
si.LastAuthor = "卡奥斯数字科技有限公司";
|
||||
|
||||
// 填加xls文件作者信息
|
||||
si.Comments = "拓通智联科技有限公司";
|
||||
si.Comments = "卡奥斯数字科技有限公司";
|
||||
|
||||
// 填加xls文件标题信息
|
||||
si.Title = "标题信息";
|
||||
@@ -762,16 +762,16 @@ public class ExcelExportHelper<T>
|
||||
SummaryInformation si = PropertySetFactory.CreateSummaryInformation();
|
||||
|
||||
// 填加xls文件作者信息
|
||||
si.Author = "拓通智联科技有限公司";
|
||||
si.Author = "卡奥斯数字科技有限公司";
|
||||
|
||||
// 填加xls文件创建程序信息
|
||||
si.ApplicationName = "拓通智联科技有限公司";
|
||||
si.ApplicationName = "卡奥斯数字科技有限公司";
|
||||
|
||||
// 填加xls文件最后保存者信息
|
||||
si.LastAuthor = "拓通智联科技有限公司";
|
||||
si.LastAuthor = "卡奥斯数字科技有限公司";
|
||||
|
||||
// 填加xls文件作者信息
|
||||
si.Comments = "拓通智联科技有限公司";
|
||||
si.Comments = "卡奥斯数字科技有限公司";
|
||||
|
||||
// 填加xls文件标题信息
|
||||
si.Title = "标题信息";
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace JNPF.Common.Helper
|
||||
/// <summary>
|
||||
/// Excel导入操作类
|
||||
/// 版 本:V3.2.0
|
||||
/// 版 权:拓通智联科技有限公司(http://www.tuotong-tech.com)
|
||||
|
||||
/// 日 期:2017.03.12.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace JNPF.Common.Security;
|
||||
/// <summary>
|
||||
/// FileHelper
|
||||
/// 版 本:V3.2.0
|
||||
/// 版 权:拓通智联科技有限公司(http://www.tuotong-tech.com)
|
||||
|
||||
/// 作 者:JNPF开发平台组.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace JNPF.Common.Security;
|
||||
/// <summary>
|
||||
/// JsonHelper
|
||||
/// 版 本:V3.4.2
|
||||
/// 版 权:拓通智联科技有限公司(http://www.tuotong-tech.com)
|
||||
|
||||
/// 作 者:JNPF开发平台组.
|
||||
/// </summary>
|
||||
public static class JsonHelper
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace JNPF.Common.Security;
|
||||
/// <summary>
|
||||
/// 网络操作
|
||||
/// 版 本:V3.0.0
|
||||
/// 版 权:拓通智联科技有限公司(http://www.tuotong-tech.com)
|
||||
|
||||
/// 作 者:JNPF开发平台组.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace JNPF.Common.Security;
|
||||
/// <summary>
|
||||
/// 汉字转换拼音
|
||||
/// 版 本:V3.2.0
|
||||
/// 版 权:拓通智联科技有限公司(http://www.tuotong-tech.com)
|
||||
|
||||
/// 作 者:JNPF开发平台组.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace JNPF.Common.Security;
|
||||
/// <summary>
|
||||
/// 树形结构查询
|
||||
/// 版 本:V3.2.0
|
||||
/// 版 权:拓通智联科技有限公司(http://www.tuotong-tech.com)
|
||||
|
||||
/// 作 者:JNPF开发平台组.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
// 宁波拓通e智造平台 ToTong Next Builder //
|
||||
// https://git.tuotong-tech.com/tnb/tnb.server //
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace Mapster;
|
||||
|
||||
@@ -73,17 +73,17 @@ where TEntity : class, new()
|
||||
base.Context.Ado.CommandTimeOut = 30;
|
||||
base.Context.Aop.OnLogExecuted = (sql, pars) =>
|
||||
{
|
||||
var oldColor = Console.ForegroundColor;
|
||||
// var oldColor = Console.ForegroundColor;
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
var finalSql = UtilMethods.GetSqlString(Context.CurrentConnectionConfig.DbType, sql, pars);
|
||||
Console.WriteLine($"【{DateTime.Now.ToString("HH:mm:ss.fff")}——SQL执行完成】{Context.Ado.SqlExecutionTime.TotalMilliseconds} ms");
|
||||
Console.WriteLine(finalSql);
|
||||
Console.ForegroundColor = oldColor;
|
||||
// Console.WriteLine($"【{DateTime.Now.ToString("HH:mm:ss.fff")}——SQL执行完成】{Context.Ado.SqlExecutionTime.TotalMilliseconds} ms");
|
||||
// Console.WriteLine(finalSql);
|
||||
// Console.ForegroundColor = oldColor;
|
||||
if (Context.Ado.SqlExecutionTime.TotalMilliseconds > 3000)
|
||||
{
|
||||
Log.Warning($"慢查询: {Context.Ado.SqlExecutionTime.TotalMilliseconds}ms, SQL: " + finalSql);
|
||||
}
|
||||
Console.WriteLine();
|
||||
// Console.WriteLine();
|
||||
//App.PrintToMiniProfiler("SqlSugar", "Info", sql + "\r\n" + base.Context.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value)));
|
||||
};
|
||||
base.Context.Aop.OnError = (ex) =>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<!--<VersionSuffix>$([System.DateTime]::Now.Year).$([System.DateTime]::Now.Month).$([System.DateTime]::Now.Day).$([System.DateTime]::Now.ToString(HHmm))</VersionSuffix>
|
||||
<AssemblyVersion>$(VersionSuffix)</AssemblyVersion>
|
||||
<Version>$(VersionSuffix)</Version>-->
|
||||
<Authors>ToTong</Authors>
|
||||
<Authors>cosmoplat</Authors>
|
||||
<Description>TNB 数据库访问器 SqlSugar 插件</Description>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<NoWarn>$(NoWarn);CS1591;</NoWarn>
|
||||
|
||||
Reference in New Issue
Block a user