|
|
|
@ -20,7 +20,7 @@ namespace Myshipping.Core.Service;
|
|
|
|
|
[ApiDescriptionSettings(Name = "CommonDB", Order = 1000)]
|
|
|
|
|
public class CommonDBService : ICommonDBService, IDynamicApiController, ITransient
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
#region
|
|
|
|
|
private readonly SqlSugarRepository<CodeCarrier> _codeCarrierRep;
|
|
|
|
|
private readonly SqlSugarRepository<MappingCarrier> _mappingCarrierRep;
|
|
|
|
|
private readonly SqlSugarRepository<CodeVessel> _codeVesselRep;
|
|
|
|
@ -94,6 +94,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 船公司
|
|
|
|
|
/// <summary>
|
|
|
|
@ -117,6 +118,12 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
[HttpPost("/commondb/addcarrier")]
|
|
|
|
|
public async Task AddCarrier([FromBody] CodeCarrierDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllCodeCarrier();
|
|
|
|
|
var count = list.Where(x => x.Code == dto.Code).Count();
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
}
|
|
|
|
|
var entity = dto.Adapt<CodeCarrier>();
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
@ -153,6 +160,11 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
[HttpPost("/commondb/addorupdatemappingcarrier")]
|
|
|
|
|
public async Task AddOrUpdateMappingCarrier([FromBody] MappingCarrierDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllMappingCarrier();
|
|
|
|
|
var count = list.Where(x => x.Module == dto.Module && x.Code == dto.Code && x.GID != dto.GID).Count();
|
|
|
|
|
if (count>0) {
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
}
|
|
|
|
|
var entity = dto.Adapt<MappingCarrier>();
|
|
|
|
|
if (string.IsNullOrWhiteSpace(dto.GID))
|
|
|
|
|
{
|
|
|
|
@ -200,6 +212,12 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
[HttpPost("/commondb/addvessel")]
|
|
|
|
|
public async Task AddVessel([FromBody] CodeVesselDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllCodeVessel();
|
|
|
|
|
var count = list.Where(x => x.Name.Trim() == dto.Name.Trim()).Count();
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
}
|
|
|
|
|
var entity = dto.Adapt<CodeVessel>();
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
@ -235,6 +253,16 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
[HttpPost("/commondb/addorupdatevessel")]
|
|
|
|
|
public async Task AddOrUpdateMappingVessel([FromBody] MappingVesselDto dto)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var list = await _sysCacheService.GetAllMappingVessel();
|
|
|
|
|
var count = list.Where(x => x.Name.Trim() == dto.Name.Trim()&&x.Module==dto.Module && x.GID != dto.GID).Count();
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var entity = dto.Adapt<MappingVessel>();
|
|
|
|
|
if (string.IsNullOrWhiteSpace(dto.GID))
|
|
|
|
|
{
|
|
|
|
@ -276,6 +304,12 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
[HttpPost("/commondb/addforwarder")]
|
|
|
|
|
public async Task AddForwarder([FromBody] CodeForwarderDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllCodeForwarder();
|
|
|
|
|
var count = list.Where(x => x.Code == dto.Code).Count();
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
}
|
|
|
|
|
var entity = dto.Adapt<CodeForwarder>();
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
@ -306,6 +340,13 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
[HttpPost("/commondb/addyard")]
|
|
|
|
|
public async Task AddYard([FromBody] CodeYardDto dto)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var list = await _sysCacheService.GetAllCodeYard();
|
|
|
|
|
var count = list.Where(x => x.Code == dto.Code).Count();
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
}
|
|
|
|
|
var entity = dto.Adapt<CodeYard>();
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
@ -344,6 +385,13 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
[HttpPost("/commondb/addorupdatemappingyard")]
|
|
|
|
|
public async Task AddOrUpdateMappingYard([FromBody] MappingYardDto dto)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var list = await _sysCacheService.GetAllMappingYard();
|
|
|
|
|
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<MappingYard>();
|
|
|
|
|
if (string.IsNullOrWhiteSpace(dto.GID))
|
|
|
|
|
{
|
|
|
|
@ -388,6 +436,12 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
[HttpPost("/commondb/addportload")]
|
|
|
|
|
public async Task AddPortload([FromBody] CodePortLoadDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllCodePortLoad();
|
|
|
|
|
var count = list.Where(x => x.Code == dto.Code ).Count();
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
}
|
|
|
|
|
var entity = dto.Adapt<CodePortLoad>();
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
@ -427,6 +481,12 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
[HttpPost("/commondb/addorupdatemappingportload")]
|
|
|
|
|
public async Task AddOrUpdatePortload([FromBody] MappingPortLoadDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllMappingPortLoad();
|
|
|
|
|
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<MappingPortLoad>();
|
|
|
|
|
if (string.IsNullOrWhiteSpace(dto.GID))
|
|
|
|
|
{
|
|
|
|
@ -472,6 +532,12 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
[HttpPost("/commondb/addport")]
|
|
|
|
|
public async Task AddPort([FromBody] CodePortDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllCodePort();
|
|
|
|
|
var count = list.Where(x => x.Code == dto.Code ).Count();
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
}
|
|
|
|
|
var entity = dto.Adapt<CodePort>();
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
@ -510,6 +576,12 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
[HttpPost("/commondb/addorupdatemappingport")]
|
|
|
|
|
public async Task AddOrUpdatePort([FromBody] MappingPortDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllMappingPort();
|
|
|
|
|
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<MappingPort>();
|
|
|
|
|
if (string.IsNullOrWhiteSpace(dto.GID))
|
|
|
|
|
{
|
|
|
|
@ -550,6 +622,12 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
[HttpPost("/commondb/addpackage")]
|
|
|
|
|
public async Task AddPackage([FromBody] CodePackageDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllCodePackage();
|
|
|
|
|
var count = list.Where(x => x.Code == dto.Code ).Count();
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
}
|
|
|
|
|
var entity = dto.Adapt<CodePackage>();
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
await _codePackageRep.InsertAsync(entity);
|
|
|
|
@ -588,6 +666,12 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
[HttpPost("/commondb/addorupdatemappingpackage")]
|
|
|
|
|
public async Task AddOrUpdateMappingPackage([FromBody] MappingPackageDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllMappingPackage();
|
|
|
|
|
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<MappingPackage>();
|
|
|
|
|
if (string.IsNullOrWhiteSpace(dto.GID))
|
|
|
|
|
{
|
|
|
|
@ -629,6 +713,12 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
[HttpPost("/commondb/addservice")]
|
|
|
|
|
public async Task AddService([FromBody] CodeServiceDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllCodeService();
|
|
|
|
|
var count = list.Where(x => x.Code == dto.Code ).Count();
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
}
|
|
|
|
|
var entity = dto.Adapt<CodeService>();
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
@ -668,6 +758,12 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
[HttpPost("/commondb/addorupdatemappingservice")]
|
|
|
|
|
public async Task AddOrUpdateMappingService([FromBody] MappingServiceDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllMappingService();
|
|
|
|
|
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<MappingService>();
|
|
|
|
|
if (string.IsNullOrWhiteSpace(dto.GID))
|
|
|
|
|
{
|
|
|
|
@ -711,6 +807,12 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
[HttpPost("/commondb/addctn")]
|
|
|
|
|
public async Task AddCtn([FromBody] CodeCtnDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllCodeCtn();
|
|
|
|
|
var count = list.Where(x => x.Code == dto.Code ).Count();
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
}
|
|
|
|
|
var entity = dto.Adapt<CodeCtn>();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
|
entity.CreateUser = UserManager.DjyUserId;
|
|
|
|
@ -750,6 +852,12 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
[HttpPost("/commondb/addmappingctn")]
|
|
|
|
|
public async Task AddOrUpdateMappingCtn([FromBody] MappingCtnDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllMappingCtn();
|
|
|
|
|
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<MappingCtn>();
|
|
|
|
|
if (string.IsNullOrWhiteSpace(dto.GID))
|
|
|
|
|
{
|
|
|
|
@ -795,6 +903,12 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
[HttpPost("/commondb/addfrt")]
|
|
|
|
|
public async Task AddFrt([FromBody] CodeFrtDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllCodeFrt();
|
|
|
|
|
var count = list.Where(x => x.Code == dto.Code ).Count();
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
}
|
|
|
|
|
var entity = dto.Adapt<CodeFrt>();
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
@ -830,6 +944,12 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
[HttpPost("/commondb/addmappingfrt")]
|
|
|
|
|
public async Task AddOrUpdateMappingFrt([FromBody] MappingFrtDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllMappingFrt();
|
|
|
|
|
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<MappingFrt>();
|
|
|
|
|
if (string.IsNullOrWhiteSpace(dto.GID))
|
|
|
|
|
{
|
|
|
|
@ -871,6 +991,12 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
[HttpPost("/commondb/addcodeissuetype")]
|
|
|
|
|
public async Task AddCodeIssueType([FromBody] CodeIssueTypeDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllCodeIssueType();
|
|
|
|
|
var count = list.Where(x => x.Code == dto.Code ).Count();
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
}
|
|
|
|
|
var entity = dto.Adapt<CodeIssueType>();
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
|