【 3. 轨迹订单操作列增加一个按钮:日志,点击弹窗日志列表】
https://www.tapd.cn/60863849/prong/tasks/view/1160863849001027887
This commit is contained in:
parent
b919300524
commit
8b60235d9f
@ -1,9 +1,11 @@
|
|||||||
using DotNetCore.CAP;
|
using DotNetCore.CAP;
|
||||||
|
using SJZY.Expand.ABP.Core.PublicMethords;
|
||||||
using SJZY.Track.Application.Contract.Dtos.ProvideServices;
|
using SJZY.Track.Application.Contract.Dtos.ProvideServices;
|
||||||
using SJZY.Track.Application.Contract.Services;
|
using SJZY.Track.Application.Contract.Services;
|
||||||
using SJZY.Track.Domain.Aggregates.OrderAggregate;
|
using SJZY.Track.Domain.Aggregates.OrderAggregate;
|
||||||
using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
|
using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
|
||||||
using SJZY.Track.Domain.Queries;
|
using SJZY.Track.Domain.Queries;
|
||||||
|
using SJZY.UserCenter.HttpApi.Services;
|
||||||
|
|
||||||
namespace SJZY.Track.Application.Services.ProvideServices;
|
namespace SJZY.Track.Application.Services.ProvideServices;
|
||||||
|
|
||||||
@ -14,12 +16,15 @@ namespace SJZY.Track.Application.Services.ProvideServices;
|
|||||||
[Route("/ProviderService")]
|
[Route("/ProviderService")]
|
||||||
public partial class OrderService : ApplicationService, IOrderService
|
public partial class OrderService : ApplicationService, IOrderService
|
||||||
{
|
{
|
||||||
|
private readonly IOrderOperationRecordRepository _orderOperationRecordRepository;
|
||||||
private readonly IOrderRepository _orderRepository;
|
private readonly IOrderRepository _orderRepository;
|
||||||
|
|
||||||
public OrderService(IOrderRepository orderRepository, IBasicQuery<OrderLinkEntity> orderLinkQuery,
|
public OrderService(IOrderRepository orderRepository, IBasicQuery<OrderLinkEntity> orderLinkQuery,
|
||||||
ICapPublisher capPublisher, ITrackDetailsRepository trackDetailsRepository)
|
ICapPublisher capPublisher, ITrackDetailsRepository trackDetailsRepository,
|
||||||
|
IOrderOperationRecordRepository orderOperationRecordRepository)
|
||||||
{
|
{
|
||||||
_orderRepository = orderRepository;
|
_orderRepository = orderRepository;
|
||||||
|
_orderOperationRecordRepository = orderOperationRecordRepository;
|
||||||
_trackDetailsRepository = trackDetailsRepository;
|
_trackDetailsRepository = trackDetailsRepository;
|
||||||
_capPublisher = capPublisher;
|
_capPublisher = capPublisher;
|
||||||
_orderLinkQuery = orderLinkQuery;
|
_orderLinkQuery = orderLinkQuery;
|
||||||
@ -43,6 +48,16 @@ public partial class OrderService : ApplicationService, IOrderService
|
|||||||
// 订单已存在则视为更新
|
// 订单已存在则视为更新
|
||||||
await UpdateOrderAsync(input, order);
|
await UpdateOrderAsync(input, order);
|
||||||
|
|
||||||
|
var index = new OrderOperationRecordIndex
|
||||||
|
{
|
||||||
|
OrderId = order.Id,
|
||||||
|
OrderNo = input.OrderNo,
|
||||||
|
OptionType = OptionType.修改.ToString(),
|
||||||
|
Content = input.ToJson(),
|
||||||
|
};
|
||||||
|
|
||||||
|
_ = _orderOperationRecordRepository.AddAsync(index);
|
||||||
|
|
||||||
return new UnifyResultDto<IdBaseDto>(true, new IdBaseDto
|
return new UnifyResultDto<IdBaseDto>(true, new IdBaseDto
|
||||||
{
|
{
|
||||||
Id = order.Id
|
Id = order.Id
|
||||||
@ -54,6 +69,18 @@ public partial class OrderService : ApplicationService, IOrderService
|
|||||||
order.OrderFlights = ObjectMapper.Map<List<OrderFlightInfo>, List<OrderFlightEntity>>(input.FlightInfos);
|
order.OrderFlights = ObjectMapper.Map<List<OrderFlightInfo>, List<OrderFlightEntity>>(input.FlightInfos);
|
||||||
|
|
||||||
var orderId = await _orderRepository.CreateOrderAsync(order);
|
var orderId = await _orderRepository.CreateOrderAsync(order);
|
||||||
|
var indexForAdd = new OrderOperationRecordIndex
|
||||||
|
{
|
||||||
|
OrderId = orderId,
|
||||||
|
OrderNo = input.OrderNo,
|
||||||
|
OptionType = OptionType.新增.ToString(),
|
||||||
|
Content = input.ToJson(),
|
||||||
|
CreateUserId = CurrentUserRequest.CurrentUser.UserId,
|
||||||
|
CreateTime = DateTime.Now
|
||||||
|
};
|
||||||
|
|
||||||
|
_ = _orderOperationRecordRepository.AddAsync(indexForAdd);
|
||||||
|
|
||||||
return new UnifyResultDto<IdBaseDto>(true, new IdBaseDto
|
return new UnifyResultDto<IdBaseDto>(true, new IdBaseDto
|
||||||
{
|
{
|
||||||
Id = orderId
|
Id = orderId
|
||||||
|
|||||||
@ -15,6 +15,7 @@ namespace SJZY.Track.Application.Services.TrackOrders;
|
|||||||
[Route("/Track/Order")]
|
[Route("/Track/Order")]
|
||||||
public class TrackOrderService : ApplicationService
|
public class TrackOrderService : ApplicationService
|
||||||
{
|
{
|
||||||
|
private readonly IOrderOperationRecordRepository _orderOperationRecordRepository;
|
||||||
private readonly IOrderRepository _orderRepository;
|
private readonly IOrderRepository _orderRepository;
|
||||||
private readonly ITrackContentRepository _trackContentRepository;
|
private readonly ITrackContentRepository _trackContentRepository;
|
||||||
private readonly ITrackDetailsRepository _trackDetailsRepository;
|
private readonly ITrackDetailsRepository _trackDetailsRepository;
|
||||||
@ -26,14 +27,15 @@ public class TrackOrderService : ApplicationService
|
|||||||
ITrackOrderQueries trackOrderQueries,
|
ITrackOrderQueries trackOrderQueries,
|
||||||
ITrackDetailsRepository trackDetailsRepository,
|
ITrackDetailsRepository trackDetailsRepository,
|
||||||
ITrackContentRepository trackContentRepository,
|
ITrackContentRepository trackContentRepository,
|
||||||
ITrackPushRecordsRepository trackPushRecordsRepository
|
ITrackPushRecordsRepository trackPushRecordsRepository,
|
||||||
)
|
IOrderOperationRecordRepository orderOperationRecordRepository)
|
||||||
{
|
{
|
||||||
_orderRepository = orderRepository;
|
_orderRepository = orderRepository;
|
||||||
_trackOrderQueries = trackOrderQueries;
|
_trackOrderQueries = trackOrderQueries;
|
||||||
_trackDetailsRepository = trackDetailsRepository;
|
_trackDetailsRepository = trackDetailsRepository;
|
||||||
_trackContentRepository = trackContentRepository;
|
_trackContentRepository = trackContentRepository;
|
||||||
_trackPushRecordsRepository = trackPushRecordsRepository;
|
_trackPushRecordsRepository = trackPushRecordsRepository;
|
||||||
|
_orderOperationRecordRepository = orderOperationRecordRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region 轨迹订单列表
|
#region 轨迹订单列表
|
||||||
@ -194,4 +196,17 @@ public class TrackOrderService : ApplicationService
|
|||||||
await _trackDetailsRepository.DeleteTrackByIdAsync(trackId, track.IndexName);
|
await _trackDetailsRepository.DeleteTrackByIdAsync(trackId, track.IndexName);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据订单id查询订单操作记录
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="orderId">订单id</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("GetOrderOperationsById")]
|
||||||
|
public async Task<List<OrderOperationRecordIndex>> GetOrderOperationsByIdAsync(int orderId)
|
||||||
|
{
|
||||||
|
// todo:分页?dto?
|
||||||
|
return await _orderOperationRecordRepository.GetOrderOperationsByIdAsync(orderId);
|
||||||
|
;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,7 @@ using SJZY.Track.Domain.Consts;
|
|||||||
|
|
||||||
namespace SJZY.Track.Domain.Aggregates.ForewarningAggregate;
|
namespace SJZY.Track.Domain.Aggregates.ForewarningAggregate;
|
||||||
|
|
||||||
[ElasticsearchType(RelationName = GlobalConst.TrackWarningRecordsIndex)]
|
[ElasticsearchType(RelationName = GlobalConst.TrackWarningRecordIndex)]
|
||||||
public class WarningRecordIndex : IdBaseIndex
|
public class WarningRecordIndex : IdBaseIndex
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -0,0 +1,18 @@
|
|||||||
|
namespace SJZY.Track.Domain.Aggregates.OrderAggregate;
|
||||||
|
|
||||||
|
public interface IOrderOperationRecordRepository
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 添加订单操作记录
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="index"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task AddAsync(OrderOperationRecordIndex index);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取订单操作记录
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="orderId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<List<OrderOperationRecordIndex>> GetOrderOperationsByIdAsync(int orderId);
|
||||||
|
}
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
using Nest;
|
||||||
|
using SJZY.Expand.ElasticSearch;
|
||||||
|
using SJZY.Track.Domain.Consts;
|
||||||
|
|
||||||
|
namespace SJZY.Track.Domain.Aggregates.OrderAggregate;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 订单操作记录
|
||||||
|
/// </summary>
|
||||||
|
[ElasticsearchType(RelationName = GlobalConst.OrderOperationRecordIndex)]
|
||||||
|
public class OrderOperationRecordIndex : IdBaseIndex
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 索引名称
|
||||||
|
/// </summary>
|
||||||
|
public string IndexName { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 订单Id
|
||||||
|
/// </summary>
|
||||||
|
public int OrderId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 订单号
|
||||||
|
/// </summary>
|
||||||
|
public string OrderNo { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 操作类型
|
||||||
|
/// </summary>
|
||||||
|
public string OptionType { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 前期报文(json)
|
||||||
|
/// </summary>
|
||||||
|
public string Content { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建人
|
||||||
|
/// </summary>
|
||||||
|
public int CreateUserId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime CreateTime { get; set; }
|
||||||
|
}
|
||||||
@ -15,5 +15,10 @@ public partial class GlobalConst
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 预警记录 es索引名称(模板)
|
/// 预警记录 es索引名称(模板)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string TrackWarningRecordsIndex = "sjzy_track_warning_records";
|
public const string TrackWarningRecordIndex = "sjzy_track_warning_records";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 订单操作记录 es索引名称(模板)
|
||||||
|
/// </summary>
|
||||||
|
public const string OrderOperationRecordIndex = "sjzy_track_order_operation_records";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@ public partial class GlobalConst
|
|||||||
public const string EmptyString = "--";
|
public const string EmptyString = "--";
|
||||||
public const int ChunkSize = 100;
|
public const int ChunkSize = 100;
|
||||||
public const int SafelyLimit = 10000;
|
public const int SafelyLimit = 10000;
|
||||||
|
public const int NormalLimit = 10000;
|
||||||
|
|
||||||
public const float NoneTrackTimeZone = 99999;
|
public const float NoneTrackTimeZone = 99999;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,45 @@
|
|||||||
|
using Nest;
|
||||||
|
using SJZY.Expand.ABP.Core.Logger;
|
||||||
|
using SJZY.Expand.ElasticSearch.Services;
|
||||||
|
using SJZY.Track.Domain.Aggregates.OrderAggregate;
|
||||||
|
using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
|
||||||
|
using SJZY.Track.Domain.Consts;
|
||||||
|
|
||||||
|
namespace SJZY.Track.Repository.Repositories;
|
||||||
|
|
||||||
|
public class OrderOperationRecordRepository : ElasticSearchContextAbstract<TrackDetailsIndex>,
|
||||||
|
IOrderOperationRecordRepository,
|
||||||
|
ITransientDependency
|
||||||
|
{
|
||||||
|
public OrderOperationRecordRepository(ConnectionFactory connectionFactory) : base(connectionFactory)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task AddAsync(OrderOperationRecordIndex index)
|
||||||
|
{
|
||||||
|
index.IndexName = $"{GlobalConst.OrderOperationRecordIndex}-{DateTime.Now:yyyy.MM.dd}";
|
||||||
|
index.CreateTime = DateTime.Now;
|
||||||
|
// 按天写入es
|
||||||
|
var r = await Context.IndexAsync(index, request => request
|
||||||
|
.Index(index.IndexName)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!r.IsValid)
|
||||||
|
{
|
||||||
|
LogHelper.Error($"轨迹推送记录写入es失败,原因:{r.DebugInformation}。");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<OrderOperationRecordIndex>> GetOrderOperationsByIdAsync(int orderId)
|
||||||
|
{
|
||||||
|
var data = await Context.SearchAsync<OrderOperationRecordIndex>(x => x
|
||||||
|
.Index(GlobalConst.TrackPushRecordsIndex)
|
||||||
|
.Query(q =>
|
||||||
|
q.Term(t => t.OrderId, orderId)
|
||||||
|
)
|
||||||
|
.Size(GlobalConst.NormalLimit)
|
||||||
|
.Sort(s => s.Field(f => f.CreateTime, SortOrder.Descending)));
|
||||||
|
|
||||||
|
return data.Documents.ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user