接口优化

optimize
wet 2 years ago
parent 4fd0cdbb1d
commit f6d7013bfb

@ -285,7 +285,7 @@ namespace Myshipping.Application
.WhereIF(!string.IsNullOrWhiteSpace(input.CUSTSERVICEID), u => u.CUSTSERVICEID == input.CUSTSERVICEID)
.WhereIF(!string.IsNullOrWhiteSpace(input.CUSTSERVICE), u => u.CUSTSERVICE.Contains(input.CUSTSERVICE))
.WhereIF(!string.IsNullOrWhiteSpace(input.CUSTOMERNAME), u => u.CUSTOMERNAME.Contains(input.CUSTOMERNAME))
.WhereIF( input.CUSTOMERID != null && input.CUSTOMERID != 0, u => u.CUSTOMERID == input.CUSTOMERID)
.WhereIF(input.CUSTOMERID != null && input.CUSTOMERID != 0, u => u.CUSTOMERID == input.CUSTOMERID)
.WhereIF(!string.IsNullOrWhiteSpace(input.FORWARDER), u => u.FORWARDER.Contains(input.FORWARDER))
.WhereIF(!string.IsNullOrWhiteSpace(input.CUSTSERVICE), u => u.CUSTSERVICE == input.CUSTSERVICE)
.WhereIF(!string.IsNullOrWhiteSpace(input.CUSTOMERNAME), u => u.CUSTOMERNAME == input.CUSTOMERNAME)
@ -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))
{
@ -3398,20 +3399,20 @@ namespace Myshipping.Application
//优先取订舱的EDI附属信息为空取FTP配置
primaryModel.EDIATTN = ediExtModel.EDIAttn;
if(string.IsNullOrWhiteSpace(primaryModel.EDIATTN))
if (string.IsNullOrWhiteSpace(primaryModel.EDIATTN))
{
primaryModel.EDIATTN = ftpSet.SENDATTN;
}
primaryModel.EDIATTNTEL = ediExtModel.EDIAttnTel;
if(string.IsNullOrWhiteSpace(primaryModel.EDIATTNTEL))
if (string.IsNullOrWhiteSpace(primaryModel.EDIATTNTEL))
{
primaryModel.EDIATTNTEL = ftpSet.SENDTEL;
}
primaryModel.EDIATTNEMAIL = ediExtModel.EDIAttnMail;
if(string.IsNullOrWhiteSpace(primaryModel.EDIATTNEMAIL))
if (string.IsNullOrWhiteSpace(primaryModel.EDIATTNEMAIL))
{
primaryModel.EDIATTNEMAIL = ftpSet.SENDEMAIL;
}
@ -3541,7 +3542,7 @@ namespace Myshipping.Application
bool isSendEmail = false;
//是订舱并且FTP配置了订舱接收邮箱则触发邮箱发送
if(ftpSet.SendType.Equals("SO",StringComparison.OrdinalIgnoreCase)
if (ftpSet.SendType.Equals("SO", StringComparison.OrdinalIgnoreCase)
&& model.sendType.Equals("B", StringComparison.OrdinalIgnoreCase)
&& !string.IsNullOrWhiteSpace(ftpSet.RECEIVEEMAIL))
{
@ -3591,7 +3592,7 @@ namespace Myshipping.Application
PId = logId,
Field = String.Empty,
OldValue = String.Empty,
NewValue = $"发送 {order.CARRIERID} EDI 类型={model.sendType} 通过{(isSendEmail?"":"FTP")} {(sendStatus.succ ? "":"")}",
NewValue = $"发送 {order.CARRIERID} EDI 类型={model.sendType} 通过{(isSendEmail ? "" : "FTP")} {(sendStatus.succ ? "" : "")}",
});
if (!sendStatus.succ)
@ -3759,14 +3760,14 @@ namespace Myshipping.Application
/// <param name="ediCfg">EDI配置</param>
/// <returns>返回回执</returns>
private async Task<CommonWebApiResult> InnerSendBookingOrClosingEDIToEmail(BookingOrder bookingOrder, string filePath,
string sendType, string emailTopic,DjyEdiSetting ediCfg)
string sendType, string emailTopic, DjyEdiSetting ediCfg)
{
CommonWebApiResult result = new CommonWebApiResult { succ = true };
var emailUrl = _cache.GetAllDictData().GetAwaiter().GetResult()
.FirstOrDefault(x => x.TypeCode == "url_set" && x.Code == "email_api_url")?.Value;
if(emailUrl == null)
if (emailUrl == null)
throw Oops.Bah("字典未配置 url_set->email_api_url 请联系管理员");
List<EmailApiDto> emailList = new List<EmailApiDto>();
@ -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