Merge branch 'S06' into test

This commit is contained in:
hardstylewyl 2024-12-20 15:22:09 +08:00
commit ebb81a4cc0
4 changed files with 42 additions and 10 deletions

View File

@ -100,7 +100,9 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
// 推送新增,需要根据上一次的推送 推断 本次推送 是否可行
config = GetValidPushConfigAsync(_pushConfigs, order.LatestPushTrackCode, @event.TrackCode);
if (config == null) continue;
// 是否自动推送
if (!config.IsAutoPush) continue;
//配置的类型如何和订单类型不一致则不允许推送
if (config.OrderType != order.OrderType) continue;
var log = new TrackPushRecordIndex
@ -142,6 +144,9 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
if (config == null) continue;
//配置的类型如何和订单类型不一致则不允许推送
if (config.OrderType != order.OrderType) continue;
var log = new TrackPushRecordIndex
{
OptionType = @event.OptionType.ToString(),
@ -202,6 +207,9 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
var items = new List<TrackUpdateInput>();
foreach (var order in _orders)
{
//配置的类型如何和订单类型不一致则不允许推送
if (config.OrderType != order.OrderType) continue;
var log = new TrackPushRecordIndex
{
OptionType = @event.OptionType.ToString(),

View File

@ -67,11 +67,11 @@ public class TrackPushCompletedEventHandler : ITransientDependency, IRabbitHandl
var optionType = Base64Helper.DeSerialize<string>(@event.Attach);
if (optionType == OptionType.新增.ToString())
{
logStr = JsonConvert.DeserializeObject<TrackPushInput>(@event.RequestParams)!.Log;
logStr = JsonConvert.DeserializeObject<List<TrackPushInput>>(@event.RequestParams)!.First().Log;
}
else if (optionType == OptionType.修改.ToString())
{
logStr = JsonConvert.DeserializeObject<TrackUpdateInput>(@event.RequestParams)!.Log;
logStr = JsonConvert.DeserializeObject<List<TrackUpdateInput>>(@event.RequestParams)!.First().Log;;
}
if (logStr.IsNullOrEmpty()) throw new InvalidOperationException();

View File

@ -13,7 +13,6 @@ using SJZY.Track.Domain.Aggregates.TrackFlagAggregate;
using SJZY.Track.Domain.Aggregates.TrackStatusAggregate;
using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
using SJZY.Track.Domain.Dtos.TrackContents;
using SJZY.Track.Domain.Dtos.TrackTemplate;
using SJZY.Track.Domain.Enums;
using SJZY.Track.Domain.Queries;
@ -290,6 +289,11 @@ public class TrackContentService : ApplicationService
if (order == default)
throw new BusinessException(message: "订单不存在!");
var res = new UnifyResultDto<List<GetAvailableContentOutput>>(true)
{
Data = new List<GetAvailableContentOutput>()
};
//获取轨迹详情
var trackDetails = await _trackDetailsEsRepository.GetListAsync(order.Id);
@ -298,6 +302,17 @@ public class TrackContentService : ApplicationService
{
trackDetails = trackDetails.Where(m => m.Source != (int) TrackSourceEnum.ExternalServiceProvide).ToList();
}
//进行推送时,匹配订单类型一致的轨迹
if (input.TrackOptionType == TrackOptionType.推送)
{
trackDetails = trackDetails.Where(t => t.OrderType == order.OrderType).ToList();
}
//进行删除和推送行为无任何轨迹内容,直接返回为空即可
if (input.TrackOptionType is TrackOptionType.删除 or TrackOptionType.推送 && trackDetails.Count == 0)
{
return res;
}
//获取当前子系统下所有的轨迹内容
var contentList = await _trackContentRepository.GetListBySystemIdAsync(input.SystemId);
@ -312,11 +327,6 @@ public class TrackContentService : ApplicationService
contentList = contentList.Where(m => template.Contains(m.Code)).ToList();
}
var res = new UnifyResultDto<List<GetAvailableContentOutput>>(true)
{
Data = new List<GetAvailableContentOutput>()
};
foreach (var item in contentList)
{
//新增时跳过已存在轨迹内容
@ -351,7 +361,7 @@ public class TrackContentService : ApplicationService
}
//修改操作,查轨迹内容列表反映明细表数据,重新构造响应数据
//修改/删除/推送 操作,查轨迹内容列表反映明细表数据,重新构造响应数据
var matchContent = new List<GetAvailableContentOutput>();
var contents = res.Data.Select(x => new
{

View File

@ -142,7 +142,8 @@ public class SjzyTrackApplicationModule : AbpModule
options.PoolSize = configuration.GetValue<int>("RabbitMQ:PoolSize");
options.Declarations = new List<Action<IDeclaration>>()
{
o=>o.ExchangeDeclare(GlobalConst.TrackChangeExchange, ExchangeType.Topic, true),
o => o.ExchangeDeclare(GlobalConst.TrackChangeExchange, ExchangeType.Topic, true),
o => o.ExchangeDeclare(GlobalConst.TrackPushExchange, ExchangeType.Topic, true)
};
options.Consumes = new List<ConsumeOptions>
{
@ -158,6 +159,19 @@ public class SjzyTrackApplicationModule : AbpModule
o.QueueBind(GlobalConst.TrackRefreshSubscribe, GlobalConst.InterfaceRelayExchange,
GlobalConst.TrackRefreshSubscribe);
}
},
new()
{
Queue = GlobalConst.TrackPushCompletedSubscribe,
FetchCount = configuration.GetValue<ushort>("TrackApp:TrackRefreshFetchCount"),
FailedRequeue = false,
Declaration = o =>
{
o.ExchangeDeclare(GlobalConst.InterfaceRelayExchange, ExchangeType.Direct, true);
o.QueueDeclare(GlobalConst.TrackPushCompletedSubscribe, true);
o.QueueBind(GlobalConst.TrackPushCompletedSubscribe, GlobalConst.InterfaceRelayExchange,
GlobalConst.TrackPushCompletedSubscribe);
}
}
};
}, typeof(SjzyTrackApplicationModule).Assembly);