From 956fba5fc3df2fa327c4eac91c9af85cb6407f08 Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Fri, 7 Jul 2023 15:23:27 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=8F=91=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ServiceWorkFlowActivitiesRelation.cs | 5 ++ .../ServiceWorkFlowActivitiesSubRelation.cs | 5 ++ .../ServiceWorkFlowProjectRelation.cs | 5 ++ .../ServiceWorkFlowReleaseInfo.cs | 2 +- .../ServiceWorkFlowBaseService.cs | 47 +++++++++++++++---- 5 files changed, 55 insertions(+), 9 deletions(-) diff --git a/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowActivitiesRelation.cs b/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowActivitiesRelation.cs index e8e0ca89..74a0681d 100644 --- a/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowActivitiesRelation.cs +++ b/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowActivitiesRelation.cs @@ -44,5 +44,10 @@ namespace Myshipping.Application /// 值类型 STRING-字符 DATETIME-日期 /// public string VAL_TYPE { get; set; } + + /// + /// 流程版本号 + /// + public string WF_VERSION { get; set; } } } diff --git a/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowActivitiesSubRelation.cs b/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowActivitiesSubRelation.cs index c5a82824..bcd149fc 100644 --- a/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowActivitiesSubRelation.cs +++ b/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowActivitiesSubRelation.cs @@ -44,5 +44,10 @@ namespace Myshipping.Application /// 值类型 STRING-字符 DATETIME-日期 /// public string VAL_TYPE { get; set; } + + /// + /// 流程版本号 + /// + public string WF_VERSION { get; set; } } } diff --git a/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowProjectRelation.cs b/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowProjectRelation.cs index d749d35c..7d647677 100644 --- a/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowProjectRelation.cs +++ b/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowProjectRelation.cs @@ -32,5 +32,10 @@ namespace Myshipping.Application.Entity /// 服务项目主键 /// public string SERVICE_PROJECT_ID { get; set; } + + /// + /// 流程版本号 + /// + public string WF_VERSION { get; set; } } } diff --git a/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowReleaseInfo.cs b/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowReleaseInfo.cs index c5a7e178..69b01ff4 100644 --- a/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowReleaseInfo.cs +++ b/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowReleaseInfo.cs @@ -38,7 +38,7 @@ namespace Myshipping.Application.Entity /// /// 发布人 /// - public string PUBLISH_ER { get; set; } + public long PUBLISH_ER { get; set; } /// /// 发布人名称 diff --git a/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowBaseService.cs b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowBaseService.cs index 0d3d1d8b..7ecc114b 100644 --- a/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowBaseService.cs +++ b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowBaseService.cs @@ -41,7 +41,8 @@ namespace Myshipping.Application SqlSugarRepository serviceWorkFlowActivitiesInfoRepository, SqlSugarRepository serviceWorkFlowProjectRelationRepository, SqlSugarRepository serviceWorkFlowActivitiesRelationRepository, - SqlSugarRepository serviceWorkFlowActivitiesSubRelationRepository) + SqlSugarRepository serviceWorkFlowActivitiesSubRelationRepository, + SqlSugarRepository serviceWorkFlowReleaseInfoRepository) { _serviceWorkFlowBaseRepository = serviceWorkFlowBaseRepository; _serviceWorkFlowActivitiesInfoRepository = serviceWorkFlowActivitiesInfoRepository; @@ -50,6 +51,7 @@ namespace Myshipping.Application _logger = logger; _serviceWorkFlowActivitiesSubRelationRepository = serviceWorkFlowActivitiesSubRelationRepository; + _serviceWorkFlowReleaseInfoRepository = serviceWorkFlowReleaseInfoRepository; } /// @@ -238,15 +240,15 @@ namespace Myshipping.Application //批量删除服务流程与服务项目关系(物理删除) _serviceWorkFlowProjectRelationRepository.EntityContext.Deleteable() - .EnableQueryFilter().Where(a => a.SERVICE_WORKFLOW_ID == entity.PK_ID).ExecuteCommand(); + .EnableQueryFilter().Where(a => a.SERVICE_WORKFLOW_ID == entity.PK_ID && a.WF_VERSION == "DEVELOP").ExecuteCommand(); //批量删除服务流程与服务活动关系(物理删除) _serviceWorkFlowActivitiesRelationRepository.EntityContext.Deleteable() - .EnableQueryFilter().Where(a => a.SERVICE_WORKFLOW_ID == entity.PK_ID).ExecuteCommand(); + .EnableQueryFilter().Where(a => a.SERVICE_WORKFLOW_ID == entity.PK_ID && a.WF_VERSION == "DEVELOP").ExecuteCommand(); //批量删除服务流程活动与子活动的关系(物理删除) _serviceWorkFlowActivitiesSubRelationRepository.EntityContext.Deleteable() - .EnableQueryFilter().Where(a => a.SERVICE_WORKFLOW_ID == entity.PK_ID).ExecuteCommand(); + .EnableQueryFilter().Where(a => a.SERVICE_WORKFLOW_ID == entity.PK_ID && a.WF_VERSION == "DEVELOP").ExecuteCommand(); } //服务流程与服务项目关系 @@ -256,6 +258,7 @@ namespace Myshipping.Application PK_ID = IDGen.NextID().ToString(), SERVICE_WORKFLOW_ID = entity.PK_ID, SERVICE_PROJECT_ID = info.ServiceProject.PKId, + WF_VERSION = "DEVELOP" }; //插入关系 @@ -273,7 +276,8 @@ namespace Myshipping.Application SERVICE_ACTIVITIES_ID = sku.PKId, SORT_NO = sku.SortNo, IS_CONTAINS_SUB = sku.IsContainsSub, - VAL_TYPE = !string.IsNullOrWhiteSpace(sku.ValType)? sku.ValType: StatusSKUValTypeEnum.DATETIME.ToString() + VAL_TYPE = !string.IsNullOrWhiteSpace(sku.ValType)? sku.ValType: StatusSKUValTypeEnum.DATETIME.ToString(), + WF_VERSION = "DEVELOP" }; await _serviceWorkFlowActivitiesRelationRepository.InsertAsync(wfRelationActivities); @@ -288,7 +292,8 @@ namespace Myshipping.Application SERVICE_WORKFLOW_ID = entity.PK_ID, SERVICE_ACTIVITIES_ID = sku.PKId, SUB_SERVICE_ACTIVITIES_ID = sub.PKId, - SORT_NO = sub.SortNo + SORT_NO = sub.SortNo, + WF_VERSION = "DEVELOP" }; await _serviceWorkFlowActivitiesSubRelationRepository.InsertAsync(wfRelationActivitiesSub); @@ -998,15 +1003,41 @@ namespace Myshipping.Application if (model == null) throw Oops.Oh($"服务流程获取失败,服务流程信息不存在或已作废", typeof(InvalidOperationException)); + var lastReleaseInfo = _serviceWorkFlowReleaseInfoRepository.AsQueryable() + .First(a => a.SERVICE_WORKFLOW_ID == model.PK_ID && a.IS_DEL == 0); + int currNum = lastReleaseInfo == null ? 1 : lastReleaseInfo.TOTAL_NUM; - + ServiceWorkFlowReleaseInfo releaseInfo = new ServiceWorkFlowReleaseInfo + { + PK_ID = IDGen.NextID().ToString(), + SERVICE_WORKFLOW_ID = model.PK_ID, + LAST_PK_ID = lastReleaseInfo.PK_ID, + PUBLISH_DATE = DateTime.Now, + IS_DEL = 0, + PUBLISH_ER = UserManager.UserId, + PUBLISH_NAME = UserManager.Name, + TOTAL_NUM = currNum + 1, + }; + + //写入发布表 + _serviceWorkFlowReleaseInfoRepository.Insert(releaseInfo); + + model.RELEASE_VERSION = releaseInfo.RELEASE_VERSION; model.UpdatedTime = DateTime.Now; model.UpdatedUserId = UserManager.UserId; model.UpdatedUserName = UserManager.Name; + await _serviceWorkFlowBaseRepository.AsUpdateable(model).UpdateColumns(it => new + { + it.RELEASE_VERSION, + it.UpdatedTime, + it.UpdatedUserId, + it.UpdatedUserName, + }).ExecuteCommandAsync(); + result.succ = true; - result.msg = "执行成功"; + result.msg = "发布成功"; } catch (Exception ex) From 8a2c873b3d623cf7c0e70b4b647979330c90ba71 Mon Sep 17 00:00:00 2001 From: wanghaomei Date: Fri, 7 Jul 2023 15:28:03 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=97=A5=E5=BF=97=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Logging/Component/LoggingFileComponent.cs | 41 +++++++++---------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/Myshipping.Core/Logging/Component/LoggingFileComponent.cs b/Myshipping.Core/Logging/Component/LoggingFileComponent.cs index f5ebaeae..28d56816 100644 --- a/Myshipping.Core/Logging/Component/LoggingFileComponent.cs +++ b/Myshipping.Core/Logging/Component/LoggingFileComponent.cs @@ -43,26 +43,25 @@ public sealed class LoggingFileComponent : IServiceComponent return string.Format(fileName, DateTime.UtcNow); }; options.FileSizeLimitBytes = 5000 * 1024; - //options.MessageFormat = (logMsg) => - //{ - // var stringBuilder = new StringBuilder(); - // stringBuilder.AppendLine("【日志级别】:" + logMsg.LogLevel); - // stringBuilder.AppendLine("【日志时间】:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); - // stringBuilder.AppendLine("【日志内容】:" + logMsg.Message); - // if (logMsg.Exception != null) - // { - // stringBuilder.AppendLine("【异常信息】:" + logMsg.Exception); - // } - // stringBuilder.AppendLine("【ManagedThreadId】:" + System.Threading.Thread.CurrentThread.ManagedThreadId); - - // if (logMsg.Context != null && logMsg.Context.Properties != null && logMsg.Context.Properties.Count > 0) - // { - // foreach (var prop in logMsg.Context.Properties) - // { - // stringBuilder.AppendLine($"【属性】{prop.Key}:{prop.Value}"); - // } - // } - // return stringBuilder.ToString(); - //}; + options.MessageFormat = (logMsg) => + { + var stringBuilder = new StringBuilder(); + stringBuilder.AppendLine($"[{logMsg.LogLevel}] [{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ffffff")}] [{logMsg.LogName}] [{System.Threading.Thread.CurrentThread.ManagedThreadId}] "); + stringBuilder.AppendLine($" {logMsg.Message}"); + if (logMsg.Exception != null) + { + stringBuilder.AppendLine(logMsg.Exception.Message); + stringBuilder.AppendLine(logMsg.Exception.StackTrace); + } + + if (logMsg.Context != null && logMsg.Context.Properties != null && logMsg.Context.Properties.Count > 0) + { + foreach (var prop in logMsg.Context.Properties) + { + stringBuilder.AppendLine($"{prop.Key}:{prop.Value}"); + } + } + return stringBuilder.ToString(); + }; } }