diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 55d8eb2f..2fef92f1 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -129,6 +129,7 @@ namespace Myshipping.Application private readonly IBookingGoodsStatusConfigService _GoodsConfig; private readonly SqlSugarRepository _repLineOpMgrConfig; private readonly SqlSugarRepository _repSysEmp; + const string CONST_MAPPING_MODULE = "BOOK_OR_CLOSING"; const string CONST_MAPPING_MODULE_ROUTE = "BOOK_OR_CLOSING_RT"; @@ -8598,5 +8599,7 @@ namespace Myshipping.Application await SendBookingOrder(orderlist.ToArray()); } + + } } diff --git a/Myshipping.Application/Service/BookingOrder/BookingValueAddedService.cs b/Myshipping.Application/Service/BookingOrder/BookingValueAddedService.cs index 97a1afd3..65063901 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingValueAddedService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingValueAddedService.cs @@ -14,6 +14,7 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Myshipping.Application.ConfigOption; using Myshipping.Application.Entity; +using Myshipping.Application.Service.BookingOrder.Dto; using Myshipping.Core; using Myshipping.Core.Entity; using Myshipping.Core.Service; @@ -53,11 +54,18 @@ namespace Myshipping.Application private readonly IBookingOrderService _bookingOrderService; private readonly ILogger _logger; private readonly SqlSugarRepository _bookingOrderRepository; - private readonly SqlSugarRepository _bookingfile; + private readonly SqlSugarRepository _bookingFileRepository; private readonly SqlSugarRepository _djyWebsiteAccountConfigRepository; private readonly SqlSugarRepository _sysUserRepository; private readonly SqlSugarRepository _bookingLetteryardRepository; private readonly SqlSugarRepository _taskBCInfoRepository; + private readonly SqlSugarRepository _statuslogRepository; + private readonly SqlSugarRepository _statuslogdetailRepository; + private readonly SqlSugarRepository _bookinglogRepository; + private readonly SqlSugarRepository _bookinglogdetailRepository; + private readonly SqlSugarRepository _bookingRemarkRepository; + + private readonly IServiceWorkFlowBaseService _serviceWorkFlowBaseService; const string CONST_MAPPING_BC_MODULE_ROUTE = "BC_DOWN_RT"; const string CONST_MAPPING_DRAFT_MODULE_ROUTE = "DRAFT_DOWN_RT"; @@ -73,22 +81,32 @@ namespace Myshipping.Application const string CONST_BC_FILE_READ_URL = "bc_file_pdf_read_url"; public BookingValueAddedService(ISysCacheService cache, ILogger logger, - SqlSugarRepository bookingOrderRepository, SqlSugarRepository bookingfile, + SqlSugarRepository bookingOrderRepository, SqlSugarRepository djyWebsiteAccountConfigRepository, SqlSugarRepository sysUserRepository, SqlSugarRepository bookingLetteryardRepository, IBookingOrderService bookingOrderService - , SqlSugarRepository taskBCInfoRepository) + , SqlSugarRepository taskBCInfoRepository, IServiceWorkFlowBaseService serviceWorkFlowBaseService, + SqlSugarRepository statuslogRepository, SqlSugarRepository statuslogdetailRepository, + SqlSugarRepository bookinglogRepository, SqlSugarRepository bookinglogdetailRepository, + SqlSugarRepository bookingRemarkRepository, SqlSugarRepository bookingFileRepository) { _cache = cache; _logger = logger; _bookingOrderRepository = bookingOrderRepository; - _bookingfile = bookingfile; _djyWebsiteAccountConfigRepository = djyWebsiteAccountConfigRepository; _sysUserRepository = sysUserRepository; _bookingLetteryardRepository = bookingLetteryardRepository; _bookingOrderService = bookingOrderService; _taskBCInfoRepository = taskBCInfoRepository; + + _serviceWorkFlowBaseService = serviceWorkFlowBaseService; + _statuslogRepository = statuslogRepository; + _statuslogdetailRepository = statuslogdetailRepository; + _bookinglogRepository = bookinglogRepository; + _bookinglogdetailRepository = bookinglogdetailRepository; + _bookingRemarkRepository = bookingRemarkRepository; + _bookingFileRepository = bookingFileRepository; } @@ -384,7 +402,7 @@ namespace Myshipping.Application BookingId = boookId, }; - await _bookingfile.InsertAsync(bookFile); + await _bookingFileRepository.InsertAsync(bookFile); } #endregion @@ -1916,6 +1934,109 @@ namespace Myshipping.Application return result; } #endregion + + /// + /// 获取订舱数据接口 备注 、 文件 、服务项目 + /// + /// 订舱ID + /// 返回服务状态列表 + public async Task GetAllDataVNTWO(long bookingId) + { + BookingAttachedDataDto resultDto = new BookingAttachedDataDto(); + + if (bookingId == 0) + { + throw Oops.Oh($"订舱ID不能为空"); + } + + var orderInfo = _bookingOrderRepository.AsQueryable().Filter(null, true).First(a => a.Id == bookingId); + + //订舱备注列表 + var remarklist = await _bookingRemarkRepository.AsQueryable().Where(u => u.PId == bookingId) + .ToListAsync(); + + resultDto.remark = remarklist; + + //订舱附件列表 + var filelist = await _bookingFileRepository.AsQueryable().Filter(null, true) + .Where(u => u.BookingId == bookingId).ToListAsync(); + + resultDto.file = filelist; + + var projectList = await _serviceWorkFlowBaseService.GetEnableProjectList(orderInfo.TenantId.Value.ToString()); + + if (projectList != null && projectList.Count > 0) + { + //resultDto = BookingServiceItem + } + + return resultDto; + } + + #region 获取订舱数据接口 日志、状态日志 + /// + /// 获取订舱数据接口 日志、状态日志 + /// + /// 订舱ID + /// 返回日志详情 + public async Task GetAllLogDataVNTWO(long bookingId) + { + BookingLogDataDto resultDto = new BookingLogDataDto(); + + var statusLogList = _statuslogRepository.AsQueryable().Filter(null, true) + .LeftJoin((a, b) => a.Id == b.PId) + .Where((a, b) => a.BookingId == bookingId) + .Select((a, b) => new { Base = a, Detail = b }) + .ToList(); + + if (statusLogList.Count > 0) + { + resultDto.statuslog = statusLogList.OrderByDescending(a => a.Base.OpTime) + .GroupBy(a => a.Base.Id) + .Select(a => + { + var currList = a.ToList(); + + var baseDto = currList.FirstOrDefault().Base.Adapt(); + + if (currList.Any(b => b.Detail != null)) + { + baseDto.detail = currList.Where(b => b.Detail != null) + .Select(b => b.Detail.Adapt()).ToList(); + } + + return baseDto; + }).ToList(); + } + + var logList = _bookinglogRepository.AsQueryable() + .LeftJoin((a, b) => a.Id == b.PId) + .Where((a, b) => a.BookingId == bookingId) + .Select((a, b) => new { Base = a, Detail = b }) + .ToList(); + + if (logList.Count > 0) + { + resultDto.log = logList.GroupBy(a => a.Base.Id) + .Select(a => + { + var currList = a.ToList(); + + var baseDto = currList.FirstOrDefault().Base.Adapt(); + + if (currList.Any(b => b.Detail != null)) + { + baseDto.details = currList.Where(b => b.Detail != null) + .Select(b => b.Detail).ToList(); + } + + return baseDto; + }).ToList(); + } + + return resultDto; + } + #endregion } public class DateTimeJsonConverter : System.Text.Json.Serialization.JsonConverter> diff --git a/Myshipping.Application/Service/BookingOrder/Dto/BookingAttachedDataDto.cs b/Myshipping.Application/Service/BookingOrder/Dto/BookingAttachedDataDto.cs new file mode 100644 index 00000000..b994666c --- /dev/null +++ b/Myshipping.Application/Service/BookingOrder/Dto/BookingAttachedDataDto.cs @@ -0,0 +1,27 @@ +using Myshipping.Application.Entity; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application +{ + /// + /// + /// + public class BookingAttachedDataDto + { + /// + /// 订舱备注 + /// + public List remark { get; set; } + + /// + /// 订舱附件 + /// + public List file { get; set; } + + + } +} diff --git a/Myshipping.Application/Service/BookingOrder/Dto/BookingLogDataDto.cs b/Myshipping.Application/Service/BookingOrder/Dto/BookingLogDataDto.cs new file mode 100644 index 00000000..b7e7901e --- /dev/null +++ b/Myshipping.Application/Service/BookingOrder/Dto/BookingLogDataDto.cs @@ -0,0 +1,25 @@ +using Myshipping.Application.Service.BookingOrder.Dto; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application +{ + /// + /// 订舱日志 + /// + public class BookingLogDataDto + { + /// + /// 货运动态日志 + /// + public List statuslog { get; set; } + + /// + /// 订舱操作日志 + /// + public List log { get; set; } + } +} diff --git a/Myshipping.Application/Service/BookingOrder/IBookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/IBookingOrderService.cs index 840d675c..7ac579aa 100644 --- a/Myshipping.Application/Service/BookingOrder/IBookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/IBookingOrderService.cs @@ -77,5 +77,7 @@ namespace Myshipping.Application Task AutoYardData(long bookId); + + } } \ No newline at end of file diff --git a/Myshipping.Application/Service/BookingOrder/IBookingValueAddedService.cs b/Myshipping.Application/Service/BookingOrder/IBookingValueAddedService.cs index ce6848f2..456e4b05 100644 --- a/Myshipping.Application/Service/BookingOrder/IBookingValueAddedService.cs +++ b/Myshipping.Application/Service/BookingOrder/IBookingValueAddedService.cs @@ -73,5 +73,19 @@ namespace Myshipping.Application /// 规则意见详情 /// 返回回执 Task GetRuleOpinionLog(RulesEngineUserFeedBackDto model); + + /// + /// 获取订舱数据接口 备注 、 文件 、服务项目 + /// + /// 订舱ID + /// 返回服务状态列表 + Task GetAllDataVNTWO(long bookingId); + + /// + /// 获取订舱数据接口 日志、状态日志 + /// + /// 订舱ID + /// 返回日志详情 + Task GetAllLogDataVNTWO(long bookingId); } }