zhangxiaofeng 8 months ago
commit fd28711b6f

@ -1,7 +1,9 @@
using Furion; using Furion;
using Myshipping.Application.Entity; using Myshipping.Application.Entity;
using Myshipping.Core; using Myshipping.Core;
using Myshipping.Core.Entity;
using Myshipping.Core.Service; using Myshipping.Core.Service;
using Newtonsoft.Json.Linq;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -20,21 +22,239 @@ namespace Myshipping.Application.EDI
var repCustOrder = App.GetService<SqlSugarRepository<BookingCustomerOrder>>(); var repCustOrder = App.GetService<SqlSugarRepository<BookingCustomerOrder>>();
var repOrder = App.GetService<SqlSugarRepository<BookingOrder>>(); var repOrder = App.GetService<SqlSugarRepository<BookingOrder>>();
var repCtn = App.GetService<SqlSugarRepository<BookingCtn>>(); var repCtn = App.GetService<SqlSugarRepository<BookingCtn>>();
var repCustomer = App.GetService<SqlSugarRepository<DjyCustomer>>();
var repContact = App.GetService<SqlSugarRepository<DjyCustomerContact>>();
var repTemplate = App.GetService<SqlSugarRepository<BookingSoTemplate>>();
var cache = App.GetService<ISysCacheService>();
var cacheService = App.GetService<ISysCacheService>(); var cacheService = App.GetService<ISysCacheService>();
var order = repOrder.FirstOrDefault(o => o.Id == bookingId); var order = await repOrder.AsQueryable().Filter(null, true).FirstAsync(o => o.Id == bookingId);
if (order == null) if (order == null)
{ {
return new KeyValuePair<bool, string>(false, "订舱信息未找到"); return new KeyValuePair<bool, string>(false, "订舱信息未找到");
} }
var custOrder = await repCustOrder.AsQueryable().Filter(null, true).FirstAsync(x => x.BookingId == order.Id);
if (custOrder == null)
{
return new KeyValuePair<bool, string>(false, "客户订舱信息未找到");
}
var sysConfigList = await cache.GetAllSysConfig();
var sCfgUserKey = sysConfigList.FirstOrDefault(x => x.Code == "ZhongYuanApiSpiderKey" && x.GroupCode == "DJY_CONST");
var sCfgUserSecret = sysConfigList.FirstOrDefault(x => x.Code == "ZhongYuanApiSpiderSecret" && x.GroupCode == "DJY_CONST");
if (sCfgUserKey == null || sCfgUserSecret == null)
{
return new KeyValuePair<bool, string>(false, "中远订舱API的KEY和密钥为配置请联系管理员");
}
BookingSoTemplate template = null;
DjyCustomerContact custContact = null;
//查找模板:
//1.根据客户订舱信息中的BookingUserId和BookingTenantId去客户信息中根据CustSysId查找客户公司及联系人员工信息
//2.根据找到的客户及联系人信息,查找中远订舱模板
if (custOrder.BookingUserId > 0 && custOrder.BookingTenantId > 0)
{
custContact = await repCustomer.AsQueryable()
.InnerJoin<DjyCustomerContact>((cust, contact) => cust.Id == contact.CustomerId)
.Where((cust, contact) => cust.CustSysId == custOrder.TenantId && contact.CustSysId == custOrder.BookingUserId)
.Select((cust, contact) => contact)
.SingleAsync();
if (custContact == null)
{
return new KeyValuePair<bool, string>(false, "未找到客户及联系人信息");
}
template = await repTemplate.AsQueryable().FirstAsync(x => x.CarrierId == order.CARRIERID && x.UserId == custContact.Id && x.IsEnable);
if (template == null)
{
return new KeyValuePair<bool, string>(false, "未找到订舱模板");
}
}
var mappingCtn = await cache.GetAllMappingCtn();
var mappingFrt = await cache.GetAllMappingFrt();
var mappingPortLoad = await cache.GetAllMappingPortLoad();
var mappingPort = await cache.GetAllMappingPort();
var postModel = new ZhongYuanSoApiModel();
postModel.userKey = sCfgUserKey.Value;
postModel.userSecret = sCfgUserSecret.Value;
if (!string.IsNullOrEmpty(custOrder.ExtendData))
{
var extObj = JObject.Parse(custOrder.ExtendData);
postModel.webAccount = extObj.GetStringValue("Account");
postModel.webPassword = extObj.GetStringValue("Password");
}
else
{
return new KeyValuePair<bool, string>(false, "未找到订舱账号信息");
}
postModel.uploadType = "DRAFT"; //DRAFT, TEMPLATE, BOOKING分别对应草稿, 模板, 订舱
postModel.saveName = template.TemplateName;
var mapPortLoad = mappingPortLoad.FirstOrDefault(x => x.Module == "DjyCustBooking" && x.CarrierCode == "COSCO" && x.Code == custOrder.PORTLOADCODE);
var mapPort = mappingPort.FirstOrDefault(x => x.Module == "DjyCustBooking" && x.CarrierCode == "COSCO" && x.Code == custOrder.PORTDISCHARGECODE);
if (mapPortLoad == null)
{
return new KeyValuePair<bool, string>(false, $"未找到起运港映射信息:{custOrder.PORTLOADCODE}");
}
if (mapPort == null)
{
return new KeyValuePair<bool, string>(false, $"未找到目的港映射信息:{custOrder.PORTDISCHARGECODE}");
}
postModel.routes = new ZhongYuanSoApiRoute()
{
originCity = mapPortLoad.MapCode,
destinationCity = mapPort.MapCode,
vesselName = custOrder.VESSEL,
voyageNumber = custOrder.VOYNO,
serviceCode = custOrder.LANECODE,
sailSchedulePriority = template.Priority.Split(',').ToList(),
};
#region 收发通及货代
postModel.shipperInfo = new ZhongYuanSoApiSFT()
{
firstName = template.ShipperFirstName,
lastName = template.ShipperLastName,
country = template.ShipperCountry,
state = template.ShipperProvince,
city = template.ShipperCity,
partyName = template.ShipperName,
addressDes = template.ShipperAddress,
phone = new ZhongYuanSoApiPhone() { countryCode = template.ShipperPhoneCountryCode, areaCode = template.ShipperPhoneCode, number = template.ShipperPhone },
postalCode = template.ShipperPostCode
};
postModel.consigneeInfo = new ZhongYuanSoApiSFT()
{
firstName = template.ConsigneeFirstName,
lastName = template.ConsigneeLastName,
country = template.ConsigneeCountry,
state = template.ConsigneeProvince,
city = template.ConsigneeCity,
partyName = template.ConsigneeName,
addressDes = template.ConsigneeAddress,
phone = new ZhongYuanSoApiPhone() { countryCode = template.ConsigneePhoneCountryCode, areaCode = template.ConsigneePhoneCode, number = template.ConsigneePhone },
postalCode = template.ConsigneePostCode
};
postModel.notifyInfo = new ZhongYuanSoApiSFT()
{
firstName = template.NotifypartFirstName,
lastName = template.NotifypartLastName,
country = template.NotifypartCountry,
state = template.NotifypartProvince,
city = template.NotifypartCity,
partyName = template.NotifypartName,
addressDes = template.NotifypartAddress,
phone = new ZhongYuanSoApiPhone() { countryCode = template.NotifypartPhoneCountryCode, areaCode = template.NotifypartPhoneCode, number = template.NotifypartPhone },
postalCode = template.NotifypartPostCode
};
postModel.forwarderInfo = new ZhongYuanSoApiSFT()
{
firstName = template.BookingFirstName,
lastName = template.BookingLastName,
country = template.BookingCountry,
state = template.BookingProvince,
city = template.BookingCity,
partyName = template.BookingName,
addressDes = template.BookingAddress,
phone = new ZhongYuanSoApiPhone() { countryCode = template.BookingPhoneCountryCode, areaCode = template.BookingPhoneCode, number = template.BookingPhone },
postalCode = template.BookingPostCode
};
#endregion
postModel.cargoInfo = new ZhongYuanSoApiCargoInfo()
{
cargoName = CargoIdZhongyuan(custOrder.CARGOID),
cargoDes = custOrder.DESCRIPTION,
hsCode = custOrder.HSCODE,
};
var ctns = await repCtn.AsQueryable().Where(x => x.BILLID == custOrder.Id).ToListAsync();
postModel.boxInfos = new List<ZhongYuanSoApiBoxInfo>();
foreach (var ctn in ctns)
{
if (!ctn.CTNNUM.HasValue || !ctn.KGS.HasValue)
{
return new KeyValuePair<bool, string>(false, $"所有箱的箱量和毛重都不能为空");
}
var mapCtn = mappingCtn.FirstOrDefault(x => x.Module == "DjyCustBooking" && x.CarrierCode == "COSCO" && x.Code == ctn.CTNCODE);
if (mapCtn == null)
{
return new KeyValuePair<bool, string>(false, $"未找箱型映射信息:{ctn.CTNCODE}");
}
var apiBox = new ZhongYuanSoApiBoxInfo()
{
boxType = mapCtn.MapCode,
boxNum = ctn.CTNNUM.Value,
weight = ctn.KGS.Value.ToString(),
weightUnit = "KGS"
};
postModel.boxInfos.Add(apiBox);
}
var mapFrt = mappingFrt.FirstOrDefault(x => x.Module == "DjyCustBooking" && x.CarrierCode == "COSCO" && x.Code == custOrder.FRTCODE);
if (mapFrt == null)
{
return new KeyValuePair<bool, string>(false, $"未找到付款方式映射信息:{custOrder.FRTCODE}");
}
postModel.rateInfos = new ZhongYuanSoApiRateInfo()
{
paymentMethod = mapFrt.MapCode
};
postModel.special = new ZhongYuanSoApiSpecial()
{
emailAddresses = custContact.Email,
remarksForEntireBooking = custOrder.SOREMARK
};
return new KeyValuePair<bool, string>(); return new KeyValuePair<bool, string>();
} }
/// <summary>
/// 获取中远货物类型
/// </summary>
/// <param name="cargoId"></param>
/// <returns></returns>
private static string CargoIdZhongyuan(string cargoId)
{
if (cargoId is "S")
{
return "General";
}
else if (cargoId is "R")
{
return "Reefer";
}
else if (cargoId is "D")
{
return "Dangerous";
} }
return null;
}
}
/// <summary>
/// 中远API订舱传输对象
/// </summary>
public class ZhongYuanSoApiModel public class ZhongYuanSoApiModel
{ {
/// <summary> /// <summary>
@ -80,24 +300,47 @@ namespace Myshipping.Application.EDI
/// <summary> /// <summary>
/// 发货人信息 /// 发货人信息
/// </summary> /// </summary>
public string shipperInfo { get; set; } public ZhongYuanSoApiSFT shipperInfo { get; set; }
/// <summary> /// <summary>
/// 收货人信息 /// 收货人信息
/// </summary> /// </summary>
public string consigneeInfo { get; set; } public ZhongYuanSoApiSFT consigneeInfo { get; set; }
/// <summary> /// <summary>
/// 通知人信息 /// 通知人信息
/// </summary> /// </summary>
public string notifyInfo { get; set; } public ZhongYuanSoApiSFT notifyInfo { get; set; }
/// <summary> /// <summary>
/// 货代信息 /// 货代信息
/// </summary> /// </summary>
public string forwarderInfo { get; set; } public ZhongYuanSoApiSFT forwarderInfo { get; set; }
/// <summary>
/// 货物信息
/// </summary>
public ZhongYuanSoApiCargoInfo cargoInfo { get; set; }
/// <summary>
/// 箱信息
/// </summary>
public List<ZhongYuanSoApiBoxInfo> boxInfos { get; set; }
/// <summary>
/// 费率相关信息
/// </summary>
public ZhongYuanSoApiRateInfo rateInfos { get; set; }
/// <summary>
/// 特殊要求及备注
/// </summary>
public ZhongYuanSoApiSpecial special { get; set; }
} }
/// <summary>
/// 路线信息
/// </summary>
public class ZhongYuanSoApiRoute public class ZhongYuanSoApiRoute
{ {
/// <summary> /// <summary>
@ -124,8 +367,16 @@ namespace Myshipping.Application.EDI
/// 航线代码 /// 航线代码
/// </summary> /// </summary>
public string serviceCode { get; set; } public string serviceCode { get; set; }
/// <summary>
/// 船期选择优先级
/// </summary>
public List<string> sailSchedulePriority { get; set; }
} }
/// <summary>
/// 收发通信息
/// </summary>
public class ZhongYuanSoApiSFT public class ZhongYuanSoApiSFT
{ {
/// <summary> /// <summary>
@ -179,9 +430,11 @@ namespace Myshipping.Application.EDI
public ZhongYuanSoApiPhone phone { get; set; } public ZhongYuanSoApiPhone phone { get; set; }
} }
/// <summary>
/// 收发通电话
/// </summary>
public class ZhongYuanSoApiPhone public class ZhongYuanSoApiPhone
{ {
/// <summary> /// <summary>
/// 国家代码 /// 国家代码
/// </summary> /// </summary>
@ -197,4 +450,79 @@ namespace Myshipping.Application.EDI
/// </summary> /// </summary>
public string number { get; set; } public string number { get; set; }
} }
/// <summary>
/// 货物信息
/// </summary>
public class ZhongYuanSoApiCargoInfo
{
/// <summary>
/// 货物类型
/// </summary>
public string cargoName { get; set; }
/// <summary>
/// 货物描述
/// </summary>
public string cargoDes { get; set; }
/// <summary>
/// HS代码
/// </summary>
public string hsCode { get; set; }
}
/// <summary>
/// 箱信息
/// </summary>
public class ZhongYuanSoApiBoxInfo
{
/// <summary>
/// 箱量
/// </summary>
public int boxNum { get; set; }
/// <summary>
/// 箱型
/// </summary>
public string boxType { get; set; }
/// <summary>
/// 毛重
/// </summary>
public string weight { get; set; }
/// <summary>
/// 重量单位
/// </summary>
public string weightUnit { get; set; }
}
public class ZhongYuanSoApiRateInfo
{
/// <summary>
/// 付款方式
/// </summary>
public string paymentMethod { get; set; }
}
/// <summary>
/// 特殊要求及备注
/// </summary>
public class ZhongYuanSoApiSpecial
{
/// <summary>
/// 备注信息
/// </summary>
public string remarksForEntireBooking { get; set; }
/// <summary>
/// 邮箱地址
/// </summary>
public string emailAddresses { get; set; }
}
} }

