临时提交

This commit is contained in:
李鹏军 2024-03-15 14:49:09 +08:00
parent 12c439c832
commit 91ad7eebb8
18 changed files with 234 additions and 131 deletions

View File

@ -0,0 +1,44 @@
namespace SJZY.Track.Application.Contract.Dtos.ProvideServices;
public class TrackPushContentConfigDto
{
/// <summary>
/// 扩展字段参数值
/// </summary>
public string? ExpandFieldsValue { get; set; }
/// <summary>
/// 推送单号类型(主数据枚举TrackOrderType)
/// </summary>
public int OrderType { get; set; }
/// <summary>
/// 轨迹代码参数值
/// </summary>
public string? TrackContentCodeValue { get; set; }
/// <summary>
/// 轨迹内容id
/// </summary>
public int TrackContentId { get; set; }
/// <summary>
/// 轨迹内容参数值
/// </summary>
public string? TrackContentValue { get; set; }
/// <summary>
/// 轨迹内容英文参数值
/// </summary>
public string? TrackEnContentValue { get; set; }
/// <summary>
/// 轨迹状态参数值
/// </summary>
public string? TrackStatusValue { get; set; }
/// <summary>
/// 轨迹时区GMT
/// </summary>
public double? TrackTimeZone { get; set; }
}

View File

@ -20,9 +20,9 @@ public class TrackUpsertEvent : UpsertTrackInput
public int SubSystemId { get; set; }
/// <summary>
/// 订单是否推送完成(异步维护)
/// 最新推送代码(异步维护)
/// </summary>
public bool IsPushCompleted { get; set; }
public int? LatestPushTrackContentId { get; set; }
/// <summary>
/// 上游子系统id

View File

@ -41,4 +41,9 @@ public class UpdateOrderTrackEvent
/// 轨迹时区
/// </summary>
public float TrackTimeZone { get; set; }
/// <summary>
/// 轨迹代码
/// </summary>
public string TrackCode { get; set; } = null!;
}

View File

@ -1,4 +1,6 @@
namespace SJZY.Track.Application.Contract.Services;
using SJZY.Track.Application.Contract.Dtos.ProvideServices;
namespace SJZY.Track.Application.Contract.Services;
public interface ITrackPushCacheService
{
@ -10,12 +12,22 @@ public interface ITrackPushCacheService
Task<bool> IsPushAsync(int customId);
/// <summary>
/// 判断客户是否需要推送
/// 获取服务商拉取配置
/// </summary>
/// <param name="subSystemId">子系统id</param>
/// <param name="customId">服务商id</param>
/// <returns></returns>
Task<List<TrackPushContentConfigDto>> GetPushContentConfigsAsync(int subSystemId, int customId);
/// <summary>
/// 根据轨迹代码推断下一个(升序)要推送的内容,如果找不到或者已经是最后一个了,返回null
/// </summary>
/// <param name="subSystemId"></param>
/// <param name="customId"></param>
/// <param name="trackContentId"></param>
/// <returns></returns>
Task<bool> IsPushAsync(int subSystemId, int customId);
Task<TrackPushContentConfigDto?> InferNextPushContentOrNullAsync(int subSystemId, int customId,
int? trackContentId);
/// <summary>
/// 更新缓存

View File

@ -31,7 +31,7 @@ public class OrderLinkAfterFillTrackHandler : ITransientDependency, ICapSubscrib
var order = await _orderRepository.GetFirstAsync(x =>
x.Id == linkOrderId, x => new
{
x.OrderType, x.OrderNo, x.CustomId, x.IsPushCompleted, x.SubSystemId
x.OrderType, x.OrderNo, x.CustomId, LatestPushCode = x.LatestPushTrackContentId, x.SubSystemId
});
if (order == default) continue;
@ -50,7 +50,7 @@ public class OrderLinkAfterFillTrackHandler : ITransientDependency, ICapSubscrib
OrderId = linkOrderId,
CustomId = order.CustomId,
SubSystemId = order.SubSystemId,
IsPushCompleted = order.IsPushCompleted,
LatestPushTrackContentId = order.LatestPushCode,
UpSubSystemId = @event.SubSystemId,
};

