This commit is contained in:
xiaolipro 2025-08-01 18:01:44 +08:00
parent e25b0ba048
commit 44fddf4843
6 changed files with 52 additions and 78 deletions

View File

@ -1,3 +1,4 @@
using InterfaceForward.Domain.Shared.Helpers;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using TrackCenter.Application.Dtos.ProvideServices; using TrackCenter.Application.Dtos.ProvideServices;
@ -18,16 +19,16 @@ namespace TrackCenter.Application.Services.ProvideServices;
[Route("/ProviderService")] [Route("/ProviderService")]
public class TrackPullService : ApplicationServiceBase public class TrackPullService : ApplicationServiceBase
{ {
private readonly IHttpClientProxy<IInterfaceForwardServiceV2> _httpClientProxy;
private readonly IOptionsMonitor<InterfaceRelayParamsConfigOptions> _options; private readonly IOptionsMonitor<InterfaceRelayParamsConfigOptions> _options;
private readonly ProvideQueries _provideQueries; private readonly ProvideQueries _provideQueries;
private readonly InterfaceForwardService _interfaceForwardService;
public TrackPullService(ProvideQueries provideQueries, public TrackPullService(ProvideQueries provideQueries,
IHttpClientProxy<IInterfaceForwardServiceV2> httpClientProxy, InterfaceForwardService interfaceForwardService,
IOptionsMonitor<InterfaceRelayParamsConfigOptions> options) IOptionsMonitor<InterfaceRelayParamsConfigOptions> options)
{ {
_provideQueries = provideQueries; _provideQueries = provideQueries;
_httpClientProxy = httpClientProxy; _interfaceForwardService = interfaceForwardService;
_options = options; _options = options;
} }
@ -73,7 +74,7 @@ public class TrackPullService : ApplicationServiceBase
new Track2InterfaceRelaySubSystemContext(group.Key.SubSystemCode))) new Track2InterfaceRelaySubSystemContext(group.Key.SubSystemCode)))
{ {
// 批量获取轨迹 // 批量获取轨迹
var res = await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync( var res = await _interfaceForwardService.BatchForwardThenPushToQueueAsync(
_options.CurrentValue.GetTrackInterfaceCode, serviceProviderCode, data, _options.CurrentValue.GetTrackInterfaceCode, serviceProviderCode, data,
GlobalConst.TrackRefreshSubscribe, GlobalConst.TrackRefreshSubscribe,
attach); attach);

View File

@ -1,19 +1,15 @@
using DotNetCore.CAP; using DotNetCore.CAP;
using SJZY.Expand.ABP.Core.Common;
using TrackCenter.Application.Dtos.ProvideServices; using TrackCenter.Application.Dtos.ProvideServices;
using TrackCenter.Application.Dtos.TrackOrder; using TrackCenter.Application.Dtos.TrackOrder;
using TrackCenter.Application.Dtos.TrackPush; using TrackCenter.Application.Dtos.TrackPush;
using TrackCenter.Application.Events; using TrackCenter.Application.Events;
using TrackCenter.Application.Services.ProvideServices;
using TrackCenter.Domain.Aggregates.OrderAggregate; using TrackCenter.Domain.Aggregates.OrderAggregate;
using TrackCenter.Domain.Aggregates.TrackDetailsAggregate; using TrackCenter.Domain.Aggregates.TrackDetailsAggregate;
using TrackCenter.Domain.Aggregates.TrackPushAggregate; using TrackCenter.Domain.Aggregates.TrackPushAggregate;
using TrackCenter.Domain.Dtos.TrackPush; using TrackCenter.Domain.Dtos.TrackPush;
using TrackCenter.Domain.Extensions; using TrackCenter.Domain.Extensions;
using TrackCenter.Domain.Queries;
using SJZY.UserCenter.HttpApi.Services.User;
using TrackCenter.Application.Helpers; using TrackCenter.Application.Helpers;
using Volo.Abp.Http.Client.DynamicProxying; using TrackCenter.Application.Queries;
namespace TrackCenter.Application.Services.ProvideServices; namespace TrackCenter.Application.Services.ProvideServices;
@ -22,12 +18,11 @@ namespace TrackCenter.Application.Services.ProvideServices;
/// </summary> /// </summary>
[ApiExplorerSettings(GroupName = "提供接口")] [ApiExplorerSettings(GroupName = "提供接口")]
[Route("/ProviderService")] [Route("/ProviderService")]
public class TrackPushService : ApplicationServiceBase, ITrackPushService public class TrackPushService : ApplicationServiceBase
{ {
private readonly ICapPublisher _capPublisher; private readonly ICapPublisher _capPublisher;
private readonly IOrderRepository _orderRepository; private readonly IOrderRepository _orderRepository;
private readonly IProvideQueries _provideQueries; private readonly ProvideQueries _provideQueries;
private readonly IHttpClientProxy<IUserBaseInfoService> _requestCurrentUserService;
private readonly ITrackPushConfigRepository _trackPushConfigRepository; private readonly ITrackPushConfigRepository _trackPushConfigRepository;
private readonly ITrackPushRecordEsRepository _trackPushRecordEsRepository; private readonly ITrackPushRecordEsRepository _trackPushRecordEsRepository;
private readonly ITrackDetailsEsRepository _trackDetailsEsRepository; private readonly ITrackDetailsEsRepository _trackDetailsEsRepository;
@ -35,14 +30,12 @@ public class TrackPushService : ApplicationServiceBase, ITrackPushService
public TrackPushService(IOrderRepository orderRepository public TrackPushService(IOrderRepository orderRepository
, ICapPublisher capPublisher , ICapPublisher capPublisher
, ITrackPushRecordEsRepository trackPushRecordEsRepository , ITrackPushRecordEsRepository trackPushRecordEsRepository
, IHttpClientProxy<IUserBaseInfoService> requestCurrentUserService , ITrackPushConfigRepository trackPushConfigRepository, ProvideQueries provideQueries,
, ITrackPushConfigRepository trackPushConfigRepository, IProvideQueries provideQueries,
ITrackDetailsEsRepository trackDetailsEsRepository) ITrackDetailsEsRepository trackDetailsEsRepository)
{ {
_orderRepository = orderRepository; _orderRepository = orderRepository;
_capPublisher = capPublisher; _capPublisher = capPublisher;
_trackPushRecordEsRepository = trackPushRecordEsRepository; _trackPushRecordEsRepository = trackPushRecordEsRepository;
_requestCurrentUserService = requestCurrentUserService;
_trackPushConfigRepository = trackPushConfigRepository; _trackPushConfigRepository = trackPushConfigRepository;
_provideQueries = provideQueries; _provideQueries = provideQueries;
_trackDetailsEsRepository = trackDetailsEsRepository; _trackDetailsEsRepository = trackDetailsEsRepository;
@ -54,13 +47,12 @@ public class TrackPushService : ApplicationServiceBase, ITrackPushService
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost("Track/Push")] [HttpPost("Track/Push")]
[CustomerResult] public async Task PushTrackAsync(PushTrackInput input)
public async Task<UnifyResultDto> PushTrackAsync(PushTrackInput input)
{ {
input.OrderNos = input.OrderNos.Where(x => !x.IsNullOrWhiteSpace()).Distinct().ToList(); // 单号去重、去空 input.OrderNos = input.OrderNos.Where(x => !x.IsNullOrWhiteSpace()).Distinct().ToList(); // 单号去重、去空
var subSystemCode = await _provideQueries.SubSystemId2CodeAsync(input.SubSystemId); var subSystemCode = await _provideQueries.SubSystemId2CodeAsync(input.SubSystemId);
var orders = await _orderRepository.GetArrayAsync(x => var orders = await _orderRepository.GetListAsync(x =>
x.SubSystemId == input.SubSystemId x.SubSystemId == input.SubSystemId
&& x.OrderType == input.OrderType && x.OrderType == input.OrderType
&& input.OrderNos.Contains(x.OrderNo), x => new && input.OrderNos.Contains(x.OrderNo), x => new
@ -73,14 +65,7 @@ public class TrackPushService : ApplicationServiceBase, ITrackPushService
{ {
throw new BusinessException(message: "一个订单都不存在"); throw new BusinessException(message: "一个订单都不存在");
} }
var name = CurrentUser.UserName;
var userInfo = await _requestCurrentUserService.Service.GetCurrentUserBasicInfoAsync();
if (userInfo.Code != GlobalConst.SuccessCode || userInfo.Data is null)
{
throw new BusinessException(message: $"调用用户中心,获取用户信息失败:{userInfo.Msg}");
}
var name = userInfo.Data.UserName;
//查出可能需要推送的轨迹 //查出可能需要推送的轨迹
var tracks = await _trackDetailsEsRepository.GetListAsync(input.SubSystemId, input.OrderType, input.OrderNos, new List<string> var tracks = await _trackDetailsEsRepository.GetListAsync(input.SubSystemId, input.OrderType, input.OrderNos, new List<string>
@ -136,9 +121,9 @@ public class TrackPushService : ApplicationServiceBase, ITrackPushService
SubSystemId = input.SubSystemId, SubSystemId = input.SubSystemId,
SubSystemCode = subSystemCode, SubSystemCode = subSystemCode,
CustomId = order.CustomId, CustomId = order.CustomId,
OrderIdTrackMetadataDict = new Dictionary<int, KeyValuePair<string, long>> OrderIdTrackMetadataDict = new Dictionary<int, TrackMetadata>
{ {
[order.Id] = KeyValuePair.Create(track.Id, track.Version) [order.Id] = TrackMetadata.Build(track.Id, track.Version, track.CreateTime)
}, },
// OrderIds = new[] { order.Id }, // OrderIds = new[] { order.Id },
TrackCode = input.TrackCode, TrackCode = input.TrackCode,
@ -160,7 +145,7 @@ public class TrackPushService : ApplicationServiceBase, ITrackPushService
await _capPublisher.PublishAsync(GlobalConst.TrackManualPushSubscribe, trackPushEvent); await _capPublisher.PublishAsync(GlobalConst.TrackManualPushSubscribe, trackPushEvent);
} }
return new UnifyResultDto(true, $"即将推送轨迹代码{input.TrackCode}给{orderIdTrackDict.Count}个订单"); LogHelper.Info($"即将推送轨迹代码{input.TrackCode}给{orderIdTrackDict.Count}个订单");
} }
@ -171,14 +156,13 @@ public class TrackPushService : ApplicationServiceBase, ITrackPushService
/// <param name="customerId"></param> /// <param name="customerId"></param>
/// <returns></returns> /// <returns></returns>
[HttpGet("Track/GetTrackPushContentList")] [HttpGet("Track/GetTrackPushContentList")]
[CustomerResult] public async Task<List<TrackPushContentDto>> GetTrackPushContentListAsync(int subSystemId, int customerId)
public async Task<UnifyResultDto<List<TrackPushContentDto>>> GetTrackPushContentListAsync(int subSystemId, int customerId)
{ {
var list = await _trackPushConfigRepository.GetTrackPushContentListAsync(subSystemId, customerId); var list = await _trackPushConfigRepository.GetTrackPushContentListAsync(subSystemId, customerId);
var result = ObjectMapper.Map<List<GetTrackPushContentListVo>, List<TrackPushContentDto>>(list); var result = ObjectMapper.Map<List<GetTrackPushContentListVo>, List<TrackPushContentDto>>(list);
return new UnifyResultDto<List<TrackPushContentDto>>(true, result, "操作成功"); return result;
} }
/// <summary> /// <summary>
@ -187,8 +171,7 @@ public class TrackPushService : ApplicationServiceBase, ITrackPushService
/// <returns></returns> /// <returns></returns>
/// <param name="input"></param> /// <param name="input"></param>
[HttpGet("Track/GetTrackPushRecords")] [HttpGet("Track/GetTrackPushRecords")]
[CustomerResult] public async Task<List<TrackPushRecordOutput>> GetTrackPushRecordsAsync([FromQuery] OrderNoInfo input)
public async Task<UnifyResultDto<List<TrackPushRecordOutput>>> GetTrackPushRecordsAsync([FromQuery] OrderNoInfo input)
{ {
var orderId = await _orderRepository.GetFirstAsync(x => var orderId = await _orderRepository.GetFirstAsync(x =>
x.SubSystemId == input.SubSystemId x.SubSystemId == input.SubSystemId
@ -204,7 +187,7 @@ public class TrackPushService : ApplicationServiceBase, ITrackPushService
var records = await _trackPushRecordEsRepository.GetTrackPushRecordsAsync(orderId); var records = await _trackPushRecordEsRepository.GetTrackPushRecordsAsync(orderId);
var res = ObjectMapper.Map<List<TrackPushRecordIndex>, List<TrackPushRecordOutput>>(records); var res = ObjectMapper.Map<List<TrackPushRecordIndex>, List<TrackPushRecordOutput>>(records);
return new UnifyResultDto<List<TrackPushRecordOutput>>(true, res, "操作成功"); return res;
} }
/// <summary> /// <summary>
@ -214,8 +197,7 @@ public class TrackPushService : ApplicationServiceBase, ITrackPushService
/// <returns></returns> /// <returns></returns>
/// <exception cref="BusinessException"></exception> /// <exception cref="BusinessException"></exception>
[HttpPost("Track/QueryTrackPushRecords")] [HttpPost("Track/QueryTrackPushRecords")]
[CustomerResult] public async Task<List<TrackPushRecordOutput>> QueryTrackPushRecordsAsync(QueryPushRecordInput input)
public async Task<UnifyResultDto<List<TrackPushRecordOutput>>> QueryTrackPushRecordsAsync(QueryPushRecordInput input)
{ {
var orderIds = await _orderRepository.GetListAsync( var orderIds = await _orderRepository.GetListAsync(
x => x.SubSystemId == input.SubSystemId x => x.SubSystemId == input.SubSystemId
@ -258,10 +240,10 @@ public class TrackPushService : ApplicationServiceBase, ITrackPushService
TrackPushTimeEnd = input.TrackPushTimeEnd?.AddHours(-8), TrackPushTimeEnd = input.TrackPushTimeEnd?.AddHours(-8),
}); });
if (records.Count == 0) return new UnifyResultDto<List<TrackPushRecordOutput>>(true, new List<TrackPushRecordOutput>(), "操作成功"); if (records.Count == 0) return new List<TrackPushRecordOutput>();
var res = ObjectMapper.Map<List<TrackPushRecordIndex>, List<TrackPushRecordOutput>>(records); var res = ObjectMapper.Map<List<TrackPushRecordIndex>, List<TrackPushRecordOutput>>(records);
return new UnifyResultDto<List<TrackPushRecordOutput>>(true, res, "操作成功"); return res;
} }
} }

View File

@ -139,12 +139,7 @@ public partial class TrackService
EnContent = x.TrackEnContent, EnContent = x.TrackEnContent,
OriginContent = x.OriginTrackContent, OriginContent = x.OriginTrackContent,
Location = x.TrackPlace, Location = x.TrackPlace,
Time = Math.Abs(x.TrackTimeZone - GlobalConst.NoneTrackTimeZone) < 1 Time = x.TrackTime,
? x.TrackTime
: x.ZeroTrackTime.AddHours(input.TimeZone ?? 8),
TimeZone = Math.Abs(x.TrackTimeZone - GlobalConst.NoneTrackTimeZone) < 1
? null
: input.TimeZone ?? 8,
IsExternal = x.IsExternal, IsExternal = x.IsExternal,
Source = x.Source, Source = x.Source,
Remarks = x.Remarks, Remarks = x.Remarks,
@ -164,10 +159,7 @@ public partial class TrackService
DestinationTimeZone = x.DestinationTimeZone, DestinationTimeZone = x.DestinationTimeZone,
EstimatedDeliveryDate = x.EstimatedDeliveryDate, EstimatedDeliveryDate = x.EstimatedDeliveryDate,
Extra = x.Extra, Extra = x.Extra,
CreateUser = x.CreateUser,
CreateTime = x.CreateTime, CreateTime = x.CreateTime,
PodFileUrls = x.PodFileUrls?.Split(",").ToList() ?? Empty<string>.List,
TrackFlags = BuildTrackFlags(trackFlagIdsDict, flagDict, x)
}).ToList(); }).ToList();
res.Add(item); res.Add(item);
@ -176,7 +168,7 @@ public partial class TrackService
// 排序 // 排序
var sortedList = await TracksOrdered(res, input, input.SortMethod); var sortedList = await TracksOrdered(res, input, input.SortMethod);
return new UnifyResultDto<List<GetTrackOutput>>(true, sortedList, "操作成功"); return sortedList;
} }
//内部系统展示所有轨迹,外部系统则要求过滤外部轨迹 //内部系统展示所有轨迹,外部系统则要求过滤外部轨迹

