客户订舱接收东胜推送添加验证;api接口授权添加日志

master
zhangxiaofeng 8 months ago
parent 262183c323
commit 2f9da19c65

@ -577,7 +577,7 @@ namespace Myshipping.Application
//2023-9-1衣国豪点击发送订舱时最少得填写船公司船期目的地品名箱型箱量重量如果以上信息没填允许保存但是发送订舱时给出提示 XXX不能为空请补充后重新发送
var emptyCtn = ctnList.Where(x => string.IsNullOrEmpty(x.CTNALL) || !x.CTNNUM.HasValue).Select(x => x.BILLID).Distinct().ToList();
if (emptyKgs.Any())
if (emptyCtn.Any())
{
var emptyCtnOrd = orderList.Where(x => emptyCtn.Contains(x.Id)).Select(x => x.BOOKINGNO).ToList();
throw Oops.Bah($"箱型箱量不能为空:\r\n{string.Join("\r\n", emptyCtnOrd)}\r\n请补充后重新发送");
@ -1769,12 +1769,28 @@ namespace Myshipping.Application
2.1湿
3.2HSCODE
*/
/*
HSCODE
*/
if (string.IsNullOrEmpty(input.BSNO))
{
throw Oops.Bah("未提供业务ID");
}
if (string.IsNullOrEmpty(input.CONTRACTNO))
{
throw Oops.Bah("合约号不能为空");
}
//if (string.IsNullOrEmpty(input.BOOKINGACCOUNT))
//{
// throw Oops.Bah("订舱账号不能为空");
//}
//if (string.IsNullOrEmpty(input.BOOKINGPASSWORD))
//{
// throw Oops.Bah("订舱密码不能为空");
//}
if (string.IsNullOrEmpty(input.CARRIERID) || string.IsNullOrEmpty(input.CARRIER))
{
throw Oops.Bah("船司代码和名称不能为空");
@ -1805,34 +1821,51 @@ namespace Myshipping.Application
throw Oops.Bah("付费方式不能为空");
}
if (!input.PKGS.HasValue)
{
throw Oops.Bah("件数不能为空");
}
if (!input.KGS.HasValue)
{
throw Oops.Bah("重量不能为空");
}
if (string.IsNullOrEmpty(input.KINDPKGS))
{
throw Oops.Bah("包装不能为空");
}
if (string.IsNullOrEmpty(input.CARGOID))
{
throw Oops.Bah("货物标识不能为空");
}
if (string.IsNullOrEmpty(input.DESCRIPTION))
if (input.CARGOID == "R")
{
throw Oops.Bah("品名不能为空");
if (string.IsNullOrEmpty(input.TEMPSET))
{
throw Oops.Bah("货物标识为冻柜的情况下,温度不能为空");
}
if (string.IsNullOrEmpty(input.REEFERF))
{
throw Oops.Bah("货物标识为冻柜的情况下,通风度不能为空");
}
if (string.IsNullOrEmpty(input.HUMIDITY))
{
throw Oops.Bah("货物标识为冻柜的情况下,湿度不能为空");
}
}
else if (input.CARGOID == "D")
{
if (string.IsNullOrEmpty(input.DCLASS))
{
throw Oops.Bah("货物标识为危险品的情况下,危险品等级不能为空");
}
if (string.IsNullOrEmpty(input.LINKMAN))
{
throw Oops.Bah("货物标识为危险品的情况下,危险品联系人不能为空");
}
if (string.IsNullOrEmpty(input.DTEL))
{
throw Oops.Bah("货物标识为危险品的情况下,危险品联系电话不能为空");
}
}
if (string.IsNullOrEmpty(input.HSCODE))
if (string.IsNullOrEmpty(input.DESCRIPTION))
{
throw Oops.Bah("HSCODE不能为空");
throw Oops.Bah("品名不能为空");
}
if (input.CtnList == null || input.CtnList.Count == 0)

@ -889,5 +889,13 @@ namespace Myshipping.Application
/// 服务项目
/// </summary>
public List<BookingServiceItemCustomerDto> ServiceItemList { get; set; }
///// <summary>
///// 订舱账号
///// </summary>
//public string BOOKINGACCOUNT { get; set; }
///// <summary>
///// 订舱密码
///// </summary>
//public string BOOKINGPASSWORD { get; set; }
}
}

@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Logging;
using Myshipping.Core.Entity;
using System;
using System.Collections.Generic;
@ -72,6 +73,29 @@ namespace Myshipping.Core
return next();
}
}
var logger = App.GetService<ILogger<ApiUserFilter>>();
var isHasKey = context.HttpContext.Request.Headers.ContainsKey(CommonConst.API_USER_HEADER_KEY);
var isHasSecret = context.HttpContext.Request.Headers.ContainsKey(CommonConst.API_USER_HEADER_SECRET);
var log = $"ApiUserFilter: {actionDescriptor?.DisplayName},无权调用!请检查授权或联系管理员,";
if (isHasKey)
{
log += $"{CommonConst.API_USER_HEADER_KEY}{context.HttpContext.Request.Headers[CommonConst.API_USER_HEADER_KEY]}";
}
else
{
log += $"{CommonConst.API_USER_HEADER_KEY}:空";
}
if (isHasSecret)
{
log += $"{CommonConst.API_USER_HEADER_SECRET}{context.HttpContext.Request.Headers[CommonConst.API_USER_HEADER_SECRET]}";
}
else
{
log += $"{CommonConst.API_USER_HEADER_SECRET}:空";
}
logger.LogError(log);
throw Oops.Oh("无权调用!请检查授权或联系管理员。");
}

Loading…
Cancel
Save