diff --git a/src/SJZY.Track.Api/appsettings.Test.json b/src/SJZY.Track.Api/appsettings.Test.json index 825693ce..c62fc382 100644 --- a/src/SJZY.Track.Api/appsettings.Test.json +++ b/src/SJZY.Track.Api/appsettings.Test.json @@ -7,8 +7,8 @@ } }, "ConnectionStrings": { - "DefaultConnection": "server=192.168.80.84;Database=sjzy_package_setting;Uid=sjzy_test_user;Pwd=848c1c31;AllowLoadLocalInfile=true;SslMode=None;Charset=utf8mb4;", - "canalView": "server=192.168.80.84;Database=sjzy_data_center;Uid=sjzy_test_user;Pwd=848c1c31;AllowLoadLocalInfile=true;SslMode=None;Charset=utf8mb4;" + "DefaultConnection": "server=mysql-test.default.svc.cluster.local;Database=sjzy_track;Uid=sjzy_test_user;Pwd=848c1c31;AllowLoadLocalInfile=true;SslMode=None;Charset=utf8mb4;", + "canalView": "server=mysql-test.default.svc.cluster.local;Database=sjzy_track;Uid=sjzy_test_user;Pwd=848c1c31;AllowLoadLocalInfile=true;SslMode=None;Charset=utf8mb4;" }, "Redis": { "ConnectionString": "192.168.80.58:6379,abortConnect=false", diff --git a/src/SJZY.Track.Api/appsettings.json b/src/SJZY.Track.Api/appsettings.json index 676973d6..d69cb0c1 100644 --- a/src/SJZY.Track.Api/appsettings.json +++ b/src/SJZY.Track.Api/appsettings.json @@ -5,7 +5,7 @@ "Apollo": { "AppId": "SJZY.Track.Configuration", "Env": "DEV", - "Namespace": "Dev", + "Namespace": "Test", "MetaServer": "http://apollo-service-test-apollo-configservice.apollo.svc.cluster.local:8080", "ConfigServer": [ "http://apollo-service-test-apollo-configservice.apollo.svc.cluster.local:8080" ] } diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetTrackDetailDto.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetTrackDetailDto.cs index 86e5db45..08f7824d 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetTrackDetailDto.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetTrackDetailDto.cs @@ -56,6 +56,11 @@ /// public string SubSystem { set; get; } + /// + /// 子系统id + /// + public int SubSystemId { set; get; } + /// /// 创建时间 /// diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs index 007e06d0..aaf59008 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs @@ -94,7 +94,6 @@ public class OrderService : ApplicationService #endregion #region 轨迹订单列表 - /// /// 获取分页的轨迹订单 /// @@ -109,7 +108,6 @@ public class OrderService : ApplicationService ObjectMapper.Map, UnifyPageResultDto>(pageList); return pageResultDto; } - #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 02f6d9b0..aa554a9a 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs @@ -1,5 +1,7 @@ using SJZY.Track.Application.Contract.Dtos.ProvideServices; +using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; +using SJZY.Track.Domain.Dtos.Order; using SJZY.Track.Domain.Queries; namespace SJZY.Track.Application.Services.ProvideServices; @@ -11,12 +13,15 @@ namespace SJZY.Track.Application.Services.ProvideServices; public class TrackQueryService : ApplicationService { private readonly ITrackDetailsRepository _trackDetailsRepository; + private readonly IOrderRepository _orderRepository; private readonly IProvideQueries _provideQueries; public TrackQueryService(ITrackDetailsRepository trackDetailsRepository, + IOrderRepository orderRepository, IProvideQueries provideQueries) { _trackDetailsRepository = trackDetailsRepository; + _orderRepository=orderRepository; _provideQueries = provideQueries; } @@ -63,6 +68,43 @@ public class TrackQueryService : ApplicationService return res; } + #region 轨迹订单明细列表 + /// + /// 根据轨迹订单id获取轨迹订单明细列表 + /// + /// + /// + [HttpPost("/Track/GetDetails")] + public async Task> GetOrderDetails(GetOrderDetailsInput input) + { + var trackDetails = await _trackDetailsRepository.GetListAsync(input.OrderId); + if (!trackDetails.IsNullOrEmpty()) + { + var list = ObjectMapper.Map, List>(trackDetails); + return list; + } + + return new List(); + } + #endregion + + #region 轨迹订单分页 + /// + /// 获取分页的轨迹订单 + /// + /// + /// + [HttpPost("/Track/GetTrackOrderList")] + public async Task> GetPageTrackOrder(GetPageTrackOrderInput input) + { + var vo = ObjectMapper.Map(input); + var pageList = await _orderRepository.GetPageTrackOrder(vo); + var pageResultDto = + ObjectMapper.Map, UnifyPageResultDto>(pageList); + return pageResultDto; + } + #endregion + private async Task TrackDetailSort(List list, GetTrackInput input) { switch (input.SortMethod) diff --git a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs index 6e8d42e7..f4946435 100644 --- a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs +++ b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs @@ -193,21 +193,24 @@ namespace SJZY.Track.Application.Services.TrackContents private async Task DeleteAsync(EditTrackContentInput input) { #region 业务校验 - //查询是否关联了轨迹模版内容 - var trackTemplateContents = await _trackTemplateContentBasicQuery.GetListAsync(a => a.TrackContentId == input.Id); - if (trackTemplateContents.Any()) + var isExistTemplate = await _trackContentRepository.GetTemplateIsExist(input.Id); + if (isExistTemplate) { throw new BusinessException(message: "该轨迹内容关联轨迹模板,禁止删除"); } + //var trackTemplateContents = await _trackTemplateContentBasicQuery.GetListAsync(a => a.TrackContentId == input.Id); + //if (trackTemplateContents.Any()) + //{ + // throw new BusinessException(message: "该轨迹内容关联轨迹模板,禁止删除"); + //} //需要加个判断,存在内容映射,则出提示 - var trackContentMapEntities = await _trackContentMapBasicQuery.GetListAsync(a => a.TrackContentId == input.Id || a.MapTrackContentId == input.Id); - if (trackContentMapEntities.Any()) - { - throw new BusinessException(message: "无法删除该内容,该轨迹内容已在轨迹内容映射中使用了,请检查"); - } - + //var trackContentMapEntities = await _trackContentMapBasicQuery.GetListAsync(a => a.TrackContentId == input.Id || a.MapTrackContentId == input.Id); + //if (trackContentMapEntities.Any()) + //{ + // throw new BusinessException(message: "无法删除该内容,该轨迹内容已在轨迹内容映射中使用了,请检查"); + //} #endregion 业务校验 var isTrue = await _trackContentRepository.SoftDeleteAsync(x => x.Id == input.Id); diff --git a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs index c1f22afb..979d412d 100644 --- a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs +++ b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs @@ -163,7 +163,7 @@ public class TrackStatusService : ApplicationService, ITransientDependency if (isExistStatus!=null) { //throw new BusinessException(message: _stringLocalizer["IsExistTrackStatus"]); - throw new BusinessException(message: "轨迹内容已经绑定了该轨迹状态,请先删除轨迹内容后再删除该轨迹状态"); + throw new BusinessException(message: "该状态关联轨迹内容,禁止删除"); } #endregion var isTrue = await _trackStatusRepository.SoftDeleteAsync(x => x.Id == input.Id); diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs index 6981c6ed..525add23 100644 --- a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs +++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs @@ -163,13 +163,13 @@ public class TrackTemplateService : ApplicationService, ITransientDependency if (isExisistTrackPullConfigs.Any()) { //throw new BusinessException(message: _stringLocalizer["IsExistTrackPullConfig"]); - throw new BusinessException(message: "轨迹拉取配置里已经绑定模版,请检查"); + throw new BusinessException(message: "该模板存在映射,禁止删除"); } //轨迹推送里看看是否被占用 var isExisistTrackPushConfigs = await _trackPushConfigRepository.GetListAsync(a => a.TrackTemplateId.Contains(input.Id.ToString())); if (isExisistTrackPushConfigs.Any()) { - throw new BusinessException(message: "轨迹推送配置里已经绑定模版,请检查"); + throw new BusinessException(message: "该模板存在映射,禁止删除"); } #endregion 业务校验 diff --git a/src/SJZY.Track.Application/SjzyTrackApplicationModule.cs b/src/SJZY.Track.Application/SjzyTrackApplicationModule.cs index b876d5bd..2bea18a6 100644 --- a/src/SJZY.Track.Application/SjzyTrackApplicationModule.cs +++ b/src/SJZY.Track.Application/SjzyTrackApplicationModule.cs @@ -48,11 +48,13 @@ namespace SJZY.Track.Application }); //添加多语言 + var languageConfig = configuration.GetSection("Language"); Configure(options => { options.Resources .Add("zh") .AddBaseTypes(typeof(SjzyBasicLocalization)) + .AddRedisResource(languageConfig) .AddVirtualJson("/Localization/Resources"); }); //授权拦截提示 diff --git a/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs index cc7a54e9..511d4feb 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs @@ -23,4 +23,5 @@ public interface ITrackContentRepository : IBasicRepository Task SoftDeleteMapAsync(Expression> whereExpression); Task UpdateMapAsync(Expression> columns, Expression> whereExpression); + Task GetTemplateIsExist(int trackContentId); } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateDetailVO.cs b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateDetailVO.cs index 1fa28d92..46677e0e 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateDetailVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateDetailVO.cs @@ -56,6 +56,11 @@ public class GetTrackTemplateListVO /// public string SubSystem { set; get; } + /// + /// 子系统id + /// + public int SubSystemId { set; get; } + /// /// 创建时间 /// diff --git a/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs index fcd51bd1..b1a0cda0 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs @@ -1,6 +1,7 @@ using SJZY.Track.Domain.Aggregates.TrackContentAggregate; using SJZY.Track.Domain.Aggregates.TrackFlagAggregate; using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; +using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; using SJZY.Track.Domain.Dtos.TrackContents; using SJZY.Track.Domain.VEntities; using System.Linq; @@ -88,6 +89,32 @@ public class TrackContentRepository : BasicRepository, ITrac return pagedList; } + /// + /// 获取轨迹模版是否存在 + /// + /// + /// + public async Task GetTemplateIsExist(int trackContentId) + { + //var trackTemplateContents = await _trackTemplateContentBasicQuery.GetListAsync(a => a.TrackContentId == input.Id); + var trackContentEntities = await Context.Queryable().LeftJoin((a, b) => a.Id==b.TrackContentId && b.IsDeleted==false) + .LeftJoin((a, b, c) => b.TrackTemplateId==c.Id&& c.IsDeleted==false) + .Where((a, b, c) => a.Id==trackContentId) + .Select((a, b, c) => new + { + TrackContentId = a.Id, + TemplateId = c.Id + }) + .ToListAsync(); + + if (trackContentEntities.Any(a => a.TemplateId>0)) + { + return true; + } + + return false; + } + public async Task> GetMapPageAsync(GetTrackContentMapPageInputVO input) { return await Context.Queryable() diff --git a/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs index d414e5c8..3bb1cfd9 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs @@ -55,7 +55,8 @@ public class TrackTemplateRepository : BasicRepository, ITr Code = a.Code, CreateTime = a.CreateTime, Name = a.Name, - SubSystem = b.CnName + SubSystem = b.CnName, + SubSystemId = b.Id }) .ToPagedListAsync(input.PageIndex, input.PageSize); //.OrderByIF(input.TrackTemplateId > 0,