diff --git a/src/SJZY.Track.Application/Dtos/TrackContents/EditTrackContentInput.cs b/src/SJZY.Track.Application/Dtos/TrackContents/EditTrackContentInput.cs new file mode 100644 index 00000000..23294dfe --- /dev/null +++ b/src/SJZY.Track.Application/Dtos/TrackContents/EditTrackContentInput.cs @@ -0,0 +1,105 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SJZY.Track.Application.Dtos.TrackContents +{ + public class EditTrackContentInput + { + /// + /// Id + /// + public int Id { get; set; } + + /// + /// 操作类型 + /// + public OptionType Options { get; set; } + + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 所属轨迹状态id + /// + public int TrackStatusId { get; set; } + + /// + /// 轨迹内容代码 + /// + public string Code { get; set; } + + /// + /// 轨迹内容 + /// + public string Content { get; set; } + + /// + /// 轨迹内容英文 + /// + public string EnContent { get; set; } + + /// + /// 轨迹标记id + /// + public int TrackFlagId { get; set; } + } + + public class GetTrackContentDetailDto + { + /// + /// Id + /// + public int Id { get; set; } + + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 子系统 + /// + public string SubSystem { get; set; } + + /// + /// 所属轨迹状态id + /// + public int TrackStatusId { get; set; } + + /// + /// 所属轨迹状态 + /// + public string TrackStatus { get; set; } + + /// + /// 轨迹内容代码 + /// + public string Code { get; set; } + + /// + /// 轨迹内容 + /// + public string Content { get; set; } + + /// + /// 轨迹内容英文 + /// + public string EnContent { get; set; } + + /// + /// 轨迹标记id + /// + public int TrackFlagId { get; set; } + + /// + /// 轨迹标记 + /// + public string TrackFlag { get; set; } + } +} + diff --git a/src/SJZY.Track.Application/Dtos/TrackContents/GetPageTrackContentInput.cs b/src/SJZY.Track.Application/Dtos/TrackContents/GetPageTrackContentInput.cs new file mode 100644 index 00000000..a494d030 --- /dev/null +++ b/src/SJZY.Track.Application/Dtos/TrackContents/GetPageTrackContentInput.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SJZY.Track.Application.Dtos.TrackContents +{ + public class GetPageTrackContentInput : PageInfoInput + { + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 关键字 + /// + public string Keywords { get; set; } + } + + public class GetTrackContentListDto + { + /// + /// Id + /// + public int Id { get; set; } + + /// + /// 子系统 + /// + public string SubSystem { get; set; } + + /// + /// 轨迹内容代码 + /// + public string Code { get; set; } + + /// + /// 轨迹内容 + /// + public string Content { get; set; } + + /// + /// 轨迹内容英文 + /// + public string EnContent { get; set; } + + /// + /// 所属状态 + /// + public string TrackStatus { get; set; } + + /// + /// 所属节点 + /// + public string Node { get; set; } + + /// + /// 轨迹标记 + /// + public string TrackFlag { get; set; } + + /// + /// 创建时间 + /// + public DateTime? CreateTime { get; set; } + + /// + /// 创建人 + /// + public string CreateUser { get; set; } + + /// + /// 修改时间 + /// + public DateTime? UpdateTime { get; set; } + + /// + /// 修改人 + /// + public string UpdateUser { get; set; } + } +} diff --git a/src/SJZY.Track.Application/Services/TrackContents/ITrackContentService.cs b/src/SJZY.Track.Application/Services/TrackContents/ITrackContentService.cs new file mode 100644 index 00000000..8747af44 --- /dev/null +++ b/src/SJZY.Track.Application/Services/TrackContents/ITrackContentService.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SJZY.Track.Application.Services.TrackContents +{ + public interface ITrackContentService + { + + } +} diff --git a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs new file mode 100644 index 00000000..fb7bacb5 --- /dev/null +++ b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs @@ -0,0 +1,108 @@ +using SJZY.Track.Application.Dtos.TrackContents; +using SJZY.Track.Application.Dtos.TrackStatus; +using SJZY.Track.Domain.Aggregates.TrackContentAggregate; +using SJZY.Track.Domain.Dtos.TrackContents; +using SJZY.Track.Domain.Dtos.TrackStatus; +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.TrackContents +{ + /// + /// 轨迹内容服务 + /// + [ApiExplorerSettings(GroupName = "轨迹内容")] + [Route("/Track/Content")] + public class TrackContentService : ApplicationService, ITransientDependency + { + private readonly ITrackContentRepository _trackContentRepository; + + public TrackContentService( + ITrackContentRepository trackContentRepository + ) + { + this._trackContentRepository=trackContentRepository; + } + + /// + /// 轨迹内容编辑 + /// + /// + [HttpPost("Edit")] + public async Task EditAsync(EditTrackContentInput input) + { + return input.Options switch + { + OptionType.新增 => await AddAsync(input), + OptionType.修改 => await UpdateAsync(input), + OptionType.删除 => await DeleteAsync(input), + _ => throw new BusinessException(message: "当前操作动作不合法") + }; + } + + /// + /// 根据内容id获取轨迹内容 + /// + /// + /// + [HttpGet("GetDetail")] + public async Task> GetDetailAsync(int id) + { + var detailInfo = await _trackContentRepository.GetDetailAsync(id); + if (detailInfo == null) + { + return new UnifyResultDto(false, null, "未查询到轨迹状态"); + } + + var dto = ObjectMapper.Map(detailInfo); + return new UnifyResultDto("200", "", dto); + } + + /// + /// 获取分页轨迹内容 + /// + /// + /// + [HttpPost("GetList")] + public async Task> GetPageTrackContent(GetPageTrackContentInput input) + { + var vo = ObjectMapper.Map(input); + var resultDto = await _trackContentRepository.GetPageTrackContent(vo); + var pageResultDto = + ObjectMapper.Map, UnifyPageResultDto>( + resultDto); + + return pageResultDto; + } + + #region 私有方法 + private async Task AddAsync(EditTrackContentInput input) + { + var entity = ObjectMapper.Map(input); + var isTrue = await _trackContentRepository.InsertAsync(entity); + + return new UnifyResultDto("200", "新增成功", isTrue); + } + + private async Task UpdateAsync(EditTrackContentInput input) + { + var templateEntity = await _trackContentRepository.GetFirstAsync(a => a.Id == input.Id); + ObjectMapper.Map(input, templateEntity); + var isTrue = await _trackContentRepository.UpdateAsync(templateEntity); + + return new UnifyResultDto("200", "修改成功", isTrue); + } + + private async Task DeleteAsync(EditTrackContentInput input) + { + var isTrue = await _trackContentRepository.SoftDeleteAsync(x => x.Id == input.Id); + + return new UnifyResultDto("200", "删除成功", isTrue); + } + #endregion + } +} diff --git a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs index acf14311..9db46c6f 100644 --- a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs +++ b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs @@ -1,6 +1,7 @@ using SJZY.Track.Application.Dtos.TrackStatus; using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; using SJZY.Track.Domain.Dtos.TrackStatus; +using Volo.Abp.DependencyInjection; namespace SJZY.Track.Application.Services.TrackStatus; @@ -9,7 +10,7 @@ namespace SJZY.Track.Application.Services.TrackStatus; /// [ApiExplorerSettings(GroupName = "轨迹状态")] [Route("/Track/Status")] -public class TrackStatusService : ApplicationService +public class TrackStatusService : ApplicationService, ITransientDependency { private readonly ITrackStatusRepository _trackStatusRepository; diff --git a/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs index b343163b..fbd0e412 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs @@ -1,5 +1,10 @@ -namespace SJZY.Track.Domain.Aggregates.TrackContentAggregate; +using SJZY.Track.Domain.Dtos.TrackContents; +using SJZY.Track.Domain.Dtos.TrackStatus; + +namespace SJZY.Track.Domain.Aggregates.TrackContentAggregate; public interface ITrackContentRepository : IBasicRepository { + Task GetDetailAsync(int id); + Task> GetPageTrackContent(GetPageTrackContentVO input); } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackContents/GetPageTrackContentVO.cs b/src/SJZY.Track.Domain/Dtos/TrackContents/GetPageTrackContentVO.cs new file mode 100644 index 00000000..f093836d --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackContents/GetPageTrackContentVO.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SJZY.Track.Domain.Dtos.TrackContents +{ + public class GetPageTrackContentVO : PageInfoInput + { + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 关键字 + /// + public string Keywords { get; set; } + } + + public class GetTrackContentListVO + { + /// + /// Id + /// + public int Id { get; set; } + + /// + /// 子系统 + /// + public string SubSystem { get; set; } + + /// + /// 轨迹内容代码 + /// + public string Code { get; set; } + + /// + /// 轨迹内容 + /// + public string Content { get; set; } + + /// + /// 轨迹内容英文 + /// + public string EnContent { get; set; } + + /// + /// 所属状态 + /// + public string TrackStatus { get; set; } + + /// + /// 所属节点 + /// + public string Node { get; set; } + + /// + /// 轨迹标记 + /// + public string TrackFlag { get; set; } + + /// + /// 创建时间 + /// + public DateTime? CreateTime { get; set; } + + /// + /// 创建人 + /// + public string CreateUser { get; set; } + + /// + /// 修改时间 + /// + public DateTime? UpdateTime { get; set; } + + /// + /// 修改人 + /// + public string UpdateUser { get; set; } + } +} diff --git a/src/SJZY.Track.Domain/Dtos/TrackContents/GetTrackContentDetailVO.cs b/src/SJZY.Track.Domain/Dtos/TrackContents/GetTrackContentDetailVO.cs new file mode 100644 index 00000000..b58df450 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackContents/GetTrackContentDetailVO.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SJZY.Track.Domain.Dtos.TrackContents +{ + public class GetTrackContentDetailVO + { + /// + /// Id + /// + public int Id { get; set; } + + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 子系统 + /// + public string SubSystem { get; set; } + + /// + /// 所属轨迹状态id + /// + public int TrackStatusId { get; set; } + + /// + /// 所属轨迹状态 + /// + public string TrackStatus { get; set; } + + /// + /// 轨迹内容代码 + /// + public string Code { get; set; } + + /// + /// 轨迹内容 + /// + public string Content { get; set; } + + /// + /// 轨迹内容英文 + /// + public string EnContent { get; set; } + + /// + /// 轨迹标记id + /// + public int TrackFlagId { get; set; } + + /// + /// 轨迹标记 + /// + public string TrackFlag { get; set; } + } +} diff --git a/src/SJZY.Track.Domain/Dtos/TrackStatus/GetTrackStatusListVO.cs b/src/SJZY.Track.Domain/Dtos/TrackStatus/GetTrackStatusListVO.cs index 38a75ed0..ff570fc0 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackStatus/GetTrackStatusListVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackStatus/GetTrackStatusListVO.cs @@ -1,54 +1,67 @@ -namespace SJZY.Track.Domain.Dtos.TrackStatus; +using SJZY.Expand.ABP.Core.PublicMethords; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; -public class GetTrackStatusListVO +namespace SJZY.Track.Domain.Dtos.TrackStatus { - /// - /// Id - /// - public int Id { get; set; } + public class GetTrackStatusListVO + { + /// + /// Id + /// + public int Id { get; set; } - /// - /// 子系统 - /// - public string SubSystem { get; set; } + /// + /// 子系统 + /// + public string SubSystem { get; set; } - /// - /// 所属节点 - /// - public string Node { get; set; } + /// + /// 节点id + /// + public int NodeId { get; set; } - /// - /// 所属轨迹状态 - /// - public string TrackStatus { get; set; } + /// + /// 所属节点 + /// + public string Node { get; set; } - /// - /// 轨迹状态代码 - /// - public string Code { get; set; } + /// + /// 所属轨迹状态 + /// + public string TrackStatus { get; set; } - /// - /// 轨迹内容英文 - /// - public string EntrackStatus { get; set; } + /// + /// 轨迹状态代码 + /// + public string Code { get; set; } - /// - /// 创建人 - /// - public string CreateUser { get; set; } + /// + /// 轨迹内容英文 + /// + public string EntrackStatus { get; set; } - /// - /// 创建时间 - /// - public DateTime? CreateTime { get; set; } + /// + /// 创建人 + /// + public string CreateUser { get; set; } - /// - /// 修改人 - /// - public string UpdateUser { get; set; } + /// + /// 创建时间 + /// + public DateTime? CreateTime { get; set; } - /// - /// 修改时间 - /// - public DateTime? UpdateTime { get; set; } -} \ No newline at end of file + /// + /// 修改人 + /// + public string UpdateUser { get; set; } + + /// + /// 修改时间 + /// + public DateTime? UpdateTime { get; set; } + } +} diff --git a/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj b/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj index b40c78be..aac0e12d 100644 --- a/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj +++ b/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj @@ -1,4 +1,4 @@ - + @@ -12,7 +12,7 @@ - + diff --git a/src/SJZY.Track.Repository/TrackContentRepository.cs b/src/SJZY.Track.Repository/TrackContentRepository.cs index 1bf04097..1671ac80 100644 --- a/src/SJZY.Track.Repository/TrackContentRepository.cs +++ b/src/SJZY.Track.Repository/TrackContentRepository.cs @@ -1,7 +1,80 @@ using SJZY.Track.Domain.Aggregates.TrackContentAggregate; +using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; +using SJZY.Track.Domain.Dtos.TrackContents; +using SJZY.Track.Domain.Dtos.TrackStatus; +using SJZY.Track.Domain.VEntities; namespace SJZY.Track.Repository; public class TrackContentRepository : BasicRepository, ITrackContentRepository, IScopedDependency { + + public TrackContentRepository() + { + + } + + /// + /// 获取轨迹内容明细 + /// + /// + /// + public async Task GetDetailAsync(int id) + { + var detail = await Context.Queryable() + .LeftJoin((a, b) => a.SubSystemId == b.Id) + .Where((a, b) => a.Id == id) + .Select((a, b) => new GetTrackContentDetailVO + { + Id = a.Id, + SubSystemId = a.SubSystemId, + SubSystem = b.CnName, + TrackStatusId=a.TrackStatusId, + TrackStatus= "", + Code = a.Code, + Content = a.Content, + EnContent = a.EnContent, + TrackFlagId=a.TrackFlagId, + TrackFlag="" + }) + .FirstAsync(); + return detail; + } + + /// + /// 分页获取轨迹内容 + /// + /// + /// + public async Task> GetPageTrackContent(GetPageTrackContentVO input) + { + UnifyPageResultDto pagedList = new UnifyPageResultDto(); + pagedList = await Context.Queryable() + .LeftJoin((a, b) => a.SubSystemId == b.Id) + .LeftJoin((a, b, c) => a.CreateUserId == c.Id) + .LeftJoin((a, b, c, d) => a.UpdateUserId == d.Id) + .WhereIF(input.SubSystemId > 0, (a, b, c, d) => a.SubSystemId == input.SubSystemId) + .WhereIF(!input.Keywords.IsNullOrWhiteSpace(), + (a, b, c, d) => a.Code.Contains(input.Keywords) + ) + .Select((a, b, c, d) => new GetTrackContentListVO + { + Id = a.Id, + SubSystem = b.CnName, + Code = a.Code, + Content = a.Content, + EnContent = a.EnContent, + TrackStatus= "", + Node = "", + TrackFlag= "", + CreateTime = a.CreateTime, + CreateUser = c.Name, + UpdateTime = a.UpdateTime, + UpdateUser = d.Name, + + }) + .ToPagedListAsync(input.PageIndex, input.PageSize); + + return pagedList; + } } \ No newline at end of file