对外接口返参调整

This commit is contained in:
moyongzhen 2024-03-29 14:39:30 +08:00
parent 9d29759cc0
commit 5818d8ddd8
4 changed files with 35 additions and 24 deletions

View File

@ -10,21 +10,21 @@ public interface ITrackService : IRemoteService
/// </summary> /// </summary>
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
Task<bool> UpsertTrackAsync(UpsertTrackInput input); Task<UnifyResultDto> UpsertTrackAsync(UpsertTrackInput input);
/// <summary> /// <summary>
/// 删除轨迹 /// 删除轨迹
/// </summary> /// </summary>
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
Task<bool> DeleteTrackAsync(DeleteTrackInput input); Task<UnifyResultDto> DeleteTrackAsync(DeleteTrackInput input);
/// <summary> /// <summary>
/// 批量删除轨迹 /// 批量删除轨迹
/// </summary> /// </summary>
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
Task<bool> BatchDeleteTrackAsync(BatchDeleteTrackInput input); Task<UnifyResultDto> BatchDeleteTrackAsync(BatchDeleteTrackInput input);
/// <summary> /// <summary>
/// 根据订单号获取轨迹 /// 根据订单号获取轨迹

View File

@ -65,7 +65,7 @@ public partial class OrderService
}); });
} }
return new UnifyResultDto(true); return new UnifyResultDto(true, true);
} }
private async Task<List<int>> DoLinkOrderAsync(LinkOrderInput input, int orderId) private async Task<List<int>> DoLinkOrderAsync(LinkOrderInput input, int orderId)
@ -108,6 +108,6 @@ public partial class OrderService
// real del // real del
await _orderRepository.UnLinkByIdsAsync(unLinkIds); await _orderRepository.UnLinkByIdsAsync(unLinkIds);
return new UnifyResultDto(true); return new UnifyResultDto(true, true);
} }
} }

View File

@ -70,7 +70,7 @@ public partial class OrderService : ApplicationService, IOrderService
await _orderRepository.DeleteOrderAsync(orderId); await _orderRepository.DeleteOrderAsync(orderId);
return new UnifyResultDto(true); return new UnifyResultDto(true, true);
} }
private async Task UpdateOrderAsync(UpdateOrderInput input, OrderEntity order) private async Task UpdateOrderAsync(UpdateOrderInput input, OrderEntity order)

View File

