Merge remote-tracking branch 'origin/S03-轨迹中台优化项' into test

This commit is contained in:
dingenwen 2024-04-10 19:19:51 +08:00
commit 35fe11c148
5 changed files with 10 additions and 54 deletions

View File

@ -5,7 +5,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>net7.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<GenerateDocumentationFile>True</GenerateDocumentationFile> <GenerateDocumentationFile>True</GenerateDocumentationFile>
<Version>7.0.0</Version> <Version>7.0.1</Version>
<GenerateDocumentationFile>True</GenerateDocumentationFile> <GenerateDocumentationFile>True</GenerateDocumentationFile>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -31,5 +31,5 @@ public interface ITrackService : IRemoteService
/// </summary> /// </summary>
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
Task<List<GetTrackOutput>> QueryAsync(GetTrackInput input); Task<UnifyResultDto> QueryAsync(GetTrackInput input);
} }

View File

@ -1,50 +0,0 @@
using DotNetCore.CAP;
using SJZY.Track.Application.Contract.Dtos.TrackPush;
using SJZY.Track.Domain.Aggregates.OrderAggregate;
using SJZY.Track.Domain.Consts;
using SJZY.Track.Domain.Enums;
using Volo.Abp.DependencyInjection;
namespace SJZY.Track.Application.EventHandlers;
public class TrackPushAfterUpdateOrderEventHandler : ITransientDependency, ICapSubscribe
{
private readonly IOrderRepository _orderRepository;
public TrackPushAfterUpdateOrderEventHandler(IOrderRepository orderRepository)
{
_orderRepository = orderRepository;
}
[CapSubscribe(GlobalConst.TrackPushAfterUpdateOrderSubscribe)]
public async Task ConsumerAsync(TrackPushAfterUpdateOrderDto dto)
{
var order = await _orderRepository.GetFirstAsync(x => x.Id == dto.OrderId);
if (order == default) return;
/*
* 异常:最近一条推送是失败
*/
if (!dto.IsSuccess)
{
order.QuestionType = (int)TrackProblemType.Error;
order.LatestPushError = dto.Message;
}
else
{
order.QuestionType = (int)TrackProblemType.None;
order.LatestPushError = null;
if (dto.OptionType == OptionType.新增)
{
// tips:只有新增会影响推送进度
order.LatestPushTrackCode = dto.TrackCode;
order.LatestPushTime = DateTime.Now;
}
}
await _orderRepository.UpdateColumnAsync(order, x => new
{
x.LatestPushTrackCode, x.QuestionType, x.LatestPushError, x.LatestPushTime
});
}
}

View File

@ -17,7 +17,7 @@ public partial class TrackService
/// <returns></returns> /// <returns></returns>
/// <exception cref="BusinessException"></exception> /// <exception cref="BusinessException"></exception>
[HttpPost("Track/Query")] [HttpPost("Track/Query")]
public async Task<List<GetTrackOutput>> QueryAsync(GetTrackInput input) public async Task<UnifyResultDto> QueryAsync(GetTrackInput input)
{ {
if (input.OrderNos.Count > 500) if (input.OrderNos.Count > 500)
{ {
@ -50,7 +50,7 @@ public partial class TrackService
await TrackDetailSort(res, input); await TrackDetailSort(res, input);
return res; return new UnifyResultDto(true, res, "操作成功");
} }
private async Task TrackDetailSort(List<GetTrackOutput> list, GetTrackInput input) private async Task TrackDetailSort(List<GetTrackOutput> list, GetTrackInput input)

View File

@ -84,7 +84,13 @@ namespace SJZY.Track.Application
configure.UserName = configuration["RabbitMQ:UserName"]!; configure.UserName = configuration["RabbitMQ:UserName"]!;
configure.Password = configuration["RabbitMQ:Password"]!; configure.Password = configuration["RabbitMQ:Password"]!;
configure.Port = configuration.GetValue<int>("RabbitMQ:Port"); configure.Port = configuration.GetValue<int>("RabbitMQ:Port");
configure.BasicQosOptions =
new RabbitMQOptions.BasicQos(configuration.GetValue<ushort>("CAP:PrefetchCount"));
}); });
options.FailedRetryInterval = configuration.GetValue<int>("CAP:FailedRetryInterval");
options.FailedRetryCount = configuration.GetValue<int>("CAP:FailedRetryCount");
options.UseDispatchingPerGroup = configuration.GetValue<bool>("CAP:UseDispatchingPerGroup");
options.ConsumerThreadCount = configuration.GetValue<int>("CAP:ConsumerThreadCount");
// options.TopicNamePrefix = "v1"; // options.TopicNamePrefix = "v1";
options.SucceedMessageExpiredAfter = 6 * 60 * 60; options.SucceedMessageExpiredAfter = 6 * 60 * 60;