From 8a24094ee93e6d99fd84bb24a91ac9004e83ee5c Mon Sep 17 00:00:00 2001
From: wet <1034391973@qq.com>
Date: Thu, 13 Apr 2023 13:47:27 +0800
Subject: [PATCH] 1
---
Myshipping.Core/Const/CommonConst.cs | 4 ++
.../Entity/CommonDB/CodeIssueType.cs | 34 +++++++++-
.../Service/Cache/ISysCacheService.cs | 12 ++++
.../Service/Cache/SysCacheService.cs | 20 ++++++
.../CommomDBPage/CommonDBPageService.cs | 15 ++++-
.../Service/CommonDB/CommonDBService.cs | 64 ++++++++++++++++++-
.../Service/CommonDB/Dto/CodeIssueTypeDto.cs | 32 ++++++++++
7 files changed, 177 insertions(+), 4 deletions(-)
diff --git a/Myshipping.Core/Const/CommonConst.cs b/Myshipping.Core/Const/CommonConst.cs
index c5c4c5b0..ce719415 100644
--- a/Myshipping.Core/Const/CommonConst.cs
+++ b/Myshipping.Core/Const/CommonConst.cs
@@ -165,6 +165,10 @@ public class CommonConst
///
public const string CACHE_KEY_COMMON_DB_MAPPING_CODEISSUETYPE = "CommonDbCodeIssueType";
///
+ /// 签单方式映射
+ ///
+ public const string CACHE_KEY_COMMON_DB_MAPPING_ISSUETYPE = "CommonDbMappingIssueType";
+ ///
/// 字典映射
///
public const string CACHE_KEY_COMMON_DB_DICT_DATA = "DictDataList";
diff --git a/Myshipping.Core/Entity/CommonDB/CodeIssueType.cs b/Myshipping.Core/Entity/CommonDB/CodeIssueType.cs
index cababfb4..6cb0fdaf 100644
--- a/Myshipping.Core/Entity/CommonDB/CodeIssueType.cs
+++ b/Myshipping.Core/Entity/CommonDB/CodeIssueType.cs
@@ -38,11 +38,41 @@ namespace Myshipping.Core.Entity.CommonDB
/// 备注
///
public string Remark { get; set; }
+
+
+ }
+
+
+ [SugarTable("MappingIssueType")]
+ [Description("签单方式")]
+ public class MappingIssueType : CommonDbEntity
+ {
+ ///
+ /// 代码
+ ///
+ public string Code { get; set; }
+
+ ///
+ /// 类别
+ ///
+ public string Module { get; set; }
///
- /// 排序
+ /// 映射名称
///
- public int Sort { get; set; }
+ public string MapName { get; set; }
+
+
+
+ ///
+ /// 备注
+ ///
+ public string Remark { get; set; }
+
+
}
+
+
+
}
diff --git a/Myshipping.Core/Service/Cache/ISysCacheService.cs b/Myshipping.Core/Service/Cache/ISysCacheService.cs
index 6dcc6685..f2edfd28 100644
--- a/Myshipping.Core/Service/Cache/ISysCacheService.cs
+++ b/Myshipping.Core/Service/Cache/ISysCacheService.cs
@@ -286,12 +286,24 @@ public interface ISysCacheService
///
Task> GetAllCodeIssueType();
+ ///
+ /// 获取公共库 签单方式映射
+ ///
+ ///
+ Task> GetAllMappingIssueType();
+
///
/// 设置公共库 签单方式
///
///
Task SetAllCodeIssueType(List list);
+ ///
+ /// 设置公共库 签单方式映射
+ ///
+ ///
+ Task SetAllMappingIssueType(List list);
+
///
/// 设置公共库 航线
///
diff --git a/Myshipping.Core/Service/Cache/SysCacheService.cs b/Myshipping.Core/Service/Cache/SysCacheService.cs
index ceba00ae..1901e087 100644
--- a/Myshipping.Core/Service/Cache/SysCacheService.cs
+++ b/Myshipping.Core/Service/Cache/SysCacheService.cs
@@ -709,6 +709,26 @@ public class SysCacheService : ISysCacheService, IDynamicApiController, ISinglet
{
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_CODEISSUETYPE, list);
}
+
+
+ ///
+ /// 获取公共库 签单方式映射
+ ///
+ ///
+ public Task> GetAllMappingIssueType()
+ {
+ return _cache.GetAsync>(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_ISSUETYPE);
+ }
+
+ ///
+ /// 设置公共库 签单方式映射
+ ///
+ ///
+ public Task SetAllMappingIssueType(List list)
+ {
+ return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_ISSUETYPE, list);
+ }
+
#endregion
#region DJY
diff --git a/Myshipping.Core/Service/CommomDBPage/CommonDBPageService.cs b/Myshipping.Core/Service/CommomDBPage/CommonDBPageService.cs
index fa3b191c..df21f5b9 100644
--- a/Myshipping.Core/Service/CommomDBPage/CommonDBPageService.cs
+++ b/Myshipping.Core/Service/CommomDBPage/CommonDBPageService.cs
@@ -47,6 +47,7 @@ public class CommonDBPageService : IDynamicApiController, ITransient
private readonly SqlSugarRepository _codeLaneRep;
private readonly SqlSugarRepository _relaPortCarrierLaneRep;
private readonly SqlSugarRepository _codeCountryRep;
+ private readonly SqlSugarRepository _mappingIssueTypeRep;
public CommonDBPageService(SqlSugarRepository codeCarrierRep,
SqlSugarRepository codeVesselRep,
SqlSugarRepository codeForwarderRep,
@@ -72,6 +73,7 @@ public class CommonDBPageService : IDynamicApiController, ITransient
ISysCacheService sysCacheService,
SqlSugarRepository codeLaneRep,
SqlSugarRepository relaPortCarrierLaneRep,
+ SqlSugarRepository mappingIssueTypeRep,
SqlSugarRepository codeCountryRep)
{
_codeCarrierRep = codeCarrierRep;
@@ -100,6 +102,7 @@ public class CommonDBPageService : IDynamicApiController, ITransient
_codeLaneRep = codeLaneRep;
_relaPortCarrierLaneRep = relaPortCarrierLaneRep;
_codeCountryRep = codeCountryRep;
+ _mappingIssueTypeRep = mappingIssueTypeRep;
}
#endregion
@@ -396,9 +399,19 @@ public class CommonDBPageService : IDynamicApiController, ITransient
|| x.CnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)).OrderBy(PageInputOrder.OrderBuilder(input.SortField, input.DescSort)).ToPagedListAsync(input.PageNo, input.PageSize);
+ }
+ ///
+ /// 获取签单方式映射信息
+ ///
+ [HttpGet("/commondbpage/mappingissuetypelist")]
+ public async Task MappingIssueTypeList([FromQuery] MappingQueryDto input)
+ {
+ return await _mappingIssueTypeRep.AsQueryable().Where(x => x.Module == input.Module).WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)
+ || x.MapName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)).OrderBy(PageInputOrder.OrderBuilder(input.SortField, input.DescSort)).ToPagedListAsync(input.PageNo, input.PageSize);
+
+
}
-
#endregion
diff --git a/Myshipping.Core/Service/CommonDB/CommonDBService.cs b/Myshipping.Core/Service/CommonDB/CommonDBService.cs
index cfd9fb58..32023ebf 100644
--- a/Myshipping.Core/Service/CommonDB/CommonDBService.cs
+++ b/Myshipping.Core/Service/CommonDB/CommonDBService.cs
@@ -42,6 +42,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
private readonly SqlSugarRepository _mappingServiceRep;
private readonly ISysCacheService _sysCacheService;
private readonly SqlSugarRepository _codeIssueTypeRep;
+ private readonly SqlSugarRepository _mappingIssueTypeRep;
private readonly SqlSugarRepository _commonModuleRep;
private readonly ILogger _logger;
private readonly SqlSugarRepository _codeLaneRep;
@@ -72,6 +73,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
ISysCacheService sysCacheService,
SqlSugarRepository codeLaneRep,
SqlSugarRepository relaPortCarrierLaneRep,
+ SqlSugarRepository mappingIssueTypeRep
SqlSugarRepository codeCountryRep)
{
_codeCarrierRep = codeCarrierRep;
@@ -100,6 +102,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
_codeLaneRep = codeLaneRep;
_relaPortCarrierLaneRep = relaPortCarrierLaneRep;
_codeCountryRep = codeCountryRep;
+ _mappingIssueTypeRep= mappingIssueTypeRep;
}
#endregion
@@ -295,7 +298,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
public async Task AddOrUpdateMappingVessel([FromBody] MappingVesselDto dto)
{
var list = await _sysCacheService.GetAllMappingVessel();
- var count = list.Where(x => x.Name == dto.Name.Trim()
+ var count = list.Where(x => x.Name == dto.Name.Trim()
&& x.Module == dto.Module
&& x.YardCode == dto.YardCode
&& x.GID != dto.GID).Count();
@@ -1230,6 +1233,65 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
await GetAllCodeIssueType();
}
+
+
+
+
+ ///
+ /// 获取签单方式映射列表信息
+ ///
+ [HttpGet("/commondb/mappingIssueTypelist")]
+ public async Task MappingIssueTypeList([FromQuery] MappingQueryDto input)
+ { //数量太多,不允许查询全部
+ if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
+ {
+ throw Oops.Bah("参数过多,请传入模块查询");
+ }
+ var list = await _sysCacheService.GetAllMappingIssueType();
+
+ var queryList = list.Where(x => x.Module == input.Module)
+ .WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)
+ || x.MapName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
+ if (queryList.Count() > 20)
+ {
+ return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
+ }
+ return queryList.OrderBy(x => x.Sort).ToList();
+ }
+ ///
+ /// 新增编辑签单方式映射信息
+ ///
+ [HttpPost("/commondb/addmappingIssueType")]
+ public async Task AddOrUpdateMappingIssueType([FromBody] MappingIssueTypeDto dto)
+ {
+ var list = await _sysCacheService.GetAllMappingIssueType();
+ var count = list.Where(x => x.Code == dto.Code && x.Module == dto.Module && x.GID != dto.GID).Count();
+ if (count > 0)
+ {
+ throw Oops.Bah(ErrorCode.D1006);
+ }
+ var entity = dto.Adapt();
+ if (string.IsNullOrWhiteSpace(dto.GID))
+ {
+ entity.GID = Guid.NewGuid().ToString();
+ entity.CreateTime = DateTime.Now;
+ entity.CreateUser = UserManager.DjyUserId;
+ await _mappingIssueTypeRep.InsertAsync(entity);
+ }
+ else
+ {
+ entity.CreateTime = list.Where(x => x.GID == dto.GID).Select(x => x.CreateTime).FirstOrDefault();
+ entity.CreateUser = list.Where(x => x.GID == dto.GID).Select(x => x.CreateUser).FirstOrDefault();
+ entity.ModifyTime = DateTime.Now;
+ entity.ModifyUser = UserManager.DjyUserId;
+ await _mappingIssueTypeRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
+ }
+ await GetAllMappingFrt();
+ }
+
+
+
+
#endregion
diff --git a/Myshipping.Core/Service/CommonDB/Dto/CodeIssueTypeDto.cs b/Myshipping.Core/Service/CommonDB/Dto/CodeIssueTypeDto.cs
index ee26e6d8..056615ba 100644
--- a/Myshipping.Core/Service/CommonDB/Dto/CodeIssueTypeDto.cs
+++ b/Myshipping.Core/Service/CommonDB/Dto/CodeIssueTypeDto.cs
@@ -30,6 +30,38 @@ namespace Myshipping.Core.Service.CommonDB.Dto
///
public string Description { get; set; }
+ ///
+ /// 备注
+ ///
+ public string Remark { get; set; }
+
+ ///
+ /// 排序
+ ///
+ public int Sort { get; set; }
+ }
+
+
+ public class MappingIssueTypeDto
+ {
+
+ public string GID { get; set; }
+ ///
+ /// 代码
+ ///
+ public string Code { get; set; }
+
+ ///
+ /// 模块
+ ///
+ public string Module { get; set; }
+
+ ///
+ /// 映射名称
+ ///
+ public string MapName { get; set; }
+
+
///
/// 备注
///