@ -38,13 +38,17 @@ public partial class TrackService : ApplicationService, ITrackService
/// <returns></returns> /// <returns></returns>
/// <exception cref="BusinessException"></exception> /// <exception cref="BusinessException"></exception>
[HttpPost("Track/Upsert")] [HttpPost("Track/Upsert")]
public async Task<bool> UpsertTrackAsync(UpsertTrackInput input) public async Task<UnifyResultDto> UpsertTrackAsync(UpsertTrackInput input)
{ {
var order = await _orderRepository.GetFirstAsync(x => var order = await _orderRepository.GetFirstAsync(x =>
x.OrderType == input.OrderType && x.OrderNo == input.OrderNo, x => new x.OrderType == input.OrderType && x.OrderNo == input.OrderNo, x => new
{ {
x.Id, x.SubSystemId, x.LatestPushTrackContentId, x.CustomId, x.IsCompleted x.Id,
}); x.SubSystemId,
x.LatestPushTrackContentId,
x.CustomId,
x.IsCompleted
});
if (order == default) if (order == default)
{ {
throw new BusinessException(message: $"订单:{input.OrderNo}不存在"); throw new BusinessException(message: $"订单:{input.OrderNo}不存在");
@ -59,7 +63,7 @@ public partial class TrackService : ApplicationService, ITrackService
@event.IsCompleted = order.IsCompleted; @event.IsCompleted = order.IsCompleted;
@event.OperationMan = CurrentUserRequest.CurrentUser.Name; @event.OperationMan = CurrentUserRequest.CurrentUser.Name;
await _capPublisher.PublishAsync(GlobalConst.TrackUpsertSubscribe, @event); await _capPublisher.PublishAsync(GlobalConst.TrackUpsertSubscribe, @event);
return true; return new UnifyResultDto(true, true);
} }
/// <summary> /// <summary>
@ -69,7 +73,7 @@ public partial class TrackService : ApplicationService, ITrackService
/// <returns></returns> /// <returns></returns>
/// <exception cref="BusinessException"></exception> /// <exception cref="BusinessException"></exception>
[HttpPost("Track/BatchUpsert")] [HttpPost("Track/BatchUpsert")]
public async Task<bool> BatchUpsertTrackAsync(BatchUpsertTrackInput input) public async Task<UnifyResultDto> BatchUpsertTrackAsync(BatchUpsertTrackInput input)
{ {
input.OrderNos = input.OrderNos.Where(x => !x.IsNullOrWhiteSpace()).Distinct().ToList(); // 单号去重、去空 input.OrderNos = input.OrderNos.Where(x => !x.IsNullOrWhiteSpace()).Distinct().ToList(); // 单号去重、去空
if (input.OrderNos.Count == 0) if (input.OrderNos.Count == 0)
@ -79,9 +83,14 @@ public partial class TrackService : ApplicationService, ITrackService
var orders = await _orderRepository.GetListAsync(x => var orders = await _orderRepository.GetListAsync(x =>
x.OrderType == input.OrderType && input.OrderNos.Contains(x.OrderNo), x => new x.OrderType == input.OrderType && input.OrderNos.Contains(x.OrderNo), x => new
{ {
x.Id, x.OrderNo, x.SubSystemId, x.LatestPushTrackContentId, x.CustomId, x.IsCompleted x.Id,
}); x.OrderNo,
x.SubSystemId,
x.LatestPushTrackContentId,
x.CustomId,
x.IsCompleted
});
foreach (var order in orders) foreach (var order in orders)
{ {
@ -105,7 +114,7 @@ public partial class TrackService : ApplicationService, ITrackService
await _capPublisher.PublishAsync(GlobalConst.TrackUpsertSubscribe, @event); await _capPublisher.PublishAsync(GlobalConst.TrackUpsertSubscribe, @event);
} }
return true; return new UnifyResultDto(true, true);
} }
/// <summary> /// <summary>
@ -115,13 +124,14 @@ public partial class TrackService : ApplicationService, ITrackService
/// <returns></returns> /// <returns></returns>
/// <exception cref="BusinessException"></exception> /// <exception cref="BusinessException"></exception>
[HttpPost("Track/Delete")] [HttpPost("Track/Delete")]
public async Task<bool> DeleteTrackAsync(DeleteTrackInput input) public async Task<UnifyResultDto> DeleteTrackAsync(DeleteTrackInput input)
{ {
var order = await _orderRepository.GetFirstAsync(x => var order = await _orderRepository.GetFirstAsync(x =>
x.OrderType == input.OrderType && x.OrderNo == input.OrderNo, x => new x.OrderType == input.OrderType && x.OrderNo == input.OrderNo, x => new
{ {
x.Id, x.SubSystemId x.Id,
}); x.SubSystemId
});
if (order == default) if (order == default)
{ {
throw new BusinessException(message: $"订单:{input.OrderNo}不存在"); throw new BusinessException(message: $"订单:{input.OrderNo}不存在");
@ -144,7 +154,7 @@ public partial class TrackService : ApplicationService, ITrackService
}; };
await _capPublisher.PublishAsync(GlobalConst.TrackDeleteSubscribe, @event); await _capPublisher.PublishAsync(GlobalConst.TrackDeleteSubscribe, @event);
return true; return new UnifyResultDto(true, true);
} }
/// <summary> /// <summary>
@ -154,13 +164,14 @@ public partial class TrackService : ApplicationService, ITrackService
/// <returns></returns> /// <returns></returns>
/// <exception cref="BusinessException"></exception> /// <exception cref="BusinessException"></exception>
[HttpPost("Track/BatchDelete")] [HttpPost("Track/BatchDelete")]
public async Task<bool> BatchDeleteTrackAsync(BatchDeleteTrackInput input) public async Task<UnifyResultDto> BatchDeleteTrackAsync(BatchDeleteTrackInput input)
{ {
var orders = await _orderRepository.GetListAsync(x => var orders = await _orderRepository.GetListAsync(x =>
x.OrderType == input.OrderType && input.OrderNos.Contains(x.OrderNo) x.OrderType == input.OrderType && input.OrderNos.Contains(x.OrderNo)
, x => new , x => new
{ {
x.Id, x.SubSystemId x.Id,
x.SubSystemId
}); });
var codes = await _provideQueries.GetCanDeleteTrackCodesAsync( var codes = await _provideQueries.GetCanDeleteTrackCodesAsync(
@ -185,6 +196,6 @@ public partial class TrackService : ApplicationService, ITrackService
await _capPublisher.PublishAsync(GlobalConst.TrackDeleteSubscribe, @event); await _capPublisher.PublishAsync(GlobalConst.TrackDeleteSubscribe, @event);
} }
return true; return new UnifyResultDto(true, true);
} }
} }