booking_auth_dev
wet 2 years ago
commit 41a8b96344

@ -1163,6 +1163,7 @@ namespace Myshipping.Application
throw Oops.Bah(BookingErrorCode.BOOK001);
}
_logger.LogInformation($"查找模板bookingId-{bookingId} TenantId-{order.TenantId}");
var printTemplate = await _repPrintTemplate.AsQueryable().Filter(null, true).FirstAsync(x => x.TenantId == order.TenantId && x.TypeCode == typeCode);
if (printTemplate == null)
{
@ -1177,6 +1178,7 @@ namespace Myshipping.Application
}
var fileAbsPath = Path.Combine(dirAbs, printTemplate.FilePath);
_logger.LogInformation($"查找模板文件:{fileAbsPath}");
if (!File.Exists(fileAbsPath))
{
throw Oops.Bah(BookingErrorCode.BOOK115);

@ -19,6 +19,8 @@ using Furion.DistributedIDGenerator;
using Mapster;
using Furion.DataValidation;
using Newtonsoft.Json.Linq;
using Myshipping.Core.Service;
using Myshipping.Core.Entity;
namespace Myshipping.Application
{
@ -31,17 +33,20 @@ namespace Myshipping.Application
private readonly SqlSugarRepository<BookingOrder> _bookingOrderRepository;
private readonly SqlSugarRepository<BookingCtn> _bookingOrderContaRepository;
private readonly SqlSugarRepository<BookingCtnDetail> _bookingOrderContaCargoRepository;
private readonly ISysCacheService _cache;
/// <summary>
///
/// </summary>
public RulesEngineClientService(SqlSugarRepository<BookingOrder> bookingOrderRepository,
SqlSugarRepository<BookingCtn> bookingOrderContaRepository,
SqlSugarRepository<BookingCtnDetail> bookingOrderContaCargoRepository)
SqlSugarRepository<BookingCtnDetail> bookingOrderContaCargoRepository,
ISysCacheService cache)
{
_bookingOrderRepository = bookingOrderRepository;
_bookingOrderContaRepository = bookingOrderContaRepository;
_bookingOrderContaCargoRepository = bookingOrderContaCargoRepository;
_cache = cache;
}
#region 海运订舱请求规则引擎校验
@ -244,6 +249,27 @@ namespace Myshipping.Application
msgModel.Main.BusinessInfo = model.Adapt<RulesEngineOrderBookingMainBusinessInfo>();
//根据卸货港翻译航线信息
if(!string.IsNullOrWhiteSpace(model.PORTDISCHARGEID))
{
var laneList = _cache.GetAllRelaPortCarrierLane().GetAwaiter().GetResult();
var laneInfo = laneList
.FirstOrDefault(p => !string.IsNullOrWhiteSpace(model.CARRIER) && !string.IsNullOrWhiteSpace(p.CarrierCode) &&
p.CarrierCode.Equals(model.CARRIER, StringComparison.OrdinalIgnoreCase) && p.PortCode.Equals(model.PORTDISCHARGEID, StringComparison.OrdinalIgnoreCase));
if(laneInfo == null)
laneInfo = laneList.FirstOrDefault(p => string.IsNullOrWhiteSpace(p.CarrierCode) && p.PortCode.Equals(model.PORTDISCHARGEID, StringComparison.OrdinalIgnoreCase));
if (laneInfo != null)
{
var lineModel = _cache.GetAllCodeLane().GetAwaiter().GetResult().FirstOrDefault(t => t.Code.Equals(laneInfo.LaneCode, StringComparison.OrdinalIgnoreCase));
msgModel.Main.BusinessInfo.LaneCode = laneInfo.LaneCode;
msgModel.Main.BusinessInfo.LaneName = lineModel?.CnName;
}
}
var contaList = await _bookingOrderContaRepository.AsQueryable().Where(x => x.BILLID == model.Id).ToListAsync();
if (contaList.Count > 0)

@ -90,6 +90,16 @@ public class CommonConst
/// </summary>
public const string CACHE_KEY_COMMON_DB_FRT = "CommonDbFrt";
/// <summary>
/// 航线
/// </summary>
public const string CACHE_KEY_COMMON_DB_LANE= "CommonDbLane";
/// <summary>
/// 航线与港口的的关系
/// </summary>
public const string CACHE_KEY_COMMON_DB_LANE_PORT = "CommonDbLanePort";
/// <summary>
/// 箱型映射
/// </summary>

@ -0,0 +1,40 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Core.Entity
{
[SugarTable("CodeLine")]
[Description("航线")]
public class CodeLane : CommonDbEntity
{
/// <summary>
/// 航线代码
/// </summary>
public string Code { get; set; }
/// <summary>
/// 航线类型 SEA-海运
/// </summary>
public string LaneType { get; set; }
/// <summary>
/// 航线英文名称
/// </summary>
public string EnName { get; set; }
/// <summary>
/// 航线中文名称
/// </summary>
public string CnName { get; set; }
/// <summary>
/// 描述
/// </summary>
public string Description { get; set; }
}
}

@ -0,0 +1,40 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Core.Entity
{
[SugarTable("RelaPortCarrierLine")]
[Description("航线与港口的的关系表")]
public class RelaPortCarrierLane : CommonDbEntity
{
/// <summary>
/// 航线代码
/// </summary>
public string LaneCode { get; set; }
/// <summary>
/// 船司代码
/// </summary>
public string CarrierCode { get; set; }
/// <summary>
/// 港口代码
/// </summary>
public string PortCode { get; set; }
/// <summary>
/// 模块(公用时为空字符串)
/// </summary>
public string Module { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
}
}

@ -89,6 +89,12 @@ namespace Myshipping.Core.Job
//系统参数
await App.GetService<ISysConfigService>().CacheData();
//航线
await App.GetService<ICommonDBService>().GetAllLane(true);
//航线与港口的的关系
await App.GetService<ICommonDBService>().GetAllRelaPortCarrierLane(true);
Log.Information($"缓存公共库完成 {DateTime.Now}");
}
}

