booking_auth_dev
wanghaomei 2 years ago
commit 92af417367

@ -115,13 +115,18 @@ public class CommonConst
/// </summary>
public const string CACHE_KEY_COMMON_DB_MAPPING_VESSEL = "CommonDbMappingVessel";
/// <summary>
/// 场站映射
/// </summary>
public const string CACHE_KEY_COMMON_DB_MAPPING_YARD = "CommonDbMappingYard";
/// <summary>
/// 字典映射
/// </summary>
public const string CACHE_KEY_COMMON_DB_DICT_DATA = "DictDataList";
/// <summary>
/// 船名映射
/// EDI映射
/// </summary>
public const string CACHE_KEY_DJY_EDI_SETTING = "DjyEdiSetting";

@ -54,4 +54,43 @@ namespace Myshipping.Core.Entity
}
[SugarTable("MappingYard")]
[Description("场站映射")]
public class MappingYard : CommonDbEntity
{
/// <summary>
/// 代码
/// </summary>
public string Code { get; set; }
/// <summary>
/// 名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 模块
/// </summary>
public string Module { get; set; }
/// <summary>
/// 映射代码
/// </summary>
public string MapCode { get; set; }
/// <summary>
/// 映射名称
/// </summary>
public string MapName { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
}
}

@ -1257,6 +1257,31 @@
修改人
</summary>
</member>
<member name="P:Myshipping.Core.Entity.MappingYard.Code">
<summary>
代码
</summary>
</member>
<member name="P:Myshipping.Core.Entity.MappingYard.Module">
<summary>
模块
</summary>
</member>
<member name="P:Myshipping.Core.Entity.MappingYard.MapCode">
<summary>
映射代码
</summary>
</member>
<member name="P:Myshipping.Core.Entity.MappingYard.MapName">
<summary>
映射名称
</summary>
</member>
<member name="P:Myshipping.Core.Entity.MappingYard.Remark">
<summary>
备注
</summary>
</member>
<member name="P:Myshipping.Core.Entity.CommonDbEntity.GID">
<summary>
主键

@ -121,7 +121,11 @@ public interface ISysCacheService
Task<List<MappingVessel>> GetAllMappingVessel();
/// <summary>
/// 获取公共库 场站映射
/// </summary>
/// <returns></returns>
Task<List<MappingYard>> GetAllMappingYard();
/// <summary>
/// 设置公共库 船公司
/// </summary>
@ -204,6 +208,12 @@ public interface ISysCacheService
/// </summary>
/// <returns></returns>
Task SetAllMappingVessel(List<MappingVessel> list);
/// <summary>
/// 设置公共库 场站映射
/// </summary>
/// <returns></returns>
Task SetAllMappingYard(List<MappingYard> list);
#endregion
#region DJY

@ -418,7 +418,14 @@ public class SysCacheService : ISysCacheService, IDynamicApiController, ISinglet
return _cache.GetAsync<List<MappingVessel>>(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_VESSEL);
}
/// <summary>
/// 获取公共库 船名映射
/// </summary>
/// <returns></returns>
public Task<List<MappingYard>> GetAllMappingYard()
{
return _cache.GetAsync<List<MappingYard>>(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_YARD);
}
/// <summary>
@ -547,6 +554,14 @@ public class SysCacheService : ISysCacheService, IDynamicApiController, ISinglet
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_VESSEL, list, TimeSpan.FromMinutes(5));
}
/// <summary>
/// 设置公共库 场站映射
/// </summary>
/// <returns></returns>
public Task SetAllMappingYard(List<MappingYard> list)
{
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_YARD, list, TimeSpan.FromMinutes(5));
}
#endregion

