From 500b4be531dafe07588d7e322edfabbb35fab523 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Thu, 29 Feb 2024 16:35:18 +0800 Subject: [PATCH 01/16] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=EF=BC=8Ckeywords=E5=8F=82=E6=95=B0=E9=BB=98=E8=AE=A4=E4=BC=A0?= =?UTF-8?q?=20""=20=E7=A9=BA=E5=AD=97=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProvideServices/GetPageTrackOrderInput.cs | 29 +++++++++++++++++++ .../TrackContents/GetPageTrackContentInput.cs | 4 +-- .../Dtos/TrackStatus/GetTrackStatusListDto.cs | 4 +-- .../GetPageTrackTemplateInput.cs | 4 +-- .../Services/ProvideServices/OrderService.cs | 4 ++- .../OrderAggregate/IOrderRepository.cs | 8 +++++ .../Dtos/Order/GetOrderDetailsInputVO.cs | 18 ++++++++++++ .../Dtos/Order/GetPageTrackOrderInputVO.cs | 21 ++++++++++++++ src/SJZY.Track.Repository/OrderRepository.cs | 29 ++++++++++++++++++- 9 files changed, 113 insertions(+), 8 deletions(-) create mode 100644 src/SJZY.Track.Domain/Dtos/Order/GetOrderDetailsInputVO.cs create mode 100644 src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs index 62a1bdb2..e2fb21f2 100644 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs +++ b/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs @@ -8,7 +8,25 @@ namespace SJZY.Track.Application.Dtos.ProvideServices { public class GetPageTrackOrderInput : PageInfoInput { + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + /// + /// 单号 + /// + public List OrderNos { get; set; } + + /// + /// 创建时间开始 + /// + public DateTime? CreateTimeStart { get; set; } + + /// + /// 创建时间截止 + /// + public DateTime? createTimeEnd { get; set; } } /// @@ -16,6 +34,17 @@ namespace SJZY.Track.Application.Dtos.ProvideServices /// public class TrackOrderDto { + /// + /// 轨迹订单id + /// + public int Id { get; set; } + /// + /// 订单类型 + /// + public string OrderType { get; set; } + + + public string OrderNumber { get; set; } } } diff --git a/src/SJZY.Track.Application/Dtos/TrackContents/GetPageTrackContentInput.cs b/src/SJZY.Track.Application/Dtos/TrackContents/GetPageTrackContentInput.cs index a494d030..7a009ccb 100644 --- a/src/SJZY.Track.Application/Dtos/TrackContents/GetPageTrackContentInput.cs +++ b/src/SJZY.Track.Application/Dtos/TrackContents/GetPageTrackContentInput.cs @@ -15,8 +15,8 @@ namespace SJZY.Track.Application.Dtos.TrackContents /// /// 关键字 - /// - public string Keywords { get; set; } + /// + public string Keywords { get; set; } = ""; } public class GetTrackContentListDto diff --git a/src/SJZY.Track.Application/Dtos/TrackStatus/GetTrackStatusListDto.cs b/src/SJZY.Track.Application/Dtos/TrackStatus/GetTrackStatusListDto.cs index ec218c97..ecdb123d 100644 --- a/src/SJZY.Track.Application/Dtos/TrackStatus/GetTrackStatusListDto.cs +++ b/src/SJZY.Track.Application/Dtos/TrackStatus/GetTrackStatusListDto.cs @@ -65,11 +65,11 @@ namespace SJZY.Track.Application.Dtos.TrackStatus /// /// 子系统id /// - public int SubSystemId { get; set; } + public int SubSystemId { get; set; } /// /// 关键字 /// - public string Keywords { get; set; } + public string Keywords { get; set; } = ""; } } diff --git a/src/SJZY.Track.Application/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs b/src/SJZY.Track.Application/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs index 357784df..3be009ac 100644 --- a/src/SJZY.Track.Application/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs +++ b/src/SJZY.Track.Application/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs @@ -13,8 +13,8 @@ /// /// 关键字 /// - public string Keywords { get; set; } - + public string Keywords { get; set; } = ""; + /// /// 轨迹模版id,轨迹映射的查询使用 /// diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs index 7381144c..55560ce6 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs @@ -79,13 +79,15 @@ public class OrderService : ApplicationService #region 轨迹订单列表 /// - /// + /// 获取分页的轨迹订单 /// /// /// [HttpPost("/Order/GetTrackOrderList")] public async Task> GetPageTrackOrder(GetPageTrackOrderInput input) { + + return null; } #endregion diff --git a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs index e076b731..ded90121 100644 --- a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs @@ -10,6 +10,7 @@ public interface IOrderRepository : IBasicRepository /// /// Task CreateOrderAsync(OrderEntity order); + Task> GetOrderDetails(GetOrderDetailsInputVO input); /// /// 根据订单号,获取订单模板 @@ -19,6 +20,13 @@ public interface IOrderRepository : IBasicRepository /// Task> GetOrderTemplatesAsync(int orderType, List distinctOrderNumbers); + /// + /// 获取分页的轨迹订单 + /// + /// + /// + Task> GetPageTrackOrder(GetPageTrackOrderInputVO input); + /// /// 关联订单 /// diff --git a/src/SJZY.Track.Domain/Dtos/Order/GetOrderDetailsInputVO.cs b/src/SJZY.Track.Domain/Dtos/Order/GetOrderDetailsInputVO.cs new file mode 100644 index 00000000..082b245a --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/Order/GetOrderDetailsInputVO.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SJZY.Track.Domain.Dtos.Order +{ + public class GetOrderDetailsInputVO + { + + } + + public class TrackOrderDetailVO + { + + } +} diff --git a/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs b/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs new file mode 100644 index 00000000..882f2db8 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SJZY.Track.Domain.Dtos.Order +{ + public class GetPageTrackOrderInputVO + { + + } + + /// + /// 轨迹订单VO + /// + public class TrackOrderVO + { + + } +} diff --git a/src/SJZY.Track.Repository/OrderRepository.cs b/src/SJZY.Track.Repository/OrderRepository.cs index 645fb94b..303a6c5b 100644 --- a/src/SJZY.Track.Repository/OrderRepository.cs +++ b/src/SJZY.Track.Repository/OrderRepository.cs @@ -1,4 +1,5 @@ -using SJZY.Track.Domain; +using Microsoft.AspNetCore.Mvc; +using SJZY.Track.Domain; using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.Track.Domain.Dtos.Order; @@ -57,4 +58,30 @@ public class OrderRepository : BasicRepository, IOrderRepository, I tran.Complete(); } + + #region 轨迹订单明细 + + /// + /// 根据轨迹订单id获取轨迹明细列表 + /// + /// + /// + public async Task> GetOrderDetails(GetOrderDetailsInputVO input) + { + return null; + } + #endregion + + #region 轨迹订单分页 + /// + /// 获取分页的轨迹订单 + /// + /// + /// + public async Task> GetPageTrackOrder(GetPageTrackOrderInputVO input) + { + + return null; + } + #endregion } \ No newline at end of file From 95dee9ec69e49fa4897785f5c922e3dfa867d068 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Thu, 29 Feb 2024 17:18:10 +0800 Subject: [PATCH 02/16] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E5=AD=90=E7=B3=BB=E7=BB=9F=E5=90=8D=E7=A7=B0=E8=81=94=E8=A1=A8?= =?UTF-8?q?=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SJZY.Track.Repository/OrderRepository.cs | 1 + src/SJZY.Track.Repository/TrackContentRepository.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SJZY.Track.Repository/OrderRepository.cs b/src/SJZY.Track.Repository/OrderRepository.cs index 303a6c5b..ae51a536 100644 --- a/src/SJZY.Track.Repository/OrderRepository.cs +++ b/src/SJZY.Track.Repository/OrderRepository.cs @@ -80,6 +80,7 @@ public class OrderRepository : BasicRepository, IOrderRepository, I /// public async Task> GetPageTrackOrder(GetPageTrackOrderInputVO input) { + //await Context.Queryable((a,b)= ); return null; } diff --git a/src/SJZY.Track.Repository/TrackContentRepository.cs b/src/SJZY.Track.Repository/TrackContentRepository.cs index 32ebd92d..896d02d4 100644 --- a/src/SJZY.Track.Repository/TrackContentRepository.cs +++ b/src/SJZY.Track.Repository/TrackContentRepository.cs @@ -25,7 +25,7 @@ public class TrackContentRepository : BasicRepository, ITrac var detail = await Context.Queryable() .LeftJoin((a, b) => a.TrackStatusId==b.Id) .LeftJoin((a, b, c) => a.TrackFlagId==c.Id) - .LeftJoin((a, b, c, d) => a.SubSystemId == b.Id) + .LeftJoin((a, b, c, d) => a.SubSystemId == d.Id) .Where((a, b, c, d) => a.Id == id) .Select((a, b, c, d) => new GetTrackContentDetailVO { From 812546bfa344948802dc93cfb7d42338135cbe25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Thu, 29 Feb 2024 17:22:13 +0800 Subject: [PATCH 03/16] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E6=8B=89=E5=8F=96=E9=85=8D=E7=BD=AE=E7=BC=96=E8=BE=91=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutoMapper/TrackPullAutoMapperProfile.cs | 17 +++ .../TrackPull/EditTrackPullConfigInput.cs | 71 ++++++++++ .../Services/TrackPull/TrackPullService.cs | 122 +++++++++++++++++- .../ITrackPullConfigRepository.cs | 12 ++ .../ITrackTemplateRepository.cs | 2 + .../TrackPullConfigRepository.cs | 37 ++++++ .../TrackTemplateRepository.cs | 5 + 7 files changed, 265 insertions(+), 1 deletion(-) create mode 100644 src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs create mode 100644 src/SJZY.Track.Application/Dtos/TrackPull/EditTrackPullConfigInput.cs diff --git a/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs new file mode 100644 index 00000000..15d39d05 --- /dev/null +++ b/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs @@ -0,0 +1,17 @@ +using AutoMapper; +using SJZY.Track.Application.Dtos.TrackPull; +using SJZY.Track.Domain.Aggregates.TrackPullAggregate; +using Volo.Abp.AutoMapper; + +namespace SJZY.Track.Application.AutoMapper +{ + public class TrackPullAutoMapperProfile : Profile + { + public TrackPullAutoMapperProfile() + { + CreateMap(MemberList.None); + CreateMap(MemberList.None).Ignore(dest => dest.Id) + .ForMember(dest => dest.IsPush, opt => opt.MapFrom(source => false)); + } + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/TrackPull/EditTrackPullConfigInput.cs b/src/SJZY.Track.Application/Dtos/TrackPull/EditTrackPullConfigInput.cs new file mode 100644 index 00000000..71fe55cf --- /dev/null +++ b/src/SJZY.Track.Application/Dtos/TrackPull/EditTrackPullConfigInput.cs @@ -0,0 +1,71 @@ +namespace SJZY.Track.Application.Dtos.TrackPull; + +public class EditTrackPullConfigInput +{ + public int? Id { get; set; } + + /// + /// 操作类型 + /// + public OptionTypeNoNull Options { get; set; } + + /// + /// 拉取轨迹订单号 + /// + public string OrderNoName { get; set; } + + /// + /// 返参解析对象 + /// + public int ParseMethod { get; set; } + + /// + /// 定时任务(分钟) + /// + public int PullInterval { get; set; } + + /// + /// 服务商id + /// + public int ServiceProviderId { get; set; } + + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 拉取轨迹时区 + /// + public string TackTimeZoneName { get; set; } + + /// + /// 拉取轨迹内容代码 + /// + public string TrackContentCodeName { get; set; } + + /// + /// 拉取轨迹内容 + /// + public string TrackContentName { get; set; } + + /// + /// 拉取轨迹发生地 + /// + public string TrackPlaceName { get; set; } + + /// + /// 拉取轨迹状态 + /// + public string TrackStatusName { get; set; } + + /// + /// 轨迹模板id + /// + public int TrackTemplateId { get; set; } + + /// + /// 拉取轨迹发生时间 + /// + public string TrackTimeName { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs index 004198e0..646e439b 100644 --- a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs +++ b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs @@ -1,8 +1,14 @@ using Microsoft.Extensions.Localization; +using SJZY.Expand.ABP.Core.Localization; +using SJZY.Expand.ABP.Core.PublicMethords; +using SJZY.Track.Application.Dtos.TrackPull; +using SJZY.Track.Application.Dtos.TrackTemplates; using SJZY.Track.Application.Localization; using SJZY.Track.Domain.Aggregates.TrackPullAggregate; +using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; using SJZY.Track.Domain.Dtos.Common; using SJZY.Track.Domain.Dtos.TrackPull; +using System.Linq.Expressions; using Volo.Abp.DependencyInjection; namespace SJZY.Track.Application.Services.TrackPull; @@ -16,13 +22,16 @@ public class TrackPullService : ApplicationService, ITransientDependency { private readonly IStringLocalizer _stringLocalizer; private readonly ITrackPullConfigRepository _trackPullConfigRepository; + private readonly ITrackTemplateRepository _trackTemplateRepository; public TrackPullService( IStringLocalizer stringLocalizer, - ITrackPullConfigRepository trackPullConfigRepository) + ITrackPullConfigRepository trackPullConfigRepository, + ITrackTemplateRepository trackTemplateRepository) { _stringLocalizer = stringLocalizer; _trackPullConfigRepository = trackPullConfigRepository; + _trackTemplateRepository = trackTemplateRepository; } /// @@ -68,4 +77,115 @@ public class TrackPullService : ApplicationService, ITransientDependency { return await _trackPullConfigRepository.GetContentDetailAsync(id); } + + /// + /// 轨迹拉取配置编辑 + /// + /// + /// + [HttpPost("Edit")] + public async Task EditAsync([FromBody] EditTrackPullConfigInput input) + { + if (input.Options != OptionTypeNoNull.删除) + { + Expression> isAnyExp = x => + x.SubSystemId == input.SubSystemId && x.TrackTemplateId == input.TrackTemplateId && x.ServiceProviderId == input.ServiceProviderId; + if (input.Options == OptionTypeNoNull.修改) isAnyExp.And(x => x.Id != input.Id); + + if (await _trackPullConfigRepository.IsAnyAsync(isAnyExp)) + throw new BusinessException(message: _stringLocalizer["IsTrackPullConfigAny"]); + } + + switch (input.Options) + { + case OptionTypeNoNull.新增: + { + var trackPullEntity = ObjectMapper.Map(input); + var trackPullParamsEntity = ObjectMapper.Map(input); + + var trackTemplateContentEntities = await _trackTemplateRepository.GetContentListAsync(x => x.TrackTemplateId == input.TrackTemplateId); + + var trackPullContentEntities = new List(); + + using (var ts = TransactionScopeHelper.Create()) + { + int id = await _trackPullConfigRepository.InsertReturnIdentityAsync(trackPullEntity); + + trackPullParamsEntity.PullOrPushConfigId = id; + await _trackPullConfigRepository.InsertParamsAsync(trackPullParamsEntity); + + foreach (var item in trackTemplateContentEntities) + { + trackPullContentEntities.Add(new() + { + TrackPullConfigId = id, + TrackContentId = item.TrackContentId + }); + } + await _trackPullConfigRepository.InsertContentRangeAsync(trackPullContentEntities); + + ts.Complete(); + } + } + break; + + case OptionTypeNoNull.修改: + { + var oldTrackPullEntity = await _trackPullConfigRepository.GetFirstAsync(x => x.Id == input.Id) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]); + + var oldTrackPullParamsEntity = await _trackPullConfigRepository.GetParamsSingleAsync(x => x.PullOrPushConfigId == input.Id && !x.IsPush); + + var trackPullContentEntities = new List(); + + if (oldTrackPullEntity.TrackTemplateId != input.TrackTemplateId) + { + var trackTemplateContentEntities = await _trackTemplateRepository.GetContentListAsync(x => x.TrackTemplateId == input.TrackTemplateId); + + foreach (var item in trackTemplateContentEntities) + { + trackPullContentEntities.Add(new() + { + TrackPullConfigId = oldTrackPullEntity.Id, + TrackContentId = item.TrackContentId + }); + } + } + + ObjectMapper.Map(input, oldTrackPullEntity); + ObjectMapper.Map(input, oldTrackPullParamsEntity); + + using (var ts = TransactionScopeHelper.Create()) + { + await _trackPullConfigRepository.UpdateAsync(oldTrackPullEntity); + await _trackPullConfigRepository.UpdateParamsAsync(oldTrackPullParamsEntity); + + if (oldTrackPullEntity.TrackTemplateId != input.TrackTemplateId) + { + await _trackPullConfigRepository.SoftDeleteContentAsync(x => x.TrackPullConfigId == input.Id); + await _trackPullConfigRepository.InsertContentRangeAsync(trackPullContentEntities); + } + + ts.Complete(); + } + } + break; + + case OptionTypeNoNull.删除: + using (var ts = TransactionScopeHelper.Create()) + { + await _trackPullConfigRepository.SoftDeleteAsync(x => x.Id == input.Id); + await _trackPullConfigRepository.SoftDeleteParamsAsync(x => x.PullOrPushConfigId == input.Id && !x.IsPush); + await _trackPullConfigRepository.SoftDeleteContentAsync(x => x.TrackPullConfigId == input.Id); + + ts.Complete(); + } + break; + + default: + throw new BusinessException(message: _stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum, + nameof(EditTrackPullConfigInput.Options)]); + } + + return true; + } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs index 6de7445c..3d34310a 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs @@ -32,4 +32,16 @@ public interface ITrackPullConfigRepository : IBasicRepository /// Task GetContentDetailAsync(int id); + + Task InsertParamsAsync(TrackPushPullParamsConfigEntity insertObj); + + Task InsertContentRangeAsync(List insertObjs); + + Task GetParamsSingleAsync(Expression> whereExpression); + + Task UpdateParamsAsync(TrackPushPullParamsConfigEntity updateObj); + + Task SoftDeleteContentAsync(Expression> whereExpression); + + Task SoftDeleteParamsAsync(Expression> whereExpression); } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs index ac26857b..cbc2ccf3 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs @@ -34,4 +34,6 @@ public interface ITrackTemplateRepository : IBasicRepository UpdateContentAsync(TrackTemplateContentEntity updateObj); Task SoftDeleteContentAsync(int id); + + Task> GetContentListAsync(Expression> whereExpression); } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs index 8965f22a..564cb0f3 100644 --- a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs +++ b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs @@ -4,6 +4,7 @@ using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; using SJZY.Track.Domain.Dtos.Common; using SJZY.Track.Domain.Dtos.TrackPull; using SJZY.Track.Domain.VEntities; +using System.Linq.Expressions; namespace SJZY.Track.Repository; @@ -83,4 +84,40 @@ public class TrackPullConfigRepository : BasicRepository, }, true) .SingleAsync(); } + + public async Task InsertParamsAsync(TrackPushPullParamsConfigEntity insertObj) + { + return await Context.Insertable(insertObj).ExecuteCommandAsync() > 0; + } + + public async Task InsertContentRangeAsync(List insertObjs) + { + return await Context.Insertable(insertObjs).ExecuteCommandAsync() > 0; + } + + public async Task GetParamsSingleAsync(Expression> whereExpression) + { + return await Context.Queryable().SingleAsync(whereExpression); + } + + public async Task UpdateParamsAsync(TrackPushPullParamsConfigEntity updateObj) + { + return await Context.Updateable(updateObj).ExecuteCommandHasChangeAsync(); + } + + public async Task SoftDeleteContentAsync(Expression> whereExpression) + { + return await Context.Updateable() + .Where(whereExpression) + .SetColumns(nameof(ISoftDeleteBasicEntity.IsDeleted), true) + .ExecuteCommandHasChangeAsync(); + } + + public async Task SoftDeleteParamsAsync(Expression> whereExpression) + { + return await Context.Updateable() + .Where(whereExpression) + .SetColumns(nameof(ISoftDeleteBasicEntity.IsDeleted), true) + .ExecuteCommandHasChangeAsync(); + } } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/TrackTemplateRepository.cs index ee2ee76f..f8659624 100644 --- a/src/SJZY.Track.Repository/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/TrackTemplateRepository.cs @@ -157,4 +157,9 @@ public class TrackTemplateRepository : BasicRepository, ITr .SetColumns(nameof(ISoftDeleteBasicEntity.IsDeleted), true) .ExecuteCommandHasChangeAsync(); } + + public async Task> GetContentListAsync(Expression> whereExpression) + { + return await Context.Queryable().Where(whereExpression).ToListAsync(); + } } \ No newline at end of file From dba6172aab73afd8ce0d46d2e2f26a4c07c87967 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Thu, 29 Feb 2024 17:24:58 +0800 Subject: [PATCH 04/16] =?UTF-8?q?=E8=BF=98=E5=8E=9F=E8=AF=AD=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SJZY.Track.Repository/TrackPullConfigRepository.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs index 564cb0f3..058146bd 100644 --- a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs +++ b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs @@ -47,8 +47,8 @@ public class TrackPullConfigRepository : BasicRepository, }, true) .Mapper(x => { - x.TrackKeywords = [.. x.TrackKeyword.Split(',')]; - x.TrackKeywordsReverse = [.. x.TrackKeywordReverse.Split(',')]; + x.TrackKeywords = x.TrackKeyword.Split(',').ToList(); + x.TrackKeywordsReverse = x.TrackKeywordReverse.Split(',').ToList(); }) .ToPagedListAsync(input.PageIndex, input.PageSize); } From 5ddfaf5ec34521d914bdf374086513b8e4353a23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Thu, 29 Feb 2024 17:46:14 +0800 Subject: [PATCH 05/16] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E6=8B=89=E5=8F=96=E9=85=8D=E7=BD=AE=E5=86=85=E5=AE=B9=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutoMapper/TrackPullAutoMapperProfile.cs | 1 + .../TrackPull/UpdateTrackPullContentInput.cs | 51 +++++++++++++++++++ .../Services/TrackPull/TrackPullService.cs | 17 +++++++ .../ITrackPullConfigRepository.cs | 4 ++ .../TrackPullConfigRepository.cs | 10 ++++ 5 files changed, 83 insertions(+) create mode 100644 src/SJZY.Track.Application/Dtos/TrackPull/UpdateTrackPullContentInput.cs diff --git a/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs index 15d39d05..3577eceb 100644 --- a/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs @@ -12,6 +12,7 @@ namespace SJZY.Track.Application.AutoMapper CreateMap(MemberList.None); CreateMap(MemberList.None).Ignore(dest => dest.Id) .ForMember(dest => dest.IsPush, opt => opt.MapFrom(source => false)); + CreateMap(MemberList.None); } } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/TrackPull/UpdateTrackPullContentInput.cs b/src/SJZY.Track.Application/Dtos/TrackPull/UpdateTrackPullContentInput.cs new file mode 100644 index 00000000..74a54567 --- /dev/null +++ b/src/SJZY.Track.Application/Dtos/TrackPull/UpdateTrackPullContentInput.cs @@ -0,0 +1,51 @@ +namespace SJZY.Track.Application.Dtos.TrackPull; + +public class UpdateTrackPullContentInput +{ + public int Id { get; set; } + + /// + /// 服务商轨迹代码参数值 + /// + public string TrackContentCodeValue { get; set; } + + /// + /// 轨迹内容id + /// + public int TrackContentId { get; set; } + + /// + /// 服务商轨迹内容参数值 + /// + public string TrackContentValue { get; set; } + + /// + /// 轨迹关键词(正向) + /// + public string TrackKeyword { get; set; } + + /// + /// 轨迹关键词(反向) + /// + public string TrackKeywordReverse { get; set; } + + /// + /// 轨迹发生地参数值 + /// + public int? TrackPlaceValue { get; set; } + + /// + /// 轨迹拉取配置id + /// + public int TrackPullConfigId { get; set; } + + /// + /// 服务商轨迹状态参数值 + /// + public string TrackStatusValue { get; set; } + + /// + /// 轨迹时区GMT + /// + public string TrackTimeZone { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs index 646e439b..f76abe50 100644 --- a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs +++ b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs @@ -188,4 +188,21 @@ public class TrackPullService : ApplicationService, ITransientDependency return true; } + + /// + /// 轨迹拉取配置内容修改 + /// + /// + /// + [HttpPost("UpdateContent")] + public async Task UpdateContentAsync([FromBody] UpdateTrackPullContentInput input) + { + var oldTrackPullContentEntity = await _trackPullConfigRepository.GetContentByIdAsync(input.Id) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]); + + ObjectMapper.Map(input, oldTrackPullContentEntity); + + await _trackPullConfigRepository.UpdateContentAsync(oldTrackPullContentEntity); + + return true; + } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs index 3d34310a..c7a36732 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs @@ -44,4 +44,8 @@ public interface ITrackPullConfigRepository : IBasicRepository SoftDeleteContentAsync(Expression> whereExpression); Task SoftDeleteParamsAsync(Expression> whereExpression); + + Task GetContentByIdAsync(int id); + + Task UpdateContentAsync(TrackPullContentConfigEntity updateObj); } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs index 058146bd..dbcb40be 100644 --- a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs +++ b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs @@ -120,4 +120,14 @@ public class TrackPullConfigRepository : BasicRepository, .SetColumns(nameof(ISoftDeleteBasicEntity.IsDeleted), true) .ExecuteCommandHasChangeAsync(); } + + public async Task GetContentByIdAsync(int id) + { + return await Context.Queryable().InSingleAsync(id); + } + + public async Task UpdateContentAsync(TrackPullContentConfigEntity updateObj) + { + return await Context.Updateable(updateObj).ExecuteCommandHasChangeAsync(); + } } \ No newline at end of file From 57749fc32e6b053376dd3a4435569912b0b23e64 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Thu, 29 Feb 2024 18:33:43 +0800 Subject: [PATCH 06/16] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8E=88=E6=9D=83?= =?UTF-8?q?=E6=8B=A6=E6=88=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SJZY.Track.Application/ApplicationModule.cs | 9 ++++++++- .../Services/TrackStatus/TrackStatusService.cs | 3 ++- .../Services/TrackTemplates/TrackTemplateService.cs | 1 + src/SJZY.Track.Repository/OrderRepository.cs | 1 + 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/SJZY.Track.Application/ApplicationModule.cs b/src/SJZY.Track.Application/ApplicationModule.cs index ba3bc813..94127ff2 100644 --- a/src/SJZY.Track.Application/ApplicationModule.cs +++ b/src/SJZY.Track.Application/ApplicationModule.cs @@ -2,6 +2,7 @@ using SJZY.Track.Application.Localization; using SJZY.UserCenter.Contracts; using SJZY.UserCenter.SharedModel; +using SJZY.UserCenter.SharedModel.Pub; using Volo.Abp.AspNetCore.Mvc; using Volo.Abp.AutoMapper; using Volo.Abp.FluentValidation; @@ -18,7 +19,8 @@ namespace SJZY.Track.Application typeof(AbpLocalizationModule), typeof(AbpVirtualFileSystemModule), typeof(AbpHttpClientModule), - typeof(SJZYTrackDomainModule) + typeof(SJZYTrackDomainModule), + typeof(SjzyUserCenterHttpApiModule) )] public class ApplicationModule : AbpModule { @@ -46,6 +48,11 @@ namespace SJZY.Track.Application .AddBaseTypes(typeof(SjzyBasicLocalization)) .AddVirtualJson("/Localization/Resources"); }); + //授权拦截提示 + context.Services.Configure(options => + { + options.Filters.Add(new ApiAsyncAuthorizationFilter()); + }); //用户中心 context.Services.AddHttpClientProxies(typeof(SjzyUserCenterHttpApiModule).Assembly, "UserCenter", false); diff --git a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs index 7b076868..bd58470f 100644 --- a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs +++ b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs @@ -1,4 +1,5 @@ -using Microsoft.Extensions.Localization; +using Microsoft.AspNetCore.Authorization; +using Microsoft.Extensions.Localization; using SJZY.Track.Application.Dtos.TrackStatus; using SJZY.Track.Application.Localization; using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs index 422aafde..e77a574d 100644 --- a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs +++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs @@ -1,4 +1,5 @@ using System.Linq.Expressions; +using Microsoft.AspNetCore.Authorization; using Microsoft.Extensions.Localization; using SJZY.Expand.ABP.Core.Localization; using SJZY.Track.Application.Dtos.TrackTemplates; diff --git a/src/SJZY.Track.Repository/OrderRepository.cs b/src/SJZY.Track.Repository/OrderRepository.cs index ae51a536..3fbb9dfb 100644 --- a/src/SJZY.Track.Repository/OrderRepository.cs +++ b/src/SJZY.Track.Repository/OrderRepository.cs @@ -81,6 +81,7 @@ public class OrderRepository : BasicRepository, IOrderRepository, I public async Task> GetPageTrackOrder(GetPageTrackOrderInputVO input) { //await Context.Queryable((a,b)= ); + //await Context.Queryable((a,b)=> ) return null; } From b139734d57cd76bc974841ce53700ba02530c501 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Thu, 29 Feb 2024 19:06:34 +0800 Subject: [PATCH 07/16] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E6=97=B6=EF=BC=8C=E8=8E=B7=E5=8F=96=E4=B8=8D?= =?UTF-8?q?=E5=88=B0=E7=94=A8=E6=88=B7id=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutoMapper/OrderAutoMapperProfile.cs | 5 +++ .../ProvideServices/GetPageTrackOrderInput.cs | 2 +- .../SJZY.Track.Application.csproj | 2 -- .../Services/ProvideServices/OrderService.cs | 4 ++- .../Dtos/Order/GetPageTrackOrderInputVO.cs | 36 ++++++++++++++++++- .../SJZY.Track.Domain.csproj | 1 + src/SJZY.Track.Repository/DataBaseContext.cs | 24 +++++++++++++ src/SJZY.Track.Repository/OrderRepository.cs | 11 +++++- .../SJZYTrackRepositoryModule.cs | 4 +++ 9 files changed, 83 insertions(+), 6 deletions(-) diff --git a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs index 2dac9751..4a0bb612 100644 --- a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs @@ -1,6 +1,8 @@ using AutoMapper; +using AutoMapper.Internal.Mappers; using SJZY.Track.Application.Dtos.ProvideServices; using SJZY.Track.Domain.Aggregates.OrderAggregate; +using SJZY.Track.Domain.Dtos.Order; namespace SJZY.Track.Application.AutoMapper; @@ -15,5 +17,8 @@ public class OrderAutoMapperProfile : Profile .ForMember(dest => dest.ServiceProviderId, opt => opt.MapFrom(m => m.ServiceProviderId ?? 0)) .ForMember(dest => dest.TrackTemplateId, opt => opt.MapFrom(m => m.TemplateId)); CreateMap(MemberList.None); + + CreateMap(MemberList.None); + } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs index e2fb21f2..4709c862 100644 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs +++ b/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs @@ -16,7 +16,7 @@ namespace SJZY.Track.Application.Dtos.ProvideServices /// /// 单号 /// - public List OrderNos { get; set; } + public List? OrderNos { get; set; } /// /// 创建时间开始 diff --git a/src/SJZY.Track.Application/SJZY.Track.Application.csproj b/src/SJZY.Track.Application/SJZY.Track.Application.csproj index e8f1425c..43edd929 100644 --- a/src/SJZY.Track.Application/SJZY.Track.Application.csproj +++ b/src/SJZY.Track.Application/SJZY.Track.Application.csproj @@ -19,8 +19,6 @@ - - diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs index 55560ce6..1c5c25dd 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs @@ -1,5 +1,6 @@ using SJZY.Track.Application.Dtos.ProvideServices; using SJZY.Track.Domain.Aggregates.OrderAggregate; +using SJZY.Track.Domain.Dtos.Order; namespace SJZY.Track.Application.Services.ProvideServices; @@ -86,7 +87,8 @@ public class OrderService : ApplicationService [HttpPost("/Order/GetTrackOrderList")] public async Task> GetPageTrackOrder(GetPageTrackOrderInput input) { - + var vo = ObjectMapper.Map(input); + var jj = await _orderRepository.GetPageTrackOrder(vo); return null; } diff --git a/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs b/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs index 882f2db8..5dcbafaf 100644 --- a/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs @@ -6,9 +6,27 @@ using System.Threading.Tasks; namespace SJZY.Track.Domain.Dtos.Order { - public class GetPageTrackOrderInputVO + public class GetPageTrackOrderInputVO : PageInfoInput { + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + /// + /// 单号 + /// + public List OrderNos { get; set; } + + /// + /// 创建时间开始 + /// + public DateTime? CreateTimeStart { get; set; } + + /// + /// 创建时间截止 + /// + public DateTime? createTimeEnd { get; set; } } /// @@ -16,6 +34,22 @@ namespace SJZY.Track.Domain.Dtos.Order /// public class TrackOrderVO { + /// + /// 轨迹订单id + /// + public int Id { get; set; } + /// + /// 订单类型 + /// + public string OrderType { get; set; } + + + public string OrderNumber { get; set; } + + /// + /// 轨迹模版 + /// + public string TrackTemplateNames { get; set; } } } diff --git a/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj b/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj index aac0e12d..5ebeded5 100644 --- a/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj +++ b/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj @@ -9,6 +9,7 @@ + diff --git a/src/SJZY.Track.Repository/DataBaseContext.cs b/src/SJZY.Track.Repository/DataBaseContext.cs index b9712ab1..14dbada8 100644 --- a/src/SJZY.Track.Repository/DataBaseContext.cs +++ b/src/SJZY.Track.Repository/DataBaseContext.cs @@ -1,4 +1,6 @@ #pragma warning disable 1591 +using SJZY.UserCenter.HttpApi.Services; + namespace SJZY.Track.Repository { /// @@ -22,6 +24,17 @@ namespace SJZY.Track.Repository entityInfo.SetValue(DateTime.Now); if (entityInfo.PropertyName == nameof(ICreateBaicEntity.CreateUserId)) { + if (oldValue == null || (int)oldValue == 0) + { + try + { + entityInfo.SetValue(CurrentUserRequest.CurrentUser?.UserId); + } + catch + { + + } + } //entityInfo.SetValue(CurrentUserRequest.CurrentUser.UserId); } } @@ -32,6 +45,17 @@ namespace SJZY.Track.Repository entityInfo.SetValue(DateTime.Now); else if (entityInfo.PropertyName == nameof(IUpdateBasicEntity.UpdateUserId)) { + if (oldValue == null || (int)oldValue == 1) + { + try + { + entityInfo.SetValue(CurrentUserRequest.CurrentUser.UserId); + } + catch + { + + } + } //entityInfo.SetValue(CurrentUserRequest.CurrentUser.UserId); } //删除 diff --git a/src/SJZY.Track.Repository/OrderRepository.cs b/src/SJZY.Track.Repository/OrderRepository.cs index 3fbb9dfb..98a60b5f 100644 --- a/src/SJZY.Track.Repository/OrderRepository.cs +++ b/src/SJZY.Track.Repository/OrderRepository.cs @@ -81,7 +81,16 @@ public class OrderRepository : BasicRepository, IOrderRepository, I public async Task> GetPageTrackOrder(GetPageTrackOrderInputVO input) { //await Context.Queryable((a,b)= ); - //await Context.Queryable((a,b)=> ) + await Context.Queryable((a, b) => new JoinQueryInfos(JoinType.Left, a.Id==b.OrderId)) + .GroupBy((a, b) => new { a.Id }) + .Select((a, b) => new TrackOrderVO + { + Id=a.Id, + OrderNumber=a.OrderNo, + + + + }).ToPageListAsync(input.PageIndex, input.PageSize); return null; } diff --git a/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs b/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs index b58d19b1..a482fb7f 100644 --- a/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs +++ b/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs @@ -43,6 +43,10 @@ public class SJZYTrackRepositoryModule : AbpModule }); } + + + + public override void ConfigureServices(ServiceConfigurationContext context) { context.Services.AddTransient(typeof(IBasicQuery<>), typeof(BasicQuery<>)); From 2603cd1ac46c93f41308a647e55ba1bd3bcc2dab Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Thu, 29 Feb 2024 19:45:13 +0800 Subject: [PATCH 08/16] =?UTF-8?q?=E7=BC=96=E8=BE=91=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E4=B8=B2=E7=B1=BB=E5=9E=8B=E7=9A=84=E5=BF=85?= =?UTF-8?q?=E9=A1=BB=E5=8A=A0=3F=E5=8F=AF=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackContents/EditTrackContentInput.cs | 6 ++-- .../Dtos/TrackStatus/EditTrackStatusInput.cs | 6 ++-- .../Dtos/TrackTemplates/GetTrackDetailDto.cs | 4 +-- src/SJZY.Track.Repository/OrderRepository.cs | 29 +++++++++++++------ 4 files changed, 28 insertions(+), 17 deletions(-) diff --git a/src/SJZY.Track.Application/Dtos/TrackContents/EditTrackContentInput.cs b/src/SJZY.Track.Application/Dtos/TrackContents/EditTrackContentInput.cs index 23294dfe..9879ffb8 100644 --- a/src/SJZY.Track.Application/Dtos/TrackContents/EditTrackContentInput.cs +++ b/src/SJZY.Track.Application/Dtos/TrackContents/EditTrackContentInput.cs @@ -31,17 +31,17 @@ namespace SJZY.Track.Application.Dtos.TrackContents /// /// 轨迹内容代码 /// - public string Code { get; set; } + public string? Code { get; set; } /// /// 轨迹内容 /// - public string Content { get; set; } + public string? Content { get; set; } /// /// 轨迹内容英文 /// - public string EnContent { get; set; } + public string? EnContent { get; set; } /// /// 轨迹标记id diff --git a/src/SJZY.Track.Application/Dtos/TrackStatus/EditTrackStatusInput.cs b/src/SJZY.Track.Application/Dtos/TrackStatus/EditTrackStatusInput.cs index a77a4f1c..ce9a0ebf 100644 --- a/src/SJZY.Track.Application/Dtos/TrackStatus/EditTrackStatusInput.cs +++ b/src/SJZY.Track.Application/Dtos/TrackStatus/EditTrackStatusInput.cs @@ -31,16 +31,16 @@ namespace SJZY.Track.Application.Dtos.TrackStatus /// /// 轨迹状态代码 /// - public string Code { get; set; } + public string? Code { get; set; } /// /// 轨迹状态 /// - public string TrackStatus { get; set; } + public string? TrackStatus { get; set; } /// /// 轨迹状态英文 /// - public string EntrackStatus { get; set; } + public string? EntrackStatus { get; set; } } } diff --git a/src/SJZY.Track.Application/Dtos/TrackTemplates/GetTrackDetailDto.cs b/src/SJZY.Track.Application/Dtos/TrackTemplates/GetTrackDetailDto.cs index 6269ba0b..f4ac73d8 100644 --- a/src/SJZY.Track.Application/Dtos/TrackTemplates/GetTrackDetailDto.cs +++ b/src/SJZY.Track.Application/Dtos/TrackTemplates/GetTrackDetailDto.cs @@ -85,11 +85,11 @@ /// /// 模板名称 /// - public string Name { set; get; } + public string? Name { set; get; } /// /// 模板代码 /// - public string Code { set; get; } + public string? Code { set; get; } } } diff --git a/src/SJZY.Track.Repository/OrderRepository.cs b/src/SJZY.Track.Repository/OrderRepository.cs index 98a60b5f..3196cbdd 100644 --- a/src/SJZY.Track.Repository/OrderRepository.cs +++ b/src/SJZY.Track.Repository/OrderRepository.cs @@ -1,6 +1,7 @@ using Microsoft.AspNetCore.Mvc; using SJZY.Track.Domain; using SJZY.Track.Domain.Aggregates.OrderAggregate; +using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; using SJZY.Track.Domain.Dtos.Order; namespace SJZY.Track.Repository; @@ -81,16 +82,26 @@ public class OrderRepository : BasicRepository, IOrderRepository, I public async Task> GetPageTrackOrder(GetPageTrackOrderInputVO input) { //await Context.Queryable((a,b)= ); - await Context.Queryable((a, b) => new JoinQueryInfos(JoinType.Left, a.Id==b.OrderId)) - .GroupBy((a, b) => new { a.Id }) - .Select((a, b) => new TrackOrderVO - { - Id=a.Id, - OrderNumber=a.OrderNo, - - + //await Context.Queryable((a, b) => new JoinQueryInfos(JoinType.Left, a.Id==b.OrderId)) + // .GroupBy((a, b) => new { a.Id }) + // .Select((a, b) => new TrackOrderVO + // { + // Id=a.Id, + // OrderNumber=a.OrderNo, + // TrackTemplateNames = SqlFunc.AggregateConcat(b.) - }).ToPageListAsync(input.PageIndex, input.PageSize); + + // }).ToPageListAsync(input.PageIndex, input.PageSize); + + //await Context.Queryable() + // .Includes(a => a.OrderTemplates) + // .Select(a => new TrackOrderVO + // { + // Id=a.Id, + // OrderNumber=a.OrderNo, + // TrackTemplateNames = SqlFunc.Subqueryable().Where(z=>z.OrderId==a.Id).SelectStringJoin(z=>z.) + // }) + // .ToPageListAsync(input.PageIndex, input.PageSize); return null; } From 2e125f8662e558c747bf5869f0005172ea168b22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com> Date: Thu, 29 Feb 2024 20:12:03 +0800 Subject: [PATCH 09/16] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutoMapper/OrderAutoMapperProfile.cs | 6 +- .../Dtos/ProvideServices/DeleteOrderInput.cs | 20 +--- .../Dtos/ProvideServices/OrderNoInfo.cs | 19 +++ ...reateOrderInput.cs => UpsertOrderInput.cs} | 2 +- .../Dtos/ProvideServices/UpsertTrackInput.cs | 24 ++++ .../ProvideServices/OrderLinkService.cs | 1 + .../Services/ProvideServices/OrderService.cs | 12 +- .../ProvideServices/TrackQueryService.cs | 42 +++---- .../Services/ProvideServices/TrackService.cs | 84 ++++++++++++- .../OrderAggregate/IOrderRepository.cs | 16 +-- .../OrderAggregate/OrderFlightEntity.cs | 10 +- .../OrderAggregate/OrderLinkEntity.cs | 10 +- .../OrderAggregate/OrderTemplateEntity.cs | 17 ++- .../TrackContentEntity.cs | 6 +- .../ITrackDetailsRepository.cs | 8 +- .../TrackDetailsIndex.cs | 2 +- .../TrackStatusAggregate/TrackStatusEntity.cs | 6 +- .../ITrackTemplateRepository.cs | 5 +- .../Dtos/Order/OrderIdentifier.cs | 23 ++++ ...TemplateDto.cs => OrderTemplateLinkDto.cs} | 4 +- .../Dtos/TrackDetails/MatchTrackContentDto.cs | 19 +++ ...ntOrderlyDto.cs => OrderedTrackCodeDto.cs} | 2 +- src/SJZY.Track.Domain/IBasicRepository.cs | 4 +- .../{ => Queries}/IBasicQuery.cs | 2 +- .../Queries/ITrackQueries.cs | 34 ++++++ src/SJZY.Track.Repository/BasicQuery.cs | 2 +- src/SJZY.Track.Repository/DataBaseContext.cs | 110 +++++++++--------- src/SJZY.Track.Repository/OrderRepository.cs | 35 +++--- .../Queries/TrackQueries.cs | 78 +++++++++++++ .../SJZYTrackRepositoryModule.cs | 4 +- .../TrackDetailsRepository.cs | 55 ++++++--- .../TrackTemplateRepository.cs | 40 +++---- 32 files changed, 504 insertions(+), 198 deletions(-) create mode 100644 src/SJZY.Track.Application/Dtos/ProvideServices/OrderNoInfo.cs rename src/SJZY.Track.Application/Dtos/ProvideServices/{CreateOrderInput.cs => UpsertOrderInput.cs} (93%) create mode 100644 src/SJZY.Track.Application/Dtos/ProvideServices/UpsertTrackInput.cs create mode 100644 src/SJZY.Track.Domain/Dtos/Order/OrderIdentifier.cs rename src/SJZY.Track.Domain/Dtos/Order/{OrderTemplateDto.cs => OrderTemplateLinkDto.cs} (70%) create mode 100644 src/SJZY.Track.Domain/Dtos/TrackDetails/MatchTrackContentDto.cs rename src/SJZY.Track.Domain/Dtos/TrackTemplate/{TemplateContentOrderlyDto.cs => OrderedTrackCodeDto.cs} (86%) rename src/SJZY.Track.Domain/{ => Queries}/IBasicQuery.cs (96%) create mode 100644 src/SJZY.Track.Domain/Queries/ITrackQueries.cs create mode 100644 src/SJZY.Track.Repository/Queries/TrackQueries.cs diff --git a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs index 4a0bb612..fabc4fdd 100644 --- a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs @@ -1,5 +1,4 @@ using AutoMapper; -using AutoMapper.Internal.Mappers; using SJZY.Track.Application.Dtos.ProvideServices; using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.Track.Domain.Dtos.Order; @@ -10,15 +9,14 @@ public class OrderAutoMapperProfile : Profile { public OrderAutoMapperProfile() { - CreateMap(MemberList.None); + CreateMap(MemberList.None); CreateMap(MemberList.None); CreateMap(MemberList.None) .ForMember(dest => dest.ServiceProviderId, opt => opt.MapFrom(m => m.ServiceProviderId ?? 0)) .ForMember(dest => dest.TrackTemplateId, opt => opt.MapFrom(m => m.TemplateId)); CreateMap(MemberList.None); - - CreateMap(MemberList.None); + CreateMap(MemberList.None); } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/DeleteOrderInput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/DeleteOrderInput.cs index b48f8af7..c4fba2a8 100644 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/DeleteOrderInput.cs +++ b/src/SJZY.Track.Application/Dtos/ProvideServices/DeleteOrderInput.cs @@ -1,23 +1,5 @@ -using System.ComponentModel.DataAnnotations; - -namespace SJZY.Track.Application.Dtos.ProvideServices; +namespace SJZY.Track.Application.Dtos.ProvideServices; public class DeleteOrderInput : OrderNoInfo { -} - -public class OrderNoInfo -{ - /// - /// 订单类型,必填 - /// - [Required] - public int OrderType { get; set; } - - /// - /// 订单号,必填 - /// - [Required] - [MaxLength(100)] - public string OrderNo { get; set; } = null!; } \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/OrderNoInfo.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/OrderNoInfo.cs new file mode 100644 index 00000000..6f98fafc --- /dev/null +++ b/src/SJZY.Track.Application/Dtos/ProvideServices/OrderNoInfo.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations; + +namespace SJZY.Track.Application.Dtos.ProvideServices; + +public class OrderNoInfo +{ + /// + /// 订单类型,必填 + /// + [Required] + public int OrderType { get; set; } + + /// + /// 订单号,必填 + /// + [Required] + [MaxLength(100)] + public string OrderNo { get; set; } = null!; +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/CreateOrderInput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/UpsertOrderInput.cs similarity index 93% rename from src/SJZY.Track.Application/Dtos/ProvideServices/CreateOrderInput.cs rename to src/SJZY.Track.Application/Dtos/ProvideServices/UpsertOrderInput.cs index 47888316..c03d2478 100644 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/CreateOrderInput.cs +++ b/src/SJZY.Track.Application/Dtos/ProvideServices/UpsertOrderInput.cs @@ -2,7 +2,7 @@ namespace SJZY.Track.Application.Dtos.ProvideServices; -public class CreateOrderInput : UpdateOrderInput +public class UpsertOrderInput : UpdateOrderInput { /// /// 客户id diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/UpsertTrackInput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/UpsertTrackInput.cs new file mode 100644 index 00000000..fa2112ee --- /dev/null +++ b/src/SJZY.Track.Application/Dtos/ProvideServices/UpsertTrackInput.cs @@ -0,0 +1,24 @@ +namespace SJZY.Track.Application.Dtos.ProvideServices; + +public class UpsertTrackInput : OrderNoInfo +{ + /// + /// 轨迹内容代码 + /// + public string TrackCode { get; set; } + + /// + /// 轨迹发生地 + /// + public string TrackPlace { get; set; } + + /// + /// 轨迹发生时间 + /// + public DateTime TrackTime { get; set; } + + /// + /// 轨迹发生时区 + /// + public float TraceTimeZone { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs index d4ec1f87..e21ca538 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs @@ -1,5 +1,6 @@ using SJZY.Track.Application.Dtos.ProvideServices; using SJZY.Track.Domain.Aggregates.OrderAggregate; +using SJZY.Track.Domain.Queries; namespace SJZY.Track.Application.Services.ProvideServices; diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs index 1c5c25dd..f75a8de9 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs @@ -23,8 +23,8 @@ public class OrderService : ApplicationService /// /// /// - [HttpPost("Order/CreateOrUpdate")] - public async Task CreateOrUpdateOrderAsync(CreateOrderInput input) + [HttpPost("Order/Upsert")] + public async Task UpsertAsync(UpsertOrderInput input) { var order = await _orderRepository.GetFirstAsync(x => x.OrderType == input.OrderType && x.OrderNo == input.OrderNo); @@ -35,7 +35,7 @@ public class OrderService : ApplicationService return "更新成功"; } - order = ObjectMapper.Map(input); + order = ObjectMapper.Map(input); order.SubSystemId = 1; order.OrderTemplates = ObjectMapper.Map, List>(input.Templates); order.OrderFlights = ObjectMapper.Map, List>(input.FlightInfos); @@ -60,12 +60,13 @@ public class OrderService : ApplicationService throw new BusinessException(message: $"订单:{input.OrderNo}不存在"); } - await _orderRepository.SoftDeleteAsync(x => x.Id == orderId); + await _orderRepository.DeleteOrderAsync(orderId); return true; } #region 轨迹订单明细 + /// /// 根据轨迹订单id获取轨迹订单明细列表 /// @@ -76,9 +77,11 @@ public class OrderService : ApplicationService { return null; } + #endregion #region 轨迹订单列表 + /// /// 获取分页的轨迹订单 /// @@ -92,6 +95,7 @@ public class OrderService : ApplicationService return null; } + #endregion private async Task UpdateOrderAsync(UpdateOrderInput input, OrderEntity order) diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs index 7792631f..587c316b 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs @@ -1,7 +1,6 @@ using SJZY.Track.Application.Dtos.ProvideServices; -using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; -using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; +using SJZY.Track.Domain.Queries; namespace SJZY.Track.Application.Services.ProvideServices; @@ -12,15 +11,13 @@ namespace SJZY.Track.Application.Services.ProvideServices; public class TrackQueryService : ApplicationService { private readonly ITrackDetailsRepository _trackDetailsRepository; - private readonly IOrderRepository _orderRepository; - private readonly ITrackTemplateRepository _trackTemplateRepository; + private readonly ITrackQueries _trackQueries; - public TrackQueryService(ITrackDetailsRepository trackDetailsRepository, IOrderRepository orderRepository, - ITrackTemplateRepository trackTemplateRepository) + public TrackQueryService(ITrackDetailsRepository trackDetailsRepository, + ITrackQueries trackQueries) { _trackDetailsRepository = trackDetailsRepository; - _orderRepository = orderRepository; - _trackTemplateRepository = trackTemplateRepository; + _trackQueries = trackQueries; } /// @@ -29,8 +26,8 @@ public class TrackQueryService : ApplicationService /// /// /// - [HttpPost("TrackQuery/GetByOrderNos")] - public async Task> GetByOrderNosAsync(GetTrackInput input) + [HttpPost("Track/Query")] + public async Task> QueryAsync(GetTrackInput input) { if (input.OrderNos.Count > 500) { @@ -38,8 +35,8 @@ public class TrackQueryService : ApplicationService } var res = new List(); - input.OrderNos = input.OrderNos.Distinct().ToList(); - var details = await _trackDetailsRepository.GetListAsync(input.OrderNos); + input.OrderNos = input.OrderNos.Distinct().ToList(); // 单号去重 + var details = await _trackDetailsRepository.GetListAsync(input.OrderType, input.OrderNos); var isTurn = input.TimeZone != 0; foreach (var group in details.GroupBy(x => x.OrderId)) @@ -78,18 +75,21 @@ public class TrackQueryService : ApplicationService list.ForEach(item => item.TrackDetails.Sort((a, b) => b.Time.CompareTo(a.Time))); break; case SortMethod.ByTemplate: - var orderTemplates = await _orderRepository.GetOrderTemplatesAsync(input.OrderType, input.OrderNos); + var orderTemplates = await _trackQueries + .GetOrderTemplateLinksAsync(input.OrderType, input.OrderNos); var distinctTemplateIds = orderTemplates.Select(x => x.TemplateId).Distinct().ToList(); - var templateContent = - await _trackTemplateRepository.GetTemplateContentOrderlyAsync(distinctTemplateIds); + var templateContent = await _trackQueries.GetOrderedTrackCodesAsync(distinctTemplateIds); list.ForEach(item => { - var template = orderTemplates.FirstOrDefault(x => x.OrderNo == item.OrderNo); - if (template == default) return; - var codes = templateContent - .Where(x => x.TemplateId == template.TemplateId) - .Select(x => x.Code) - .ToList(); + var codes = new List(); + // 多模板拼接显示 + foreach (var orderTemplate in orderTemplates.Where(x => x.OrderNo == item.OrderNo)) + { + codes.AddRange(templateContent + .Where(t => t.TemplateId == orderTemplate.TemplateId) + .Select(t => t.Code)); + } + item.TrackDetails = item.TrackDetails .Where(x => codes.Contains(x.Code)) // 剔除不在模板内容中的元素 .OrderBy(x => codes.IndexOf(x.Code)) // 按照在模板内容的位置排序 diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs index c5cddf06..5147ae93 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs @@ -1,5 +1,85 @@ -namespace SJZY.Track.Application.Services.ProvideServices; +using SJZY.Track.Application.Dtos.ProvideServices; +using SJZY.Track.Domain.Aggregates.OrderAggregate; +using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; +using SJZY.Track.Domain.Queries; +using SJZY.UserCenter.HttpApi.Services; -public class TrackService +namespace SJZY.Track.Application.Services.ProvideServices; + +/// +/// 轨迹服务 +/// +[ApiExplorerSettings(GroupName = "提供接口")] +public class TrackService : ApplicationService { + private readonly IOrderRepository _orderRepository; + private readonly ITrackDetailsRepository _trackDetailsRepository; + private readonly ITrackQueries _trackQueries; + + public TrackService(ITrackQueries trackQueries, IOrderRepository orderRepository, + ITrackDetailsRepository trackDetailsRepository) + { + _trackQueries = trackQueries; + _orderRepository = orderRepository; + _trackDetailsRepository = trackDetailsRepository; + } + + /// + /// 新增/更新订单轨迹接口 + /// + /// + /// + /// + [HttpPost("Track/Upsert")] + public async Task UpsertTrackAsync(UpsertTrackInput input) + { + var orderId = await _orderRepository.GetFirstAsync(x => + x.OrderType == input.OrderType && x.OrderNo == input.OrderNo, x => x.Id); + if (orderId == default) + { + throw new BusinessException(message: $"订单:{input.OrderNo}不存在"); + } + + // 不存在则新增轨迹,存在则更新 + var track = await _trackDetailsRepository.GetFirstOrDefaultAsync(orderId, input.TrackCode); + if (track == default) + { + var trackContent = await _trackQueries.MatchTrackContentAsync(orderId, input.TrackCode); + if (trackContent == default) + { + throw new BusinessException(message: $"订单:{input.OrderNo} 所绑定的模板,没有一条内容可以匹配轨迹代码:{input.TrackCode}"); + } + + track = new TrackDetailsIndex + { + OrderId = orderId, + OrderNo = input.OrderNo, + OrderType = input.OrderType, + TrackStatus = trackContent.Status, + TrackCode = input.TrackCode, + TrackContent = trackContent.Content, + TrackEnContent = trackContent.EnContent, + TrackPlace = input.TrackPlace, + TrackTime = input.TrackTime, + TraceTimeZone = input.TraceTimeZone, + CreateUserId = CurrentUserRequest.CurrentUser.UserId, + CreateTime = DateTime.Now + }; + await _trackDetailsRepository.CreateAsync(track); + } + else + { + track.UpdateUserId = CurrentUserRequest.CurrentUser.UserId; + track.UpdateTime = DateTime.Now; + track.TrackPlace = input.TrackPlace; + track.TrackTime = input.TrackTime; + track.TraceTimeZone = input.TraceTimeZone; + await _trackDetailsRepository.UpdateAsync(track); + } + + // 根据订单关联关系向下刷,不同子系统还需要做内容映射 + + // 推送 + return true; + } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs index ded90121..93d162e2 100644 --- a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs @@ -10,15 +10,8 @@ public interface IOrderRepository : IBasicRepository /// /// Task CreateOrderAsync(OrderEntity order); - Task> GetOrderDetails(GetOrderDetailsInputVO input); - /// - /// 根据订单号,获取订单模板 - /// - /// 订单类型 - /// - /// - Task> GetOrderTemplatesAsync(int orderType, List distinctOrderNumbers); + Task> GetOrderDetails(GetOrderDetailsInputVO input); /// /// 获取分页的轨迹订单 @@ -47,4 +40,11 @@ public interface IOrderRepository : IBasicRepository /// /// Task UpdateOrderAsync(OrderEntity order); + + /// + /// 删除订单 + /// + /// + /// + Task DeleteOrderAsync(int orderId); } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderFlightEntity.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderFlightEntity.cs index c76d4d54..4e5f2017 100644 --- a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderFlightEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderFlightEntity.cs @@ -4,7 +4,7 @@ /// 订单航班表(1:N) /// [SugarTable("t_order_flight")] -public class OrderFlightEntity : ICreateBaicEntity, IEntity +public class OrderFlightEntity : ICreateBaicEntity, ISoftDeleteBasicEntity, IEntity { /// /// 自增主键 @@ -33,10 +33,18 @@ public class OrderFlightEntity : ICreateBaicEntity, IEntity /// /// 创建人 /// + [SugarColumn(ColumnName = "CreateUserId")] public int CreateUserId { get; set; } /// /// 创建时间 /// + [SugarColumn(ColumnName = "CreateTime")] public DateTime? CreateTime { get; set; } + + /// + /// 是否删除 + /// + [SugarColumn(ColumnName = "IsDeleted")] + public bool IsDeleted { get; set; } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderLinkEntity.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderLinkEntity.cs index 68b20740..112fc472 100644 --- a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderLinkEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderLinkEntity.cs @@ -4,7 +4,7 @@ /// 轨迹订单关联表(1:N) /// [SugarTable("t_order_link")] -public class OrderLinkEntity : ICreateBaicEntity, IEntity +public class OrderLinkEntity : ICreateBaicEntity, ISoftDeleteBasicEntity, IEntity { /// /// 自增主键 @@ -39,10 +39,18 @@ public class OrderLinkEntity : ICreateBaicEntity, IEntity /// /// 创建人 /// + [SugarColumn(ColumnName = "CreateUserId")] public int CreateUserId { get; set; } /// /// 创建时间 /// + [SugarColumn(ColumnName = "CreateTime")] public DateTime? CreateTime { get; set; } + + /// + /// 是否删除 + /// + [SugarColumn(ColumnName = "IsDeleted")] + public bool IsDeleted { get; set; } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderTemplateEntity.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderTemplateEntity.cs index 91219904..88559ae6 100644 --- a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderTemplateEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderTemplateEntity.cs @@ -4,7 +4,7 @@ /// 轨迹订单模板表(1:N) /// [SugarTable("t_order_template")] -public class OrderTemplateEntity : ICreateBaicEntity, IEntity +public class OrderTemplateEntity : ICreateBaicEntity, ISoftDeleteBasicEntity, IEntity { /// /// 自增主键 @@ -30,6 +30,21 @@ public class OrderTemplateEntity : ICreateBaicEntity, IEntity [SugarColumn(ColumnName = "TrackTemplateId")] public int TrackTemplateId { get; set; } + /// + /// 创建人 + /// + [SugarColumn(ColumnName = "CreateUserId")] public int CreateUserId { get; set; } + + /// + /// 创建时间 + /// + [SugarColumn(ColumnName = "CreateTime")] public DateTime? CreateTime { get; set; } + + /// + /// 是否删除 + /// + [SugarColumn(ColumnName = "IsDeleted")] + public bool IsDeleted { get; set; } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/TrackContentEntity.cs b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/TrackContentEntity.cs index adf4b23b..02fac985 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/TrackContentEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/TrackContentEntity.cs @@ -16,19 +16,19 @@ public class TrackContentEntity : IFullAuditedBasicEntitys, IAggregateRoot /// 轨迹内容代码 /// [SugarColumn(ColumnName = "Code")] - public string Code { get; set; } + public string Code { get; set; } = null!; /// /// 轨迹内容 /// [SugarColumn(ColumnName = "Content")] - public string Content { get; set; } + public string Content { get; set; } = null!; /// /// 轨迹内容英文 /// [SugarColumn(ColumnName = "EnContent")] - public string EnContent { get; set; } + public string EnContent { get; set; } = null!; /// /// 子系统id diff --git a/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs index 5e83c476..444dd072 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs @@ -4,9 +4,13 @@ namespace SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; public interface ITrackDetailsRepository { - Task WriteTrack(TrackDetailsIndex index); + Task GetFirstOrDefaultAsync(int orderId, string inputTrackCode); - Task> GetListAsync(List orderNos); + Task UpdateAsync(TrackDetailsIndex index); + + Task CreateAsync(TrackDetailsIndex index); + + Task> GetListAsync(int orderType, List orderNos); Task<(List list, long total)> GetListAsync(TrackDetailsQueryInput input); } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs index 9040ecc2..a8160da6 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs @@ -21,7 +21,7 @@ public class TrackDetailsIndex : IdBaseIndex /// /// 订单类型(主数据枚举TrackOrderType) /// - public string OrderType { get; set; } + public int OrderType { get; set; } /// /// 轨迹状态 diff --git a/src/SJZY.Track.Domain/Aggregates/TrackStatusAggregate/TrackStatusEntity.cs b/src/SJZY.Track.Domain/Aggregates/TrackStatusAggregate/TrackStatusEntity.cs index 7d1b1a0d..dd98a21d 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackStatusAggregate/TrackStatusEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackStatusAggregate/TrackStatusEntity.cs @@ -16,13 +16,13 @@ public class TrackStatusEntity : IFullAuditedBasicEntitys, IAggregateRoot /// 轨迹状态代码 /// [SugarColumn(ColumnName = "Code")] - public string Code { get; set; } + public string Code { get; set; } = null!; /// /// 轨迹状态英文 /// [SugarColumn(ColumnName = "EnStatus")] - public string EnStatus { get; set; } + public string EnStatus { get; set; } = null!; /// /// 所属节点(主数据枚举ServiceNode) @@ -34,7 +34,7 @@ public class TrackStatusEntity : IFullAuditedBasicEntitys, IAggregateRoot /// 轨迹状态 /// [SugarColumn(ColumnName = "Status")] - public string Status { get; set; } + public string Status { get; set; } = null!; /// /// 子系统id diff --git a/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs index f7c5fb2b..13d2ff0a 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs @@ -4,8 +4,6 @@ namespace SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; public interface ITrackTemplateRepository : IBasicRepository { - Task> GetTemplateContentOrderlyAsync(List distinctTemplateIds); - Task GetDetailAsync(int id); Task> GetPageTrackTemplate(GetPageTrackTemplateVO input); @@ -35,5 +33,6 @@ public interface ITrackTemplateRepository : IBasicRepository SoftDeleteContentAsync(int id); - Task> GetContentListAsync(Expression> whereExpression); + Task> GetContentListAsync( + Expression> whereExpression); } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/Order/OrderIdentifier.cs b/src/SJZY.Track.Domain/Dtos/Order/OrderIdentifier.cs new file mode 100644 index 00000000..248ec7e9 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/Order/OrderIdentifier.cs @@ -0,0 +1,23 @@ +namespace SJZY.Track.Domain.Dtos.Order; + +/// +/// 订单标识符 +/// +public readonly struct OrderIdentifier +{ + public OrderIdentifier(int orderType, string orderNo) + { + OrderType = orderType; + OrderNo = orderNo; + } + + /// + /// 订单类型 + /// + public int OrderType { get; } + + /// + /// 订单号 + /// + public string OrderNo { get; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/Order/OrderTemplateDto.cs b/src/SJZY.Track.Domain/Dtos/Order/OrderTemplateLinkDto.cs similarity index 70% rename from src/SJZY.Track.Domain/Dtos/Order/OrderTemplateDto.cs rename to src/SJZY.Track.Domain/Dtos/Order/OrderTemplateLinkDto.cs index c2655b43..6ca82ed3 100644 --- a/src/SJZY.Track.Domain/Dtos/Order/OrderTemplateDto.cs +++ b/src/SJZY.Track.Domain/Dtos/Order/OrderTemplateLinkDto.cs @@ -1,11 +1,11 @@ namespace SJZY.Track.Domain.Dtos.Order; -public class OrderTemplateDto +public class OrderTemplateLinkDto { /// /// 订单号 /// - public string OrderNo { get; set; } + public string OrderNo { get; set; } = null!; /// /// 模板id diff --git a/src/SJZY.Track.Domain/Dtos/TrackDetails/MatchTrackContentDto.cs b/src/SJZY.Track.Domain/Dtos/TrackDetails/MatchTrackContentDto.cs new file mode 100644 index 00000000..c6e07352 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackDetails/MatchTrackContentDto.cs @@ -0,0 +1,19 @@ +namespace SJZY.Track.Domain.Dtos.TrackDetails; + +public class MatchTrackContentDto +{ + /// + /// 轨迹内容 + /// + public string Content { get; set; } + + /// + /// 轨迹内容英文 + /// + public string EnContent { get; set; } + + /// + /// 轨迹状态 + /// + public string Status { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackTemplate/TemplateContentOrderlyDto.cs b/src/SJZY.Track.Domain/Dtos/TrackTemplate/OrderedTrackCodeDto.cs similarity index 86% rename from src/SJZY.Track.Domain/Dtos/TrackTemplate/TemplateContentOrderlyDto.cs rename to src/SJZY.Track.Domain/Dtos/TrackTemplate/OrderedTrackCodeDto.cs index d7ef08ef..60362986 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackTemplate/TemplateContentOrderlyDto.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackTemplate/OrderedTrackCodeDto.cs @@ -1,6 +1,6 @@ namespace SJZY.Track.Domain.Dtos.TrackTemplate; -public class TemplateContentOrderlyDto +public class OrderedTrackCodeDto { /// /// 模板id diff --git a/src/SJZY.Track.Domain/IBasicRepository.cs b/src/SJZY.Track.Domain/IBasicRepository.cs index b085429b..71bc3175 100644 --- a/src/SJZY.Track.Domain/IBasicRepository.cs +++ b/src/SJZY.Track.Domain/IBasicRepository.cs @@ -1,4 +1,6 @@ -namespace SJZY.Track.Domain; +using SJZY.Track.Domain.Queries; + +namespace SJZY.Track.Domain; public interface IBasicRepository : IBasicQuery where T : IAggregateRoot { diff --git a/src/SJZY.Track.Domain/IBasicQuery.cs b/src/SJZY.Track.Domain/Queries/IBasicQuery.cs similarity index 96% rename from src/SJZY.Track.Domain/IBasicQuery.cs rename to src/SJZY.Track.Domain/Queries/IBasicQuery.cs index f050d54d..894e72a9 100644 --- a/src/SJZY.Track.Domain/IBasicQuery.cs +++ b/src/SJZY.Track.Domain/Queries/IBasicQuery.cs @@ -1,4 +1,4 @@ -namespace SJZY.Track.Domain; +namespace SJZY.Track.Domain.Queries; public interface IBasicQuery where T : IEntity { diff --git a/src/SJZY.Track.Domain/Queries/ITrackQueries.cs b/src/SJZY.Track.Domain/Queries/ITrackQueries.cs new file mode 100644 index 00000000..df41882c --- /dev/null +++ b/src/SJZY.Track.Domain/Queries/ITrackQueries.cs @@ -0,0 +1,34 @@ +using SJZY.Track.Domain.Dtos.Order; +using SJZY.Track.Domain.Dtos.TrackDetails; +using SJZY.Track.Domain.Dtos.TrackTemplate; + +namespace SJZY.Track.Domain.Queries; + +/// +/// 提供接口专用查询 +/// +public interface ITrackQueries +{ + /// + /// 根据订单号,获取订单模板 + /// + /// 订单类型 + /// 订单号 + /// + Task> GetOrderTemplateLinksAsync(int orderType, List orderNumbers); + + /// + /// 根据订单模板,获取有序的轨迹code + /// + /// 模板id + /// + Task> GetOrderedTrackCodesAsync(List templateIds); + + /// + /// 根据订单id找到订单模板,匹配模板命中的轨迹内容 + /// + /// 订单id + /// 轨迹代码 + /// + Task MatchTrackContentAsync(int orderId, string code); +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/BasicQuery.cs b/src/SJZY.Track.Repository/BasicQuery.cs index 275b3b4d..4d8e70d1 100644 --- a/src/SJZY.Track.Repository/BasicQuery.cs +++ b/src/SJZY.Track.Repository/BasicQuery.cs @@ -1,5 +1,5 @@ using System.Linq.Expressions; -using SJZY.Track.Domain; +using SJZY.Track.Domain.Queries; using SJZY.Track.Domain.SeedWork; namespace SJZY.Track.Repository; diff --git a/src/SJZY.Track.Repository/DataBaseContext.cs b/src/SJZY.Track.Repository/DataBaseContext.cs index 14dbada8..88539836 100644 --- a/src/SJZY.Track.Repository/DataBaseContext.cs +++ b/src/SJZY.Track.Repository/DataBaseContext.cs @@ -1,77 +1,77 @@ -#pragma warning disable 1591 -using SJZY.UserCenter.HttpApi.Services; +using SJZY.UserCenter.HttpApi.Services; -namespace SJZY.Track.Repository +#pragma warning disable 1591 + +namespace SJZY.Track.Repository; + +/// +/// Sqlsugar 上下文对象 +/// +public class DataBaseContext { - /// - /// Sqlsugar 上下文对象 - /// - public class DataBaseContext + #region 审计属性自动赋值 + + public static void OnExcutingAction(object oldValue, DataFilterModel entityInfo) { + //过滤掉 "v_" 开头的表 + if (entityInfo.EntityColumnInfo.DbTableName.StartsWith("v_", StringComparison.OrdinalIgnoreCase)) + throw new Exception("非法的操作,不允许编辑映射表"); - #region 审计属性自动赋值 - - public static void OnExcutingAction(object oldValue, DataFilterModel entityInfo) + //新增 + if (entityInfo.OperationType == DataFilterType.InsertByObject) { - //过滤掉 "v_" 开头的表 - if (entityInfo.EntityColumnInfo.DbTableName.StartsWith("v_", StringComparison.OrdinalIgnoreCase)) - throw new Exception("非法的操作,不允许编辑映射表"); - - //新增 - if (entityInfo.OperationType == DataFilterType.InsertByObject) + if (entityInfo.PropertyName == nameof(ICreateBaicEntity.CreateTime)) + entityInfo.SetValue(DateTime.Now); + if (entityInfo.PropertyName == nameof(ICreateBaicEntity.CreateUserId)) { - if (entityInfo.PropertyName == nameof(ICreateBaicEntity.CreateTime)) - entityInfo.SetValue(DateTime.Now); - if (entityInfo.PropertyName == nameof(ICreateBaicEntity.CreateUserId)) + if (oldValue == null || (int)oldValue == 0) { - if (oldValue == null || (int)oldValue == 0) + try + { + entityInfo.SetValue(CurrentUserRequest.CurrentUser?.UserId); + } + catch { - try - { - entityInfo.SetValue(CurrentUserRequest.CurrentUser?.UserId); - } - catch - { - - } } - //entityInfo.SetValue(CurrentUserRequest.CurrentUser.UserId); } + //entityInfo.SetValue(CurrentUserRequest.CurrentUser.UserId); } - //修改 - else if (entityInfo.OperationType == DataFilterType.UpdateByObject) + } + //修改 + else if (entityInfo.OperationType == DataFilterType.UpdateByObject) + { + if (entityInfo.PropertyName == nameof(IUpdateBasicEntity.UpdateTime)) + entityInfo.SetValue(DateTime.Now); + else if (entityInfo.PropertyName == nameof(IUpdateBasicEntity.UpdateUserId)) { - if (entityInfo.PropertyName == nameof(IUpdateBasicEntity.UpdateTime)) - entityInfo.SetValue(DateTime.Now); - else if (entityInfo.PropertyName == nameof(IUpdateBasicEntity.UpdateUserId)) + if (oldValue == null || (int)oldValue == 1) { - if (oldValue == null || (int)oldValue == 1) + try + { + entityInfo.SetValue(CurrentUserRequest.CurrentUser.UserId); + } + catch { - try - { - entityInfo.SetValue(CurrentUserRequest.CurrentUser.UserId); - } - catch - { - - } } - //entityInfo.SetValue(CurrentUserRequest.CurrentUser.UserId); } - //删除 - else if (entityInfo.PropertyName == nameof(IDeleteBasicEntity.IsDeleted)) + //entityInfo.SetValue(CurrentUserRequest.CurrentUser.UserId); + } + //删除 + else if (entityInfo.PropertyName == nameof(IDeleteBasicEntity.IsDeleted)) + { + var currentType = entityInfo.EntityValue.GetType(); + bool.TryParse( + currentType.GetProperty(entityInfo.PropertyName)?.GetValue(entityInfo.EntityValue)?.ToString(), + out bool isdelete); + if (isdelete) { - var currentType = entityInfo.EntityValue.GetType(); - bool.TryParse(currentType.GetProperty(entityInfo.PropertyName)?.GetValue(entityInfo.EntityValue)?.ToString(), out bool isdelete); - if (isdelete) - { - //currentType.GetProperty(nameof(IDeleteBasicEntity.DeleteUserId))?.SetValue(entityInfo.EntityValue, 5); - currentType.GetProperty(nameof(IDeleteBasicEntity.DeleteTime))?.SetValue(entityInfo.EntityValue, DateTime.Now); - } + //currentType.GetProperty(nameof(IDeleteBasicEntity.DeleteUserId))?.SetValue(entityInfo.EntityValue, 5); + currentType.GetProperty(nameof(IDeleteBasicEntity.DeleteTime)) + ?.SetValue(entityInfo.EntityValue, DateTime.Now); } } } - - #endregion 审计属性自动赋值 } + + #endregion 审计属性自动赋值 } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/OrderRepository.cs b/src/SJZY.Track.Repository/OrderRepository.cs index 3196cbdd..c932f142 100644 --- a/src/SJZY.Track.Repository/OrderRepository.cs +++ b/src/SJZY.Track.Repository/OrderRepository.cs @@ -1,7 +1,5 @@ -using Microsoft.AspNetCore.Mvc; -using SJZY.Track.Domain; +using SJZY.Track.Domain; using SJZY.Track.Domain.Aggregates.OrderAggregate; -using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; using SJZY.Track.Domain.Dtos.Order; namespace SJZY.Track.Repository; @@ -16,20 +14,6 @@ public class OrderRepository : BasicRepository, IOrderRepository, I .ExecuteCommandAsync(); } - public async Task> GetOrderTemplatesAsync(int orderType, - List distinctOrderNumbers) - { - return await AsQueryable() - .LeftJoin((a, b) => a.Id == b.OrderId) - .Where(a => a.OrderType == orderType && distinctOrderNumbers.Contains(a.OrderNo)) - .Select((a, b) => new OrderTemplateDto - { - OrderNo = a.OrderNo, - TemplateId = b.TrackTemplateId - }) - .ToListAsync(); - } - public async Task LinkOrderAsync(List orderLinkEntities) { await Context.Insertable(orderLinkEntities).ExecuteCommandAsync(); @@ -60,6 +44,20 @@ public class OrderRepository : BasicRepository, IOrderRepository, I tran.Complete(); } + public async Task DeleteOrderAsync(int orderId) + { + using var tran = TransactionHelper.GetReadCommitted(); + + // 软删订单主表 + await SoftDeleteAsync(x => x.Id == orderId); + + // 软删订单模板 + // 软删订单航班 + // 软删订单关联关系 + + tran.Complete(); + } + #region 轨迹订单明细 /// @@ -71,9 +69,11 @@ public class OrderRepository : BasicRepository, IOrderRepository, I { return null; } + #endregion #region 轨迹订单分页 + /// /// 获取分页的轨迹订单 /// @@ -105,5 +105,6 @@ public class OrderRepository : BasicRepository, IOrderRepository, I return null; } + #endregion } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Queries/TrackQueries.cs b/src/SJZY.Track.Repository/Queries/TrackQueries.cs new file mode 100644 index 00000000..da7c4dab --- /dev/null +++ b/src/SJZY.Track.Repository/Queries/TrackQueries.cs @@ -0,0 +1,78 @@ +using SJZY.Track.Domain.Aggregates.OrderAggregate; +using SJZY.Track.Domain.Aggregates.TrackContentAggregate; +using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; +using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; +using SJZY.Track.Domain.Dtos.Order; +using SJZY.Track.Domain.Dtos.TrackDetails; +using SJZY.Track.Domain.Dtos.TrackTemplate; +using SJZY.Track.Domain.Queries; + +namespace SJZY.Track.Repository.Queries; + +public class TrackQueries : ISugarRepository, ITrackQueries, + ITransientDependency +{ + public ISqlSugarClient Context { get; set; } + + public TrackQueries() + { + Context = SqlsugarScopeBasic.GetContextSafely("default"); + } + + public async Task> GetOrderTemplateLinksAsync(int orderType, + params string[] orderNumbers) + { + return await Context.Queryable() + .LeftJoin((a, b) => a.Id == b.OrderId) + .Where(a => a.OrderType == orderType && orderNumbers.Contains(a.OrderNo)) + .Select((a, b) => new OrderTemplateLinkDto + { + OrderNo = a.OrderNo, + TemplateId = b.TrackTemplateId + }) + .ToListAsync(); + } + + public async Task> GetOrderTemplateLinksAsync(int orderType, List orderNumbers) + { + return await Context.Queryable() + .LeftJoin((a, b) => a.Id == b.OrderId) + .Where(a => a.OrderType == orderType && orderNumbers.Contains(a.OrderNo)) + .Select((a, b) => new OrderTemplateLinkDto + { + OrderNo = a.OrderNo, + TemplateId = b.TrackTemplateId + }) + .ToListAsync(); + } + + public async Task> GetOrderedTrackCodesAsync(List templateIds) + { + return await Context.Queryable() + .LeftJoin((a, b) => a.TrackContentId == b.Id) + .Where(a => templateIds.Contains(a.TrackTemplateId)) + .OrderBy(a => a.Sort) + .Select((a, b) => new OrderedTrackCodeDto + { + TemplateId = a.Id, + Code = b.Code + }) + .ToListAsync(); + } + + public async Task MatchTrackContentAsync(int orderId, string code) + { + return await Context.Queryable() + .LeftJoin((x, a) => x.TrackTemplateId == a.TrackTemplateId) + .LeftJoin((x, a, b) => a.TrackContentId == b.Id) + .LeftJoin((x, a, b, c) => b.TrackStatusId == c.Id) + .Where((x, a, b) => x.OrderId == orderId && b.Code == code) + .Select((x, a, b, c) => new MatchTrackContentDto + { + Content = b.Content, + EnContent = b.EnContent, + Status = c.Status + }) + .FirstAsync(); + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs b/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs index a482fb7f..799c900a 100644 --- a/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs +++ b/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs @@ -3,6 +3,7 @@ using Microsoft.Extensions.DependencyInjection; using SJZY.Expand.ABP.Core.SqlSugar.Options; using SJZY.Expand.ElasticSearch; using SJZY.Track.Domain; +using SJZY.Track.Domain.Queries; using Volo.Abp.Autofac; using Volo.Abp.Modularity; @@ -44,9 +45,6 @@ public class SJZYTrackRepositoryModule : AbpModule } - - - public override void ConfigureServices(ServiceConfigurationContext context) { context.Services.AddTransient(typeof(IBasicQuery<>), typeof(BasicQuery<>)); diff --git a/src/SJZY.Track.Repository/TrackDetailsRepository.cs b/src/SJZY.Track.Repository/TrackDetailsRepository.cs index 3a0677b9..ef51db46 100644 --- a/src/SJZY.Track.Repository/TrackDetailsRepository.cs +++ b/src/SJZY.Track.Repository/TrackDetailsRepository.cs @@ -1,6 +1,4 @@ using Nest; -using SJZY.Expand.ABP.Core.Logger; -using SJZY.Expand.ABP.Core.PublicMethords; using SJZY.Expand.ElasticSearch.Services; using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; using SJZY.Track.Domain.Dtos.TrackDetails; @@ -10,26 +8,49 @@ namespace SJZY.Track.Repository; internal class TrackDetailsRepository : ElasticSearchContextAbstract, ITrackDetailsRepository, ITransientDependency { + public string IndexName => $"{TrackDetailsIndex.IndexName}-{DateTime.Now:yyyy.MM.dd}"; + public TrackDetailsRepository(ConnectionFactory connectionFactory) : base(connectionFactory) { } - public async Task WriteTrack(TrackDetailsIndex index) + public async Task GetFirstOrDefaultAsync(int orderId, string trackCode) { - try + var r = await Context.SearchAsync(s => s + .Index($"{TrackDetailsIndex.IndexName}-{DateTime.Now:yyyy.MM.dd}") + .Query(q => + q.Term(t => t.Field(f => f.OrderId).Value(orderId)) + && q.Term(t => t.Field(f => f.TrackCode).Value(trackCode)) + ) + ); + + if (r.IsValid) { - //await Context.IndexDocumentAsync(idx); - var response = await Context.IndexAsync(index, - request => request.Index($"{TrackDetailsIndex.IndexName}-{DateTime.Now:yyyy.MM.dd}")); - if (!response.IsValid) LogHelper.Error("数据添加失败,原因:" + response.DebugInformation); - } - catch (Exception ex) - { - LogHelper.Error($"日志插入ES失败:{ex.Message}。{index.ToJson()}"); + return r.Documents.FirstOrDefault(); } + + return default; } - public async Task> GetListAsync(List orderNos) + public async Task UpdateAsync(TrackDetailsIndex index) + { + var response = await Context.UpdateAsync(index.Id, u => u + .Index(IndexName) + .Doc(index) + //.Refresh(Refresh.True) // 可选:立即刷新索引使更改立即可见 + ); + if (!response.IsValid) + throw new Exception($"数据修改失败,原因:{response.DebugInformation}"); + } + + public async Task CreateAsync(TrackDetailsIndex index) + { + var response = await Context.IndexAsync(index, request => request.Index(IndexName)); + if (!response.IsValid) + throw new Exception($"数据添加失败,原因:{response.DebugInformation}"); + } + + public async Task> GetListAsync(int orderType, List orderNos) { if (orderNos.Count < 1) return new List(); @@ -42,9 +63,11 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract f.TrackTime) .Field(f => f.TraceTimeZone) )) - .Query(q => q.Terms(t => t - .Field(f => f.OrderNo) - .Terms(orderNos))) + .Query(q => + q.Terms(t => t + .Field(f => f.OrderNo) + .Terms(orderNos)) + && q.Term(f => f.OrderType, orderType)) ); return data.Documents.ToList(); diff --git a/src/SJZY.Track.Repository/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/TrackTemplateRepository.cs index 41569c12..43fff1f5 100644 --- a/src/SJZY.Track.Repository/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/TrackTemplateRepository.cs @@ -10,24 +10,8 @@ using SJZY.Track.Repository.Enum; namespace SJZY.Track.Repository; -/// public class TrackTemplateRepository : BasicRepository, ITrackTemplateRepository, IScopedDependency { - public async Task> GetTemplateContentOrderlyAsync(List distinctTemplateIds) - { - return await Context.Queryable() - .LeftJoin((a, b) => a.Id == b.TrackTemplateId) - .LeftJoin((a, b, c) => b.TrackContentId == c.Id) - .Where(a => distinctTemplateIds.Contains(a.Id)) - .OrderBy((a, b) => b.Sort) - .Select((a, b, c) => new TemplateContentOrderlyDto - { - TemplateId = a.Id, - Code = c.Code - }) - .ToListAsync(); - } - /// /// 获取轨迹模版明细 /// @@ -40,13 +24,13 @@ public class TrackTemplateRepository : BasicRepository, ITr .Where((a, b) => a.Id == id) .Select((a, b) => new GetTrackTemplateDetailVO - { - Id = a.Id, - Code = a.Code, - Name = a.Name, - SubSystemId = a.SubSystemId, - SubSystem = b.CnName - }).FirstAsync(); + { + Id = a.Id, + Code = a.Code, + Name = a.Name, + SubSystemId = a.SubSystemId, + SubSystem = b.CnName + }).FirstAsync(); return detail; } @@ -58,13 +42,14 @@ public class TrackTemplateRepository : BasicRepository, ITr /// public async Task> GetPageTrackTemplate(GetPageTrackTemplateVO input) { - UnifyPageResultDto pagedList = new UnifyPageResultDto(); - pagedList = await Context.Queryable() + UnifyPageResultDto pagedList = await Context.Queryable() .LeftJoin((a, b) => a.SubSystemId == b.Id) .WhereIF(input.SubSystemId > 0, (a, b) => a.SubSystemId == input.SubSystemId) .WhereIF(!input.Keywords.IsNullOrWhiteSpace(), (a, b) => a.Name.Contains(input.Keywords) || a.Code.Contains(input.Keywords)) - .OrderByIF(input.TrackTemplateId > 0, (a, b) => SqlFunc.IIF(a.Id == input.TrackTemplateId, SqlFunc.DateAdd(SqlFunc.GetDate(), 1), a.CreateTime), OrderByType.Desc) + .OrderByIF(input.TrackTemplateId > 0, + (a, b) => SqlFunc.IIF(a.Id == input.TrackTemplateId, SqlFunc.DateAdd(SqlFunc.GetDate(), 1), + a.CreateTime), OrderByType.Desc) .Select((a, b) => new GetTrackTemplateListVO { Id = a.Id, @@ -168,7 +153,8 @@ public class TrackTemplateRepository : BasicRepository, ITr .ExecuteCommandHasChangeAsync(); } - public async Task> GetContentListAsync(Expression> whereExpression) + public async Task> GetContentListAsync( + Expression> whereExpression) { return await Context.Queryable().Where(whereExpression).ToListAsync(); } From 159ac8b029010407c2e1bc8e672eb64dccf90fcf Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Thu, 29 Feb 2024 21:09:25 +0800 Subject: [PATCH 10/16] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E7=9A=84=E8=BD=A8=E8=BF=B9=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutoMapper/OrderAutoMapperProfile.cs | 4 ++ .../ProvideServices/GetPageTrackOrderInput.cs | 60 ++++++++++++++++-- .../Services/ProvideServices/OrderService.cs | 9 +-- .../Dtos/Order/GetPageTrackOrderInputVO.cs | 57 +++++++++++++++-- src/SJZY.Track.Repository/OrderRepository.cs | 62 +++++++++++++------ 5 files changed, 159 insertions(+), 33 deletions(-) diff --git a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs index fabc4fdd..a8d93386 100644 --- a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs @@ -1,7 +1,9 @@ using AutoMapper; +using AutoMapper.Internal.Mappers; using SJZY.Track.Application.Dtos.ProvideServices; using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.Track.Domain.Dtos.Order; +using System.Diagnostics; namespace SJZY.Track.Application.AutoMapper; @@ -18,5 +20,7 @@ public class OrderAutoMapperProfile : Profile CreateMap(MemberList.None); CreateMap(MemberList.None); + CreateMap(MemberList.None); + CreateMap, UnifyPageResultDto>(MemberList.None); } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs index 4709c862..06335e34 100644 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs +++ b/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs @@ -26,7 +26,7 @@ namespace SJZY.Track.Application.Dtos.ProvideServices /// /// 创建时间截止 /// - public DateTime? createTimeEnd { get; set; } + public DateTime? CreateTimeEnd { get; set; } } /// @@ -40,11 +40,63 @@ namespace SJZY.Track.Application.Dtos.ProvideServices public int Id { get; set; } /// - /// 订单类型 + /// 订单类型id /// - public string OrderType { get; set; } + public int OrderType { get; set; } + /// + /// 订单号 + /// + public string? OrderNumber { get; set; } - public string OrderNumber { get; set; } + /// + /// 轨迹模版 + /// + public string? TrackTemplateNames { get; set; } + + /// + /// 客户简称 + /// + public string? CustomerShortName { get; set; } + + /// + /// 客户代码 + /// + public string? CustomerCode { get; set; } + + /// + /// 订单明细(json) + /// + public string? OrderDetails { get; set; } + + /// + /// 最新轨迹内容 + /// + public string? NewestTrackContent { get; set; } + + /// + /// 最新轨迹内容英文 + /// + public string? NewestTrackEnContent { get; set; } + + /// + /// 最新轨迹发生地 + /// + public string? NewestTrackPlace { get; set; } + + /// + /// 是否完结 + /// + public bool IsFinish { get; set; } + + /// + /// 创建时间 + /// + public DateTime? CreateTime { get; set; } + + /// + /// 子系统 + /// + public string SubSystem { get; set; } } } diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs index f75a8de9..8b6b8e19 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs @@ -1,4 +1,5 @@ -using SJZY.Track.Application.Dtos.ProvideServices; +using SJZY.Expand.ABP.Core.Common.Dto; +using SJZY.Track.Application.Dtos.ProvideServices; using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.Track.Domain.Dtos.Order; @@ -91,9 +92,9 @@ public class OrderService : ApplicationService public async Task> GetPageTrackOrder(GetPageTrackOrderInput input) { var vo = ObjectMapper.Map(input); - var jj = await _orderRepository.GetPageTrackOrder(vo); - - return null; + var pageList = await _orderRepository.GetPageTrackOrder(vo); + var pageResultDto = ObjectMapper.Map, UnifyPageResultDto>(pageList); + return pageResultDto; } #endregion diff --git a/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs b/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs index 5dcbafaf..c95fae3e 100644 --- a/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs @@ -40,16 +40,63 @@ namespace SJZY.Track.Domain.Dtos.Order public int Id { get; set; } /// - /// 订单类型 + /// 订单类型id /// - public string OrderType { get; set; } + public int OrderType { get; set; } - - public string OrderNumber { get; set; } + /// + /// 订单号 + /// + public string? OrderNumber { get; set; } /// /// 轨迹模版 /// - public string TrackTemplateNames { get; set; } + public string? TrackTemplateNames { get; set; } + + /// + /// 客户简称 + /// + public string? CustomerShortName { get; set; } + + /// + /// 客户代码 + /// + public string? CustomerCode { get; set; } + + /// + /// 订单明细(json) + /// + public string? OrderDetails { get; set; } + + /// + /// 最新轨迹内容 + /// + public string? NewestTrackContent { get; set; } + + /// + /// 最新轨迹内容英文 + /// + public string? NewestTrackEnContent { get; set; } + + /// + /// 最新轨迹发生地 + /// + public string? NewestTrackPlace { get; set; } + + /// + /// 是否完结 + /// + public bool IsFinish { get; set; } + + /// + /// 创建时间 + /// + public DateTime? CreateTime { get; set; } + + /// + /// 子系统 + /// + public string SubSystem { get; set; } } } diff --git a/src/SJZY.Track.Repository/OrderRepository.cs b/src/SJZY.Track.Repository/OrderRepository.cs index c932f142..1d7ebfa2 100644 --- a/src/SJZY.Track.Repository/OrderRepository.cs +++ b/src/SJZY.Track.Repository/OrderRepository.cs @@ -1,6 +1,10 @@ -using SJZY.Track.Domain; +using Nest; +using SJZY.Track.Domain; using SJZY.Track.Domain.Aggregates.OrderAggregate; +using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; using SJZY.Track.Domain.Dtos.Order; +using SJZY.Track.Domain.VEntities; +using SJZY.Track.Repository.VData.Entitys; namespace SJZY.Track.Repository; @@ -81,29 +85,47 @@ public class OrderRepository : BasicRepository, IOrderRepository, I /// public async Task> GetPageTrackOrder(GetPageTrackOrderInputVO input) { - //await Context.Queryable((a,b)= ); - //await Context.Queryable((a, b) => new JoinQueryInfos(JoinType.Left, a.Id==b.OrderId)) - // .GroupBy((a, b) => new { a.Id }) - // .Select((a, b) => new TrackOrderVO - // { - // Id=a.Id, - // OrderNumber=a.OrderNo, - // TrackTemplateNames = SqlFunc.AggregateConcat(b.) + var pageList = await Context.Queryable() + .LeftJoin((a, b) => a.CustomId==b.Id) + .LeftJoin((a, b, c) => a.SubSystemId==c.Id) + .Select((a, b, c) => new TrackOrderVO + { + Id = a.Id, + OrderNumber= a.OrderNo, + OrderType = a.OrderType, + CustomerShortName= b.Abbreviation, + CustomerCode= b.Code, + TrackTemplateNames = "", + OrderDetails="", + NewestTrackContent= a.LatestTrackContent, + NewestTrackEnContent= a.LatestTrackEnContent, + NewestTrackPlace= a.LatestTrackPlace, + IsFinish=a.IsCompleted, + CreateTime=a.CreateTime, + SubSystem= c.CnName + }) + .ToPagedListAsync(input.PageIndex, input.PageSize); + + if (pageList.List.Any()) + { + var orderIds = pageList.List.Select(a => a.Id); + //查询轨迹模版 - // }).ToPageListAsync(input.PageIndex, input.PageSize); + var trackTemplateList = await Context.Queryable() + .LeftJoin((a, b) => a.TrackTemplateId==b.Id) + .Where((a, b) => orderIds.Contains(a.OrderId)) + .Select((a, b) => new { OrderId = a.OrderId, Name = b.Name }) + .ToListAsync(); - //await Context.Queryable() - // .Includes(a => a.OrderTemplates) - // .Select(a => new TrackOrderVO - // { - // Id=a.Id, - // OrderNumber=a.OrderNo, - // TrackTemplateNames = SqlFunc.Subqueryable().Where(z=>z.OrderId==a.Id).SelectStringJoin(z=>z.) - // }) - // .ToPageListAsync(input.PageIndex, input.PageSize); + pageList.List.ForEach(a => + { + var templateListOfOrderId = trackTemplateList.Where(b => b.OrderId== a.Id); + a.TrackTemplateNames = templateListOfOrderId.Select(c => c.Name).JoinAsString(","); + }); + } - return null; + return pageList; } #endregion From 2998d69ed967eb3cde148a16ba3013dbd014c5e0 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Fri, 1 Mar 2024 09:11:27 +0800 Subject: [PATCH 11/16] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E6=A0=87=E8=AE=B0?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E8=BE=93=E5=85=A5=E5=8F=82=E6=95=B0=EF=BC=8C?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E4=B8=B2=E7=B1=BB=E5=9E=8B=E5=8A=A0=E4=B8=8A?= =?UTF-8?q?=20=3F=20=E5=8F=AF=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/TrackFlags/EditTrackFlagInput.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SJZY.Track.Application/Dtos/TrackFlags/EditTrackFlagInput.cs b/src/SJZY.Track.Application/Dtos/TrackFlags/EditTrackFlagInput.cs index 05c9b56c..901f5e5a 100644 --- a/src/SJZY.Track.Application/Dtos/TrackFlags/EditTrackFlagInput.cs +++ b/src/SJZY.Track.Application/Dtos/TrackFlags/EditTrackFlagInput.cs @@ -26,12 +26,12 @@ namespace SJZY.Track.Application.Dtos.TrackFlags /// /// 标记 /// - public string Flag { get; set; } + public string? Flag { get; set; } /// /// 代码 /// - public string Code { get; set; } + public string? Code { get; set; } /// /// 是否完结 From c3886b1d8b45222930626d00ae3c1943b8942bfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Fri, 1 Mar 2024 09:26:11 +0800 Subject: [PATCH 12/16] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E6=8E=A8=E9=80=81=E9=85=8D=E7=BD=AE=E5=88=97=E8=A1=A8=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutoMapper/TrackPullAutoMapperProfile.cs | 17 ++++----- .../AutoMapper/TrackPushAutoMapperProfile.cs | 10 +++++ .../Services/TrackPull/TrackPullService.cs | 1 - .../Services/TrackPush/TrackPushService.cs | 38 +++++++++++++++++++ .../ITrackPushConfigRepository.cs | 6 ++- .../GetTrackPullConfigPageOutputVO.cs | 2 +- .../GetTrackPushConfigPageOutputVO.cs | 26 +++++++++++++ .../TrackPushConfigRepository.cs | 29 ++++++++++++++ 8 files changed, 117 insertions(+), 12 deletions(-) create mode 100644 src/SJZY.Track.Application/AutoMapper/TrackPushAutoMapperProfile.cs create mode 100644 src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs create mode 100644 src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushConfigPageOutputVO.cs diff --git a/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs index 3577eceb..da6207a5 100644 --- a/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs @@ -3,16 +3,15 @@ using SJZY.Track.Application.Dtos.TrackPull; using SJZY.Track.Domain.Aggregates.TrackPullAggregate; using Volo.Abp.AutoMapper; -namespace SJZY.Track.Application.AutoMapper +namespace SJZY.Track.Application.AutoMapper; + +public class TrackPullAutoMapperProfile : Profile { - public class TrackPullAutoMapperProfile : Profile + public TrackPullAutoMapperProfile() { - public TrackPullAutoMapperProfile() - { - CreateMap(MemberList.None); - CreateMap(MemberList.None).Ignore(dest => dest.Id) - .ForMember(dest => dest.IsPush, opt => opt.MapFrom(source => false)); - CreateMap(MemberList.None); - } + CreateMap(MemberList.None); + CreateMap(MemberList.None).Ignore(dest => dest.Id) + .ForMember(dest => dest.IsPush, opt => opt.MapFrom(source => false)); + CreateMap(MemberList.None); } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/AutoMapper/TrackPushAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackPushAutoMapperProfile.cs new file mode 100644 index 00000000..420b0e23 --- /dev/null +++ b/src/SJZY.Track.Application/AutoMapper/TrackPushAutoMapperProfile.cs @@ -0,0 +1,10 @@ +using AutoMapper; + +namespace SJZY.Track.Application.AutoMapper; + +public class TrackPushAutoMapperProfile : Profile +{ + public TrackPushAutoMapperProfile() + { + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs index f76abe50..fcd56e92 100644 --- a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs +++ b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs @@ -2,7 +2,6 @@ using SJZY.Expand.ABP.Core.Localization; using SJZY.Expand.ABP.Core.PublicMethords; using SJZY.Track.Application.Dtos.TrackPull; -using SJZY.Track.Application.Dtos.TrackTemplates; using SJZY.Track.Application.Localization; using SJZY.Track.Domain.Aggregates.TrackPullAggregate; using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; diff --git a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs new file mode 100644 index 00000000..b04e1194 --- /dev/null +++ b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs @@ -0,0 +1,38 @@ +using Microsoft.Extensions.Localization; +using SJZY.Track.Application.Localization; +using SJZY.Track.Domain.Aggregates.TrackPushAggregate; +using SJZY.Track.Domain.Dtos.Common; +using SJZY.Track.Domain.Dtos.TrackPush; +using Volo.Abp.DependencyInjection; + +namespace SJZY.Track.Application.Services.TrackPush; + +/// +/// 轨迹推送 +/// +[ApiExplorerSettings(GroupName = "轨迹推送")] +[Route("/Track/PushConfig")] +public class TrackPushService : ApplicationService, ITransientDependency +{ + private readonly IStringLocalizer _stringLocalizer; + private readonly ITrackPushConfigRepository _trackPushConfigRepository; + + public TrackPushService( + IStringLocalizer stringLocalizer, + ITrackPushConfigRepository trackPushConfigRepository) + { + _stringLocalizer = stringLocalizer; + _trackPushConfigRepository = trackPushConfigRepository; + } + + /// + /// 轨迹推送配置列表 + /// + /// + /// + [HttpPost("GetPage")] + public async Task> GetPageAsync([FromBody] KeywordsInputVO input) + { + return await _trackPushConfigRepository.GetPageAsync(input); + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs index abceffa6..82866c1f 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs @@ -1,5 +1,9 @@ -namespace SJZY.Track.Domain.Aggregates.TrackPushAggregate; +using SJZY.Track.Domain.Dtos.Common; +using SJZY.Track.Domain.Dtos.TrackPush; + +namespace SJZY.Track.Domain.Aggregates.TrackPushAggregate; public interface ITrackPushConfigRepository : IBasicRepository { + Task> GetPageAsync(KeywordsInputVO input); } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullConfigPageOutputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullConfigPageOutputVO.cs index e45b7de8..15d25401 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullConfigPageOutputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullConfigPageOutputVO.cs @@ -7,7 +7,7 @@ public class GetTrackPullConfigPageOutputVO /// public DateTime? CreateTime { get; set; } - public int? Id { get; set; } + public int Id { get; set; } /// /// 服务商名称 diff --git a/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushConfigPageOutputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushConfigPageOutputVO.cs new file mode 100644 index 00000000..9b2e3a83 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushConfigPageOutputVO.cs @@ -0,0 +1,26 @@ +namespace SJZY.Track.Domain.Dtos.TrackPush; + +public class GetTrackPushConfigPageOutputVO +{ + /// + /// 创建时间 + /// + public DateTime? CreateTime { get; set; } + + /// + /// 客户名称 + /// + public string CustomName { get; set; } + + public int Id { get; set; } + + /// + /// 子系统名称 + /// + public string SubSystem { get; set; } + + /// + /// 模板名称 + /// + public string TrackTemplate { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackPushConfigRepository.cs b/src/SJZY.Track.Repository/TrackPushConfigRepository.cs index 32c71905..a69f2406 100644 --- a/src/SJZY.Track.Repository/TrackPushConfigRepository.cs +++ b/src/SJZY.Track.Repository/TrackPushConfigRepository.cs @@ -1,8 +1,37 @@ using SJZY.Track.Domain.Aggregates.TrackPushAggregate; +using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; +using SJZY.Track.Domain.Dtos.Common; +using SJZY.Track.Domain.Dtos.TrackPush; +using SJZY.Track.Domain.VEntities; +using SJZY.Track.Repository.VData.Entitys; namespace SJZY.Track.Repository; public class TrackPushConfigRepository : BasicRepository, ITrackPushConfigRepository, IScopedDependency { + public async Task> GetPageAsync(KeywordsInputVO input) + { + return await AsQueryable() + .LeftJoin((trackPush, system) => trackPush.SubSystemId == system.Id && !system.IsDeleted) + .LeftJoin((trackPush, system, externalSubject) => trackPush.CustomId == externalSubject.Id && !externalSubject.IsDeleted) + .LeftJoin((trackPush, system, externalSubject, template) => SqlFunc.SplitIn(trackPush.TrackTemplateId, template.Id.ToString()) && !template.IsDeleted) + .Filter(null, true) + .Where(trackPush => !trackPush.IsDeleted) + .WhereIF(input.SubSystemId.HasValue, trackPush => trackPush.SubSystemId == input.SubSystemId) + .WhereIF(!input.Keywords.IsNullOrWhiteSpace(), (trackPush, system, externalSubject, template) => externalSubject.Name.Contains(input.Keywords) || template.Name.Contains(input.Keywords)) + .OrderByDescending(trackPush => trackPush.CreateTime) + .Select((trackPush, system, externalSubject, template) => new GetTrackPushConfigPageOutputVO + { + Id = trackPush.Id, + SubSystem = system.CnName, + CustomName = externalSubject.Abbreviation, + TrackTemplate = SqlFunc.Subqueryable() + .Where(template => SqlFunc.SplitIn(trackPush.TrackTemplateId, template.Id.ToString()) && !template.IsDeleted) + .SelectStringJoin(template => template.Name, ","), + CreateTime = trackPush.CreateTime + }) + .Distinct() + .ToPagedListAsync(input.PageIndex, input.PageSize); + } } \ No newline at end of file From 3260a70fe60622539fd54b39280867d206fd415f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com> Date: Fri, 1 Mar 2024 09:39:35 +0800 Subject: [PATCH 13/16] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SJZY.Track.Api.sln | 2 +- src/SJZY.Track.Api/SJZY.Track.Api.csproj | 2 +- src/SJZY.Track.Api/SJZYTrackApiModule.cs | 4 ++-- .../SJZY.Track.Application.csproj | 1 + .../Services/ProvideServices/TrackService.cs | 7 +++++-- src/SJZY.Track.Domain/SJZY.Track.Domain.csproj | 1 - .../BasicQuery.cs | 2 +- .../DataBaseContext.cs | 2 +- .../Enum/Enums.cs | 5 ++--- .../GlobalUsing.cs | 2 +- .../Queries/TrackQueries.cs | 2 +- .../Repositories}/BasicRepository.cs | 2 +- .../Repositories}/DemoRepository.cs | 2 +- .../Repositories}/OrderRepository.cs | 2 +- .../Repositories}/TrackContentRepository.cs | 3 +-- .../Repositories}/TrackDetailsRepository.cs | 2 +- .../Repositories}/TrackFlagRepository.cs | 4 +--- .../Repositories}/TrackPullConfigRepository.cs | 6 +++--- .../Repositories}/TrackPushConfigRepository.cs | 2 +- .../Repositories}/TrackStatusRepository.cs | 2 +- .../Repositories}/TrackTemplateRepository.cs | 4 ++-- .../SJZY.Track.Infrastructure.csproj} | 6 ++++-- .../SJZYTrackInfrastructureModule.cs} | 5 +++-- .../TrackPushRecord/Entitys/TrackPushRecordEntity.cs | 2 +- .../Services/ITrackPushRecordRepository.cs | 8 ++++++++ .../Services/TrackPushRecordRepository.cs | 10 ++++++++++ .../Entitys/TrackPushRecordDetailsEntity.cs | 2 +- .../Services/ITrackPushRecordDetailsRepository.cs | 8 ++++++++ .../Services/TrackPushRecordDetailsRepository.cs | 10 ++++++++++ .../Services/ITrackPushRecordRepository.cs | 9 --------- .../Services/TrackPushRecordRepository.cs | 9 --------- .../Services/ITrackPushRecordDetailsRepository.cs | 9 --------- .../Services/TrackPushRecordDetailsRepository.cs | 9 --------- test/SJZY.Track.Test/TestModule.cs | 4 ++-- 34 files changed, 76 insertions(+), 74 deletions(-) rename src/{SJZY.Track.Repository => SJZY.Track.Infrastructure}/BasicQuery.cs (96%) rename src/{SJZY.Track.Repository => SJZY.Track.Infrastructure}/DataBaseContext.cs (98%) rename src/{SJZY.Track.Repository => SJZY.Track.Infrastructure}/Enum/Enums.cs (66%) rename src/{SJZY.Track.Repository => SJZY.Track.Infrastructure}/GlobalUsing.cs (85%) rename src/{SJZY.Track.Repository => SJZY.Track.Infrastructure}/Queries/TrackQueries.cs (98%) rename src/{SJZY.Track.Repository => SJZY.Track.Infrastructure/Repositories}/BasicRepository.cs (97%) rename src/{SJZY.Track.Repository => SJZY.Track.Infrastructure/Repositories}/DemoRepository.cs (99%) rename src/{SJZY.Track.Repository => SJZY.Track.Infrastructure/Repositories}/OrderRepository.cs (98%) rename src/{SJZY.Track.Repository => SJZY.Track.Infrastructure/Repositories}/TrackContentRepository.cs (97%) rename src/{SJZY.Track.Repository => SJZY.Track.Infrastructure/Repositories}/TrackDetailsRepository.cs (98%) rename src/{SJZY.Track.Repository => SJZY.Track.Infrastructure/Repositories}/TrackFlagRepository.cs (94%) rename src/{SJZY.Track.Repository => SJZY.Track.Infrastructure/Repositories}/TrackPullConfigRepository.cs (97%) rename src/{SJZY.Track.Repository => SJZY.Track.Infrastructure/Repositories}/TrackPushConfigRepository.cs (79%) rename src/{SJZY.Track.Repository => SJZY.Track.Infrastructure/Repositories}/TrackStatusRepository.cs (98%) rename src/{SJZY.Track.Repository => SJZY.Track.Infrastructure/Repositories}/TrackTemplateRepository.cs (98%) rename src/{SJZY.Track.Repository/SJZY.Track.Repository.csproj => SJZY.Track.Infrastructure/SJZY.Track.Infrastructure.csproj} (81%) rename src/{SJZY.Track.Repository/SJZYTrackRepositoryModule.cs => SJZY.Track.Infrastructure/SJZYTrackInfrastructureModule.cs} (92%) rename src/{SJZY.Track.Repository => SJZY.Track.Infrastructure}/TrackPushRecord/Entitys/TrackPushRecordEntity.cs (96%) create mode 100644 src/SJZY.Track.Infrastructure/TrackPushRecord/Services/ITrackPushRecordRepository.cs create mode 100644 src/SJZY.Track.Infrastructure/TrackPushRecord/Services/TrackPushRecordRepository.cs rename src/{SJZY.Track.Repository => SJZY.Track.Infrastructure}/TrackPushRecordDetails/Entitys/TrackPushRecordDetailsEntity.cs (94%) create mode 100644 src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Services/ITrackPushRecordDetailsRepository.cs create mode 100644 src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Services/TrackPushRecordDetailsRepository.cs delete mode 100644 src/SJZY.Track.Repository/TrackPushRecord/Services/ITrackPushRecordRepository.cs delete mode 100644 src/SJZY.Track.Repository/TrackPushRecord/Services/TrackPushRecordRepository.cs delete mode 100644 src/SJZY.Track.Repository/TrackPushRecordDetails/Services/ITrackPushRecordDetailsRepository.cs delete mode 100644 src/SJZY.Track.Repository/TrackPushRecordDetails/Services/TrackPushRecordDetailsRepository.cs diff --git a/SJZY.Track.Api.sln b/SJZY.Track.Api.sln index 8a9c51e8..c1408517 100644 --- a/SJZY.Track.Api.sln +++ b/SJZY.Track.Api.sln @@ -10,7 +10,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{DAC93270-5A2 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{0E2537C3-6EF3-4085-9BD2-CF923E53F82A}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SJZY.Track.Repository", "src\SJZY.Track.Repository\SJZY.Track.Repository.csproj", "{D9CF5706-1972-414F-821E-AA32C13B8570}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SJZY.Track.Infrastructure", "src\SJZY.Track.Infrastructure\SJZY.Track.Infrastructure.csproj", "{D9CF5706-1972-414F-821E-AA32C13B8570}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SJZY.Track.HttpApi", "src\SJZY.Track.HttpApi\SJZY.Track.HttpApi.csproj", "{390A44FB-0DB5-4B66-86AB-7712DC3030F5}" EndProject diff --git a/src/SJZY.Track.Api/SJZY.Track.Api.csproj b/src/SJZY.Track.Api/SJZY.Track.Api.csproj index 44113706..0dd07648 100644 --- a/src/SJZY.Track.Api/SJZY.Track.Api.csproj +++ b/src/SJZY.Track.Api/SJZY.Track.Api.csproj @@ -26,7 +26,7 @@ - + diff --git a/src/SJZY.Track.Api/SJZYTrackApiModule.cs b/src/SJZY.Track.Api/SJZYTrackApiModule.cs index 93e04188..07bb3fee 100644 --- a/src/SJZY.Track.Api/SJZYTrackApiModule.cs +++ b/src/SJZY.Track.Api/SJZYTrackApiModule.cs @@ -9,7 +9,7 @@ using SJZY.Expand.ABP.Core.Prometheus; using SJZY.Expand.ABP.Core.Redis; using SJZY.Expand.ABP.Core.Swagger; using SJZY.Track.Application; -using SJZY.Track.Repository; +using SJZY.Track.Infrastructure; using Volo.Abp; using Volo.Abp.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Serilog; @@ -28,7 +28,7 @@ namespace SJZY.Track.Api typeof(AbpAspNetCoreMvcModule), typeof(AbpAspNetCoreSerilogModule), typeof(ApplicationModule), - typeof(SJZYTrackRepositoryModule) + typeof(SJZYTrackInfrastructureModule) )] public class SJZYTrackApiModule : AbpModule { diff --git a/src/SJZY.Track.Application/SJZY.Track.Application.csproj b/src/SJZY.Track.Application/SJZY.Track.Application.csproj index 43edd929..76ef0752 100644 --- a/src/SJZY.Track.Application/SJZY.Track.Application.csproj +++ b/src/SJZY.Track.Application/SJZY.Track.Application.csproj @@ -26,5 +26,6 @@ + diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs index 5147ae93..7077cfb3 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs @@ -1,4 +1,5 @@ -using SJZY.Track.Application.Dtos.ProvideServices; +using DotNetCore.CAP; +using SJZY.Track.Application.Dtos.ProvideServices; using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; using SJZY.Track.Domain.Queries; @@ -15,13 +16,15 @@ public class TrackService : ApplicationService private readonly IOrderRepository _orderRepository; private readonly ITrackDetailsRepository _trackDetailsRepository; private readonly ITrackQueries _trackQueries; + private readonly ICapPublisher _capPublisher; public TrackService(ITrackQueries trackQueries, IOrderRepository orderRepository, - ITrackDetailsRepository trackDetailsRepository) + ITrackDetailsRepository trackDetailsRepository, ICapPublisher capPublisher) { _trackQueries = trackQueries; _orderRepository = orderRepository; _trackDetailsRepository = trackDetailsRepository; + _capPublisher = capPublisher; } /// diff --git a/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj b/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj index 5ebeded5..aac0e12d 100644 --- a/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj +++ b/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj @@ -9,7 +9,6 @@ - diff --git a/src/SJZY.Track.Repository/BasicQuery.cs b/src/SJZY.Track.Infrastructure/BasicQuery.cs similarity index 96% rename from src/SJZY.Track.Repository/BasicQuery.cs rename to src/SJZY.Track.Infrastructure/BasicQuery.cs index 4d8e70d1..75ee80b2 100644 --- a/src/SJZY.Track.Repository/BasicQuery.cs +++ b/src/SJZY.Track.Infrastructure/BasicQuery.cs @@ -2,7 +2,7 @@ using SJZY.Track.Domain.Queries; using SJZY.Track.Domain.SeedWork; -namespace SJZY.Track.Repository; +namespace SJZY.Track.Infrastructure; #pragma warning disable CS8613 public class BasicQuery : SimpleClient, IBasicQuery where T : class, IEntity, new() diff --git a/src/SJZY.Track.Repository/DataBaseContext.cs b/src/SJZY.Track.Infrastructure/DataBaseContext.cs similarity index 98% rename from src/SJZY.Track.Repository/DataBaseContext.cs rename to src/SJZY.Track.Infrastructure/DataBaseContext.cs index 88539836..9fbb7d44 100644 --- a/src/SJZY.Track.Repository/DataBaseContext.cs +++ b/src/SJZY.Track.Infrastructure/DataBaseContext.cs @@ -2,7 +2,7 @@ #pragma warning disable 1591 -namespace SJZY.Track.Repository; +namespace SJZY.Track.Infrastructure; /// /// Sqlsugar 上下文对象 diff --git a/src/SJZY.Track.Repository/Enum/Enums.cs b/src/SJZY.Track.Infrastructure/Enum/Enums.cs similarity index 66% rename from src/SJZY.Track.Repository/Enum/Enums.cs rename to src/SJZY.Track.Infrastructure/Enum/Enums.cs index f32f511c..a2246eed 100644 --- a/src/SJZY.Track.Repository/Enum/Enums.cs +++ b/src/SJZY.Track.Infrastructure/Enum/Enums.cs @@ -1,6 +1,6 @@ using System.ComponentModel; -namespace SJZY.Track.Repository.Enum; +namespace SJZY.Track.Infrastructure.Enum; /// /// 枚举属性 @@ -10,6 +10,5 @@ public enum EnumPropertyEnums /// /// 节点 /// - [Description("ServiceNode")] - 节点, + [Description("ServiceNode")] 节点, } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/GlobalUsing.cs b/src/SJZY.Track.Infrastructure/GlobalUsing.cs similarity index 85% rename from src/SJZY.Track.Repository/GlobalUsing.cs rename to src/SJZY.Track.Infrastructure/GlobalUsing.cs index dc581267..bb8c080a 100644 --- a/src/SJZY.Track.Repository/GlobalUsing.cs +++ b/src/SJZY.Track.Infrastructure/GlobalUsing.cs @@ -4,4 +4,4 @@ global using SJZY.Expand.ABP.Core.SqlSugar; global using SJZY.Expand.ABP.Core.SqlSugar.Entitys; global using SJZY.Expand.ABP.Core.SqlSugar.Tools; global using SqlSugar; -global using Volo.Abp.DependencyInjection; +global using Volo.Abp.DependencyInjection; \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Queries/TrackQueries.cs b/src/SJZY.Track.Infrastructure/Queries/TrackQueries.cs similarity index 98% rename from src/SJZY.Track.Repository/Queries/TrackQueries.cs rename to src/SJZY.Track.Infrastructure/Queries/TrackQueries.cs index da7c4dab..413c38fe 100644 --- a/src/SJZY.Track.Repository/Queries/TrackQueries.cs +++ b/src/SJZY.Track.Infrastructure/Queries/TrackQueries.cs @@ -7,7 +7,7 @@ using SJZY.Track.Domain.Dtos.TrackDetails; using SJZY.Track.Domain.Dtos.TrackTemplate; using SJZY.Track.Domain.Queries; -namespace SJZY.Track.Repository.Queries; +namespace SJZY.Track.Infrastructure.Queries; public class TrackQueries : ISugarRepository, ITrackQueries, ITransientDependency diff --git a/src/SJZY.Track.Repository/BasicRepository.cs b/src/SJZY.Track.Infrastructure/Repositories/BasicRepository.cs similarity index 97% rename from src/SJZY.Track.Repository/BasicRepository.cs rename to src/SJZY.Track.Infrastructure/Repositories/BasicRepository.cs index a4616860..48c7f89c 100644 --- a/src/SJZY.Track.Repository/BasicRepository.cs +++ b/src/SJZY.Track.Infrastructure/Repositories/BasicRepository.cs @@ -3,7 +3,7 @@ using SJZY.Track.Domain; using SJZY.Track.Domain.SeedWork; using Volo.Abp; -namespace SJZY.Track.Repository; +namespace SJZY.Track.Infrastructure.Repositories; /// /// 仓储基类实现 diff --git a/src/SJZY.Track.Repository/DemoRepository.cs b/src/SJZY.Track.Infrastructure/Repositories/DemoRepository.cs similarity index 99% rename from src/SJZY.Track.Repository/DemoRepository.cs rename to src/SJZY.Track.Infrastructure/Repositories/DemoRepository.cs index 18a8d5da..9acceca7 100644 --- a/src/SJZY.Track.Repository/DemoRepository.cs +++ b/src/SJZY.Track.Infrastructure/Repositories/DemoRepository.cs @@ -2,7 +2,7 @@ using SJZY.Track.Domain.Aggregates.DemoAggregate; using SJZY.Track.Domain.Dtos.Demo; -namespace SJZY.Track.Repository; +namespace SJZY.Track.Infrastructure.Repositories; public class DemoRepository : BasicRepository, IDemoRepository, IScopedDependency { diff --git a/src/SJZY.Track.Repository/OrderRepository.cs b/src/SJZY.Track.Infrastructure/Repositories/OrderRepository.cs similarity index 98% rename from src/SJZY.Track.Repository/OrderRepository.cs rename to src/SJZY.Track.Infrastructure/Repositories/OrderRepository.cs index c932f142..18bc7cc4 100644 --- a/src/SJZY.Track.Repository/OrderRepository.cs +++ b/src/SJZY.Track.Infrastructure/Repositories/OrderRepository.cs @@ -2,7 +2,7 @@ using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.Track.Domain.Dtos.Order; -namespace SJZY.Track.Repository; +namespace SJZY.Track.Infrastructure.Repositories; public class OrderRepository : BasicRepository, IOrderRepository, ITransientDependency { diff --git a/src/SJZY.Track.Repository/TrackContentRepository.cs b/src/SJZY.Track.Infrastructure/Repositories/TrackContentRepository.cs similarity index 97% rename from src/SJZY.Track.Repository/TrackContentRepository.cs rename to src/SJZY.Track.Infrastructure/Repositories/TrackContentRepository.cs index 896d02d4..eac2265f 100644 --- a/src/SJZY.Track.Repository/TrackContentRepository.cs +++ b/src/SJZY.Track.Infrastructure/Repositories/TrackContentRepository.cs @@ -2,10 +2,9 @@ using SJZY.Track.Domain.Aggregates.TrackFlagAggregate; 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; +namespace SJZY.Track.Infrastructure.Repositories; public class TrackContentRepository : BasicRepository, ITrackContentRepository, IScopedDependency { diff --git a/src/SJZY.Track.Repository/TrackDetailsRepository.cs b/src/SJZY.Track.Infrastructure/Repositories/TrackDetailsRepository.cs similarity index 98% rename from src/SJZY.Track.Repository/TrackDetailsRepository.cs rename to src/SJZY.Track.Infrastructure/Repositories/TrackDetailsRepository.cs index ef51db46..2737c39d 100644 --- a/src/SJZY.Track.Repository/TrackDetailsRepository.cs +++ b/src/SJZY.Track.Infrastructure/Repositories/TrackDetailsRepository.cs @@ -3,7 +3,7 @@ using SJZY.Expand.ElasticSearch.Services; using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; using SJZY.Track.Domain.Dtos.TrackDetails; -namespace SJZY.Track.Repository; +namespace SJZY.Track.Infrastructure.Repositories; internal class TrackDetailsRepository : ElasticSearchContextAbstract, ITrackDetailsRepository, ITransientDependency diff --git a/src/SJZY.Track.Repository/TrackFlagRepository.cs b/src/SJZY.Track.Infrastructure/Repositories/TrackFlagRepository.cs similarity index 94% rename from src/SJZY.Track.Repository/TrackFlagRepository.cs rename to src/SJZY.Track.Infrastructure/Repositories/TrackFlagRepository.cs index 508d80ef..12c29447 100644 --- a/src/SJZY.Track.Repository/TrackFlagRepository.cs +++ b/src/SJZY.Track.Infrastructure/Repositories/TrackFlagRepository.cs @@ -1,10 +1,8 @@ using SJZY.Track.Domain.Aggregates.TrackFlagAggregate; -using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; using SJZY.Track.Domain.Dtos.TrackFlags; -using SJZY.Track.Domain.Dtos.TrackStatus; using SJZY.Track.Domain.VEntities; -namespace SJZY.Track.Repository; +namespace SJZY.Track.Infrastructure.Repositories; public class TrackFlagRepository : BasicRepository, ITrackFlagRepository, IScopedDependency { diff --git a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs b/src/SJZY.Track.Infrastructure/Repositories/TrackPullConfigRepository.cs similarity index 97% rename from src/SJZY.Track.Repository/TrackPullConfigRepository.cs rename to src/SJZY.Track.Infrastructure/Repositories/TrackPullConfigRepository.cs index dbcb40be..796e6778 100644 --- a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs +++ b/src/SJZY.Track.Infrastructure/Repositories/TrackPullConfigRepository.cs @@ -1,12 +1,12 @@ -using SJZY.Track.Domain.Aggregates.TrackContentAggregate; +using System.Linq.Expressions; +using SJZY.Track.Domain.Aggregates.TrackContentAggregate; using SJZY.Track.Domain.Aggregates.TrackPullAggregate; using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; using SJZY.Track.Domain.Dtos.Common; using SJZY.Track.Domain.Dtos.TrackPull; using SJZY.Track.Domain.VEntities; -using System.Linq.Expressions; -namespace SJZY.Track.Repository; +namespace SJZY.Track.Infrastructure.Repositories; public class TrackPullConfigRepository : BasicRepository, ITrackPullConfigRepository, IScopedDependency diff --git a/src/SJZY.Track.Repository/TrackPushConfigRepository.cs b/src/SJZY.Track.Infrastructure/Repositories/TrackPushConfigRepository.cs similarity index 79% rename from src/SJZY.Track.Repository/TrackPushConfigRepository.cs rename to src/SJZY.Track.Infrastructure/Repositories/TrackPushConfigRepository.cs index 32c71905..70008005 100644 --- a/src/SJZY.Track.Repository/TrackPushConfigRepository.cs +++ b/src/SJZY.Track.Infrastructure/Repositories/TrackPushConfigRepository.cs @@ -1,6 +1,6 @@ using SJZY.Track.Domain.Aggregates.TrackPushAggregate; -namespace SJZY.Track.Repository; +namespace SJZY.Track.Infrastructure.Repositories; public class TrackPushConfigRepository : BasicRepository, ITrackPushConfigRepository, IScopedDependency diff --git a/src/SJZY.Track.Repository/TrackStatusRepository.cs b/src/SJZY.Track.Infrastructure/Repositories/TrackStatusRepository.cs similarity index 98% rename from src/SJZY.Track.Repository/TrackStatusRepository.cs rename to src/SJZY.Track.Infrastructure/Repositories/TrackStatusRepository.cs index 9e88da35..a9218613 100644 --- a/src/SJZY.Track.Repository/TrackStatusRepository.cs +++ b/src/SJZY.Track.Infrastructure/Repositories/TrackStatusRepository.cs @@ -2,7 +2,7 @@ using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; using SJZY.Track.Domain.Dtos.TrackStatus; using SJZY.Track.Domain.VEntities; -namespace SJZY.Track.Repository; +namespace SJZY.Track.Infrastructure.Repositories; public class TrackStatusRepository : BasicRepository, ITrackStatusRepository, IScopedDependency { diff --git a/src/SJZY.Track.Repository/TrackTemplateRepository.cs b/src/SJZY.Track.Infrastructure/Repositories/TrackTemplateRepository.cs similarity index 98% rename from src/SJZY.Track.Repository/TrackTemplateRepository.cs rename to src/SJZY.Track.Infrastructure/Repositories/TrackTemplateRepository.cs index 43fff1f5..c3e3a9c0 100644 --- a/src/SJZY.Track.Repository/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Infrastructure/Repositories/TrackTemplateRepository.cs @@ -6,9 +6,9 @@ using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; using SJZY.Track.Domain.Dtos.TrackTemplate; using SJZY.Track.Domain.VEntities; -using SJZY.Track.Repository.Enum; +using SJZY.Track.Infrastructure.Enum; -namespace SJZY.Track.Repository; +namespace SJZY.Track.Infrastructure.Repositories; public class TrackTemplateRepository : BasicRepository, ITrackTemplateRepository, IScopedDependency { diff --git a/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj b/src/SJZY.Track.Infrastructure/SJZY.Track.Infrastructure.csproj similarity index 81% rename from src/SJZY.Track.Repository/SJZY.Track.Repository.csproj rename to src/SJZY.Track.Infrastructure/SJZY.Track.Infrastructure.csproj index 42332f80..f1e677f8 100644 --- a/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj +++ b/src/SJZY.Track.Infrastructure/SJZY.Track.Infrastructure.csproj @@ -17,8 +17,10 @@ - - + + + + diff --git a/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs b/src/SJZY.Track.Infrastructure/SJZYTrackInfrastructureModule.cs similarity index 92% rename from src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs rename to src/SJZY.Track.Infrastructure/SJZYTrackInfrastructureModule.cs index 799c900a..7f18046a 100644 --- a/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs +++ b/src/SJZY.Track.Infrastructure/SJZYTrackInfrastructureModule.cs @@ -4,17 +4,18 @@ using SJZY.Expand.ABP.Core.SqlSugar.Options; using SJZY.Expand.ElasticSearch; using SJZY.Track.Domain; using SJZY.Track.Domain.Queries; +using SJZY.Track.Infrastructure.Repositories; using Volo.Abp.Autofac; using Volo.Abp.Modularity; -namespace SJZY.Track.Repository; +namespace SJZY.Track.Infrastructure; /// /// 仓储模块 /// [DependsOn(typeof(AbpAutofacModule))] [DependsOn(typeof(SJZYTrackDomainModule))] -public class SJZYTrackRepositoryModule : AbpModule +public class SJZYTrackInfrastructureModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) { diff --git a/src/SJZY.Track.Repository/TrackPushRecord/Entitys/TrackPushRecordEntity.cs b/src/SJZY.Track.Infrastructure/TrackPushRecord/Entitys/TrackPushRecordEntity.cs similarity index 96% rename from src/SJZY.Track.Repository/TrackPushRecord/Entitys/TrackPushRecordEntity.cs rename to src/SJZY.Track.Infrastructure/TrackPushRecord/Entitys/TrackPushRecordEntity.cs index 9b45f7c2..32615bba 100644 --- a/src/SJZY.Track.Repository/TrackPushRecord/Entitys/TrackPushRecordEntity.cs +++ b/src/SJZY.Track.Infrastructure/TrackPushRecord/Entitys/TrackPushRecordEntity.cs @@ -1,6 +1,6 @@ using SJZY.Track.Domain.SeedWork; -namespace SJZY.Track.Repository.TrackPushRecord.Entitys +namespace SJZY.Track.Infrastructure.TrackPushRecord.Entitys { /// /// 轨迹推送记录 diff --git a/src/SJZY.Track.Infrastructure/TrackPushRecord/Services/ITrackPushRecordRepository.cs b/src/SJZY.Track.Infrastructure/TrackPushRecord/Services/ITrackPushRecordRepository.cs new file mode 100644 index 00000000..7b2e515e --- /dev/null +++ b/src/SJZY.Track.Infrastructure/TrackPushRecord/Services/ITrackPushRecordRepository.cs @@ -0,0 +1,8 @@ +using SJZY.Track.Infrastructure.TrackPushRecord.Entitys; + +namespace SJZY.Track.Infrastructure.TrackPushRecord.Services +{ + public interface ITrackPushRecordRepository : ISimpleClient + { + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Infrastructure/TrackPushRecord/Services/TrackPushRecordRepository.cs b/src/SJZY.Track.Infrastructure/TrackPushRecord/Services/TrackPushRecordRepository.cs new file mode 100644 index 00000000..22529060 --- /dev/null +++ b/src/SJZY.Track.Infrastructure/TrackPushRecord/Services/TrackPushRecordRepository.cs @@ -0,0 +1,10 @@ +using SJZY.Track.Infrastructure.Repositories; +using SJZY.Track.Infrastructure.TrackPushRecord.Entitys; + +namespace SJZY.Track.Infrastructure.TrackPushRecord.Services +{ + public class TrackPushRecordRepository : BasicRepository, ITrackPushRecordRepository, IScopedDependency + { + + } +} diff --git a/src/SJZY.Track.Repository/TrackPushRecordDetails/Entitys/TrackPushRecordDetailsEntity.cs b/src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Entitys/TrackPushRecordDetailsEntity.cs similarity index 94% rename from src/SJZY.Track.Repository/TrackPushRecordDetails/Entitys/TrackPushRecordDetailsEntity.cs rename to src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Entitys/TrackPushRecordDetailsEntity.cs index 64208102..796e3e47 100644 --- a/src/SJZY.Track.Repository/TrackPushRecordDetails/Entitys/TrackPushRecordDetailsEntity.cs +++ b/src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Entitys/TrackPushRecordDetailsEntity.cs @@ -1,6 +1,6 @@ using SJZY.Track.Domain.SeedWork; -namespace SJZY.Track.Repository.TrackPushRecordDetails.Entitys +namespace SJZY.Track.Infrastructure.TrackPushRecordDetails.Entitys { /// /// 轨迹推送明细表 diff --git a/src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Services/ITrackPushRecordDetailsRepository.cs b/src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Services/ITrackPushRecordDetailsRepository.cs new file mode 100644 index 00000000..6f29bbc3 --- /dev/null +++ b/src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Services/ITrackPushRecordDetailsRepository.cs @@ -0,0 +1,8 @@ +using SJZY.Track.Infrastructure.TrackPushRecordDetails.Entitys; + +namespace SJZY.Track.Infrastructure.TrackPushRecordDetails.Services +{ + public interface ITrackPushRecordDetailsRepository : ISimpleClient + { + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Services/TrackPushRecordDetailsRepository.cs b/src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Services/TrackPushRecordDetailsRepository.cs new file mode 100644 index 00000000..157dc8bd --- /dev/null +++ b/src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Services/TrackPushRecordDetailsRepository.cs @@ -0,0 +1,10 @@ +using SJZY.Track.Infrastructure.Repositories; +using SJZY.Track.Infrastructure.TrackPushRecordDetails.Entitys; + +namespace SJZY.Track.Infrastructure.TrackPushRecordDetails.Services +{ + public class TrackPushRecordDetailsRepository : BasicRepository, ITrackPushRecordDetailsRepository, IScopedDependency + { + + } +} diff --git a/src/SJZY.Track.Repository/TrackPushRecord/Services/ITrackPushRecordRepository.cs b/src/SJZY.Track.Repository/TrackPushRecord/Services/ITrackPushRecordRepository.cs deleted file mode 100644 index cac702c2..00000000 --- a/src/SJZY.Track.Repository/TrackPushRecord/Services/ITrackPushRecordRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.TrackPushRecord.Entitys; - -namespace SJZY.Track.Repository.TrackPushRecord.Services -{ - public interface ITrackPushRecordRepository : ISimpleClient - { - - } -} diff --git a/src/SJZY.Track.Repository/TrackPushRecord/Services/TrackPushRecordRepository.cs b/src/SJZY.Track.Repository/TrackPushRecord/Services/TrackPushRecordRepository.cs deleted file mode 100644 index 06a72739..00000000 --- a/src/SJZY.Track.Repository/TrackPushRecord/Services/TrackPushRecordRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.TrackPushRecord.Entitys; - -namespace SJZY.Track.Repository.TrackPushRecord.Services -{ - public class TrackPushRecordRepository : BasicRepository, ITrackPushRecordRepository, IScopedDependency - { - - } -} diff --git a/src/SJZY.Track.Repository/TrackPushRecordDetails/Services/ITrackPushRecordDetailsRepository.cs b/src/SJZY.Track.Repository/TrackPushRecordDetails/Services/ITrackPushRecordDetailsRepository.cs deleted file mode 100644 index 85047d16..00000000 --- a/src/SJZY.Track.Repository/TrackPushRecordDetails/Services/ITrackPushRecordDetailsRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.TrackPushRecordDetails.Entitys; - -namespace SJZY.Track.Repository.TrackPushRecordDetails.Services -{ - public interface ITrackPushRecordDetailsRepository : ISimpleClient - { - - } -} diff --git a/src/SJZY.Track.Repository/TrackPushRecordDetails/Services/TrackPushRecordDetailsRepository.cs b/src/SJZY.Track.Repository/TrackPushRecordDetails/Services/TrackPushRecordDetailsRepository.cs deleted file mode 100644 index 20cd54e3..00000000 --- a/src/SJZY.Track.Repository/TrackPushRecordDetails/Services/TrackPushRecordDetailsRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.TrackPushRecordDetails.Entitys; - -namespace SJZY.Track.Repository.TrackPushRecordDetails.Services -{ - public class TrackPushRecordDetailsRepository : BasicRepository, ITrackPushRecordDetailsRepository, IScopedDependency - { - - } -} diff --git a/test/SJZY.Track.Test/TestModule.cs b/test/SJZY.Track.Test/TestModule.cs index 8cff2d50..43bc8f71 100644 --- a/test/SJZY.Track.Test/TestModule.cs +++ b/test/SJZY.Track.Test/TestModule.cs @@ -2,7 +2,7 @@ using Microsoft.Extensions.DependencyInjection; using SJZY.Track.Api; using SJZY.Track.Application; -using SJZY.Track.Repository; +using SJZY.Track.Infrastructure; using Volo.Abp; using Volo.Abp.AspNetCore.TestBase; using Volo.Abp.Authorization; @@ -19,7 +19,7 @@ namespace SJZY.Track.Test; typeof(AbpAspNetCoreTestBaseModule), typeof(AbpAutofacModule), typeof(AbpAuthorizationModule), - typeof(SJZYTrackRepositoryModule), + typeof(SJZYTrackInfrastructureModule), typeof(ApplicationModule), typeof(SJZYTrackApiModule), typeof(AbpHttpClientModule) //添加abp的http代理模块 From 3578e82bedf6cf8687ea30eb3bfb1829608f8660 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Fri, 1 Mar 2024 09:44:41 +0800 Subject: [PATCH 14/16] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E6=8E=A8=E9=80=81=E9=85=8D=E7=BD=AE=E5=86=85=E5=AE=B9=E5=88=97?= =?UTF-8?q?=E8=A1=A8=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackPush/TrackPushService.cs | 11 ++++ .../ITrackPushConfigRepository.cs | 2 + .../GetTrackPushContentPageInputVO.cs | 9 +++ .../GetTrackPushContentPageOutputVO.cs | 56 +++++++++++++++++++ .../TrackPushConfigRepository.cs | 19 ++++++- 5 files changed, 95 insertions(+), 2 deletions(-) create mode 100644 src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushContentPageInputVO.cs create mode 100644 src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushContentPageOutputVO.cs diff --git a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs index b04e1194..4acda516 100644 --- a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs +++ b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs @@ -35,4 +35,15 @@ public class TrackPushService : ApplicationService, ITransientDependency { return await _trackPushConfigRepository.GetPageAsync(input); } + + /// + /// 轨迹推送配置内容列表 + /// + /// + /// + [HttpPost("GetContentPage")] + public async Task> GetContentPageAsync([FromBody] GetTrackPushContentPageInputVO input) + { + return await _trackPushConfigRepository.GetContentPageAsync(input); + } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs index 82866c1f..ce41da3b 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs @@ -6,4 +6,6 @@ namespace SJZY.Track.Domain.Aggregates.TrackPushAggregate; public interface ITrackPushConfigRepository : IBasicRepository { Task> GetPageAsync(KeywordsInputVO input); + + Task> GetContentPageAsync(GetTrackPushContentPageInputVO input); } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushContentPageInputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushContentPageInputVO.cs new file mode 100644 index 00000000..f0558e95 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushContentPageInputVO.cs @@ -0,0 +1,9 @@ +namespace SJZY.Track.Domain.Dtos.TrackPush; + +public class GetTrackPushContentPageInputVO : PageInfoInput +{ + /// + /// 轨迹推送配置id + /// + public int TrackPushConfigId { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushContentPageOutputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushContentPageOutputVO.cs new file mode 100644 index 00000000..b3ae2d3f --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushContentPageOutputVO.cs @@ -0,0 +1,56 @@ +namespace SJZY.Track.Domain.Dtos.TrackPush; + +public class GetTrackPushContentPageOutputVO +{ + /// + /// 轨迹内容代码 + /// + public string Code { get; set; } + + /// + /// 轨迹内容 + /// + public string Content { get; set; } + + /// + /// 轨迹内容英文 + /// + public string EnContent { get; set; } + + /// + /// 推送扩展字段 + /// + public string ExpandFieldsValue { get; set; } + + public int Id { get; set; } + + /// + /// 推送单号类型 + /// + public string OrderNoType { get; set; } + + /// + /// 推送排序 + /// + public int Sort { get; set; } + + /// + /// 推送轨迹内容代码 + /// + public string TrackContentCodeValue { get; set; } + + /// + /// 推送轨迹内容 + /// + public string TrackContentValue { get; set; } + + /// + /// 推送轨迹内容英文 + /// + public string TrackEnContentValue { get; set; } + + /// + /// 推送轨迹状态 + /// + public string TrackStatusValue { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackPushConfigRepository.cs b/src/SJZY.Track.Repository/TrackPushConfigRepository.cs index a69f2406..5d15dab1 100644 --- a/src/SJZY.Track.Repository/TrackPushConfigRepository.cs +++ b/src/SJZY.Track.Repository/TrackPushConfigRepository.cs @@ -1,4 +1,5 @@ -using SJZY.Track.Domain.Aggregates.TrackPushAggregate; +using SJZY.Track.Domain.Aggregates.TrackContentAggregate; +using SJZY.Track.Domain.Aggregates.TrackPushAggregate; using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; using SJZY.Track.Domain.Dtos.Common; using SJZY.Track.Domain.Dtos.TrackPush; @@ -19,7 +20,7 @@ public class TrackPushConfigRepository : BasicRepository, .Filter(null, true) .Where(trackPush => !trackPush.IsDeleted) .WhereIF(input.SubSystemId.HasValue, trackPush => trackPush.SubSystemId == input.SubSystemId) - .WhereIF(!input.Keywords.IsNullOrWhiteSpace(), (trackPush, system, externalSubject, template) => externalSubject.Name.Contains(input.Keywords) || template.Name.Contains(input.Keywords)) + .WhereIF(!input.Keywords.IsNullOrWhiteSpace(), (trackPush, system, externalSubject, template) => externalSubject.Abbreviation.Contains(input.Keywords) || externalSubject.Name.Contains(input.Keywords) || template.Name.Contains(input.Keywords)) .OrderByDescending(trackPush => trackPush.CreateTime) .Select((trackPush, system, externalSubject, template) => new GetTrackPushConfigPageOutputVO { @@ -34,4 +35,18 @@ public class TrackPushConfigRepository : BasicRepository, .Distinct() .ToPagedListAsync(input.PageIndex, input.PageSize); } + + public async Task> GetContentPageAsync(GetTrackPushContentPageInputVO input) + { + return await Context.Queryable() + .InnerJoin((pushContent, trackContent) => pushContent.TrackContentId == trackContent.Id) + .Where(pushContent => pushContent.TrackPushConfigId == input.TrackPushConfigId) + .OrderBy((pushContent, trackContent) => pushContent.Sort) + .Select((pushContent, trackContent) => new GetTrackPushContentPageOutputVO + { + Id = pushContent.Id, + Sort = pushContent.Sort + }, true) + .ToPagedListAsync(input.PageIndex, input.PageSize); + } } \ No newline at end of file From 0763cbf2631c4c948cb74c3f65dcde58473e8aee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com> Date: Fri, 1 Mar 2024 09:48:49 +0800 Subject: [PATCH 15/16] =?UTF-8?q?=E9=87=8D=E7=BB=84=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SJZY.Track.Api.sln.DotSettings | 2 ++ .../SJZY.Track.Application.csproj | 11 ++++++----- .../Enums/EnumPropertyEnums.cs} | 2 +- src/SJZY.Track.Domain/IBasicRepository.cs | 2 +- .../{ => Queries}/BasicQuery.cs | 2 +- .../Repositories/BasicRepository.cs | 3 ++- .../Repositories/TrackTemplateRepository.cs | 2 +- .../SJZYTrackInfrastructureModule.cs | 1 + 8 files changed, 15 insertions(+), 10 deletions(-) create mode 100644 SJZY.Track.Api.sln.DotSettings rename src/{SJZY.Track.Infrastructure/Enum/Enums.cs => SJZY.Track.Domain/Enums/EnumPropertyEnums.cs} (83%) rename src/SJZY.Track.Infrastructure/{ => Queries}/BasicQuery.cs (95%) diff --git a/SJZY.Track.Api.sln.DotSettings b/SJZY.Track.Api.sln.DotSettings new file mode 100644 index 00000000..2363a683 --- /dev/null +++ b/SJZY.Track.Api.sln.DotSettings @@ -0,0 +1,2 @@ + + True \ No newline at end of file diff --git a/src/SJZY.Track.Application/SJZY.Track.Application.csproj b/src/SJZY.Track.Application/SJZY.Track.Application.csproj index 76ef0752..ccc853da 100644 --- a/src/SJZY.Track.Application/SJZY.Track.Application.csproj +++ b/src/SJZY.Track.Application/SJZY.Track.Application.csproj @@ -17,15 +17,16 @@ - - - - + + + + + + - diff --git a/src/SJZY.Track.Infrastructure/Enum/Enums.cs b/src/SJZY.Track.Domain/Enums/EnumPropertyEnums.cs similarity index 83% rename from src/SJZY.Track.Infrastructure/Enum/Enums.cs rename to src/SJZY.Track.Domain/Enums/EnumPropertyEnums.cs index a2246eed..e1c08aaf 100644 --- a/src/SJZY.Track.Infrastructure/Enum/Enums.cs +++ b/src/SJZY.Track.Domain/Enums/EnumPropertyEnums.cs @@ -1,6 +1,6 @@ using System.ComponentModel; -namespace SJZY.Track.Infrastructure.Enum; +namespace SJZY.Track.Domain.Enums; /// /// 枚举属性 diff --git a/src/SJZY.Track.Domain/IBasicRepository.cs b/src/SJZY.Track.Domain/IBasicRepository.cs index 71bc3175..8e9baed2 100644 --- a/src/SJZY.Track.Domain/IBasicRepository.cs +++ b/src/SJZY.Track.Domain/IBasicRepository.cs @@ -35,7 +35,7 @@ public interface IBasicRepository : IBasicQuery where T : IAggregateRoot /// /// 要更新的列 /// - Task UpdateRangeAsync(List entities, Expression> updateColumns = null); + Task UpdateRangeAsync(List entities, Expression>? updateColumns = null); /// /// 软删 diff --git a/src/SJZY.Track.Infrastructure/BasicQuery.cs b/src/SJZY.Track.Infrastructure/Queries/BasicQuery.cs similarity index 95% rename from src/SJZY.Track.Infrastructure/BasicQuery.cs rename to src/SJZY.Track.Infrastructure/Queries/BasicQuery.cs index 75ee80b2..fbb511c7 100644 --- a/src/SJZY.Track.Infrastructure/BasicQuery.cs +++ b/src/SJZY.Track.Infrastructure/Queries/BasicQuery.cs @@ -2,7 +2,7 @@ using SJZY.Track.Domain.Queries; using SJZY.Track.Domain.SeedWork; -namespace SJZY.Track.Infrastructure; +namespace SJZY.Track.Infrastructure.Queries; #pragma warning disable CS8613 public class BasicQuery : SimpleClient, IBasicQuery where T : class, IEntity, new() diff --git a/src/SJZY.Track.Infrastructure/Repositories/BasicRepository.cs b/src/SJZY.Track.Infrastructure/Repositories/BasicRepository.cs index 48c7f89c..a776fd88 100644 --- a/src/SJZY.Track.Infrastructure/Repositories/BasicRepository.cs +++ b/src/SJZY.Track.Infrastructure/Repositories/BasicRepository.cs @@ -1,6 +1,7 @@ using System.Linq.Expressions; using SJZY.Track.Domain; using SJZY.Track.Domain.SeedWork; +using SJZY.Track.Infrastructure.Queries; using Volo.Abp; namespace SJZY.Track.Infrastructure.Repositories; @@ -32,7 +33,7 @@ public class BasicRepository : BasicQuery, IBasicRepository where T : c .ExecuteCommandHasChangeAsync(); } - public async Task UpdateRangeAsync(List entities, Expression> columns = null) + public async Task UpdateRangeAsync(List entities, Expression>? columns = null) { return await Context.Updateable(entities) .UpdateColumnsIF(columns != null, columns) diff --git a/src/SJZY.Track.Infrastructure/Repositories/TrackTemplateRepository.cs b/src/SJZY.Track.Infrastructure/Repositories/TrackTemplateRepository.cs index c3e3a9c0..d4ae27a6 100644 --- a/src/SJZY.Track.Infrastructure/Repositories/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Infrastructure/Repositories/TrackTemplateRepository.cs @@ -5,8 +5,8 @@ using SJZY.Track.Domain.Aggregates.TrackFlagAggregate; using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; using SJZY.Track.Domain.Dtos.TrackTemplate; +using SJZY.Track.Domain.Enums; using SJZY.Track.Domain.VEntities; -using SJZY.Track.Infrastructure.Enum; namespace SJZY.Track.Infrastructure.Repositories; diff --git a/src/SJZY.Track.Infrastructure/SJZYTrackInfrastructureModule.cs b/src/SJZY.Track.Infrastructure/SJZYTrackInfrastructureModule.cs index 7f18046a..c412b69c 100644 --- a/src/SJZY.Track.Infrastructure/SJZYTrackInfrastructureModule.cs +++ b/src/SJZY.Track.Infrastructure/SJZYTrackInfrastructureModule.cs @@ -4,6 +4,7 @@ using SJZY.Expand.ABP.Core.SqlSugar.Options; using SJZY.Expand.ElasticSearch; using SJZY.Track.Domain; using SJZY.Track.Domain.Queries; +using SJZY.Track.Infrastructure.Queries; using SJZY.Track.Infrastructure.Repositories; using Volo.Abp.Autofac; using Volo.Abp.Modularity; From adc30d39c77ca5f1cf31901f89c905134c14b73e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Fri, 1 Mar 2024 10:12:14 +0800 Subject: [PATCH 16/16] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E6=8E=A8=E9=80=81=E9=85=8D=E7=BD=AE=E8=AF=A6=E6=83=85=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackPush/TrackPushService.cs | 11 +++ .../ITrackPushConfigRepository.cs | 2 + .../GetTrackPushConfigDetailOutputVO.cs | 98 +++++++++++++++++++ .../Repositories/TrackPushConfigRepository.cs | 20 ++++ 4 files changed, 131 insertions(+) create mode 100644 src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushConfigDetailOutputVO.cs diff --git a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs index 4acda516..f303cc4c 100644 --- a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs +++ b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs @@ -46,4 +46,15 @@ public class TrackPushService : ApplicationService, ITransientDependency { return await _trackPushConfigRepository.GetContentPageAsync(input); } + + /// + /// 轨迹推送配置详情 + /// + /// + /// + [HttpGet("GetDetail")] + public async Task GetDetailAsync(int id) + { + return await _trackPushConfigRepository.GetDetailAsync(id); + } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs index ce41da3b..9050f090 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs @@ -8,4 +8,6 @@ public interface ITrackPushConfigRepository : IBasicRepository> GetPageAsync(KeywordsInputVO input); Task> GetContentPageAsync(GetTrackPushContentPageInputVO input); + + Task GetDetailAsync(int id); } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushConfigDetailOutputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushConfigDetailOutputVO.cs new file mode 100644 index 00000000..6e9cd961 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushConfigDetailOutputVO.cs @@ -0,0 +1,98 @@ +using SJZY.Expand.ABP.Core.PublicMethords; + +namespace SJZY.Track.Domain.Dtos.TrackPush; + +public class GetTrackPushConfigDetailOutputVO +{ + /// + /// 客户id + /// + public int CustomId { get; set; } + + /// + /// 客户 + /// + public string CustomName { get; set; } + + /// + /// 推送扩展字段 + /// + public string ExpandFieldsName { get; set; } + + public int Id { get; set; } + + /// + /// 是否自动推送 + /// + public bool IsAutoPush { get; set; } + + /// + /// 推送轨迹订单号 + /// + public string OrderNoName { get; set; } + + /// + /// 服务商 + /// + public string ServiceProvider { get; set; } + + /// + /// 服务商id + /// + public int ServiceProviderId { get; set; } + + /// + /// 子系统 + /// + public string SubSystem { get; set; } + + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 推送轨迹时区 + /// + public string TackTimeZoneName { get; set; } + + /// + /// 推送轨迹内容代码 + /// + public string TrackContentCodeName { get; set; } + + /// + /// 推送轨迹内容 + /// + public string TrackContentName { get; set; } + + /// + /// 推送轨迹内容英文 + /// + public string TrackEnContentName { get; set; } + + /// + /// 推送轨迹发生地 + /// + public string TrackPlaceName { get; set; } + + /// + /// 推送轨迹状态 + /// + public string TrackStatusName { get; set; } + + /// + /// 轨迹模板 + /// + public List TrackTemplate { get; set; } + + /// + /// 轨迹模板id + /// + public int TrackTemplateId { get; set; } + + /// + /// 推送轨迹发生时间 + /// + public string TrackTimeName { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Infrastructure/Repositories/TrackPushConfigRepository.cs b/src/SJZY.Track.Infrastructure/Repositories/TrackPushConfigRepository.cs index 788741ca..d5180da1 100644 --- a/src/SJZY.Track.Infrastructure/Repositories/TrackPushConfigRepository.cs +++ b/src/SJZY.Track.Infrastructure/Repositories/TrackPushConfigRepository.cs @@ -1,4 +1,5 @@ using SJZY.Track.Domain.Aggregates.TrackContentAggregate; +using SJZY.Track.Domain.Aggregates.TrackPullAggregate; using SJZY.Track.Domain.Aggregates.TrackPushAggregate; using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; using SJZY.Track.Domain.Dtos.Common; @@ -49,4 +50,23 @@ public class TrackPushConfigRepository : BasicRepository, }, true) .ToPagedListAsync(input.PageIndex, input.PageSize); } + + public async Task GetDetailAsync(int id) + { + return await AsQueryable() + .LeftJoin((trackPush, system) => trackPush.SubSystemId == system.Id && !system.IsDeleted) + .LeftJoin((trackPush, system, externalSubject) => trackPush.CustomId == externalSubject.Id && !externalSubject.IsDeleted) + .LeftJoin((trackPush, system, externalSubject, service) => trackPush.ServiceProviderId == service.Id && !service.IsDeleted) + .InnerJoin((trackPush, system, externalSubject, service, paramsConfig) => trackPush.Id == paramsConfig.PullOrPushConfigId && paramsConfig.IsPush && !paramsConfig.IsDeleted) + .Filter(null, true) + .Where(trackPush => trackPush.Id == id && !trackPush.IsDeleted) + .Select((trackPush, system, externalSubject, service, paramsConfig) => new GetTrackPushConfigDetailOutputVO + { + Id = trackPush.Id, + SubSystem = system.CnName, + CustomName = externalSubject.Abbreviation, + ServiceProvider = service.Name, + }, true) + .SingleAsync(); + } } \ No newline at end of file