jianghaiqing 2 months ago
commit 05f94b4d13

@ -34,7 +34,9 @@ public class AutofacModuleRegister : Autofac.Module
.AsImplementedInterfaces()
.InstancePerDependency()
.PropertiesAutowired()
.EnableInterfaceInterceptors(); //引用Autofac.Extras.DynamicProxy
.EnableInterfaceInterceptors()
//.InstancePerLifetimeScope()
; //引用Autofac.Extras.DynamicProxy
//.InterceptedBy(cacheType.ToArray());//允许将拦截器服务的列表分配给注册。
#endregion 带有接口层的服务注入

@ -17,7 +17,7 @@ namespace DS.WMS.Core.Application.Dtos
/// <summary>
/// 业务信息
/// </summary>
public List<BizItem> Items { get; set; } = [];
public List<FeeClient> Items { get; set; } = [];
/// <summary>
/// 汇率转换信息

@ -0,0 +1,94 @@
using DS.WMS.Core.Op.Entity;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.Serialization;
namespace DS.WMS.Core.Application.Dtos
{
/// <summary>
/// 业务ID与类型
/// </summary>
public class BizItem
{
public static readonly BizItemComparer DefaultComparer = new();
/// <summary>
/// 业务ID
/// </summary>
public long Id { get; set; }
/// <summary>
/// 业务类型
/// </summary>
public BusinessType BusinessType { get; set; }
public class BizItemComparer : IEqualityComparer<BizItem>
{
public bool Equals(BizItem? x, BizItem? y)
{
if (x == null || y == null)
return false;
return x.Id == y.Id && x.BusinessType == y.BusinessType;
}
public int GetHashCode([DisallowNull] BizItem obj)
{
return obj.Id.GetHashCode() ^ (int)obj.BusinessType;
}
}
}
/// <summary>
/// 费用对象/单位
/// </summary>
public class FeeClient : BizItem
{
/// <summary>
/// 费用对象ID
/// </summary>
public long CustomerId { get; set; }
}
public class BizOperation : IValidatableObject
{
/// <summary>
/// 请求值object类型根据业务按需传值
/// </summary>
public object Value { get; set; }
/// <summary>
/// 业务ID与类型
/// </summary>
public List<BizItem>? Items { get; set; }
/// <summary>
/// 业务ID
/// </summary>
[IgnoreDataMember]
public IEnumerable<long>? Ids => Items?.Select(x => x.Id).Distinct();
/// <summary>
/// 业务类型
/// </summary>
[IgnoreDataMember]
public IEnumerable<BusinessType>? Types => Items?.Select(x => x.BusinessType).Distinct();
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
if (Items == null || Items.Count == 0)
{
yield return new ValidationResult($"缺少请求参数:{nameof(Items)}");
}
}
}
public class BizOperation<T> : BizOperation
{
/// <summary>
/// 请求值(根据业务按需传值)
/// </summary>
public new T Value { get; set; }
}
}

@ -36,7 +36,7 @@ namespace DS.WMS.Core.Application.Interface
/// </summary>
/// <param name="items">业务ID与业务类型</param>
/// <returns></returns>
Task<DataResult<InvoiceApplicaitonBiz>> GetFeesAsync(params BizItem[] items);
Task<DataResult<InvoiceApplicaitonBiz>> GetFeesAsync(params FeeClient[] items);
/// <summary>
/// 删除发票明细

@ -36,7 +36,7 @@ namespace DS.WMS.Core.Application.Interface
/// </summary>
/// <param name="items">业务ID与业务类型</param>
/// <returns></returns>
Task<DataResult<PaymentApplicaitonBiz>> GetFeesAsync(params BizItem[] items);
Task<DataResult<PaymentApplicaitonBiz>> GetFeesAsync(IEnumerable<FeeClient> items);
/// <summary>
/// 设置是否收到发票
@ -46,6 +46,5 @@ namespace DS.WMS.Core.Application.Interface
/// <returns></returns>
Task<DataResult> SetInvoiceReceivedAsync(bool isInvoiceReceived, params long[] ids);
}
}