@ -27,6 +27,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
private readonly SqlSugarRepository<CodeForwarder> _codeForwarderRep;
private readonly SqlSugarRepository<CodeYard> _codeYardRep;
private readonly SqlSugarRepository<MappingYard> _mappingYardRep;
private readonly SqlSugarRepository<CodePortLoad> _codePortLoadrRep;
private readonly SqlSugarRepository<CodePort> _codePortRep;
private readonly SqlSugarRepository<CodePackage> _codePackageRep;
@ -53,6 +54,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
SqlSugarRepository<MappingVessel> mappingVesselRep,
SqlSugarRepository<MappingCtn> mappingCtnRep,
SqlSugarRepository<MappingFrt> mappingFrtRep,
SqlSugarRepository<MappingYard> mappingYardRep,
ISysCacheService sysCacheService)
{
_codeCarrierRep = codeCarrierRep;
@ -69,6 +71,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
_mappingVesselRep = mappingVesselRep;
_mappingCtnRep = mappingCtnRep;
_mappingFrtRep = mappingFrtRep;
_mappingYardRep = mappingYardRep;
_sysCacheService = sysCacheService;
@ -96,6 +99,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
public async Task AddCarrier([FromBody] CodeCarrier dto)
{
var entity = dto.Adapt<CodeCarrier>();
entity.GID = Guid.NewGuid().ToString();
await _codeCarrierRep.InsertAsync(entity);
await GetAllCarrier();
}
@ -125,6 +129,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
var entity = dto.Adapt<MappingCarrier>();
if (string.IsNullOrWhiteSpace(dto.GID))
{
entity.GID = Guid.NewGuid().ToString();
await _mappingCarrierRep.InsertAsync(entity);
}
else
@ -167,6 +172,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
public async Task AddVessel([FromBody] CodeVessel dto)
{
var entity = dto.Adapt<CodeVessel>();
entity.GID = Guid.NewGuid().ToString();
await _codeVesselRep.InsertAsync(entity);
await GetAllVessel();
}
@ -200,6 +206,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
var entity = dto.Adapt<MappingVessel>();
if (string.IsNullOrWhiteSpace(dto.GID))
{
entity.GID = Guid.NewGuid().ToString();
await _mappingVesselRep.InsertAsync(entity);
}
else
@ -235,6 +242,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
public async Task AddForwarder([FromBody] CodeForwarder dto)
{
var entity = dto.Adapt<CodeForwarder>();
entity.GID = Guid.NewGuid().ToString();
await _codeForwarderRep.InsertAsync(entity);
await GetAllForwarder();
}
@ -262,9 +270,53 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
public async Task AddYard([FromBody] CodeYard dto)
{
var entity = dto.Adapt<CodeYard>();
entity.GID = Guid.NewGuid().ToString();
await _codeYardRep.InsertAsync(entity);
await GetAllYard();
}
/// <summary>
/// 获取场站映射
/// </summary>
[HttpGet("/commondb/mappingyardlist")]
public async Task<dynamic> MappingYardList([FromQuery] MappingQueryDto input)
{
//数量太多,不允许查询全部
if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
{
return new List<MappingYard>();
}
List<MappingYard> list = await _sysCacheService.GetAllMappingYard();
var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Module), x => x.Module == input.Module)
.WhereIF(!string.IsNullOrEmpty(input.MapName), x => x.Name.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase));
return queryList.ToList();
}
/// <summary>
/// 新增编辑场站映射信息
/// </summary>
[HttpPost("/commondb/addorupdateyard")]
public async Task AddOrUpdateMappingYard([FromBody] MappingYard dto)
{
var entity = dto.Adapt<MappingYard>();
if (string.IsNullOrWhiteSpace(dto.GID))
{
entity.GID = Guid.NewGuid().ToString();
await _mappingYardRep.InsertAsync(entity);
}
else
{
await _mappingYardRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
await GetAllMappingYard();
}
#endregion
@ -288,6 +340,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
public async Task AddPortload([FromBody] CodePortLoad dto)
{
var entity = dto.Adapt<CodePortLoad>();
entity.GID = Guid.NewGuid().ToString();
await _codePortLoadrRep.InsertAsync(entity);
await GetAllPortload();
}
@ -321,6 +374,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
public async Task AddPort([FromBody] CodePort dto)
{
var entity = dto.Adapt<CodePort>();
entity.GID = Guid.NewGuid().ToString();
await _codePortRep.InsertAsync(entity);
await GetAllPort();
}
@ -348,6 +402,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
public async Task AddPackage([FromBody] CodePackage dto)
{
var entity = dto.Adapt<CodePackage>();
entity.GID = Guid.NewGuid().ToString();
await _codePackageRep.InsertAsync(entity);
await GetAllPackage();
}
@ -375,6 +430,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
public async Task AddService([FromBody] CodeService dto)
{
var entity = dto.Adapt<CodeService>();
entity.GID = Guid.NewGuid().ToString();
await _codeServiceRep.InsertAsync(entity);
await GetAllService();
}
@ -404,6 +460,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
public async Task AddCtn([FromBody] CodeCtn dto)
{
var entity = dto.Adapt<CodeCtn>();
entity.GID = Guid.NewGuid().ToString();
await _codeCtnRep.InsertAsync(entity);
await GetAllCtn();
}
@ -435,6 +492,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
var entity = dto.Adapt<MappingCtn>();
if (string.IsNullOrWhiteSpace(dto.GID))
{
entity.GID = Guid.NewGuid().ToString();
await _mappingCtnRep.InsertAsync(entity);
}
else
@ -470,6 +528,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
public async Task AddFrt([FromBody] CodeFrt dto)
{
var entity = dto.Adapt<CodeFrt>();
entity.GID = Guid.NewGuid().ToString();
await _codeFrtRep.InsertAsync(entity);
await GetAllFrt();
}
@ -500,6 +559,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
var entity = dto.Adapt<MappingFrt>();
if (string.IsNullOrWhiteSpace(dto.GID))
{
entity.GID = Guid.NewGuid().ToString();
await _mappingFrtRep.InsertAsync(entity);
}
else
@ -550,7 +610,15 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
return list;
}
[NonAction]
public async Task<List<MappingYard>> GetAllMappingYard()
{
var list = await _mappingYardRep.ToListAsync();
await _sysCacheService.SetAllMappingYard(list);
return list;
}
[NonAction]
public async Task<List<CodeForwarder>> GetAllForwarder()
{

@ -42,6 +42,12 @@ public interface ICommonDBService
/// <returns></returns>
Task<List<CodeYard>> GetAllYard();
/// <summary>
/// 获取场站映射
/// </summary>
/// <returns></returns>
Task<List<MappingYard>> GetAllMappingYard();
/// <summary>
/// 获取起始港
/// </summary>

@ -8,7 +8,7 @@
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile />
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
</PropertyGroup>
<ProjectExtensions>
<VisualStudio>

@ -135,6 +135,9 @@ public class Startup : AppStartup
//船名映射
App.GetService<ICommonDBService>().GetAllMappingVessel();
//场站映射
App.GetService<ICommonDBService>().GetAllMappingYard();
//船代
App.GetService<ICommonDBService>().GetAllForwarder();

Loading…
Cancel
Save