@ -627,6 +627,16 @@
付费方式
</summary>
</member>
<member name="F:Myshipping.Core.CommonConst.CACHE_KEY_COMMON_DB_LANE">
<summary>
航线
</summary>
</member>
<member name="F:Myshipping.Core.CommonConst.CACHE_KEY_COMMON_DB_LANE_PORT">
<summary>
航线与港口的的关系
</summary>
</member>
<member name="F:Myshipping.Core.CommonConst.CACHE_KEY_COMMON_DB_MAPPING_CTN">
<summary>
箱型映射
@ -1062,6 +1072,31 @@
排序
</summary>
</member>
<member name="P:Myshipping.Core.Entity.CodeLane.Code">
<summary>
航线代码
</summary>
</member>
<member name="P:Myshipping.Core.Entity.CodeLane.LaneType">
<summary>
航线类型 SEA-海运
</summary>
</member>
<member name="P:Myshipping.Core.Entity.CodeLane.EnName">
<summary>
航线英文名称
</summary>
</member>
<member name="P:Myshipping.Core.Entity.CodeLane.CnName">
<summary>
航线中文名称
</summary>
</member>
<member name="P:Myshipping.Core.Entity.CodeLane.Description">
<summary>
描述
</summary>
</member>
<member name="P:Myshipping.Core.Entity.CodePackage.Code">
<summary>
代码
@ -1472,6 +1507,31 @@
描述
</summary>
</member>
<member name="P:Myshipping.Core.Entity.RelaPortCarrierLane.LaneCode">
<summary>
航线代码
</summary>
</member>
<member name="P:Myshipping.Core.Entity.RelaPortCarrierLane.CarrierCode">
<summary>
船司代码
</summary>
</member>
<member name="P:Myshipping.Core.Entity.RelaPortCarrierLane.PortCode">
<summary>
港口代码
</summary>
</member>
<member name="P:Myshipping.Core.Entity.RelaPortCarrierLane.Module">
<summary>
模块(公用时为空字符串)
</summary>
</member>
<member name="P:Myshipping.Core.Entity.RelaPortCarrierLane.Remark">
<summary>
备注
</summary>
</member>
<member name="T:Myshipping.Core.Entity.DBEntityTenant">
<summary>
自定义租户基类实体
@ -5844,6 +5904,18 @@
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.ISysCacheService.GetAllCodeLane">
<summary>
获取公共库 航线
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.ISysCacheService.GetAllRelaPortCarrierLane">
<summary>
设置公共库 航线与港口的的关系表
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.ISysCacheService.GetAllMappingCtn">
<summary>
获取公共库 箱型映射
@ -6024,6 +6096,18 @@
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.ISysCacheService.SetAllCodeLane(System.Collections.Generic.List{Myshipping.Core.Entity.CodeLane})">
<summary>
设置公共库 航线
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.ISysCacheService.SetAllRelaPortCarrierLane(System.Collections.Generic.List{Myshipping.Core.Entity.RelaPortCarrierLane})">
<summary>
设置公共库 航线与港口的的关系表
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.ISysCacheService.GetAllTenantParam">
<summary>
获取租户参数
@ -6310,6 +6394,18 @@
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.SysCacheService.GetAllCodeLane">
<summary>
获取公共库 航线
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.SysCacheService.GetAllRelaPortCarrierLane">
<summary>
设置公共库 航线与港口的的关系表
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.SysCacheService.GetAllMappingCtn">
<summary>
获取公共库 箱型映射
@ -6400,6 +6496,18 @@
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.SysCacheService.SetAllCodeLane(System.Collections.Generic.List{Myshipping.Core.Entity.CodeLane})">
<summary>
设置公共库 航线
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.SysCacheService.SetAllRelaPortCarrierLane(System.Collections.Generic.List{Myshipping.Core.Entity.RelaPortCarrierLane})">
<summary>
设置公共库 航线与港口的的关系表
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.SysCacheService.SetAllMappingCtn(System.Collections.Generic.List{Myshipping.Core.Entity.MappingCtn})">
<summary>
设置公共库 箱型映射
@ -7252,6 +7360,13 @@
获取模块信息
</summary>
</member>
<member name="M:Myshipping.Core.Service.CommonDBService.GetAllLane(System.Boolean)">
<summary>
获取航线信息
</summary>
<param name="flag"></param>
<returns></returns>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.CodeCarrierDto.Code">
<summary>
代码
@ -7961,6 +8076,18 @@
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.ICommonDBService.GetAllLane(System.Boolean)">
<summary>
航线
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.ICommonDBService.GetAllRelaPortCarrierLane(System.Boolean)">
<summary>
航线与港口的的关系
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.ICommonDBService.GetAllMappingFrt(System.Boolean)">
<summary>
付费方式映射

