remove:去除通知模版
This commit is contained in:
parent
01c73803da
commit
926adfcd5d
@ -7,7 +7,7 @@
|
|||||||
"Apollo": {
|
"Apollo": {
|
||||||
"AppId": "SJZY.Track.Configuration",
|
"AppId": "SJZY.Track.Configuration",
|
||||||
"Env": "DEV",
|
"Env": "DEV",
|
||||||
"Namespace": "Test",
|
"Namespace": "dev",
|
||||||
"MetaServer": "http://apollo-service-test-apollo-configservice.apollo.svc.cluster.local:8080",
|
"MetaServer": "http://apollo-service-test-apollo-configservice.apollo.svc.cluster.local:8080",
|
||||||
"ConfigServer": [
|
"ConfigServer": [
|
||||||
"http://apollo-service-test-apollo-configservice.apollo.svc.cluster.local:8080"
|
"http://apollo-service-test-apollo-configservice.apollo.svc.cluster.local:8080"
|
||||||
|
|||||||
@ -2,6 +2,9 @@ using System.ComponentModel.DataAnnotations;
|
|||||||
|
|
||||||
namespace SJZY.Track.Application.Contract.Dtos.ProvideServices;
|
namespace SJZY.Track.Application.Contract.Dtos.ProvideServices;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 子系统id+订单类型+订单号 确定唯一订单
|
||||||
|
/// </summary>
|
||||||
public class OrderNoInfo
|
public class OrderNoInfo
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -42,11 +42,6 @@ public class UpdateOrderInput : OrderNoInfo
|
|||||||
[MaxLength(200)]
|
[MaxLength(200)]
|
||||||
public string LeaveCity { get; set; } = null!;
|
public string LeaveCity { get; set; } = null!;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 订单模板(传全量)
|
|
||||||
/// </summary>
|
|
||||||
public List<OrderTemplateInfo> Templates { get; set; } = new();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 订单航班信息
|
/// 订单航班信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -2,7 +2,18 @@ namespace SJZY.Track.Application.Contract.Events;
|
|||||||
|
|
||||||
public struct OrderIdentifier
|
public struct OrderIdentifier
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 订单id
|
||||||
|
/// </summary>
|
||||||
public int OrderId { get; set; }
|
public int OrderId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 订单号
|
||||||
|
/// </summary>
|
||||||
public string OrderNo { get; set; }
|
public string OrderNo { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 订单类型
|
||||||
|
/// </summary>
|
||||||
public int OrderType { get; set; }
|
public int OrderType { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -52,7 +52,7 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
.GroupBy(x => new
|
.GroupBy(x => new
|
||||||
{
|
{
|
||||||
x.SubSystemId,
|
x.SubSystemId,
|
||||||
x.CustomId
|
x.CustomId // 这里按客户分组是为了后续的推送方便
|
||||||
}))
|
}))
|
||||||
{
|
{
|
||||||
var nextEvent = @event.DeepCopy();
|
var nextEvent = @event.DeepCopy();
|
||||||
|
|||||||
@ -159,7 +159,6 @@ public class ForewarningHelper
|
|||||||
StartTrackStatusId = x.StartTrackStatusId,
|
StartTrackStatusId = x.StartTrackStatusId,
|
||||||
EndTrackStatusId = x.EndTrackStatusId,
|
EndTrackStatusId = x.EndTrackStatusId,
|
||||||
NotifyMode = input.NotifyMode,
|
NotifyMode = input.NotifyMode,
|
||||||
NotifyTemplate = input.NotifyTemplate,
|
|
||||||
NotifyUserId = x.NotifyUserId
|
NotifyUserId = x.NotifyUserId
|
||||||
}).ToList();
|
}).ToList();
|
||||||
}
|
}
|
||||||
@ -173,7 +172,6 @@ public class ForewarningHelper
|
|||||||
SubSystemId = warning.SubSystemId,
|
SubSystemId = warning.SubSystemId,
|
||||||
CustomerId = warning.CustomerId,
|
CustomerId = warning.CustomerId,
|
||||||
NotifyMode = warning.WarningNotifies.First().NotifyMode,
|
NotifyMode = warning.WarningNotifies.First().NotifyMode,
|
||||||
NotifyTemplate = warning.WarningNotifies.First().NotifyTemplate,
|
|
||||||
TrackStatusSpans = warning.WarningNotifies.Select(x => new WarningNotifyWithIdDto
|
TrackStatusSpans = warning.WarningNotifies.Select(x => new WarningNotifyWithIdDto
|
||||||
{
|
{
|
||||||
Id = x.Id,
|
Id = x.Id,
|
||||||
|
|||||||
@ -113,7 +113,6 @@ public class ForewarningService : ApplicationService
|
|||||||
{
|
{
|
||||||
Id = x.Id,
|
Id = x.Id,
|
||||||
NotifyMode = input.NotifyMode,
|
NotifyMode = input.NotifyMode,
|
||||||
NotifyTemplate = input.NotifyTemplate,
|
|
||||||
NotifyUserId = x.NotifyUserId
|
NotifyUserId = x.NotifyUserId
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
|
|||||||
@ -34,9 +34,11 @@ public partial class OrderService : ApplicationService, IOrderService
|
|||||||
[HttpPost("Order/Upsert")]
|
[HttpPost("Order/Upsert")]
|
||||||
public async Task<UnifyResultDto> UpsertAsync(UpsertOrderInput input)
|
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 =>
|
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)
|
if (order != default)
|
||||||
{
|
{
|
||||||
// 订单已存在则视为更新
|
// 订单已存在则视为更新
|
||||||
@ -51,8 +53,7 @@ public partial class OrderService : ApplicationService, IOrderService
|
|||||||
}
|
}
|
||||||
|
|
||||||
order = ObjectMapper.Map<UpsertOrderInput, OrderEntity>(input);
|
order = ObjectMapper.Map<UpsertOrderInput, OrderEntity>(input);
|
||||||
order.SubSystemId = CurrentUserRequest.SubSystemId;
|
order.SubSystemId = subSystemId;
|
||||||
order.OrderTemplates = ObjectMapper.Map<List<OrderTemplateInfo>, List<OrderTemplateEntity>>(input.Templates);
|
|
||||||
order.OrderFlights = ObjectMapper.Map<List<OrderFlightInfo>, List<OrderFlightEntity>>(input.FlightInfos);
|
order.OrderFlights = ObjectMapper.Map<List<OrderFlightInfo>, List<OrderFlightEntity>>(input.FlightInfos);
|
||||||
|
|
||||||
await _orderRepository.CreateOrderAsync(order);
|
await _orderRepository.CreateOrderAsync(order);
|
||||||
@ -88,7 +89,6 @@ public partial class OrderService : ApplicationService, IOrderService
|
|||||||
private async Task UpdateOrderAsync(UpdateOrderInput input, OrderEntity order)
|
private async Task UpdateOrderAsync(UpdateOrderInput input, OrderEntity order)
|
||||||
{
|
{
|
||||||
order = ObjectMapper.Map(input, 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);
|
order.OrderFlights = ObjectMapper.Map<List<OrderFlightInfo>, List<OrderFlightEntity>>(input.FlightInfos);
|
||||||
await _orderRepository.UpdateOrderAsync(order);
|
await _orderRepository.UpdateOrderAsync(order);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,12 +35,6 @@ public class WarningNotifyEntity : IFullAuditedBasicEntitys, IEntity
|
|||||||
[SugarColumn(ColumnName = "NotifyMode")]
|
[SugarColumn(ColumnName = "NotifyMode")]
|
||||||
public NotifyMode NotifyMode { get; set; }
|
public NotifyMode NotifyMode { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 通知模板
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnName = "NotifyTemplate", Length = 256)]
|
|
||||||
public string NotifyTemplate { get; set; } = null!;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 通知人
|
/// 通知人
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -25,12 +25,6 @@ public interface IOrderRepository : IBasicRepository<OrderEntity>
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task DeleteOrderAsync(int orderId);
|
Task DeleteOrderAsync(int orderId);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 更新推送预警单
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task<int> PushWarnOrdersAsync(int pageSize, DateTime createTime);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 更新推送预警单
|
/// 更新推送预警单
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -175,7 +175,6 @@ public class OrderEntity : IFullAuditedBasicEntitys, IAggregateRoot
|
|||||||
public short? IsTriggerPull { get; set; }
|
public short? IsTriggerPull { get; set; }
|
||||||
|
|
||||||
[SugarColumn(IsIgnore = true)] public List<OrderFlightEntity> OrderFlights { get; set; }
|
[SugarColumn(IsIgnore = true)] public List<OrderFlightEntity> OrderFlights { get; set; }
|
||||||
[SugarColumn(IsIgnore = true)] public List<OrderTemplateEntity> OrderTemplates { get; set; }
|
|
||||||
|
|
||||||
public void ResetTrackInfo()
|
public void ResetTrackInfo()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -41,7 +41,6 @@ public class WarningQueries : ISugarRepository, IWarningQueries,
|
|||||||
LeavePort = wr.LeavePort,
|
LeavePort = wr.LeavePort,
|
||||||
ProductCode = wr.ProductCode,
|
ProductCode = wr.ProductCode,
|
||||||
NotifyMode = wn.NotifyMode,
|
NotifyMode = wn.NotifyMode,
|
||||||
NotifyTemplate = wn.NotifyTemplate,
|
|
||||||
NotifyUserId = wn.NotifyUserId,
|
NotifyUserId = wn.NotifyUserId,
|
||||||
FactorTypeSort = w.FactorTypeSort
|
FactorTypeSort = w.FactorTypeSort
|
||||||
})
|
})
|
||||||
|
|||||||
@ -11,8 +11,6 @@ public class OrderRepository : BasicRepository<OrderEntity>, IOrderRepository, I
|
|||||||
using var tran = TransactionHelper.GetReadCommitted();
|
using var tran = TransactionHelper.GetReadCommitted();
|
||||||
|
|
||||||
var orderId = await InsertReturnIdentityAsync(order);
|
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);
|
order.OrderFlights.ForEach(x => x.OrderId = orderId);
|
||||||
await Context.Insertable(order.OrderFlights).ExecuteCommandAsync();
|
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();
|
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();
|
await Context.Deleteable<OrderFlightEntity>().Where(x => x.OrderId == order.Id).ExecuteCommandAsync();
|
||||||
@ -68,22 +64,6 @@ public class OrderRepository : BasicRepository<OrderEntity>, IOrderRepository, I
|
|||||||
tran.Complete();
|
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>
|
||||||
/// 更新推送预警单
|
/// 更新推送预警单
|
||||||
/// </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)
|
public async Task<int> PushWarnOrdersAsync(int pageSize, int pageindex)
|
||||||
{
|
{
|
||||||
var ordersToUpdate = await Context.Queryable<OrderEntity>()
|
var ordersToUpdate = await Context.Queryable<OrderEntity>()
|
||||||
.Where((b) => !b.IsCompleted
|
.Where(b => !b.IsCompleted
|
||||||
&& b.QuestionType != 1
|
&& b.QuestionType != 1
|
||||||
&& !b.IsDeleted)
|
&& !b.IsDeleted)
|
||||||
.Select(b => new
|
.Select(b => new
|
||||||
{
|
{
|
||||||
b.LatestPushTime,
|
b.LatestPushTime,
|
||||||
|
|||||||
@ -87,7 +87,6 @@ public class WarningRepository : BasicRepository<WarningEntity>, IWarningReposit
|
|||||||
.UpdateColumns(x => new
|
.UpdateColumns(x => new
|
||||||
{
|
{
|
||||||
x.NotifyMode,
|
x.NotifyMode,
|
||||||
x.NotifyTemplate,
|
|
||||||
x.NotifyUserId,
|
x.NotifyUserId,
|
||||||
x.UpdateTime,
|
x.UpdateTime,
|
||||||
x.UpdateUserId
|
x.UpdateUserId
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user