接口优化

optimize
wet 2 years ago
parent 4fd0cdbb1d
commit f6d7013bfb

@ -323,12 +323,13 @@ namespace Myshipping.Application
var list = entities.Adapt<SqlSugarPagedList<PageBookingOrder>>();
var status = _repBookingStatus.AsQueryable();
var remark = _bookingremark.AsQueryable();
foreach (var item in list.Items)
{
var sta = await _repBookingStatus.AsQueryable().Where(x => x.BookingId == item.Id).ToListAsync();
var sta = await status.Where(x => x.BookingId == item.Id).ToListAsync();
if (sta != null) { item.bookstatus = sta; }
var st = await _bookingremark.AsQueryable().Where(x => x.PId == item.Id).ToListAsync();
var st = await remark.Where(x => x.PId == item.Id).ToListAsync();
if (st != null) { item.bookremark = st; }
if (!string.IsNullOrWhiteSpace(item.ETD))
{
@ -4575,8 +4576,51 @@ namespace Myshipping.Application
/// <summary>
/// 获取订舱数据接口 备注 、 文件 、日志、服务项目、状态日志
/// </summary>
/// <returns></returns>
[HttpGet("/BookingOrder/GetAllData")]
public async Task<dynamic> GetAllData(long bookingId)
{
BookingAllData allData = new BookingAllData();
//服务项目
var itemlist = await _serviceItem.AsQueryable().Where(x => x.BookingId == bookingId).ToListAsync();
allData.item = itemlist;
var remarklist = await _bookingremark.AsQueryable().Where(u => u.PId == bookingId).ToListAsync();
allData.remark = remarklist;
var filelist = await _bookingfile.AsQueryable().Filter(null, true).Where(u => u.BookingId == bookingId).ToListAsync();
allData.file = filelist;
var statuslog = await _repStatuslog.AsQueryable().Filter(null, true).Where(x => x.BookingId == bookingId).OrderByDescending(x => x.OpTime).ToListAsync();
var dto = statuslog.Adapt<List<BookingStatusLogDto>>();
var statuslogdetail = _statuslogdetail.AsQueryable();
foreach (var item in dto)
{
var detail =await statuslogdetail.Where(x => x.PId == item.Id).ToListAsync();
item.detail = detail.Adapt<List<BookingStatusLogDetailDto>>();
}
allData.statuslog = dto;
var bookinglog = _bookinglog.AsQueryable();
List<BookingLogDto> list = new List<BookingLogDto>();
var main = await bookinglog.Where(u => u.BookingId == bookingId).ToListAsync();
list = main.Adapt<List<BookingLogDto>>();
if (list != null)
{
var bookinglogdetail = _bookinglogdetail.AsQueryable();
foreach (var item in list)
{
var details = await bookinglogdetail.Where(x => x.PId == item.Id).ToListAsync();
item.details = details;
}
}
allData.log = list;
return allData;
}

@ -0,0 +1,24 @@
using Myshipping.Application.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application.Service.BookingOrder.Dto
{
public class BookingAllData
{
public List<BookingServiceItem> item { get; set; }
public List<BookingRemark> remark { get; set; }
public List<BookingFile> file { get; set; }
public List<BookingStatusLogDto> statuslog { get; set; }
public List<BookingLogDto> log { get; set; }
}
}
Loading…
Cancel
Save