View File

@ -63,7 +63,7 @@ public class TrackRefreshEventHandler : ITransientDependency, ICapSubscribe
var order = await _orderRepository.GetFirstAsync(x =>
x.OrderType == orderType && x.OrderNo == orderNo, x => new
{
x.Id, x.SubSystemId, x.IsPushCompleted, x.CustomId
x.Id, x.SubSystemId, LatestPushCode = x.LatestPushTrackContentId, x.CustomId
});
if (order == default) return;
@ -73,7 +73,7 @@ public class TrackRefreshEventHandler : ITransientDependency, ICapSubscribe
{
OrderId = order.Id,
SubSystemId = order.SubSystemId,
IsPushCompleted = order.IsPushCompleted,
LatestPushTrackContentId = order.LatestPushCode,
CustomId = order.CustomId,
OrderType = orderType,
OrderNo = orderNo!,

View File

@ -88,6 +88,7 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
TrackStatus = trackContent.Status,
TrackCode = @event.TrackCode,
TrackContent = trackContent.Content,
TrackContentId = trackContent.Id,
IsCompleted = orderIsCompleted,
TrackEnContent = trackContent.EnContent,
TrackPlace = @event.TrackPlace,
@ -97,13 +98,6 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
CreateUser = CurrentUserRequest.CurrentUser.Name,
CreateTime = DateTime.Now
};
// todo:推送只做新增的,更新和删除的不做先
if (!@event.IsPushCompleted &&
await _trackPushCacheService.IsPushAsync(@event.SubSystemId, @event.CustomId))
{
//await PushTrack();
}
}
else
{
@ -114,13 +108,24 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
track.UpdateTime = DateTime.Now;
}
// upsert es轨迹
await _trackDetailsRepository.UpsertAsync(track);
// 触发轨迹推送事件
var content = await _trackPushCacheService.InferNextPushContentOrNullAsync(
@event.SubSystemId, @event.CustomId, @event.LatestPushTrackContentId);
if (content != default && content.TrackContentId == track.TrackContentId &&
content.OrderType == @event.OrderType)
{
//await PushTrack(content);
}
// 触发订单主表更新事件
await _capPublisher.PublishAsync(GlobalConst.UpdateOrderTrackSubscribe, new UpdateOrderTrackEvent
{
OrderId = track.OrderId,
IsCompleted = orderIsCompleted,
TrackCode = track.TrackCode,
TrackContent = track.TrackContent,
TrackEnContent = track.TrackEnContent,
TrackPlace = track.TrackPlace,
@ -137,7 +142,7 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
nextEvent.OrderType = linkedOrder.OrderType;
nextEvent.OrderNo = linkedOrder.OrderNo;
nextEvent.SubSystemId = linkedOrder.SubSystemId;
nextEvent.IsPushCompleted = linkedOrder.IsPushCompleted;
nextEvent.LatestPushTrackContentId = linkedOrder.LatestPushTrackContentId;
nextEvent.CustomId = linkedOrder.CustomId;
nextEvent.UpSubSystemId = @event.SubSystemId;
await _capPublisher.PublishAsync(GlobalConst.TrackUpsertSubscribe, nextEvent);

View File

@ -41,7 +41,7 @@ public partial class TrackService : ApplicationService, ITrackService
var order = await _orderRepository.GetFirstAsync(x =>
x.OrderType == input.OrderType && x.OrderNo == input.OrderNo, x => new
{
x.Id, x.SubSystemId, x.IsPushCompleted, x.CustomId
x.Id, x.SubSystemId, LatestPushCode = x.LatestPushTrackContentId, x.CustomId
});
if (order == default)
{
@ -52,7 +52,7 @@ public partial class TrackService : ApplicationService, ITrackService
var @event = ObjectMapper.Map<UpsertTrackInput, TrackUpsertEvent>(input);
@event.OrderId = order.Id;
@event.SubSystemId = order.SubSystemId;
@event.IsPushCompleted = order.IsPushCompleted;
@event.LatestPushTrackContentId = order.LatestPushCode;
@event.CustomId = order.CustomId;
await _capPublisher.PublishAsync(GlobalConst.TrackUpsertSubscribe, @event);
return true;
@ -76,7 +76,7 @@ public partial class TrackService : ApplicationService, ITrackService
var orders = await _orderRepository.GetListAsync(x =>
x.OrderType == input.OrderType && input.OrderNos.Contains(x.OrderNo), x => new
{
x.Id, x.OrderNo, x.SubSystemId, x.IsPushCompleted, x.CustomId
x.Id, x.OrderNo, x.SubSystemId, LatestPushCode = x.LatestPushTrackContentId, x.CustomId
});
foreach (var order in orders)
@ -92,7 +92,7 @@ public partial class TrackService : ApplicationService, ITrackService
OrderNo = order.OrderNo,
OrderId = order.Id,
SubSystemId = order.SubSystemId,
IsPushCompleted = order.IsPushCompleted,
LatestPushTrackContentId = order.LatestPushCode,
CustomId = order.CustomId
};
await _capPublisher.PublishAsync(GlobalConst.TrackUpsertSubscribe, @event);

View File

@ -1,4 +1,5 @@
using SJZY.Expand.ABP.Core;
using SJZY.Track.Application.Contract.Dtos.ProvideServices;
using SJZY.Track.Application.Contract.Services;
using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
using SJZY.Track.Domain.Queries;
@ -17,34 +18,20 @@ public class TrackPushCacheService : ITrackPushCacheService, ITransientDependenc
_trackPushConfigQuery = trackPushConfigQuery;
}
public async Task<bool> IsPushAsync(int customId)
public Task<bool> IsPushAsync(int customId)
{
var isPush =
await RedisHelper.Client.GetAsync<bool?>(RedisKey(customId));
if (isPush == null)
{
isPush = await _trackPushConfigQuery.GetFirstAsync(x => x.CustomId == customId,
x => x.IsAutoPush);
await RedisHelper.Client.SetAsync(RedisKey(customId), isPush);
}
return (bool)isPush;
throw new NotImplementedException();
}
public async Task<bool> IsPushAsync(int subSystemId, int customId)
public Task<List<TrackPushContentConfigDto>> GetPushContentConfigsAsync(int subSystemId, int customId)
{
var isPush =
await RedisHelper.Client.GetAsync<bool?>(RedisKey(customId));
throw new NotImplementedException();
}
if (isPush == null)
{
isPush = await _trackPushConfigQuery.GetFirstAsync(x => x.CustomId == customId,
x => x.IsAutoPush);
await RedisHelper.Client.SetAsync(RedisKey(customId), isPush);
}
return (bool)isPush;
public Task<TrackPushContentConfigDto?> InferNextPushContentOrNullAsync(int subSystemId, int customId,
int? trackContentId)
{
throw new NotImplementedException();
}
public async Task UpdateAsync(int customId, bool isPush)

View File

@ -1,4 +1,5 @@
using Microsoft.Extensions.Localization;
using System.Linq.Expressions;
using Microsoft.Extensions.Localization;
using SJZY.Expand.ABP.Core.Localization;
using SJZY.Expand.ABP.Core.PublicMethords;
using SJZY.Track.Application.Contract.Dtos.TrackPush;
@ -9,9 +10,6 @@ using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
using SJZY.Track.Domain.Dtos.Common;
using SJZY.Track.Domain.Dtos.TrackPush;
using SqlSugar;
using System.Linq.Expressions;
using Volo.Abp.DependencyInjection;
namespace SJZY.Track.Application.Services.TrackPush;
@ -20,11 +18,10 @@ namespace SJZY.Track.Application.Services.TrackPush;
/// </summary>
[ApiExplorerSettings(GroupName = "轨迹推送")]
[Route("/Track/PushConfig")]
public class TrackPushService : ApplicationService, ITransientDependency
public class TrackPushService : ApplicationService
{
private readonly IStringLocalizer<TrackLocalizationResource> _stringLocalizer;
private readonly ITrackPushConfigRepository _trackPushConfigRepository;
private readonly ITrackTemplateRepository _trackTemplateRepository;
private readonly ITrackPullConfigRepository _trackPullConfigRepository;
private readonly ITrackPushCacheService _trackPushCacheService;
@ -37,7 +34,6 @@ public class TrackPushService : ApplicationService, ITransientDependency
{
_stringLocalizer = stringLocalizer;
_trackPushConfigRepository = trackPushConfigRepository;
_trackTemplateRepository = trackTemplateRepository;
_trackPullConfigRepository = trackPullConfigRepository;
_trackPushCacheService = trackPushCacheService;
}
@ -59,7 +55,8 @@ public class TrackPushService : ApplicationService, ITransientDependency
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("GetContentPage")]
public async Task<UnifyPageResultDto<GetTrackPushContentPageOutputVO>> GetContentPageAsync([FromBody] GetTrackPushContentPageInputVO input)
public async Task<UnifyPageResultDto<GetTrackPushContentPageOutputVO>> GetContentPageAsync(
[FromBody] GetTrackPushContentPageInputVO input)
{
return await _trackPushConfigRepository.GetContentPageAsync(input);
}
@ -97,71 +94,79 @@ public class TrackPushService : ApplicationService, ITransientDependency
if (input.Options != OptionTypeNoNull.删除)
{
Expression<Func<TrackPushConfigEntity, bool>> isAnyExp = x =>
x.SubSystemId == input.SubSystemId && x.CustomId == input.CustomId && x.ServiceProviderId == input.ServiceProviderId;
x.SubSystemId == input.SubSystemId && x.CustomId == input.CustomId &&
x.ServiceProviderId == input.ServiceProviderId;
if (input.Options == OptionTypeNoNull.修改) isAnyExp = isAnyExp.And(x => x.Id != input.Id);
if (await _trackPushConfigRepository.IsAnyAsync(isAnyExp)) throw new BusinessException(message: _stringLocalizer["IsTrackPushConfigAny"]);
if (await _trackPushConfigRepository.IsAnyAsync(isAnyExp))
throw new BusinessException(message: _stringLocalizer["IsTrackPushConfigAny"]);
}
switch (input.Options)
{
case OptionTypeNoNull.新增:
{
var trackPushEntity = ObjectMapper.Map<EditTrackPushConfigInput, TrackPushConfigEntity>(input);
var trackPushParamsEntity =
ObjectMapper.Map<EditTrackPushConfigInput, TrackPushPullParamsConfigEntity>(input);
using (var ts = TransactionScopeHelper.Create())
{
var trackPushEntity = ObjectMapper.Map<EditTrackPushConfigInput, TrackPushConfigEntity>(input);
var trackPushParamsEntity = ObjectMapper.Map<EditTrackPushConfigInput, TrackPushPullParamsConfigEntity>(input);
int id = await _trackPushConfigRepository.InsertReturnIdentityAsync(trackPushEntity);
using (var ts = TransactionScopeHelper.Create())
{
int id = await _trackPushConfigRepository.InsertReturnIdentityAsync(trackPushEntity);
trackPushParamsEntity.PullOrPushConfigId = id;
await _trackPullConfigRepository.InsertParamsAsync(trackPushParamsEntity);
trackPushParamsEntity.PullOrPushConfigId = id;
await _trackPullConfigRepository.InsertParamsAsync(trackPushParamsEntity);
if (input.IsAutoPush!.Value) await _trackPushCacheService.IsPushAsync(input.CustomId!.Value);
if (input.IsAutoPush!.Value) await _trackPushCacheService.IsPushAsync(input.CustomId!.Value);
ts.Complete();
}
ts.Complete();
}
}
break;
case OptionTypeNoNull.修改:
{
var oldTrackPushEntity = await _trackPushConfigRepository.GetFirstAsync(x => x.Id == input.Id) ??
throw new BusinessException(message: _stringLocalizer["NotFindData"]);
int oldCustomId = oldTrackPushEntity.CustomId;
var oldTrackPushParamsEntity =
await _trackPullConfigRepository.GetParamsSingleAsync(x =>
x.PullOrPushConfigId == input.Id && x.IsPush);
ObjectMapper.Map(input, oldTrackPushEntity);
ObjectMapper.Map(input, oldTrackPushParamsEntity);
using (var ts = TransactionScopeHelper.Create())
{
var oldTrackPushEntity = await _trackPushConfigRepository.GetFirstAsync(x => x.Id == input.Id) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]);
await _trackPushConfigRepository.UpdateAsync(oldTrackPushEntity);
await _trackPullConfigRepository.UpdateParamsAsync(oldTrackPushParamsEntity);
int oldCustomId = oldTrackPushEntity.CustomId;
await _trackPushCacheService.UpdateAsync(oldCustomId, false);
if (input.IsAutoPush!.Value) await _trackPushCacheService.IsPushAsync(input.CustomId!.Value);
var oldTrackPushParamsEntity = await _trackPullConfigRepository.GetParamsSingleAsync(x => x.PullOrPushConfigId == input.Id && x.IsPush);
ObjectMapper.Map(input, oldTrackPushEntity);
ObjectMapper.Map(input, oldTrackPushParamsEntity);
using (var ts = TransactionScopeHelper.Create())
{
await _trackPushConfigRepository.UpdateAsync(oldTrackPushEntity);
await _trackPullConfigRepository.UpdateParamsAsync(oldTrackPushParamsEntity);
await _trackPushCacheService.UpdateAsync(oldCustomId, false);
if (input.IsAutoPush!.Value) await _trackPushCacheService.IsPushAsync(input.CustomId!.Value);
ts.Complete();
}
ts.Complete();
}
}
break;
case OptionTypeNoNull.删除:
{
var oldTrackPushEntity = await _trackPushConfigRepository.GetFirstAsync(x => x.Id == input.Id) ??
throw new BusinessException(message: _stringLocalizer["NotFindData"]);
using (var ts = TransactionScopeHelper.Create())
{
var oldTrackPushEntity = await _trackPushConfigRepository.GetFirstAsync(x => x.Id == input.Id) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]);
await _trackPushConfigRepository.SoftDeleteAsync(x => x.Id == input.Id);
await _trackPullConfigRepository.SoftDeleteParamsAsync(x =>
x.PullOrPushConfigId == input.Id && x.IsPush);
await _trackPushConfigRepository.SoftDeleteContentAsync(x => x.TrackPushConfigId == input.Id);
await _trackPushCacheService.UpdateAsync(oldTrackPushEntity.CustomId, false);
using (var ts = TransactionScopeHelper.Create())
{
await _trackPushConfigRepository.SoftDeleteAsync(x => x.Id == input.Id);
await _trackPullConfigRepository.SoftDeleteParamsAsync(x => x.PullOrPushConfigId == input.Id && x.IsPush);
await _trackPushConfigRepository.SoftDeleteContentAsync(x => x.TrackPushConfigId == input.Id);
await _trackPushCacheService.UpdateAsync(oldTrackPushEntity.CustomId, false);
ts.Complete();
}
ts.Complete();
}
}
break;
default:
@ -182,62 +187,76 @@ public class TrackPushService : ApplicationService, ITransientDependency
{
if (input.Options != OptionTypeNoNull.删除)
{
Expression<Func<TrackPushContentConfigEntity, bool>> isContentAnyExp = x => x.TrackPushConfigId == input.TrackPushConfigId;
Expression<Func<TrackPushContentConfigEntity, bool>> isContentAnyExp = x =>
x.TrackPushConfigId == input.TrackPushConfigId;
if (input.Options == OptionTypeNoNull.修改) isContentAnyExp = isContentAnyExp.And(x => x.Id != input.Id);
if (await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackContentId == input.TrackContentId)))
if (await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x =>
x.TrackContentId == input.TrackContentId)))
throw new BusinessException(message: _stringLocalizer["IsTrackPushContentAny"]);
else if (!input.TrackContentCodeValue.IsNullOrWhiteSpace() && await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackContentCodeValue == input.TrackContentCodeValue)))
else if (!input.TrackContentCodeValue.IsNullOrWhiteSpace() &&
await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x =>
x.TrackContentCodeValue == input.TrackContentCodeValue)))
throw new BusinessException(message: _stringLocalizer["IsTrackPushContentCodeValueAny"]);
else if (!input.TrackStatusValue.IsNullOrWhiteSpace() && await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackStatusValue == input.TrackStatusValue)))
else if (!input.TrackStatusValue.IsNullOrWhiteSpace() &&
await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x =>
x.TrackStatusValue == input.TrackStatusValue)))
throw new BusinessException(message: _stringLocalizer["IsTrackPushContentStatusValueAny"]);
else if (!input.TrackContentValue.IsNullOrWhiteSpace() && await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackContentValue == input.TrackContentValue)))
else if (!input.TrackContentValue.IsNullOrWhiteSpace() &&
await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x =>
x.TrackContentValue == input.TrackContentValue)))
throw new BusinessException(message: _stringLocalizer["IsTrackPushContentValueAny"]);
else if (!input.TrackEnContentValue.IsNullOrWhiteSpace() && await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackEnContentValue == input.TrackEnContentValue)))
else if (!input.TrackEnContentValue.IsNullOrWhiteSpace() &&
await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x =>
x.TrackEnContentValue == input.TrackEnContentValue)))
throw new BusinessException(message: _stringLocalizer["IsTrackPushEnContentValueAny"]);
}
switch (input.Options)
{
case OptionTypeNoNull.新增:
{
int maxSort = await _trackPushConfigRepository.ContentMaxAsync(x => x.Sort, x => x.TrackPushConfigId == input.TrackPushConfigId);
{
int maxSort = await _trackPushConfigRepository.ContentMaxAsync(x => x.Sort,
x => x.TrackPushConfigId == input.TrackPushConfigId);
var entity = ObjectMapper.Map<EditTrackPushContentInput, TrackPushContentConfigEntity>(input);
entity.Sort = maxSort + 1;
var entity = ObjectMapper.Map<EditTrackPushContentInput, TrackPushContentConfigEntity>(input);
entity.Sort = maxSort + 1;
await _trackPushConfigRepository.InsertContentAsync(entity);
await _trackPushConfigRepository.InsertContentAsync(entity);
break;
}
break;
}
case OptionTypeNoNull.修改:
{
var entity = await _trackPushConfigRepository.GetContentByIdAsync(input.Id!.Value) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]);
{
var entity = await _trackPushConfigRepository.GetContentByIdAsync(input.Id!.Value) ??
throw new BusinessException(message: _stringLocalizer["NotFindData"]);
ObjectMapper.Map(input, entity);
ObjectMapper.Map(input, entity);
await _trackPushConfigRepository.UpdateContentAsync(entity);
await _trackPushConfigRepository.UpdateContentAsync(entity);
break;
}
break;
}
case OptionTypeNoNull.删除:
{
var entity = await _trackPushConfigRepository.GetContentByIdAsync(input.Id!.Value) ??
throw new BusinessException(message: _stringLocalizer["NotFindData"]);
using (var ts = TransactionScopeHelper.Create())
{
var entity = await _trackPushConfigRepository.GetContentByIdAsync(input.Id!.Value) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]);
await _trackPushConfigRepository.SoftDeleteContentAsync(x => x.Id == input.Id);
using (var ts = TransactionScopeHelper.Create())
{
await _trackPushConfigRepository.SoftDeleteContentAsync(x => x.Id == input.Id);
await _trackPushConfigRepository.UpdateContentAsync(x => x.Sort == x.Sort - 1,
x => x.TrackPushConfigId == entity.TrackPushConfigId && x.Sort > entity.Sort);
await _trackPushConfigRepository.UpdateContentAsync(x => x.Sort == x.Sort - 1, x => x.TrackPushConfigId == entity.TrackPushConfigId && x.Sort > entity.Sort);
ts.Complete();
}
break;
ts.Complete();
}
break;
}
default:
throw new BusinessException(message: _stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum,
nameof(EditTrackPushContentInput.Options)]);

