|
|
|
@ -20,23 +20,19 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
|
|
|
|
|
private readonly SqlSugarRepository<CodeCarrier> _codeCarrierRep;
|
|
|
|
|
private readonly SqlSugarRepository<MappingCarrier> _mappingCarrierRep;
|
|
|
|
|
|
|
|
|
|
private readonly SqlSugarRepository<CodeVessel> _codeVesselRep;
|
|
|
|
|
private readonly SqlSugarRepository<MappingVessel> _mappingVesselRep;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
private readonly SqlSugarRepository<CodeService> _codeServiceRep;
|
|
|
|
|
private readonly SqlSugarRepository<CodeCtn> _codeCtnRep;
|
|
|
|
|
private readonly SqlSugarRepository<MappingCtn> _mappingCtnRep;
|
|
|
|
|
|
|
|
|
|
private readonly SqlSugarRepository<CodeFrt> _codeFrtRep;
|
|
|
|
|
private readonly SqlSugarRepository<MappingFrt> _mappingFrtRep;
|
|
|
|
|
|
|
|
|
|
private readonly ISysCacheService _sysCacheService;
|
|
|
|
|
|
|
|
|
|
public CommonDBService(SqlSugarRepository<CodeCarrier> codeCarrierRep,
|
|
|
|
@ -53,6 +49,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 +66,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
_mappingVesselRep = mappingVesselRep;
|
|
|
|
|
_mappingCtnRep = mappingCtnRep;
|
|
|
|
|
_mappingFrtRep = mappingFrtRep;
|
|
|
|
|
_mappingYardRep = mappingYardRep;
|
|
|
|
|
_sysCacheService = sysCacheService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -96,6 +94,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();
|
|
|
|
|
}
|
|
|
|
@ -112,7 +111,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.Code), x => x.Code.Contains(input.Code, System.StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.MapCode), x => x.MapCode.Contains(input.MapCode, System.StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.Module), x => x.Module == input.Module)
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.MapName), x => x.Code.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase));
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.MapName), x => x.MapName.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase));
|
|
|
|
|
return queryList.ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -125,6 +124,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
|
|
|
|
@ -159,7 +159,6 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
return queryList.ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 新增船名信息
|
|
|
|
|
/// </summary>
|
|
|
|
@ -167,6 +166,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();
|
|
|
|
|
}
|
|
|
|
@ -186,7 +186,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
List<MappingVessel> list = await _sysCacheService.GetAllMappingVessel();
|
|
|
|
|
|
|
|
|
|
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));
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.MapName), x => x.MapName.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase));
|
|
|
|
|
|
|
|
|
|
return queryList.ToList();
|
|
|
|
|
}
|
|
|
|
@ -200,6 +200,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
|
|
|
|
@ -213,7 +214,6 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 船代
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取船代列表信息
|
|
|
|
@ -235,12 +235,12 @@ 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();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 场站
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -262,11 +262,54 @@ 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();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
/// <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.MapName.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase));
|
|
|
|
|
|
|
|
|
|
return queryList.ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 新增编辑场站映射信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpPost("/commondb/addorupdatemappingyard")]
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
#region 起始港
|
|
|
|
|
/// <summary>
|
|
|
|
@ -288,6 +331,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 +365,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 +393,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 +421,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 +451,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();
|
|
|
|
|
}
|
|
|
|
@ -421,7 +469,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.Code), x => x.Code.Contains(input.Code, System.StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.MapCode), x => x.MapCode.Contains(input.MapCode, System.StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.Module), x => x.Module == input.Module)
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.MapName), x => x.Code.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase));
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.MapName), x => x.MapName.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase));
|
|
|
|
|
|
|
|
|
|
return queryList.ToList();
|
|
|
|
|
}
|
|
|
|
@ -435,6 +483,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 +519,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();
|
|
|
|
|
}
|
|
|
|
@ -487,7 +537,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.Code), x => x.Code.Contains(input.Code, System.StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.MapCode), x => x.MapCode.Contains(input.MapCode, System.StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.Module), x => x.Module == input.Module)
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.MapName), x => x.Code.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase));
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.MapName), x => x.MapName.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase));
|
|
|
|
|
|
|
|
|
|
return queryList.ToList();
|
|
|
|
|
}
|
|
|
|
@ -500,6 +550,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
|
|
|
|
@ -510,9 +561,6 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 实现接口,获取公共数据并缓存
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task<List<CodeCarrier>> GetAllCarrier()
|
|
|
|
@ -550,7 +598,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()
|
|
|
|
|
{
|
|
|
|
@ -647,7 +703,4 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|