feat: 轨迹映射界面的推送配置增加推送时间格式
This commit is contained in:
parent
f42287a7f8
commit
d67c7ce820
@ -1,4 +1,6 @@
|
|||||||
namespace SJZY.Track.Application.Contract.Dtos.TrackPush;
|
using SJZY.Track.Domain.Enums;
|
||||||
|
|
||||||
|
namespace SJZY.Track.Application.Contract.Dtos.TrackPush;
|
||||||
|
|
||||||
public class EditTrackPushConfigInput
|
public class EditTrackPushConfigInput
|
||||||
{
|
{
|
||||||
@ -48,4 +50,19 @@ public class EditTrackPushConfigInput
|
|||||||
/// 是否全量推送
|
/// 是否全量推送
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool? IsAllPush { get; set; }
|
public bool? IsAllPush { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 时间格式枚举
|
||||||
|
/// </summary>
|
||||||
|
public DateTimeFormatEnum DateTimeFormatType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 日期时间格式模板
|
||||||
|
/// </summary>
|
||||||
|
public string? DateTimeFormat { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 时区格式格式模板
|
||||||
|
/// </summary>
|
||||||
|
public string? TimezoneFormat { get; set; }
|
||||||
}
|
}
|
||||||
@ -1,4 +1,6 @@
|
|||||||
namespace SJZY.Track.Application.Contract.Dtos.TrackPush;
|
using SJZY.Track.Domain.Enums;
|
||||||
|
|
||||||
|
namespace SJZY.Track.Application.Contract.Dtos.TrackPush;
|
||||||
|
|
||||||
public class TrackPushContentConfigDto
|
public class TrackPushContentConfigDto
|
||||||
{
|
{
|
||||||
@ -71,4 +73,20 @@ public class TrackPushContentConfigDto
|
|||||||
/// 扩展字段参数值
|
/// 扩展字段参数值
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? ExpandFieldsValue { get; set; }
|
public string? ExpandFieldsValue { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 时间格式枚举
|
||||||
|
/// </summary>
|
||||||
|
public DateTimeFormatEnum DateTimeFormatType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 日期时间格式模板
|
||||||
|
/// </summary>
|
||||||
|
public string? DateTimeFormat { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 时区格式格式模板
|
||||||
|
/// </summary>
|
||||||
|
public string? TimezoneFormat { get; set; }
|
||||||
}
|
}
|
||||||
@ -87,6 +87,8 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
if (!config.IsAutoPush) continue;
|
if (!config.IsAutoPush) continue;
|
||||||
if (config.OrderType != order.OrderType) continue;
|
if (config.OrderType != order.OrderType) continue;
|
||||||
|
|
||||||
|
// todo 确认是不是这里转换
|
||||||
|
DateTimeFormat( @event.SystemPushInfo.TrackTime,"yyyy-MM-dd HH:mm:ss");
|
||||||
var log = new TrackPushRecordIndex
|
var log = new TrackPushRecordIndex
|
||||||
{
|
{
|
||||||
OptionType = @event.OptionType.ToString(),
|
OptionType = @event.OptionType.ToString(),
|
||||||
@ -160,6 +162,12 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private string DateTimeFormat(DateTime dateTime,string format)
|
||||||
|
{
|
||||||
|
return dateTime.ToString("yyyy-MM-dd HH:mm:ss");
|
||||||
|
}
|
||||||
|
|
||||||
private async Task DoUpdateAsync(TrackPushEvent @event)
|
private async Task DoUpdateAsync(TrackPushEvent @event)
|
||||||
{
|
{
|
||||||
var config = _pushConfigs.FirstOrDefault(x => x.TrackCode == @event.TrackCode);
|
var config = _pushConfigs.FirstOrDefault(x => x.TrackCode == @event.TrackCode);
|
||||||
@ -250,6 +258,7 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
|
|
||||||
if (config.IsAllPush)
|
if (config.IsAllPush)
|
||||||
{
|
{
|
||||||
|
//todo 这个是指每次都带上之前的轨迹嘛
|
||||||
var history = await _trackPushRecordsRepository.GetLatestTrackPushRecordAsync(log.OrderId);
|
var history = await _trackPushRecordsRepository.GetLatestTrackPushRecordAsync(log.OrderId);
|
||||||
if (history != default)
|
if (history != default)
|
||||||
{
|
{
|
||||||
|
|||||||
36
src/SJZY.Track.Application/Helpers/DateTimeHelper.cs
Normal file
36
src/SJZY.Track.Application/Helpers/DateTimeHelper.cs
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
namespace SJZY.Track.Application.Helpers;
|
||||||
|
|
||||||
|
public static class DateTimeHelper
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Generates a Unix timestamp from a DateTime object.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dateTime">The DateTime object to convert to a Unix timestamp.</param>
|
||||||
|
/// <returns>The Unix timestamp as a long.</returns>
|
||||||
|
public static long GenerateUnixTimestamp(DateTime dateTime)
|
||||||
|
{
|
||||||
|
return new DateTimeOffset(dateTime).ToUnixTimeSeconds();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Formats a DateTime object into a specified format.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dateTime">The DateTime object to format.</param>
|
||||||
|
/// <param name="format">The format string.</param>
|
||||||
|
/// <returns>The formatted date string.</returns>
|
||||||
|
public static string FormatDateTime(DateTime dateTime, string format)
|
||||||
|
{
|
||||||
|
return dateTime.ToString(format);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 时区格式化
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="timezone"></param>
|
||||||
|
/// <param name="format"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string TimezoneFormat(float timezone, string format)
|
||||||
|
{
|
||||||
|
return string.Format(format, timezone);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -48,7 +48,7 @@ public class TrackPushCacheService : ITrackPushCacheService, ITransientDependenc
|
|||||||
var trackPushConfig = await _trackPushConfigRepository.GetFirstAsync(
|
var trackPushConfig = await _trackPushConfigRepository.GetFirstAsync(
|
||||||
x => x.SubSystemId == subSystemId && x.CustomId == customId, x => new
|
x => x.SubSystemId == subSystemId && x.CustomId == customId, 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,x.DateTimeFormatType,x.DateTimeFormat,x.TimezoneFormat
|
||||||
});
|
});
|
||||||
if (trackPushConfig == null)
|
if (trackPushConfig == null)
|
||||||
{
|
{
|
||||||
@ -68,6 +68,9 @@ public class TrackPushCacheService : ITrackPushCacheService, ITransientDependenc
|
|||||||
IsCanUpdate = trackPushConfig.IsCanUpdate,
|
IsCanUpdate = trackPushConfig.IsCanUpdate,
|
||||||
IsAllPush = trackPushConfig.IsAllPush,
|
IsAllPush = trackPushConfig.IsAllPush,
|
||||||
IsCanDelete = trackPushConfig.IsCanDelete,
|
IsCanDelete = trackPushConfig.IsCanDelete,
|
||||||
|
DateTimeFormatType = trackPushConfig.DateTimeFormatType,
|
||||||
|
DateTimeFormat = trackPushConfig.DateTimeFormat,
|
||||||
|
TimezoneFormat = trackPushConfig.TimezoneFormat,
|
||||||
ServiceProviderCode = item.ServiceProviderCode,
|
ServiceProviderCode = item.ServiceProviderCode,
|
||||||
OrderType = item.OrderType,
|
OrderType = item.OrderType,
|
||||||
TrackCode = item.TrackCode,
|
TrackCode = item.TrackCode,
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
namespace SJZY.Track.Domain.Aggregates.TrackPushAggregate;
|
using SJZY.Track.Domain.Enums;
|
||||||
|
|
||||||
|
namespace SJZY.Track.Domain.Aggregates.TrackPushAggregate;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹推送配置表
|
/// 轨迹推送配置表
|
||||||
@ -53,4 +55,22 @@ public class TrackPushConfigEntity : IFullAuditedBasicEntitys, IAggregateRoot
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnName = "IsAllPush")]
|
[SugarColumn(ColumnName = "IsAllPush")]
|
||||||
public bool IsAllPush { get; set; }
|
public bool IsAllPush { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 日期时间格式类型
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "DateTimeFormatType")]
|
||||||
|
public DateTimeFormatEnum DateTimeFormatType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 日期时间格式模板
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "DateTimeFormat")]
|
||||||
|
public string? DateTimeFormat { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 时区格式格式模板
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "TimezoneFormat")]
|
||||||
|
public string? TimezoneFormat { get; set; }
|
||||||
}
|
}
|
||||||
17
src/SJZY.Track.Domain/Enums/DateTimeFormatEnum.cs
Normal file
17
src/SJZY.Track.Domain/Enums/DateTimeFormatEnum.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
namespace SJZY.Track.Domain.Enums;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 时间样式枚举
|
||||||
|
/// </summary>
|
||||||
|
public enum DateTimeFormatEnum
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 时间戳
|
||||||
|
/// </summary>
|
||||||
|
Timestamp=1,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 时间加时区
|
||||||
|
/// </summary>
|
||||||
|
DateTimeAndTimezone =2
|
||||||
|
}
|
||||||
37
src/SJZY.Track.Domain/Enums/TimezoneSourceEnum.cs
Normal file
37
src/SJZY.Track.Domain/Enums/TimezoneSourceEnum.cs
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
namespace SJZY.Track.Domain.Enums;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 推送轨迹时区来源
|
||||||
|
/// </summary>
|
||||||
|
public enum TimezoneSourceEnum
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 起运城市
|
||||||
|
/// </summary>
|
||||||
|
DeliverCity = 1,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 接收城市
|
||||||
|
/// </summary>
|
||||||
|
ReceiveCity = 2,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 起运港口
|
||||||
|
/// </summary>
|
||||||
|
DeliverPort = 3,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 接收港口
|
||||||
|
/// </summary>
|
||||||
|
ReceivePort = 4,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 起运国家
|
||||||
|
/// </summary>
|
||||||
|
DeliverCountry = 5,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 接收国家
|
||||||
|
/// </summary>
|
||||||
|
ReceiveCountry = 6
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user