booking_auth_dev
wet 2 years ago
parent ab8385dc72
commit 1e5eddd6a5

@ -255,28 +255,7 @@ namespace Myshipping.Application
if (!string.IsNullOrWhiteSpace(input.YARDID) && !string.IsNullOrWhiteSpace(input.YARD) && !string.IsNullOrWhiteSpace(input.MBLNO))
{
_logger.LogInformation("提单号:" + input.MBLNO + " 调用运踪接口");
var key = _webconfig.FirstOrDefault(x => x.TenantId == Convert.ToInt64(UserManager.TENANT_ID) && x.TypeCode == "seae_billtraceurl");
var url = _cache.GetAllDictData().Result;
BillTraceDto billdto = new BillTraceDto();
List<BillTraceList> billTraceList = new List<BillTraceList>();
billTraceList.Add(new BillTraceList
{
MBLNO = input.MBLNO,
YARD = input.YARD,
YardCode = input.YARDID,
CARRIER = null,
CARRIERID = null,
isBook = false
});
billdto.Children = billTraceList;
billdto.Key = key.Account;
billdto.PWD = key.Password;
var json = billdto.ToJsonString();
var html = await url.FirstOrDefault(x=>x.TypeCode== "url_set"&&x.Code== "seae_billtraceurl").Value.SetHttpMethod(HttpMethod.Post).SetQueries(new { msg = json }).SetRetryPolicy(3, 5000).SendAsAsync<RespCommon>();
_logger.LogInformation("提单号:" + input.MBLNO + " 调用运踪接口返回" + html.ToJsonString());
await SendTrace(input.YARDID, input.YARD, input.MBLNO);
}
}
@ -380,29 +359,9 @@ namespace Myshipping.Application
});
if (descriptor.Name == "YARDID" || descriptor.Name == "YARD" || descriptor.Name == "MBLNO")
{
if (!string.IsNullOrWhiteSpace(input.YARDID) && !string.IsNullOrWhiteSpace(input.YARD) && !string.IsNullOrWhiteSpace(input.MBLNO))
{
_logger.LogInformation("提单号:" + input.MBLNO + " 调用运踪接口");
var key = _webconfig.FirstOrDefault(x => x.TenantId == Convert.ToInt64(UserManager.TENANT_ID) && x.TypeCode == "seae_billtraceurl");
var url = _cache.GetAllDictData().Result;
BillTraceDto billdto = new BillTraceDto();
List<BillTraceList> billTraceList = new List<BillTraceList>();
billTraceList.Add(new BillTraceList
{
MBLNO = input.MBLNO,
YARD = input.YARD,
YardCode = input.YARDID,
CARRIER = null,
CARRIERID = null,
isBook = false
});
billdto.Children = billTraceList;
billdto.Key = key.Account;
billdto.PWD = key.Password;
var json = billdto.ToJsonString();
var html = await url.FirstOrDefault(x => x.TypeCode == "url_set" && x.Code == "seae_billtraceurl").Value.SetHttpMethod(HttpMethod.Post).SetQueries(new { msg = json }).SetRetryPolicy(3, 5000).SendAsAsync<RespCommon>();
_logger.LogInformation("提单号:" + input.MBLNO + " 调用运踪接口返回" + html.ToJsonString());
await SendTrace(input.YARDID, input.YARD, input.MBLNO);
}
}
}
@ -550,5 +509,31 @@ namespace Myshipping.Application
var list = await _bookingfile.FirstOrDefaultAsync(u => u.BookingId == Id);
return list;
}
public async Task SendTrace(string YARDID, string YARD, string MBLNO)
{
_logger.LogInformation("提单号:" + MBLNO + " 调用运踪接口");
var key = _webconfig.FirstOrDefault(x => x.TenantId == Convert.ToInt64(UserManager.TENANT_ID) && x.TypeCode == "seae_billtraceurl");
var url = _cache.GetAllDictData().Result;
BillTraceDto billdto = new BillTraceDto();
List<BillTraceList> billTraceList = new List<BillTraceList>();
billTraceList.Add(new BillTraceList
{
MBLNO = MBLNO,
YARD = YARD,
YardCode = YARDID,
CARRIER = null,
CARRIERID = null,
isBook = false
});
billdto.Children = billTraceList;
billdto.Key = key.Account;
billdto.PWD = key.Password;
var json = billdto.ToJsonString();
var html = await url.FirstOrDefault(x => x.TypeCode == "url_set" && x.Code == "seae_billtraceurl").Value.SetHttpMethod(HttpMethod.Post).SetQueries(new { msg = json }).SetRetryPolicy(3, 5000).SendAsAsync<RespCommon>();
_logger.LogInformation("提单号:" + MBLNO + " 调用运踪接口返回" + html.ToJsonString());
}
}
}

@ -26,5 +26,7 @@ namespace Myshipping.Application
Task AddFile(IFormFile file, [FromForm] BookingFileDto dto);
Task<BookingFile> GetFile(long Id);
Task SendTrace(string YARDID, string YARD, string MBLNO);
}
}

@ -17,4 +17,6 @@ public interface ISysDictDataService
Task<dynamic> QueryDictDataPageList([FromQuery] DictDataInput input);
Task UpdateDictData(UpdateDictDataInput input);
Task<List<SysDictData>> GetDictDataByCode(string code);
Task CacheData();
}

