From b14a52776b2670a556eafbe17c4390cf97cc7317 Mon Sep 17 00:00:00 2001
From: xiaolipro <2357729423@qq.com>
Date: Tue, 10 Sep 2024 16:59:58 +0800
Subject: [PATCH] =?UTF-8?q?add=EF=BC=9A=E8=BD=A8=E8=BF=B9=E6=A0=87?=
=?UTF-8?q?=E8=AE=B0=E3=80=81=E7=8A=B6=E6=80=81=E6=B7=BB=E5=8A=A0=E6=98=AF?=
=?UTF-8?q?=E5=90=A6=E5=B9=BF=E6=92=AD=E5=AD=97=E6=AE=B5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../TrackContents/EditTrackContentInput.cs | 2 +-
.../Dtos/TrackFlags/EditTrackFlagInput.cs | 12 ++++-----
.../Dtos/TrackStatus/EditTrackStatusInput.cs | 5 ++++
.../TrackContents/TrackContentService.cs | 3 ++-
.../Services/TrackFlags/TrackFlagService.cs | 16 +++++------
.../TrackStatus/TrackStatusService.cs | 27 ++++++++-----------
6 files changed, 33 insertions(+), 32 deletions(-)
diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackContents/EditTrackContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/EditTrackContentInput.cs
index 4bce2569..117a5cdf 100644
--- a/src/SJZY.Track.Application.Contract/Dtos/TrackContents/EditTrackContentInput.cs
+++ b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/EditTrackContentInput.cs
@@ -40,7 +40,7 @@ public class EditTrackContentInput
///
/// 轨迹标记id
///
- public int TrackFlagId { get; set; }
+ public int[] TrackFlagIds { get; set; }
///
/// 是否对外
diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackFlags/EditTrackFlagInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackFlags/EditTrackFlagInput.cs
index 0d3c631d..0d605e40 100644
--- a/src/SJZY.Track.Application.Contract/Dtos/TrackFlags/EditTrackFlagInput.cs
+++ b/src/SJZY.Track.Application.Contract/Dtos/TrackFlags/EditTrackFlagInput.cs
@@ -1,4 +1,4 @@
-namespace SJZY.Track.Application.Contract.Dtos.TrackFlags;
+namespace SJZY.Track.Application.Contract.Dtos.TrackFlags;
public class EditTrackFlagInput
{
@@ -27,10 +27,10 @@ public class EditTrackFlagInput
///
public string? Code { get; set; }
- /////
- ///// 是否完结
- /////
- //public bool IsFinish { get; set; }
+ ///
+ /// 是否广播
+ ///
+ public bool IsToMq { get; set; }
}
public class GetTrackFlagDetailDto
@@ -56,7 +56,7 @@ public class GetTrackFlagDetailDto
public string Code { get; set; }
///
- ///
+ ///
///
public string Flag { get; set; }
diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackStatus/EditTrackStatusInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackStatus/EditTrackStatusInput.cs
index 27cda0eb..e5efd4c1 100644
--- a/src/SJZY.Track.Application.Contract/Dtos/TrackStatus/EditTrackStatusInput.cs
+++ b/src/SJZY.Track.Application.Contract/Dtos/TrackStatus/EditTrackStatusInput.cs
@@ -41,4 +41,9 @@ public class EditTrackStatusInput
/// 是否完结
///
public bool IsCompleted { get; set; }
+
+ ///
+ /// 是否广播
+ ///
+ public bool IsToMq { get; set; }
}
diff --git a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs
index 48bf22fe..eb8f7492 100644
--- a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs
+++ b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs
@@ -187,6 +187,7 @@ public class TrackContentService : ApplicationService
#endregion 业务逻辑校验
var entity = ObjectMapper.Map(input);
+ entity.TrackFlagId = input.TrackFlagIds.JoinAsString(",");
var isTrue = await _trackContentRepository.InsertAsync(entity);
return new UnifyResultDto(GlobalConst.SuccessCode, "新增成功", isTrue);
@@ -254,7 +255,7 @@ public class TrackContentService : ApplicationService
}
ObjectMapper.Map(input, trackContent);
-
+ trackContent.TrackFlagId = input.TrackFlagIds.JoinAsString(",");
isTrue = await _trackContentRepository.UpdateAsync(trackContent);
ts.Complete();
diff --git a/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs b/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs
index 445c9472..b42afce5 100644
--- a/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs
+++ b/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs
@@ -92,8 +92,6 @@ public class TrackFlagService : ApplicationService, ITransientDependency
a.SubSystemId == input.SubSystemId && (a.Code == input.Code || a.Name == input.Flag));
if (trackFlagsEntitys.Any())
{
- //throw new BusinessException(message: _stringLocalizer["TrackFlagExist"]);
- //throw new BusinessException(message: "当前子系统下已存在轨迹标记代码");
var trackFlagCode = trackFlagsEntitys.FirstOrDefault(a => a.Code == input.Code);
if (trackFlagCode != null)
{
@@ -125,8 +123,6 @@ public class TrackFlagService : ApplicationService, ITransientDependency
a.Name == input.Flag));
if (trackFlagsEntitys.Any())
{
- //throw new BusinessException(message: _stringLocalizer["TrackFlagExist"]);
- //throw new BusinessException(message: "当前子系统下已存在轨迹标记代码");
var trackFlagCode = trackFlagsEntitys.FirstOrDefault(a => a.Code == input.Code);
if (trackFlagCode != null)
{
@@ -142,9 +138,14 @@ public class TrackFlagService : ApplicationService, ITransientDependency
#endregion
- var templateEntity = await _trackFlagRepository.GetFirstAsync(a => a.Id == input.Id);
- ObjectMapper.Map(input, templateEntity);
- var isTrue = await _trackFlagRepository.UpdateAsync(templateEntity);
+ var trackFlag = await _trackFlagRepository.GetFirstAsync(a => a.Id == input.Id);
+ if (trackFlag == null)
+ {
+ throw new BusinessException(message: "轨迹标记不存在");
+ }
+
+ ObjectMapper.Map(input, trackFlag);
+ var isTrue = await _trackFlagRepository.UpdateAsync(trackFlag);
return new UnifyResultDto(GlobalConst.SuccessCode, "修改成功", isTrue);
}
@@ -157,7 +158,6 @@ public class TrackFlagService : ApplicationService, ITransientDependency
await _trackContentRepository.GetFirstAsync(a => SqlFunc.SplitIn(a.TrackFlagId, input.Id.ToString()));
if (isExistContent != null)
{
- //throw new BusinessException(message: _stringLocalizer["IsExistTrackFlag"]);
throw new BusinessException(message: "该标记关联轨迹内容,禁止删除");
}
diff --git a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs
index be742360..0061c2c4 100644
--- a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs
+++ b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs
@@ -1,10 +1,7 @@
-using Microsoft.Extensions.Localization;
using SJZY.Track.Application.Contract.Dtos.TrackStatus;
-using SJZY.Track.Application.Localization;
using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
using SJZY.Track.Domain.Aggregates.TrackStatusAggregate;
using SJZY.Track.Domain.Dtos.TrackStatus;
-using Volo.Abp.DependencyInjection;
namespace SJZY.Track.Application.Services.TrackStatus;
@@ -13,21 +10,18 @@ namespace SJZY.Track.Application.Services.TrackStatus;
///
[ApiExplorerSettings(GroupName = "轨迹状态")]
[Route("/Track/Status")]
-public class TrackStatusService : ApplicationService, ITransientDependency
+public class TrackStatusService : ApplicationService
{
- private readonly IStringLocalizer _stringLocalizer;
private readonly ITrackContentRepository _trackContentRepository;
private readonly ITrackStatusRepository _trackStatusRepository;
public TrackStatusService(
- IStringLocalizer stringLocalizer,
ITrackStatusRepository trackStatusRepository,
ITrackContentRepository trackContentRepository
)
{
- this._stringLocalizer = stringLocalizer;
- this._trackStatusRepository = trackStatusRepository;
- this._trackContentRepository = trackContentRepository;
+ _trackStatusRepository = trackStatusRepository;
+ _trackContentRepository = trackContentRepository;
}
///
@@ -92,8 +86,6 @@ public class TrackStatusService : ApplicationService, ITransientDependency
a.Status == input.TrackStatus || a.EnStatus == input.EnTrackStatus));
if (trackStatusEntitys.Any())
{
- //throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]);
- //throw new BusinessException(message: "当前子系统下,轨迹状态代码或轨迹状态或轨迹状态英文存在");
var trackStatusCode = trackStatusEntitys.FirstOrDefault(t => t.Code == input.Code);
if (trackStatusCode != null)
{
@@ -130,8 +122,6 @@ public class TrackStatusService : ApplicationService, ITransientDependency
a.Status == input.TrackStatus || a.EnStatus == input.EnTrackStatus));
if (trackStatusEntitys.Any())
{
- //throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]);
- //throw new BusinessException(message: "当前子系统下,轨迹状态代码或轨迹状态或轨迹状态英文存在");
var trackStatusCode = trackStatusEntitys.FirstOrDefault(t => t.Code == input.Code);
if (trackStatusCode != null)
{
@@ -153,9 +143,14 @@ public class TrackStatusService : ApplicationService, ITransientDependency
#endregion
- var templateEntity = await _trackStatusRepository.GetFirstAsync(a => a.Id == input.Id);
- ObjectMapper.Map(input, templateEntity);
- var isTrue = await _trackStatusRepository.UpdateAsync(templateEntity);
+ var trackStatus = await _trackStatusRepository.GetFirstAsync(a => a.Id == input.Id);
+ if (trackStatus == null)
+ {
+ throw new BusinessException(message: "轨迹状态不存在");
+ }
+
+ ObjectMapper.Map(input, trackStatus);
+ var isTrue = await _trackStatusRepository.UpdateAsync(trackStatus);
return new UnifyResultDto(GlobalConst.SuccessCode, "修改成功", isTrue);
}