View File

@ -43,10 +43,10 @@ public class OrderEntity : IFullAuditedBasicEntitys, IAggregateRoot
public bool IsCompleted { get; set; }
/// <summary>
/// 订单是否推送完成(异步维护)
/// 最新推送轨迹内容id(异步维护)
/// </summary>
[SugarColumn(ColumnName = "IsPushCompleted")]
public bool IsPushCompleted { get; set; }
[SugarColumn(ColumnName = "LatestPushTrackContentId")]
public int? LatestPushTrackContentId { get; set; }
/// <summary>
/// 最新轨迹内容(异步维护)
@ -112,7 +112,7 @@ public class OrderEntity : IFullAuditedBasicEntitys, IAggregateRoot
/// 问题类型(主数据枚举TrackQuestionType)
/// </summary>
[SugarColumn(ColumnName = "QuestionType")]
public int QuestionType { get; set; }
public int QuestionType { get; set; }
/// <summary>
/// 问题描述(主数据枚举TrackProblemDescription)

View File

@ -46,6 +46,11 @@ public class TrackDetailsIndex : IdBaseIndex
/// </summary>
public string TrackContent { get; set; } = null!;
/// <summary>
/// 轨迹内容Id
/// </summary>
public int TrackContentId { get; set; }
/// <summary>
/// 是否意味着完成
/// </summary>