@ -12490,5 +12490,23 @@ namespace Myshipping.Application
return result; return result;
} }
#endregion #endregion
#region 发送订舱
/// <summary>
/// 发送Api订舱目前只有中远
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpPost("/BookingOrder/PostApiSO")]
public async Task PostApiSO(long id)
{
var rtn = await ZhongYuanSoApiHelper.DoPost(id);
if (!rtn.Key)
{
throw Oops.Bah(rtn.Value);
}
}
#endregion
} }
} }

@ -206,6 +206,11 @@ public class CommonConst
/// 省份信息 /// 省份信息
/// </summary> /// </summary>
public const string CACHE_KEY_COMMON_DB_PROVINCE = "CommonDbCodeProvince"; public const string CACHE_KEY_COMMON_DB_PROVINCE = "CommonDbCodeProvince";
/// <summary>
/// 起运港与船代的关系
/// </summary>
public const string CACHE_KEY_COMMON_DB_RELA_PORTLOAD_FORWARDER = "CommonDbRelaPortLoadForwarder";
#endregion #endregion
public const string API_USER_HEADER_KEY = "USER_KEY"; public const string API_USER_HEADER_KEY = "USER_KEY";

@ -0,0 +1,35 @@
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("RelaPortLoadForwarder")]
[Description("起运港和船代的关系表")]
public class RelaPortLoadForwarder : CommonDbEntity
{
/// <summary>
/// 起运港代码
/// </summary>
public string PortLoadCode { get; set; }
/// <summary>
/// 船代代码
/// </summary>
public string ForwarderCode { get; set; }
/// <summary>
/// 模块(公用时为空字符串)
/// </summary>
public string Module { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
}
}

