Merge branch 'S03-轨迹中台优化项' into dev
This commit is contained in:
commit
fd92d75461
@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SJZY.Track.Application.Contract.Dtos.ProvideServices
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询轨迹推送映射关系入参
|
||||
/// </summary>
|
||||
public class QueryTrackPullMappingsInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 子系统id
|
||||
/// </summary>
|
||||
public int SubsystemsId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 客户id
|
||||
/// </summary>
|
||||
public int CustomerId { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询轨迹推送映射关系返参项
|
||||
/// </summary>
|
||||
public class QueryTrackPullMappingsInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 轨迹代码
|
||||
/// </summary>
|
||||
public string? Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 订单类型
|
||||
/// </summary>
|
||||
public int OrderType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 服务商轨迹代码
|
||||
/// </summary>
|
||||
public string? ServiceCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 服务商轨迹状态
|
||||
/// </summary>
|
||||
public string? Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 服务商轨迹内容
|
||||
/// </summary>
|
||||
public string? Content { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 服务商轨迹内容英文
|
||||
/// </summary>
|
||||
public string? ContentEn { get; set; }
|
||||
}
|
||||
}
|
||||
@ -5,7 +5,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<Version>7.0.0</Version>
|
||||
<Version>7.0.1</Version>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@ -0,0 +1,22 @@
|
||||
using AutoMapper;
|
||||
using SJZY.Track.Application.Contract.Dtos.ProvideServices;
|
||||
using SJZY.Track.Application.Contract.Dtos.TrackPush;
|
||||
using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
|
||||
using SJZY.Track.Domain.Dtos.TrackPush;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SJZY.Track.Application.AutoMapper
|
||||
{
|
||||
public class TrackPushConfigAutoMapperProfile : Profile
|
||||
{
|
||||
public TrackPushConfigAutoMapperProfile()
|
||||
{
|
||||
CreateMap<QueryTrackPullMappingsInput, QueryTrackPullMappingsInputVO>(MemberList.None);
|
||||
CreateMap<QueryTrackPullMappingsInfoVO, QueryTrackPullMappingsInfo>(MemberList.None);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
using SJZY.Track.Application.Contract.Dtos.ProvideServices;
|
||||
using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
|
||||
using SJZY.Track.Domain.Dtos.TrackPush;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Volo.Abp.ObjectMapping;
|
||||
|
||||
namespace SJZY.Track.Application.Services.ProvideServices
|
||||
{
|
||||
/// <summary>
|
||||
/// 轨迹推送配置服务
|
||||
/// </summary>
|
||||
[ApiExplorerSettings(GroupName = "提供接口")]
|
||||
[Route("/ProviderService")]
|
||||
public class TrackPushConfigService : ApplicationService
|
||||
{
|
||||
private readonly ITrackPushConfigRepository _trackPushConfigRepository;
|
||||
|
||||
public TrackPushConfigService(
|
||||
ITrackPushConfigRepository trackPushConfigRepository
|
||||
)
|
||||
{
|
||||
_trackPushConfigRepository = trackPushConfigRepository;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询轨迹推送配置关系
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("Track/QueryTrackPullMappings")]
|
||||
public async Task<UnifyResultDto> QueryTrackPullMappingsAsync(QueryTrackPullMappingsInput input)
|
||||
{
|
||||
var vo = ObjectMapper.Map<QueryTrackPullMappingsInput, QueryTrackPullMappingsInputVO>(input);
|
||||
var result = await _trackPushConfigRepository.QueryTrackPullMappingsAsync(vo);
|
||||
var output = ObjectMapper.Map<List<QueryTrackPullMappingsInfoVO>, List<QueryTrackPullMappingsInfo>>(result);
|
||||
|
||||
return new UnifyResultDto(true, output, "操作成功");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -84,12 +84,17 @@ namespace SJZY.Track.Application
|
||||
configure.UserName = configuration["RabbitMQ:UserName"]!;
|
||||
configure.Password = configuration["RabbitMQ:Password"]!;
|
||||
configure.Port = configuration.GetValue<int>("RabbitMQ:Port");
|
||||
configure.BasicQosOptions =
|
||||
new RabbitMQOptions.BasicQos(configuration.GetValue<ushort>("CAP:PrefetchCount"));
|
||||
});
|
||||
|
||||
// options.TopicNamePrefix = "v1";
|
||||
options.SucceedMessageExpiredAfter = 6 * 60 * 60;
|
||||
options.FailedRetryInterval = 60;
|
||||
options.FailedRetryCount = 3;
|
||||
options.FailedRetryInterval = configuration.GetValue<int>("CAP:FailedRetryInterval");
|
||||
options.FailedRetryCount = configuration.GetValue<int>("CAP:FailedRetryCount");
|
||||
options.ConsumerThreadCount = configuration.GetValue<int>("CAP:ConsumerThreadCount");
|
||||
options.SucceedMessageExpiredAfter = configuration.GetValue<int>("CAP:SucceedMessageExpiredAfter");
|
||||
options.UseDispatchingPerGroup = true;
|
||||
options.EnableConsumerPrefetch = true;
|
||||
|
||||
options.UseDashboard(dashboardOptions =>
|
||||
{
|
||||
dashboardOptions.PathBase = System.Diagnostics.Debugger.IsAttached
|
||||
|
||||
@ -35,4 +35,5 @@ public interface ITrackPushConfigRepository : IBasicRepository<TrackPushConfigEn
|
||||
|
||||
Task<bool> UpdateContentAsync(Expression<Func<TrackPushContentConfigEntity, bool>> columns,
|
||||
Expression<Func<TrackPushContentConfigEntity, bool>> whereExpression);
|
||||
Task<List<QueryTrackPullMappingsInfoVO>> QueryTrackPullMappingsAsync(QueryTrackPullMappingsInputVO input);
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SJZY.Track.Domain.Dtos.TrackPush
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询轨迹推送关系入参
|
||||
/// </summary>
|
||||
public class QueryTrackPullMappingsInfoVO
|
||||
{
|
||||
/// <summary>
|
||||
/// 轨迹代码
|
||||
/// </summary>
|
||||
public string? Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 订单类型
|
||||
/// </summary>
|
||||
public int OrderType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 服务商轨迹代码
|
||||
/// </summary>
|
||||
public string? ServiceCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 服务商轨迹状态
|
||||
/// </summary>
|
||||
public string? Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 服务商轨迹内容
|
||||
/// </summary>
|
||||
public string? Content { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 服务商轨迹内容英文
|
||||
/// </summary>
|
||||
public string? ContentEn { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询轨迹推送关系返参项
|
||||
/// </summary>
|
||||
public class QueryTrackPullMappingsInputVO
|
||||
{
|
||||
/// <summary>
|
||||
/// 子系统id
|
||||
/// </summary>
|
||||
public int SubsystemsId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 客户id
|
||||
/// </summary>
|
||||
public int CustomerId { get; set; }
|
||||
}
|
||||
}
|
||||
@ -166,4 +166,29 @@ public class TrackPushConfigRepository : BasicRepository<TrackPushConfigEntity>,
|
||||
return await Context.Updateable<TrackPushContentConfigEntity>().SetColumns(columns).Where(whereExpression)
|
||||
.ExecuteCommandHasChangeAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询轨迹推送关系
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<QueryTrackPullMappingsInfoVO>> QueryTrackPullMappingsAsync(QueryTrackPullMappingsInputVO input)
|
||||
{
|
||||
var result = await Context.Queryable<TrackPushConfigEntity>().LeftJoin<TrackPushContentConfigEntity>((a, b) => a.Id == b.TrackPushConfigId && !b.IsDeleted)
|
||||
.LeftJoin<TrackContentEntity>((a, b, c) => b.TrackContentId == c.Id && !c.IsDeleted)
|
||||
.Where((a, b, c) => !a.IsDeleted)
|
||||
.Where((a, b, c) => a.SubSystemId == input.SubsystemsId && a.CustomId == input.CustomerId)
|
||||
.Select((a, b, c) => new QueryTrackPullMappingsInfoVO
|
||||
{
|
||||
Code = c.Code,
|
||||
OrderType = b.OrderNoType,
|
||||
ServiceCode = b.TrackContentCodeValue,
|
||||
Status = b.TrackStatusValue,
|
||||
Content = b.TrackContentValue,
|
||||
ContentEn = b.TrackEnContentValue
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user