Merge branch 'S03-轨迹中台优化项' into dev
This commit is contained in:
commit
4af0f701d4
@ -5,17 +5,18 @@ public class GetTrackOutput
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 订单号
|
/// 订单号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string OrderNo { get; set; }
|
public string OrderNo { get; set; } = null!;
|
||||||
|
|
||||||
public List<TrackDetail> TrackDetails { get; set; }
|
public List<TrackDetail> TrackDetails { get; set; } = new();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TrackDetail
|
public class TrackDetail
|
||||||
{
|
{
|
||||||
public string Code { get; set; }
|
public string Code { get; set; } = null!;
|
||||||
public string Status { get; set; }
|
public string Status { get; set; } = null!;
|
||||||
public string Content { get; set; }
|
public string? Content { get; set; }
|
||||||
public string Location { get; set; }
|
public string? OriginContent { get; set; }
|
||||||
|
public string Location { get; set; } = null!;
|
||||||
public DateTime Time { get; set; }
|
public DateTime Time { get; set; }
|
||||||
public float TimeZone { get; set; }
|
public float TimeZone { get; set; }
|
||||||
}
|
}
|
||||||
@ -88,7 +88,7 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹标记id
|
/// 轨迹标记id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int TrackFlagId { get; set; }
|
public int? TrackFlagId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹标记
|
/// 轨迹标记
|
||||||
|
|||||||
@ -0,0 +1,75 @@
|
|||||||
|
namespace SJZY.Track.Application.Contract.Dtos.TrackOrder;
|
||||||
|
|
||||||
|
public class TrackPushRecordOutput
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 订单Id
|
||||||
|
/// </summary>
|
||||||
|
public int OrderId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 接口通请求Id
|
||||||
|
/// </summary>
|
||||||
|
public Guid RequestId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 信息
|
||||||
|
/// </summary>
|
||||||
|
public string Message { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 操作类型
|
||||||
|
/// </summary>
|
||||||
|
public string OptionType { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹状态
|
||||||
|
/// </summary>
|
||||||
|
public string TrackStatus { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹内容代码
|
||||||
|
/// </summary>
|
||||||
|
public string TrackCode { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹内容
|
||||||
|
/// </summary>
|
||||||
|
public string TrackContent { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹发生地
|
||||||
|
/// </summary>
|
||||||
|
public string TrackPlace { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹发生时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime TrackTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹发生时区
|
||||||
|
/// </summary>
|
||||||
|
public float TrackTimeZone { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹发生时区
|
||||||
|
/// </summary>
|
||||||
|
public string TrackGTMTimeZone { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否成功
|
||||||
|
/// </summary>
|
||||||
|
public bool IsSuccess { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 推送内容(json)
|
||||||
|
/// </summary>
|
||||||
|
public string PushContent { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>创建人</summary>
|
||||||
|
public string? CreateUser { get; set; }
|
||||||
|
|
||||||
|
/// <summary>创建时间</summary>
|
||||||
|
public DateTime CreateTime { get; set; }
|
||||||
|
}
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
namespace SJZY.Track.Application.Contract.Dtos.TrackPush;
|
||||||
|
|
||||||
|
public class TrackPushInput
|
||||||
|
{
|
||||||
|
public string OrderNo { get; set; } = null!;
|
||||||
|
|
||||||
|
public List<TrackItem> Data { get; set; } = new();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TrackItem
|
||||||
|
{
|
||||||
|
public string Location { get; set; } = null!;
|
||||||
|
public DateTime Date { get; set; }
|
||||||
|
public double TimeZone { get; set; }
|
||||||
|
public string? Description { get; set; }
|
||||||
|
public string? DescriptionCn { get; set; }
|
||||||
|
public string? Code { get; set; }
|
||||||
|
public string? Status { get; set; }
|
||||||
|
public string? Extra { get; set; }
|
||||||
|
}
|
||||||
@ -22,6 +22,16 @@ public class TrackUpsertEvent
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string? ServiceProviderName { get; set; }
|
public string? ServiceProviderName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 原轨迹内容
|
||||||
|
/// </summary>
|
||||||
|
public string? OriginTrackContent { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 原轨迹报文
|
||||||
|
/// </summary>
|
||||||
|
public string? OriginTrackData { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 表示订单是否完成(只由轨迹刷新配置决定)
|
/// 表示订单是否完成(只由轨迹刷新配置决定)
|
||||||
/// tips:能够使得IsCompleted为true的点,全局只有一个:轨迹刷新
|
/// tips:能够使得IsCompleted为true的点,全局只有一个:轨迹刷新
|
||||||
|
|||||||
@ -12,6 +12,14 @@ public interface ITrackPushCacheService
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<List<TrackPushContentConfigDto>?> GetPushContentConfigsAsync(int subSystemId, int customId);
|
Task<List<TrackPushContentConfigDto>?> GetPushContentConfigsAsync(int subSystemId, int customId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置服务商拉取配置缓存
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="subSystemId"></param>
|
||||||
|
/// <param name="customId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<List<TrackPushContentConfigDto>?> SetPushContentConfigsAsync(int subSystemId, int customId);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取服务商拉取配置
|
/// 获取服务商拉取配置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -33,14 +41,4 @@ public interface ITrackPushCacheService
|
|||||||
Task<TrackPushContentConfigDto?> IsValidPushAsync(int subSystemId, int customId,
|
Task<TrackPushContentConfigDto?> IsValidPushAsync(int subSystemId, int customId,
|
||||||
string? latestPushTrackCode,
|
string? latestPushTrackCode,
|
||||||
string? trackCode);
|
string? trackCode);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 设置推送配置缓存
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="id"></param>
|
|
||||||
/// <param name="subSystemId">子系统id</param>
|
|
||||||
/// <param name="customId">客户id</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task<List<TrackPushContentConfigDto>?> SetPushContentConfigsAsync(int? id = null, int? subSystemId = null,
|
|
||||||
int? customId = null);
|
|
||||||
}
|
}
|
||||||
@ -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);
|
||||||
}
|
}
|
||||||
@ -1,8 +1,10 @@
|
|||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
using SJZY.Expand.ABP.Core.PublicMethords;
|
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.Dtos.TrackOrder;
|
||||||
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.Aggregates.TrackPushAggregate;
|
||||||
using SJZY.Track.Domain.Dtos.Order;
|
using SJZY.Track.Domain.Dtos.Order;
|
||||||
using SJZY.Track.Domain.Enums;
|
using SJZY.Track.Domain.Enums;
|
||||||
using Volo.Abp.AutoMapper;
|
using Volo.Abp.AutoMapper;
|
||||||
@ -34,6 +36,8 @@ public class OrderAutoMapperProfile : Profile
|
|||||||
.ForMember(dest => dest.Content, opt => opt.MapFrom(m => m.TrackContent))
|
.ForMember(dest => dest.Content, opt => opt.MapFrom(m => m.TrackContent))
|
||||||
.ForMember(dest => dest.EnContent, opt => opt.MapFrom(m => m.TrackEnContent))
|
.ForMember(dest => dest.EnContent, opt => opt.MapFrom(m => m.TrackEnContent))
|
||||||
.ForMember(dest => dest.TrackTimeZoneValue, opt => opt.MapFrom(m => m.TrackTimeZone));
|
.ForMember(dest => dest.TrackTimeZoneValue, opt => opt.MapFrom(m => m.TrackTimeZone));
|
||||||
|
|
||||||
|
CreateMap<TrackPushRecordIndex, TrackPushRecordOutput>(MemberList.None);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -20,8 +20,9 @@ public class CapFilter : SubscribeFilter
|
|||||||
{
|
{
|
||||||
context.DeliverMessage.Headers["sjzy-receive-time"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff");
|
context.DeliverMessage.Headers["sjzy-receive-time"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff");
|
||||||
|
|
||||||
// 轨迹刷新不做幂等
|
// 轨迹增删改要做幂等
|
||||||
if (context.DeliverMessage.Headers["cap-msg-name"]!.EndsWith(GlobalConst.TrackRefreshSubscribe))
|
if (!context.DeliverMessage.Headers["cap-msg-name"]
|
||||||
|
.IsIn(GlobalConst.TrackUpsertSubscribe, GlobalConst.TrackDeleteSubscribe))
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
|
|
||||||
// 本地调试不做幂等
|
// 本地调试不做幂等
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
using DotNetCore.CAP;
|
using DotNetCore.CAP;
|
||||||
using SJZY.Track.Application.Contract.Events;
|
using SJZY.Track.Application.Contract.Events;
|
||||||
using SJZY.Track.Domain.Aggregates.OrderAggregate;
|
|
||||||
using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
|
using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
|
||||||
using SJZY.Track.Domain.Consts;
|
using SJZY.Track.Domain.Consts;
|
||||||
using Volo.Abp.DependencyInjection;
|
using Volo.Abp.DependencyInjection;
|
||||||
@ -11,14 +10,11 @@ public class OrderLinkAfterFillTrackHandler : ITransientDependency, ICapSubscrib
|
|||||||
{
|
{
|
||||||
private readonly ITrackDetailsRepository _trackDetailsRepository;
|
private readonly ITrackDetailsRepository _trackDetailsRepository;
|
||||||
private readonly ICapPublisher _capPublisher;
|
private readonly ICapPublisher _capPublisher;
|
||||||
private readonly IOrderRepository _orderRepository;
|
|
||||||
|
|
||||||
public OrderLinkAfterFillTrackHandler(ITrackDetailsRepository trackDetailsRepository, ICapPublisher capPublisher,
|
public OrderLinkAfterFillTrackHandler(ITrackDetailsRepository trackDetailsRepository, ICapPublisher capPublisher)
|
||||||
IOrderRepository orderRepository)
|
|
||||||
{
|
{
|
||||||
_trackDetailsRepository = trackDetailsRepository;
|
_trackDetailsRepository = trackDetailsRepository;
|
||||||
_capPublisher = capPublisher;
|
_capPublisher = capPublisher;
|
||||||
_orderRepository = orderRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[CapSubscribe(GlobalConst.OrderLinkAfterFillTrack)]
|
[CapSubscribe(GlobalConst.OrderLinkAfterFillTrack)]
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
using DotNetCore.CAP;
|
using DotNetCore.CAP;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json;
|
||||||
using SJZY.Expand.ABP.Core.PublicMethords;
|
using SJZY.Expand.ABP.Core.PublicMethords;
|
||||||
using SJZY.InterfaceRelay.Application.Contracts;
|
using SJZY.InterfaceRelay.Application.Contracts;
|
||||||
using SJZY.Track.Application.Contract.Dtos.TrackPush;
|
using SJZY.Track.Application.Contract.Dtos.TrackPush;
|
||||||
@ -39,9 +39,7 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
{
|
{
|
||||||
x.SubSystemId, x.LatestPushTrackCode, x.QuestionType, x.CustomId
|
x.SubSystemId, x.LatestPushTrackCode, x.QuestionType, x.CustomId
|
||||||
});
|
});
|
||||||
if (order == null || order.QuestionType == (int)TrackProblemType.Error) return; // 是否通知?
|
if (order == null) return;
|
||||||
|
|
||||||
TrackPushContentConfigDto? config;
|
|
||||||
|
|
||||||
var log = new TrackPushRecordIndex
|
var log = new TrackPushRecordIndex
|
||||||
{
|
{
|
||||||
@ -58,16 +56,25 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
CreateTime = DateTime.Now
|
CreateTime = DateTime.Now
|
||||||
};
|
};
|
||||||
|
|
||||||
|
TrackPushContentConfigDto? config = null;
|
||||||
|
|
||||||
switch (@event.OptionType)
|
switch (@event.OptionType)
|
||||||
{
|
{
|
||||||
case OptionType.无:
|
case OptionType.无:
|
||||||
return;
|
return;
|
||||||
case OptionType.新增:
|
case OptionType.新增:
|
||||||
if (@event.OperationMan == null)
|
if (@event.OperationMan == null)
|
||||||
|
{
|
||||||
|
if (order.QuestionType != (int)TrackProblemType.Error)
|
||||||
{
|
{
|
||||||
// 推送新增,需要根据上一次的推送 推断 本次推送 是否可行
|
// 推送新增,需要根据上一次的推送 推断 本次推送 是否可行
|
||||||
config = await _trackPushCacheService.IsValidPushAsync(order.SubSystemId, order.CustomId,
|
config = await _trackPushCacheService.IsValidPushAsync(order.SubSystemId, order.CustomId,
|
||||||
order.LatestPushTrackCode, @event.TrackCode);
|
order.LatestPushTrackCode, @event.TrackCode);
|
||||||
|
if (config is not { IsAutoPush: true })
|
||||||
|
{
|
||||||
|
config = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -132,45 +139,50 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
// tips:只有新增会影响推送进度?
|
// tips:只有新增会影响推送进度?
|
||||||
order.LatestPushTrackCode = dto.TrackCode;
|
order.LatestPushTrackCode = dto.TrackCode;
|
||||||
order.LatestPushTime = DateTime.Now;
|
order.LatestPushTime = DateTime.Now;
|
||||||
|
await _orderRepository.UpdateColumnAsync(order, x => new
|
||||||
|
{
|
||||||
|
x.LatestPushTrackCode, x.LatestPushTime, x.QuestionType, x.LatestPushError
|
||||||
|
});
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await _orderRepository.UpdateColumnAsync(order, x => new
|
await _orderRepository.UpdateColumnAsync(order, x => new
|
||||||
{
|
{
|
||||||
x.LatestPushTrackCode, x.QuestionType, x.LatestPushError, x.LatestPushTime
|
x.QuestionType, x.LatestPushError
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task DoAddAsync(TrackPushEvent @event,
|
private async Task DoAddAsync(TrackPushEvent @event,
|
||||||
TrackPushContentConfigDto config, TrackPushRecordIndex log)
|
TrackPushContentConfigDto config, TrackPushRecordIndex log)
|
||||||
{
|
{
|
||||||
var track = new
|
var track = new TrackItem
|
||||||
{
|
{
|
||||||
// 推真实的发生地和发生时间(时间是计算后的)
|
// 推真实的发生地和发生时间(时间是计算后的)
|
||||||
location = @event.TrackPlace,
|
Location = @event.TrackPlace,
|
||||||
date = @event.TrackTime.AddHours(
|
Date = @event.TrackTime.AddHours(
|
||||||
config.TrackTimeZone ?? @event.TrackTimeZone - @event.TrackTimeZone),
|
config.TrackTimeZone ?? @event.TrackTimeZone - @event.TrackTimeZone),
|
||||||
timeZone = config.TrackTimeZone ?? @event.TrackTimeZone,
|
TimeZone = config.TrackTimeZone ?? @event.TrackTimeZone,
|
||||||
description = config.TrackEnContentValue,
|
Description = config.TrackEnContentValue,
|
||||||
description_cn = config.TrackContentValue,
|
DescriptionCn = config.TrackContentValue,
|
||||||
code = config.TrackContentCodeValue,
|
Code = config.TrackContentCodeValue,
|
||||||
status = config.TrackStatusValue,
|
Status = config.TrackStatusValue,
|
||||||
extra = config.ExpandFieldsValue
|
Extra = config.ExpandFieldsValue
|
||||||
};
|
};
|
||||||
|
|
||||||
JObject body = JObject.FromObject(new
|
var body = new TrackPushInput()
|
||||||
{
|
{
|
||||||
orderNo = @event.OrderNo,
|
OrderNo = @event.OrderNo,
|
||||||
data = new[] { track }
|
};
|
||||||
});
|
body.Data.Add(track);
|
||||||
|
|
||||||
if (config.IsAllPush)
|
if (config.IsAllPush)
|
||||||
{
|
{
|
||||||
var history = await _trackPushRecordsRepository.GetLatestTrackPushRecordAsync(@event.OrderId);
|
var history = await _trackPushRecordsRepository.GetLatestTrackPushRecordAsync(@event.OrderId);
|
||||||
if (history != default)
|
if (history != default)
|
||||||
{
|
{
|
||||||
body = JObject.Parse(history.PushContent);
|
body = JsonConvert.DeserializeObject<TrackPushInput>(history.PushContent);
|
||||||
((JArray)body["data"]!).Add(JObject.FromObject(track));
|
body!.Data.Add(track);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,6 +190,7 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
config.ServiceProviderCode, body);
|
config.ServiceProviderCode, body);
|
||||||
|
|
||||||
log.PushContent = body.ToJson();
|
log.PushContent = body.ToJson();
|
||||||
|
|
||||||
log.IsSuccess = res.Code == InterfaceRelayConst.SuccessCode;
|
log.IsSuccess = res.Code == InterfaceRelayConst.SuccessCode;
|
||||||
log.RequestId = res.RequestId;
|
log.RequestId = res.RequestId;
|
||||||
log.Message = res.Msg;
|
log.Message = res.Msg;
|
||||||
|
|||||||
@ -218,6 +218,7 @@ public class TrackRefreshEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
OrderType = context.OrderType,
|
OrderType = context.OrderType,
|
||||||
OrderNo = context.OrderNo,
|
OrderNo = context.OrderNo,
|
||||||
ServiceProviderName = context.ServiceProviderName,
|
ServiceProviderName = context.ServiceProviderName,
|
||||||
|
OriginTrackData = JsonConvert.SerializeObject(trackToken),
|
||||||
IsCompleted = matchedContentConfig.IsCompleted,
|
IsCompleted = matchedContentConfig.IsCompleted,
|
||||||
SubSystemId = context.SubSystemId,
|
SubSystemId = context.SubSystemId,
|
||||||
TrackCode = matchedContentConfig.TrackContentCode,
|
TrackCode = matchedContentConfig.TrackContentCode,
|
||||||
@ -225,6 +226,11 @@ public class TrackRefreshEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
TrackTime = trackTime ?? DateTime.Now,
|
TrackTime = trackTime ?? DateTime.Now,
|
||||||
TrackTimeZone = trackTimeZone ?? matchedContentConfig.TrackTimeZoneValue ?? 8
|
TrackTimeZone = trackTimeZone ?? matchedContentConfig.TrackTimeZoneValue ?? 8
|
||||||
};
|
};
|
||||||
|
if (paramConfig.TrackContentName != null)
|
||||||
|
{
|
||||||
|
trackUpsertEvent.OriginTrackContent = trackToken[paramConfig.TrackContentName]?.Value<string>();
|
||||||
|
}
|
||||||
|
|
||||||
await _capPublisher.PublishAsync(GlobalConst.TrackUpsertSubscribe, trackUpsertEvent);
|
await _capPublisher.PublishAsync(GlobalConst.TrackUpsertSubscribe, trackUpsertEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -131,6 +131,8 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
TrackTime = @event.TrackTime,
|
TrackTime = @event.TrackTime,
|
||||||
TrackTimeZone = @event.TrackTimeZone,
|
TrackTimeZone = @event.TrackTimeZone,
|
||||||
ServiceProviderName = @event.ServiceProviderName,
|
ServiceProviderName = @event.ServiceProviderName,
|
||||||
|
OriginTrackContent = @event.OriginTrackContent,
|
||||||
|
OriginTrackData = @event.OriginTrackData,
|
||||||
IsCanDelete = false,
|
IsCanDelete = false,
|
||||||
CreateUser = @event.OperationMan ?? GlobalConst.SystemUser,
|
CreateUser = @event.OperationMan ?? GlobalConst.SystemUser,
|
||||||
CreateTime = DateTime.Now
|
CreateTime = DateTime.Now
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="SJZY.InterfaceRelay.Application.Contracts" Version="7.1.8"/>
|
<PackageReference Include="SJZY.InterfaceRelay.Application.Contracts" Version="7.1.9"/>
|
||||||
<PackageReference Include="Volo.Abp.Http.Client" Version="7.0.2" />
|
<PackageReference Include="Volo.Abp.Http.Client" Version="7.0.2" />
|
||||||
<PackageReference Include="Volo.Abp.FluentValidation" Version="7.0.2" />
|
<PackageReference Include="Volo.Abp.FluentValidation" Version="7.0.2" />
|
||||||
<PackageReference Include="SJZY.UserCenter.HttpApi" Version="3.0.3-alpha8" />
|
<PackageReference Include="SJZY.UserCenter.HttpApi" Version="3.0.3-alpha8" />
|
||||||
|
|||||||
@ -64,7 +64,7 @@ public class TrackPullService : ApplicationService
|
|||||||
|
|
||||||
var attach = Base64Helper.SerializeObject(group.Key);
|
var attach = Base64Helper.SerializeObject(group.Key);
|
||||||
// 批量获取轨迹
|
// 批量获取轨迹
|
||||||
await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync(
|
var _ = await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync(
|
||||||
"A012", serviceProviderCode, data, GlobalConst.TrackRefreshSubscribe, attach);
|
"A012", serviceProviderCode, data, GlobalConst.TrackRefreshSubscribe, attach);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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)
|
||||||
{
|
{
|
||||||
@ -39,6 +39,7 @@ public partial class TrackService
|
|||||||
Code = x.TrackCode,
|
Code = x.TrackCode,
|
||||||
Status = x.TrackStatus,
|
Status = x.TrackStatus,
|
||||||
Content = x.TrackContent,
|
Content = x.TrackContent,
|
||||||
|
OriginContent = x.OriginTrackContent,
|
||||||
Location = x.TrackPlace,
|
Location = x.TrackPlace,
|
||||||
Time = x.TrackTime.AddHours(input.TimeZone ?? 8 - x.TrackTimeZone),
|
Time = x.TrackTime.AddHours(input.TimeZone ?? 8 - x.TrackTimeZone),
|
||||||
TimeZone = input.TimeZone ?? 8
|
TimeZone = input.TimeZone ?? 8
|
||||||
@ -49,25 +50,16 @@ 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)
|
||||||
{
|
{
|
||||||
switch (input.SortMethod)
|
|
||||||
{
|
|
||||||
case SortMethod.ByTrackTime:
|
|
||||||
// tips:quick-sort 直接修改原list
|
|
||||||
list.ForEach(item => item.TrackDetails.Sort((a, b) => a.Time.CompareTo(b.Time)));
|
|
||||||
break;
|
|
||||||
case SortMethod.ByTrackTimeDesc:
|
|
||||||
list.ForEach(item => item.TrackDetails.Sort((a, b) => b.Time.CompareTo(a.Time)));
|
|
||||||
break;
|
|
||||||
case SortMethod.ByTemplate:
|
|
||||||
var orderTemplates = await _provideQueries
|
var orderTemplates = await _provideQueries
|
||||||
.GetOrderTemplateLinksAsync(input.OrderType, input.OrderNos);
|
.GetOrderTemplateLinksAsync(input.OrderType, input.OrderNos);
|
||||||
var distinctTemplateIds = orderTemplates.Select(x => x.TemplateId).Distinct().ToList();
|
var distinctTemplateIds = orderTemplates.Select(x => x.TemplateId).Distinct().ToList();
|
||||||
var templateContent = await _provideQueries.GetOrderedTrackCodesAsync(distinctTemplateIds);
|
var templateContent = await _provideQueries.GetOrderedTrackCodesAsync(distinctTemplateIds);
|
||||||
|
|
||||||
list.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
var codes = new List<string>();
|
var codes = new List<string>();
|
||||||
@ -85,9 +77,32 @@ public partial class TrackService
|
|||||||
.OrderBy(x => codes.IndexOf(x.Code)) // 按照在模板内容的位置排序
|
.OrderBy(x => codes.IndexOf(x.Code)) // 按照在模板内容的位置排序
|
||||||
.ToList();
|
.ToList();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
switch (input.SortMethod)
|
||||||
|
{
|
||||||
|
case SortMethod.ByTrackTime:
|
||||||
|
// tips:quick-sort 直接修改原list
|
||||||
|
list.ForEach(item => item.TrackDetails.Sort((a, b) => a.Time.CompareTo(b.Time)));
|
||||||
|
break;
|
||||||
|
case SortMethod.ByTrackTimeDesc:
|
||||||
|
list.ForEach(item => item.TrackDetails.Sort((a, b) => b.Time.CompareTo(a.Time)));
|
||||||
|
break;
|
||||||
|
case SortMethod.ByTemplate:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new ArgumentOutOfRangeException(nameof(input.SortMethod), input.SortMethod, "不支持的排序方式");
|
throw new ArgumentOutOfRangeException(nameof(input.SortMethod), input.SortMethod, "不支持的排序方式");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 显示原轨迹
|
||||||
|
list.ForEach(item =>
|
||||||
|
{
|
||||||
|
item.TrackDetails.ForEach(track =>
|
||||||
|
{
|
||||||
|
if (templateContent.First(x => x.Code == track.Code).ShowOrigin)
|
||||||
|
{
|
||||||
|
track.Content = track.OriginContent;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -59,6 +59,8 @@ public class TrackContentService : ApplicationService
|
|||||||
}
|
}
|
||||||
|
|
||||||
var dto = ObjectMapper.Map<GetTrackContentDetailVO, GetTrackContentDetailDto>(detailInfo);
|
var dto = ObjectMapper.Map<GetTrackContentDetailVO, GetTrackContentDetailDto>(detailInfo);
|
||||||
|
|
||||||
|
if (dto.TrackFlagId == 0) dto.TrackFlagId = null;
|
||||||
return new UnifyResultDto<GetTrackContentDetailDto>("200", "", dto);
|
return new UnifyResultDto<GetTrackContentDetailDto>("200", "", dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -160,8 +160,20 @@ public class TrackOrderService : ApplicationService
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <param name="orderId">订单id</param>
|
/// <param name="orderId">订单id</param>
|
||||||
[HttpGet("GetTrackPushRecords")]
|
[HttpGet("GetTrackPushRecords")]
|
||||||
public async Task<List<TrackPushRecordIndex>> GetTrackPushRecordsAsync(int orderId)
|
public async Task<List<TrackPushRecordOutput>> GetTrackPushRecordsAsync(int orderId)
|
||||||
{
|
{
|
||||||
return await _trackPushRecordsRepository.GetTrackPushRecordsAsync(orderId);
|
var records = await _trackPushRecordsRepository.GetTrackPushRecordsAsync(orderId);
|
||||||
|
|
||||||
|
var res = ObjectMapper.Map<List<TrackPushRecordIndex>, List<TrackPushRecordOutput>>(records);
|
||||||
|
|
||||||
|
res.ForEach(x =>
|
||||||
|
{
|
||||||
|
int hours = (int)x.TrackTimeZone; // 提取整数部分作为小时
|
||||||
|
int minutes = (int)((x.TrackTimeZone - hours) * 60); // 将小数部分乘以 60 转换为分钟
|
||||||
|
x.TrackGTMTimeZone =
|
||||||
|
$"GTM {(x.TrackTimeZone >= 0 ? "+" : "-")}{new TimeSpan(hours, minutes, 0).ToString().RemovePostFix(":00")}";
|
||||||
|
});
|
||||||
|
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,5 +1,4 @@
|
|||||||
using System.Linq.Expressions;
|
using SJZY.Expand.ABP.Core;
|
||||||
using SJZY.Expand.ABP.Core;
|
|
||||||
using SJZY.Track.Application.Contract.Dtos.TrackPush;
|
using SJZY.Track.Application.Contract.Dtos.TrackPush;
|
||||||
using SJZY.Track.Application.Contract.Services;
|
using SJZY.Track.Application.Contract.Services;
|
||||||
using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
|
using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
|
||||||
@ -22,11 +21,25 @@ public class TrackPushCacheService : ITrackPushCacheService, ITransientDependenc
|
|||||||
|
|
||||||
public async Task<List<TrackPushContentConfigDto>?> GetPushContentConfigsAsync(int subSystemId, int customId)
|
public async Task<List<TrackPushContentConfigDto>?> GetPushContentConfigsAsync(int subSystemId, int customId)
|
||||||
{
|
{
|
||||||
var data = await RedisHelper.Client.GetAsync<List<TrackPushContentConfigDto>>(
|
var exists = await RedisHelper.Client.ExistsAsync(TrackPushContentKey(subSystemId, customId));
|
||||||
|
if (exists)
|
||||||
|
{
|
||||||
|
return await RedisHelper.Client.GetAsync<List<TrackPushContentConfigDto>>(
|
||||||
TrackPushContentKey(subSystemId, customId));
|
TrackPushContentKey(subSystemId, customId));
|
||||||
|
}
|
||||||
|
|
||||||
data ??= await SetPushContentConfigsAsync(subSystemId: subSystemId, customId: customId);
|
return await SetPushContentConfigsAsync(subSystemId, customId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<TrackPushContentConfigDto>?> SetPushContentConfigsAsync(int subSystemId, int customId)
|
||||||
|
{
|
||||||
|
// maybe is null
|
||||||
|
var data = await DoGetPushContentConfigsAsync(subSystemId, customId);
|
||||||
|
var ttl = 3 * 24 * 60 * 60;
|
||||||
|
if (data == null) ttl = 5;
|
||||||
|
// ttl 3days
|
||||||
|
await RedisHelper.Client.SetAsync(TrackPushContentKey(subSystemId, customId),
|
||||||
|
data, ttl);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,26 +68,26 @@ public class TrackPushCacheService : ITrackPushCacheService, ITransientDependenc
|
|||||||
// find swap
|
// find swap
|
||||||
cache.FirstOrDefault(x => x.TrackCode == cache[idx + 1].SwapTrackCode);
|
cache.FirstOrDefault(x => x.TrackCode == cache[idx + 1].SwapTrackCode);
|
||||||
|
|
||||||
return matched != null && matched.TrackCode == trackCode && matched.IsAutoPush ? matched : default;
|
return matched != null && matched.TrackCode == trackCode ? matched : default;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<TrackPushContentConfigDto>?> SetPushContentConfigsAsync(int? id = null,
|
private async Task<List<TrackPushContentConfigDto>?> DoGetPushContentConfigsAsync(int subSystemId, int customId)
|
||||||
int? subSystemId = null,
|
|
||||||
int? customId = null)
|
|
||||||
{
|
{
|
||||||
Expression<Func<TrackPushConfigEntity, bool>> exp = x => true;
|
var trackPushConfig = await _trackPushConfigRepository.GetFirstAsync(
|
||||||
if (id.HasValue) exp = x => x.Id == id;
|
x => x.SubSystemId == subSystemId && x.CustomId == customId, x => new
|
||||||
else if (subSystemId.HasValue && customId.HasValue)
|
|
||||||
exp = x => x.SubSystemId == subSystemId && x.CustomId == customId;
|
|
||||||
|
|
||||||
var trackPushConfig = await _trackPushConfigRepository.GetFirstAsync(exp, x => new
|
|
||||||
{
|
{
|
||||||
x.Id, x.IsAutoPush, x.IsAllPush, x.IsCanDelete, x.IsCanUpdate, x.SubSystemId, x.CustomId
|
x.Id, x.IsAutoPush, x.IsAllPush, x.IsCanDelete, x.IsCanUpdate, x.SubSystemId, x.CustomId
|
||||||
});
|
});
|
||||||
if (trackPushConfig == null) return null;
|
if (trackPushConfig == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
var trackPushContentList = await _trackPushConfigRepository.GetContentListAsync(trackPushConfig.Id);
|
var trackPushContentList = await _trackPushConfigRepository.GetContentListAsync(trackPushConfig.Id);
|
||||||
if (trackPushContentList.Count == 0) return null;
|
if (trackPushContentList.Count == 0)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// tips:hot path,auto mapper性能不如原生
|
// tips:hot path,auto mapper性能不如原生
|
||||||
var res = trackPushContentList.Select(item => new TrackPushContentConfigDto
|
var res = trackPushContentList.Select(item => new TrackPushContentConfigDto
|
||||||
@ -95,9 +108,6 @@ public class TrackPushCacheService : ITrackPushCacheService, ITransientDependenc
|
|||||||
ExpandFieldsValue = item.ExpandFieldsValue,
|
ExpandFieldsValue = item.ExpandFieldsValue,
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
await RedisHelper.Client.SetAsync(TrackPushContentKey(trackPushConfig.SubSystemId, trackPushConfig.CustomId),
|
|
||||||
res);
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -95,12 +95,17 @@ public class TrackPushService : ApplicationService
|
|||||||
throw new BusinessException(message: _stringLocalizer["IsTrackPushConfigAny"]);
|
throw new BusinessException(message: _stringLocalizer["IsTrackPushConfigAny"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
using var ts = TransactionScopeHelper.Create();
|
||||||
|
|
||||||
switch (input.Options)
|
switch (input.Options)
|
||||||
{
|
{
|
||||||
case OptionTypeNoNull.新增:
|
case OptionTypeNoNull.新增:
|
||||||
{
|
{
|
||||||
var trackPushEntity = ObjectMapper.Map<EditTrackPushConfigInput, TrackPushConfigEntity>(input);
|
var trackPushEntity = ObjectMapper.Map<EditTrackPushConfigInput, TrackPushConfigEntity>(input);
|
||||||
|
|
||||||
await _trackPushConfigRepository.InsertReturnIdentityAsync(trackPushEntity);
|
await _trackPushConfigRepository.InsertReturnIdentityAsync(trackPushEntity);
|
||||||
|
await _trackPushCacheService.SetPushContentConfigsAsync(trackPushEntity.SubSystemId,
|
||||||
|
trackPushEntity.CustomId);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -111,21 +116,19 @@ public class TrackPushService : ApplicationService
|
|||||||
|
|
||||||
ObjectMapper.Map(input, oldTrackPushEntity);
|
ObjectMapper.Map(input, oldTrackPushEntity);
|
||||||
await _trackPushConfigRepository.UpdateAsync(oldTrackPushEntity);
|
await _trackPushConfigRepository.UpdateAsync(oldTrackPushEntity);
|
||||||
|
await _trackPushCacheService.SetPushContentConfigsAsync(oldTrackPushEntity.SubSystemId,
|
||||||
if (input.IsAutoPush!.Value) await _trackPushCacheService.SetPushContentConfigsAsync(input.Id);
|
oldTrackPushEntity.CustomId);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OptionTypeNoNull.删除:
|
case OptionTypeNoNull.删除:
|
||||||
{
|
{
|
||||||
_ = await _trackPushConfigRepository.GetFirstAsync(x => x.Id == input.Id) ??
|
var entity = await _trackPushConfigRepository.GetFirstAsync(x => x.Id == input.Id) ??
|
||||||
throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
||||||
|
|
||||||
using var ts = TransactionScopeHelper.Create();
|
|
||||||
await _trackPushConfigRepository.SoftDeleteAsync(x => x.Id == input.Id);
|
await _trackPushConfigRepository.SoftDeleteAsync(x => x.Id == input.Id);
|
||||||
await _trackPushConfigRepository.SoftDeleteContentAsync(x => x.TrackPushConfigId == input.Id);
|
await _trackPushConfigRepository.SoftDeleteContentAsync(x => x.TrackPushConfigId == input.Id);
|
||||||
|
await _trackPushCacheService.SetPushContentConfigsAsync(entity.SubSystemId, entity.CustomId);
|
||||||
ts.Complete();
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -134,6 +137,7 @@ public class TrackPushService : ApplicationService
|
|||||||
nameof(EditTrackPushConfigInput.Options)]);
|
nameof(EditTrackPushConfigInput.Options)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ts.Complete();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,6 +176,10 @@ public class TrackPushService : ApplicationService
|
|||||||
throw new BusinessException(message: _stringLocalizer["IsTrackPushEnContentValueAny"]);
|
throw new BusinessException(message: _stringLocalizer["IsTrackPushEnContentValueAny"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var trackPushConfigId = input.TrackPushConfigId;
|
||||||
|
|
||||||
|
using var ts = TransactionScopeHelper.Create();
|
||||||
|
|
||||||
switch (input.Options)
|
switch (input.Options)
|
||||||
{
|
{
|
||||||
case OptionTypeNoNull.新增:
|
case OptionTypeNoNull.新增:
|
||||||
@ -181,10 +189,7 @@ public class TrackPushService : ApplicationService
|
|||||||
|
|
||||||
var entity = ObjectMapper.Map<EditTrackPushContentInput, TrackPushContentConfigEntity>(input);
|
var entity = ObjectMapper.Map<EditTrackPushContentInput, TrackPushContentConfigEntity>(input);
|
||||||
entity.Sort = maxSort + 1;
|
entity.Sort = maxSort + 1;
|
||||||
|
|
||||||
await _trackPushConfigRepository.InsertContentAsync(entity);
|
await _trackPushConfigRepository.InsertContentAsync(entity);
|
||||||
await _trackPushCacheService.SetPushContentConfigsAsync(input.TrackPushConfigId);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,10 +199,7 @@ public class TrackPushService : ApplicationService
|
|||||||
throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
||||||
|
|
||||||
ObjectMapper.Map(input, entity);
|
ObjectMapper.Map(input, entity);
|
||||||
|
|
||||||
await _trackPushConfigRepository.UpdateContentAsync(entity);
|
await _trackPushConfigRepository.UpdateContentAsync(entity);
|
||||||
await _trackPushCacheService.SetPushContentConfigsAsync(entity.TrackPushConfigId);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,18 +207,10 @@ public class TrackPushService : ApplicationService
|
|||||||
{
|
{
|
||||||
var entity = await _trackPushConfigRepository.GetContentByIdAsync(input.Id!.Value) ??
|
var entity = await _trackPushConfigRepository.GetContentByIdAsync(input.Id!.Value) ??
|
||||||
throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
||||||
|
trackPushConfigId = entity.TrackPushConfigId;
|
||||||
using (var ts = TransactionScopeHelper.Create())
|
|
||||||
{
|
|
||||||
await _trackPushConfigRepository.SoftDeleteContentAsync(x => x.Id == input.Id);
|
await _trackPushConfigRepository.SoftDeleteContentAsync(x => x.Id == input.Id);
|
||||||
await _trackPushConfigRepository.UpdateContentAsync(x => x.Sort == x.Sort - 1,
|
await _trackPushConfigRepository.UpdateContentAsync(x => x.Sort == x.Sort - 1,
|
||||||
x => x.TrackPushConfigId == entity.TrackPushConfigId && x.Sort > entity.Sort);
|
x => x.TrackPushConfigId == entity.TrackPushConfigId && x.Sort > entity.Sort);
|
||||||
|
|
||||||
ts.Complete();
|
|
||||||
}
|
|
||||||
|
|
||||||
await _trackPushCacheService.SetPushContentConfigsAsync(entity.TrackPushConfigId);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,6 +219,14 @@ public class TrackPushService : ApplicationService
|
|||||||
nameof(EditTrackPushContentInput.Options)]);
|
nameof(EditTrackPushContentInput.Options)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var pushConfig = await _trackPushConfigRepository.GetFirstAsync(x => x.Id == trackPushConfigId);
|
||||||
|
if (pushConfig != null)
|
||||||
|
{
|
||||||
|
await _trackPushCacheService.SetPushContentConfigsAsync(pushConfig.SubSystemId, pushConfig.CustomId);
|
||||||
|
}
|
||||||
|
|
||||||
|
ts.Complete();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,8 +249,19 @@ public class TrackPushService : ApplicationService
|
|||||||
|
|
||||||
if (trackPushContentEntities.Count > 0)
|
if (trackPushContentEntities.Count > 0)
|
||||||
{
|
{
|
||||||
|
using var ts = TransactionScopeHelper.Create();
|
||||||
|
|
||||||
await _trackPushConfigRepository.UpdateContentRangeAsync(trackPushContentEntities);
|
await _trackPushConfigRepository.UpdateContentRangeAsync(trackPushContentEntities);
|
||||||
await _trackPushCacheService.SetPushContentConfigsAsync(trackPushContentEntities[0].TrackPushConfigId);
|
|
||||||
|
var pushConfig =
|
||||||
|
await _trackPushConfigRepository.GetFirstAsync(x =>
|
||||||
|
x.Id == trackPushContentEntities[0].TrackPushConfigId);
|
||||||
|
if (pushConfig != null)
|
||||||
|
{
|
||||||
|
await _trackPushCacheService.SetPushContentConfigsAsync(pushConfig.SubSystemId, pushConfig.CustomId);
|
||||||
|
}
|
||||||
|
|
||||||
|
ts.Complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -1,7 +0,0 @@
|
|||||||
namespace SJZY.Track.Application.Services.TrackTemplates
|
|
||||||
{
|
|
||||||
public interface ITrackTemplateService
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -16,4 +16,9 @@ public class OrderedTrackCodeDto
|
|||||||
/// 是否对外
|
/// 是否对外
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsExternal { get; set; }
|
public bool IsExternal { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 显示原轨迹
|
||||||
|
/// </summary>
|
||||||
|
public bool ShowOrigin { get; set; }
|
||||||
}
|
}
|
||||||
@ -20,20 +20,6 @@ public class ProvideQueries : ISugarRepository, IProvideQueries,
|
|||||||
Context = SqlsugarScopeBasic.GetContextSafely("default");
|
Context = SqlsugarScopeBasic.GetContextSafely("default");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<OrderTemplateLinkDto>> GetOrderTemplateLinksAsync(int orderType,
|
|
||||||
params string[] orderNumbers)
|
|
||||||
{
|
|
||||||
return await Context.Queryable<OrderEntity>()
|
|
||||||
.LeftJoin<OrderTemplateEntity>((a, b) => a.Id == b.OrderId)
|
|
||||||
.Where(a => a.OrderType == orderType && orderNumbers.Contains(a.OrderNo))
|
|
||||||
.Select((a, b) => new OrderTemplateLinkDto
|
|
||||||
{
|
|
||||||
OrderNo = a.OrderNo,
|
|
||||||
TemplateId = b.TrackTemplateId
|
|
||||||
})
|
|
||||||
.ToListAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<List<OrderTemplateLinkDto>> GetOrderTemplateLinksAsync(int orderType, List<string> orderNumbers)
|
public async Task<List<OrderTemplateLinkDto>> GetOrderTemplateLinksAsync(int orderType, List<string> orderNumbers)
|
||||||
{
|
{
|
||||||
return await Context.Queryable<OrderEntity>()
|
return await Context.Queryable<OrderEntity>()
|
||||||
@ -49,15 +35,17 @@ public class ProvideQueries : ISugarRepository, IProvideQueries,
|
|||||||
|
|
||||||
public async Task<List<OrderedTrackCodeDto>> GetOrderedTrackCodesAsync(List<int> templateIds)
|
public async Task<List<OrderedTrackCodeDto>> GetOrderedTrackCodesAsync(List<int> templateIds)
|
||||||
{
|
{
|
||||||
return await Context.Queryable<TrackTemplateContentEntity>()
|
return await Context.Queryable<TrackTemplateEntity>()
|
||||||
.LeftJoin<TrackContentEntity>((a, b) => a.TrackContentId == b.Id)
|
.LeftJoin<TrackTemplateContentEntity>((a, b) => a.Id == b.TrackTemplateId)
|
||||||
.Where(a => templateIds.Contains(a.TrackTemplateId))
|
.LeftJoin<TrackContentEntity>((a, b, c) => b.TrackContentId == c.Id)
|
||||||
.OrderBy(a => a.Sort)
|
.Where(a => templateIds.Contains(a.Id))
|
||||||
.Select((a, b) => new OrderedTrackCodeDto
|
.OrderBy((a, b) => b.Sort)
|
||||||
|
.Select((a, b, c) => new OrderedTrackCodeDto
|
||||||
{
|
{
|
||||||
TemplateId = a.TrackTemplateId,
|
TemplateId = a.Id,
|
||||||
Code = b.Code,
|
ShowOrigin = a.ShowOrigin,
|
||||||
IsExternal = a.IsExternal
|
Code = c.Code,
|
||||||
|
IsExternal = b.IsExternal
|
||||||
})
|
})
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -85,6 +85,7 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract<TrackDetail
|
|||||||
.Field(f => f.TrackStatus)
|
.Field(f => f.TrackStatus)
|
||||||
.Field(f => f.TrackCode)
|
.Field(f => f.TrackCode)
|
||||||
.Field(f => f.TrackContent)
|
.Field(f => f.TrackContent)
|
||||||
|
.Field(f => f.OriginTrackContent)
|
||||||
.Field(f => f.TrackPlace)
|
.Field(f => f.TrackPlace)
|
||||||
.Field(f => f.TrackTime)
|
.Field(f => f.TrackTime)
|
||||||
.Field(f => f.TrackTimeZone)
|
.Field(f => f.TrackTimeZone)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user