@ -152,5 +152,15 @@ namespace Myshipping.Core.Entity
/// 等级 /// 等级
/// </summary> /// </summary>
public string Level { get; set; } public string Level { get; set; }
/// <summary>
/// 客户端系统ID
/// </summary>
public long CustSysId { get; set; }
/// <summary>
/// 大简云GID
/// </summary>
public string DjyGid { get; set; }
} }
} }

@ -47,5 +47,15 @@ namespace Myshipping.Core.Entity
/// 备注 /// 备注
/// </summary> /// </summary>
public string Remark { get; set; } public string Remark { get; set; }
/// <summary>
/// 客户端系统ID
/// </summary>
public long CustSysId { get; set; }
/// <summary>
/// 大简云GID
/// </summary>
public string DjyGid { get; set; }
} }
} }

@ -101,6 +101,9 @@ namespace Myshipping.Core.Job
//航线与港口的的关系 //航线与港口的的关系
await App.GetService<ICommonDBService>().GetAllRelaPortCarrierLane(true); await App.GetService<ICommonDBService>().GetAllRelaPortCarrierLane(true);
//起运港与船代的的关系
await App.GetService<ICommonDBService>().GetAllRelaPortLoadForwarder(true);
//国家 //国家
await App.GetService<ICommonDBService>().GetAllCountry(true); await App.GetService<ICommonDBService>().GetAllCountry(true);

