委托单位权限控制

master
zhangxiaofeng 6 months ago
parent b9fcef76f5
commit 4d9994ce96

@ -540,7 +540,7 @@ namespace Myshipping.Application
SELLING_PRICE = x.SELLING_PRICE
}).ToListAsync();
if (saleInfoList != null && saleInfoList.Count > 0)
if (saleInfoList.Any())
{
// 判断是否启用了委托单位查看控制权限
var tenantParamList = await _cache.GetAllTenantParam();
@ -565,17 +565,17 @@ namespace Myshipping.Application
&& !userListStr.Contains(saleInfoItem.CUSTSERVICEID))
{
saleInfoItem.CUSTOMERID = 0;
saleInfoItem.CUSTOMERNAME = "*****";
saleInfoItem.CUSTOMERNAME = "--";
saleInfoItem.OPID = "";
saleInfoItem.OP = "*****";
saleInfoItem.OP = "--";
saleInfoItem.DOCID = "";
saleInfoItem.DOC = "*****";
saleInfoItem.DOC = "--";
saleInfoItem.SALEID = "";
saleInfoItem.SALE = "*****";
saleInfoItem.SHIPPER = "*****";
saleInfoItem.GOODSNAME = "*****";
saleInfoItem.SALE = "--";
saleInfoItem.SHIPPER = "--";
saleInfoItem.GOODSNAME = "--";
saleInfoItem.CUSTSERVICEID = "";
saleInfoItem.CUSTSERVICE = "*****";
saleInfoItem.CUSTSERVICE = "--";
}
}
}
@ -1834,24 +1834,6 @@ 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();
}
}
// 箱型筛选
@ -1892,17 +1874,17 @@ 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(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,
@ -1951,40 +1933,61 @@ namespace Myshipping.Application
CreatedUserId = x.CreatedUserId
}).ToListAsync();
var saleInfoGroup = allocationInfoList.GroupBy(x => x.BOOKING_SLOT_ID);
foreach (var item in saleInfoGroup)
if (allocationInfoList.Any())
{
// 判断是否启用了委托单位查看控制权限
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)
{
// 遍历销售信息,如果销售信息中的“销售、操作、单证、客服、创建人”中不在当前登陆人的权限范围,则隐藏客户信息
foreach (BookingSlotSaleInfoDto saleInfoItem in item)
userList = await _sysDataUserMenuService.GetDataScopeList(MenuConst.MenuDjyCustomer);
if (userList == null || userList.Count == 0)
{
if (!userList.Contains(saleInfoItem.CreatedUserId ?? 0)
&& !userListStr.Contains(saleInfoItem.OPID)
&& !userListStr.Contains(saleInfoItem.DOCID)
&& !userListStr.Contains(saleInfoItem.SALEID)
&& !userListStr.Contains(saleInfoItem.CUSTSERVICEID))
isEnableCustomerAuthority = false;
}
else
{
userListStr = userList.Select(x => x.ToString()).ToList();
}
}
var saleInfoGroup = allocationInfoList.GroupBy(x => x.BOOKING_SLOT_ID);
foreach (var item in saleInfoGroup)
{
if (isEnableCustomerAuthority)
{
// 遍历销售信息,如果销售信息中的“销售、操作、单证、客服、创建人”中不在当前登陆人的权限范围,则隐藏客户信息
foreach (BookingSlotSaleInfoDto saleInfoItem in item)
{
saleInfoItem.CUSTOMERID = 0;
saleInfoItem.CUSTOMERNAME = "*****";
saleInfoItem.OPID = "";
saleInfoItem.OP = "*****";
saleInfoItem.DOCID = "";
saleInfoItem.DOC = "*****";
saleInfoItem.SALEID = "";
saleInfoItem.SALE = "*****";
saleInfoItem.SHIPPER = "*****";
saleInfoItem.GOODSNAME = "*****";
saleInfoItem.CUSTSERVICEID = "";
saleInfoItem.CUSTSERVICE = "*****";
if (!userList.Contains(saleInfoItem.CreatedUserId ?? 0)
&& !userListStr.Contains(saleInfoItem.OPID)
&& !userListStr.Contains(saleInfoItem.DOCID)
&& !userListStr.Contains(saleInfoItem.SALEID)
&& !userListStr.Contains(saleInfoItem.CUSTSERVICEID))
{
saleInfoItem.CUSTOMERID = 0;
saleInfoItem.CUSTOMERNAME = "--";
saleInfoItem.OPID = "";
saleInfoItem.OP = "--";
saleInfoItem.DOCID = "";
saleInfoItem.DOC = "--";
saleInfoItem.SALEID = "";
saleInfoItem.SALE = "--";
saleInfoItem.SHIPPER = "--";
saleInfoItem.GOODSNAME = "--";
saleInfoItem.CUSTSERVICEID = "";
saleInfoItem.CUSTSERVICE = "--";
}
}
}
}
var slot = result.Items.FirstOrDefault(x => x.Id == item.Key);
if (slot != null)
{
slot.BookingSlotSaleInfoList = item.ToList();
var slot = result.Items.FirstOrDefault(x => x.Id == item.Key);
if (slot != null)
{
slot.BookingSlotSaleInfoList = item.ToList();
}
}
}
@ -2581,24 +2584,6 @@ 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;
@ -2638,17 +2623,17 @@ 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(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>()
@ -2693,41 +2678,62 @@ namespace Myshipping.Application
GOODSNAME = x.GOODSNAME,
SELLING_PRICE = x.SELLING_PRICE
}).ToListAsync();
var saleInfoGroup = allocationInfoList.GroupBy(x => x.BOOKING_SLOT_ID);
foreach (var item in saleInfoGroup)
{
if (allocationInfoList.Any())
{
// 判断是否启用了委托单位查看控制权限
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)
{
// 遍历销售信息,如果销售信息中的“销售、操作、单证、客服、创建人”中不在当前登陆人的权限范围,则隐藏客户信息
foreach (BookingSlotSaleInfoDto saleInfoItem in item)
userList = await _sysDataUserMenuService.GetDataScopeList(MenuConst.MenuDjyCustomer);
if (userList == null || userList.Count == 0)
{
if (!userList.Contains(saleInfoItem.CreatedUserId ?? 0)
&& !userListStr.Contains(saleInfoItem.OPID)
&& !userListStr.Contains(saleInfoItem.DOCID)
&& !userListStr.Contains(saleInfoItem.SALEID)
&& !userListStr.Contains(saleInfoItem.CUSTSERVICEID))
{
saleInfoItem.CUSTOMERID = 0;
saleInfoItem.CUSTOMERNAME = "*****";
saleInfoItem.OPID = "";
saleInfoItem.OP = "*****";
saleInfoItem.DOCID = "";
saleInfoItem.DOC = "*****";
saleInfoItem.SALEID = "";
saleInfoItem.SALE = "*****";
saleInfoItem.SHIPPER = "*****";
saleInfoItem.GOODSNAME = "*****";
saleInfoItem.CUSTSERVICEID = "";
saleInfoItem.CUSTSERVICE = "*****";
}
isEnableCustomerAuthority = false;
}
else
{
userListStr = userList.Select(x => x.ToString()).ToList();
}
}
var slot = data.FirstOrDefault(x => x.Id == item.Key);
if (slot != null)
var saleInfoGroup = allocationInfoList.GroupBy(x => x.BOOKING_SLOT_ID);
foreach (var item in saleInfoGroup)
{
slot.BookingSlotSaleInfoList = item.ToList();
if (isEnableCustomerAuthority)
{
// 遍历销售信息,如果销售信息中的“销售、操作、单证、客服、创建人”中不在当前登陆人的权限范围,则隐藏客户信息
foreach (BookingSlotSaleInfoDto saleInfoItem in item)
{
if (!userList.Contains(saleInfoItem.CreatedUserId ?? 0)
&& !userListStr.Contains(saleInfoItem.OPID)
&& !userListStr.Contains(saleInfoItem.DOCID)
&& !userListStr.Contains(saleInfoItem.SALEID)
&& !userListStr.Contains(saleInfoItem.CUSTSERVICEID))
{
saleInfoItem.CUSTOMERID = 0;
saleInfoItem.CUSTOMERNAME = "--";
saleInfoItem.OPID = "";
saleInfoItem.OP = "--";
saleInfoItem.DOCID = "";
saleInfoItem.DOC = "--";
saleInfoItem.SALEID = "";
saleInfoItem.SALE = "--";
saleInfoItem.SHIPPER = "--";
saleInfoItem.GOODSNAME = "--";
saleInfoItem.CUSTSERVICEID = "";
saleInfoItem.CUSTSERVICE = "--";
}
}
}
var slot = data.FirstOrDefault(x => x.Id == item.Key);
if (slot != null)
{
slot.BookingSlotSaleInfoList = item.ToList();
}
}
}

Loading…
Cancel
Save