diff --git a/src/SJZY.Track.Application/Dtos/TrackStatus/EditTrackStatusInput.cs b/src/SJZY.Track.Application/Dtos/TrackStatus/EditTrackStatusInput.cs
new file mode 100644
index 00000000..a77a4f1c
--- /dev/null
+++ b/src/SJZY.Track.Application/Dtos/TrackStatus/EditTrackStatusInput.cs
@@ -0,0 +1,46 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SJZY.Track.Application.Dtos.TrackStatus
+{
+ public class EditTrackStatusInput
+ {
+ ///
+ /// Id
+ ///
+ public int Id { get; set; }
+
+ ///
+ /// 操作类型
+ ///
+ public OptionType Options { get; set; }
+
+ ///
+ /// 子系统id
+ ///
+ public int SubSystemId { get; set; }
+
+ ///
+ /// 所属节点id
+ ///
+ public int NodeId { get; set; }
+
+ ///
+ /// 轨迹状态代码
+ ///
+ public string Code { get; set; }
+
+ ///
+ /// 轨迹状态
+ ///
+ public string TrackStatus { get; set; }
+
+ ///
+ /// 轨迹状态英文
+ ///
+ public string EntrackStatus { get; set; }
+ }
+}
diff --git a/src/SJZY.Track.Application/Services/TrackStatus/ITrackStatusService.cs b/src/SJZY.Track.Application/Services/TrackStatus/ITrackStatusService.cs
new file mode 100644
index 00000000..eef632b7
--- /dev/null
+++ b/src/SJZY.Track.Application/Services/TrackStatus/ITrackStatusService.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SJZY.Track.Application.Services.TrackStatus
+{
+ public interface ITrackStatusService
+ {
+ }
+}
diff --git a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs
index 938837c7..432cabad 100644
--- a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs
+++ b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs
@@ -1,13 +1,72 @@
-using System;
+using SJZY.Track.Application.Dtos.TrackStatus;
+using SJZY.Track.Application.Dtos.TrackTemplates;
+using SJZY.Track.Domain.TrackStatusAggregate;
+using SJZY.Track.Domain.TrackTemplateAggregate;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using Volo.Abp.DependencyInjection;
namespace SJZY.Track.Application.Services.TrackStatus
{
- public class TrackStatusService
+ ///
+ /// 轨迹状态
+ ///
+ [ApiExplorerSettings(GroupName = "轨迹状态")]
+ [Route("/Track/Status")]
+ public class TrackStatusService : ApplicationService, ITransientDependency
{
+ private readonly ITrackStatusRepository _trackStatusRepository;
+ public TrackStatusService(
+ ITrackStatusRepository trackStatusRepository
+ )
+ {
+ this._trackStatusRepository=trackStatusRepository;
+ }
+
+ ///
+ /// 轨迹状态编辑
+ ///
+ ///
+ [HttpPost("Edit")]
+ public async Task EditAsync(EditTrackStatusInput input)
+ {
+ return input.Options switch
+ {
+ OptionType.新增 => await AddAsync(input),
+ OptionType.修改 => await UpdateAsync(input),
+ OptionType.删除 => await DeleteAsync(input),
+ _ => throw new BusinessException(message: "当前操作动作不合法")
+ };
+ }
+
+ #region 私有方法
+ private async Task AddAsync(EditTrackStatusInput input)
+ {
+ var entity = ObjectMapper.Map(input);
+ var isTrue = await _trackStatusRepository.InsertAsync(entity);
+
+ return new UnifyResultDto("200", "新增成功", isTrue);
+ }
+
+ private async Task UpdateAsync(EditTrackStatusInput input)
+ {
+ var templateEntity = await _trackStatusRepository.GetFirstAsync(a => a.Id == input.Id);
+ ObjectMapper.Map(input, templateEntity);
+ var isTrue = await _trackStatusRepository.UpdateAsync(templateEntity);
+
+ return new UnifyResultDto("200", "修改成功", isTrue);
+ }
+
+ private async Task DeleteAsync(EditTrackStatusInput input)
+ {
+ var isTrue = await _trackStatusRepository.SoftDeleteAsync(x => x.Id == input.Id);
+
+ return new UnifyResultDto("200", "删除成功", isTrue);
+ }
+ #endregion
}
}