修改格式单比对接口,增加API认证

optimize
jianghaiqing 1 year ago
parent 7d8b2b0e29
commit 2a59bf6eae

@ -72,7 +72,7 @@ namespace Myshipping.Application
/// <param name="file">请求文件</param>
/// <param name="jsonData">邮件Draft比对请求报文</param>
/// <returns>返回回执</returns>
[AllowAnonymous,HttpPost("/TaskDraftCompare/ExcuteEmailDraftCompare")]
[AllowAnonymous,HttpPost("/TaskDraftCompare/ExcuteEmailDraftCompare"), ApiUser(ApiCode = "ExcuteEmailDraftCompare")]
public async Task<TaskManageExcuteResultDto> ExcuteEmailDraftCompareAsync(IFormFile file, [FromForm] string jsonData)
{
string batchNo = IDGen.NextID().ToString();
@ -161,7 +161,7 @@ namespace Myshipping.Application
}
var bookingOrder = _bookingOrderRepository.AsQueryable().Filter(null, true)
.First(a => a.MBLNO.Equals(billNo) && !a.IsDeleted && a.TenantId == long.Parse(model.Main.TenantId));
.First(a => a.MBLNO.Equals(billNo) && !a.IsDeleted && a.TenantId == UserManager.TENANT_ID);
if (bookingOrder == null)
{
@ -194,12 +194,12 @@ namespace Myshipping.Application
var userInfo = _sysUserRepository.AsQueryable().First(a => a.Id == bookingOrder.CreatedUserId);
mainInfo.BusiPKId = bookingOrder.Id.ToString();
mainInfo.UserId = bookingOrder.CreatedUserId.ToString();
mainInfo.UserName = bookingOrder.CreatedUserName;
mainInfo.UserEmail = userInfo?.Email;
mainInfo.UserId = UserManager.UserId.ToString();
mainInfo.UserName = UserManager.Name;
mainInfo.UserEmail = UserManager.Email;
var contaList = _bookingOrderContaRepository.AsQueryable().Filter(null,true)
.Where(x => x.BILLID == bookingOrder.Id && !x.IsDeleted && x.TenantId == long.Parse(model.Main.TenantId)).ToList();
.Where(x => x.BILLID == bookingOrder.Id && !x.IsDeleted && x.TenantId == UserManager.TENANT_ID).ToList();
_logger.LogInformation("批次={no} 提取箱完成 数量={total}", batchNo, contaList.Count);
@ -227,7 +227,7 @@ namespace Myshipping.Application
_logger.LogInformation("批次={no} 对应请求报文完成 msg={msg}", batchNo, JSON.Serialize(msgModel));
var entity = _bookingOrderRepository.AsQueryable().Filter(null, true)
.First(a => a.Id == bookingOrder.Id && !a.IsDeleted && a.TenantId == long.Parse(model.Main.TenantId));
.First(a => a.Id == bookingOrder.Id && !a.IsDeleted && a.TenantId == UserManager.TENANT_ID);
entity.LstDraftCompareRlt = compareResult.extra2.Any(a => a.IsDiff) ? "DIFF" : "NO DIFF";
entity.LstDraftCompareDate = nowDate;
@ -598,7 +598,7 @@ namespace Myshipping.Application
/// <param name="fileAttach">请求附件文件</param>
/// <param name="jsonData">邮件Draft比对请求报文</param>
/// <returns>返回回执</returns>
[AllowAnonymous, HttpPost("/TaskDraftCompare/ExcuteEmailAttachedSheetDraftCompare")]
[AllowAnonymous, HttpPost("/TaskDraftCompare/ExcuteEmailAttachedSheetDraftCompare"), ApiUser(ApiCode = "ExcuteEmailDraftCompare")]
public async Task<TaskManageExcuteResultDto> ExcuteEmailAttachedSheetDraftCompareAsync(IFormFile file, IFormFile fileAttach, string jsonData)
{
string batchNo = IDGen.NextID().ToString();
@ -748,12 +748,12 @@ namespace Myshipping.Application
var userInfo = _sysUserRepository.AsQueryable().First(a => a.Id == bookingOrder.CreatedUserId);
mainInfo.BusiPKId = bookingOrder.Id.ToString();
mainInfo.UserId = bookingOrder.CreatedUserId.ToString();
mainInfo.UserName = bookingOrder.CreatedUserName;
mainInfo.UserEmail = userInfo?.Email;
mainInfo.UserId = UserManager.UserId.ToString();
mainInfo.UserName = UserManager.Name;
mainInfo.UserEmail = UserManager.Email;
var contaList = _bookingOrderContaRepository.AsQueryable().Filter(null, true)
.Where(x => x.BILLID == bookingOrder.Id && !x.IsDeleted && x.TenantId == long.Parse(model.Main.TenantId))
.Where(x => x.BILLID == bookingOrder.Id && !x.IsDeleted && x.TenantId == UserManager.TENANT_ID)
.ToList();
_logger.LogInformation("批次={no} 提取箱完成 数量={total}", batchNo, contaList.Count);
@ -782,7 +782,7 @@ namespace Myshipping.Application
_logger.LogInformation("批次={no} 对应请求报文完成 msg={msg}", batchNo, JSON.Serialize(msgModel));
var entity = _bookingOrderRepository.AsQueryable().Filter(null, true)
.First(a => a.Id == bookingOrder.Id && !a.IsDeleted && a.TenantId == long.Parse(model.Main.TenantId));
.First(a => a.Id == bookingOrder.Id && !a.IsDeleted && a.TenantId == UserManager.TENANT_ID);
entity.LstDraftCompareRlt = compareResult.extra2.Any(a => a.IsDiff) ? "DIFF" : "NO DIFF";
entity.LstDraftCompareDate = nowDate;

@ -2224,20 +2224,6 @@ namespace Myshipping.Application
_logger.LogInformation("批次={no} 请求保存服务项目 modifyjson={msg}", batchNo, JSON.Serialize(model));
string operUserId = bookingOrder.CreatedUserId.ToString();
string operUserName = bookingOrder.CreatedUserName;
//这里因为没有登录所以导致异常,因为当前接口是不验证登录的所以这里加了异常捕获,异常后登录人从订舱上制单人取。
try
{
operUserId = UserManager.UserId.ToString();
operUserName = UserManager.Name;
}
catch (Exception ex)
{
_logger.LogInformation("批次={no} 这里因为是非登录请求接口所以自动捕获异常", batchNo);
}
TrackingMessageInfo msgInfo = new TrackingMessageInfo
{
Head = new TrackingMessageHeadInfo
@ -2263,8 +2249,8 @@ namespace Myshipping.Application
OperTenantId = bookingOrder.TenantId.Value,
OperTenantName = bookingOrder.TenantName,
OpertType = TrackingOperTypeEnum.MANUAL,
OperUserId = operUserId,
OperUserName = operUserName,
OperUserId = UserManager.UserId.ToString(),
OperUserName = UserManager.Name,
SourceType = model.SourceType,
StatusList = model.StatusCodes.Select(a => new TrackingMessageMainStatusInfo
{
@ -2332,19 +2318,6 @@ namespace Myshipping.Application
_logger.LogInformation("批次={no} 请求保存服务项目 modifyjson={msg}", batchNo, JSON.Serialize(model));
string operUserId = bookingOrder.CreatedUserId.ToString();
string operUserName = bookingOrder.CreatedUserName;
try
{
operUserId = UserManager.UserId.ToString();
operUserName = UserManager.Name;
}
catch (Exception ex)
{
_logger.LogInformation("批次={no} 这里因为是非登录请求接口所以自动捕获异常", batchNo);
}
TrackingMessageInfo msgInfo = new TrackingMessageInfo
{
Head = new TrackingMessageHeadInfo
@ -2370,8 +2343,8 @@ namespace Myshipping.Application
OperTenantId = bookingOrder.TenantId.Value,
OperTenantName = bookingOrder.TenantName,
OpertType = TrackingOperTypeEnum.MANUAL,
OperUserId = operUserId,
OperUserName = operUserName,
OperUserId = UserManager.UserId.ToString(),
OperUserName = UserManager.Name,
SourceType = model.SourceType,
StatusList = model.StatusCodes.Select(a => new TrackingMessageMainStatusInfo
{

Loading…
Cancel
Save