From 926adfcd5df14c3c3ba936bcb26c51a7dbf6aea5 Mon Sep 17 00:00:00 2001
From: xiaolipro <2357729423@qq.com>
Date: Tue, 3 Sep 2024 14:43:33 +0800
Subject: [PATCH] =?UTF-8?q?remove=EF=BC=9A=E5=8E=BB=E9=99=A4=E9=80=9A?=
=?UTF-8?q?=E7=9F=A5=E6=A8=A1=E7=89=88?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/SJZY.Track.Api/appsettings.json | 4 +--
.../Dtos/ProvideServices/OrderNoInfo.cs | 3 +++
.../Dtos/ProvideServices/UpdateOrderInput.cs | 5 ----
.../Events/OrderIdentifier.cs | 11 ++++++++
.../EventHandlers/TrackUpsertEventHandler.cs | 2 +-
.../Helpers/ForewarningHelper.cs | 2 --
.../ForewarningServices/ForewarningService.cs | 1 -
.../Services/ProvideServices/OrderService.cs | 10 +++----
.../WarningNotifyEntity.cs | 6 -----
.../OrderAggregate/IOrderRepository.cs | 6 -----
.../Aggregates/OrderAggregate/OrderEntity.cs | 1 -
.../Queries/WarningQueries.cs | 1 -
.../Repositories/OrderRepository.cs | 26 +++----------------
.../Repositories/WarningRepository.cs | 1 -
14 files changed, 25 insertions(+), 54 deletions(-)
diff --git a/src/SJZY.Track.Api/appsettings.json b/src/SJZY.Track.Api/appsettings.json
index 90870b4f..ac8a5882 100644
--- a/src/SJZY.Track.Api/appsettings.json
+++ b/src/SJZY.Track.Api/appsettings.json
@@ -7,7 +7,7 @@
"Apollo": {
"AppId": "SJZY.Track.Configuration",
"Env": "DEV",
- "Namespace": "Test",
+ "Namespace": "dev",
"MetaServer": "http://apollo-service-test-apollo-configservice.apollo.svc.cluster.local:8080",
"ConfigServer": [
"http://apollo-service-test-apollo-configservice.apollo.svc.cluster.local:8080"
@@ -21,4 +21,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/OrderNoInfo.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/OrderNoInfo.cs
index 933239a4..7418c745 100644
--- a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/OrderNoInfo.cs
+++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/OrderNoInfo.cs
@@ -2,6 +2,9 @@ using System.ComponentModel.DataAnnotations;
namespace SJZY.Track.Application.Contract.Dtos.ProvideServices;
+///
+/// 子系统id+订单类型+订单号 确定唯一订单
+///
public class OrderNoInfo
{
///
diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpdateOrderInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpdateOrderInput.cs
index edb94a8c..17a9a838 100644
--- a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpdateOrderInput.cs
+++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpdateOrderInput.cs
@@ -42,11 +42,6 @@ public class UpdateOrderInput : OrderNoInfo
[MaxLength(200)]
public string LeaveCity { get; set; } = null!;
- ///
- /// 订单模板(传全量)
- ///
- public List Templates { get; set; } = new();
-
///
/// 订单航班信息
///
diff --git a/src/SJZY.Track.Application.Contract/Events/OrderIdentifier.cs b/src/SJZY.Track.Application.Contract/Events/OrderIdentifier.cs
index 96b412cf..09bccd14 100644
--- a/src/SJZY.Track.Application.Contract/Events/OrderIdentifier.cs
+++ b/src/SJZY.Track.Application.Contract/Events/OrderIdentifier.cs
@@ -2,7 +2,18 @@ namespace SJZY.Track.Application.Contract.Events;
public struct OrderIdentifier
{
+ ///
+ /// 订单id
+ ///
public int OrderId { get; set; }
+
+ ///
+ /// 订单号
+ ///
public string OrderNo { get; set; }
+
+ ///
+ /// 订单类型
+ ///
public int OrderType { get; set; }
}
diff --git a/src/SJZY.Track.Application/CAP/EventHandlers/TrackUpsertEventHandler.cs b/src/SJZY.Track.Application/CAP/EventHandlers/TrackUpsertEventHandler.cs
index afe662ff..dc157801 100644
--- a/src/SJZY.Track.Application/CAP/EventHandlers/TrackUpsertEventHandler.cs
+++ b/src/SJZY.Track.Application/CAP/EventHandlers/TrackUpsertEventHandler.cs
@@ -52,7 +52,7 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
.GroupBy(x => new
{
x.SubSystemId,
- x.CustomId
+ x.CustomId // 这里按客户分组是为了后续的推送方便
}))
{
var nextEvent = @event.DeepCopy();
diff --git a/src/SJZY.Track.Application/Helpers/ForewarningHelper.cs b/src/SJZY.Track.Application/Helpers/ForewarningHelper.cs
index 792f0112..835c9a32 100644
--- a/src/SJZY.Track.Application/Helpers/ForewarningHelper.cs
+++ b/src/SJZY.Track.Application/Helpers/ForewarningHelper.cs
@@ -159,7 +159,6 @@ public class ForewarningHelper
StartTrackStatusId = x.StartTrackStatusId,
EndTrackStatusId = x.EndTrackStatusId,
NotifyMode = input.NotifyMode,
- NotifyTemplate = input.NotifyTemplate,
NotifyUserId = x.NotifyUserId
}).ToList();
}
@@ -173,7 +172,6 @@ public class ForewarningHelper
SubSystemId = warning.SubSystemId,
CustomerId = warning.CustomerId,
NotifyMode = warning.WarningNotifies.First().NotifyMode,
- NotifyTemplate = warning.WarningNotifies.First().NotifyTemplate,
TrackStatusSpans = warning.WarningNotifies.Select(x => new WarningNotifyWithIdDto
{
Id = x.Id,
diff --git a/src/SJZY.Track.Application/Services/ForewarningServices/ForewarningService.cs b/src/SJZY.Track.Application/Services/ForewarningServices/ForewarningService.cs
index ba1842cf..05c49b65 100644
--- a/src/SJZY.Track.Application/Services/ForewarningServices/ForewarningService.cs
+++ b/src/SJZY.Track.Application/Services/ForewarningServices/ForewarningService.cs
@@ -113,7 +113,6 @@ public class ForewarningService : ApplicationService
{
Id = x.Id,
NotifyMode = input.NotifyMode,
- NotifyTemplate = input.NotifyTemplate,
NotifyUserId = x.NotifyUserId
}).ToList();
diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs
index 9e002b1c..7818fd9e 100644
--- a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs
+++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs
@@ -34,9 +34,11 @@ public partial class OrderService : ApplicationService, IOrderService
[HttpPost("Order/Upsert")]
public async Task UpsertAsync(UpsertOrderInput input)
{
- if (input.Templates.Count == 0) throw new BusinessException(message: "至少有一个模板");
+ var subSystemId = CurrentUserRequest.SubSystemId;
+
+ // 校验订单是否已存在,存在则更新
var order = await _orderRepository.GetFirstAsync(x =>
- x.OrderType == input.OrderType && x.OrderNo == input.OrderNo);
+ x.SubSystemId == subSystemId && x.OrderType == input.OrderType && x.OrderNo == input.OrderNo);
if (order != default)
{
// 订单已存在则视为更新
@@ -51,8 +53,7 @@ public partial class OrderService : ApplicationService, IOrderService
}
order = ObjectMapper.Map(input);
- order.SubSystemId = CurrentUserRequest.SubSystemId;
- order.OrderTemplates = ObjectMapper.Map, List>(input.Templates);
+ order.SubSystemId = subSystemId;
order.OrderFlights = ObjectMapper.Map, List>(input.FlightInfos);
await _orderRepository.CreateOrderAsync(order);
@@ -88,7 +89,6 @@ public partial class OrderService : ApplicationService, IOrderService
private async Task UpdateOrderAsync(UpdateOrderInput input, OrderEntity order)
{
order = ObjectMapper.Map(input, order);
- order.OrderTemplates = ObjectMapper.Map, List>(input.Templates);
order.OrderFlights = ObjectMapper.Map, List>(input.FlightInfos);
await _orderRepository.UpdateOrderAsync(order);
}
diff --git a/src/SJZY.Track.Domain/Aggregates/ForewarningAggregate/WarningNotifyEntity.cs b/src/SJZY.Track.Domain/Aggregates/ForewarningAggregate/WarningNotifyEntity.cs
index ff84c0ac..ba601062 100644
--- a/src/SJZY.Track.Domain/Aggregates/ForewarningAggregate/WarningNotifyEntity.cs
+++ b/src/SJZY.Track.Domain/Aggregates/ForewarningAggregate/WarningNotifyEntity.cs
@@ -35,12 +35,6 @@ public class WarningNotifyEntity : IFullAuditedBasicEntitys, IEntity
[SugarColumn(ColumnName = "NotifyMode")]
public NotifyMode NotifyMode { get; set; }
- ///
- /// 通知模板
- ///
- [SugarColumn(ColumnName = "NotifyTemplate", Length = 256)]
- public string NotifyTemplate { get; set; } = null!;
-
///
/// 通知人
///
diff --git a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs
index 87f5f7d3..3ff7261a 100644
--- a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs
+++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs
@@ -25,12 +25,6 @@ public interface IOrderRepository : IBasicRepository
///
Task DeleteOrderAsync(int orderId);
- ///
- /// 更新推送预警单
- ///
- ///
- Task PushWarnOrdersAsync(int pageSize, DateTime createTime);
-
///
/// 更新推送预警单
///
diff --git a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderEntity.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderEntity.cs
index f19af187..104b4867 100644
--- a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderEntity.cs
+++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderEntity.cs
@@ -175,7 +175,6 @@ public class OrderEntity : IFullAuditedBasicEntitys, IAggregateRoot
public short? IsTriggerPull { get; set; }
[SugarColumn(IsIgnore = true)] public List OrderFlights { get; set; }
- [SugarColumn(IsIgnore = true)] public List OrderTemplates { get; set; }
public void ResetTrackInfo()
{
diff --git a/src/SJZY.Track.Repository/Queries/WarningQueries.cs b/src/SJZY.Track.Repository/Queries/WarningQueries.cs
index 4a82cc6b..4cd8acb8 100644
--- a/src/SJZY.Track.Repository/Queries/WarningQueries.cs
+++ b/src/SJZY.Track.Repository/Queries/WarningQueries.cs
@@ -41,7 +41,6 @@ public class WarningQueries : ISugarRepository, IWarningQueries,
LeavePort = wr.LeavePort,
ProductCode = wr.ProductCode,
NotifyMode = wn.NotifyMode,
- NotifyTemplate = wn.NotifyTemplate,
NotifyUserId = wn.NotifyUserId,
FactorTypeSort = w.FactorTypeSort
})
diff --git a/src/SJZY.Track.Repository/Repositories/OrderRepository.cs b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs
index 0cd86b83..e28b4f25 100644
--- a/src/SJZY.Track.Repository/Repositories/OrderRepository.cs
+++ b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs
@@ -11,8 +11,6 @@ public class OrderRepository : BasicRepository, IOrderRepository, I
using var tran = TransactionHelper.GetReadCommitted();
var orderId = await InsertReturnIdentityAsync(order);
- order.OrderTemplates.ForEach(x => x.OrderId = orderId);
- await Context.Insertable(order.OrderTemplates).ExecuteCommandAsync();
order.OrderFlights.ForEach(x => x.OrderId = orderId);
await Context.Insertable(order.OrderFlights).ExecuteCommandAsync();
@@ -43,8 +41,6 @@ public class OrderRepository : BasicRepository, IOrderRepository, I
// 更新订单模板
await Context.Deleteable().Where(x => x.OrderId == order.Id).ExecuteCommandAsync();
- order.OrderTemplates.ForEach(x => x.OrderId = order.Id);
- await Context.Insertable(order.OrderTemplates).ExecuteCommandAsync();
// 更新订单航班
await Context.Deleteable().Where(x => x.OrderId == order.Id).ExecuteCommandAsync();
@@ -68,22 +64,6 @@ public class OrderRepository : BasicRepository, IOrderRepository, I
tran.Complete();
}
- public async Task PushWarnOrdersAsync(int pageSize, DateTime createTime)
- {
- return await Context.Ado.ExecuteCommandAsync(@"UPDATE `t_track_push_config` `a`
-LEFT JOIN `t_order` `b` ON `a`.`SubSystemId` = `b`.`SubSystemId` AND `a`.`CustomId` = `b`.`CustomId`
-SET `b`.`QuestionType` = CASE
- WHEN `b`.`LatestPushTime` IS NULL THEN 2
- WHEN `b`.`LatestPushTime` < DATE_SUB(NOW(), INTERVAL 12 HOUR) THEN 2
- ELSE 0 END
-WHERE `b`.`IsCompleted` = 0 AND `b`.`QuestionType` != 1 AND `b`.`CreateTime` < @createTime
-AND `a`.`IsDeleted` = 0 AND `b`.`IsDeleted` = 0 limit @pageSize", new
- {
- pageSize,
- createTime
- });
- }
-
///
/// 更新推送预警单
///
@@ -93,9 +73,9 @@ AND `a`.`IsDeleted` = 0 AND `b`.`IsDeleted` = 0 limit @pageSize", new
public async Task PushWarnOrdersAsync(int pageSize, int pageindex)
{
var ordersToUpdate = await Context.Queryable()
- .Where((b) => !b.IsCompleted
- && b.QuestionType != 1
- && !b.IsDeleted)
+ .Where(b => !b.IsCompleted
+ && b.QuestionType != 1
+ && !b.IsDeleted)
.Select(b => new
{
b.LatestPushTime,
diff --git a/src/SJZY.Track.Repository/Repositories/WarningRepository.cs b/src/SJZY.Track.Repository/Repositories/WarningRepository.cs
index fff0a754..ef384d6c 100644
--- a/src/SJZY.Track.Repository/Repositories/WarningRepository.cs
+++ b/src/SJZY.Track.Repository/Repositories/WarningRepository.cs
@@ -87,7 +87,6 @@ public class WarningRepository : BasicRepository, IWarningReposit
.UpdateColumns(x => new
{
x.NotifyMode,
- x.NotifyTemplate,
x.NotifyUserId,
x.UpdateTime,
x.UpdateUserId