增加申请单泛型接口

usertest
嵇文龙 5 months ago
parent ec060fdf4b
commit 62e94f2ae9

@ -185,7 +185,6 @@ namespace DS.WMS.Core.Fee.Dtos
/// <summary>
/// 审核状态(仅查询用)
/// </summary>
public AuditStatusForQuery? AuditStatus { get; set; }
}

@ -1,39 +1,15 @@
using DS.Module.Core;
using DS.WMS.Core.Application.Entity;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Flow.Dtos;
using DS.WMS.Core.Op.Entity;
namespace DS.WMS.Core.Application.Interface
{
/// <summary>
/// 付费申请
/// 申请单审核服务定义
/// </summary>
public interface IFeeApplicationAuditService
public interface IApplicationAuditService<in TEntity> where TEntity : ApplicationBase, new()
{
/// <summary>
/// 获取申请单明细
/// </summary>
/// <param name="id">申请单ID</param>
/// <returns></returns>
Task<DataResult<FeeApplicationSummary>> GetDetailsAsync(long id);
/// <summary>
/// 获取业务费用统计
/// </summary>
/// <param name="id">业务ID</param>
/// <param name="businessType">业务类型</param>
/// <param name="customerId">结算对象ID</param>
/// <returns></returns>
Task<DataResult<FeeBiz>> GetFeeBizAsync(long id, BusinessType businessType, long customerId);
/// <summary>
/// 获取按票统计
/// </summary>
/// <param name="id">业务ID</param>
/// <param name="businessType">业务类型</param>
/// <returns></returns>
Task<DataResult<BizFeeStat>> GetStatAsync(long id, BusinessType businessType);
/// <summary>
/// 一键审核当前登录用户的所有待审核项
/// </summary>

@ -0,0 +1,49 @@
using DS.Module.Core;
using DS.WMS.Core.Application.Entity;
namespace DS.WMS.Core.Application.Interface
{
/// <summary>
/// 申请单基础服务定义
/// </summary>
/// <typeparam name="TEntity">实体的类型声明</typeparam>
public interface IApplicationService<in TEntity> where TEntity : ApplicationBase, new()
{
/// <summary>
/// 提交申请单
/// </summary>
/// <param name="application">申请单</param>
/// <returns></returns>
Task<DataResult> SaveAsync(TEntity application);
/// <summary>
/// 删除申请单明细
/// </summary>
/// <param name="ids">申请单明细ID</param>
/// <returns></returns>
Task<DataResult> DeleteDetailAsync(params long[] ids);
/// <summary>
/// 删除申请单
/// </summary>
/// <param name="ids">申请单ID</param>
/// <returns></returns>
Task<DataResult> DeleteAsync(params long[] ids);
/// <summary>
/// 发起审批工作流
/// </summary>
/// <param name="auditType">审批类型</param>
/// <param name="remark">审批备注</param>
/// <param name="idArray">申请单ID</param>
/// <returns></returns>
Task<DataResult> SubmitApprovalAsync(AuditType auditType, string remark, params long[] idArray);
/// <summary>
/// 撤销审批
/// </summary>
/// <param name="ids">申请单ID</param>
/// <returns></returns>
Task<DataResult> WithdrawAsync(params long[] ids);
}
}

@ -1,79 +0,0 @@
using DS.Module.Core;
using DS.WMS.Core.Application.Entity;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Op.Entity;
namespace DS.WMS.Core.Application.Interface
{
/// <summary>
/// 付费申请
/// </summary>
public interface IFeeApplicationService
{
/// <summary>
/// 获取分页列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
Task<DataResult<List<ApplicationDto>>> GetListAsync(PageRequest request);
/// <summary>
/// 获取待付费的业务列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
Task<DataResult<List<FeeApplicationBiz>>> GetBizListAsync(PageRequest request);
/// <summary>
/// 获取申请单详情
/// </summary>
/// <param name="id">申请单ID</param>
/// <returns></returns>
Task<DataResult<ApplicationDto>> GetAsync(long id);
/// <summary>
/// 根据业务编号及类型获取关联费用记录
/// </summary>
/// <param name="id">业务ID</param>
/// <param name="businessType">业务类型</param>
/// <returns></returns>
Task<DataResult<FeeDto>> GetFeesAsync(long id, BusinessType businessType);
/// <summary>
/// 提交申请单
/// </summary>
/// <param name="application">申请单</param>
/// <returns></returns>
Task<DataResult> SaveAsync(PaymentApplication application);
/// <summary>
/// 删除申请单明细
/// </summary>
/// <param name="ids">申请单明细ID</param>
/// <returns></returns>
Task<DataResult> DeleteDetailAsync(params long[] ids);
/// <summary>
/// 删除申请单
/// </summary>
/// <param name="ids">申请单ID</param>
/// <returns></returns>
Task<DataResult> DeleteAsync(params long[] ids);
/// <summary>
/// 发起审批工作流
/// </summary>
/// <param name="auditType">审批类型</param>
/// <param name="remark">审批备注</param>
/// <param name="idArray">申请单ID</param>
/// <returns></returns>
Task<DataResult> SubmitForApprovalAsync(AuditType auditType, string remark, params long[] idArray);
/// <summary>
/// 撤销审批
/// </summary>
/// <param name="ids">申请单ID</param>
/// <returns></returns>
Task<DataResult> WithdrawAsync(params long[] ids);
}
}

@ -0,0 +1,39 @@
using DS.Module.Core;
using DS.WMS.Core.Application.Entity;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Op.Entity;
namespace DS.WMS.Core.Application.Interface
{
/// <summary>
/// 付费申请
/// </summary>
public interface IPaymentApplicationAuditService : IApplicationAuditService<PaymentApplication>
{
/// <summary>
/// 获取申请单明细
/// </summary>
/// <param name="id">申请单ID</param>
/// <returns></returns>
Task<DataResult<FeeApplicationSummary>> GetDetailsAsync(long id);
/// <summary>
/// 获取业务费用统计
/// </summary>
/// <param name="id">业务ID</param>
/// <param name="businessType">业务类型</param>
/// <param name="customerId">结算对象ID</param>
/// <returns></returns>
Task<DataResult<FeeBiz>> GetFeeBizAsync(long id, BusinessType businessType, long customerId);
/// <summary>
/// 获取按票统计
/// </summary>
/// <param name="id">业务ID</param>
/// <param name="businessType">业务类型</param>
/// <returns></returns>
Task<DataResult<BizFeeStat>> GetStatAsync(long id, BusinessType businessType);
}
}

@ -0,0 +1,43 @@
using DS.Module.Core;
using DS.WMS.Core.Application.Entity;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Op.Entity;
namespace DS.WMS.Core.Application.Interface
{
/// <summary>
/// 付费申请
/// </summary>
public interface IPaymentApplicationService : IApplicationService<PaymentApplication>
{
/// <summary>
/// 获取分页列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
Task<DataResult<List<ApplicationDto>>> GetListAsync(PageRequest request);
/// <summary>
/// 获取待付费的业务列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
Task<DataResult<List<FeeApplicationBiz>>> GetBizListAsync(PageRequest request);
/// <summary>
/// 获取申请单详情
/// </summary>
/// <param name="id">申请单ID</param>
/// <returns></returns>
Task<DataResult<ApplicationDto>> GetAsync(long id);
/// <summary>
/// 根据业务编号及类型获取关联费用记录
/// </summary>
/// <param name="id">业务ID</param>
/// <param name="businessType">业务类型</param>
/// <returns></returns>
Task<DataResult<FeeDto>> GetFeesAsync(long id, BusinessType businessType);
}
}

@ -1,5 +1,6 @@
using DS.Module.Core;
using DS.WMS.Core.Application.Entity;
using DS.WMS.Core.Application.Interface;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Fee.Method;
using DS.WMS.Core.Flow.Dtos;
@ -12,7 +13,7 @@ namespace DS.WMS.Core.Application.Method
/// <summary>
/// 费用申请单审核服务
/// </summary>
public class ApplicationAuditService<TEntity> : FeeServiceBase
public class ApplicationAuditService<TEntity> : FeeServiceBase, IApplicationAuditService<TEntity>
where TEntity : ApplicationBase, new()
{
internal static readonly string[] AuditTypes = [AuditType.PaidApplication.ToString()];

@ -1,6 +1,7 @@
using DS.Module.Core;
using DS.Module.Core.Extensions;
using DS.WMS.Core.Application.Entity;
using DS.WMS.Core.Application.Interface;
using DS.WMS.Core.Fee.Entity;
using DS.WMS.Core.Fee.Method;
using DS.WMS.Core.Flow.Dtos;
@ -16,8 +17,7 @@ namespace DS.WMS.Core.Application.Method
/// 申请单基础实现
/// </summary>
/// <typeparam name="TEntity">实体的类型声明</typeparam>
/// <typeparam name="TModel">模型的类型声明</typeparam>
public class ApplicationService<TEntity> : FeeServiceBase
public class ApplicationService<TEntity> : FeeServiceBase, IApplicationService<TEntity>
where TEntity : ApplicationBase, new()
//where TModel : ApplicationDto
{
@ -191,7 +191,7 @@ namespace DS.WMS.Core.Application.Method
OriginalAmount = x.OriginalAmount
}).ToListAsync();
var appIds = details.Select(x=>x.ApplicationId).Distinct().ToList();
var appIds = details.Select(x => x.ApplicationId).Distinct().ToList();
var apps = await TenantDb.Queryable<TEntity>().Where(x => appIds.Contains(x.Id)).Select(x => new TEntity
{
Id = x.Id,
@ -224,7 +224,7 @@ namespace DS.WMS.Core.Application.Method
/// </summary>
/// <param name="applications">申请单</param>
/// <returns></returns>
protected virtual DataResult PreDelete(List<TEntity> applications)
protected virtual DataResult PreDelete(List<TEntity> applications)
{
return DataResult.Success;
}
@ -234,7 +234,7 @@ namespace DS.WMS.Core.Application.Method
/// </summary>
/// <param name="details">申请单明细</param>
/// <returns></returns>
protected virtual Task OnDeleteDetailAsync(List<ApplicationDetail> details)
protected virtual Task OnDeleteDetailAsync(List<ApplicationDetail> details)
{
return Task.CompletedTask;
}
@ -356,7 +356,7 @@ namespace DS.WMS.Core.Application.Method
/// </summary>
/// <param name="applications">申请单</param>
/// <returns></returns>
protected virtual DataResult PreSubmitApproval(List<TEntity> applications)
protected virtual DataResult PreSubmitApproval(List<TEntity> applications)
{
return DataResult.Success;
}

@ -3,6 +3,7 @@ using DS.Module.Core;
using DS.Module.Core.Enums;
using DS.Module.Core.Extensions;
using DS.WMS.Core.Application.Entity;
using DS.WMS.Core.Application.Interface;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Fee.Entity;
using DS.WMS.Core.Op.Entity;
@ -14,7 +15,7 @@ namespace DS.WMS.Core.Application.Method
/// <summary>
/// 付费申请实现
/// </summary>
public class PaymentApplicationService : ApplicationService<PaymentApplication>
public class PaymentApplicationService : ApplicationService<PaymentApplication>, IPaymentApplicationService
{
/// <summary>
/// 初始化
@ -174,7 +175,10 @@ namespace DS.WMS.Core.Application.Method
{
var query = TenantDb.Queryable<PaymentApplication>();
var whereList = Db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
List<IConditionalModel> whereList = [];
if (!request.QueryCondition.IsNullOrEmpty())
whereList = Db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
int? index = null;
foreach (var item in whereList)
{
@ -361,7 +365,6 @@ namespace DS.WMS.Core.Application.Method
await TenantDb.Updateable(fees).UpdateColumns(x => new { x.OrderAmount }).ExecuteCommandAsync();
}
protected override DataResult PreDelete(List<PaymentApplication> applications)
{
if (applications.Any(x => x.Status != PaymentApplicationStatus.Pending && x.Status != PaymentApplicationStatus.AuditRejected))
@ -380,7 +383,6 @@ namespace DS.WMS.Core.Application.Method
.ExecuteCommandAsync();
}
protected override DataResult PreSubmitApproval(List<PaymentApplication> applications)
{
if (applications.Exists(x => x.Status == PaymentApplicationStatus.AuditSubmittd || x.Status == PaymentApplicationStatus.AuditPassed))

@ -11,15 +11,15 @@ namespace DS.WMS.FeeApi.Controllers
/// <summary>
/// 申请单审核服务
/// </summary>
public class FeeApplicationAuditController : ApiController
public class PaymentApplicationAuditController : ApiController
{
readonly IFeeApplicationAuditService _auditService;
readonly IPaymentApplicationAuditService _auditService;
/// <summary>
/// 初始化
/// </summary>
/// <param name="auditService"></param>
public FeeApplicationAuditController(IFeeApplicationAuditService auditService)
public PaymentApplicationAuditController(IPaymentApplicationAuditService auditService)
{
_auditService = auditService;
}

@ -11,15 +11,15 @@ namespace DS.WMS.FeeApi.Controllers
/// <summary>
/// 费用申请单API
/// </summary>
public class FeeApplicationController : ApiController
public class PaymentApplicationController : ApiController
{
readonly IFeeApplicationService _service;
readonly IPaymentApplicationService _service;
/// <summary>
/// 初始化
/// </summary>
/// <param name="service"></param>
public FeeApplicationController(IFeeApplicationService service)
public PaymentApplicationController(IPaymentApplicationService service)
{
_service = service;
}
@ -119,7 +119,7 @@ namespace DS.WMS.FeeApi.Controllers
if (model.Ids == null || model.Ids.Length == 0)
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
return await _service.SubmitForApprovalAsync(AuditType.PaidApplication, model.Remark, model.Ids);
return await _service.SubmitApprovalAsync(AuditType.PaidApplication, model.Remark, model.Ids);
}
/// <summary>

@ -1363,3 +1363,17 @@
2024-06-18 14:50:39.2948 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config
2024-06-18 14:50:39.2948 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-06-18 14:50:39.3179 Info Configuration initialized.
2024-06-19 17:19:38.4724 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-06-19 17:19:38.5209 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-06-19 17:19:38.5209 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-06-19 17:19:38.5447 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-06-19 17:19:38.5501 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config
2024-06-19 17:19:38.5501 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-06-19 17:19:38.5501 Info Configuration initialized.
2024-06-19 17:26:34.6946 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-06-19 17:26:34.7358 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-06-19 17:26:34.7358 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-06-19 17:26:34.7529 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-06-19 17:26:34.7529 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config
2024-06-19 17:26:34.7529 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-06-19 17:26:34.7685 Info Configuration initialized.

Loading…
Cancel
Save