From 6ab8472a4cf8cd76b2c98cedddb4673188ecf922 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Sat, 2 Mar 2024 09:41:05 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E6=A8=A1=E7=89=88?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E8=AF=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackTemplates/TrackTemplateService.cs | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs index 6fdf4498..8d51d3e9 100644 --- a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs +++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs @@ -4,6 +4,7 @@ using SJZY.Expand.ABP.Core.Localization; using SJZY.Track.Application.Contract.Dtos.TrackTemplates; using SJZY.Track.Application.Localization; using SJZY.Track.Domain.Aggregates.TrackPullAggregate; +using SJZY.Track.Domain.Aggregates.TrackPushAggregate; using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; using SJZY.Track.Domain.Dtos.TrackTemplate; using Volo.Abp.DependencyInjection; @@ -20,17 +21,20 @@ public class TrackTemplateService : ApplicationService, ITransientDependency private readonly IStringLocalizer _stringLocalizer; private readonly ITrackTemplateRepository _trackTemplateRepository; private readonly ITrackPullConfigRepository _trackPullConfigRepository; + private readonly ITrackPushConfigRepository _trackPushConfigRepository; /// public TrackTemplateService( IStringLocalizer stringLocalizer, ITrackTemplateRepository trackTemplateRepository, - ITrackPullConfigRepository trackPullConfigRepository + ITrackPullConfigRepository trackPullConfigRepository, + ITrackPushConfigRepository trackPushConfigRepository ) { _stringLocalizer = stringLocalizer; _trackTemplateRepository = trackTemplateRepository; _trackPullConfigRepository = trackPullConfigRepository; + _trackPushConfigRepository=trackPushConfigRepository; } /// @@ -97,7 +101,7 @@ public class TrackTemplateService : ApplicationService, ITransientDependency if (templateEntity != null) { //throw new BusinessException(message: _stringLocalizer["TemplateExist"]); - throw new BusinessException("轨迹代码重复"); + throw new BusinessException("模板代码已存在于当前选择的子系统下"); } #endregion 业务校验 @@ -116,7 +120,7 @@ public class TrackTemplateService : ApplicationService, ITransientDependency a.Id != input.Id && a.SubSystemId == input.SubSystemId && a.Code == input.Code); if (isExist != null) { - throw new BusinessException(message: _stringLocalizer["TemplateExist"]); + throw new BusinessException(message: _stringLocalizer["模板代码已存在于当前选择的子系统下"]); } #endregion 业务校验 @@ -133,10 +137,17 @@ public class TrackTemplateService : ApplicationService, ITransientDependency #region 业务校验 //查询看看在轨迹拉取里面有没有被占用 - var isExisistTrackPullConfig = await _trackPullConfigRepository.GetFirstAsync(a => a.TrackTemplateId == input.Id); - if (isExisistTrackPullConfig != null) + var isExisistTrackPullConfigs = await _trackPullConfigRepository.GetListAsync(a => a.TrackTemplateId == input.Id); + if (isExisistTrackPullConfigs.Any()) { - throw new BusinessException(message: _stringLocalizer["IsExistTrackPullConfig"]); + //throw new BusinessException(message: _stringLocalizer["IsExistTrackPullConfig"]); + throw new BusinessException(message: _stringLocalizer["轨迹拉取配置里已经绑定模版,请检查"]); + } + //轨迹推送里看看是否被占用 + var isExisistTrackPushConfigs = await _trackPushConfigRepository.GetListAsync(a => a.TrackTemplateId.Contains(input.Id.ToString())); + if (isExisistTrackPushConfigs.Any()) + { + throw new BusinessException(message: _stringLocalizer["轨迹推送配置里已经绑定模版,请检查"]); } #endregion 业务校验 From 2dc9c7f31b8e15df40e60b7a8e677b2980016e91 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Sat, 2 Mar 2024 09:50:31 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackStatus/TrackStatusService.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs index 686854db..b742ae81 100644 --- a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs +++ b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs @@ -92,7 +92,8 @@ public class TrackStatusService : ApplicationService, ITransientDependency a.Status == input.TrackStatus || a.EnStatus == input.EntrackStatus)); if (trackStatusEntity != null) { - throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]); + //throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]); + throw new BusinessException("当前子系统下,轨迹状态代码或轨迹状态或轨迹状态英文存在"); } #endregion @@ -112,7 +113,8 @@ public class TrackStatusService : ApplicationService, ITransientDependency a.Status == input.TrackStatus || a.EnStatus == input.EntrackStatus)); if (trackStatusEntity != null) { - throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]); + //throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]); + throw new BusinessException("当前子系统下,轨迹状态代码或轨迹状态或轨迹状态英文存在"); } #endregion @@ -130,7 +132,8 @@ public class TrackStatusService : ApplicationService, ITransientDependency var isExistStatus = await _trackContentRepository.GetFirstAsync(a => a.TrackStatusId==input.Id); if (isExistStatus!=null) { - throw new BusinessException(message: _stringLocalizer["IsExistTrackStatus"]); + //throw new BusinessException(message: _stringLocalizer["IsExistTrackStatus"]); + throw new BusinessException("轨迹内容已经绑定了该轨迹状态,请先删除轨迹内容后再删除该轨迹状态"); } #endregion var isTrue = await _trackStatusRepository.SoftDeleteAsync(x => x.Id == input.Id); From e9128e1985ab134fecbad2476b0e12b8db2323bf Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Sat, 2 Mar 2024 09:54:40 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E8=AF=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackStatus/TrackStatusService.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs index b742ae81..50bbbdae 100644 --- a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs +++ b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs @@ -87,10 +87,10 @@ public class TrackStatusService : ApplicationService, ITransientDependency { #region 业务校验 - var trackStatusEntity = await _trackStatusRepository.GetFirstAsync(a => a.SubSystemId == input.SubSystemId && + var trackStatusEntitys = await _trackStatusRepository.GetListAsync(a => a.SubSystemId == input.SubSystemId && (a.Code == input.Code || a.Status == input.TrackStatus || a.EnStatus == input.EntrackStatus)); - if (trackStatusEntity != null) + if (trackStatusEntitys.Any()) { //throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]); throw new BusinessException("当前子系统下,轨迹状态代码或轨迹状态或轨迹状态英文存在"); @@ -108,10 +108,10 @@ public class TrackStatusService : ApplicationService, ITransientDependency { #region 业务校验 - var trackStatusEntity = await _trackStatusRepository.GetFirstAsync(a => a.Id != input.Id && + var trackStatusEntitys = await _trackStatusRepository.GetListAsync(a => a.Id != input.Id && a.SubSystemId == input.SubSystemId && (a.Code == input.Code || a.Status == input.TrackStatus || a.EnStatus == input.EntrackStatus)); - if (trackStatusEntity != null) + if (trackStatusEntitys.Any()) { //throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]); throw new BusinessException("当前子系统下,轨迹状态代码或轨迹状态或轨迹状态英文存在"); From e1958fe96e45cc1a8e782ce6ed86d7e9074076cb Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Sat, 2 Mar 2024 09:59:04 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E8=AF=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackStatus/TrackStatusService.cs | 6 +++--- .../Services/TrackTemplates/TrackTemplateService.cs | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs index 50bbbdae..5dad92e8 100644 --- a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs +++ b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs @@ -93,7 +93,7 @@ public class TrackStatusService : ApplicationService, ITransientDependency if (trackStatusEntitys.Any()) { //throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]); - throw new BusinessException("当前子系统下,轨迹状态代码或轨迹状态或轨迹状态英文存在"); + throw new BusinessException(message: "当前子系统下,轨迹状态代码或轨迹状态或轨迹状态英文存在"); } #endregion @@ -114,7 +114,7 @@ public class TrackStatusService : ApplicationService, ITransientDependency if (trackStatusEntitys.Any()) { //throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]); - throw new BusinessException("当前子系统下,轨迹状态代码或轨迹状态或轨迹状态英文存在"); + throw new BusinessException(message: "当前子系统下,轨迹状态代码或轨迹状态或轨迹状态英文存在"); } #endregion @@ -133,7 +133,7 @@ public class TrackStatusService : ApplicationService, ITransientDependency if (isExistStatus!=null) { //throw new BusinessException(message: _stringLocalizer["IsExistTrackStatus"]); - throw new BusinessException("轨迹内容已经绑定了该轨迹状态,请先删除轨迹内容后再删除该轨迹状态"); + throw new BusinessException(message: "轨迹内容已经绑定了该轨迹状态,请先删除轨迹内容后再删除该轨迹状态"); } #endregion var isTrue = await _trackStatusRepository.SoftDeleteAsync(x => x.Id == input.Id); diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs index 8d51d3e9..f084dc2c 100644 --- a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs +++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs @@ -101,7 +101,7 @@ public class TrackTemplateService : ApplicationService, ITransientDependency if (templateEntity != null) { //throw new BusinessException(message: _stringLocalizer["TemplateExist"]); - throw new BusinessException("模板代码已存在于当前选择的子系统下"); + throw new BusinessException(message: "模板代码已存在于当前选择的子系统下"); } #endregion 业务校验 @@ -119,8 +119,8 @@ public class TrackTemplateService : ApplicationService, ITransientDependency var isExist = await _trackTemplateRepository.GetFirstAsync(a => a.Id != input.Id && a.SubSystemId == input.SubSystemId && a.Code == input.Code); if (isExist != null) - { - throw new BusinessException(message: _stringLocalizer["模板代码已存在于当前选择的子系统下"]); + { + throw new BusinessException(message: "模板代码已存在于当前选择的子系统下"); } #endregion 业务校验 @@ -140,14 +140,14 @@ public class TrackTemplateService : ApplicationService, ITransientDependency var isExisistTrackPullConfigs = await _trackPullConfigRepository.GetListAsync(a => a.TrackTemplateId == input.Id); if (isExisistTrackPullConfigs.Any()) { - //throw new BusinessException(message: _stringLocalizer["IsExistTrackPullConfig"]); - throw new BusinessException(message: _stringLocalizer["轨迹拉取配置里已经绑定模版,请检查"]); + //throw new BusinessException(message: _stringLocalizer["IsExistTrackPullConfig"]); + throw new BusinessException(message: "轨迹拉取配置里已经绑定模版,请检查"); } //轨迹推送里看看是否被占用 var isExisistTrackPushConfigs = await _trackPushConfigRepository.GetListAsync(a => a.TrackTemplateId.Contains(input.Id.ToString())); if (isExisistTrackPushConfigs.Any()) { - throw new BusinessException(message: _stringLocalizer["轨迹推送配置里已经绑定模版,请检查"]); + throw new BusinessException(message: "轨迹推送配置里已经绑定模版,请检查"); } #endregion 业务校验