@ -97,6 +97,18 @@ public interface ISysCacheService
/// <returns></returns>
Task<List<CodeFrt>> GetAllCodeFrt();
/// <summary>
/// 获取公共库 航线
/// </summary>
/// <returns></returns>
Task<List<CodeLane>> GetAllCodeLane();
/// <summary>
/// 设置公共库 航线与港口的的关系表
/// </summary>
/// <returns></returns>
Task<List<RelaPortCarrierLane>> GetAllRelaPortCarrierLane();
/// <summary>
/// 获取公共库 箱型映射
/// </summary>
@ -273,6 +285,19 @@ public interface ISysCacheService
/// </summary>
/// <returns></returns>
Task SetAllCodeIssueType(List<CodeIssueType> list);
/// <summary>
/// 设置公共库 航线
/// </summary>
/// <returns></returns>
Task SetAllCodeLane(List<CodeLane> list);
/// <summary>
/// 设置公共库 航线与港口的的关系表
/// </summary>
/// <returns></returns>
Task SetAllRelaPortCarrierLane(List<RelaPortCarrierLane> list);
#endregion
#region DJY

@ -387,6 +387,24 @@ public class SysCacheService : ISysCacheService, IDynamicApiController, ISinglet
return _cache.GetAsync<List<CodeFrt>>(CommonConst.CACHE_KEY_COMMON_DB_FRT);
}
/// <summary>
/// 获取公共库 航线
/// </summary>
/// <returns></returns>
public Task<List<CodeLane>> GetAllCodeLane()
{
return _cache.GetAsync<List<CodeLane>>(CommonConst.CACHE_KEY_COMMON_DB_LANE);
}
/// <summary>
/// 设置公共库 航线与港口的的关系表
/// </summary>
/// <returns></returns>
public Task<List<RelaPortCarrierLane>> GetAllRelaPortCarrierLane()
{
return _cache.GetAsync<List<RelaPortCarrierLane>>(CommonConst.CACHE_KEY_COMMON_DB_LANE_PORT);
}
/// <summary>
/// 获取公共库 箱型映射
/// </summary>
@ -526,6 +544,25 @@ public class SysCacheService : ISysCacheService, IDynamicApiController, ISinglet
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_FRT, list);
}
/// <summary>
/// 设置公共库 航线
/// </summary>
/// <returns></returns>
public Task SetAllCodeLane(List<CodeLane> list)
{
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_LANE, list);
}
/// <summary>
/// 设置公共库 航线与港口的的关系表
/// </summary>
/// <returns></returns>
public Task SetAllRelaPortCarrierLane(List<RelaPortCarrierLane> list)
{
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_LANE_PORT, list);
}
/// <summary>
/// 设置公共库 箱型映射
/// </summary>