@ -782,6 +782,11 @@
省份信息 省份信息
</summary> </summary>
</member> </member>
<member name="F:Myshipping.Core.CommonConst.CACHE_KEY_COMMON_DB_RELA_PORTLOAD_FORWARDER">
<summary>
起运港与船代的关系
</summary>
</member>
<member name="F:Myshipping.Core.CommonConst.ENTITY_ASSEMBLY_NAME"> <member name="F:Myshipping.Core.CommonConst.ENTITY_ASSEMBLY_NAME">
<summary> <summary>
程序集 程序集
@ -1732,6 +1737,26 @@
备注 备注
</summary> </summary>
</member> </member>
<member name="P:Myshipping.Core.Entity.RelaPortLoadForwarder.PortLoadCode">
<summary>
起运港代码
</summary>
</member>
<member name="P:Myshipping.Core.Entity.RelaPortLoadForwarder.ForwarderCode">
<summary>
船代代码
</summary>
</member>
<member name="P:Myshipping.Core.Entity.RelaPortLoadForwarder.Module">
<summary>
模块(公用时为空字符串)
</summary>
</member>
<member name="P:Myshipping.Core.Entity.RelaPortLoadForwarder.Remark">
<summary>
备注
</summary>
</member>
<member name="T:Myshipping.Core.Entity.DBEntityTenant"> <member name="T:Myshipping.Core.Entity.DBEntityTenant">
<summary> <summary>
自定义租户基类实体 自定义租户基类实体
@ -2044,6 +2069,16 @@
等级 等级
</summary> </summary>
</member> </member>
<member name="P:Myshipping.Core.Entity.DjyCustomer.CustSysId">
<summary>
客户端系统ID
</summary>
</member>
<member name="P:Myshipping.Core.Entity.DjyCustomer.DjyGid">
<summary>
大简云GID
</summary>
</member>
<member name="T:Myshipping.Core.Entity.DjyCustomerAddr"> <member name="T:Myshipping.Core.Entity.DjyCustomerAddr">
<summary> <summary>
客户地址 客户地址
@ -2129,6 +2164,16 @@
备注 备注
</summary> </summary>
</member> </member>
<member name="P:Myshipping.Core.Entity.DjyCustomerContact.CustSysId">
<summary>
客户端系统ID
</summary>
</member>
<member name="P:Myshipping.Core.Entity.DjyCustomerContact.DjyGid">
<summary>
大简云GID
</summary>
</member>
<member name="T:Myshipping.Core.Entity.DjyDingtalkGroupConfig"> <member name="T:Myshipping.Core.Entity.DjyDingtalkGroupConfig">
<summary> <summary>
钉钉客服通知群配置 钉钉客服通知群配置
@ -7332,6 +7377,12 @@
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Myshipping.Core.Service.ISysCacheService.GetAllRelaPortLoadForwarder">
<summary>
获取公共库 起运港与船代的关系表
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.ISysCacheService.GetAllCodeCountry"> <member name="M:Myshipping.Core.Service.ISysCacheService.GetAllCodeCountry">
<summary> <summary>
获取公共库 国家 获取公共库 国家
@ -7554,6 +7605,12 @@
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Myshipping.Core.Service.ISysCacheService.SetAllRelaPortLoadForwarder(System.Collections.Generic.List{Myshipping.Core.Entity.RelaPortLoadForwarder})">
<summary>
设置公共库 起运港与船代的关系表
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.ISysCacheService.SetAllCodeCountry(System.Collections.Generic.List{Myshipping.Core.Entity.CodeCountry})"> <member name="M:Myshipping.Core.Service.ISysCacheService.SetAllCodeCountry(System.Collections.Generic.List{Myshipping.Core.Entity.CodeCountry})">
<summary> <summary>
设置公共库 国家 设置公共库 国家
@ -7878,7 +7935,13 @@
</member> </member>
<member name="M:Myshipping.Core.Service.SysCacheService.GetAllRelaPortCarrierLane"> <member name="M:Myshipping.Core.Service.SysCacheService.GetAllRelaPortCarrierLane">
<summary> <summary>
设置公共库 航线与港口的的关系表 获取公共库 航线与港口的的关系表
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.SysCacheService.GetAllRelaPortLoadForwarder">
<summary>
获取公共库 起运港与船代的关系表
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>
@ -7996,6 +8059,12 @@
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Myshipping.Core.Service.SysCacheService.SetAllRelaPortLoadForwarder(System.Collections.Generic.List{Myshipping.Core.Entity.RelaPortLoadForwarder})">
<summary>
设置公共库 起运港与船代的关系表
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.SysCacheService.SetAllCodeCountry(System.Collections.Generic.List{Myshipping.Core.Entity.CodeCountry})"> <member name="M:Myshipping.Core.Service.SysCacheService.SetAllCodeCountry(System.Collections.Generic.List{Myshipping.Core.Entity.CodeCountry})">
<summary> <summary>
设置公共库 国家 设置公共库 国家
@ -10158,6 +10227,12 @@
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Myshipping.Core.Service.ICommonDBService.GetAllRelaPortLoadForwarder(System.Boolean)">
<summary>
起运港与船代的关系
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.ICommonDBService.GetAllCountry(System.Boolean)"> <member name="M:Myshipping.Core.Service.ICommonDBService.GetAllCountry(System.Boolean)">
<summary> <summary>
国家 国家