@ -79,19 +79,7 @@ public class SysDictDataService : ISysDictDataService, IDynamicApiController, IT
await _sysDictDataRep.InsertAsync(dictData);
////设置缓存
await _cache.DelAsync(CommonConst.CACHE_KEY_COMMON_DB_DICT_DATA);
var list = await _sysDictDataRep.AsQueryable().InnerJoin<SysDictType>((d, t) => d.TypeId == t.Id).Where((d, t) => t.Status == CommonStatus.ENABLE && d.Status == CommonStatus.ENABLE).Select((d, t) => new DictDataDto
{
Id = d.Id,
TypeName = t.Name,
TypeCode = t.Code,
Value = d.Value,
Code = d.Code,
Sort = d.Sort,
Remark = d.Remark
}).ToListAsync();
await _cache.SetAllDictData(list);
await CacheData();
}
@ -110,19 +98,7 @@ public class SysDictDataService : ISysDictDataService, IDynamicApiController, IT
await _sysDictDataRep.DeleteAsync(dictData);
////设置缓存
await _cache.DelAsync(CommonConst.CACHE_KEY_COMMON_DB_DICT_DATA);
var list = await _sysDictDataRep.AsQueryable().InnerJoin<SysDictType>((d, t) => d.TypeId == t.Id).Where((d, t) => t.Status == CommonStatus.ENABLE && d.Status == CommonStatus.ENABLE).Select((d, t) => new DictDataDto
{
Id = d.Id,
TypeName = t.Name,
TypeCode = t.Code,
Value = d.Value,
Code = d.Code,
Sort = d.Sort,
Remark = d.Remark
}).ToListAsync();
await _cache.SetAllDictData(list);
await CacheData();
}
/// <summary>
@ -144,19 +120,7 @@ public class SysDictDataService : ISysDictDataService, IDynamicApiController, IT
await _sysDictDataRep.AsUpdateable(dictData).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
////设置缓存
await _cache.DelAsync(CommonConst.CACHE_KEY_COMMON_DB_DICT_DATA);
var list = await _sysDictDataRep.AsQueryable().InnerJoin<SysDictType>((d, t) => d.TypeId == t.Id).Where((d, t) => t.Status == CommonStatus.ENABLE && d.Status == CommonStatus.ENABLE).Select((d, t) => new DictDataDto
{
Id = d.Id,
TypeName = t.Name,
TypeCode = t.Code,
Value = d.Value,
Code = d.Code,
Sort = d.Sort,
Remark = d.Remark
}).ToListAsync();
await _cache.SetAllDictData(list);
await CacheData();
}
/// <summary>
@ -185,19 +149,7 @@ public class SysDictDataService : ISysDictDataService, IDynamicApiController, IT
throw Oops.Oh(ErrorCode.D3005);
dictData.Status = input.Status;
////设置缓存
await _cache.DelAsync(CommonConst.CACHE_KEY_COMMON_DB_DICT_DATA);
var list = await _sysDictDataRep.AsQueryable().InnerJoin<SysDictType>((d, t) => d.TypeId == t.Id).Where((d, t) => t.Status == CommonStatus.ENABLE && d.Status == CommonStatus.ENABLE).Select((d, t) => new DictDataDto
{
Id = d.Id,
TypeName = t.Name,
TypeCode = t.Code,
Value = d.Value,
Code = d.Code,
Sort = d.Sort,
Remark = d.Remark
}).ToListAsync();
await _cache.SetAllDictData(list);
await CacheData();
}
/// <summary>
@ -226,8 +178,29 @@ public class SysDictDataService : ISysDictDataService, IDynamicApiController, IT
{
await _sysDictDataRep.DeleteAsync(u => u.TypeId == dictTypeId);
////设置缓存
await _cache.DelAsync(CommonConst.CACHE_KEY_COMMON_DB_DICT_DATA);
await CacheData();
}
/// <summary>
/// 根据字典Code返回字典值列表
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
[NonAction]
public async Task<List<SysDictData>> GetDictDataByCode(string code)
{
var payment = await _sysDictDataRep.AsQueryable().InnerJoin<SysDictType>((d, t) => d.TypeId == t.Id).Where((d, t) => t.Code == code).Select<SysDictData>().ToListAsync();
return payment;
}
/// <summary>
/// 缓存数据
/// </summary>
/// <returns></returns>
/// <exception cref="System.NotImplementedException"></exception>
[NonAction]
public async Task CacheData()
{
var list = await _sysDictDataRep.AsQueryable().InnerJoin<SysDictType>((d, t) => d.TypeId == t.Id).Where((d, t) => t.Status == CommonStatus.ENABLE && d.Status == CommonStatus.ENABLE).Select((d, t) => new DictDataDto
{
Id = d.Id,
@ -242,15 +215,4 @@ public class SysDictDataService : ISysDictDataService, IDynamicApiController, IT
}
/// <summary>
/// 根据字典Code返回字典值列表
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
[NonAction]
public async Task<List<SysDictData>> GetDictDataByCode(string code)
{
var payment = await _sysDictDataRep.AsQueryable().InnerJoin<SysDictType>((d, t) => d.TypeId == t.Id).Where((d, t) => t.Code == code).Select<SysDictData>().ToListAsync();
return payment;
}
}

@ -113,6 +113,9 @@ public class Startup : AppStartup
//缓存EDI数据
App.GetService<IDjyEdiSettingService>().CacheData();
//缓存字典数据
App.GetService<ISysDictDataService>().CacheData();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)

Loading…
Cancel
Save