@ -44,6 +44,8 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
private readonly SqlSugarRepository<CodeIssueType> _codeIssueTypeRep;
private readonly SqlSugarRepository<CommonModule> _commonModuleRep;
private readonly ILogger<CommonDBService> _logger;
private readonly SqlSugarRepository<CodeLane> _codeLaneRep;
private readonly SqlSugarRepository<RelaPortCarrierLane> _relaPortCarrierLaneRep;
public CommonDBService(SqlSugarRepository<CodeCarrier> codeCarrierRep,
SqlSugarRepository<CodeVessel> codeVesselRep,
SqlSugarRepository<CodeForwarder> codeForwarderRep,
@ -66,7 +68,9 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
SqlSugarRepository<CodeIssueType> codeIssueTypeRep,
SqlSugarRepository<CommonModule> commonModuleRep,
ILogger<CommonDBService> logger,
ISysCacheService sysCacheService)
ISysCacheService sysCacheService,
SqlSugarRepository<CodeLane> codeLaneRep,
SqlSugarRepository<RelaPortCarrierLane> relaPortCarrierLaneRep)
{
_codeCarrierRep = codeCarrierRep;
_codeVesselRep = codeVesselRep;
@ -91,7 +95,8 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
_codeIssueTypeRep = codeIssueTypeRep;
_commonModuleRep = commonModuleRep;
_logger = logger;
_codeLaneRep = codeLaneRep;
_relaPortCarrierLaneRep = relaPortCarrierLaneRep;
}
#endregion
@ -1257,6 +1262,52 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
}
/// <summary>
/// 获取航线信息
/// </summary>
/// <param name="flag"></param>
/// <returns></returns>
[NonAction]
public async Task GetAllLane(bool flag = false)
{
if (flag)
{
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_LANE))
{
var list = await _codeLaneRep.ToListAsync();
await _sysCacheService.SetAllCodeLane(list);
}
}
else
{
var list = await _codeLaneRep.ToListAsync();
await _sysCacheService.SetAllCodeLane(list);
}
}
[NonAction]
public async Task GetAllRelaPortCarrierLane(bool flag = false)
{
if (flag)
{
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_LANE_PORT))
{
var list = await _relaPortCarrierLaneRep.ToListAsync();
await _sysCacheService.SetAllRelaPortCarrierLane(list);
}
}
else
{
var list = await _relaPortCarrierLaneRep.ToListAsync();
await _sysCacheService.SetAllRelaPortCarrierLane(list);
}
}
[NonAction]
public async Task GetAllMappingCtn(bool flag = false)
{

@ -92,6 +92,18 @@ public interface ICommonDBService
/// <returns></returns>
Task GetAllFrt(bool flag);
/// <summary>
/// 航线
/// </summary>
/// <returns></returns>
Task GetAllLane(bool flag);
/// <summary>
/// 航线与港口的的关系
/// </summary>
/// <returns></returns>
Task GetAllRelaPortCarrierLane(bool flag);
/// <summary>
/// 付费方式映射
/// </summary>

@ -17,6 +17,8 @@ namespace Myshipping.Report.Controllers
{
public class ReportController : Controller
{
private readonly NLog.Logger log = NLog.LogManager.GetCurrentClassLogger();
private SqlSugar.SqlSugarClient sqlSugarClient;
public ReportController()
@ -59,6 +61,8 @@ namespace Myshipping.Report.Controllers
var tmpFile = Path.Combine(savePath, $"{Guid.NewGuid()}{fileExt}");
Request.Files[0].SaveAs(tmpFile);
log.Debug($"临时保存模板文件:{tmpFile}");
//生成报表
FastReport.Report report = new FastReport.Report();
report.Load(tmpFile);
@ -137,19 +141,25 @@ namespace Myshipping.Report.Controllers
[HttpGet]
public ActionResult BookingReportJson(long bookingId)
{
log.Debug("test");
return Content(GetBookingJson(bookingId));
}
[NonAction]
private string GetBookingJson(long bookingId)
{
log.Debug($"准备获取订舱数据:{bookingId}");
var order = sqlSugarClient.Queryable<BookingOrder>().First(x => x.Id == bookingId);
var ctns = sqlSugarClient.Queryable<BookingCtn>().Where(x => x.BILLID == bookingId).ToList();
return JsonConvert.SerializeObject(new
var strObj = JsonConvert.SerializeObject(new
{
order = order,
ctns = ctns
});
log.Debug($"订舱数据:{strObj}");
return strObj;
}
}
}

@ -15,6 +15,8 @@ namespace Myshipping.Report
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
}
}
}

@ -72,6 +72,9 @@
<Reference Include="MySql.Data, Version=8.0.31.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.8.0.31\lib\net452\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.5.0.5\lib\net46\NLog.dll</HintPath>
</Reference>
<Reference Include="SqlSugar, Version=5.1.3.30, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SqlSugar.5.1.3.30\lib\SqlSugar.dll</HintPath>
</Reference>
@ -82,6 +85,7 @@
<Reference Include="System.Configuration.Install" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Management" />
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
@ -208,6 +212,7 @@
<Content Include="booking_ctn.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="nlog.config" />
<None Include="packages.config" />
<Content Include="t2.frx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>

@ -22,6 +22,7 @@
<package id="Modernizr" version="2.8.3" targetFramework="net462" />
<package id="MySql.Data" version="8.0.31" targetFramework="net462" />
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net462" />
<package id="NLog" version="5.0.5" targetFramework="net462" />
<package id="Portable.BouncyCastle" version="1.9.0" targetFramework="net462" />
<package id="SqlSugar" version="5.1.3.30" targetFramework="net462" />
<package id="System.Buffers" version="4.5.1" targetFramework="net462" />

Loading…
Cancel
Save