委托单位相关

master
zhangxiaofeng 6 months ago
parent 56d9375cbc
commit d39ce7e860

@ -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
/// <summary>
/// 销售名称
/// </summary>
//[Description("销售")]
public string SALE { get; set; }
/// <summary>
/// 操作id
/// </summary>
//[Description("操作")]
public string OPID { get; set; }
/// <summary>
/// 操作
/// </summary>
//[Description("操作")]
public string OP { get; set; }
/// <summary>
/// 单证id
/// </summary>
//[Description("单证")]
public string DOCID { get; set; }
/// <summary>
/// 单证
/// </summary>
//[Description("单证")]
public string DOC { get; set; }
/// <summary>
/// 销售日期
/// </summary>

@ -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<ITaskManageService> namedTaskManageServiceProvider,
SqlSugarRepository<SysUser> sysUserRepository,
IDjyTenantParamService djyTenantParamService,
SqlSugarRepository<BookingPrintTemplate> repPrintTemplate)
SqlSugarRepository<BookingPrintTemplate> 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<BookingSlotBase> 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<long> userList = null;
List<string> 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<BookingSlotAllocation>()
.Where(x => x.BOOKING_SLOT_ID == u.Id)
.NotAny()
|| SqlFunc.Subqueryable<BookingSlotAllocation>()
.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<BookingLabelAllocation>()
.Where(x => x.BusinessId == u.Id && input.LabelIdArray.Contains(x.LabelId))
.Any());
if (ctnCodeArr != null && ctnCodeArr.Length > 0)
{
var tempSelect = select as ISugarQueryable<BookingSlotBase, BookingSlotCtn>;

@ -904,8 +904,9 @@
</member>
<member name="F:Myshipping.Core.Const.TenantParamCode.IS_ENABLE_CUSTOMER_AUTHORITY">
<summary>
是否启用委托单位权限显示控制
是否启用委托单位权限显示控制
</summary>
<remarks>开启此参数后,在部分接口查询数据时会根据当前登陆人的权限范围来决定返回哪些委托单位,如委托单位管理台账查询接口、委托单位下拉查询接口、舱位管理台账查询接口、舱位管理详情查询接口等</remarks>
</member>
<member name="P:Myshipping.Core.Entity.CodeCarrier.Code">
<summary>

@ -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<long> 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<long> userList = await _sysDataUserMenuService.GetDataScopeList(MenuConst.MenuDjyCustomer);
if (userList?.Any() == true)

Loading…
Cancel
Save