From d39ce7e86058a429abaf8d80141056220e58ccfb Mon Sep 17 00:00:00 2001 From: zhangxiaofeng <1939543722@qq.com> Date: Thu, 6 Jun 2024 13:53:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A7=94=E6=89=98=E5=8D=95=E4=BD=8D=E7=9B=B8?= =?UTF-8?q?=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BookingSlot/BookingSlotAllocation.cs | 28 +++++++++++-- .../Service/BookingSlot/BookingSlotService.cs | 41 ++++++++++++++++++- Myshipping.Core/Myshipping.Core.xml | 3 +- .../Service/DjyCustomer/DjyCustomerService.cs | 8 ++-- 4 files changed, 70 insertions(+), 10 deletions(-) diff --git a/Myshipping.Application/Entity/BookingSlot/BookingSlotAllocation.cs b/Myshipping.Application/Entity/BookingSlot/BookingSlotAllocation.cs index 550cbcaa..d02081c9 100644 --- a/Myshipping.Application/Entity/BookingSlot/BookingSlotAllocation.cs +++ b/Myshipping.Application/Entity/BookingSlot/BookingSlotAllocation.cs @@ -1,7 +1,6 @@ -using System; -using System.Collections.Generic; -using SqlSugar; using Myshipping.Core.Entity; +using SqlSugar; +using System; /* * @author : whm @@ -276,8 +275,31 @@ namespace Myshipping.Application /// /// 销售名称 /// + //[Description("销售")] public string SALE { get; set; } + /// + /// 操作id + /// + //[Description("操作")] + public string OPID { get; set; } + + /// + /// 操作 + /// + //[Description("操作")] + public string OP { get; set; } + /// + /// 单证id + /// + //[Description("单证")] + public string DOCID { get; set; } + + /// + /// 单证 + /// + //[Description("单证")] + public string DOC { get; set; } /// /// 销售日期 /// diff --git a/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs b/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs index e39cebc0..6c056bf1 100644 --- a/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs +++ b/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs @@ -19,6 +19,7 @@ using Myshipping.Application.Service.BookingLabel.Dto; using Myshipping.Application.Service.BookingOrder.Dto; using Myshipping.Application.Service.BookingSlot.Dto; using Myshipping.Core; +using Myshipping.Core.Const; using Myshipping.Core.Entity; using Myshipping.Core.Service; using NPOI.XSSF.UserModel; @@ -72,6 +73,7 @@ namespace Myshipping.Application private readonly IBookingValueAddedService _bookingValueAddedService; private readonly IBookingLabelService _bookingLabelService; private readonly IDjyTenantParamService _djyTenantParamService; + private readonly ISysDataUserMenu _sysDataUserMenuService; const string CONST_BC_FILE_CODE = "bc"; const string CONST_BC_FILE_NAME = "Booking Confirmation"; @@ -112,7 +114,8 @@ namespace Myshipping.Application INamedServiceProvider namedTaskManageServiceProvider, SqlSugarRepository sysUserRepository, IDjyTenantParamService djyTenantParamService, - SqlSugarRepository repPrintTemplate) + SqlSugarRepository repPrintTemplate, + ISysDataUserMenu sysDataUserMenuService) { _repBase = repBase; _repCtn = repCtn; @@ -142,6 +145,7 @@ namespace Myshipping.Application _namedTaskManageServiceProvider = namedTaskManageServiceProvider; _djyTenantParamService = djyTenantParamService; + _sysDataUserMenuService = sysDataUserMenuService; } #region 舱位 @@ -779,7 +783,7 @@ namespace Myshipping.Application throw Oops.Bah($"slotId={model.Id} 映射推送的舱位请求对应异常,原因:{ex.Message}"); } - + _logger.LogInformation($"slotId={model.Id} 开始处理重要提醒"); //执行差异重要提醒 @@ -1768,6 +1772,26 @@ namespace Myshipping.Application { ISugarQueryable select = null; + // 判断是否启用了委托单位查看控制权限 + var tenantParamList = await _cache.GetAllTenantParam(); + var isEnableCustomerAuthority = tenantParamList.FirstOrDefault(x => x.TenantId == UserManager.TENANT_ID + && x.ParaCode == TenantParamCode.IS_ENABLE_CUSTOMER_AUTHORITY)?.ItemCode == "YES"; + List userList = null; + List userListStr = null; + if (isEnableCustomerAuthority) + { + userList = await _sysDataUserMenuService.GetDataScopeList(MenuConst.MenuDjyCustomer); + if (userList == null || userList.Count == 0) + { + isEnableCustomerAuthority = false; + } + else + { + userListStr = userList.Select(x => x.ToString()).ToList(); + } + } + + // 箱型筛选 string[] ctnCodeArr = null; if (!string.IsNullOrEmpty(input.CTN_STAT)) @@ -1806,12 +1830,25 @@ namespace Myshipping.Application .WhereIF(!string.IsNullOrEmpty(input.LANENAME), u => u.LANENAME.Contains(input.LANENAME)) .WhereIF(input.WEEK_AT != null, u => u.WEEK_AT == input.WEEK_AT) + .WhereIF(isEnableCustomerAuthority, u => SqlFunc.Subqueryable() + .Where(x => x.BOOKING_SLOT_ID == u.Id) + .NotAny() + || SqlFunc.Subqueryable() + .Where(x => x.BOOKING_SLOT_ID == u.Id + && userList.Contains((long)x.CreatedUserId) + || userListStr.Contains(x.OPID) + || userListStr.Contains(x.SALEID) + || userListStr.Contains(x.DOCID) + || userListStr.Contains(x.CUSTSERVICEID)) + .Any()) + // 标签筛选 .WhereIF(input.LabelIdArray != null && input.LabelIdArray.Length > 0, u => SqlFunc.Subqueryable() .Where(x => x.BusinessId == u.Id && input.LabelIdArray.Contains(x.LabelId)) .Any()); + if (ctnCodeArr != null && ctnCodeArr.Length > 0) { var tempSelect = select as ISugarQueryable; diff --git a/Myshipping.Core/Myshipping.Core.xml b/Myshipping.Core/Myshipping.Core.xml index 3d15141e..1b4c18b8 100644 --- a/Myshipping.Core/Myshipping.Core.xml +++ b/Myshipping.Core/Myshipping.Core.xml @@ -904,8 +904,9 @@ - 是否启用委托单位权限显示控制 + 是否启用委托单位权限显示控制 + 开启此参数后,在部分接口查询数据时会根据当前登陆人的权限范围来决定返回哪些委托单位,如委托单位管理台账查询接口、委托单位下拉查询接口、舱位管理台账查询接口、舱位管理详情查询接口等 diff --git a/Myshipping.Core/Service/DjyCustomer/DjyCustomerService.cs b/Myshipping.Core/Service/DjyCustomer/DjyCustomerService.cs index 1d715400..77b1e89c 100644 --- a/Myshipping.Core/Service/DjyCustomer/DjyCustomerService.cs +++ b/Myshipping.Core/Service/DjyCustomer/DjyCustomerService.cs @@ -66,8 +66,8 @@ namespace Myshipping.Core.Service // 判断是否启用了委托单位查看控制权限 var tenantParamList = await _cache.GetAllTenantParam(); var isEnableCustomerAuthority = tenantParamList.FirstOrDefault(x => x.TenantId == UserManager.TENANT_ID - && x.ParaCode == TenantParamCode.IS_ENABLE_CUSTOMER_AUTHORITY)?.ItemCode; - if (isEnableCustomerAuthority == "YES") + && x.ParaCode == TenantParamCode.IS_ENABLE_CUSTOMER_AUTHORITY)?.ItemCode == "YES"; + if (isEnableCustomerAuthority) { List userList = await _sysDataUserMenuService.GetDataScopeList(MenuConst.MenuDjyCustomer); if (userList?.Any() == true) @@ -305,8 +305,8 @@ namespace Myshipping.Core.Service // 判断是否启用了委托单位查看控制权限 var tenantParamList = await _cache.GetAllTenantParam(); var isEnableCustomerAuthority = tenantParamList.FirstOrDefault(x => x.TenantId == UserManager.TENANT_ID - && x.ParaCode == TenantParamCode.IS_ENABLE_CUSTOMER_AUTHORITY)?.ItemCode; - if (isEnableCustomerAuthority == "YES") + && x.ParaCode == TenantParamCode.IS_ENABLE_CUSTOMER_AUTHORITY)?.ItemCode == "YES"; + if (isEnableCustomerAuthority) { List userList = await _sysDataUserMenuService.GetDataScopeList(MenuConst.MenuDjyCustomer); if (userList?.Any() == true)