@ -176,7 +176,7 @@ namespace DS.WMS.Core.Application.Method
var query1 = TenantDb.Queryable<SeaExport>()
.InnerJoin<FeeRecord>((s, f) => s.Id == f.BusinessId && f.BusinessType == BusinessType.OceanShippingExport)
.Where((s, f) => f.FeeStatus == FeeStatus.AuditPassed)
.GroupBy((s, f) => s.Id)
.GroupBy((s, f) => new { s.Id, f.CustomerId })
.Select((s, f) => new BizInvoiceApplication
{
Id = s.Id,
@ -231,10 +231,11 @@ namespace DS.WMS.Core.Application.Method
/// </summary>
/// <param name="items">业务ID与业务类型</param>
/// <returns></returns>
public async Task<DataResult<InvoiceApplicaitonBiz>> GetFeesAsync(params BizItem[] items)
public async Task<DataResult<InvoiceApplicaitonBiz>> GetFeesAsync(params FeeClient[] items)
{
var bizIds = items.Select(x => x.Id).ToList();
var types = items.Select(x => x.BusinessType).ToList();
var bizIds = items.Select(x => x.Id).Distinct();
var types = items.Select(x => x.BusinessType).Distinct();
var cIds = items.Select(x => x.CustomerId).Distinct();
var list = await TenantDb.Queryable<FeeRecord>()
.Where(f => bizIds.Contains(f.BusinessId) && types.Contains(f.BusinessType) && f.FeeStatus == FeeStatus.AuditPassed)
@ -412,11 +413,12 @@ namespace DS.WMS.Core.Application.Method
protected override async Task<List<ApplicationDetail>> GetDetailsAsync(ApplicationRequest<InvoiceApplication> request)
{
var ids1 = request.Items.Select(x => x.Id);
var ids2 = request.Items.Select(x => x.BusinessType);
var ids1 = request.Items.Select(x => x.Id).Distinct();
var ids2 = request.Items.Select(x => x.BusinessType).Distinct();
var ids3 = request.Items.Select(x => x.CustomerId).Distinct();
var list = await TenantDb.Queryable<FeeRecord>().Where(x =>
ids1.Contains(x.BusinessId) && ids2.Contains(x.BusinessType) && x.FeeStatus == FeeStatus.AuditPassed)
var list = await TenantDb.Queryable<FeeRecord>().Where(x => x.FeeStatus == FeeStatus.AuditPassed &&
ids1.Contains(x.BusinessId) && ids2.Contains(x.BusinessType) && ids3.Contains(x.CustomerId))
.Where(request.GetQueryConditions(Db))
.Select(x => new ApplicationDetail
{

@ -8,7 +8,6 @@ using DS.WMS.Core.Application.Interface;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Fee.Entity;
using DS.WMS.Core.Info.Entity;
using DS.WMS.Core.Invoice.Dtos;
using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.Sys.Entity;
using SqlSugar;
@ -123,15 +122,11 @@ namespace DS.WMS.Core.Application.Method
/// <returns></returns>
public async Task<DataResult<List<BizPaymentApplication>>> GetBizListAsync(PageRequest request)
{
var queryList = CreateBizQuery();
var query = CreateBizQuery();
var whereList = request.GetConditionalModels(Db);
query = query.Where(whereList);
if (!request.QueryCondition.IsNullOrEmpty())
{
var whereList = Db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
queryList = queryList.Where(whereList);
}
var result = await queryList.ToQueryPageAsync(request.PageCondition);
var result = await query.ToQueryPageAsync(request.PageCondition);
if (result.Data.Count > 0)
{
@ -164,17 +159,17 @@ namespace DS.WMS.Core.Application.Method
var query1 = TenantDb.Queryable<SeaExport>()
.InnerJoin<FeeRecord>((s, f) => s.Id == f.BusinessId && f.BusinessType == BusinessType.OceanShippingExport)
.Where((s, f) => f.FeeStatus == FeeStatus.AuditPassed)
.GroupBy((s, f) => s.Id)
.GroupBy((s, f) => new { s.Id, f.CustomerId })
.Select((s, f) => new BizPaymentApplication
{
Id = s.Id,
BusinessType = BusinessType.OceanShippingExport,
CustomerNo = s.CustomerNo, //委托编号
ClientName = s.CustomerName, //委托单位
MBLNO = s.MBLNO,
HBLNO = s.HBLNO,
CustomerId = s.CustomerId,
CustomerName = s.CustomerName,//结费单位
ClientName = s.CustomerName, //委托单位
CustomerId = f.CustomerId,
CustomerName = f.CustomerName, //结费单位
AccountDate = s.AccountDate,
BookingNO = s.BookingNo, //订舱编号
CntrTotal = s.CntrTotal,
@ -196,12 +191,14 @@ namespace DS.WMS.Core.Application.Method
f.FeeType == FeeType.Payable && f.Currency == FeeCurrency.USD_CODE).Select(f => SqlFunc.AggregateSum(f.Amount)),
UnpaidOther = SqlFunc.Subqueryable<FeeRecord>().Where(f => f.BusinessId == s.Id && f.FeeStatus == FeeStatus.AuditPassed &&
f.FeeType == FeeType.Payable && f.Currency != FeeCurrency.USD_CODE && f.Currency != FeeCurrency.RMB_CODE).Select(f => SqlFunc.AggregateSum(f.Amount)),
UnreceivedRMB = SqlFunc.Subqueryable<FeeRecord>().Where(f => f.BusinessId == s.Id && f.FeeStatus == FeeStatus.AuditPassed &&
f.FeeType == FeeType.Receivable && f.Currency == FeeCurrency.RMB_CODE).Select(f => SqlFunc.AggregateSum(f.Amount)),
UnreceivedUSD = SqlFunc.Subqueryable<FeeRecord>().Where(f => f.BusinessId == s.Id && f.FeeStatus == FeeStatus.AuditPassed &&
f.FeeType == FeeType.Receivable && f.Currency == FeeCurrency.USD_CODE).Select(f => SqlFunc.AggregateSum(f.Amount)),
UnreceivedOther = SqlFunc.Subqueryable<FeeRecord>().Where(f => f.BusinessId == s.Id && f.FeeStatus == FeeStatus.AuditPassed &&
f.FeeType == FeeType.Receivable && f.Currency != FeeCurrency.USD_CODE && f.Currency != FeeCurrency.RMB_CODE).Select(f => SqlFunc.AggregateSum(f.Amount)),
UnpaidRMBInv = SqlFunc.Subqueryable<FeeRecord>().Where(f => f.BusinessId == s.Id && f.FeeStatus == FeeStatus.AuditPassed &&
f.FeeType == FeeType.Payable && f.Currency == FeeCurrency.RMB_CODE).Select(f => SqlFunc.AggregateSum(f.Amount - f.InvoiceAmount - f.OrderInvoiceAmount + f.OrderInvSettlementAmount)),
UnpaidUSDInv = SqlFunc.Subqueryable<FeeRecord>().Where(f => f.BusinessId == s.Id && f.FeeStatus == FeeStatus.AuditPassed &&
@ -219,13 +216,15 @@ namespace DS.WMS.Core.Application.Method
/// </summary>
/// <param name="items">业务ID与业务类型</param>
/// <returns></returns>
public async Task<DataResult<PaymentApplicaitonBiz>> GetFeesAsync(params BizItem[] items)
public async Task<DataResult<PaymentApplicaitonBiz>> GetFeesAsync(IEnumerable<FeeClient> items)
{
var bizIds = items.Select(x => x.Id).ToList();
var types = items.Select(x => x.BusinessType).ToList();
var ids = items.Select(x => x.Id).Distinct();
var types = items.Select(x => x.BusinessType).Distinct();
var cIds = items.Select(x => x.CustomerId).Distinct();
var list = await TenantDb.Queryable<FeeRecord>()
.Where(f => bizIds.Contains(f.BusinessId) && types.Contains(f.BusinessType) && f.FeeStatus == FeeStatus.AuditPassed)
.Where(f => ids.Contains(f.BusinessId) && types.Contains(f.BusinessType) &&
cIds.Contains(f.CustomerId) && f.FeeStatus == FeeStatus.AuditPassed)
.Select(f => new FeePaymentDto
{
RecordId = f.Id,
@ -381,11 +380,12 @@ namespace DS.WMS.Core.Application.Method
protected override async Task<List<ApplicationDetail>> GetDetailsAsync(ApplicationRequest<PaymentApplication> request)
{
var ids1 = request.Items.Select(x => x.Id);
var ids2 = request.Items.Select(x => x.BusinessType);
var ids1 = request.Items.Select(x => x.Id).Distinct();
var ids2 = request.Items.Select(x => x.BusinessType).Distinct();
var ids3 = request.Items.Select(x => x.CustomerId).Distinct();
var list = await TenantDb.Queryable<FeeRecord>().Where(x =>
ids1.Contains(x.BusinessId) && ids2.Contains(x.BusinessType) && x.FeeStatus == FeeStatus.AuditPassed)
var list = await TenantDb.Queryable<FeeRecord>().Where(x => x.FeeStatus == FeeStatus.AuditPassed &&
ids1.Contains(x.BusinessId) && ids2.Contains(x.BusinessType) && ids3.Contains(x.CustomerId))
.Where(request.GetQueryConditions(Db))
.Select(x => new ApplicationDetail
{

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.Code.Dtos
{
/// <summary>
/// 用户数据权限应用请求
/// </summary>
public class UserDataRuleScopeApplyReq
{
/// <summary>
/// 数据权限Id
/// </summary>
public long RuleId { get; set; }
/// <summary>
/// 用户Id
/// </summary>
public long UserId { get; set; }
}
}

@ -27,6 +27,19 @@ public interface ICodeDataRuleService
/// <param name="req"></param>
/// <returns></returns>
public Task<DataResult> CopyDataRuleScope(CopyDataRuleScopeReq req);
/// <summary>
/// 用户可视权限应用全部
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public Task<DataResult> UserVisibleDataRuleScopeApply(UserDataRuleScopeApplyReq req);
/// <summary>
/// 用户操作权限应用全部
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public Task<DataResult> UserOperateDataRuleScopeApply(UserDataRuleScopeApplyReq req);
///// <summary>
///// 编辑
///// </summary>

@ -40,7 +40,8 @@ public interface IDataRuleTemplateService
/// 根据权限id获取数据权限模板
/// </summary>
/// <param name="id"></param>
/// <param name="ruleType"></param>
/// <returns></returns>
Task<DataResult<List<CodeDataRuleTemplateRes>>> GetDataRuleTemplateSelectList(string id);
Task<DataResult<List<CodeDataRuleTemplateRes>>> GetDataRuleTemplateSelectList(string id, string ruleType);
}

@ -9,6 +9,7 @@ using DS.WMS.Core.Code.Interface;
using DS.WMS.Core.Invoice.Dtos;
using DS.WMS.Core.Sys.Dtos;
using DS.WMS.Core.Sys.Entity;
using LanguageExt;
using Mapster;
using Microsoft.AspNet.SignalR.Hubs;
using Microsoft.Extensions.DependencyInjection;
@ -190,6 +191,217 @@ namespace DS.WMS.Core.Code.Method
return await Task.FromResult(DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess));
}
public async Task<DataResult> UserVisibleDataRuleScopeApply(UserDataRuleScopeApplyReq req)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var rule = await tenantDb.Queryable<CodeDataRule>().Where(x=>x.Id == req.RuleId).FirstAsync();
if (rule.IsNull()) {
return await Task.FromResult(DataResult.Failed("数据权限信息不存在!"));
}
if (string.IsNullOrEmpty(rule.VisibleRuleScope))
{
return await Task.FromResult(DataResult.Failed("请维护该数据权限信息的可视范围!"));
}
var userId = req.UserId;
var userInfo = await db.Queryable<SysUser>().Where(x => x.Id == userId).FirstAsync();
var roleIds = await db.Queryable<SysRoleUser>().Where(x => x.UserId == userId).Select(x => x.RoleId).ToListAsync();
if (roleIds.Count == 0)
{
return await Task.FromResult(DataResult.Failed("该用户未绑定角色!"));
}
var permissions = await db.Queryable<SysRolePermission>().Where(x => roleIds.Contains(x.RoleId))
.Select(x => x.PermissionId).Distinct().ToListAsync();
var perlist = await db.Queryable<SysPermissionTenant>()
.Where(x => x.MenuType == 2 && x.IsHidden == false && permissions.Contains(x.PermissionId) && x.PermissionId!= rule.PermissionId &&
(x.PermissionType == 1 || x.PermissionType == 0))
.OrderBy(x => x.SortCode)
.Select(a => new RouteItem
{
Id = a.Id,
ParentId = a.PermissionId,
Path = a.Url,
Name = a.PermissionName,
EnName = a.PermissionEnName,
Component = a.Component,
Redirect = a.Redirect,
SortCode = a.SortCode,
Meta = new RouteMeta()
{
Title = a.Title,
Icon = a.Icon,
}
})
.ToListAsync();
try
{
await tenantDb.Ado.BeginTranAsync();
var newRules = new List<CodeDataRule>();
var updateRules = new List<CodeDataRule>();
foreach (var item in perlist)
{
var currentTemplate = await tenantDb.Queryable<CodeDataRuleTemplate>().Where(x => x.PermissionId == item.ParentId && x.RuleScope == rule.VisibleRuleScope).FirstAsync();
var currentRule = await tenantDb.Queryable<CodeDataRule>().Where(x => x.PermissionId == item.ParentId && x.UserId == req.UserId).FirstAsync();
if (currentRule.IsNull())
{
if (currentTemplate.IsNotNull())
{
newRules.Add(new CodeDataRule()
{
UserId = userInfo.Id,
UserName = userInfo.UserName,
VisibleTemplateId = currentTemplate.Id,
VisibleRuleScope = currentTemplate.RuleScope,
VisibleRuleScopeName = currentTemplate.RuleScopeName,
PermissionEntity = currentTemplate.PermissionEntity,
PermissionId = currentTemplate.PermissionId,
Description = currentTemplate.Description,
Status = currentTemplate.Status,
Note = currentTemplate.Note,
});
}
}
else {
currentRule.VisibleTemplateId = currentTemplate.Id;
currentRule.VisibleRuleScope = currentTemplate.RuleScope;
currentRule.VisibleRuleScopeName = currentTemplate.RuleScopeName;
updateRules.Add(currentRule);
}
}
if (newRules.Count>0)
{
await tenantDb.Insertable(newRules).ExecuteCommandAsync();
}
if (updateRules.Count > 0)
{
await tenantDb.Updateable(updateRules).ExecuteCommandAsync();
}
await tenantDb.Ado.CommitTranAsync();
}
catch (Exception ex)
{
await tenantDb.Ado.RollbackTranAsync();
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed));
}
return await Task.FromResult(DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess));
}
public async Task<DataResult> UserOperateDataRuleScopeApply(UserDataRuleScopeApplyReq req)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var rule = await tenantDb.Queryable<CodeDataRule>().Where(x => x.Id == req.RuleId).FirstAsync();
if (rule.IsNull())
{
return await Task.FromResult(DataResult.Failed("数据权限信息不存在!"));
}
if (string.IsNullOrEmpty(rule.OperateRuleScope))
{
return await Task.FromResult(DataResult.Failed("请维护该数据权限信息的操作范围!"));
}
var userId = req.UserId;
var userInfo = await db.Queryable<SysUser>().Where(x => x.Id == userId).FirstAsync();
var roleIds = await db.Queryable<SysRoleUser>().Where(x => x.UserId == userId).Select(x => x.RoleId).ToListAsync();
if (roleIds.Count == 0)
{
return await Task.FromResult(DataResult.Failed("该用户未绑定角色!"));
}
var permissions = await db.Queryable<SysRolePermission>().Where(x => roleIds.Contains(x.RoleId))
.Select(x => x.PermissionId).Distinct().ToListAsync();
var perlist = await db.Queryable<SysPermissionTenant>()
.Where(x => x.MenuType == 2 && x.IsHidden == false && permissions.Contains(x.PermissionId) && x.PermissionId != rule.PermissionId &&
(x.PermissionType == 1 || x.PermissionType == 0))
.OrderBy(x => x.SortCode)
.Select(a => new RouteItem
{
Id = a.Id,
ParentId = a.PermissionId,
Path = a.Url,
Name = a.PermissionName,
EnName = a.PermissionEnName,
Component = a.Component,
Redirect = a.Redirect,
SortCode = a.SortCode,
Meta = new RouteMeta()
{
Title = a.Title,
Icon = a.Icon,
}
})
.ToListAsync();
try
{
await tenantDb.Ado.BeginTranAsync();
var newRules = new List<CodeDataRule>();
var updateRules = new List<CodeDataRule>();
foreach (var item in perlist)
{
var currentTemplate = await tenantDb.Queryable<CodeDataRuleTemplate>().Where(x => x.PermissionId == item.ParentId && x.RuleScope == rule.OperateRuleScope).FirstAsync();
var currentRule = await tenantDb.Queryable<CodeDataRule>().Where(x => x.PermissionId == item.ParentId && x.UserId == req.UserId).FirstAsync();
if (currentRule.IsNull())
{
if (currentTemplate.IsNotNull())
{
newRules.Add(new CodeDataRule()
{
UserId = userInfo.Id,
UserName = userInfo.UserName,
OperateTemplateId = currentTemplate.Id,
OperateRuleScope = currentTemplate.RuleScope,
OperateRuleScopeName = currentTemplate.RuleScopeName,
PermissionEntity = currentTemplate.PermissionEntity,
PermissionId = currentTemplate.PermissionId,
Description = currentTemplate.Description,
Status = currentTemplate.Status,
Note = currentTemplate.Note,
});
}
}
else
{
currentRule.OperateTemplateId = currentTemplate.Id;
currentRule.OperateRuleScope = currentTemplate.RuleScope;
currentRule.OperateRuleScopeName = currentTemplate.RuleScopeName;
updateRules.Add(currentRule);
}
}
if (newRules.Count > 0)
{
await tenantDb.Insertable(newRules).ExecuteCommandAsync();
}
if (updateRules.Count > 0)
{
await tenantDb.Updateable(updateRules).ExecuteCommandAsync();
}
await tenantDb.Ado.CommitTranAsync();
}
catch (Exception ex)
{
await tenantDb.Ado.RollbackTranAsync();
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed));
}
return await Task.FromResult(DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess));
}
/// <summary>

@ -104,13 +104,14 @@ namespace DS.WMS.Core.Code.Method
/// 根据权限id获取数据权限模板
/// </summary>
/// <param name="id"></param>
/// <param name="ruleType"></param>
/// <returns></returns>
public async Task<DataResult<List<CodeDataRuleTemplateRes>>> GetDataRuleTemplateSelectList(string id)
public async Task<DataResult<List<CodeDataRuleTemplateRes>>> GetDataRuleTemplateSelectList(string id,string ruleType)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = await tenantDb.Queryable<CodeDataRuleTemplate>()
.Where(x => x.PermissionId == long.Parse(id) && x.Status == StatusEnum.Enable)
.Where(x => x.PermissionId == long.Parse(id) && x.Status == StatusEnum.Enable && x.RuleType == ruleType)
.Select<CodeDataRuleTemplateRes>()
.ToListAsync();
return await Task.FromResult(DataResult<List<CodeDataRuleTemplateRes>>.Success(data, MultiLanguageConst.DataQuerySuccess));

@ -1,4 +1,4 @@
using System.Diagnostics.CodeAnalysis;
using DS.WMS.Core.Application.Dtos;
using DS.WMS.Core.Op.Entity;
namespace DS.WMS.Core.Fee.Dtos
@ -56,51 +56,6 @@ namespace DS.WMS.Core.Fee.Dtos
public List<BizItem> Items { get; set; }
}
public class BizItem
{
public static readonly BizItemComparer DefaultComparer = new BizItemComparer();
/// <summary>
/// 业务ID
/// </summary>
public long Id { get; set; }
/// <summary>
/// 业务类型
/// </summary>
public BusinessType BusinessType { get; set; }
public class BizItemComparer : IEqualityComparer<BizItem>
{
public bool Equals(BizItem? x, BizItem? y)
{
if (x == null || y == null)
return false;
return x.Id == y.Id && x.BusinessType == y.BusinessType;
}
public int GetHashCode([DisallowNull] BizItem obj)
{
return obj.Id.GetHashCode() ^ (int)obj.BusinessType;
}
}
}
public class BizOperation
{
/// <summary>
/// 请求值object类型根据业务按需传值
/// </summary>
public object Value { get; set; }
/// <summary>
/// 业务ID与类型
/// </summary>
public List<BizItem> Items { get; set; }
}
public class AuditDetailRequest : BizItem
{
public string? QueryCondition { get; set; }

@ -1,5 +1,6 @@
using DS.Module.Core;
using DS.Module.Core.Extensions;
using DS.WMS.Core.Application.Dtos;
using DS.WMS.Core.Code.Entity;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Fee.Entity;
@ -748,7 +749,7 @@ namespace DS.WMS.Core.Fee.Method
BillAuditStatus = x.BillAuditStatus
}).FirstAsync();
if (biz == null)
return DataResult.Failed(MultiLanguageConst.Operation_Failed);
return DataResult.Failed(MultiLanguageConst.EmptyData);
}
else
{
@ -761,7 +762,7 @@ namespace DS.WMS.Core.Fee.Method
BusinessType = x.BusinessType
}).FirstAsync();
if (fee == null)
return DataResult.Failed(MultiLanguageConst.Operation_Failed);
return DataResult.Failed(MultiLanguageConst.EmptyData);
fee.Reason = callback.RejectReason;
}

