From b389573d8bb1592e1ebc8892fae8cfac90047fce Mon Sep 17 00:00:00 2001
From: wet <1034391973@qq.com>
Date: Fri, 11 Nov 2022 15:31:56 +0800
Subject: [PATCH] =?UTF-8?q?=E5=9C=BA=E7=AB=99=E6=98=A0=E5=B0=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Myshipping.Core/Const/CommonConst.cs | 7 +-
Myshipping.Core/Entity/CommonDB/CodeYard.cs | 39 +++++++++++
Myshipping.Core/Myshipping.Core.xml | 25 +++++++
.../Service/Cache/ISysCacheService.cs | 12 +++-
.../Service/Cache/SysCacheService.cs | 17 ++++-
.../Service/CommonDB/CommonDBService.cs | 68 +++++++++++++++++++
.../Service/CommonDB/ICommonDBService.cs | 6 ++
.../Myshipping.Report.csproj.user | 2 +-
Myshipping.Web.Core/Startup.cs | 3 +
9 files changed, 175 insertions(+), 4 deletions(-)
diff --git a/Myshipping.Core/Const/CommonConst.cs b/Myshipping.Core/Const/CommonConst.cs
index be29f683..18d61c9b 100644
--- a/Myshipping.Core/Const/CommonConst.cs
+++ b/Myshipping.Core/Const/CommonConst.cs
@@ -115,13 +115,18 @@ public class CommonConst
///
public const string CACHE_KEY_COMMON_DB_MAPPING_VESSEL = "CommonDbMappingVessel";
+ ///
+ /// 场站映射
+ ///
+ public const string CACHE_KEY_COMMON_DB_MAPPING_YARD = "CommonDbMappingYard";
+
///
/// 字典映射
///
public const string CACHE_KEY_COMMON_DB_DICT_DATA = "DictDataList";
///
- /// 船名映射
+ /// EDI映射
///
public const string CACHE_KEY_DJY_EDI_SETTING = "DjyEdiSetting";
diff --git a/Myshipping.Core/Entity/CommonDB/CodeYard.cs b/Myshipping.Core/Entity/CommonDB/CodeYard.cs
index 9ffe39ed..69784b3b 100644
--- a/Myshipping.Core/Entity/CommonDB/CodeYard.cs
+++ b/Myshipping.Core/Entity/CommonDB/CodeYard.cs
@@ -54,4 +54,43 @@ namespace Myshipping.Core.Entity
}
+
+
+
+
+ [SugarTable("MappingYard")]
+ [Description("场站映射")]
+ public class MappingYard : CommonDbEntity
+ {
+ ///
+ /// 代码
+ ///
+ public string Code { get; set; }
+
+ ///
+ /// 名称
+ ///
+ public string Name { get; set; }
+
+ ///
+ /// 模块
+ ///
+ public string Module { get; set; }
+
+ ///
+ /// 映射代码
+ ///
+ public string MapCode { get; set; }
+
+ ///
+ /// 映射名称
+ ///
+ public string MapName { get; set; }
+
+ ///
+ /// 备注
+ ///
+ public string Remark { get; set; }
+
+ }
}
diff --git a/Myshipping.Core/Myshipping.Core.xml b/Myshipping.Core/Myshipping.Core.xml
index 748cf6d6..f020ae68 100644
--- a/Myshipping.Core/Myshipping.Core.xml
+++ b/Myshipping.Core/Myshipping.Core.xml
@@ -1257,6 +1257,31 @@
修改人
+
+
+ 代码
+
+
+
+
+ 模块
+
+
+
+
+ 映射代码
+
+
+
+
+ 映射名称
+
+
+
+
+ 备注
+
+
主键
diff --git a/Myshipping.Core/Service/Cache/ISysCacheService.cs b/Myshipping.Core/Service/Cache/ISysCacheService.cs
index 8156676d..9362cd72 100644
--- a/Myshipping.Core/Service/Cache/ISysCacheService.cs
+++ b/Myshipping.Core/Service/Cache/ISysCacheService.cs
@@ -121,7 +121,11 @@ public interface ISysCacheService
Task> GetAllMappingVessel();
-
+ ///
+ /// 获取公共库 场站映射
+ ///
+ ///
+ Task> GetAllMappingYard();
///
/// 设置公共库 船公司
///
@@ -204,6 +208,12 @@ public interface ISysCacheService
///
///
Task SetAllMappingVessel(List list);
+
+ ///
+ /// 设置公共库 场站映射
+ ///
+ ///
+ Task SetAllMappingYard(List list);
#endregion
#region DJY
diff --git a/Myshipping.Core/Service/Cache/SysCacheService.cs b/Myshipping.Core/Service/Cache/SysCacheService.cs
index 73c55db2..ebaff0ac 100644
--- a/Myshipping.Core/Service/Cache/SysCacheService.cs
+++ b/Myshipping.Core/Service/Cache/SysCacheService.cs
@@ -418,7 +418,14 @@ public class SysCacheService : ISysCacheService, IDynamicApiController, ISinglet
return _cache.GetAsync>(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_VESSEL);
}
-
+ ///
+ /// 获取公共库 船名映射
+ ///
+ ///
+ public Task> GetAllMappingYard()
+ {
+ return _cache.GetAsync>(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_YARD);
+ }
///
@@ -547,6 +554,14 @@ public class SysCacheService : ISysCacheService, IDynamicApiController, ISinglet
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_VESSEL, list, TimeSpan.FromMinutes(5));
}
+ ///
+ /// 设置公共库 场站映射
+ ///
+ ///
+ public Task SetAllMappingYard(List list)
+ {
+ return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_YARD, list, TimeSpan.FromMinutes(5));
+ }
#endregion
diff --git a/Myshipping.Core/Service/CommonDB/CommonDBService.cs b/Myshipping.Core/Service/CommonDB/CommonDBService.cs
index 864109aa..37ad1cc7 100644
--- a/Myshipping.Core/Service/CommonDB/CommonDBService.cs
+++ b/Myshipping.Core/Service/CommonDB/CommonDBService.cs
@@ -27,6 +27,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
private readonly SqlSugarRepository _codeForwarderRep;
private readonly SqlSugarRepository _codeYardRep;
+ private readonly SqlSugarRepository _mappingYardRep;
private readonly SqlSugarRepository _codePortLoadrRep;
private readonly SqlSugarRepository _codePortRep;
private readonly SqlSugarRepository _codePackageRep;
@@ -53,6 +54,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
SqlSugarRepository mappingVesselRep,
SqlSugarRepository mappingCtnRep,
SqlSugarRepository mappingFrtRep,
+ SqlSugarRepository 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();
+ 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();
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();
+ 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();
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();
+ 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();
+ entity.GID = Guid.NewGuid().ToString();
await _codeYardRep.InsertAsync(entity);
await GetAllYard();
}
+
+ ///
+ /// 获取场站映射
+ ///
+ [HttpGet("/commondb/mappingyardlist")]
+ public async Task MappingYardList([FromQuery] MappingQueryDto input)
+ {
+ //数量太多,不允许查询全部
+ if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
+ {
+ return new List();
+ }
+
+ List 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();
+ }
+
+ ///
+ /// 新增编辑场站映射信息
+ ///
+ [HttpPost("/commondb/addorupdateyard")]
+ public async Task AddOrUpdateMappingYard([FromBody] MappingYard dto)
+ {
+ var entity = dto.Adapt();
+ 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();
+ 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();
+ 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();
+ 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();
+ 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();
+ 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();
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();
+ 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();
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> GetAllMappingYard()
+ {
+
+ var list = await _mappingYardRep.ToListAsync();
+ await _sysCacheService.SetAllMappingYard(list);
+ return list;
+ }
[NonAction]
public async Task> GetAllForwarder()
{
diff --git a/Myshipping.Core/Service/CommonDB/ICommonDBService.cs b/Myshipping.Core/Service/CommonDB/ICommonDBService.cs
index b015ba4a..5cf68df8 100644
--- a/Myshipping.Core/Service/CommonDB/ICommonDBService.cs
+++ b/Myshipping.Core/Service/CommonDB/ICommonDBService.cs
@@ -42,6 +42,12 @@ public interface ICommonDBService
///
Task> GetAllYard();
+ ///
+ /// 获取场站映射
+ ///
+ ///
+ Task> GetAllMappingYard();
+
///
/// 获取起始港
///
diff --git a/Myshipping.Report/Myshipping.Report.csproj.user b/Myshipping.Report/Myshipping.Report.csproj.user
index c54031d1..5831b7bf 100644
--- a/Myshipping.Report/Myshipping.Report.csproj.user
+++ b/Myshipping.Report/Myshipping.Report.csproj.user
@@ -8,7 +8,7 @@
- Release|Any CPU
+ Debug|Any CPU
diff --git a/Myshipping.Web.Core/Startup.cs b/Myshipping.Web.Core/Startup.cs
index 2f77f3bc..0777e248 100644
--- a/Myshipping.Web.Core/Startup.cs
+++ b/Myshipping.Web.Core/Startup.cs
@@ -135,6 +135,9 @@ public class Startup : AppStartup
//船名映射
App.GetService().GetAllMappingVessel();
+ //场站映射
+ App.GetService().GetAllMappingYard();
+
//船代
App.GetService().GetAllForwarder();