From 3d63e164c2419f06635b534f9f6be759e1d0645e Mon Sep 17 00:00:00 2001 From: wxd <123@qq.com> Date: Wed, 22 Apr 2026 10:27:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E7=A5=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CreateInvoiceApplyInputDto.cs | 86 ++++++++ .../GetInvoiceApplyListInputDto.cs | 32 +++ .../InvoiceApplys/InvoiceApplyDto.cs | 97 +++++++++ .../InvoiceApplys/InvoiceApplyIdInputDto.cs | 11 + .../UpdateInvoiceApplyInputDto.cs | 86 ++++++++ .../CreateInvoiceRecordInputDto.cs | 37 ++++ .../GetInvoiceRecordListInputDto.cs | 44 ++++ .../InvoiceRecords/InvoiceRecordDto.cs | 35 +++ .../InvoiceRecords/InvoiceRecordIdInputDto.cs | 11 + .../UpdateInvoiceRecordInputDto.cs | 37 ++++ .../CreatePaymentRecordInputDto.cs | 61 ++++++ .../GetPaymentRecordListInputDto.cs | 60 +++++ .../PaymentRecords/PaymentRecordDto.cs | 61 ++++++ .../PaymentRecords/PaymentRecordIdInputDto.cs | 11 + .../UpdatePaymentRecordInputDto.cs | 60 +++++ .../InvoiceApplys/InvoiceApplyAppService.cs | 205 ++++++++++++++++++ .../InvoiceRecords/InvoiceRecordAppService.cs | 146 +++++++++++++ .../PaymentRecords/PaymentRecordAppService.cs | 164 ++++++++++++++ 18 files changed, 1244 insertions(+) create mode 100644 src/Shentun.Peis.Application.Contracts/InvoiceApplys/CreateInvoiceApplyInputDto.cs create mode 100644 src/Shentun.Peis.Application.Contracts/InvoiceApplys/GetInvoiceApplyListInputDto.cs create mode 100644 src/Shentun.Peis.Application.Contracts/InvoiceApplys/InvoiceApplyDto.cs create mode 100644 src/Shentun.Peis.Application.Contracts/InvoiceApplys/InvoiceApplyIdInputDto.cs create mode 100644 src/Shentun.Peis.Application.Contracts/InvoiceApplys/UpdateInvoiceApplyInputDto.cs create mode 100644 src/Shentun.Peis.Application.Contracts/InvoiceRecords/CreateInvoiceRecordInputDto.cs create mode 100644 src/Shentun.Peis.Application.Contracts/InvoiceRecords/GetInvoiceRecordListInputDto.cs create mode 100644 src/Shentun.Peis.Application.Contracts/InvoiceRecords/InvoiceRecordDto.cs create mode 100644 src/Shentun.Peis.Application.Contracts/InvoiceRecords/InvoiceRecordIdInputDto.cs create mode 100644 src/Shentun.Peis.Application.Contracts/InvoiceRecords/UpdateInvoiceRecordInputDto.cs create mode 100644 src/Shentun.Peis.Application.Contracts/PaymentRecords/CreatePaymentRecordInputDto.cs create mode 100644 src/Shentun.Peis.Application.Contracts/PaymentRecords/GetPaymentRecordListInputDto.cs create mode 100644 src/Shentun.Peis.Application.Contracts/PaymentRecords/PaymentRecordDto.cs create mode 100644 src/Shentun.Peis.Application.Contracts/PaymentRecords/PaymentRecordIdInputDto.cs create mode 100644 src/Shentun.Peis.Application.Contracts/PaymentRecords/UpdatePaymentRecordInputDto.cs create mode 100644 src/Shentun.Peis.Application/InvoiceApplys/InvoiceApplyAppService.cs create mode 100644 src/Shentun.Peis.Application/InvoiceRecords/InvoiceRecordAppService.cs create mode 100644 src/Shentun.Peis.Application/PaymentRecords/PaymentRecordAppService.cs diff --git a/src/Shentun.Peis.Application.Contracts/InvoiceApplys/CreateInvoiceApplyInputDto.cs b/src/Shentun.Peis.Application.Contracts/InvoiceApplys/CreateInvoiceApplyInputDto.cs new file mode 100644 index 00000000..44810890 --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/InvoiceApplys/CreateInvoiceApplyInputDto.cs @@ -0,0 +1,86 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Text; + +namespace Shentun.Peis.InvoiceApplys +{ + public class CreateInvoiceApplyInputDto + { + /// + /// 单位编号 + /// + public Guid CustomerOrgId { get; set; } + + + + /// + ///客户单位登记ID 体检次数 + /// + public Guid CustomerOrgRegisterId { get; set; } + + /// + /// 业务员 + /// + public string SalesPerson { get; set; } + + /// + /// 申请时间 + /// + public string ApplyTime { get; set; } + + + /// + /// 申请金额 + /// + public decimal ApplyAmount { get; set; } + + + /// + /// 开票名称 + /// + public string InvoiceName { get; set; } + + /// + /// 国家组织机构代码 税号 + /// + public string CountryOrgCode { get; set; } + + /// + /// 业务银行 + /// + public string Bank { get; set; } + + + /// + /// 银行帐号 + /// + public string Accounts { get; set; } + + /// + /// 联系人 + /// + public string Contact { get; set; } + + /// + /// 联系电话 + /// + public string ContactPhone { get; set; } + + /// + /// 是否完成开票 + /// + public char IsCompleteInvoicing { get; set; } = 'N'; + + /// + /// 是否完成收款 + /// + public char IsCompletePayment { get; set; } = 'N'; + + /// + /// 备注 + /// + public string Remark { get; set; } + } +} diff --git a/src/Shentun.Peis.Application.Contracts/InvoiceApplys/GetInvoiceApplyListInputDto.cs b/src/Shentun.Peis.Application.Contracts/InvoiceApplys/GetInvoiceApplyListInputDto.cs new file mode 100644 index 00000000..b70d7157 --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/InvoiceApplys/GetInvoiceApplyListInputDto.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shentun.Peis.InvoiceApplys +{ + public class GetInvoiceApplyListInputDto + { + public string SalesPerson { get; set; } + + + /// + /// 发票申请开始时间 + /// + public string StartDate { get; set; } + + /// + /// 发票申请结束时间 + /// + public string EndDate { get; set; } + + /// + /// 是否完成开票 + /// + public char? IsCompleteInvoicing { get; set; } + + /// + /// 是否完成收款 + /// + public char? IsCompletePayment { get; set; } + } +} diff --git a/src/Shentun.Peis.Application.Contracts/InvoiceApplys/InvoiceApplyDto.cs b/src/Shentun.Peis.Application.Contracts/InvoiceApplys/InvoiceApplyDto.cs new file mode 100644 index 00000000..59e41da9 --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/InvoiceApplys/InvoiceApplyDto.cs @@ -0,0 +1,97 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shentun.Peis.InvoiceApplys +{ + public class InvoiceApplyDto : AuditedEntityDtoName + { + /// + /// 单位编号 + /// + public Guid CustomerOrgId { get; set; } + + /// + /// 单位名称 + /// + public string CustomerOrgName { get; set; } + + /// + /// 部门名称 + /// + public string DepartmentName { get; set; } + + /// + ///客户单位登记ID 体检次数 + /// + public Guid CustomerOrgRegisterId { get; set; } + + /// + ///客户单位登记ID 体检次数 + /// + public short MedicalTimes { get; set; } + + /// + /// 业务员 + /// + public string SalesPerson { get; set; } + + /// + /// 申请时间 + /// + public string ApplyTime { get; set; } + + + /// + /// 申请金额 + /// + public decimal ApplyAmount { get; set; } + + + /// + /// 开票名称 + /// + public string InvoiceName { get; set; } + + /// + /// 国家组织机构代码 税号 + /// + public string CountryOrgCode { get; set; } + + /// + /// 业务银行 + /// + public string Bank { get; set; } + + + /// + /// 银行帐号 + /// + public string Accounts { get; set; } + + /// + /// 联系人 + /// + public string Contact { get; set; } + + /// + /// 联系电话 + /// + public string ContactPhone { get; set; } + + /// + /// 是否完成开票 + /// + public char IsCompleteInvoicing { get; set; } = 'N'; + + /// + /// 是否完成收款 + /// + public char IsCompletePayment { get; set; } = 'N'; + + /// + /// 备注 + /// + public string Remark { get; set; } + } +} diff --git a/src/Shentun.Peis.Application.Contracts/InvoiceApplys/InvoiceApplyIdInputDto.cs b/src/Shentun.Peis.Application.Contracts/InvoiceApplys/InvoiceApplyIdInputDto.cs new file mode 100644 index 00000000..695aa558 --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/InvoiceApplys/InvoiceApplyIdInputDto.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shentun.Peis.InvoiceApplys +{ + public class InvoiceApplyIdInputDto + { + public Guid InvoiceApplyId { get; set; } + } +} diff --git a/src/Shentun.Peis.Application.Contracts/InvoiceApplys/UpdateInvoiceApplyInputDto.cs b/src/Shentun.Peis.Application.Contracts/InvoiceApplys/UpdateInvoiceApplyInputDto.cs new file mode 100644 index 00000000..6345f57d --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/InvoiceApplys/UpdateInvoiceApplyInputDto.cs @@ -0,0 +1,86 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shentun.Peis.InvoiceApplys +{ + public class UpdateInvoiceApplyInputDto + { + public Guid Id { get; set; } + + /// + /// 单位编号 + /// + public Guid CustomerOrgId { get; set; } + + + + /// + ///客户单位登记ID 体检次数 + /// + public Guid CustomerOrgRegisterId { get; set; } + + /// + /// 业务员 + /// + public string SalesPerson { get; set; } + + /// + /// 申请时间 + /// + public string ApplyTime { get; set; } + + + /// + /// 申请金额 + /// + public decimal ApplyAmount { get; set; } + + + /// + /// 开票名称 + /// + public string InvoiceName { get; set; } + + /// + /// 国家组织机构代码 税号 + /// + public string CountryOrgCode { get; set; } + + /// + /// 业务银行 + /// + public string Bank { get; set; } + + + /// + /// 银行帐号 + /// + public string Accounts { get; set; } + + /// + /// 联系人 + /// + public string Contact { get; set; } + + /// + /// 联系电话 + /// + public string ContactPhone { get; set; } + + /// + /// 是否完成开票 + /// + public char IsCompleteInvoicing { get; set; } = 'N'; + + /// + /// 是否完成收款 + /// + public char IsCompletePayment { get; set; } = 'N'; + + /// + /// 备注 + /// + public string Remark { get; set; } + } +} diff --git a/src/Shentun.Peis.Application.Contracts/InvoiceRecords/CreateInvoiceRecordInputDto.cs b/src/Shentun.Peis.Application.Contracts/InvoiceRecords/CreateInvoiceRecordInputDto.cs new file mode 100644 index 00000000..93d9f573 --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/InvoiceRecords/CreateInvoiceRecordInputDto.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Text; + +namespace Shentun.Peis.InvoiceRecords +{ + public class CreateInvoiceRecordInputDto + { + /// + ///发票申请表id + /// + public Guid InvoiceApplyId { get; set; } + + /// + /// 开票人 + /// + public string InvoicePerson { get; set; } + + /// + /// 开票时间 + /// + public string InvoiceTime { get; set; } + + + /// + /// 开票金额 + /// + public decimal InvoiceAmount { get; set; } + + /// + /// 备注 + /// + public string Remark { get; set; } + } +} diff --git a/src/Shentun.Peis.Application.Contracts/InvoiceRecords/GetInvoiceRecordListInputDto.cs b/src/Shentun.Peis.Application.Contracts/InvoiceRecords/GetInvoiceRecordListInputDto.cs new file mode 100644 index 00000000..9993e0bb --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/InvoiceRecords/GetInvoiceRecordListInputDto.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.Text; + +namespace Shentun.Peis.InvoiceRecords +{ + public class GetInvoiceRecordListInputDto + { + /// + ///发票申请表id + /// + public Guid? InvoiceApplyId { get; set; } + + /// + /// 开票人 + /// + public string InvoicePerson { get; set; } + + + /// + /// 开票时间开始时间 + /// + public string StartDate { get; set; } + + /// + /// 开票时间结束时间 + /// + public string EndDate { get; set; } + + + /// + /// 开票金额开始金额 + /// + public decimal? StartAmount { get; set; } + + /// + /// 开票金额结束金额 + /// + public decimal? EndAmount { get; set; } + + + } +} diff --git a/src/Shentun.Peis.Application.Contracts/InvoiceRecords/InvoiceRecordDto.cs b/src/Shentun.Peis.Application.Contracts/InvoiceRecords/InvoiceRecordDto.cs new file mode 100644 index 00000000..dc53aa2c --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/InvoiceRecords/InvoiceRecordDto.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shentun.Peis.InvoiceRecords +{ + public class InvoiceRecordDto : AuditedEntityDtoName + { + /// + ///发票申请表id + /// + public Guid InvoiceApplyId { get; set; } + + /// + /// 开票人 + /// + public string InvoicePerson { get; set; } + + /// + /// 开票时间 + /// + public string InvoiceTime { get; set; } + + + /// + /// 开票金额 + /// + public decimal InvoiceAmount { get; set; } + + /// + /// 备注 + /// + public string Remark { get; set; } + } +} diff --git a/src/Shentun.Peis.Application.Contracts/InvoiceRecords/InvoiceRecordIdInputDto.cs b/src/Shentun.Peis.Application.Contracts/InvoiceRecords/InvoiceRecordIdInputDto.cs new file mode 100644 index 00000000..16f2297e --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/InvoiceRecords/InvoiceRecordIdInputDto.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shentun.Peis.InvoiceRecords +{ + public class InvoiceRecordIdInputDto + { + public Guid InvoiceRecordId { get; set; } + } +} diff --git a/src/Shentun.Peis.Application.Contracts/InvoiceRecords/UpdateInvoiceRecordInputDto.cs b/src/Shentun.Peis.Application.Contracts/InvoiceRecords/UpdateInvoiceRecordInputDto.cs new file mode 100644 index 00000000..19b94dbe --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/InvoiceRecords/UpdateInvoiceRecordInputDto.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shentun.Peis.InvoiceRecords +{ + public class UpdateInvoiceRecordInputDto + { + public Guid Id { get; set; } + + /// + ///发票申请表id + /// + public Guid InvoiceApplyId { get; set; } + + /// + /// 开票人 + /// + public string InvoicePerson { get; set; } + + /// + /// 开票时间 + /// + public string InvoiceTime { get; set; } + + + /// + /// 开票金额 + /// + public decimal InvoiceAmount { get; set; } + + /// + /// 备注 + /// + public string Remark { get; set; } + } +} diff --git a/src/Shentun.Peis.Application.Contracts/PaymentRecords/CreatePaymentRecordInputDto.cs b/src/Shentun.Peis.Application.Contracts/PaymentRecords/CreatePaymentRecordInputDto.cs new file mode 100644 index 00000000..66faf7ed --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/PaymentRecords/CreatePaymentRecordInputDto.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Text; + +namespace Shentun.Peis.PaymentRecords +{ + public class CreatePaymentRecordInputDto + { + /// + ///发票申请表id + /// + public Guid InvoiceApplyId { get; set; } + + /// + /// 付款账户 + /// + public string PaymentAccount { get; set; } + + /// + /// 付款银行 + /// + public string PaymentBank { get; set; } + + + /// + /// 付款金额 + /// + public decimal PaymentAmount { get; set; } + + + /// + /// 付款时间 + /// + public string PaymentTime { get; set; } + + + + /// + /// 收款账户 + /// + public string CollectionAccount { get; set; } + + /// + /// 收款银行 + /// + public string CollectionBank { get; set; } + + + /// + /// 交易流水号 + /// + public string TransactionId { get; set; } + + /// + /// 备注 + /// + public string Remark { get; set; } + } +} diff --git a/src/Shentun.Peis.Application.Contracts/PaymentRecords/GetPaymentRecordListInputDto.cs b/src/Shentun.Peis.Application.Contracts/PaymentRecords/GetPaymentRecordListInputDto.cs new file mode 100644 index 00000000..3568458d --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/PaymentRecords/GetPaymentRecordListInputDto.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Text; + +namespace Shentun.Peis.PaymentRecords +{ + public class GetPaymentRecordListInputDto + { + /// + ///发票申请表id + /// + public Guid? InvoiceApplyId { get; set; } + + + + /// + /// 付款账户 + /// + public string PaymentAccount { get; set; } + + + + + /// + /// 付款时间开始时间 + /// + public string StartDate { get; set; } + + /// + /// 付款时间结束时间 + /// + public string EndDate { get; set; } + + + /// + /// 付款金额开始金额 + /// + public decimal? StartAmount { get; set; } + + /// + /// 付款金额结束金额 + /// + public decimal? EndAmount { get; set; } + + + + /// + /// 收款账户 + /// + public string CollectionAccount { get; set; } + + + /// + /// 交易流水号 + /// + public string TransactionId { get; set; } + } +} diff --git a/src/Shentun.Peis.Application.Contracts/PaymentRecords/PaymentRecordDto.cs b/src/Shentun.Peis.Application.Contracts/PaymentRecords/PaymentRecordDto.cs new file mode 100644 index 00000000..c790c1f5 --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/PaymentRecords/PaymentRecordDto.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Text; + +namespace Shentun.Peis.PaymentRecords +{ + public class PaymentRecordDto : AuditedEntityDtoName + { + /// + ///发票申请表id + /// + public Guid InvoiceApplyId { get; set; } + + /// + /// 付款账户 + /// + public string PaymentAccount { get; set; } + + /// + /// 付款银行 + /// + public string PaymentBank { get; set; } + + + /// + /// 付款金额 + /// + public decimal PaymentAmount { get; set; } + + + /// + /// 付款时间 + /// + public string PaymentTime { get; set; } + + + + /// + /// 收款账户 + /// + public string CollectionAccount { get; set; } + + /// + /// 收款银行 + /// + public string CollectionBank { get; set; } + + + /// + /// 交易流水号 + /// + public string TransactionId { get; set; } + + /// + /// 备注 + /// + public string Remark { get; set; } + } +} diff --git a/src/Shentun.Peis.Application.Contracts/PaymentRecords/PaymentRecordIdInputDto.cs b/src/Shentun.Peis.Application.Contracts/PaymentRecords/PaymentRecordIdInputDto.cs new file mode 100644 index 00000000..29b182df --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/PaymentRecords/PaymentRecordIdInputDto.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shentun.Peis.PaymentRecords +{ + public class PaymentRecordIdInputDto + { + public Guid PaymentRecordId { get; set; } + } +} diff --git a/src/Shentun.Peis.Application.Contracts/PaymentRecords/UpdatePaymentRecordInputDto.cs b/src/Shentun.Peis.Application.Contracts/PaymentRecords/UpdatePaymentRecordInputDto.cs new file mode 100644 index 00000000..7cb73732 --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/PaymentRecords/UpdatePaymentRecordInputDto.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shentun.Peis.PaymentRecords +{ + public class UpdatePaymentRecordInputDto + { + public Guid Id { get; set; } + /// + ///发票申请表id + /// + public Guid InvoiceApplyId { get; set; } + + /// + /// 付款账户 + /// + public string PaymentAccount { get; set; } + + /// + /// 付款银行 + /// + public string PaymentBank { get; set; } + + + /// + /// 付款金额 + /// + public decimal PaymentAmount { get; set; } + + + /// + /// 付款时间 + /// + public string PaymentTime { get; set; } + + + + /// + /// 收款账户 + /// + public string CollectionAccount { get; set; } + + /// + /// 收款银行 + /// + public string CollectionBank { get; set; } + + + /// + /// 交易流水号 + /// + public string TransactionId { get; set; } + + /// + /// 备注 + /// + public string Remark { get; set; } + } +} diff --git a/src/Shentun.Peis.Application/InvoiceApplys/InvoiceApplyAppService.cs b/src/Shentun.Peis.Application/InvoiceApplys/InvoiceApplyAppService.cs new file mode 100644 index 00000000..8a5939c5 --- /dev/null +++ b/src/Shentun.Peis.Application/InvoiceApplys/InvoiceApplyAppService.cs @@ -0,0 +1,205 @@ +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore.Metadata.Internal; +using Npgsql.Internal.TypeHandlers.DateTimeHandlers; +using NPOI.Util; +using Shentun.Peis.Migrations; +using Shentun.Peis.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.Application.Services; +using Volo.Abp.Domain.Repositories; + +namespace Shentun.Peis.InvoiceApplys +{ + /// + /// 发票申请 + /// + [ApiExplorerSettings(GroupName = "Work")] + [Authorize] + public class InvoiceApplyAppService : ApplicationService + { + private readonly IRepository _invoiceApplyRepository; + private readonly IRepository _invoiceRecordRepository; + private readonly IRepository _paymentRecordRepository; + private readonly IRepository _customerOrgRegisterRepository; + private readonly CacheService _cacheService; + + + public InvoiceApplyAppService( + IRepository invoiceApplyRepository, + IRepository invoiceRecordRepository, + IRepository paymentRecordRepository, + IRepository customerOrgRegisterRepository, + CacheService cacheService) + { + _invoiceApplyRepository = invoiceApplyRepository; + _invoiceRecordRepository = invoiceRecordRepository; + _paymentRecordRepository = paymentRecordRepository; + _customerOrgRegisterRepository = customerOrgRegisterRepository; + _cacheService = cacheService; + } + + /// + /// 发票申请列表 + /// + /// + [HttpPost("api/app/InvoiceApply/GetInvoiceApplyList")] + public async Task> GetInvoiceApplyListAsync(GetInvoiceApplyListInputDto input) + { + var query = from invoiceApply in await _invoiceApplyRepository.GetQueryableAsync() + join customerOrgRegister in await _customerOrgRegisterRepository.GetQueryableAsync() on invoiceApply.CustomerOrgRegisterId equals customerOrgRegister.Id + select new + { + invoiceApply, + customerOrgRegister + }; + + if (!string.IsNullOrWhiteSpace(input.SalesPerson)) + { + query = query.Where(m => m.invoiceApply.SalesPerson == input.SalesPerson); + } + + if (input.IsCompleteInvoicing != null) + { + query = query.Where(m => m.invoiceApply.IsCompleteInvoicing == input.IsCompleteInvoicing); + } + + if (input.IsCompletePayment != null) + { + query = query.Where(m => m.invoiceApply.IsCompletePayment == input.IsCompletePayment); + } + + if (!string.IsNullOrWhiteSpace(input.StartDate) && !string.IsNullOrWhiteSpace(input.EndDate)) + { + query = query.Where(m => m.invoiceApply.ApplyTime >= Convert.ToDateTime(input.StartDate) && + m.invoiceApply.ApplyTime.Value < Convert.ToDateTime(input.EndDate).AddDays(1)); + } + + var entListDto = query.ToList().Select(s => new InvoiceApplyDto + { + Accounts = s.invoiceApply.Accounts, + ApplyAmount = s.invoiceApply.ApplyAmount, + ApplyTime = DataHelper.ConversionDateShortToString(s.invoiceApply.ApplyTime), + Bank = s.invoiceApply.Bank, + Contact = s.invoiceApply.Contact, + ContactPhone = s.invoiceApply.ContactPhone, + CountryOrgCode = s.invoiceApply.CountryOrgCode, + CreationTime = s.invoiceApply.CreationTime, + CreatorId = s.invoiceApply.CreatorId, + CreatorName = _cacheService.GetSurnameAsync(s.invoiceApply.CreatorId).GetAwaiter().GetResult(), + CustomerOrgId = s.invoiceApply.CustomerOrgId, + CustomerOrgName = _cacheService.GetTopCustomerOrgNameAsync(s.invoiceApply.CustomerOrgId).GetAwaiter().GetResult(), + DepartmentName = _cacheService.GetCustomerOrgNameAsync(s.invoiceApply.CustomerOrgId).GetAwaiter().GetResult(), + CustomerOrgRegisterId = s.invoiceApply.CustomerOrgRegisterId, + Id = s.invoiceApply.Id, + InvoiceName = s.invoiceApply.InvoiceName, + IsCompleteInvoicing = s.invoiceApply.IsCompleteInvoicing, + IsCompletePayment = s.invoiceApply.IsCompletePayment, + LastModificationTime = s.invoiceApply.LastModificationTime, + LastModifierId = s.invoiceApply.LastModifierId, + Remark = s.invoiceApply.Remark, + SalesPerson = s.invoiceApply.SalesPerson, + LastModifierName = _cacheService.GetSurnameAsync(s.invoiceApply.LastModifierId).GetAwaiter().GetResult(), + MedicalTimes = s.customerOrgRegister.MedicalTimes + }).ToList(); + + return entListDto; + } + + + /// + /// 创建发票申请 + /// + /// + [HttpPost("api/app/InvoiceApply/CreateInvoiceApply")] + public async Task CreateInvoiceApplyAsync(CreateInvoiceApplyInputDto input) + { + Guid invoiceApplyId = GuidGenerator.Create(); + var invoiceApplyEntity = new InvoiceApply(invoiceApplyId) + { + Accounts = input.Accounts, + ApplyAmount = input.ApplyAmount, + ApplyTime = !string.IsNullOrWhiteSpace(input.ApplyTime) ? DateTime.Parse(input.ApplyTime) : DateTime.Now, + Bank = input.Bank, + Contact = input.Contact, + ContactPhone = input.ContactPhone, + CountryOrgCode = input.CountryOrgCode, + CustomerOrgId = input.CustomerOrgId, + CustomerOrgRegisterId = input.CustomerOrgRegisterId, + InvoiceName = input.InvoiceName, + IsCompleteInvoicing = input.IsCompleteInvoicing, + IsCompletePayment = input.IsCompletePayment, + Remark = input.Remark, + SalesPerson = input.SalesPerson + }; + + await _invoiceApplyRepository.InsertAsync(invoiceApplyEntity); + } + + /// + /// 修改发票申请 + /// + /// + [HttpPost("api/app/InvoiceApply/UpdateInvoiceApply")] + public async Task UpdateInvoiceApplyAsync(UpdateInvoiceApplyInputDto input) + { + var invoiceApplyEntity = await _invoiceApplyRepository.FirstOrDefaultAsync(f => f.Id == input.Id); + if (invoiceApplyEntity == null) + { + throw new UserFriendlyException("申请不存在"); + } + + invoiceApplyEntity.Accounts = input.Accounts; + invoiceApplyEntity.ApplyAmount = input.ApplyAmount; + invoiceApplyEntity.ApplyTime = DateTime.Parse(input.ApplyTime); + invoiceApplyEntity.Bank = input.Bank; + invoiceApplyEntity.Contact = input.Contact; + invoiceApplyEntity.ContactPhone = input.ContactPhone; + invoiceApplyEntity.CountryOrgCode = input.CountryOrgCode; + invoiceApplyEntity.CustomerOrgId = input.CustomerOrgId; + invoiceApplyEntity.CustomerOrgRegisterId = input.CustomerOrgRegisterId; + invoiceApplyEntity.InvoiceName = input.InvoiceName; + invoiceApplyEntity.IsCompleteInvoicing = input.IsCompleteInvoicing; + invoiceApplyEntity.IsCompletePayment = input.IsCompletePayment; + invoiceApplyEntity.Remark = input.Remark; + invoiceApplyEntity.SalesPerson = input.SalesPerson; + + + await _invoiceApplyRepository.UpdateAsync(invoiceApplyEntity); + } + + + /// + /// 删除发票申请 + /// + /// + [HttpPost("api/app/InvoiceApply/DeleteInvoiceApply")] + public async Task DeleteInvoiceApplyAsync(InvoiceApplyIdInputDto input) + { + var invoiceApplyEntity = await _invoiceApplyRepository.FirstOrDefaultAsync(f => f.Id == input.InvoiceApplyId); + if (invoiceApplyEntity == null) + { + throw new UserFriendlyException("申请不存在"); + } + + var invoiceRecordEntity = await _invoiceRecordRepository.FirstOrDefaultAsync(f => f.InvoiceApplyId == input.InvoiceApplyId); + if (invoiceRecordEntity != null) + { + throw new UserFriendlyException("该发票申请已有开票记录,不能删除"); + } + + var paymentRecordEntity = await _paymentRecordRepository.FirstOrDefaultAsync(f => f.InvoiceApplyId == input.InvoiceApplyId); + if (paymentRecordEntity != null) + { + throw new UserFriendlyException("该发票申请已有付款记录,不能删除"); + } + + await _invoiceApplyRepository.DeleteAsync(invoiceApplyEntity); + } + } +} diff --git a/src/Shentun.Peis.Application/InvoiceRecords/InvoiceRecordAppService.cs b/src/Shentun.Peis.Application/InvoiceRecords/InvoiceRecordAppService.cs new file mode 100644 index 00000000..851093f2 --- /dev/null +++ b/src/Shentun.Peis.Application/InvoiceRecords/InvoiceRecordAppService.cs @@ -0,0 +1,146 @@ +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Shentun.Peis.InvoiceApplys; +using Shentun.Peis.Models; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.Application.Services; +using Volo.Abp.Domain.Repositories; + +namespace Shentun.Peis.InvoiceRecords +{ + /// + /// 开票记录 + /// + [ApiExplorerSettings(GroupName = "Work")] + [Authorize] + public class InvoiceRecordAppService : ApplicationService + { + private readonly IRepository _invoiceRecordRepository; + private readonly CacheService _cacheService; + + public InvoiceRecordAppService( + IRepository invoiceRecordRepository, + CacheService cacheService) + { + _invoiceRecordRepository = invoiceRecordRepository; + _cacheService = cacheService; + } + + /// + /// 开票记录列表 + /// + /// + [HttpPost("api/app/InvoiceRecord/GetInvoiceRecordList")] + public async Task> GetInvoiceRecordListAsync(GetInvoiceRecordListInputDto input) + { + var query = await _invoiceRecordRepository.GetQueryableAsync(); + + if (input.InvoiceApplyId != null) + { + query = query.Where(m => m.InvoiceApplyId == input.InvoiceApplyId); + } + + if (!string.IsNullOrWhiteSpace(input.InvoicePerson)) + { + query = query.Where(m => m.InvoicePerson == input.InvoicePerson); + } + + if (input.StartAmount != null && input.EndAmount != null) + { + query = query.Where(m => m.InvoiceAmount >= input.StartAmount && + m.InvoiceAmount < input.EndAmount); + } + + if (!string.IsNullOrWhiteSpace(input.StartDate) && !string.IsNullOrWhiteSpace(input.EndDate)) + { + query = query.Where(m => m.InvoiceTime >= Convert.ToDateTime(input.StartDate) && + m.InvoiceTime < Convert.ToDateTime(input.EndDate).AddDays(1)); + } + + var entListDto = query.ToList().Select(s => new InvoiceRecordDto + { + CreationTime = s.CreationTime, + CreatorId = s.CreatorId, + CreatorName = _cacheService.GetSurnameAsync(s.CreatorId).GetAwaiter().GetResult(), + Id = s.Id, + LastModificationTime = s.LastModificationTime, + LastModifierId = s.LastModifierId, + Remark = s.Remark, + LastModifierName = _cacheService.GetSurnameAsync(s.LastModifierId).GetAwaiter().GetResult(), + InvoiceAmount = s.InvoiceAmount, + InvoiceTime = DataHelper.ConversionDateToString(s.LastModificationTime), + InvoiceApplyId = s.InvoiceApplyId, + InvoicePerson = s.InvoicePerson + }).ToList(); + + return entListDto; + } + + /// + /// 添加开票记录 + /// + /// + [HttpPost("api/app/InvoiceRecord/CreateInvoiceRecord")] + public async Task CreateInvoiceRecordAsync(CreateInvoiceRecordInputDto input) + { + Guid invoiceRecordId = GuidGenerator.Create(); + var invoiceRecordEntity = new InvoiceRecord(invoiceRecordId) + { + InvoiceAmount = input.InvoiceAmount, + InvoiceApplyId = input.InvoiceApplyId, + InvoicePerson = input.InvoicePerson, + InvoiceTime = !string.IsNullOrWhiteSpace(input.InvoiceTime) ? DateTime.Parse(input.InvoiceTime) : DateTime.Now, + Remark = input.Remark + }; + + await _invoiceRecordRepository.InsertAsync(invoiceRecordEntity); + } + + /// + /// 修改开票记录 + /// + /// + [HttpPost("api/app/InvoiceRecord/UpdateInvoiceRecord")] + public async Task UpdateInvoiceRecordAsync(UpdateInvoiceRecordInputDto input) + { + var invoiceRecordEntity = await _invoiceRecordRepository.FirstOrDefaultAsync(f => f.Id == input.Id); + if (invoiceRecordEntity == null) + { + throw new UserFriendlyException("记录不存在"); + } + + invoiceRecordEntity.InvoiceTime = DateTime.Parse(input.InvoiceTime); + invoiceRecordEntity.InvoiceAmount = input.InvoiceAmount; + invoiceRecordEntity.InvoiceApplyId = input.InvoiceApplyId; + invoiceRecordEntity.InvoicePerson = input.Remark; + invoiceRecordEntity.Remark = input.Remark; + + + + await _invoiceRecordRepository.UpdateAsync(invoiceRecordEntity); + } + + + /// + /// 删除开票记录 + /// + /// + [HttpPost("api/app/InvoiceRecord/DeleteInvoiceRecord")] + public async Task DeleteInvoiceApplyAsync(InvoiceRecordIdInputDto input) + { + var invoiceRecordEntity = await _invoiceRecordRepository.FirstOrDefaultAsync(f => f.Id == input.InvoiceRecordId); + if (invoiceRecordEntity == null) + { + throw new UserFriendlyException("记录不存在"); + } + + await _invoiceRecordRepository.DeleteAsync(invoiceRecordEntity); + } + } +} diff --git a/src/Shentun.Peis.Application/PaymentRecords/PaymentRecordAppService.cs b/src/Shentun.Peis.Application/PaymentRecords/PaymentRecordAppService.cs new file mode 100644 index 00000000..9c5e0df2 --- /dev/null +++ b/src/Shentun.Peis.Application/PaymentRecords/PaymentRecordAppService.cs @@ -0,0 +1,164 @@ +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Shentun.Peis.Models; +using Shentun.Peis.PaymentRecords; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.Application.Services; +using Volo.Abp.Domain.Repositories; + +namespace Shentun.Peis.PaymentRecords +{ + /// + /// 付款记录 + /// + [ApiExplorerSettings(GroupName = "Work")] + [Authorize] + public class PaymentRecordAppService : ApplicationService + { + private readonly IRepository _paymentRecordRepository; + private readonly CacheService _cacheService; + + public PaymentRecordAppService( + IRepository paymentRecordRepository, + CacheService cacheService) + { + _paymentRecordRepository = paymentRecordRepository; + _cacheService = cacheService; + } + + /// + /// 付款记录列表 + /// + /// + [HttpPost("api/app/PaymentRecord/GetPaymentRecordList")] + public async Task> GetPaymentRecordListAsync(GetPaymentRecordListInputDto input) + { + var query = await _paymentRecordRepository.GetQueryableAsync(); + + + if (!string.IsNullOrWhiteSpace(input.PaymentAccount)) + { + query = query.Where(m => m.PaymentAccount == input.PaymentAccount); + } + + if (!string.IsNullOrWhiteSpace(input.CollectionAccount)) + { + query = query.Where(m => m.CollectionAccount == input.CollectionAccount); + } + + if (!string.IsNullOrWhiteSpace(input.TransactionId)) + { + query = query.Where(m => m.TransactionId == input.TransactionId); + } + + if (input.StartAmount != null && input.EndAmount != null) + { + query = query.Where(m => m.PaymentAmount >= input.StartAmount && + m.PaymentAmount < input.EndAmount); + } + + if (!string.IsNullOrWhiteSpace(input.StartDate) && !string.IsNullOrWhiteSpace(input.EndDate)) + { + query = query.Where(m => m.PaymentTime >= Convert.ToDateTime(input.StartDate) && + m.PaymentTime < Convert.ToDateTime(input.EndDate).AddDays(1)); + } + + var entListDto = query.ToList().Select(s => new PaymentRecordDto + { + CreationTime = s.CreationTime, + CreatorId = s.CreatorId, + CreatorName = _cacheService.GetSurnameAsync(s.CreatorId).GetAwaiter().GetResult(), + Id = s.Id, + LastModificationTime = s.LastModificationTime, + LastModifierId = s.LastModifierId, + CollectionAccount = s.CollectionAccount, + CollectionBank = s.CollectionBank, + PaymentAccount = s.PaymentAccount, + PaymentAmount = s.PaymentAmount, + PaymentBank = s.PaymentBank, + Remark = s.Remark, + TransactionId = s.TransactionId, + LastModifierName = _cacheService.GetSurnameAsync(s.LastModifierId).GetAwaiter().GetResult(), + InvoiceApplyId = s.InvoiceApplyId, + PaymentTime = DataHelper.ConversionDateToString(s.PaymentTime) + }).ToList(); + + return entListDto; + } + + /// + /// 添加付款记录 + /// + /// + [HttpPost("api/app/PaymentRecord/CreatePaymentRecord")] + public async Task CreatePaymentRecordAsync(CreatePaymentRecordInputDto input) + { + Guid paymentRecordId = GuidGenerator.Create(); + var paymentRecordEntity = new PaymentRecord(paymentRecordId) + { + CollectionAccount = input.CollectionAccount, + CollectionBank = input.CollectionBank, + PaymentAccount = input.PaymentAccount, + PaymentAmount = input.PaymentAmount, + PaymentBank = input.PaymentBank, + PaymentTime = string.IsNullOrWhiteSpace(input.PaymentTime) ? null : DateTime.Parse(input.PaymentTime), + TransactionId = input.TransactionId, + InvoiceApplyId = input.InvoiceApplyId, + Remark = input.Remark + }; + + await _paymentRecordRepository.InsertAsync(paymentRecordEntity); + } + + /// + /// 修改付款记录 + /// + /// + [HttpPost("api/app/PaymentRecord/UpdatePaymentRecord")] + public async Task UpdatePaymentRecordAsync(UpdatePaymentRecordInputDto input) + { + var paymentRecordEntity = await _paymentRecordRepository.FirstOrDefaultAsync(f => f.Id == input.Id); + if (paymentRecordEntity == null) + { + throw new UserFriendlyException("记录不存在"); + } + + + paymentRecordEntity.CollectionAccount = input.CollectionAccount; + paymentRecordEntity.CollectionBank = input.CollectionBank; + paymentRecordEntity.PaymentAccount = input.PaymentAccount; + paymentRecordEntity.PaymentAmount = input.PaymentAmount; + paymentRecordEntity.PaymentBank = input.PaymentBank; + paymentRecordEntity.PaymentTime = string.IsNullOrWhiteSpace(input.PaymentTime) ? null : DateTime.Parse(input.PaymentTime); + paymentRecordEntity.TransactionId = input.TransactionId; + paymentRecordEntity.InvoiceApplyId = input.InvoiceApplyId; + paymentRecordEntity.Remark = input.Remark; + + + await _paymentRecordRepository.UpdateAsync(paymentRecordEntity); + } + + + /// + /// 删除付款记录 + /// + /// + [HttpPost("api/app/PaymentRecord/DeletePaymentRecord")] + public async Task DeleteInvoiceApplyAsync(PaymentRecordIdInputDto input) + { + var paymentRecordEntity = await _paymentRecordRepository.FirstOrDefaultAsync(f => f.Id == input.PaymentRecordId); + if (paymentRecordEntity == null) + { + throw new UserFriendlyException("记录不存在"); + } + + await _paymentRecordRepository.DeleteAsync(paymentRecordEntity); + } + } +}