View File

@ -1,3 +1,4 @@
using InterfaceForward.Domain.Shared.Helpers;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using SJZY.Expand.ABP.Core; using SJZY.Expand.ABP.Core;
@ -8,8 +9,11 @@ using TrackCenter.Application.Dtos.TrackPull;
using TrackCenter.Application.Services; using TrackCenter.Application.Services;
using TrackCenter.Application.Helpers; using TrackCenter.Application.Helpers;
using TrackCenter.Application.Options; using TrackCenter.Application.Options;
using TrackCenter.Application.Queries;
using TrackCenter.Application.Services.TrackPull;
using TrackCenter.Application.Track2InterfaceRelay; using TrackCenter.Application.Track2InterfaceRelay;
using TrackCenter.Domain.Dtos.TrackPull; using TrackCenter.Domain.Dtos.TrackPull;
using TrackCenter.Domain.Extensions;
using TrackCenter.Domain.Queries; using TrackCenter.Domain.Queries;
using TrackCenter.Repository.Redis; using TrackCenter.Repository.Redis;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
@ -40,7 +44,7 @@ public class TrackPullTask : ApplicationServiceBase, ISingletonDependency
{ {
using var serviceScope = _serviceScopeFactory.CreateScope(); using var serviceScope = _serviceScopeFactory.CreateScope();
var provideQueries = serviceScope.ServiceProvider.GetRequiredService<IProvideQueries>(); var provideQueries = serviceScope.ServiceProvider.GetRequiredService<ProvideQueries>();
var configs = await provideQueries.GetAllPullConfigsAsync(); var configs = await provideQueries.GetAllPullConfigsAsync();
foreach (var config in configs) foreach (var config in configs)
@ -55,7 +59,7 @@ public class TrackPullTask : ApplicationServiceBase, ISingletonDependency
private async Task RefreshForConfigAsync(IServiceScope serviceScope, TrackPullConfigVo config) private async Task RefreshForConfigAsync(IServiceScope serviceScope, TrackPullConfigVo config)
{ {
var trackPullCacheService = LazyServiceProvider.LazyGetRequiredService<ITrackPullCacheService>(); var trackPullCacheService = LazyServiceProvider.GetRequiredService<TrackPullCacheService>();
var redisKey = trackPullCacheService.TrackPullKey(config.SubSystemId, config.ServiceProviderCode); var redisKey = trackPullCacheService.TrackPullKey(config.SubSystemId, config.ServiceProviderCode);
if (await RedisHelper.Client.ExistsAsync(redisKey)) if (await RedisHelper.Client.ExistsAsync(redisKey))
{ {
@ -68,9 +72,9 @@ public class TrackPullTask : ApplicationServiceBase, ISingletonDependency
{ {
try try
{ {
var provideQueries = serviceScope.ServiceProvider.GetRequiredService<IProvideQueries>(); var provideQueries = serviceScope.ServiceProvider.GetRequiredService<ProvideQueries>();
var httpClientProxy = serviceScope.ServiceProvider var interfaceForward = serviceScope.ServiceProvider
.GetRequiredService<IHttpClientProxy<IInterfaceForwardServiceV2>>(); .GetRequiredService<InterfaceForwardService>();
var interfaceOptions = serviceScope.ServiceProvider var interfaceOptions = serviceScope.ServiceProvider
.GetRequiredService<IOptions<InterfaceRelayParamsConfigOptions>>(); .GetRequiredService<IOptions<InterfaceRelayParamsConfigOptions>>();
await DoRefreshAsync(config, provideQueries, httpClientProxy, interfaceOptions.Value); await DoRefreshAsync(config, provideQueries, httpClientProxy, interfaceOptions.Value);
@ -83,8 +87,8 @@ public class TrackPullTask : ApplicationServiceBase, ISingletonDependency
}); });
} }
private static async Task DoRefreshAsync(TrackPullConfigVo config, IProvideQueries provideQueries, private static async Task DoRefreshAsync(TrackPullConfigVo config, ProvideQueries provideQueries,
IHttpClientProxy<IInterfaceForwardServiceV2> httpClientProxy, InterfaceForwardService interfaceForward,
InterfaceRelayParamsConfigOptions interfaceOptionsValue) InterfaceRelayParamsConfigOptions interfaceOptionsValue)
{ {
using (Track2InterfaceRelaySubSystemContext.Use( using (Track2InterfaceRelaySubSystemContext.Use(
@ -105,7 +109,7 @@ public class TrackPullTask : ApplicationServiceBase, ISingletonDependency
})); }));
var attach = Base64Helper.SerializeObject(new TrackRefreshAttach(config.ServiceProviderCode, var attach = Base64Helper.SerializeObject(new TrackRefreshAttach(config.ServiceProviderCode,
config.SubSystemId, group.Key)); config.SubSystemId, group.Key));
var res = await httpClientProxy.Service.BatchForwardThenPushToQueueAsync( var res = await interfaceForward.BatchForwardThenPushToQueueAsync(
interfaceOptionsValue.GetTrackInterfaceCode, serviceProviderCode, data, interfaceOptionsValue.GetTrackInterfaceCode, serviceProviderCode, data,
GlobalConst.TrackRefreshSubscribe, attach); GlobalConst.TrackRefreshSubscribe, attach);

View File

@ -1,9 +1,9 @@
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using SJZY.Expand.ABP.Core;
using SJZY.Expand.ABP.Core.Logger;
using TrackCenter.Application.Track2InterfaceRelay; using TrackCenter.Application.Track2InterfaceRelay;
using TrackCenter.Domain.Aggregates.OrderAggregate; using TrackCenter.Domain.Aggregates.OrderAggregate;
using TrackCenter.Domain.Extensions;
using TrackCenter.Repository.Redis;
namespace TrackCenter.Application.Services.TimerTaskss; namespace TrackCenter.Application.Services.TimerTaskss;

View File

@ -1,12 +1,15 @@
using System.Linq.Expressions; using System.Linq.Expressions;
using Fake.Application.Dtos;
using Microsoft.Extensions.Localization; using Microsoft.Extensions.Localization;
using SJZY.Expand.ABP.Core.Localization; using SJZY.Expand.ABP.Core.Localization;
using SJZY.Expand.ABP.Core.PublicMethords; using SJZY.Expand.ABP.Core.PublicMethords;
using SJZY.Expand.AliyunOSS; using SJZY.Expand.AliyunOSS;
using TrackCenter.Application.Dtos.ProvideServices; using TrackCenter.Application.Dtos.ProvideServices;
using TrackCenter.Application.Dtos.TrackContents; using TrackCenter.Application.Dtos.TrackContents;
using TrackCenter.Application.Helpers.OSS;
using TrackCenter.Application.Services; using TrackCenter.Application.Services;
using TrackCenter.Application.Localization; using TrackCenter.Application.Localization;
using TrackCenter.Application.Services.TrackPush;
using TrackCenter.Domain.Aggregates.OrderAggregate; using TrackCenter.Domain.Aggregates.OrderAggregate;
using TrackCenter.Domain.Aggregates.TrackContentAggregate; using TrackCenter.Domain.Aggregates.TrackContentAggregate;
using TrackCenter.Domain.Aggregates.TrackDetailsAggregate; using TrackCenter.Domain.Aggregates.TrackDetailsAggregate;
@ -26,25 +29,22 @@ namespace TrackCenter.Application.Services.TrackContents;
[Route("/Track/Content")] [Route("/Track/Content")]
public class TrackContentService : ApplicationServiceBase public class TrackContentService : ApplicationServiceBase
{ {
private readonly IStringLocalizer<TrackLocalizationResource> _stringLocalizer;
private readonly ITrackContentRepository _trackContentRepository; private readonly ITrackContentRepository _trackContentRepository;
private readonly ITrackTemplateRepository _trackTemplateRepository; private readonly ITrackTemplateRepository _trackTemplateRepository;
private readonly IBasicQuery<TrackFlagEntity> _trackFlagBasicQuery; private readonly IBasicRepository<TrackFlagEntity> _trackFlagBasicQuery;
private readonly IBasicQuery<TrackStatusEntity> _trackStatusBasicQuery; private readonly IBasicRepository<TrackStatusEntity> _trackStatusBasicQuery;
private readonly IOrderRepository _orderRepository; private readonly IOrderRepository _orderRepository;
private readonly ITrackDetailsEsRepository _trackDetailsEsRepository; private readonly ITrackDetailsEsRepository _trackDetailsEsRepository;
private readonly ITrackPushCacheService _trackPushCacheService; private readonly TrackPushCacheService _trackPushCacheService;
public TrackContentService( public TrackContentService(
IStringLocalizer<TrackLocalizationResource> stringLocalizer,
ITrackContentRepository trackContentRepository, ITrackContentRepository trackContentRepository,
IBasicQuery<TrackStatusEntity> trackStatusBasicQuery, IBasicRepository<TrackStatusEntity> trackStatusBasicQuery,
IBasicQuery<TrackFlagEntity> trackFlagBasicQuery, IBasicRepository<TrackFlagEntity> trackFlagBasicQuery,
IOrderRepository orderRepository, IOrderRepository orderRepository,
ITrackDetailsEsRepository trackDetailsEsRepository, ITrackDetailsEsRepository trackDetailsEsRepository,
ITrackTemplateRepository trackTemplateRepository, ITrackPushCacheService trackPushCacheService) ITrackTemplateRepository trackTemplateRepository, TrackPushCacheService trackPushCacheService)
{ {
_stringLocalizer = stringLocalizer;
_trackContentRepository = trackContentRepository; _trackContentRepository = trackContentRepository;
_trackStatusBasicQuery = trackStatusBasicQuery; _trackStatusBasicQuery = trackStatusBasicQuery;
_trackFlagBasicQuery = trackFlagBasicQuery; _trackFlagBasicQuery = trackFlagBasicQuery;
@ -59,7 +59,7 @@ public class TrackContentService : ApplicationServiceBase
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost("Edit")] [HttpPost("Edit")]
public async Task<UnifyResultDto> EditAsync(EditTrackContentInput input) public async Task EditAsync(EditTrackContentInput input)
{ {
if (input.TrackStatusId != null) if (input.TrackStatusId != null)
{ {
@ -95,17 +95,12 @@ public class TrackContentService : ApplicationServiceBase
/// <param name="id"></param> /// <param name="id"></param>
/// <returns></returns> /// <returns></returns>
[HttpGet("GetDetail")] [HttpGet("GetDetail")]
public async Task<UnifyResultDto<GetTrackContentDetailDto>> GetDetailAsync(int id) public async Task<GetTrackContentDetailDto> GetDetailAsync(int id)
{ {
var detailInfo = await _trackContentRepository.GetDetailAsync(id); var detailInfo = await _trackContentRepository.GetDetailAsync(id);
if (detailInfo == null) if (detailInfo == null) return null;
{
return new UnifyResultDto<GetTrackContentDetailDto>(false, null!, "未查询到轨迹状态");
}
var dto = ObjectMapper.Map<GetTrackContentDetailVO, GetTrackContentDetailDto>(detailInfo); return ObjectMapper.Map<GetTrackContentDetailVO, GetTrackContentDetailDto>(detailInfo);
return new UnifyResultDto<GetTrackContentDetailDto>(GlobalConst.SuccessCode, "", dto);
} }
/// <summary> /// <summary>
@ -204,7 +199,7 @@ public class TrackContentService : ApplicationServiceBase
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost("GetTrackContentByCode")] [HttpPost("GetTrackContentByCode")]
public async Task<UnifyResultDto<GetTrackContentByCodeOutput>> GetTrackContentByCodeAsync([FromBody] GetTrackContentByCodeInput input) public async Task<GetTrackContentByCodeOutput> GetTrackContentByCodeAsync([FromBody] GetTrackContentByCodeInput input)
{ {
if (input.SystemId <= 0) if (input.SystemId <= 0)
return new UnifyResultDto<GetTrackContentByCodeOutput>(false, "子系统Id必须大于等于0"); return new UnifyResultDto<GetTrackContentByCodeOutput>(false, "子系统Id必须大于等于0");