You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
BookingHeChuan/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs

257 lines
20 KiB
C#

2 years ago
using Myshipping.Core;
using Furion.DependencyInjection;
using Furion.DynamicApiController;
using Mapster;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using System.Linq;
using System.Threading.Tasks;
using Myshipping.Application.Entity;
using Microsoft.AspNetCore.Authorization;
using Furion;
using Microsoft.AspNetCore.Http;
using Furion.DataEncryption;
using System.Collections.Generic;
2 years ago
namespace Magic.Application
{
/// <summary>
/// 订舱主表服务
/// </summary>
[ApiDescriptionSettings("Application", Name = "BookingOrder", Order = 1)]
2 years ago
public class BookingOrderService : IBookingOrderService, IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<BookingOrder> _rep;
public BookingOrderService(SqlSugarRepository<BookingOrder> rep)
{
_rep = rep;
}
/// <summary>
/// 分页查询订舱主表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet("/BookingOrder/page")]
public async Task<dynamic> Page([FromQuery] BookingOrderInput input)
{
var entities = await _rep.AsQueryable()
.WhereIF(!string.IsNullOrWhiteSpace(input.BSSTATUS), u => u.BSSTATUS == input.BSSTATUS)
.WhereIF(!string.IsNullOrWhiteSpace(input.MBLNO), u => u.MBLNO == input.MBLNO)
.WhereIF(!string.IsNullOrWhiteSpace(input.HBLNO), u => u.HBLNO == input.HBLNO)
.WhereIF(!string.IsNullOrWhiteSpace(input.BOOKINGNO), u => u.BOOKINGNO == input.BOOKINGNO)
.WhereIF(!string.IsNullOrWhiteSpace(input.CONTRACTNO), u => u.CONTRACTNO == input.CONTRACTNO)
.WhereIF(!string.IsNullOrWhiteSpace(input.SERVICECONTRACTNO), u => u.SERVICECONTRACTNO == input.SERVICECONTRACTNO)
.WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPER), u => u.SHIPPER == input.SHIPPER)
.WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEE), u => u.CONSIGNEE == input.CONSIGNEE)
.WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTY), u => u.NOTIFYPARTY == input.NOTIFYPARTY)
.WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTY2), u => u.NOTIFYPARTY2 == input.NOTIFYPARTY2)
.WhereIF(!string.IsNullOrWhiteSpace(input.YARDID), u => u.YARDID == input.YARDID)
.WhereIF(!string.IsNullOrWhiteSpace(input.YARD), u => u.YARD == input.YARD)
.WhereIF(!string.IsNullOrWhiteSpace(input.VESSELID), u => u.VESSELID == input.VESSELID)
.WhereIF(!string.IsNullOrWhiteSpace(input.VESSEL), u => u.VESSEL == input.VESSEL)
.WhereIF(!string.IsNullOrWhiteSpace(input.VOYNO), u => u.VOYNO == input.VOYNO)
.WhereIF(!string.IsNullOrWhiteSpace(input.VOYNOINNER), u => u.VOYNOINNER == input.VOYNOINNER)
.WhereIF(!string.IsNullOrWhiteSpace(input.PLACERECEIPT), u => u.PLACERECEIPT == input.PLACERECEIPT)
.WhereIF(!string.IsNullOrWhiteSpace(input.PORTLOAD), u => u.PORTLOAD == input.PORTLOAD)
.WhereIF(!string.IsNullOrWhiteSpace(input.PORTDISCHARGE), u => u.PORTDISCHARGE == input.PORTDISCHARGE)
.WhereIF(!string.IsNullOrWhiteSpace(input.PLACEDELIVERY), u => u.PLACEDELIVERY == input.PLACEDELIVERY)
.WhereIF(!string.IsNullOrWhiteSpace(input.DESTINATION), u => u.DESTINATION == input.DESTINATION)
.WhereIF(!string.IsNullOrWhiteSpace(input.NOBILL), u => u.NOBILL == input.NOBILL)
.WhereIF(!string.IsNullOrWhiteSpace(input.COPYNOBILLL), u => u.COPYNOBILLL == input.COPYNOBILLL)
.WhereIF(!string.IsNullOrWhiteSpace(input.ISSUETYPE), u => u.ISSUETYPE == input.ISSUETYPE)
.WhereIF(!string.IsNullOrWhiteSpace(input.ISSUEPLACE), u => u.ISSUEPLACE == input.ISSUEPLACE)
.WhereIF(!string.IsNullOrWhiteSpace(input.BLFRT), u => u.BLFRT == input.BLFRT)
.WhereIF(!string.IsNullOrWhiteSpace(input.PREPARDAT), u => u.PREPARDAT == input.PREPARDAT)
.WhereIF(!string.IsNullOrWhiteSpace(input.PAYABLEAT), u => u.PAYABLEAT == input.PAYABLEAT)
.WhereIF(!string.IsNullOrWhiteSpace(input.SERVICE), u => u.SERVICE == input.SERVICE)
.WhereIF(!string.IsNullOrWhiteSpace(input.MARKS), u => u.MARKS == input.MARKS)
.WhereIF(!string.IsNullOrWhiteSpace(input.HSCODE), u => u.HSCODE == input.HSCODE)
.WhereIF(!string.IsNullOrWhiteSpace(input.DESCRIPTION), u => u.DESCRIPTION == input.DESCRIPTION)
.WhereIF(!string.IsNullOrWhiteSpace(input.KINDPKGS), u => u.KINDPKGS == input.KINDPKGS)
.WhereIF(!string.IsNullOrWhiteSpace(input.CNTRTOTAL), u => u.CNTRTOTAL == input.CNTRTOTAL)
.WhereIF(!string.IsNullOrWhiteSpace(input.CARRIERID), u => u.CARRIERID == input.CARRIERID)
.WhereIF(!string.IsNullOrWhiteSpace(input.CARRIER), u => u.CARRIER == input.CARRIER)
.WhereIF(!string.IsNullOrWhiteSpace(input.CARGOID), u => u.CARGOID == input.CARGOID)
.WhereIF(!string.IsNullOrWhiteSpace(input.DCLASS), u => u.DCLASS == input.DCLASS)
.WhereIF(!string.IsNullOrWhiteSpace(input.DUNNO), u => u.DUNNO == input.DUNNO)
.WhereIF(!string.IsNullOrWhiteSpace(input.DPAGE), u => u.DPAGE == input.DPAGE)
.WhereIF(!string.IsNullOrWhiteSpace(input.DLABEL), u => u.DLABEL == input.DLABEL)
.WhereIF(!string.IsNullOrWhiteSpace(input.LINKMAN), u => u.LINKMAN == input.LINKMAN)
.WhereIF(!string.IsNullOrWhiteSpace(input.TEMPID), u => u.TEMPID == input.TEMPID)
.WhereIF(!string.IsNullOrWhiteSpace(input.TEMPSET), u => u.TEMPSET == input.TEMPSET)
.WhereIF(!string.IsNullOrWhiteSpace(input.REEFERF), u => u.REEFERF == input.REEFERF)
.WhereIF(!string.IsNullOrWhiteSpace(input.HUMIDITY), u => u.HUMIDITY == input.HUMIDITY)
.WhereIF(!string.IsNullOrWhiteSpace(input.TEMPMIN), u => u.TEMPMIN == input.TEMPMIN)
.WhereIF(!string.IsNullOrWhiteSpace(input.TEMPMAX), u => u.TEMPMAX == input.TEMPMAX)
//.WhereIF(!input.ISCONTAINERSOC, u => u.ISCONTAINERSOC == input.ISCONTAINERSOC)
.WhereIF(!string.IsNullOrWhiteSpace(input.SOREMARK), u => u.SOREMARK == input.SOREMARK)
.WhereIF(!string.IsNullOrWhiteSpace(input.SIREMARK), u => u.SIREMARK == input.SIREMARK)
.WhereIF(!string.IsNullOrWhiteSpace(input.YARDREMARK), u => u.YARDREMARK == input.YARDREMARK)
.WhereIF(!string.IsNullOrWhiteSpace(input.COMPID), u => u.COMPID == input.COMPID)
.WhereIF(!string.IsNullOrWhiteSpace(input.COMPNAME), u => u.COMPNAME == input.COMPNAME)
.WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERNAME), u => u.SHIPPERNAME == input.SHIPPERNAME)
.WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERADDR1), u => u.SHIPPERADDR1 == input.SHIPPERADDR1)
.WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERADDR2), u => u.SHIPPERADDR2 == input.SHIPPERADDR2)
.WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERADDR3), u => u.SHIPPERADDR3 == input.SHIPPERADDR3)
.WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERCITY), u => u.SHIPPERCITY == input.SHIPPERCITY)
.WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERPROVINCE), u => u.SHIPPERPROVINCE == input.SHIPPERPROVINCE)
.WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERPOSTCODE), u => u.SHIPPERPOSTCODE == input.SHIPPERPOSTCODE)
.WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERCOUNTRY), u => u.SHIPPERCOUNTRY == input.SHIPPERCOUNTRY)
.WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERATTN), u => u.SHIPPERATTN == input.SHIPPERATTN)
.WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERTEL), u => u.SHIPPERTEL == input.SHIPPERTEL)
.WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEENAME), u => u.CONSIGNEENAME == input.CONSIGNEENAME)
.WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEEADDR1), u => u.CONSIGNEEADDR1 == input.CONSIGNEEADDR1)
.WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEEADDR2), u => u.CONSIGNEEADDR2 == input.CONSIGNEEADDR2)
.WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEEADDR3), u => u.CONSIGNEEADDR3 == input.CONSIGNEEADDR3)
.WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEECITY), u => u.CONSIGNEECITY == input.CONSIGNEECITY)
.WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEEPROVINCE), u => u.CONSIGNEEPROVINCE == input.CONSIGNEEPROVINCE)
.WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEEPOSTCODE), u => u.CONSIGNEEPOSTCODE == input.CONSIGNEEPOSTCODE)
.WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEERCOUNTRY), u => u.CONSIGNEERCOUNTRY == input.CONSIGNEERCOUNTRY)
.WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEEATTN), u => u.CONSIGNEEATTN == input.CONSIGNEEATTN)
.WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEETEL), u => u.CONSIGNEETEL == input.CONSIGNEETEL)
.WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTYNAME), u => u.NOTIFYPARTYNAME == input.NOTIFYPARTYNAME)
.WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTYADDR1), u => u.NOTIFYPARTYADDR1 == input.NOTIFYPARTYADDR1)
.WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTYADDR2), u => u.NOTIFYPARTYADDR2 == input.NOTIFYPARTYADDR2)
.WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTYADDR3), u => u.NOTIFYPARTYADDR3 == input.NOTIFYPARTYADDR3)
.WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTYCITY), u => u.NOTIFYPARTYCITY == input.NOTIFYPARTYCITY)
.WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTYPROVINCE), u => u.NOTIFYPARTYPROVINCE == input.NOTIFYPARTYPROVINCE)
.WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTYPOSTCODE), u => u.NOTIFYPARTYPOSTCODE == input.NOTIFYPARTYPOSTCODE)
.WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTYCOUNTRY), u => u.NOTIFYPARTYCOUNTRY == input.NOTIFYPARTYCOUNTRY)
.WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTYATTN), u => u.NOTIFYPARTYATTN == input.NOTIFYPARTYATTN)
.WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTYTEL), u => u.NOTIFYPARTYTEL == input.NOTIFYPARTYTEL)
.WhereIF(!string.IsNullOrWhiteSpace(input.PONO), u => u.PONO == input.PONO)
.WhereIF(!string.IsNullOrWhiteSpace(input.OPID), u => u.OPID == input.OPID)
.WhereIF(!string.IsNullOrWhiteSpace(input.DOCID), u => u.DOCID == input.DOCID)
.WhereIF(!string.IsNullOrWhiteSpace(input.OP), u => u.OP == input.OP)
.WhereIF(!string.IsNullOrWhiteSpace(input.DOC), u => u.DOC == input.DOC)
.WhereIF(!string.IsNullOrWhiteSpace(input.SALEID), u => u.SALEID == input.SALEID)
.WhereIF(!string.IsNullOrWhiteSpace(input.SALE), u => u.SALE == input.SALE)
.WhereIF(!string.IsNullOrWhiteSpace(input.CUSTSERVICEID), u => u.CUSTSERVICEID == input.CUSTSERVICEID)
.WhereIF(!string.IsNullOrWhiteSpace(input.CUSTSERVICE), u => u.CUSTSERVICE == input.CUSTSERVICE)
.WhereIF(!string.IsNullOrWhiteSpace(input.CUSTOMERNAME), u => u.CUSTOMERNAME == input.CUSTOMERNAME)
.WhereIF(!string.IsNullOrWhiteSpace(input.FORWARDER), u => u.FORWARDER == input.FORWARDER)
.WhereIF(!string.IsNullOrWhiteSpace(input.SHIPAGENCY), u => u.SHIPAGENCY == input.SHIPAGENCY)
.WhereIF(!string.IsNullOrWhiteSpace(input.CUSTOMSER), u => u.CUSTOMSER == input.CUSTOMSER)
.WhereIF(!string.IsNullOrWhiteSpace(input.TRUCKER), u => u.TRUCKER == input.TRUCKER)
.WhereIF(!string.IsNullOrWhiteSpace(input.AGENTID), u => u.AGENTID == input.AGENTID)
.WhereIF(!string.IsNullOrWhiteSpace(input.CUSTOMERID), u => u.CUSTOMERID == input.CUSTOMERID)
.WhereIF(!string.IsNullOrWhiteSpace(input.FORWARDERID), u => u.FORWARDERID == input.FORWARDERID)
.WhereIF(!string.IsNullOrWhiteSpace(input.SHIPAGENCYID), u => u.SHIPAGENCYID == input.SHIPAGENCYID)
.WhereIF(!string.IsNullOrWhiteSpace(input.CUSTOMSERID), u => u.CUSTOMSERID == input.CUSTOMSERID)
.WhereIF(!string.IsNullOrWhiteSpace(input.TRUCKERID), u => u.TRUCKERID == input.TRUCKERID)
.WhereIF(!string.IsNullOrWhiteSpace(input.AGENTNAME), u => u.AGENTNAME == input.AGENTNAME)
.WhereIF(!string.IsNullOrWhiteSpace(input.WEITUO), u => u.WEITUO == input.WEITUO)
.WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEEDOORADDR), u => u.CONSIGNEEDOORADDR == input.CONSIGNEEDOORADDR)
.WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERDOORADDR), u => u.SHIPPERDOORADDR == input.SHIPPERDOORADDR)
.WhereIF(!string.IsNullOrWhiteSpace(input.SCACCODE), u => u.SCACCODE == input.SCACCODE)
.WhereIF(!string.IsNullOrWhiteSpace(input.ITNCODE), u => u.ITNCODE == input.ITNCODE)
.WhereIF(!string.IsNullOrWhiteSpace(input.PREPARDATID), u => u.PREPARDATID == input.PREPARDATID)
.WhereIF(!string.IsNullOrWhiteSpace(input.PAYABLEATID), u => u.PAYABLEATID == input.PAYABLEATID)
.WhereIF(!string.IsNullOrWhiteSpace(input.CUSTNO), u => u.CUSTNO == input.CUSTNO)
.WhereIF(!string.IsNullOrWhiteSpace(input.TRANSPORTID), u => u.TRANSPORTID == input.TRANSPORTID)
.WhereIF(!string.IsNullOrWhiteSpace(input.TRANSPORT), u => u.TRANSPORT == input.TRANSPORT)
.WhereIF(!string.IsNullOrWhiteSpace(input.THIRDPAYADDR), u => u.THIRDPAYADDR == input.THIRDPAYADDR)
.WhereIF(!string.IsNullOrWhiteSpace(input.YARDCONTRACTTEL), u => u.YARDCONTRACTTEL == input.YARDCONTRACTTEL)
.WhereIF(!string.IsNullOrWhiteSpace(input.YARDCONTRACTEMAIL), u => u.YARDCONTRACTEMAIL == input.YARDCONTRACTEMAIL)
.WhereIF(!string.IsNullOrWhiteSpace(input.LANECODE), u => u.LANECODE == input.LANECODE)
.WhereIF(!string.IsNullOrWhiteSpace(input.LANENAME), u => u.LANENAME == input.LANENAME)
.WhereIF(!string.IsNullOrWhiteSpace(input.FREIGHTPAYER), u => u.FREIGHTPAYER == input.FREIGHTPAYER)
.ToPagedListAsync(input.PageNo, input.PageSize);
return entities.XnPagedResult();
}
/// <summary>
/// 增加订舱主表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("/BookingOrder/add")]
public async Task Add(AddBookingOrderInput input)
{
var entity = input.Adapt<BookingOrder>();
await _rep.InsertAsync(entity);
}
/// <summary>
/// 删除订舱主表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("/BookingOrder/delete")]
public async Task Delete(DeleteBookingOrderInput input)
{
var entity = await _rep.FirstOrDefaultAsync(u => u.Id == input.Id);
await _rep.DeleteAsync(entity);
}
/// <summary>
/// 更新订舱主表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("/BookingOrder/edit")]
public async Task Update(UpdateBookingOrderInput input)
{
var entity = input.Adapt<BookingOrder>();
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
2 years ago
}
/// <summary>
/// 获取订舱主表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet("/BookingOrder/detail")]
public async Task<BookingOrder> Get([FromQuery] QueryeBookingOrderInput input)
{
return await _rep.FirstOrDefaultAsync(u => u.Id == input.Id);
}
/// <summary>
///
2 years ago
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[AllowAnonymous]
[HttpGet("/BookingOrder/updata")]
public async Task<dynamic> Updata()
{
var accessToken = JWTEncryption.Encrypt(new Dictionary<string, object>
{
{ClaimConst.CLAINM_USERID, 111},
{ClaimConst.TENANT_ID, 10},
{ClaimConst.CLAINM_ACCOUNT, "admin"},
{ClaimConst.CLAINM_NAME, "管理员"},
{ClaimConst.CLAINM_SUPERADMIN, AdminType.Admin},
{ ClaimConst.CLAINM_TENANT_TYPE, TenantTypeEnum.SYSTEM },
{ ClaimConst.CLAINM_TENANT_NAME, "测试" },
});
var httpContext = App.GetService<IHttpContextAccessor>().HttpContext;
httpContext.SigninToSwagger(accessToken);
return Task.Run(() =>
{
return $"当前用户:{UserManager.Name}";
});
}
[AllowAnonymous]
[HttpGet("/BookingOrder/test")]
public async Task<dynamic> Test(string str, bool encrpyt = true)
2 years ago
{
var keyDES = App.GetOptions<EncryptKeyOptions>().DES;
if (encrpyt)
{
return $"{keyDES} {DESCEncryption.Encrypt(str, keyDES)}";
}
else
{
return DESCEncryption.Decrypt(str, keyDES);
}
2 years ago
}
}
}