From 5c923275527fae5077f68bf5a40ca031fbb45014 Mon Sep 17 00:00:00 2001
From: hao <86whm@163.com>
Date: Wed, 31 Jan 2024 18:00:59 +0800
Subject: [PATCH] =?UTF-8?q?=E8=B4=B9=E7=94=A8=E6=A8=A1=E6=9D=BF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Service/Fee/Dto/FeeTemplateDto.cs | 256 ++++++++++++++++++
.../Service/Fee/FeeCustTemplateService.cs | 2 +-
.../Service/Fee/FeeTemplateService.cs | 154 +++++++++++
3 files changed, 411 insertions(+), 1 deletion(-)
create mode 100644 Myshipping.Application/Service/Fee/Dto/FeeTemplateDto.cs
create mode 100644 Myshipping.Application/Service/Fee/FeeTemplateService.cs
diff --git a/Myshipping.Application/Service/Fee/Dto/FeeTemplateDto.cs b/Myshipping.Application/Service/Fee/Dto/FeeTemplateDto.cs
new file mode 100644
index 00000000..c5c253fe
--- /dev/null
+++ b/Myshipping.Application/Service/Fee/Dto/FeeTemplateDto.cs
@@ -0,0 +1,256 @@
+using Myshipping.Core;
+using SqlSugar;
+using System.ComponentModel;
+using System;
+using System.Collections.Generic;
+
+namespace Myshipping.Application.Service.Fee.Dto
+{
+ public class FeeTemplateDto
+ {
+ ///
+ /// ID
+ ///
+ public long Id { get; set; }
+
+ ///
+ /// 业务类型
+ ///
+ [Description("业务类型")]
+ public string OpType { get; set; }
+
+ ///
+ /// 收付类型(收、付)
+ ///
+ [Description("收付类型(收、付)")]
+ public string FeeType { get; set; }
+
+ ///
+ /// 费用模板名称
+ ///
+ [Description("费用模板名称")]
+ public string Name { get; set; }
+
+ ///
+ /// 费用模板描述
+ ///
+ [Description("费用模板描述")]
+ public string Description { get; set; }
+
+ ///
+ /// 备注
+ ///
+ [Description("备注")]
+ public string Remark { get; set; }
+
+ ///
+ /// 是否公共
+ ///
+ [Description("是否公共")]
+ public bool IsPublic { get; set; }
+
+ ///
+ /// 开始时间
+ ///
+ [Description("开始时间")]
+ public DateTime BgnDate { get; set; }
+
+ ///
+ /// 结束时间
+ ///
+ [Description("结束时间")]
+ public DateTime EndDate { get; set; }
+
+ }
+
+ ///
+ /// 查询
+ ///
+ public class FeeTemplatePageInput : PageInputBase
+ {
+
+ ///
+ /// 业务类型
+ ///
+ [Description("业务类型")]
+ public string OpType { get; set; }
+
+ ///
+ /// 收付类型(收、付)
+ ///
+ [Description("收付类型(收、付)")]
+ public string FeeType { get; set; }
+
+ ///
+ /// 费用模板名称
+ ///
+ [Description("费用模板名称")]
+ public string Name { get; set; }
+
+ }
+
+ ///
+ /// 台账列表
+ ///
+ public class FeeTemplatePageOutput : FeeTemplateDto
+ {
+
+ }
+
+ ///
+ /// 保存
+ ///
+ public class FeeTemplateSaveDto : FeeTemplateDto
+ {
+ ///
+ /// 明细
+ ///
+ public List Detail { get; set; }
+ }
+
+
+
+ ///
+ /// 费用模板明细dto
+ ///
+ public class FeeTemplateDetailDto
+ {
+ ///
+ /// ID
+ ///
+ public long Id { get; set; }
+
+ ///
+ /// 模板ID
+ ///
+ [Description("模板ID")]
+ public long TemplateID { get; set; }
+
+ ///
+ /// 费用名称;取【费用代码】 中的费用名称,录入是可以 通过过费用代码、费用名称检索
+ ///
+ [Description("费用名称;取【费用代码】 中的费用名称,录入是可以 通过过费用代码、费用名称检索")]
+ public string FeeName { get; set; }
+
+ ///
+ /// 费用对象;可以为空,为空时 录入费用按客户类型提取业务数据费用对象
+ ///
+ [Description("费用对象;可以为空,为空时 录入费用按客户类型提取业务数据费用对象")]
+ public string CustomerName { get; set; }
+
+ ///
+ /// 客户类别;可枚举维护、(船公司、委托单位、场站、车队等)
+ ///
+ [Description("客户类别;可枚举维护、(船公司、委托单位、场站、车队等)")]
+ public string CustType { get; set; }
+
+ ///
+ /// 费用标准;枚举维护加所有箱型
+ ///
+ [Description("费用标准;枚举维护加所有箱型")]
+ public string Unit { get; set; }
+
+ ///
+ /// 币别;可以录入汇率(数值)或选择按【汇率设置】中提取汇率
+ ///
+ [Description("币别;可以录入汇率(数值)或选择按【汇率设置】中提取汇率")]
+ public string Currency { get; set; }
+
+ ///
+ /// 单价
+ ///
+ [Description("单价")]
+ public decimal UnitPrice { get; set; }
+
+ ///
+ /// 备注
+ ///
+ [Description("备注")]
+ public string Remark { get; set; }
+
+ ///
+ /// 排序号
+ ///
+ [Description("排序号")]
+ public int Sort { get; set; }
+
+ ///
+ /// 收付类别(收、付)
+ ///
+ [Description("收付类别(收、付)")]
+ public string FeeType { get; set; }
+
+ ///
+ /// 汇率;可以选择 本公司中的 各分公司
+ ///
+ [Description("汇率;可以选择 本公司中的 各分公司")]
+ public decimal ExchangeRate { get; set; }
+
+ ///
+ /// 是否按箱型;如果选择了否,则假如前面标准选择了以 20GP为标准,则在调用时不管业务信息里有无20GP的箱子,都是以20GP为标准,有20GP的则调用其数量,没有20GP的,则生成一条标准为20GP数量为0的费用;如果选择了是,则只有当业务信息里有 20GP这种箱型时,才调用这条费用
+ ///
+ [Description("是否按箱型")]
+ public bool IsCtn { get; set; }
+
+ ///
+ /// 是否开票
+ ///
+ [Description("是否开票")]
+ public bool IsInvoice { get; set; }
+
+ ///
+ /// 是否垫付
+ ///
+ [Description("是否垫付")]
+ public bool IsAdvancedPay { get; set; }
+
+ ///
+ /// 费用FRT;PP,CC
+ ///
+ [Description("费用FRT;PP,CC")]
+ public string FeeFrt { get; set; }
+
+ ///
+ /// 税率;含税单价=单价*(1+(税率/100))录入单价或税率自动计算 含税单价
+ ///
+ [Description("税率;含税单价=单价*(1+(税率/100))录入单价或税率自动计算 含税单价")]
+ public decimal TaxRate { get; set; }
+
+ ///
+ /// 税额
+ ///
+ [Description("税额")]
+ public decimal Tax { get; set; }
+
+ ///
+ /// 核算单位
+ ///
+ [Description("核算单位")]
+ public string SaleCorp { get; set; }
+
+ ///
+ /// 含税单价
+ ///
+ [Description("含税单价")]
+ public decimal TaxUnitPrice { get; set; }
+
+ ///
+ /// 财务税率
+ ///
+ [Description("财务税率")]
+ public decimal AccTaxRate { get; set; }
+
+ ///
+ /// 费用英文名称;录入费用名称时,自动带出【费用代码】的 费用英文名称
+ ///
+ [Description("费用英文名称;录入费用名称时,自动带出【费用代码】的 费用英文名称")]
+ public string FeeDescription { get; set; }
+
+ ///
+ /// 费用分组;枚举中设置的 费用分组
+ ///
+ [Description("费用分组;枚举中设置的 费用分组")]
+ public string FeeGroup { get; set; }
+
+ }
+}
diff --git a/Myshipping.Application/Service/Fee/FeeCustTemplateService.cs b/Myshipping.Application/Service/Fee/FeeCustTemplateService.cs
index 3a352287..2387a700 100644
--- a/Myshipping.Application/Service/Fee/FeeCustTemplateService.cs
+++ b/Myshipping.Application/Service/Fee/FeeCustTemplateService.cs
@@ -19,7 +19,7 @@ namespace Myshipping.Application
///
/// 往来单位固定费用
///
- [ApiDescriptionSettings("Application", Name = "FeeTemplate", Order = 1)]
+ [ApiDescriptionSettings("Application", Name = "FeeCustTemplate", Order = 1)]
public class FeeCustTemplateService : IDynamicApiController, ITransient
{
private readonly SqlSugarRepository _repCustTemplete;
diff --git a/Myshipping.Application/Service/Fee/FeeTemplateService.cs b/Myshipping.Application/Service/Fee/FeeTemplateService.cs
new file mode 100644
index 00000000..deb0f005
--- /dev/null
+++ b/Myshipping.Application/Service/Fee/FeeTemplateService.cs
@@ -0,0 +1,154 @@
+using Furion;
+using Furion.DependencyInjection;
+using Furion.DynamicApiController;
+using Furion.EventBus;
+using Furion.FriendlyException;
+using Furion.LinqBuilder;
+using Mapster;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Logging;
+using Myshipping.Application.ConfigOption;
+using Myshipping.Application.Entity;
+using Myshipping.Application.Event;
+using Myshipping.Application.Service.BookingOrder.Dto;
+using Myshipping.Application.Service.BookingSlot.Dto;
+using Myshipping.Application.Service.Fee.Dto;
+using Myshipping.Core;
+using Myshipping.Core.Service;
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.IO;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+using Yitter.IdGenerator;
+
+
+namespace Myshipping.Application
+{
+ ///
+ /// 费用模板
+ ///
+ [ApiDescriptionSettings("Application", Name = "FeeTemplate", Order = 1)]
+ public class FeeTemplateService : IDynamicApiController, ITransient
+ {
+ private readonly SqlSugarRepository _repTemplate;
+ private readonly SqlSugarRepository _repTemplateDetail;
+
+ private readonly ILogger _logger;
+ private readonly ISysCacheService _cache;
+
+ private readonly IEventPublisher _publisher;
+
+ public FeeTemplateService(SqlSugarRepository repTemplate,
+ SqlSugarRepository repTemplateDetail,
+ ILogger logger,
+ ISysCacheService cache,
+ IEventPublisher publisher)
+ {
+ _repTemplate = repTemplate;
+ _repTemplateDetail = repTemplateDetail;
+
+ _logger = logger;
+ _cache = cache;
+
+ _publisher = publisher;
+ }
+
+ ///
+ /// 费用模板查询
+ ///
+ ///
+ ///
+ [HttpPost("/FeeTemplate/Page")]
+ public async Task Page(FeeTemplatePageInput input)
+ {
+ var entities = await _repTemplate.AsQueryable()
+ .WhereIF(!string.IsNullOrEmpty(input.OpType), u => u.OpType == input.OpType)
+ .WhereIF(!string.IsNullOrEmpty(input.FeeType), u => u.OpType == input.FeeType)
+ .WhereIF(!string.IsNullOrEmpty(input.Name), u => u.Name.Contains(input.Name))
+ .ToPagedListAsync(input.PageNo, input.PageSize);
+
+ var result = entities.Adapt>();
+
+ return result.XnPagedResult();
+ }
+
+ ///
+ /// 保存
+ ///
+ ///
+ ///
+ [HttpPost("/FeeTemplate/Save")]
+ public async Task Save(FeeTemplateSaveDto input)
+ {
+ if (input == null)
+ {
+ throw Oops.Bah("请传入正常数据!");
+ }
+
+ FeeTemplate entity = null;
+ if (input.Id == 0)
+ {
+ entity = input.Adapt();
+ entity.Id = YitIdHelper.NextId();
+ await _repTemplate.InsertAsync(entity);
+
+ }
+ else
+ {
+ entity = await _repTemplate.AsQueryable().Filter(null, true).FirstAsync(x => x.Id == input.Id);
+ entity = input.Adapt(entity);
+ await _repTemplate.UpdateAsync(entity);
+ }
+
+ await _repTemplateDetail.DeleteAsync(x => x.TemplateID == entity.Id);
+ foreach (var det in input.Detail)
+ {
+ var detail = det.Adapt();
+ detail.Id = YitIdHelper.NextId();
+ detail.TemplateID = entity.Id;
+ await _repTemplateDetail.InsertAsync(detail);
+ }
+
+
+ var rtn = entity.Adapt();
+ rtn.Detail = input.Detail;
+
+ return rtn;
+ }
+
+ ///
+ /// 获取详情
+ ///
+ ///
+ ///
+ [HttpGet("/FeeTemplate/Detail")]
+ public async Task Detail(long id)
+ {
+ var entity = await _repTemplate.AsQueryable().Filter(null, true).FirstAsync(x => x.Id == id);
+ var detailList = await _repTemplateDetail.AsQueryable().Where(x => x.TemplateID == id).ToListAsync();
+ var rtn = entity.Adapt();
+ rtn.Detail = detailList.Adapt>();
+ return rtn;
+ }
+
+
+ ///
+ /// 删除
+ ///
+ ///
+ ///
+ [HttpPost("/FeeTemplate/Delete")]
+ public async Task Delete(List ids)
+ {
+ var list = await _repTemplate.AsQueryable().Filter(null, true).Where(x => ids.Contains(x.Id)).ToListAsync();
+ list.ForEach(x => x.IsDeleted = true);
+ await _repTemplate.AsUpdateable(list).ExecuteCommandAsync();
+ }
+
+ }
+}