View File

@ -6,7 +6,7 @@ public class LinkedOrderVO
/// 关联订单id
/// </summary>
public int OrderId { get; set; }
/// <summary>
/// 订单号
/// </summary>
@ -21,12 +21,12 @@ public class LinkedOrderVO
/// 子系统id
/// </summary>
public int SubSystemId { get; set; }
/// <summary>
/// 订单是否推送完成(异步维护)
/// 最新推送轨迹内容id(异步维护)
/// </summary>
public bool IsPushCompleted { get; set; }
public int? LatestPushTrackContentId { get; set; }
/// <summary>
/// 客户id
/// </summary>

View File

@ -2,6 +2,11 @@
public class MatchTrackContentDto
{
/// <summary>
/// 轨迹内容id
/// </summary>
public int Id { get; set; }
/// <summary>
/// 轨迹内容
/// </summary>

View File

@ -0,0 +1,15 @@
namespace SJZY.Track.Domain.Enums;
[Flags]
public enum TrackProblemType
{
/// <summary>
/// 异常
/// </summary>
Error = 1,
/// <summary>
/// 预警
/// </summary>
Warn = 2,
}

View File

@ -37,6 +37,11 @@ public class GlobalConst
/// </summary>
public const string TrackPushKeyPrefix = "TrackPush";
/// <summary>
/// 轨迹推送内容配置redis key前缀
/// </summary>
public const string TrackPushContentKeyPrefix = "TrackPushContent";
/// <summary>
/// 轨迹拉取配置信息redis key前缀
/// </summary>

View File

@ -70,6 +70,7 @@ public class ProvideQueries : ISugarRepository, IProvideQueries,
.Where((x, a, b) => x.OrderId == orderId && b.Code == code)
.Select((x, a, b, c) => new MatchTrackContentDto
{
Id = b.Id,
Content = b.Content,
EnContent = b.EnContent,
Status = c.Status,

View File

@ -67,7 +67,7 @@ public class OrderRepository : BasicRepository<OrderEntity>, IOrderRepository, I
OrderType = b.OrderType,
OrderNo = b.OrderNo,
SubSystemId = b.SubSystemId,
IsPushCompleted = b.IsPushCompleted,
LatestPushTrackContentId = b.LatestPushTrackContentId,
CustomId = b.CustomId
})
.ToListAsync();