diff --git a/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs b/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs index 65c6a24a..13a6309b 100644 --- a/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs +++ b/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs @@ -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.条件字段2:若货物标识为危险品,危险品编号,危险品等级,联系人,电话,HSCODE必填。 */ - + /* + 必填字段:去掉 件数、包装、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) diff --git a/Myshipping.Application/Service/BookingCustomerOrder/Dto/Dtos.cs b/Myshipping.Application/Service/BookingCustomerOrder/Dto/Dtos.cs index 6055bd58..c90bf365 100644 --- a/Myshipping.Application/Service/BookingCustomerOrder/Dto/Dtos.cs +++ b/Myshipping.Application/Service/BookingCustomerOrder/Dto/Dtos.cs @@ -889,5 +889,13 @@ namespace Myshipping.Application /// 服务项目 /// public List ServiceItemList { get; set; } + ///// + ///// 订舱账号 + ///// + //public string BOOKINGACCOUNT { get; set; } + ///// + ///// 订舱密码 + ///// + //public string BOOKINGPASSWORD { get; set; } } } diff --git a/Myshipping.Core/Filter/ApiUserFilter.cs b/Myshipping.Core/Filter/ApiUserFilter.cs index e9715be0..7eb610cf 100644 --- a/Myshipping.Core/Filter/ApiUserFilter.cs +++ b/Myshipping.Core/Filter/ApiUserFilter.cs @@ -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>(); + 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("无权调用!请检查授权或联系管理员。"); }