remove:去除通知模版
This commit is contained in:
parent
01c73803da
commit
926adfcd5d
@ -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 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,9 @@ using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace SJZY.Track.Application.Contract.Dtos.ProvideServices;
|
||||
|
||||
/// <summary>
|
||||
/// 子系统id+订单类型+订单号 确定唯一订单
|
||||
/// </summary>
|
||||
public class OrderNoInfo
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@ -42,11 +42,6 @@ public class UpdateOrderInput : OrderNoInfo
|
||||
[MaxLength(200)]
|
||||
public string LeaveCity { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// 订单模板(传全量)
|
||||
/// </summary>
|
||||
public List<OrderTemplateInfo> Templates { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 订单航班信息
|
||||
/// </summary>
|
||||
|
||||
@ -2,7 +2,18 @@ namespace SJZY.Track.Application.Contract.Events;
|
||||
|
||||
public struct OrderIdentifier
|
||||
{
|
||||
/// <summary>
|
||||
/// 订单id
|
||||
/// </summary>
|
||||
public int OrderId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 订单号
|
||||
/// </summary>
|
||||
public string OrderNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 订单类型
|
||||
/// </summary>
|
||||
public int OrderType { get; set; }
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
|
||||
.GroupBy(x => new
|
||||
{
|
||||
x.SubSystemId,
|
||||
x.CustomId
|
||||
x.CustomId // 这里按客户分组是为了后续的推送方便
|
||||
}))
|
||||
{
|
||||
var nextEvent = @event.DeepCopy();
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -113,7 +113,6 @@ public class ForewarningService : ApplicationService
|
||||
{
|
||||
Id = x.Id,
|
||||
NotifyMode = input.NotifyMode,
|
||||
NotifyTemplate = input.NotifyTemplate,
|
||||
NotifyUserId = x.NotifyUserId
|
||||
}).ToList();
|
||||
|
||||
|
||||
@ -34,9 +34,11 @@ public partial class OrderService : ApplicationService, IOrderService
|
||||
[HttpPost("Order/Upsert")]
|
||||
public async Task<UnifyResultDto> 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<UpsertOrderInput, OrderEntity>(input);
|
||||
order.SubSystemId = CurrentUserRequest.SubSystemId;
|
||||
order.OrderTemplates = ObjectMapper.Map<List<OrderTemplateInfo>, List<OrderTemplateEntity>>(input.Templates);
|
||||
order.SubSystemId = subSystemId;
|
||||
order.OrderFlights = ObjectMapper.Map<List<OrderFlightInfo>, List<OrderFlightEntity>>(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<OrderTemplateInfo>, List<OrderTemplateEntity>>(input.Templates);
|
||||
order.OrderFlights = ObjectMapper.Map<List<OrderFlightInfo>, List<OrderFlightEntity>>(input.FlightInfos);
|
||||
await _orderRepository.UpdateOrderAsync(order);
|
||||
}
|
||||
|
||||
@ -35,12 +35,6 @@ public class WarningNotifyEntity : IFullAuditedBasicEntitys, IEntity
|
||||
[SugarColumn(ColumnName = "NotifyMode")]
|
||||
public NotifyMode NotifyMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 通知模板
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "NotifyTemplate", Length = 256)]
|
||||
public string NotifyTemplate { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// 通知人
|
||||
/// </summary>
|
||||
|
||||
@ -25,12 +25,6 @@ public interface IOrderRepository : IBasicRepository<OrderEntity>
|
||||
/// <returns></returns>
|
||||
Task DeleteOrderAsync(int orderId);
|
||||
|
||||
/// <summary>
|
||||
/// 更新推送预警单
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<int> PushWarnOrdersAsync(int pageSize, DateTime createTime);
|
||||
|
||||
/// <summary>
|
||||
/// 更新推送预警单
|
||||
/// </summary>
|
||||
|
||||
@ -175,7 +175,6 @@ public class OrderEntity : IFullAuditedBasicEntitys, IAggregateRoot
|
||||
public short? IsTriggerPull { get; set; }
|
||||
|
||||
[SugarColumn(IsIgnore = true)] public List<OrderFlightEntity> OrderFlights { get; set; }
|
||||
[SugarColumn(IsIgnore = true)] public List<OrderTemplateEntity> OrderTemplates { get; set; }
|
||||
|
||||
public void ResetTrackInfo()
|
||||
{
|
||||
|
||||
@ -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
|
||||
})
|
||||
|
||||
@ -11,8 +11,6 @@ public class OrderRepository : BasicRepository<OrderEntity>, 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<OrderEntity>, IOrderRepository, I
|
||||
|
||||
// 更新订单模板
|
||||
await Context.Deleteable<OrderTemplateEntity>().Where(x => x.OrderId == order.Id).ExecuteCommandAsync();
|
||||
order.OrderTemplates.ForEach(x => x.OrderId = order.Id);
|
||||
await Context.Insertable(order.OrderTemplates).ExecuteCommandAsync();
|
||||
|
||||
// 更新订单航班
|
||||
await Context.Deleteable<OrderFlightEntity>().Where(x => x.OrderId == order.Id).ExecuteCommandAsync();
|
||||
@ -68,22 +64,6 @@ public class OrderRepository : BasicRepository<OrderEntity>, IOrderRepository, I
|
||||
tran.Complete();
|
||||
}
|
||||
|
||||
public async Task<int> 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
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新推送预警单
|
||||
/// </summary>
|
||||
@ -93,9 +73,9 @@ AND `a`.`IsDeleted` = 0 AND `b`.`IsDeleted` = 0 limit @pageSize", new
|
||||
public async Task<int> PushWarnOrdersAsync(int pageSize, int pageindex)
|
||||
{
|
||||
var ordersToUpdate = await Context.Queryable<OrderEntity>()
|
||||
.Where((b) => !b.IsCompleted
|
||||
&& b.QuestionType != 1
|
||||
&& !b.IsDeleted)
|
||||
.Where(b => !b.IsCompleted
|
||||
&& b.QuestionType != 1
|
||||
&& !b.IsDeleted)
|
||||
.Select(b => new
|
||||
{
|
||||
b.LatestPushTime,
|
||||
|
||||
@ -87,7 +87,6 @@ public class WarningRepository : BasicRepository<WarningEntity>, IWarningReposit
|
||||
.UpdateColumns(x => new
|
||||
{
|
||||
x.NotifyMode,
|
||||
x.NotifyTemplate,
|
||||
x.NotifyUserId,
|
||||
x.UpdateTime,
|
||||
x.UpdateUserId
|
||||
|
||||
Loading…
Reference in New Issue
Block a user