@ -109,6 +109,12 @@ public interface ISysCacheService
/// <returns></returns> /// <returns></returns>
Task<List<RelaPortCarrierLane>> GetAllRelaPortCarrierLane(); Task<List<RelaPortCarrierLane>> GetAllRelaPortCarrierLane();
/// <summary>
/// 获取公共库 起运港与船代的关系表
/// </summary>
/// <returns></returns>
Task<List<RelaPortLoadForwarder>> GetAllRelaPortLoadForwarder();
/// <summary> /// <summary>
/// 获取公共库 国家 /// 获取公共库 国家
/// </summary> /// </summary>
@ -332,6 +338,12 @@ public interface ISysCacheService
/// <returns></returns> /// <returns></returns>
Task SetAllRelaPortCarrierLane(List<RelaPortCarrierLane> list); Task SetAllRelaPortCarrierLane(List<RelaPortCarrierLane> list);
/// <summary>
/// 设置公共库 起运港与船代的关系表
/// </summary>
/// <returns></returns>
Task SetAllRelaPortLoadForwarder(List<RelaPortLoadForwarder> list);
/// <summary> /// <summary>
/// 设置公共库 国家 /// 设置公共库 国家
/// </summary> /// </summary>

@ -398,7 +398,7 @@ public class SysCacheService : ISysCacheService, IDynamicApiController, ISinglet
} }
/// <summary> /// <summary>
/// 设置公共库 航线与港口的的关系表 /// 获取公共库 航线与港口的的关系表
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public Task<List<RelaPortCarrierLane>> GetAllRelaPortCarrierLane() public Task<List<RelaPortCarrierLane>> GetAllRelaPortCarrierLane()
@ -406,6 +406,15 @@ public class SysCacheService : ISysCacheService, IDynamicApiController, ISinglet
return _cache.GetAsync<List<RelaPortCarrierLane>>(CommonConst.CACHE_KEY_COMMON_DB_LANE_PORT); return _cache.GetAsync<List<RelaPortCarrierLane>>(CommonConst.CACHE_KEY_COMMON_DB_LANE_PORT);
} }
/// <summary>
/// 获取公共库 起运港与船代的关系表
/// </summary>
/// <returns></returns>
public Task<List<RelaPortLoadForwarder>> GetAllRelaPortLoadForwarder()
{
return _cache.GetAsync<List<RelaPortLoadForwarder>>(CommonConst.CACHE_KEY_COMMON_DB_RELA_PORTLOAD_FORWARDER);
}
/// <summary> /// <summary>
/// 获取公共库 国家 /// 获取公共库 国家
/// </summary> /// </summary>
@ -580,6 +589,15 @@ public class SysCacheService : ISysCacheService, IDynamicApiController, ISinglet
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_LANE_PORT, list); return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_LANE_PORT, list);
} }
/// <summary>
/// 设置公共库 起运港与船代的关系表
/// </summary>
/// <returns></returns>
public Task SetAllRelaPortLoadForwarder(List<RelaPortLoadForwarder> list)
{
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_RELA_PORTLOAD_FORWARDER, list);
}
/// <summary> /// <summary>
/// 设置公共库 国家 /// 设置公共库 国家
/// </summary> /// </summary>

