对外接口返参调整

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>
/// <param name="input"></param>
/// <returns></returns>
Task<bool> UpsertTrackAsync(UpsertTrackInput input);
Task<UnifyResultDto> UpsertTrackAsync(UpsertTrackInput input);
/// <summary>
/// 删除轨迹
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
Task<bool> DeleteTrackAsync(DeleteTrackInput input);
Task<UnifyResultDto> DeleteTrackAsync(DeleteTrackInput input);
/// <summary>
/// 批量删除轨迹
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
Task<bool> BatchDeleteTrackAsync(BatchDeleteTrackInput input);
Task<UnifyResultDto> BatchDeleteTrackAsync(BatchDeleteTrackInput input);
/// <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)
@ -108,6 +108,6 @@ public partial class OrderService
// real del
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);
return new UnifyResultDto(true);
return new UnifyResultDto(true, true);
}
private async Task UpdateOrderAsync(UpdateOrderInput input, OrderEntity order)

View File

@ -38,12 +38,16 @@ public partial class TrackService : ApplicationService, ITrackService
/// <returns></returns>
/// <exception cref="BusinessException"></exception>
[HttpPost("Track/Upsert")]
public async Task<bool> UpsertTrackAsync(UpsertTrackInput input)
public async Task<UnifyResultDto> UpsertTrackAsync(UpsertTrackInput input)
{
var order = await _orderRepository.GetFirstAsync(x =>
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)
{
@ -59,7 +63,7 @@ public partial class TrackService : ApplicationService, ITrackService
@event.IsCompleted = order.IsCompleted;
@event.OperationMan = CurrentUserRequest.CurrentUser.Name;
await _capPublisher.PublishAsync(GlobalConst.TrackUpsertSubscribe, @event);
return true;
return new UnifyResultDto(true, true);
}
/// <summary>
@ -69,7 +73,7 @@ public partial class TrackService : ApplicationService, ITrackService
/// <returns></returns>
/// <exception cref="BusinessException"></exception>
[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(); // 单号去重、去空
if (input.OrderNos.Count == 0)
@ -80,7 +84,12 @@ public partial class TrackService : ApplicationService, ITrackService
var orders = await _orderRepository.GetListAsync(x =>
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)
@ -105,7 +114,7 @@ public partial class TrackService : ApplicationService, ITrackService
await _capPublisher.PublishAsync(GlobalConst.TrackUpsertSubscribe, @event);
}
return true;
return new UnifyResultDto(true, true);
}
/// <summary>
@ -115,12 +124,13 @@ public partial class TrackService : ApplicationService, ITrackService
/// <returns></returns>
/// <exception cref="BusinessException"></exception>
[HttpPost("Track/Delete")]
public async Task<bool> DeleteTrackAsync(DeleteTrackInput input)
public async Task<UnifyResultDto> DeleteTrackAsync(DeleteTrackInput input)
{
var order = await _orderRepository.GetFirstAsync(x =>
x.OrderType == input.OrderType && x.OrderNo == input.OrderNo, x => new
{
x.Id, x.SubSystemId
x.Id,
x.SubSystemId
});
if (order == default)
{
@ -144,7 +154,7 @@ public partial class TrackService : ApplicationService, ITrackService
};
await _capPublisher.PublishAsync(GlobalConst.TrackDeleteSubscribe, @event);
return true;
return new UnifyResultDto(true, true);
}
/// <summary>
@ -154,13 +164,14 @@ public partial class TrackService : ApplicationService, ITrackService
/// <returns></returns>
/// <exception cref="BusinessException"></exception>
[HttpPost("Track/BatchDelete")]
public async Task<bool> BatchDeleteTrackAsync(BatchDeleteTrackInput input)
public async Task<UnifyResultDto> BatchDeleteTrackAsync(BatchDeleteTrackInput input)
{
var orders = await _orderRepository.GetListAsync(x =>
x.OrderType == input.OrderType && input.OrderNos.Contains(x.OrderNo)
, x => new
{
x.Id, x.SubSystemId
x.Id,
x.SubSystemId
});
var codes = await _provideQueries.GetCanDeleteTrackCodesAsync(
@ -185,6 +196,6 @@ public partial class TrackService : ApplicationService, ITrackService
await _capPublisher.PublishAsync(GlobalConst.TrackDeleteSubscribe, @event);
}
return true;
return new UnifyResultDto(true, true);
}
}