@ -21,8 +21,7 @@ namespace DS.WMS.Core.Invoice.Interface
/// </summary>
/// <param name="items">业务ID与业务类型</param>
/// <returns></returns>
Task<DataResult<InvoiceApplicaitonBiz>> GetFeesAsync(params BizItem[] items);
Task<DataResult<InvoiceApplicaitonBiz>> GetFeesAsync(params FeeClient[] items);
}
}

@ -56,7 +56,7 @@ namespace DS.WMS.Core.Invoice.Method
if (!request.QueryCondition.IsNullOrEmpty())
{
var whereList = Db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
var whereList = request.GetConditionalModels(Db);
query = query.Where(whereList);
}
@ -120,13 +120,15 @@ namespace DS.WMS.Core.Invoice.Method
/// </summary>
/// <param name="items">业务ID与业务类型</param>
/// <returns></returns>
public async Task<DataResult<InvoiceApplicaitonBiz>> GetFeesAsync(params BizItem[] items)
public async Task<DataResult<InvoiceApplicaitonBiz>> GetFeesAsync(params FeeClient[] items)
{
var bizIds = items.Select(x => x.Id).ToList();
var types = items.Select(x => x.BusinessType).ToList();
var bizIds = items.Select(x => x.Id).Distinct();
var types = items.Select(x => x.BusinessType).Distinct();
var cIds = items.Select(x => x.CustomerId).Distinct();
var list = await TenantDb.Queryable<FeeRecord>()
.Where(f => bizIds.Contains(f.BusinessId) && types.Contains(f.BusinessType) && AllowedStatus.Contains(f.FeeStatus))
.Where(f => bizIds.Contains(f.BusinessId) && types.Contains(f.BusinessType) && cIds.Contains(f.CustomerId) &&
AllowedStatus.Contains(f.FeeStatus))
.Select(f => new FeeInvoiceDto
{
RecordId = f.Id,

@ -149,8 +149,6 @@ namespace DS.WMS.Core.Invoice.Method
return Task.Factory.StartNew(UpdateInvoiceApplications, new List<Entity.Invoice> { invoice });
}
protected override async Task OnDeleteDetailAsync(List<Entity.Invoice> invoices, DeleteOption deleteOption)
{
var list = invoices.SelectMany(x => x.Details).Where(x => x.DetailId.HasValue).Select(x => new ApplicationDetail

@ -3,7 +3,7 @@ using DS.Module.Core;
using DS.Module.Core.Data;
using DS.Module.Core.Helpers;
using DS.Module.DjyRulesEngine;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Application.Dtos;
using DS.WMS.Core.Flow.Dtos;
using DS.WMS.Core.Flow.Entity;
using DS.WMS.Core.Flow.Interface;

@ -1,5 +1,5 @@
using DS.Module.Core;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Application.Dtos;
using DS.WMS.Core.Settlement.Dtos;
using DS.WMS.Core.Settlement.Entity;
@ -23,7 +23,7 @@ namespace DS.WMS.Core.Settlement.Interface
/// </summary>
/// <param name="items">业务ID与业务类型</param>
/// <returns></returns>
Task<DataResult<FeeForm>> GetFeesAsync(params BizItem[] items);
Task<DataResult<FeeForm>> GetFeesAsync(params FeeClient[] items);
/// <summary>
/// 获取付费自由结算单

@ -5,7 +5,6 @@ using DS.Module.Core.Extensions;
using DS.WMS.Core.Application.Dtos;
using DS.WMS.Core.Application.Entity;
using DS.WMS.Core.Code.Entity;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Fee.Entity;
using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.Settlement.Dtos;
@ -143,14 +142,15 @@ namespace DS.WMS.Core.Settlement.Method
/// </summary>
/// <param name="items">业务ID与业务类型</param>
/// <returns></returns>
public async Task<DataResult<FeeForm>> GetFeesAsync(params BizItem[] items)
public async Task<DataResult<FeeForm>> GetFeesAsync(params FeeClient[] items)
{
var bizIds = items.Select(x => x.Id).ToList();
var types = items.Select(x => x.BusinessType).ToList();
var bizIds = items.Select(x => x.Id).Distinct();
var types = items.Select(x => x.BusinessType).Distinct();
var cIds = items.Select(x => x.CustomerId).Distinct();
var list = await TenantDb.Queryable<FeeRecord>()
.Where(f => bizIds.Contains(f.BusinessId) && types.Contains(f.BusinessType) && f.FeeStatus == FeeStatus.AuditPassed &&
(f.Amount - f.SettlementAmount - f.OrderAmount + f.OrderSettlementAmount) != 0)
.Where(f => bizIds.Contains(f.BusinessId) && types.Contains(f.BusinessType) && cIds.Contains(f.CustomerId) &&
f.FeeStatus == FeeStatus.AuditPassed && (f.Amount - f.SettlementAmount - f.OrderAmount + f.OrderSettlementAmount) != 0)
.Select(f => new FeeItem
{
RecordId = f.Id,
@ -375,6 +375,5 @@ namespace DS.WMS.Core.Settlement.Method
return DataResult.Success;
}
}
}

@ -1,4 +1,5 @@
using DS.Module.Core;
using DS.WMS.Core.Application.Dtos;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Fee.Interface;
using DS.WMS.Core.Flow.Dtos;

@ -1,7 +1,7 @@
using System.Net;
using DS.Module.Core;
using DS.Module.Core.Data;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Application.Dtos;
using DS.WMS.Core.Fee.Entity;
using DS.WMS.Core.Fee.Interface;
using Microsoft.AspNetCore.Mvc;

@ -53,7 +53,7 @@ namespace DS.WMS.FeeApi.Controllers
/// <param name="items">业务ID与业务类型</param>
/// <returns></returns>
[HttpPost, Route("GetFees")]
public async Task<DataResult<InvoiceApplicaitonBiz>> GetFeesAsync([FromBody] BizItem[] items)
public async Task<DataResult<InvoiceApplicaitonBiz>> GetFeesAsync([FromBody] FeeClient[] items)
{
return await _service.GetFeesAsync(items);
}

@ -66,7 +66,7 @@ namespace DS.WMS.FeeApi.Controllers
/// <param name="items">业务ID和类型</param>
/// <returns></returns>
[HttpPost, Route("GetFees")]
public async Task<DataResult<InvoiceApplicaitonBiz>> GetFeesAsync([FromBody] params BizItem[] items)
public async Task<DataResult<InvoiceApplicaitonBiz>> GetFeesAsync([FromBody] params FeeClient[] items)
{
if (items == null || items.Length == 0)
return DataResult<InvoiceApplicaitonBiz>.Failed("缺少请求参数");

@ -60,10 +60,10 @@ namespace DS.WMS.FeeApi.Controllers
/// <summary>
/// 根据业务编号及类型获取关联费用记录
/// </summary>
/// <param name="items">业务ID和类型</param>
/// <param name="items"></param>
/// <returns></returns>
[HttpPost, Route("GetFees")]
public async Task<DataResult<PaymentApplicaitonBiz>> GetFeesAsync([FromBody] params BizItem[] items)
public async Task<DataResult<PaymentApplicaitonBiz>> GetFeesAsync([FromBody] params FeeClient[] items)
{
if (items == null || items.Length == 0)
return DataResult<PaymentApplicaitonBiz>.Failed("缺少请求参数");

@ -1,5 +1,6 @@
using DS.Module.Core;
using DS.Module.Core.Data;
using DS.WMS.Core.Application.Dtos;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Settlement.Dtos;
using DS.WMS.Core.Settlement.Entity;
@ -41,7 +42,7 @@ namespace DS.WMS.FeeApi.Controllers
/// <param name="items">业务ID与业务类型</param>
/// <returns></returns>
[HttpPost, Route("GetFees")]
public async Task<DataResult<FeeForm>> GetFeesAsync([FromBody] BizItem[] items)
public async Task<DataResult<FeeForm>> GetFeesAsync([FromBody] FeeClient[] items)
{
return await _service.GetFeesAsync(items);
}

@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<Project>
<PropertyGroup>
<_PublishTargetUrl>D:\Publish\DS8\FeeApi</_PublishTargetUrl>
<History>True|2024-09-06T10:49:17.9435308Z||;True|2024-09-06T17:01:39.6646353+08:00||;True|2024-09-06T10:27:36.9990456+08:00||;True|2024-09-06T09:48:23.4236094+08:00||;True|2024-09-05T13:57:23.8452431+08:00||;True|2024-09-05T10:21:34.6675149+08:00||;True|2024-09-05T09:12:44.5610882+08:00||;True|2024-09-04T10:07:38.3707398+08:00||;True|2024-09-04T09:52:47.0574599+08:00||;True|2024-09-03T16:41:23.7516960+08:00||;True|2024-09-03T15:22:31.8718097+08:00||;True|2024-09-03T10:01:09.7656702+08:00||;False|2024-09-03T09:46:46.8956531+08:00||;True|2024-09-02T17:07:41.0268500+08:00||;True|2024-09-02T13:50:22.0203254+08:00||;True|2024-09-02T13:34:23.3441546+08:00||;True|2024-08-30T11:25:14.7431645+08:00||;True|2024-08-29T16:38:26.3491372+08:00||;True|2024-08-29T16:32:31.8580864+08:00||;False|2024-08-29T16:30:41.4763198+08:00||;True|2024-08-09T09:18:05.8484398+08:00||;True|2024-08-09T08:45:38.7858906+08:00||;True|2024-08-05T11:37:07.3133020+08:00||;True|2024-07-24T16:45:58.2272340+08:00||;True|2024-07-24T15:48:52.0128987+08:00||;True|2024-07-23T17:41:01.7494842+08:00||;True|2024-07-23T17:25:11.8773492+08:00||;True|2024-07-23T17:07:16.5460273+08:00||;True|2024-07-22T08:59:23.3235603+08:00||;True|2024-07-12T17:35:11.1225017+08:00||;True|2024-07-11T11:40:17.3581147+08:00||;True|2024-07-04T17:20:50.0175739+08:00||;True|2024-07-02T11:26:14.2092751+08:00||;True|2024-07-02T09:21:51.3513605+08:00||;True|2024-07-01T17:47:56.0407256+08:00||;True|2024-07-01T16:42:55.7374984+08:00||;True|2024-07-01T15:49:58.9266967+08:00||;True|2024-07-01T14:35:48.1117178+08:00||;True|2024-07-01T11:41:52.2969338+08:00||;True|2024-07-01T11:13:02.6561160+08:00||;True|2024-06-28T15:28:43.1470725+08:00||;True|2024-06-28T15:16:20.1999596+08:00||;True|2024-06-28T15:14:56.2534743+08:00||;True|2024-06-28T15:02:41.3033806+08:00||;True|2024-06-28T13:37:28.2462742+08:00||;True|2024-06-28T11:06:30.7400535+08:00||;True|2024-06-26T15:24:17.1939896+08:00||;True|2024-06-26T14:33:06.3530466+08:00||;True|2024-06-26T09:45:24.4055568+08:00||;True|2024-06-25T15:45:57.6052473+08:00||;True|2024-06-25T10:17:17.7408916+08:00||;False|2024-06-25T10:16:23.5639654+08:00||;False|2024-06-25T10:15:28.3857721+08:00||;False|2024-06-25T10:10:59.5536995+08:00||;False|2024-06-25T10:07:10.4050937+08:00||;True|2024-06-24T15:22:18.2672769+08:00||;True|2024-06-24T15:01:04.8153621+08:00||;False|2024-06-24T15:00:29.9618848+08:00||;True|2024-06-24T14:07:19.9401637+08:00||;False|2024-06-24T14:06:36.1250570+08:00||;True|2024-06-21T15:13:57.4273503+08:00||;True|2024-06-21T15:04:37.8218608+08:00||;True|2024-06-21T14:12:48.0266638+08:00||;True|2024-06-21T13:52:30.0950155+08:00||;True|2024-06-20T11:02:42.9508506+08:00||;True|2024-06-19T11:43:01.1899282+08:00||;True|2024-06-19T11:23:01.2938141+08:00||;True|2024-06-18T08:51:21.6222152+08:00||;True|2024-06-17T09:20:35.0804494+08:00||;True|2024-06-17T08:41:58.1319484+08:00||;True|2024-06-17T08:38:09.0137102+08:00||;True|2024-06-14T15:19:45.7395180+08:00||;True|2024-06-14T14:38:49.7094421+08:00||;True|2024-06-14T14:27:39.2815370+08:00||;True|2024-06-14T09:42:21.5397525+08:00||;True|2024-06-13T16:03:39.8475642+08:00||;True|2024-06-13T14:12:10.1725629+08:00||;True|2024-06-13T10:46:52.6971321+08:00||;True|2024-06-11T17:03:44.8328978+08:00||;True|2024-06-06T17:41:51.1810315+08:00||;True|2024-06-06T10:57:27.8273617+08:00||;True|2024-06-04T14:23:21.3742450+08:00||;True|2024-05-31T17:01:42.4717460+08:00||;True|2024-05-31T13:56:03.0734064+08:00||;True|2024-05-31T08:45:52.3549394+08:00||;True|2024-05-30T17:16:32.8907958+08:00||;True|2024-05-30T16:18:06.9957657+08:00||;True|2024-05-29T15:44:18.4051203+08:00||;True|2024-05-29T15:11:03.1518632+08:00||;True|2024-05-29T14:52:26.0823495+08:00||;True|2024-05-29T11:17:20.2245101+08:00||;True|2024-05-29T08:36:28.9569161+08:00||;True|2024-05-28T08:44:31.4427261+08:00||;False|2024-05-28T08:44:02.5254826+08:00||;True|2024-05-27T15:16:32.9413631+08:00||;True|2024-05-27T15:03:42.9803879+08:00||;True|2024-05-27T08:49:54.3933663+08:00||;True|2024-05-27T08:46:13.5862236+08:00||;True|2024-05-23T17:19:32.8154451+08:00||;True|2024-05-23T17:19:01.4587615+08:00||;</History>
<History>True|2024-09-13T02:44:56.1241214Z||;False|2024-09-13T10:44:26.6088271+08:00||;False|2024-09-13T10:44:06.1615137+08:00||;False|2024-09-13T10:43:19.2432517+08:00||;False|2024-09-13T10:38:18.1663387+08:00||;True|2024-09-06T18:49:17.9435308+08:00||;True|2024-09-06T17:01:39.6646353+08:00||;True|2024-09-06T10:27:36.9990456+08:00||;True|2024-09-06T09:48:23.4236094+08:00||;True|2024-09-05T13:57:23.8452431+08:00||;True|2024-09-05T10:21:34.6675149+08:00||;True|2024-09-05T09:12:44.5610882+08:00||;True|2024-09-04T10:07:38.3707398+08:00||;True|2024-09-04T09:52:47.0574599+08:00||;True|2024-09-03T16:41:23.7516960+08:00||;True|2024-09-03T15:22:31.8718097+08:00||;True|2024-09-03T10:01:09.7656702+08:00||;False|2024-09-03T09:46:46.8956531+08:00||;True|2024-09-02T17:07:41.0268500+08:00||;True|2024-09-02T13:50:22.0203254+08:00||;True|2024-09-02T13:34:23.3441546+08:00||;True|2024-08-30T11:25:14.7431645+08:00||;True|2024-08-29T16:38:26.3491372+08:00||;True|2024-08-29T16:32:31.8580864+08:00||;False|2024-08-29T16:30:41.4763198+08:00||;True|2024-08-09T09:18:05.8484398+08:00||;True|2024-08-09T08:45:38.7858906+08:00||;True|2024-08-05T11:37:07.3133020+08:00||;True|2024-07-24T16:45:58.2272340+08:00||;True|2024-07-24T15:48:52.0128987+08:00||;True|2024-07-23T17:41:01.7494842+08:00||;True|2024-07-23T17:25:11.8773492+08:00||;True|2024-07-23T17:07:16.5460273+08:00||;True|2024-07-22T08:59:23.3235603+08:00||;True|2024-07-12T17:35:11.1225017+08:00||;True|2024-07-11T11:40:17.3581147+08:00||;True|2024-07-04T17:20:50.0175739+08:00||;True|2024-07-02T11:26:14.2092751+08:00||;True|2024-07-02T09:21:51.3513605+08:00||;True|2024-07-01T17:47:56.0407256+08:00||;True|2024-07-01T16:42:55.7374984+08:00||;True|2024-07-01T15:49:58.9266967+08:00||;True|2024-07-01T14:35:48.1117178+08:00||;True|2024-07-01T11:41:52.2969338+08:00||;True|2024-07-01T11:13:02.6561160+08:00||;True|2024-06-28T15:28:43.1470725+08:00||;True|2024-06-28T15:16:20.1999596+08:00||;True|2024-06-28T15:14:56.2534743+08:00||;True|2024-06-28T15:02:41.3033806+08:00||;True|2024-06-28T13:37:28.2462742+08:00||;True|2024-06-28T11:06:30.7400535+08:00||;True|2024-06-26T15:24:17.1939896+08:00||;True|2024-06-26T14:33:06.3530466+08:00||;True|2024-06-26T09:45:24.4055568+08:00||;True|2024-06-25T15:45:57.6052473+08:00||;True|2024-06-25T10:17:17.7408916+08:00||;False|2024-06-25T10:16:23.5639654+08:00||;False|2024-06-25T10:15:28.3857721+08:00||;False|2024-06-25T10:10:59.5536995+08:00||;False|2024-06-25T10:07:10.4050937+08:00||;True|2024-06-24T15:22:18.2672769+08:00||;True|2024-06-24T15:01:04.8153621+08:00||;False|2024-06-24T15:00:29.9618848+08:00||;True|2024-06-24T14:07:19.9401637+08:00||;False|2024-06-24T14:06:36.1250570+08:00||;True|2024-06-21T15:13:57.4273503+08:00||;True|2024-06-21T15:04:37.8218608+08:00||;True|2024-06-21T14:12:48.0266638+08:00||;True|2024-06-21T13:52:30.0950155+08:00||;True|2024-06-20T11:02:42.9508506+08:00||;True|2024-06-19T11:43:01.1899282+08:00||;True|2024-06-19T11:23:01.2938141+08:00||;True|2024-06-18T08:51:21.6222152+08:00||;True|2024-06-17T09:20:35.0804494+08:00||;True|2024-06-17T08:41:58.1319484+08:00||;True|2024-06-17T08:38:09.0137102+08:00||;True|2024-06-14T15:19:45.7395180+08:00||;True|2024-06-14T14:38:49.7094421+08:00||;True|2024-06-14T14:27:39.2815370+08:00||;True|2024-06-14T09:42:21.5397525+08:00||;True|2024-06-13T16:03:39.8475642+08:00||;True|2024-06-13T14:12:10.1725629+08:00||;True|2024-06-13T10:46:52.6971321+08:00||;True|2024-06-11T17:03:44.8328978+08:00||;True|2024-06-06T17:41:51.1810315+08:00||;True|2024-06-06T10:57:27.8273617+08:00||;True|2024-06-04T14:23:21.3742450+08:00||;True|2024-05-31T17:01:42.4717460+08:00||;True|2024-05-31T13:56:03.0734064+08:00||;True|2024-05-31T08:45:52.3549394+08:00||;True|2024-05-30T17:16:32.8907958+08:00||;True|2024-05-30T16:18:06.9957657+08:00||;True|2024-05-29T15:44:18.4051203+08:00||;True|2024-05-29T15:11:03.1518632+08:00||;True|2024-05-29T14:52:26.0823495+08:00||;True|2024-05-29T11:17:20.2245101+08:00||;True|2024-05-29T08:36:28.9569161+08:00||;True|2024-05-28T08:44:31.4427261+08:00||;False|2024-05-28T08:44:02.5254826+08:00||;True|2024-05-27T15:16:32.9413631+08:00||;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>

@ -61,6 +61,31 @@ public class CodeDataRuleController : ApiController
var res = await _invokeService.CopyDataRuleScope(req);
return res;
}
/// <summary>
/// 用户可视权限应用全部
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
[Route("UserVisibleDataRuleScopeApply")]
public async Task<DataResult> UserVisibleDataRuleScopeApply([FromBody] UserDataRuleScopeApplyReq req)
{
var res = await _invokeService.UserVisibleDataRuleScopeApply(req);
return res;
}
/// <summary>
/// 用户操作权限应用全部
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
[Route("UserOperateDataRuleScopeApply")]
public async Task<DataResult> UserOperateDataRuleScopeApply([FromBody] UserDataRuleScopeApplyReq req)
{
var res = await _invokeService.UserOperateDataRuleScopeApply(req);
return res;
}
///// <summary>
///// 编辑
///// </summary>

@ -40,12 +40,13 @@ public class CodeDataRuleTemplateController : ApiController
/// 根据权限id获取数据权限模板
/// </summary>
/// <param name="id"></param>
/// <param name="ruleType"></param>
/// <returns></returns>
[HttpPost]
[Route("GetDataRuleTemplateSelectList")]
public async Task<DataResult<List<CodeDataRuleTemplateRes>>> GetDataRuleTemplateSelectList([FromQuery] string id)
public async Task<DataResult<List<CodeDataRuleTemplateRes>>> GetDataRuleTemplateSelectList([FromQuery] string id, string ruleType)
{
var res = await _invokeService.GetDataRuleTemplateSelectList(id);
var res = await _invokeService.GetDataRuleTemplateSelectList(id,ruleType);
return res;
}
/// <summary>

Loading…
Cancel
Save