@ -51,6 +51,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
private readonly SqlSugarRepository<MappingForwarder> _mappingForwarder; private readonly SqlSugarRepository<MappingForwarder> _mappingForwarder;
private readonly SqlSugarRepository<CodeCity> _codeCityRep; private readonly SqlSugarRepository<CodeCity> _codeCityRep;
private readonly SqlSugarRepository<CodeProvince> _codeProvinceRep; private readonly SqlSugarRepository<CodeProvince> _codeProvinceRep;
private readonly SqlSugarRepository<RelaPortLoadForwarder> _relaPortLoadForwarderRep;
public CommonDBService(SqlSugarRepository<CodeCarrier> codeCarrierRep, public CommonDBService(SqlSugarRepository<CodeCarrier> codeCarrierRep,
SqlSugarRepository<CodeVessel> codeVesselRep, SqlSugarRepository<CodeVessel> codeVesselRep,
SqlSugarRepository<CodeForwarder> codeForwarderRep, SqlSugarRepository<CodeForwarder> codeForwarderRep,
@ -80,7 +81,8 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
SqlSugarRepository<CodeCountry> codeCountryRep, SqlSugarRepository<CodeCountry> codeCountryRep,
SqlSugarRepository<MappingForwarder> mappingForwarder, SqlSugarRepository<MappingForwarder> mappingForwarder,
SqlSugarRepository<CodeCity> codeCityRep, SqlSugarRepository<CodeCity> codeCityRep,
SqlSugarRepository<CodeProvince> codeProvinceRep SqlSugarRepository<CodeProvince> codeProvinceRep,
SqlSugarRepository<RelaPortLoadForwarder> relaPortLoadForwarderRep
) )
{ {
_codeCarrierRep = codeCarrierRep; _codeCarrierRep = codeCarrierRep;
@ -113,7 +115,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
_mappingForwarder = mappingForwarder; _mappingForwarder = mappingForwarder;
_codeCityRep = codeCityRep; _codeCityRep = codeCityRep;
_codeProvinceRep = codeProvinceRep; _codeProvinceRep = codeProvinceRep;
_relaPortLoadForwarderRep = relaPortLoadForwarderRep;
} }
#endregion #endregion
@ -1918,6 +1920,26 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
} }
}
[NonAction]
public async Task GetAllRelaPortLoadForwarder(bool flag = false)
{
if (flag)
{
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_RELA_PORTLOAD_FORWARDER))
{
var list = await _relaPortLoadForwarderRep.ToListAsync();
await _sysCacheService.SetAllRelaPortLoadForwarder(list);
}
}
else
{
var list = await _relaPortLoadForwarderRep.ToListAsync();
await _sysCacheService.SetAllRelaPortLoadForwarder(list);
}
} }
/// <summary> /// <summary>

@ -105,6 +105,12 @@ public interface ICommonDBService
/// <returns></returns> /// <returns></returns>
Task GetAllRelaPortCarrierLane(bool flag); Task GetAllRelaPortCarrierLane(bool flag);
/// <summary>
/// 起运港与船代的关系
/// </summary>
/// <returns></returns>
Task GetAllRelaPortLoadForwarder(bool flag);
/// <summary> /// <summary>
/// 国家 /// 国家
/// </summary> /// </summary>

Loading…
Cancel
Save