From 4a759333ca265cd9e0dacdfce2d00f64d0bff5d9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com>
Date: Wed, 3 Apr 2024 09:13:47 +0800
Subject: [PATCH 01/12] =?UTF-8?q?change=EF=BC=9A=E6=8E=A8=E9=80=81?=
=?UTF-8?q?=E5=BC=82=E5=B8=B8=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../EventHandlers/TrackPushEventHandler.cs | 22 +++++++++++++------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/src/SJZY.Track.Application/EventHandlers/TrackPushEventHandler.cs b/src/SJZY.Track.Application/EventHandlers/TrackPushEventHandler.cs
index e95906da..68ad47d4 100644
--- a/src/SJZY.Track.Application/EventHandlers/TrackPushEventHandler.cs
+++ b/src/SJZY.Track.Application/EventHandlers/TrackPushEventHandler.cs
@@ -39,9 +39,7 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
{
x.SubSystemId, x.LatestPushTrackCode, x.QuestionType, x.CustomId
});
- if (order == null || order.QuestionType == (int)TrackProblemType.Error) return; // 是否通知?
-
- TrackPushContentConfigDto? config;
+ if (order == null) return;
var log = new TrackPushRecordIndex
{
@@ -58,6 +56,8 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
CreateTime = DateTime.Now
};
+ TrackPushContentConfigDto? config = null;
+
switch (@event.OptionType)
{
case OptionType.无:
@@ -65,9 +65,12 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
case OptionType.新增:
if (@event.OperationMan == null)
{
- // 推送新增,需要根据上一次的推送 推断 本次推送 是否可行
- config = await _trackPushCacheService.IsValidPushAsync(order.SubSystemId, order.CustomId,
- order.LatestPushTrackCode, @event.TrackCode);
+ if (order.QuestionType != (int)TrackProblemType.Error)
+ {
+ // 推送新增,需要根据上一次的推送 推断 本次推送 是否可行
+ config = await _trackPushCacheService.IsValidPushAsync(order.SubSystemId, order.CustomId,
+ order.LatestPushTrackCode, @event.TrackCode);
+ }
}
else
{
@@ -132,12 +135,17 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
// tips:只有新增会影响推送进度?
order.LatestPushTrackCode = dto.TrackCode;
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
{
- x.LatestPushTrackCode, x.QuestionType, x.LatestPushError, x.LatestPushTime
+ x.QuestionType, x.LatestPushError
});
}
From 63e4c8b999ee5cbe2a497d14a11f5b78347134cb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com>
Date: Wed, 3 Apr 2024 17:00:30 +0800
Subject: [PATCH 02/12] =?UTF-8?q?fix=EF=BC=9A=E3=80=90=E3=80=90=E4=BF=AE?=
=?UTF-8?q?=E6=94=B9=E8=BD=A8=E8=BF=B9=E5=86=85=E5=AE=B9=E3=80=91=E8=BD=A8?=
=?UTF-8?q?=E8=BF=B9=E6=A0=87=E8=AE=B0=E6=B2=A1=E6=9C=89=E5=80=BC=E6=97=B6?=
=?UTF-8?q?=EF=BC=8C=E6=98=BE=E7=A4=BA=E4=BA=86id=E3=80=91https://www.tapd?=
=?UTF-8?q?.cn/60863849/bugtrace/bugs/view=3Fbug=5Fid=3D116086384900103258?=
=?UTF-8?q?5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Dtos/TrackContents/EditTrackContentInput.cs | 2 +-
.../Services/TrackContents/TrackContentService.cs | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackContents/EditTrackContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/EditTrackContentInput.cs
index d2a829ca..8a99f816 100644
--- a/src/SJZY.Track.Application.Contract/Dtos/TrackContents/EditTrackContentInput.cs
+++ b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/EditTrackContentInput.cs
@@ -88,7 +88,7 @@
///
/// 轨迹标记id
///
- public int TrackFlagId { get; set; }
+ public int? TrackFlagId { get; set; }
///
/// 轨迹标记
diff --git a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs
index 657cc671..9ed8374e 100644
--- a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs
+++ b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs
@@ -59,6 +59,8 @@ public class TrackContentService : ApplicationService
}
var dto = ObjectMapper.Map(detailInfo);
+
+ if (dto.TrackFlagId == 0) dto.TrackFlagId = null;
return new UnifyResultDto("200", "", dto);
}
From 0b8e9da9180dd26848d0375580ca47d054f238ca Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com>
Date: Wed, 3 Apr 2024 17:51:00 +0800
Subject: [PATCH 03/12] =?UTF-8?q?change=EF=BC=9A=E8=BD=A8=E8=BF=B9?=
=?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=AF=B9=E5=A4=96=E9=80=BB=E8=BE=91=E8=B0=83?=
=?UTF-8?q?=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Dtos/ProvideServices/GetTrackOutput.cs | 13 +++--
.../ProvideServices/TrackService.Query.cs | 57 ++++++++++++-------
.../TrackTemplates/ITrackTemplateService.cs | 7 ---
.../Dtos/TrackTemplate/OrderedTrackCodeDto.cs | 5 ++
.../Queries/ProvideQueries.cs | 32 ++++-------
.../Repositories/TrackDetailsRepository.cs | 1 +
6 files changed, 59 insertions(+), 56 deletions(-)
delete mode 100644 src/SJZY.Track.Application/Services/TrackTemplates/ITrackTemplateService.cs
diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackOutput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackOutput.cs
index eda7ecbc..dcafe452 100644
--- a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackOutput.cs
+++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackOutput.cs
@@ -5,17 +5,18 @@ public class GetTrackOutput
///
/// 订单号
///
- public string OrderNo { get; set; }
+ public string OrderNo { get; set; } = null!;
- public List TrackDetails { get; set; }
+ public List TrackDetails { get; set; } = new();
}
public class TrackDetail
{
- public string Code { get; set; }
- public string Status { get; set; }
- public string Content { get; set; }
- public string Location { get; set; }
+ public string Code { get; set; } = null!;
+ public string Status { get; set; } = null!;
+ public string? Content { get; set; }
+ public string? OriginContent { get; set; }
+ public string Location { get; set; } = null!;
public DateTime Time { get; set; }
public float TimeZone { get; set; }
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackService.Query.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackService.Query.cs
index 35237196..3864b604 100644
--- a/src/SJZY.Track.Application/Services/ProvideServices/TrackService.Query.cs
+++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackService.Query.cs
@@ -39,6 +39,7 @@ public partial class TrackService
Code = x.TrackCode,
Status = x.TrackStatus,
Content = x.TrackContent,
+ OriginContent = x.OriginTrackContent,
Location = x.TrackPlace,
Time = x.TrackTime.AddHours(input.TimeZone ?? 8 - x.TrackTimeZone),
TimeZone = input.TimeZone ?? 8
@@ -54,6 +55,29 @@ public partial class TrackService
private async Task TrackDetailSort(List list, GetTrackInput input)
{
+ var orderTemplates = await _provideQueries
+ .GetOrderTemplateLinksAsync(input.OrderType, input.OrderNos);
+ var distinctTemplateIds = orderTemplates.Select(x => x.TemplateId).Distinct().ToList();
+ var templateContent = await _provideQueries.GetOrderedTrackCodesAsync(distinctTemplateIds);
+
+ list.ForEach(item =>
+ {
+ var codes = new List();
+ // 多模板拼接显示
+ foreach (var orderTemplate in orderTemplates.Where(x => x.OrderNo == item.OrderNo))
+ {
+ codes.AddRange(templateContent
+ .Where(t => t.TemplateId == orderTemplate.TemplateId) // 按模板
+ .Where(t => t.IsExternal) // 过滤不对外的
+ .Select(t => t.Code));
+ }
+
+ item.TrackDetails = item.TrackDetails
+ .Where(x => codes.Contains(x.Code)) // 剔除不在模板内容中的元素
+ .OrderBy(x => codes.IndexOf(x.Code)) // 按照在模板内容的位置排序
+ .ToList();
+ });
+
switch (input.SortMethod)
{
case SortMethod.ByTrackTime:
@@ -64,30 +88,21 @@ public partial class TrackService
list.ForEach(item => item.TrackDetails.Sort((a, b) => b.Time.CompareTo(a.Time)));
break;
case SortMethod.ByTemplate:
- var orderTemplates = await _provideQueries
- .GetOrderTemplateLinksAsync(input.OrderType, input.OrderNos);
- var distinctTemplateIds = orderTemplates.Select(x => x.TemplateId).Distinct().ToList();
- var templateContent = await _provideQueries.GetOrderedTrackCodesAsync(distinctTemplateIds);
- list.ForEach(item =>
- {
- var codes = new List();
- // 多模板拼接显示
- foreach (var orderTemplate in orderTemplates.Where(x => x.OrderNo == item.OrderNo))
- {
- codes.AddRange(templateContent
- .Where(t => t.TemplateId == orderTemplate.TemplateId) // 按模板
- .Where(t => t.IsExternal) // 过滤不对外的
- .Select(t => t.Code));
- }
-
- item.TrackDetails = item.TrackDetails
- .Where(x => codes.Contains(x.Code)) // 剔除不在模板内容中的元素
- .OrderBy(x => codes.IndexOf(x.Code)) // 按照在模板内容的位置排序
- .ToList();
- });
break;
default:
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;
+ }
+ });
+ });
}
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/ITrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/ITrackTemplateService.cs
deleted file mode 100644
index f6e29107..00000000
--- a/src/SJZY.Track.Application/Services/TrackTemplates/ITrackTemplateService.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace SJZY.Track.Application.Services.TrackTemplates
-{
- public interface ITrackTemplateService
- {
-
- }
-}
diff --git a/src/SJZY.Track.Domain/Dtos/TrackTemplate/OrderedTrackCodeDto.cs b/src/SJZY.Track.Domain/Dtos/TrackTemplate/OrderedTrackCodeDto.cs
index cb31744d..43805324 100644
--- a/src/SJZY.Track.Domain/Dtos/TrackTemplate/OrderedTrackCodeDto.cs
+++ b/src/SJZY.Track.Domain/Dtos/TrackTemplate/OrderedTrackCodeDto.cs
@@ -16,4 +16,9 @@ public class OrderedTrackCodeDto
/// 是否对外
///
public bool IsExternal { get; set; }
+
+ ///
+ /// 显示原轨迹
+ ///
+ public bool ShowOrigin { get; set; }
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Repository/Queries/ProvideQueries.cs b/src/SJZY.Track.Repository/Queries/ProvideQueries.cs
index cce3c885..7f144688 100644
--- a/src/SJZY.Track.Repository/Queries/ProvideQueries.cs
+++ b/src/SJZY.Track.Repository/Queries/ProvideQueries.cs
@@ -20,20 +20,6 @@ public class ProvideQueries : ISugarRepository, IProvideQueries,
Context = SqlsugarScopeBasic.GetContextSafely("default");
}
- public async Task> GetOrderTemplateLinksAsync(int orderType,
- params string[] orderNumbers)
- {
- return await Context.Queryable()
- .LeftJoin((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> GetOrderTemplateLinksAsync(int orderType, List orderNumbers)
{
return await Context.Queryable()
@@ -49,15 +35,17 @@ public class ProvideQueries : ISugarRepository, IProvideQueries,
public async Task> GetOrderedTrackCodesAsync(List templateIds)
{
- return await Context.Queryable()
- .LeftJoin((a, b) => a.TrackContentId == b.Id)
- .Where(a => templateIds.Contains(a.TrackTemplateId))
- .OrderBy(a => a.Sort)
- .Select((a, b) => new OrderedTrackCodeDto
+ return await Context.Queryable()
+ .LeftJoin((a, b) => a.Id == b.TrackTemplateId)
+ .LeftJoin((a, b, c) => b.TrackContentId == c.Id)
+ .Where(a => templateIds.Contains(a.Id))
+ .OrderBy((a, b) => b.Sort)
+ .Select((a, b, c) => new OrderedTrackCodeDto
{
- TemplateId = a.TrackTemplateId,
- Code = b.Code,
- IsExternal = a.IsExternal
+ TemplateId = a.Id,
+ ShowOrigin = a.ShowOrigin,
+ Code = c.Code,
+ IsExternal = b.IsExternal
})
.ToListAsync();
}
diff --git a/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs
index 1229eec7..03b3c7c9 100644
--- a/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs
+++ b/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs
@@ -85,6 +85,7 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract f.TrackStatus)
.Field(f => f.TrackCode)
.Field(f => f.TrackContent)
+ .Field(f => f.OriginTrackContent)
.Field(f => f.TrackPlace)
.Field(f => f.TrackTime)
.Field(f => f.TrackTimeZone)
From d2de95a8039155fe1b9eff4d59a8cf95e27bac5e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com>
Date: Sun, 7 Apr 2024 20:07:38 +0800
Subject: [PATCH 04/12] =?UTF-8?q?fix=EF=BC=9A=E3=80=90=E3=80=90=E8=BD=A8?=
=?UTF-8?q?=E8=BF=B9=E8=AE=A2=E5=8D=95=E3=80=91=E8=BD=A8=E8=BF=B9=E6=98=8E?=
=?UTF-8?q?=E7=BB=86=EF=BC=88"=E6=9C=8D=E5=8A=A1=E5=95=86=E6=BA=90?=
=?UTF-8?q?=E8=BD=A8=E8=BF=B9=E5=86=85=E5=AE=B9"=E4=B8=8E"=E8=BD=A8?=
=?UTF-8?q?=E8=BF=B9=E5=86=85=E5=AE=B9"=E4=B8=8D=E5=8C=B9=E9=85=8D?=
=?UTF-8?q?=EF=BC=89=E5=B7=B2=E9=85=8D=E7=BD=AE=E6=98=A0=E5=B0=84=E3=80=91?=
=?UTF-8?q?https://www.tapd.cn/60863849/bugtrace/bugs/view=3Fbug=5Fid=3D11?=
=?UTF-8?q?60863849001032624?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Events/TrackUpsertEvent.cs | 10 ++++++++++
.../EventHandlers/TrackRefreshEventHandler.cs | 6 ++++++
.../EventHandlers/TrackUpsertEventHandler.cs | 2 ++
3 files changed, 18 insertions(+)
diff --git a/src/SJZY.Track.Application.Contract/Events/TrackUpsertEvent.cs b/src/SJZY.Track.Application.Contract/Events/TrackUpsertEvent.cs
index 3533f2e6..53e0d856 100644
--- a/src/SJZY.Track.Application.Contract/Events/TrackUpsertEvent.cs
+++ b/src/SJZY.Track.Application.Contract/Events/TrackUpsertEvent.cs
@@ -22,6 +22,16 @@ public class TrackUpsertEvent
///
public string? ServiceProviderName { get; set; }
+ ///
+ /// 原轨迹内容
+ ///
+ public string? OriginTrackContent { get; set; }
+
+ ///
+ /// 原轨迹报文
+ ///
+ public string? OriginTrackData { get; set; }
+
///
/// 表示订单是否完成(只由轨迹刷新配置决定)
/// tips:能够使得IsCompleted为true的点,全局只有一个:轨迹刷新
diff --git a/src/SJZY.Track.Application/EventHandlers/TrackRefreshEventHandler.cs b/src/SJZY.Track.Application/EventHandlers/TrackRefreshEventHandler.cs
index b4bfe207..61431b30 100644
--- a/src/SJZY.Track.Application/EventHandlers/TrackRefreshEventHandler.cs
+++ b/src/SJZY.Track.Application/EventHandlers/TrackRefreshEventHandler.cs
@@ -218,6 +218,7 @@ public class TrackRefreshEventHandler : ITransientDependency, ICapSubscribe
OrderType = context.OrderType,
OrderNo = context.OrderNo,
ServiceProviderName = context.ServiceProviderName,
+ OriginTrackData = JsonConvert.SerializeObject(trackToken),
IsCompleted = matchedContentConfig.IsCompleted,
SubSystemId = context.SubSystemId,
TrackCode = matchedContentConfig.TrackContentCode,
@@ -225,6 +226,11 @@ public class TrackRefreshEventHandler : ITransientDependency, ICapSubscribe
TrackTime = trackTime ?? DateTime.Now,
TrackTimeZone = trackTimeZone ?? matchedContentConfig.TrackTimeZoneValue ?? 8
};
+ if (paramConfig.TrackContentName != null)
+ {
+ trackUpsertEvent.OriginTrackContent = trackToken[paramConfig.TrackContentName]?.Value();
+ }
+
await _capPublisher.PublishAsync(GlobalConst.TrackUpsertSubscribe, trackUpsertEvent);
}
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs b/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs
index 41ce263b..105ef588 100644
--- a/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs
+++ b/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs
@@ -131,6 +131,8 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
TrackTime = @event.TrackTime,
TrackTimeZone = @event.TrackTimeZone,
ServiceProviderName = @event.ServiceProviderName,
+ OriginTrackContent = @event.OriginTrackContent,
+ OriginTrackData = @event.OriginTrackData,
IsCanDelete = false,
CreateUser = @event.OperationMan ?? GlobalConst.SystemUser,
CreateTime = DateTime.Now
From 66d5a5c4d59dee0eaf4175e32eb109f864841226 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com>
Date: Sun, 7 Apr 2024 21:21:21 +0800
Subject: [PATCH 05/12] =?UTF-8?q?fix=EF=BC=9A=E3=80=90=E3=80=90=E8=BD=A8?=
=?UTF-8?q?=E8=BF=B9=E8=AE=A2=E5=8D=95=E3=80=91"=E6=98=AF=E5=90=A6?=
=?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=8E=A8=E9=80=81"=E4=B8=BA=E5=90=A6?=
=?UTF-8?q?=EF=BC=8C=E6=96=B0=E5=A2=9E=E8=BD=A8=E8=BF=B9=E6=98=8E=E7=BB=86?=
=?UTF-8?q?=E5=90=8E=EF=BC=8C=E5=BC=82=E5=B8=B8=E8=87=AA=E5=8A=A8=E6=8E=A8?=
=?UTF-8?q?=E9=80=81=E8=BD=A8=E8=BF=B9=E6=98=8E=E7=BB=86=E3=80=91https://w?=
=?UTF-8?q?ww.tapd.cn/60863849/bugtrace/bugs/view=3Fbug=5Fid=3D11608638490?=
=?UTF-8?q?01032644?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Services/ITrackPushCacheService.cs | 18 +++--
.../TrackPush/TrackPushCacheService.cs | 50 ++++++++------
.../Services/TrackPush/TrackPushService.cs | 65 +++++++++++--------
3 files changed, 76 insertions(+), 57 deletions(-)
diff --git a/src/SJZY.Track.Application.Contract/Services/ITrackPushCacheService.cs b/src/SJZY.Track.Application.Contract/Services/ITrackPushCacheService.cs
index d04c0fa2..8928ae11 100644
--- a/src/SJZY.Track.Application.Contract/Services/ITrackPushCacheService.cs
+++ b/src/SJZY.Track.Application.Contract/Services/ITrackPushCacheService.cs
@@ -12,6 +12,14 @@ public interface ITrackPushCacheService
///
Task?> GetPushContentConfigsAsync(int subSystemId, int customId);
+ ///
+ /// 设置服务商拉取配置缓存
+ ///
+ ///
+ ///
+ ///
+ Task?> SetPushContentConfigsAsync(int subSystemId, int customId);
+
///
/// 获取服务商拉取配置
///
@@ -33,14 +41,4 @@ public interface ITrackPushCacheService
Task IsValidPushAsync(int subSystemId, int customId,
string? latestPushTrackCode,
string? trackCode);
-
- ///
- /// 设置推送配置缓存
- ///
- ///
- /// 子系统id
- /// 客户id
- ///
- Task?> SetPushContentConfigsAsync(int? id = null, int? subSystemId = null,
- int? customId = null);
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/Services/TrackPush/TrackPushCacheService.cs b/src/SJZY.Track.Application/Services/TrackPush/TrackPushCacheService.cs
index 88d6b079..bf365f28 100644
--- a/src/SJZY.Track.Application/Services/TrackPush/TrackPushCacheService.cs
+++ b/src/SJZY.Track.Application/Services/TrackPush/TrackPushCacheService.cs
@@ -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.Services;
using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
@@ -22,11 +21,23 @@ public class TrackPushCacheService : ITrackPushCacheService, ITransientDependenc
public async Task?> GetPushContentConfigsAsync(int subSystemId, int customId)
{
- var data = await RedisHelper.Client.GetAsync>(
- TrackPushContentKey(subSystemId, customId));
+ var exists = await RedisHelper.Client.ExistsAsync(TrackPushContentKey(subSystemId, customId));
+ if (exists)
+ {
+ return await RedisHelper.Client.GetAsync>(
+ TrackPushContentKey(subSystemId, customId));
+ }
- data ??= await SetPushContentConfigsAsync(subSystemId: subSystemId, customId: customId);
+ return await SetPushContentConfigsAsync(subSystemId, customId);
+ }
+ public async Task?> SetPushContentConfigsAsync(int subSystemId, int customId)
+ {
+ // maybe is null
+ var data = await DoGetPushContentConfigsAsync(subSystemId, customId);
+ // ttl 3days
+ await RedisHelper.Client.SetAsync(TrackPushContentKey(subSystemId, customId),
+ data, 3 * 24 * 60 * 60);
return data;
}
@@ -58,23 +69,23 @@ public class TrackPushCacheService : ITrackPushCacheService, ITransientDependenc
return matched != null && matched.TrackCode == trackCode && matched.IsAutoPush ? matched : default;
}
- public async Task?> SetPushContentConfigsAsync(int? id = null,
- int? subSystemId = null,
- int? customId = null)
+ private async Task?> DoGetPushContentConfigsAsync(int subSystemId, int customId)
{
- Expression> exp = x => true;
- if (id.HasValue) exp = x => x.Id == id;
- else if (subSystemId.HasValue && customId.HasValue)
- exp = x => x.SubSystemId == subSystemId && x.CustomId == customId;
-
- var trackPushConfig = await _trackPushConfigRepository.GetFirstAsync(exp, x => new
+ var trackPushConfig = await _trackPushConfigRepository.GetFirstAsync(
+ x => x.SubSystemId == subSystemId && x.CustomId == customId, x => new
+ {
+ x.Id, x.IsAutoPush, x.IsAllPush, x.IsCanDelete, x.IsCanUpdate, x.SubSystemId, x.CustomId
+ });
+ if (trackPushConfig == null)
{
- x.Id, x.IsAutoPush, x.IsAllPush, x.IsCanDelete, x.IsCanUpdate, x.SubSystemId, x.CustomId
- });
- if (trackPushConfig == null) return null;
+ return null;
+ }
var trackPushContentList = await _trackPushConfigRepository.GetContentListAsync(trackPushConfig.Id);
- if (trackPushContentList.Count == 0) return null;
+ if (trackPushContentList.Count == 0)
+ {
+ return null;
+ }
// tips:hot path,auto mapper性能不如原生
var res = trackPushContentList.Select(item => new TrackPushContentConfigDto
@@ -95,9 +106,6 @@ public class TrackPushCacheService : ITrackPushCacheService, ITransientDependenc
ExpandFieldsValue = item.ExpandFieldsValue,
}).ToList();
- await RedisHelper.Client.SetAsync(TrackPushContentKey(trackPushConfig.SubSystemId, trackPushConfig.CustomId),
- res);
-
return res;
}
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs
index 5225e8db..f7d69e1d 100644
--- a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs
+++ b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs
@@ -95,12 +95,17 @@ public class TrackPushService : ApplicationService
throw new BusinessException(message: _stringLocalizer["IsTrackPushConfigAny"]);
}
+ using var ts = TransactionScopeHelper.Create();
+
switch (input.Options)
{
case OptionTypeNoNull.新增:
{
var trackPushEntity = ObjectMapper.Map(input);
+
await _trackPushConfigRepository.InsertReturnIdentityAsync(trackPushEntity);
+ await _trackPushCacheService.SetPushContentConfigsAsync(trackPushEntity.SubSystemId,
+ trackPushEntity.CustomId);
}
break;
@@ -111,21 +116,19 @@ public class TrackPushService : ApplicationService
ObjectMapper.Map(input, oldTrackPushEntity);
await _trackPushConfigRepository.UpdateAsync(oldTrackPushEntity);
-
- if (input.IsAutoPush!.Value) await _trackPushCacheService.SetPushContentConfigsAsync(input.Id);
+ await _trackPushCacheService.SetPushContentConfigsAsync(oldTrackPushEntity.SubSystemId,
+ oldTrackPushEntity.CustomId);
}
break;
case OptionTypeNoNull.删除:
{
- _ = await _trackPushConfigRepository.GetFirstAsync(x => x.Id == input.Id) ??
- throw new BusinessException(message: _stringLocalizer["NotFindData"]);
+ var entity = await _trackPushConfigRepository.GetFirstAsync(x => x.Id == input.Id) ??
+ throw new BusinessException(message: _stringLocalizer["NotFindData"]);
- using var ts = TransactionScopeHelper.Create();
await _trackPushConfigRepository.SoftDeleteAsync(x => x.Id == input.Id);
await _trackPushConfigRepository.SoftDeleteContentAsync(x => x.TrackPushConfigId == input.Id);
-
- ts.Complete();
+ await _trackPushCacheService.SetPushContentConfigsAsync(entity.SubSystemId, entity.CustomId);
}
break;
@@ -134,6 +137,7 @@ public class TrackPushService : ApplicationService
nameof(EditTrackPushConfigInput.Options)]);
}
+ ts.Complete();
return true;
}
@@ -172,6 +176,10 @@ public class TrackPushService : ApplicationService
throw new BusinessException(message: _stringLocalizer["IsTrackPushEnContentValueAny"]);
}
+ var trackPushConfigId = input.TrackPushConfigId;
+
+ using var ts = TransactionScopeHelper.Create();
+
switch (input.Options)
{
case OptionTypeNoNull.新增:
@@ -181,10 +189,7 @@ public class TrackPushService : ApplicationService
var entity = ObjectMapper.Map(input);
entity.Sort = maxSort + 1;
-
await _trackPushConfigRepository.InsertContentAsync(entity);
- await _trackPushCacheService.SetPushContentConfigsAsync(input.TrackPushConfigId);
-
break;
}
@@ -194,10 +199,7 @@ public class TrackPushService : ApplicationService
throw new BusinessException(message: _stringLocalizer["NotFindData"]);
ObjectMapper.Map(input, entity);
-
await _trackPushConfigRepository.UpdateContentAsync(entity);
- await _trackPushCacheService.SetPushContentConfigsAsync(entity.TrackPushConfigId);
-
break;
}
@@ -205,18 +207,10 @@ public class TrackPushService : ApplicationService
{
var entity = await _trackPushConfigRepository.GetContentByIdAsync(input.Id!.Value) ??
throw new BusinessException(message: _stringLocalizer["NotFindData"]);
-
- 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);
-
- ts.Complete();
- }
-
- await _trackPushCacheService.SetPushContentConfigsAsync(entity.TrackPushConfigId);
-
+ trackPushConfigId = entity.TrackPushConfigId;
+ 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);
break;
}
@@ -225,6 +219,14 @@ public class TrackPushService : ApplicationService
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;
}
@@ -247,8 +249,19 @@ public class TrackPushService : ApplicationService
if (trackPushContentEntities.Count > 0)
{
+ using var ts = TransactionScopeHelper.Create();
+
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;
From f229371520ae8a90312974dd79bef48d07128387 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com>
Date: Mon, 8 Apr 2024 14:20:37 +0800
Subject: [PATCH 06/12] =?UTF-8?q?fix=EF=BC=9A=E8=BD=A8=E8=BF=B9=E6=8E=A8?=
=?UTF-8?q?=E9=80=81=E5=85=B7=E8=B1=A1=E5=AE=9E=E4=BD=93?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Dtos/TrackPush/TrackPushInput.cs | 20 +++++++++++
.../EventHandlers/TrackPushEventHandler.cs | 33 ++++++++++---------
2 files changed, 37 insertions(+), 16 deletions(-)
create mode 100644 src/SJZY.Track.Application.Contract/Dtos/TrackPush/TrackPushInput.cs
diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackPush/TrackPushInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackPush/TrackPushInput.cs
new file mode 100644
index 00000000..7875d4da
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/Dtos/TrackPush/TrackPushInput.cs
@@ -0,0 +1,20 @@
+namespace SJZY.Track.Application.Contract.Dtos.TrackPush;
+
+public class TrackPushInput
+{
+ public string OrderNo { get; set; } = null!;
+
+ public List 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; }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/EventHandlers/TrackPushEventHandler.cs b/src/SJZY.Track.Application/EventHandlers/TrackPushEventHandler.cs
index 68ad47d4..9ebea1f6 100644
--- a/src/SJZY.Track.Application/EventHandlers/TrackPushEventHandler.cs
+++ b/src/SJZY.Track.Application/EventHandlers/TrackPushEventHandler.cs
@@ -1,5 +1,5 @@
using DotNetCore.CAP;
-using Newtonsoft.Json.Linq;
+using Newtonsoft.Json;
using SJZY.Expand.ABP.Core.PublicMethords;
using SJZY.InterfaceRelay.Application.Contracts;
using SJZY.Track.Application.Contract.Dtos.TrackPush;
@@ -152,33 +152,33 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
private async Task DoAddAsync(TrackPushEvent @event,
TrackPushContentConfigDto config, TrackPushRecordIndex log)
{
- var track = new
+ var track = new TrackItem
{
// 推真实的发生地和发生时间(时间是计算后的)
- location = @event.TrackPlace,
- date = @event.TrackTime.AddHours(
+ Location = @event.TrackPlace,
+ Date = @event.TrackTime.AddHours(
config.TrackTimeZone ?? @event.TrackTimeZone - @event.TrackTimeZone),
- timeZone = config.TrackTimeZone ?? @event.TrackTimeZone,
- description = config.TrackEnContentValue,
- description_cn = config.TrackContentValue,
- code = config.TrackContentCodeValue,
- status = config.TrackStatusValue,
- extra = config.ExpandFieldsValue
+ TimeZone = config.TrackTimeZone ?? @event.TrackTimeZone,
+ Description = config.TrackEnContentValue,
+ DescriptionCn = config.TrackContentValue,
+ Code = config.TrackContentCodeValue,
+ Status = config.TrackStatusValue,
+ Extra = config.ExpandFieldsValue
};
- JObject body = JObject.FromObject(new
+ var body = new TrackPushInput()
{
- orderNo = @event.OrderNo,
- data = new[] { track }
- });
+ OrderNo = @event.OrderNo,
+ };
+ body.Data.Add(track);
if (config.IsAllPush)
{
var history = await _trackPushRecordsRepository.GetLatestTrackPushRecordAsync(@event.OrderId);
if (history != default)
{
- body = JObject.Parse(history.PushContent);
- ((JArray)body["data"]!).Add(JObject.FromObject(track));
+ body = JsonConvert.DeserializeObject(history.PushContent);
+ body!.Data.Add(track);
}
}
@@ -186,6 +186,7 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
config.ServiceProviderCode, body);
log.PushContent = body.ToJson();
+
log.IsSuccess = res.Code == InterfaceRelayConst.SuccessCode;
log.RequestId = res.RequestId;
log.Message = res.Msg;
From 5a6b2a0f5d9535500a42466de2cab91b27efc435 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com>
Date: Mon, 8 Apr 2024 18:42:51 +0800
Subject: [PATCH 07/12] =?UTF-8?q?change=EF=BC=9A=E5=8F=AA=E6=9C=89?=
=?UTF-8?q?=E8=BD=A8=E8=BF=B9=E5=A2=9E=E5=88=A0=E6=94=B9=E5=81=9A=E5=B9=82?=
=?UTF-8?q?=E7=AD=89?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/SJZY.Track.Application/EventHandlers/CAPFilter.cs | 5 +++--
.../EventHandlers/OrderLinkAfterFillTrackHandler.cs | 6 +-----
.../Services/ProvideServices/TrackPullService.cs | 2 +-
3 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/src/SJZY.Track.Application/EventHandlers/CAPFilter.cs b/src/SJZY.Track.Application/EventHandlers/CAPFilter.cs
index d6186324..06bdeca3 100644
--- a/src/SJZY.Track.Application/EventHandlers/CAPFilter.cs
+++ b/src/SJZY.Track.Application/EventHandlers/CAPFilter.cs
@@ -20,8 +20,9 @@ public class CapFilter : SubscribeFilter
{
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;
// 本地调试不做幂等
diff --git a/src/SJZY.Track.Application/EventHandlers/OrderLinkAfterFillTrackHandler.cs b/src/SJZY.Track.Application/EventHandlers/OrderLinkAfterFillTrackHandler.cs
index 2d8a0ef5..37daa472 100644
--- a/src/SJZY.Track.Application/EventHandlers/OrderLinkAfterFillTrackHandler.cs
+++ b/src/SJZY.Track.Application/EventHandlers/OrderLinkAfterFillTrackHandler.cs
@@ -1,6 +1,5 @@
using DotNetCore.CAP;
using SJZY.Track.Application.Contract.Events;
-using SJZY.Track.Domain.Aggregates.OrderAggregate;
using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
using SJZY.Track.Domain.Consts;
using Volo.Abp.DependencyInjection;
@@ -11,14 +10,11 @@ public class OrderLinkAfterFillTrackHandler : ITransientDependency, ICapSubscrib
{
private readonly ITrackDetailsRepository _trackDetailsRepository;
private readonly ICapPublisher _capPublisher;
- private readonly IOrderRepository _orderRepository;
- public OrderLinkAfterFillTrackHandler(ITrackDetailsRepository trackDetailsRepository, ICapPublisher capPublisher,
- IOrderRepository orderRepository)
+ public OrderLinkAfterFillTrackHandler(ITrackDetailsRepository trackDetailsRepository, ICapPublisher capPublisher)
{
_trackDetailsRepository = trackDetailsRepository;
_capPublisher = capPublisher;
- _orderRepository = orderRepository;
}
[CapSubscribe(GlobalConst.OrderLinkAfterFillTrack)]
diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackPullService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackPullService.cs
index d7b0bc94..7cf315b2 100644
--- a/src/SJZY.Track.Application/Services/ProvideServices/TrackPullService.cs
+++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackPullService.cs
@@ -64,7 +64,7 @@ public class TrackPullService : ApplicationService
var attach = Base64Helper.SerializeObject(group.Key);
// 批量获取轨迹
- await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync(
+ var _ = await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync(
"A012", serviceProviderCode, data, GlobalConst.TrackRefreshSubscribe, attach);
}
From c5212f53f0f7d9bc65f5a9c92ab3426a29a13816 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com>
Date: Mon, 8 Apr 2024 19:11:24 +0800
Subject: [PATCH 08/12] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E6=8E=A5=E5=8F=A3?=
=?UTF-8?q?=E9=80=9Av7.1.9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/SJZY.Track.Application/SJZY.Track.Application.csproj | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/SJZY.Track.Application/SJZY.Track.Application.csproj b/src/SJZY.Track.Application/SJZY.Track.Application.csproj
index 172e83f5..99912fb3 100644
--- a/src/SJZY.Track.Application/SJZY.Track.Application.csproj
+++ b/src/SJZY.Track.Application/SJZY.Track.Application.csproj
@@ -12,7 +12,7 @@
-
+
From 4fbbbd0566546255d0fc1a831aef63afe5194531 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com>
Date: Mon, 8 Apr 2024 19:37:35 +0800
Subject: [PATCH 09/12] =?UTF-8?q?fix=EF=BC=9A=E3=80=90=E3=80=90=E8=BD=A8?=
=?UTF-8?q?=E8=BF=B9=E8=AE=A2=E5=8D=95-=E6=8E=A8=E9=80=81=E8=AE=B0?=
=?UTF-8?q?=E5=BD=95=E3=80=91=E8=BD=A8=E8=BF=B9=E5=8F=91=E7=94=9F=E6=97=B6?=
=?UTF-8?q?=E5=8C=BA=E9=9C=80=E8=B0=83=E6=95=B4=E4=B8=BA=E6=A0=BC=E6=9E=97?=
=?UTF-8?q?=E5=B0=BC=E6=B2=BB=E6=A0=87=E5=87=86=E6=97=B6=E9=97=B4=EF=BC=88?=
=?UTF-8?q?GTM=EF=BC=89=E3=80=91https://www.tapd.cn/60863849/bugtrace/bugs?=
=?UTF-8?q?/view=3Fbug=5Fid=3D1160863849001032649?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Dtos/TrackOrder/TrackPushRecordOutput.cs | 75 +++++++++++++++++++
.../AutoMapper/OrderAutoMapperProfile.cs | 4 +
.../Services/TrackOrders/TrackOrderService.cs | 16 +++-
3 files changed, 93 insertions(+), 2 deletions(-)
create mode 100644 src/SJZY.Track.Application.Contract/Dtos/TrackOrder/TrackPushRecordOutput.cs
diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackOrder/TrackPushRecordOutput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackOrder/TrackPushRecordOutput.cs
new file mode 100644
index 00000000..bc136ca0
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/Dtos/TrackOrder/TrackPushRecordOutput.cs
@@ -0,0 +1,75 @@
+namespace SJZY.Track.Application.Contract.Dtos.TrackOrder;
+
+public class TrackPushRecordOutput
+{
+ ///
+ /// 订单Id
+ ///
+ public int OrderId { get; set; }
+
+ ///
+ /// 接口通请求Id
+ ///
+ public Guid RequestId { get; set; }
+
+ ///
+ /// 信息
+ ///
+ public string Message { get; set; } = null!;
+
+ ///
+ /// 操作类型
+ ///
+ public string OptionType { get; set; } = null!;
+
+ ///
+ /// 轨迹状态
+ ///
+ public string TrackStatus { get; set; } = null!;
+
+ ///
+ /// 轨迹内容代码
+ ///
+ public string TrackCode { get; set; } = null!;
+
+ ///
+ /// 轨迹内容
+ ///
+ public string TrackContent { get; set; } = null!;
+
+ ///
+ /// 轨迹发生地
+ ///
+ public string TrackPlace { get; set; } = null!;
+
+ ///
+ /// 轨迹发生时间
+ ///
+ public DateTime TrackTime { get; set; }
+
+ ///
+ /// 轨迹发生时区
+ ///
+ public float TrackTimeZone { get; set; }
+
+ ///
+ /// 轨迹发生时区
+ ///
+ public string TrackGTMTimeZone { get; set; } = null!;
+
+ ///
+ /// 是否成功
+ ///
+ public bool IsSuccess { get; set; }
+
+ ///
+ /// 推送内容(json)
+ ///
+ public string PushContent { get; set; } = null!;
+
+ /// 创建人
+ public string? CreateUser { get; set; }
+
+ /// 创建时间
+ public DateTime CreateTime { get; set; }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs
index 8befae94..dbe6b8f6 100644
--- a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs
+++ b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs
@@ -1,8 +1,10 @@
using AutoMapper;
using SJZY.Expand.ABP.Core.PublicMethords;
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.TrackDetailsAggregate;
+using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
using SJZY.Track.Domain.Dtos.Order;
using SJZY.Track.Domain.Enums;
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.EnContent, opt => opt.MapFrom(m => m.TrackEnContent))
.ForMember(dest => dest.TrackTimeZoneValue, opt => opt.MapFrom(m => m.TrackTimeZone));
+
+ CreateMap(MemberList.None);
}
///
diff --git a/src/SJZY.Track.Application/Services/TrackOrders/TrackOrderService.cs b/src/SJZY.Track.Application/Services/TrackOrders/TrackOrderService.cs
index 5f3c1179..477456cb 100644
--- a/src/SJZY.Track.Application/Services/TrackOrders/TrackOrderService.cs
+++ b/src/SJZY.Track.Application/Services/TrackOrders/TrackOrderService.cs
@@ -160,8 +160,20 @@ public class TrackOrderService : ApplicationService
///
/// 订单id
[HttpGet("GetTrackPushRecords")]
- public async Task> GetTrackPushRecordsAsync(int orderId)
+ public async Task> GetTrackPushRecordsAsync(int orderId)
{
- return await _trackPushRecordsRepository.GetTrackPushRecordsAsync(orderId);
+ var records = await _trackPushRecordsRepository.GetTrackPushRecordsAsync(orderId);
+
+ var res = ObjectMapper.Map, List>(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;
}
}
\ No newline at end of file
From d7cfd153b259b2cc07dac80a2d93a592125a0676 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com>
Date: Tue, 9 Apr 2024 14:33:40 +0800
Subject: [PATCH 10/12] =?UTF-8?q?opt=EF=BC=9A=E4=BC=98=E5=8C=96null=20?=
=?UTF-8?q?=E7=BC=93=E5=AD=985s?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Services/TrackPush/TrackPushCacheService.cs | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/SJZY.Track.Application/Services/TrackPush/TrackPushCacheService.cs b/src/SJZY.Track.Application/Services/TrackPush/TrackPushCacheService.cs
index bf365f28..eb4c2504 100644
--- a/src/SJZY.Track.Application/Services/TrackPush/TrackPushCacheService.cs
+++ b/src/SJZY.Track.Application/Services/TrackPush/TrackPushCacheService.cs
@@ -35,9 +35,11 @@ public class TrackPushCacheService : ITrackPushCacheService, ITransientDependenc
{
// 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, 3 * 24 * 60 * 60);
+ data, ttl);
return data;
}
From 9ddba4f5619c4ca2ac3b7647e99713a6ddeecfc4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com>
Date: Tue, 9 Apr 2024 14:38:26 +0800
Subject: [PATCH 11/12] =?UTF-8?q?fix=EF=BC=9A=E6=89=8B=E5=8A=A8=20?=
=?UTF-8?q?=E5=85=A8=E9=87=8F=20=E6=8E=A8=E9=80=81=20=E6=A0=A1=E9=AA=8Cbug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../EventHandlers/TrackPushEventHandler.cs | 4 ++++
.../Services/TrackPush/TrackPushCacheService.cs | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/SJZY.Track.Application/EventHandlers/TrackPushEventHandler.cs b/src/SJZY.Track.Application/EventHandlers/TrackPushEventHandler.cs
index 9ebea1f6..a9a207e9 100644
--- a/src/SJZY.Track.Application/EventHandlers/TrackPushEventHandler.cs
+++ b/src/SJZY.Track.Application/EventHandlers/TrackPushEventHandler.cs
@@ -70,6 +70,10 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
// 推送新增,需要根据上一次的推送 推断 本次推送 是否可行
config = await _trackPushCacheService.IsValidPushAsync(order.SubSystemId, order.CustomId,
order.LatestPushTrackCode, @event.TrackCode);
+ if (config is not { IsAutoPush: true })
+ {
+ config = null;
+ }
}
}
else
diff --git a/src/SJZY.Track.Application/Services/TrackPush/TrackPushCacheService.cs b/src/SJZY.Track.Application/Services/TrackPush/TrackPushCacheService.cs
index eb4c2504..e5d413f4 100644
--- a/src/SJZY.Track.Application/Services/TrackPush/TrackPushCacheService.cs
+++ b/src/SJZY.Track.Application/Services/TrackPush/TrackPushCacheService.cs
@@ -68,7 +68,7 @@ public class TrackPushCacheService : ITrackPushCacheService, ITransientDependenc
// find swap
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;
}
private async Task?> DoGetPushContentConfigsAsync(int subSystemId, int customId)
From f1a48cc9a60c269add9c2f459c5988559fc4d12f Mon Sep 17 00:00:00 2001
From: moyongzhen <2534173414@qq.com>
Date: Wed, 10 Apr 2024 15:04:30 +0800
Subject: [PATCH 12/12] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E8=BD=A8=E8=BF=B9=20?=
=?UTF-8?q?=E8=BF=94=E5=9B=9E=E5=8F=82=E6=95=B0=E8=B0=83=E6=95=B4=E6=88=90?=
=?UTF-8?q?UnifyResultDto?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/SJZY.Track.Application.Contract/Services/ITrackService.cs | 2 +-
.../Services/ProvideServices/TrackService.Query.cs | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/SJZY.Track.Application.Contract/Services/ITrackService.cs b/src/SJZY.Track.Application.Contract/Services/ITrackService.cs
index 31dae617..904f834d 100644
--- a/src/SJZY.Track.Application.Contract/Services/ITrackService.cs
+++ b/src/SJZY.Track.Application.Contract/Services/ITrackService.cs
@@ -31,5 +31,5 @@ public interface ITrackService : IRemoteService
///
///
///
- Task> QueryAsync(GetTrackInput input);
+ Task QueryAsync(GetTrackInput input);
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackService.Query.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackService.Query.cs
index 3864b604..74f4e52f 100644
--- a/src/SJZY.Track.Application/Services/ProvideServices/TrackService.Query.cs
+++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackService.Query.cs
@@ -17,7 +17,7 @@ public partial class TrackService
///
///
[HttpPost("Track/Query")]
- public async Task> QueryAsync(GetTrackInput input)
+ public async Task QueryAsync(GetTrackInput input)
{
if (input.OrderNos.Count > 500)
{
@@ -50,7 +50,7 @@ public partial class TrackService
await TrackDetailSort(res, input);
- return res;
+ return new UnifyResultDto(true, res, "操作成功");
}
private async Task TrackDetailSort(List list, GetTrackInput input)