optimize
wet 2 years ago
parent de65e47996
commit 8a24094ee9

@ -165,6 +165,10 @@ public class CommonConst
/// </summary>
public const string CACHE_KEY_COMMON_DB_MAPPING_CODEISSUETYPE = "CommonDbCodeIssueType";
/// <summary>
/// 签单方式映射
/// </summary>
public const string CACHE_KEY_COMMON_DB_MAPPING_ISSUETYPE = "CommonDbMappingIssueType";
/// <summary>
/// 字典映射
/// </summary>
public const string CACHE_KEY_COMMON_DB_DICT_DATA = "DictDataList";

@ -38,11 +38,41 @@ namespace Myshipping.Core.Entity.CommonDB
/// 备注
/// </summary>
public string Remark { get; set; }
}
[SugarTable("MappingIssueType")]
[Description("签单方式")]
public class MappingIssueType : CommonDbEntity
{
/// <summary>
/// 代码
/// </summary>
public string Code { get; set; }
/// <summary>
/// 类别
/// </summary>
public string Module { get; set; }
/// <summary>
/// 排序
/// 映射名称
/// </summary>
public int Sort { get; set; }
public string MapName { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
}
}

@ -286,12 +286,24 @@ public interface ISysCacheService
/// <returns></returns>
Task<List<CodeIssueType>> GetAllCodeIssueType();
/// <summary>
/// 获取公共库 签单方式映射
/// </summary>
/// <returns></returns>
Task<List<MappingIssueType>> GetAllMappingIssueType();
/// <summary>
/// 设置公共库 签单方式
/// </summary>
/// <returns></returns>
Task SetAllCodeIssueType(List<CodeIssueType> list);
/// <summary>
/// 设置公共库 签单方式映射
/// </summary>
/// <returns></returns>
Task SetAllMappingIssueType(List<MappingIssueType> list);
/// <summary>
/// 设置公共库 航线
/// </summary>

@ -709,6 +709,26 @@ public class SysCacheService : ISysCacheService, IDynamicApiController, ISinglet
{
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_CODEISSUETYPE, list);
}
/// <summary>
/// 获取公共库 签单方式映射
/// </summary>
/// <returns></returns>
public Task<List<MappingIssueType>> GetAllMappingIssueType()
{
return _cache.GetAsync<List<MappingIssueType>>(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_ISSUETYPE);
}
/// <summary>
/// 设置公共库 签单方式映射
/// </summary>
/// <returns></returns>
public Task SetAllMappingIssueType(List<MappingIssueType> list)
{
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_ISSUETYPE, list);
}
#endregion
#region DJY

@ -47,6 +47,7 @@ public class CommonDBPageService : IDynamicApiController, ITransient
private readonly SqlSugarRepository<CodeLane> _codeLaneRep;
private readonly SqlSugarRepository<RelaPortCarrierLane> _relaPortCarrierLaneRep;
private readonly SqlSugarRepository<CodeCountry> _codeCountryRep;
private readonly SqlSugarRepository<MappingIssueType> _mappingIssueTypeRep;
public CommonDBPageService(SqlSugarRepository<CodeCarrier> codeCarrierRep,
SqlSugarRepository<CodeVessel> codeVesselRep,
SqlSugarRepository<CodeForwarder> codeForwarderRep,
@ -72,6 +73,7 @@ public class CommonDBPageService : IDynamicApiController, ITransient
ISysCacheService sysCacheService,
SqlSugarRepository<CodeLane> codeLaneRep,
SqlSugarRepository<RelaPortCarrierLane> relaPortCarrierLaneRep,
SqlSugarRepository<MappingIssueType> mappingIssueTypeRep,
SqlSugarRepository<CodeCountry> 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);
}
/// <summary>
/// 获取签单方式映射信息
/// </summary>
[HttpGet("/commondbpage/mappingissuetypelist")]
public async Task<dynamic> 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

@ -42,6 +42,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
private readonly SqlSugarRepository<MappingService> _mappingServiceRep;
private readonly ISysCacheService _sysCacheService;
private readonly SqlSugarRepository<CodeIssueType> _codeIssueTypeRep;
private readonly SqlSugarRepository<MappingIssueType> _mappingIssueTypeRep;
private readonly SqlSugarRepository<CommonModule> _commonModuleRep;
private readonly ILogger<CommonDBService> _logger;
private readonly SqlSugarRepository<CodeLane> _codeLaneRep;
@ -72,6 +73,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
ISysCacheService sysCacheService,
SqlSugarRepository<CodeLane> codeLaneRep,
SqlSugarRepository<RelaPortCarrierLane> relaPortCarrierLaneRep,
SqlSugarRepository<MappingIssueType> mappingIssueTypeRep
SqlSugarRepository<CodeCountry> 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();
}
/// <summary>
/// 获取签单方式映射列表信息
/// </summary>
[HttpGet("/commondb/mappingIssueTypelist")]
public async Task<dynamic> 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();
}
/// <summary>
/// 新增编辑签单方式映射信息
/// </summary>
[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<MappingIssueType>();
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

@ -30,6 +30,38 @@ namespace Myshipping.Core.Service.CommonDB.Dto
/// </summary>
public string Description { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
/// <summary>
/// 排序
/// </summary>
public int Sort { get; set; }
}
public class MappingIssueTypeDto
{
public string GID { get; set; }
/// <summary>
/// 代码
/// </summary>
public string Code { get; set; }
/// <summary>
/// 模块
/// </summary>
public string Module { get; set; }
/// <summary>
/// 映射名称
/// </summary>
public string MapName { get; set; }
/// <summary>
/// 备注
/// </summary>

Loading…
Cancel
Save