|
|
|
@ -11,6 +11,7 @@ using System.Collections.Generic;
|
|
|
|
|
using System;
|
|
|
|
|
using Myshipping.Core.Service.CommonDB.Dto;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using Myshipping.Core.Entity.CommonDB;
|
|
|
|
|
|
|
|
|
|
namespace Myshipping.Core.Service;
|
|
|
|
|
/// <summary>
|
|
|
|
@ -40,6 +41,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
private readonly SqlSugarRepository<MappingPackage> _mappingPackageRep;
|
|
|
|
|
private readonly SqlSugarRepository<MappingService> _mappingServiceRep;
|
|
|
|
|
private readonly ISysCacheService _sysCacheService;
|
|
|
|
|
private readonly SqlSugarRepository<CodeIssueType> _codeIssueTypeRep;
|
|
|
|
|
private readonly ILogger<CommonDBService> _logger;
|
|
|
|
|
public CommonDBService(SqlSugarRepository<CodeCarrier> codeCarrierRep,
|
|
|
|
|
SqlSugarRepository<CodeVessel> codeVesselRep,
|
|
|
|
@ -60,6 +62,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
SqlSugarRepository<MappingPort> mappingPortRep,
|
|
|
|
|
SqlSugarRepository<MappingPackage> mappingPackageRep,
|
|
|
|
|
SqlSugarRepository<MappingService> mappingServiceRep,
|
|
|
|
|
SqlSugarRepository<CodeIssueType> codeIssueTypeRep,
|
|
|
|
|
ILogger<CommonDBService> logger,
|
|
|
|
|
ISysCacheService sysCacheService)
|
|
|
|
|
{
|
|
|
|
@ -83,6 +86,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
_mappingPortRep = mappingPortRep;
|
|
|
|
|
_mappingPackageRep = mappingPackageRep;
|
|
|
|
|
_mappingServiceRep = mappingServiceRep;
|
|
|
|
|
_codeIssueTypeRep = codeIssueTypeRep;
|
|
|
|
|
_logger = logger;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -785,13 +789,44 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 签单方式
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取签单方式信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpGet("/commondb/codeissuetypelist")]
|
|
|
|
|
public async Task<dynamic> CodeIssueTypeList([FromQuery] NameQueryDto input)
|
|
|
|
|
{
|
|
|
|
|
List<CodeIssueType> list = await _sysCacheService.GetAllCodeIssueType();
|
|
|
|
|
|
|
|
|
|
var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.CnName.Contains(input.Name, System.StringComparison.CurrentCultureIgnoreCase));
|
|
|
|
|
|
|
|
|
|
return queryList.ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 新增签单方式
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpPost("/commondb/addcodeissuetype")]
|
|
|
|
|
public async Task AddCodeIssueType([FromBody] CodeIssueTypeDto dto)
|
|
|
|
|
{
|
|
|
|
|
var entity = dto.Adapt<CodeIssueType>();
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
|
entity.CreateUser = UserManager.DjyUserId;
|
|
|
|
|
await _codeIssueTypeRep.InsertAsync(entity);
|
|
|
|
|
await GetAllCodeIssueType();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 实现接口,获取公共数据并缓存
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task<List<CodeCarrier>> GetAllCarrier()
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeCarrierRep.ToListAsync();
|
|
|
|
|
_logger.LogInformation("船公司缓存");
|
|
|
|
|
_logger.LogInformation(list.ToJsonString());
|
|
|
|
|
await _sysCacheService.SetAllCodeCarrier(list);
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
@ -966,6 +1001,13 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
return list;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<List<CodeIssueType>> GetAllCodeIssueType()
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeIssueTypeRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeIssueType(list);
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|