From 13ccd198d5dd19d5166eb7e0992a67d8f4492cea Mon Sep 17 00:00:00 2001
From: zzh <1368735060@qq.com>
Date: Thu, 25 Jun 2026 19:59:06 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=9B=E5=BB=BA=E8=AE=A2?=
=?UTF-8?q?=E5=8D=95=E6=8A=A5=E9=94=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Channels/ServiceChannelGroupSaveInput.cs | 4 +-
.../Customers/ResetCustomerPasswordInput.cs | 6 +-
.../Operations/CreateInboundRecordInput.cs | 6 +-
.../Operations/CreateOutboundRecordInput.cs | 4 +-
.../Dtos/Operations/PrintLabelInput.cs | 8 +-
.../Dtos/Orders/OrderActionInput.cs | 4 +-
.../Dtos/Orders/OrderParcelCreateInput.cs | 4 +-
.../Dtos/Orders/ProductBillingSnapshotDtos.cs | 30 +++++++
.../Dtos/Recharge/ApproveRechargeInput.cs | 4 +-
.../Dtos/Recharge/RejectRechargeInput.cs | 4 +-
.../Dtos/Recharge/SubmitRechargeFormInput.cs | 9 +++
.../Dtos/Recharge/SubmitRechargeInput.cs | 8 +-
src/Oms.Application/Dtos/Shared/IdInput.cs | 2 +-
.../Dtos/System/CreateWarehouseInput.cs | 16 ++--
.../Dtos/System/DictCreateInput.cs | 12 +--
.../Dtos/System/DictUpdateInput.cs | 2 +-
.../Dtos/System/NoticeCreateInput.cs | 14 ++--
.../Dtos/System/NoticeUpdateInput.cs | 2 +-
.../Dtos/System/UpdateWarehouseInput.cs | 18 ++---
src/Oms.Application/OmsApplicationModule.cs | 4 +
.../OmsApplicationAutoMapperProfile.cs | 6 ++
.../Services/Channels/AutoTriggerService.cs | 3 +
.../Services/Channels/KpiAreaService.cs | 3 +
.../Services/Channels/LabelTemplateService.cs | 3 +
.../Services/Channels/SalesProductService.cs | 3 +
.../Channels/ServiceChannelService.cs | 3 +
.../Channels/WeightRoundingService.cs | 3 +
.../Services/Channels/WeightRuleService.cs | 3 +
.../Services/Customers/CustomerService.cs | 3 +
.../Operations/InboundRecordService.cs | 3 +
.../Services/Operations/LabelPrintService.cs | 3 +
.../Operations/OutboundRecordService.cs | 3 +
.../Services/Orders/OrderService.Helpers.cs | 80 +++++++++++++++----
.../Orders/OrderService.ParcelBilling.cs | 28 ++++++-
.../Services/Orders/OrderService.cs | 55 ++++++++-----
.../Services/Orders/ParcelQuoteContext.cs | 2 +-
.../Services/Orders/ParcelQuoteResult.cs | 2 +-
.../Services/Recharge/RechargeService.cs | 5 ++
.../Services/System/CountryService.cs | 3 +
.../Services/System/DictService.cs | 3 +
.../Services/System/NoticeService.cs | 3 +
.../Services/System/WarehouseService.cs | 3 +
src/Oms.Application/Shared/OmsDocHelper.cs | 24 ++++++
.../Shared/OmsSessionHelper.cs | 8 +-
44 files changed, 316 insertions(+), 100 deletions(-)
diff --git a/src/Oms.Application/Dtos/Channels/ServiceChannelGroupSaveInput.cs b/src/Oms.Application/Dtos/Channels/ServiceChannelGroupSaveInput.cs
index 092d339..94b2a05 100644
--- a/src/Oms.Application/Dtos/Channels/ServiceChannelGroupSaveInput.cs
+++ b/src/Oms.Application/Dtos/Channels/ServiceChannelGroupSaveInput.cs
@@ -12,11 +12,11 @@ public class ServiceChannelGroupSaveInput
///
public int? Id { get; set; }
- [Required]
- [StringLength(128)]
///
/// 分组名称。
///
+ [Required]
+ [StringLength(128)]
public string Name { get; set; } = string.Empty;
///
diff --git a/src/Oms.Application/Dtos/Customers/ResetCustomerPasswordInput.cs b/src/Oms.Application/Dtos/Customers/ResetCustomerPasswordInput.cs
index a8239b4..11392ca 100644
--- a/src/Oms.Application/Dtos/Customers/ResetCustomerPasswordInput.cs
+++ b/src/Oms.Application/Dtos/Customers/ResetCustomerPasswordInput.cs
@@ -7,16 +7,16 @@ namespace Oms.Application.Dtos.Customers;
///
public class ResetCustomerPasswordInput
{
- [Required]
///
/// 主键。
///
+ [Required]
public int Id { get; set; }
- [Required]
- [StringLength(64)]
///
/// 新密码。
///
+ [Required]
+ [StringLength(64)]
public string NewPassword { get; set; } = string.Empty;
}
diff --git a/src/Oms.Application/Dtos/Operations/CreateInboundRecordInput.cs b/src/Oms.Application/Dtos/Operations/CreateInboundRecordInput.cs
index eb2d4ad..9895415 100644
--- a/src/Oms.Application/Dtos/Operations/CreateInboundRecordInput.cs
+++ b/src/Oms.Application/Dtos/Operations/CreateInboundRecordInput.cs
@@ -7,11 +7,11 @@ namespace Oms.Application.Dtos.Operations;
///
public class CreateInboundRecordInput
{
- [Required]
- [StringLength(64)]
///
/// 运单号。
///
+ [Required]
+ [StringLength(64)]
public string WaybillNo { get; set; } = string.Empty;
///
@@ -39,10 +39,10 @@ public class CreateInboundRecordInput
///
public int? SalesProductId { get; set; }
- [StringLength(8)]
///
/// 目的国家/地区。
///
+ [StringLength(8)]
public string? DestinationCountry { get; set; }
///
diff --git a/src/Oms.Application/Dtos/Operations/CreateOutboundRecordInput.cs b/src/Oms.Application/Dtos/Operations/CreateOutboundRecordInput.cs
index 35094ab..4b11c74 100644
--- a/src/Oms.Application/Dtos/Operations/CreateOutboundRecordInput.cs
+++ b/src/Oms.Application/Dtos/Operations/CreateOutboundRecordInput.cs
@@ -7,11 +7,11 @@ namespace Oms.Application.Dtos.Operations;
///
public class CreateOutboundRecordInput
{
- [Required]
- [StringLength(64)]
///
/// 运单号。
///
+ [Required]
+ [StringLength(64)]
public string WaybillNo { get; set; } = string.Empty;
///
diff --git a/src/Oms.Application/Dtos/Operations/PrintLabelInput.cs b/src/Oms.Application/Dtos/Operations/PrintLabelInput.cs
index 8888818..31f15be 100644
--- a/src/Oms.Application/Dtos/Operations/PrintLabelInput.cs
+++ b/src/Oms.Application/Dtos/Operations/PrintLabelInput.cs
@@ -7,23 +7,23 @@ namespace Oms.Application.Dtos.Operations;
///
public class PrintLabelInput
{
- [Required]
- [StringLength(64)]
///
/// 单号值。
///
+ [Required]
+ [StringLength(64)]
public string Number { get; set; } = string.Empty;
- [StringLength(64)]
///
/// 单号类型。
///
+ [StringLength(64)]
public string? NumberType { get; set; }
- [StringLength(64)]
///
/// 模板类型。
///
+ [StringLength(64)]
public string? TemplateType { get; set; }
///
diff --git a/src/Oms.Application/Dtos/Orders/OrderActionInput.cs b/src/Oms.Application/Dtos/Orders/OrderActionInput.cs
index 8d0831f..b44ae60 100644
--- a/src/Oms.Application/Dtos/Orders/OrderActionInput.cs
+++ b/src/Oms.Application/Dtos/Orders/OrderActionInput.cs
@@ -7,15 +7,15 @@ namespace Oms.Application.Dtos.Orders;
///
public class OrderActionInput
{
- [Required]
///
/// 主键。
///
+ [Required]
public int Id { get; set; }
- [StringLength(64)]
///
/// 请求标识。
///
+ [StringLength(64)]
public string? RequestId { get; set; }
}
diff --git a/src/Oms.Application/Dtos/Orders/OrderParcelCreateInput.cs b/src/Oms.Application/Dtos/Orders/OrderParcelCreateInput.cs
index 0ea130a..c2aafa2 100644
--- a/src/Oms.Application/Dtos/Orders/OrderParcelCreateInput.cs
+++ b/src/Oms.Application/Dtos/Orders/OrderParcelCreateInput.cs
@@ -16,12 +16,12 @@ public class OrderParcelCreateInput
public string? ClientNo { get; set; }
///
- /// 跟踪号。
+ /// 跟踪号(可选)。
///
public string? TrackNo { get; set; }
///
- /// 服务单号。
+ /// 服务单号(可选,不传时系统自动生成)。
///
public string? ServiceNo { get; set; }
diff --git a/src/Oms.Application/Dtos/Orders/ProductBillingSnapshotDtos.cs b/src/Oms.Application/Dtos/Orders/ProductBillingSnapshotDtos.cs
index 938dbf8..8fadcc1 100644
--- a/src/Oms.Application/Dtos/Orders/ProductBillingSnapshotDtos.cs
+++ b/src/Oms.Application/Dtos/Orders/ProductBillingSnapshotDtos.cs
@@ -7,8 +7,14 @@ namespace Oms.Application.Dtos.Orders;
///
public class SalesProductPricePublishSnapshotDto
{
+ ///
+ /// 销售产品主键。
+ ///
public int SalesProductId { get; set; }
+ ///
+ /// 价格项列表。
+ ///
public List Prices { get; set; } = [];
}
@@ -17,8 +23,14 @@ public class SalesProductPricePublishSnapshotDto
///
public class SalesProductRulesPublishSnapshotDto
{
+ ///
+ /// 产品基础信息。
+ ///
public SalesProductSaveInput? Product { get; set; }
+ ///
+ /// 分配的服务商列表。
+ ///
public List Providers { get; set; } = [];
}
@@ -27,15 +39,33 @@ public class SalesProductRulesPublishSnapshotDto
///
public class ProductSnapshotBinding
{
+ ///
+ /// 规则快照版本号。
+ ///
public string RulesVersion { get; set; } = string.Empty;
+ ///
+ /// 价格快照版本号。
+ ///
public string PriceVersion { get; set; } = string.Empty;
+ ///
+ /// 规则快照生效时间。
+ ///
public DateTime RulesEffectiveTime { get; set; }
+ ///
+ /// 价格快照生效时间。
+ ///
public DateTime PriceEffectiveTime { get; set; }
+ ///
+ /// 规则快照内容。
+ ///
public SalesProductRulesPublishSnapshotDto Rules { get; set; } = new();
+ ///
+ /// 价格快照内容。
+ ///
public SalesProductPricePublishSnapshotDto Price { get; set; } = new();
}
diff --git a/src/Oms.Application/Dtos/Recharge/ApproveRechargeInput.cs b/src/Oms.Application/Dtos/Recharge/ApproveRechargeInput.cs
index 6fd6def..fee2715 100644
--- a/src/Oms.Application/Dtos/Recharge/ApproveRechargeInput.cs
+++ b/src/Oms.Application/Dtos/Recharge/ApproveRechargeInput.cs
@@ -7,15 +7,15 @@ namespace Oms.Application.Dtos.Recharge;
///
public class ApproveRechargeInput
{
- [Required]
///
/// 主键。
///
+ [Required]
public int Id { get; set; }
- [StringLength(512)]
///
/// 备注。
///
+ [StringLength(512)]
public string? Remark { get; set; }
}
diff --git a/src/Oms.Application/Dtos/Recharge/RejectRechargeInput.cs b/src/Oms.Application/Dtos/Recharge/RejectRechargeInput.cs
index b79a1f9..8dec13d 100644
--- a/src/Oms.Application/Dtos/Recharge/RejectRechargeInput.cs
+++ b/src/Oms.Application/Dtos/Recharge/RejectRechargeInput.cs
@@ -7,15 +7,15 @@ namespace Oms.Application.Dtos.Recharge;
///
public class RejectRechargeInput
{
- [Required]
///
/// 主键。
///
+ [Required]
public int Id { get; set; }
- [StringLength(512)]
///
/// 备注。
///
+ [StringLength(512)]
public string? Remark { get; set; }
}
diff --git a/src/Oms.Application/Dtos/Recharge/SubmitRechargeFormInput.cs b/src/Oms.Application/Dtos/Recharge/SubmitRechargeFormInput.cs
index f9195a5..1ed6dd0 100644
--- a/src/Oms.Application/Dtos/Recharge/SubmitRechargeFormInput.cs
+++ b/src/Oms.Application/Dtos/Recharge/SubmitRechargeFormInput.cs
@@ -14,12 +14,21 @@ public class SubmitRechargeFormInput
///
public int? CustomerId { get; set; }
+ ///
+ /// 充值金额。
+ ///
[Range(typeof(decimal), "0.01", "999999999999")]
public decimal RechargeAmount { get; set; }
+ ///
+ /// 支付方式。
+ ///
[Required]
public PayType PayType { get; set; }
+ ///
+ /// 备注。
+ ///
[StringLength(512)]
public string? Remark { get; set; }
diff --git a/src/Oms.Application/Dtos/Recharge/SubmitRechargeInput.cs b/src/Oms.Application/Dtos/Recharge/SubmitRechargeInput.cs
index ca18506..d954575 100644
--- a/src/Oms.Application/Dtos/Recharge/SubmitRechargeInput.cs
+++ b/src/Oms.Application/Dtos/Recharge/SubmitRechargeInput.cs
@@ -13,27 +13,27 @@ public class SubmitRechargeInput
///
public int? CustomerId { get; set; }
- [Range(typeof(decimal), "0.01", "999999999999")]
///
/// 充值金额。
///
+ [Range(typeof(decimal), "0.01", "999999999999")]
public decimal RechargeAmount { get; set; }
- [Required]
///
/// 支付方式。
///
+ [Required]
public PayType PayType { get; set; }
- [StringLength(255)]
///
/// 充值截图。
///
+ [StringLength(255)]
public string? RechargeScreenshot { get; set; }
- [StringLength(512)]
///
/// 备注。
///
+ [StringLength(512)]
public string? Remark { get; set; }
}
diff --git a/src/Oms.Application/Dtos/Shared/IdInput.cs b/src/Oms.Application/Dtos/Shared/IdInput.cs
index 5ce2b58..8d08c91 100644
--- a/src/Oms.Application/Dtos/Shared/IdInput.cs
+++ b/src/Oms.Application/Dtos/Shared/IdInput.cs
@@ -7,9 +7,9 @@ namespace Oms.Application.Dtos.Shared;
///
public class IdInput
{
- [Required]
///
/// 主键。
///
+ [Required]
public int Id { get; set; }
}
diff --git a/src/Oms.Application/Dtos/System/CreateWarehouseInput.cs b/src/Oms.Application/Dtos/System/CreateWarehouseInput.cs
index 421cb86..31100c7 100644
--- a/src/Oms.Application/Dtos/System/CreateWarehouseInput.cs
+++ b/src/Oms.Application/Dtos/System/CreateWarehouseInput.cs
@@ -7,30 +7,30 @@ namespace Oms.Application.Dtos.System;
///
public class CreateWarehouseInput
{
- [Required]
- [StringLength(128)]
///
/// 仓库名称。
///
+ [Required]
+ [StringLength(128)]
public string WarehouseName { get; set; } = string.Empty;
- [Required]
- [StringLength(32)]
///
/// 仓库类型编码。
///
+ [Required]
+ [StringLength(32)]
public string WarehouseType { get; set; } = string.Empty;
- [StringLength(64)]
///
/// 收件人。
///
+ [StringLength(64)]
public string? Recipient { get; set; }
- [StringLength(32)]
///
/// 联系电话。
///
+ [StringLength(32)]
public string? ContactPhone { get; set; }
///
@@ -38,16 +38,16 @@ public class CreateWarehouseInput
///
public string? ShippingAddress { get; set; }
- [StringLength(32)]
///
/// 客服手机号。
///
+ [StringLength(32)]
public string? ServicePhone { get; set; }
- [StringLength(64)]
///
/// 客服微信号。
///
+ [StringLength(64)]
public string? ServiceWechat { get; set; }
///
diff --git a/src/Oms.Application/Dtos/System/DictCreateInput.cs b/src/Oms.Application/Dtos/System/DictCreateInput.cs
index c0a1325..ae67176 100644
--- a/src/Oms.Application/Dtos/System/DictCreateInput.cs
+++ b/src/Oms.Application/Dtos/System/DictCreateInput.cs
@@ -7,11 +7,11 @@ namespace Oms.Application.Dtos.System;
///
public class DictCreateInput
{
- [Required]
- [StringLength(64)]
///
/// 字典类型。
///
+ [Required]
+ [StringLength(64)]
public string DictType { get; set; } = string.Empty;
///
@@ -19,17 +19,17 @@ public class DictCreateInput
///
public int DictSort { get; set; }
- [Required]
- [StringLength(64)]
///
/// 字典编码。
///
+ [Required]
+ [StringLength(64)]
public string DictCode { get; set; } = string.Empty;
- [Required]
- [StringLength(128)]
///
/// 字典名称。
///
+ [Required]
+ [StringLength(128)]
public string DictName { get; set; } = string.Empty;
}
diff --git a/src/Oms.Application/Dtos/System/DictUpdateInput.cs b/src/Oms.Application/Dtos/System/DictUpdateInput.cs
index d80e6c2..9e1bd59 100644
--- a/src/Oms.Application/Dtos/System/DictUpdateInput.cs
+++ b/src/Oms.Application/Dtos/System/DictUpdateInput.cs
@@ -7,9 +7,9 @@ namespace Oms.Application.Dtos.System;
///
public class DictUpdateInput : DictCreateInput
{
- [Required]
///
/// 字典主键。
///
+ [Required]
public int Id { get; set; }
}
diff --git a/src/Oms.Application/Dtos/System/NoticeCreateInput.cs b/src/Oms.Application/Dtos/System/NoticeCreateInput.cs
index 6396275..f7b4503 100644
--- a/src/Oms.Application/Dtos/System/NoticeCreateInput.cs
+++ b/src/Oms.Application/Dtos/System/NoticeCreateInput.cs
@@ -7,24 +7,24 @@ namespace Oms.Application.Dtos.System;
///
public class NoticeCreateInput
{
- [Required]
- [StringLength(16)]
///
/// 通知类型:notice/message。
///
+ [Required]
+ [StringLength(16)]
public string NoticeType { get; set; } = string.Empty;
- [Required]
- [StringLength(128)]
///
/// 标题。
///
+ [Required]
+ [StringLength(128)]
public string Title { get; set; } = string.Empty;
- [Required]
///
/// 正文内容。
///
+ [Required]
public string Content { get; set; } = string.Empty;
///
@@ -32,11 +32,11 @@ public class NoticeCreateInput
///
public byte IsPopup { get; set; }
- [Required]
- [StringLength(16)]
///
/// 接收对象类型:user/customer。
///
+ [Required]
+ [StringLength(16)]
public string ReceiverType { get; set; } = string.Empty;
///
diff --git a/src/Oms.Application/Dtos/System/NoticeUpdateInput.cs b/src/Oms.Application/Dtos/System/NoticeUpdateInput.cs
index c61a77d..a1c48fb 100644
--- a/src/Oms.Application/Dtos/System/NoticeUpdateInput.cs
+++ b/src/Oms.Application/Dtos/System/NoticeUpdateInput.cs
@@ -7,9 +7,9 @@ namespace Oms.Application.Dtos.System;
///
public class NoticeUpdateInput : NoticeCreateInput
{
- [Required]
///
/// 通知主键。
///
+ [Required]
public int Id { get; set; }
}
diff --git a/src/Oms.Application/Dtos/System/UpdateWarehouseInput.cs b/src/Oms.Application/Dtos/System/UpdateWarehouseInput.cs
index 6718b10..261e6e2 100644
--- a/src/Oms.Application/Dtos/System/UpdateWarehouseInput.cs
+++ b/src/Oms.Application/Dtos/System/UpdateWarehouseInput.cs
@@ -7,36 +7,36 @@ namespace Oms.Application.Dtos.System;
///
public class UpdateWarehouseInput
{
- [Required]
///
/// 主键。
///
+ [Required]
public int Id { get; set; }
- [Required]
- [StringLength(128)]
///
/// 仓库名称。
///
+ [Required]
+ [StringLength(128)]
public string WarehouseName { get; set; } = string.Empty;
- [Required]
- [StringLength(32)]
///
/// 仓库类型编码。
///
+ [Required]
+ [StringLength(32)]
public string WarehouseType { get; set; } = string.Empty;
- [StringLength(64)]
///
/// 收件人。
///
+ [StringLength(64)]
public string? Recipient { get; set; }
- [StringLength(32)]
///
/// 联系电话。
///
+ [StringLength(32)]
public string? ContactPhone { get; set; }
///
@@ -44,16 +44,16 @@ public class UpdateWarehouseInput
///
public string? ShippingAddress { get; set; }
- [StringLength(32)]
///
/// 客服手机号。
///
+ [StringLength(32)]
public string? ServicePhone { get; set; }
- [StringLength(64)]
///
/// 客服微信号。
///
+ [StringLength(64)]
public string? ServiceWechat { get; set; }
///
diff --git a/src/Oms.Application/OmsApplicationModule.cs b/src/Oms.Application/OmsApplicationModule.cs
index 154e817..631b9e4 100644
--- a/src/Oms.Application/OmsApplicationModule.cs
+++ b/src/Oms.Application/OmsApplicationModule.cs
@@ -5,12 +5,16 @@ using Oms.Domain;
namespace Oms.Application;
+///
+/// OMS 应用层模块注册。
+///
[DependsOn(
typeof(OmsDomainModule),
typeof(FakeObjectMappingAutoMapperModule)
)]
public class OmsApplicationModule : FakeModule
{
+ ///
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.Configure(options =>
diff --git a/src/Oms.Application/Profiles/OmsApplicationAutoMapperProfile.cs b/src/Oms.Application/Profiles/OmsApplicationAutoMapperProfile.cs
index 95dadfc..c234007 100644
--- a/src/Oms.Application/Profiles/OmsApplicationAutoMapperProfile.cs
+++ b/src/Oms.Application/Profiles/OmsApplicationAutoMapperProfile.cs
@@ -14,8 +14,14 @@ using Oms.Domain.SystemAggregate.Entities;
namespace Oms.Application.Profiles;
+///
+/// OMS 应用层 AutoMapper 映射配置。
+///
public class OmsApplicationAutoMapperProfile : Profile
{
+ ///
+ /// 注册实体与 DTO 之间的映射关系。
+ ///
public OmsApplicationAutoMapperProfile()
{
CreateMap();
diff --git a/src/Oms.Application/Services/Channels/AutoTriggerService.cs b/src/Oms.Application/Services/Channels/AutoTriggerService.cs
index d7d5491..7d7c359 100644
--- a/src/Oms.Application/Services/Channels/AutoTriggerService.cs
+++ b/src/Oms.Application/Services/Channels/AutoTriggerService.cs
@@ -9,6 +9,9 @@ using Oms.Domain.ChannelsAggregate.Repositories;
namespace Oms.Application.Services.Channels;
+///
+/// 自动触发规则 API 服务。
+///
[ApiExplorerSettings(GroupName = "OMS-Channel")]
public class AutoTriggerService : ApplicationService
{
diff --git a/src/Oms.Application/Services/Channels/KpiAreaService.cs b/src/Oms.Application/Services/Channels/KpiAreaService.cs
index 5f288c6..5138bc8 100644
--- a/src/Oms.Application/Services/Channels/KpiAreaService.cs
+++ b/src/Oms.Application/Services/Channels/KpiAreaService.cs
@@ -9,6 +9,9 @@ using Oms.Domain.ChannelsAggregate.Repositories;
namespace Oms.Application.Services.Channels;
+///
+/// KPI 分区 API 服务。
+///
[ApiExplorerSettings(GroupName = "OMS-Channel")]
public class KpiAreaService : ApplicationService
{
diff --git a/src/Oms.Application/Services/Channels/LabelTemplateService.cs b/src/Oms.Application/Services/Channels/LabelTemplateService.cs
index befee40..71250b7 100644
--- a/src/Oms.Application/Services/Channels/LabelTemplateService.cs
+++ b/src/Oms.Application/Services/Channels/LabelTemplateService.cs
@@ -7,6 +7,9 @@ using Oms.Domain.ChannelsAggregate.Repositories;
namespace Oms.Application.Services.Channels;
+///
+/// 面单模板 API 服务。
+///
[ApiExplorerSettings(GroupName = "OMS-Channel")]
public class LabelTemplateService : ApplicationService
{
diff --git a/src/Oms.Application/Services/Channels/SalesProductService.cs b/src/Oms.Application/Services/Channels/SalesProductService.cs
index ebebbfe..807dd09 100644
--- a/src/Oms.Application/Services/Channels/SalesProductService.cs
+++ b/src/Oms.Application/Services/Channels/SalesProductService.cs
@@ -9,6 +9,9 @@ using Oms.Domain.ChannelsAggregate.Repositories;
namespace Oms.Application.Services.Channels;
+///
+/// 销售产品 API 服务。
+///
[ApiExplorerSettings(GroupName = "OMS-Channel")]
public partial class SalesProductService : ApplicationService
{
diff --git a/src/Oms.Application/Services/Channels/ServiceChannelService.cs b/src/Oms.Application/Services/Channels/ServiceChannelService.cs
index 410ed8d..9a97747 100644
--- a/src/Oms.Application/Services/Channels/ServiceChannelService.cs
+++ b/src/Oms.Application/Services/Channels/ServiceChannelService.cs
@@ -9,6 +9,9 @@ using Oms.Domain.ChannelsAggregate.Repositories;
namespace Oms.Application.Services.Channels;
+///
+/// 服务渠道 API 服务。
+///
[ApiExplorerSettings(GroupName = "OMS-Channel")]
public partial class ServiceChannelService : ApplicationService
{
diff --git a/src/Oms.Application/Services/Channels/WeightRoundingService.cs b/src/Oms.Application/Services/Channels/WeightRoundingService.cs
index b81cccf..6adc81e 100644
--- a/src/Oms.Application/Services/Channels/WeightRoundingService.cs
+++ b/src/Oms.Application/Services/Channels/WeightRoundingService.cs
@@ -9,6 +9,9 @@ using Oms.Domain.ChannelsAggregate.Repositories;
namespace Oms.Application.Services.Channels;
+///
+/// 重量进位 API 服务。
+///
[ApiExplorerSettings(GroupName = "OMS-Channel")]
public class WeightRoundingService : ApplicationService
{
diff --git a/src/Oms.Application/Services/Channels/WeightRuleService.cs b/src/Oms.Application/Services/Channels/WeightRuleService.cs
index 0f8453c..cbe93f5 100644
--- a/src/Oms.Application/Services/Channels/WeightRuleService.cs
+++ b/src/Oms.Application/Services/Channels/WeightRuleService.cs
@@ -9,6 +9,9 @@ using Oms.Domain.ChannelsAggregate.Repositories;
namespace Oms.Application.Services.Channels;
+///
+/// 重量规则 API 服务。
+///
[ApiExplorerSettings(GroupName = "OMS-Channel")]
public class WeightRuleService : ApplicationService
{
diff --git a/src/Oms.Application/Services/Customers/CustomerService.cs b/src/Oms.Application/Services/Customers/CustomerService.cs
index ffb35da..fc948e4 100644
--- a/src/Oms.Application/Services/Customers/CustomerService.cs
+++ b/src/Oms.Application/Services/Customers/CustomerService.cs
@@ -16,6 +16,9 @@ using Oms.Domain.CustomersAggregate.Repositories;
namespace Oms.Application.Services.Customers;
+///
+/// 客户 API 服务。
+///
[ApiExplorerSettings(GroupName = "OMS-Customer")]
public class CustomerService : ApplicationService
{
diff --git a/src/Oms.Application/Services/Operations/InboundRecordService.cs b/src/Oms.Application/Services/Operations/InboundRecordService.cs
index ae95deb..ca15f83 100644
--- a/src/Oms.Application/Services/Operations/InboundRecordService.cs
+++ b/src/Oms.Application/Services/Operations/InboundRecordService.cs
@@ -9,6 +9,9 @@ using Oms.Domain.SystemAggregate.Repositories;
namespace Oms.Application.Services.Operations;
+///
+/// 入库记录 API 服务。
+///
[ApiExplorerSettings(GroupName = "OMS-Operation")]
public class InboundRecordService : ApplicationService
{
diff --git a/src/Oms.Application/Services/Operations/LabelPrintService.cs b/src/Oms.Application/Services/Operations/LabelPrintService.cs
index 3b89b7a..4f0fdd3 100644
--- a/src/Oms.Application/Services/Operations/LabelPrintService.cs
+++ b/src/Oms.Application/Services/Operations/LabelPrintService.cs
@@ -10,6 +10,9 @@ using Oms.Domain.Shared.Enums;
namespace Oms.Application.Services.Operations;
+///
+/// 面单打印 API 服务。
+///
[ApiExplorerSettings(GroupName = "OMS-Operation")]
public class LabelPrintService : ApplicationService
{
diff --git a/src/Oms.Application/Services/Operations/OutboundRecordService.cs b/src/Oms.Application/Services/Operations/OutboundRecordService.cs
index 5054c77..4393969 100644
--- a/src/Oms.Application/Services/Operations/OutboundRecordService.cs
+++ b/src/Oms.Application/Services/Operations/OutboundRecordService.cs
@@ -8,6 +8,9 @@ using Oms.Domain.SystemAggregate.Repositories;
namespace Oms.Application.Services.Operations;
+///
+/// 出库记录 API 服务。
+///
[ApiExplorerSettings(GroupName = "OMS-Operation")]
public class OutboundRecordService : ApplicationService
{
diff --git a/src/Oms.Application/Services/Orders/OrderService.Helpers.cs b/src/Oms.Application/Services/Orders/OrderService.Helpers.cs
index 325b7ad..3b53e29 100644
--- a/src/Oms.Application/Services/Orders/OrderService.Helpers.cs
+++ b/src/Oms.Application/Services/Orders/OrderService.Helpers.cs
@@ -116,9 +116,16 @@ public partial class OrderService
var page = OmsDocHelper.NormalizePage(input.Page);
var pageSize = OmsDocHelper.NormalizePageSize(input.PageSize);
var keyword = input.Keyword?.Trim();
+ var customerId = await OmsSessionHelper.ResolveListCustomerIdAsync(
+ CustomerRepository,
+ CurrentUser,
+ null);
+ var hasCustomerFilter = customerId.HasValue;
+ var customerIdValue = customerId.GetValueOrDefault();
var predicate = (Expression>)(x =>
(string.IsNullOrWhiteSpace(input.Type) || x.Type == input.Type) &&
- (string.IsNullOrWhiteSpace(keyword) || x.Name.Contains(keyword) || (x.TemplateKey ?? string.Empty).Contains(keyword)));
+ (string.IsNullOrWhiteSpace(keyword) || x.Name.Contains(keyword) || (x.TemplateKey ?? string.Empty).Contains(keyword)) &&
+ (!hasCustomerFilter || x.Type == "standard" || x.CustomerId == customerIdValue));
var templates = await OrderTemplateRepository.GetPagedListAsync(
predicate,
@@ -151,6 +158,15 @@ public partial class OrderService
throw new BusinessException("模板不存在");
}
+ var customerId = await OmsSessionHelper.ResolveListCustomerIdAsync(
+ CustomerRepository,
+ CurrentUser,
+ null);
+ if (customerId.HasValue)
+ {
+ EnsureTemplateAccessible(template, customerId.Value);
+ }
+
var rows = new[]
{
new Dictionary
@@ -162,7 +178,7 @@ public partial class OrderService
["ChannelCode"] = "",
["CargoAttribute"] = CargoAttributeCodes.General,
["WarehouseId"] = "",
- ["CustomerId"] = template.CustomerId,
+ ["CustomerId"] = customerId ?? template.CustomerId,
["Length"] = "",
["Width"] = "",
["Height"] = "",
@@ -202,6 +218,9 @@ public partial class OrderService
throw new BusinessException("模板不存在");
}
+ var effectiveCustomer = await ResolveEffectiveCustomerAsync();
+ EnsureTemplateAccessible(template, effectiveCustomer.Id);
+
var task = await OrderTaskRepository.InsertAsync(new OrderTask
{
TaskName = $"批量下单_{DateTime.Now:yyyyMMddHHmmss}",
@@ -210,7 +229,7 @@ public partial class OrderService
FailCount = 0,
Status = "processing",
TemplateId = template.Id,
- CustomerId = template.CustomerId
+ CustomerId = effectiveCustomer.Id
});
var quantity = 0;
@@ -233,7 +252,7 @@ public partial class OrderService
try
{
- await CreateImportOrderAsync(rowDict, template);
+ await CreateImportOrderAsync(rowDict, effectiveCustomer.Id);
successCount++;
}
catch (Exception ex)
@@ -256,29 +275,29 @@ public partial class OrderService
return new OrderUploadOutput { TaskId = task.Id };
}
- private async Task CreateImportOrderAsync(IDictionary rowDict, OrderTemplate template)
+ private async Task CreateImportOrderAsync(IDictionary rowDict, int effectiveCustomerId)
{
- var serviceNo = GetStringCell(rowDict, "ServiceNo");
- if (string.IsNullOrWhiteSpace(serviceNo))
+ var rowCustomerId = GetIntCell(rowDict, "CustomerId");
+ if (rowCustomerId is > 0 && rowCustomerId.Value != effectiveCustomerId)
{
- throw new BusinessException("ServiceNo不能为空");
+ throw new BusinessException("客户ID非法");
}
- if (await OrderRepository.HasServiceNoAsync(serviceNo))
- {
- throw new BusinessException("ServiceNo已存在");
- }
+ var serviceNo = GetStringCell(rowDict, "ServiceNo");
+ var resolvedServiceNo = await ResolveServiceNoAsync(serviceNo);
var order = await OrderRepository.InsertAsync(new Order
{
- ServiceNo = serviceNo,
+ ServiceNo = resolvedServiceNo,
ClientNo = GetStringCell(rowDict, "ClientNo"),
- TrackNo = GetStringCell(rowDict, "TrackNo"),
+ TrackNo = string.IsNullOrWhiteSpace(GetStringCell(rowDict, "TrackNo"))
+ ? null
+ : GetStringCell(rowDict, "TrackNo"),
ProductCode = GetStringCell(rowDict, "ProductCode"),
ChannelCode = GetStringCell(rowDict, "ChannelCode"),
CargoAttribute = GetStringCell(rowDict, "CargoAttribute") ?? CargoAttributeCodes.General,
WarehouseId = GetIntCell(rowDict, "WarehouseId"),
- CustomerId = GetIntCell(rowDict, "CustomerId") ?? template.CustomerId,
+ CustomerId = effectiveCustomerId,
CodCurrency = GetStringCell(rowDict, "CodCurrency"),
CodSum = GetDecimalCell(rowDict, "CodSum"),
DeclaredCurrency = GetStringCell(rowDict, "DeclaredCurrency"),
@@ -302,9 +321,16 @@ public partial class OrderService
var page = OmsDocHelper.NormalizePage(input.Page);
var pageSize = OmsDocHelper.NormalizePageSize(input.PageSize);
var keyword = input.Keyword?.Trim();
+ var customerId = await OmsSessionHelper.ResolveListCustomerIdAsync(
+ CustomerRepository,
+ CurrentUser,
+ null);
+ var hasCustomerFilter = customerId.HasValue;
+ var customerIdValue = customerId.GetValueOrDefault();
var predicate = (Expression>)(x =>
(string.IsNullOrWhiteSpace(input.Status) || x.Status == input.Status) &&
- (string.IsNullOrWhiteSpace(keyword) || x.TaskName.Contains(keyword)));
+ (string.IsNullOrWhiteSpace(keyword) || x.TaskName.Contains(keyword)) &&
+ (!hasCustomerFilter || x.CustomerId == customerIdValue));
var tasks = await OrderTaskRepository.GetPagedListAsync(
predicate,
page,
@@ -336,6 +362,15 @@ public partial class OrderService
throw new BusinessException("任务不存在");
}
+ var customerId = await OmsSessionHelper.ResolveListCustomerIdAsync(
+ CustomerRepository,
+ CurrentUser,
+ null);
+ if (customerId.HasValue && task.CustomerId != customerId.Value)
+ {
+ throw new BusinessException("任务不存在");
+ }
+
var failList = await OrderTaskRepository.GetFailListAsync(task.Id);
return new OrderTaskDetailOutput
{
@@ -527,6 +562,19 @@ public partial class OrderService
private static decimal? GetDecimalCell(IDictionary row, string key) => decimal.TryParse(GetStringCell(row, key), out var value) ? value : null;
private static bool GetBoolCell(IDictionary row, string key) => GetStringCell(row, key) is "1" or "true" or "True" or "TRUE" or "是";
+ private static void EnsureTemplateAccessible(OrderTemplate template, int effectiveCustomerId)
+ {
+ if (string.Equals(template.Type, "standard", StringComparison.OrdinalIgnoreCase))
+ {
+ return;
+ }
+
+ if (template.CustomerId != effectiveCustomerId)
+ {
+ throw new BusinessException("模板不存在");
+ }
+ }
+
private OrderWeight? BuildForecastWeight(int orderId, IDictionary row)
{
var length = GetDecimalCell(row, "Length");
diff --git a/src/Oms.Application/Services/Orders/OrderService.ParcelBilling.cs b/src/Oms.Application/Services/Orders/OrderService.ParcelBilling.cs
index 02b1e42..95127ed 100644
--- a/src/Oms.Application/Services/Orders/OrderService.ParcelBilling.cs
+++ b/src/Oms.Application/Services/Orders/OrderService.ParcelBilling.cs
@@ -38,6 +38,11 @@ public partial class OrderService
}
var bindTime = DateTime.Now;
+ NormalizeParcelCreateInput(input);
+
+ var sessionCustomer = await ResolveEffectiveCustomerAsync(input.CustomerId);
+ input.CustomerId = sessionCustomer.Id;
+
await ValidateParcelCreateInputAsync(input);
var product = await SalesProductRepository.GetByProductCodeAsync(input.ProductCode!.Trim());
@@ -135,6 +140,14 @@ public partial class OrderService
}
}
+ private static void NormalizeParcelCreateInput(OrderParcelCreateInput input)
+ {
+ input.TrackNo = string.IsNullOrWhiteSpace(input.TrackNo) ? null : input.TrackNo.Trim();
+ input.ServiceNo = string.IsNullOrWhiteSpace(input.ServiceNo) ? null : input.ServiceNo.Trim();
+ input.ClientNo = string.IsNullOrWhiteSpace(input.ClientNo) ? null : input.ClientNo.Trim();
+ input.RequestId = string.IsNullOrWhiteSpace(input.RequestId) ? null : input.RequestId.Trim();
+ }
+
private async Task ValidateParcelCreateInputAsync(OrderParcelCreateInput input)
{
if (string.IsNullOrWhiteSpace(input.ProductCode))
@@ -275,9 +288,9 @@ public partial class OrderService
};
}
- private async Task BuildLiveRulesSnapshotAsync(SalesProduct product)
+ private Task BuildLiveRulesSnapshotAsync(SalesProduct product)
{
- return new SalesProductRulesPublishSnapshotDto
+ return Task.FromResult(new SalesProductRulesPublishSnapshotDto
{
Product = new SalesProductSaveInput
{
@@ -292,7 +305,7 @@ public partial class OrderService
IsActive = product.IsActive,
Scheme = product.Scheme
}
- };
+ });
}
private async Task BuildLivePriceSnapshotAsync(SalesProduct product)
@@ -696,4 +709,13 @@ public partial class OrderService
: string.Empty
};
}
+
+ ///
+ /// 从会话解析有效客户(客户登录自动补全;管理员须传 customerId)。
+ ///
+ private Task ResolveEffectiveCustomerAsync(int? requestedCustomerId = null) =>
+ OmsSessionHelper.ResolveSessionCustomerAsync(
+ CustomerRepository,
+ CurrentUser,
+ requestedCustomerId);
}
diff --git a/src/Oms.Application/Services/Orders/OrderService.cs b/src/Oms.Application/Services/Orders/OrderService.cs
index d306110..76a5328 100644
--- a/src/Oms.Application/Services/Orders/OrderService.cs
+++ b/src/Oms.Application/Services/Orders/OrderService.cs
@@ -15,6 +15,9 @@ using Oms.Domain.SystemAggregate.Repositories;
namespace Oms.Application.Services.Orders;
+///
+/// 订单相关 API 服务。
+///
[ApiExplorerSettings(GroupName = "OMS-Order")]
public partial class OrderService : ApplicationService
{
@@ -39,7 +42,11 @@ public partial class OrderService : ApplicationService
[HttpPost("/order/list")]
public async Task> GetPaginatedListAsync(OrderPaginatedInput input)
{
- var predicate = BuildPaginatedPredicate(input);
+ var customerId = await OmsSessionHelper.ResolveListCustomerIdAsync(
+ CustomerRepository,
+ CurrentUser,
+ null);
+ var predicate = BuildPaginatedPredicate(input, customerId);
var pageIndex = OmsDocHelper.NormalizePage(input.Page);
var pageSize = OmsDocHelper.NormalizePageSize(input.PageSize);
var orders = await OrderRepository.GetPagedListAsync(
@@ -200,8 +207,12 @@ public partial class OrderService : ApplicationService
public async Task ExportAsync(OrderExportInput input)
{
await CleanupExpiredFilesAsync(GetOrderExportDirectory());
+ var customerId = await OmsSessionHelper.ResolveListCustomerIdAsync(
+ CustomerRepository,
+ CurrentUser,
+ null);
var orders = await OrderRepository.GetListAsync(
- BuildExportPredicate(input),
+ BuildExportPredicate(input, customerId),
new Dictionary { [nameof(Order.CreateTime)] = false, [nameof(Order.Id)] = false });
var fileName = $"orders-{DateTime.Now:yyyyMMddHHmmss}.xlsx";
var directory = GetOrderExportDirectory();
@@ -410,30 +421,32 @@ public partial class OrderService : ApplicationService
/// 将订单列表请求对象转换为仓储可执行的查询表达式。
///
/// 入参:分页查询条件对象。
+ /// 入参:会话客户 ID,空值表示不按客户隔离。
/// 出参:订单查询表达式。
- private Expression> BuildPaginatedPredicate(OrderPaginatedInput input)
+ private Expression> BuildPaginatedPredicate(OrderPaginatedInput input, int? customerId)
{
return BuildOrderPredicate(
input.Status,
input.Keyword,
input.CreateTimeStart,
input.CreateTimeEnd,
- OmsSessionHelper.TryGetCustomerCreateUserId(CurrentUser));
+ customerId);
}
///
/// 将订单导出请求对象转换为仓储可执行的查询表达式。
///
/// 入参:导出筛选条件对象。
+ /// 入参:会话客户 ID,空值表示不按客户隔离。
/// 出参:订单查询表达式。
- private Expression> BuildExportPredicate(OrderExportInput input)
+ private Expression> BuildExportPredicate(OrderExportInput input, int? customerId)
{
return BuildOrderPredicate(
input.Status,
input.Keyword,
input.CreateTimeStart,
input.CreateTimeEnd,
- OmsSessionHelper.TryGetCustomerCreateUserId(CurrentUser));
+ customerId);
}
///
@@ -443,6 +456,7 @@ public partial class OrderService : ApplicationService
/// 入参:关键词,可匹配运单号、客户单号、跟踪号。
/// 入参:创建时间开始值。
/// 入参:创建时间结束值。
+ /// 入参:客户主键,空值表示不按客户隔离。
/// 出参:可直接交给 SqlSugar 仓储执行的订单筛选表达式。
///
/// 核心业务逻辑:
@@ -456,14 +470,14 @@ public partial class OrderService : ApplicationService
string? keyword,
DateTime? createTimeStart,
DateTime? createTimeEnd,
- int? createUserId = null)
+ int? customerId = null)
{
status = status?.Trim();
keyword = keyword?.Trim();
var hasStatusFilter = !string.IsNullOrWhiteSpace(status) && status != "all";
var hasKeywordFilter = !string.IsNullOrWhiteSpace(keyword);
- var hasCreateUserFilter = createUserId.HasValue;
- var createUserIdValue = createUserId.GetValueOrDefault();
+ var hasCustomerFilter = customerId.HasValue;
+ var customerIdValue = customerId.GetValueOrDefault();
// 显式拆开时间分支,避免 SqlSugar 在翻译 Nullable 判空时生成异常 SQL。
if (createTimeStart.HasValue && createTimeEnd.HasValue)
@@ -471,7 +485,7 @@ public partial class OrderService : ApplicationService
var start = createTimeStart.Value;
var end = createTimeEnd.Value;
return order =>
- (!hasCreateUserFilter || order.CreateUserId == createUserIdValue) &&
+ (!hasCustomerFilter || order.CustomerId == customerIdValue) &&
(!hasStatusFilter || order.OrderStatus == status) &&
(!hasKeywordFilter ||
order.ServiceNo.Contains(keyword!) ||
@@ -485,7 +499,7 @@ public partial class OrderService : ApplicationService
{
var start = createTimeStart.Value;
return order =>
- (!hasCreateUserFilter || order.CreateUserId == createUserIdValue) &&
+ (!hasCustomerFilter || order.CustomerId == customerIdValue) &&
(!hasStatusFilter || order.OrderStatus == status) &&
(!hasKeywordFilter ||
order.ServiceNo.Contains(keyword!) ||
@@ -498,7 +512,7 @@ public partial class OrderService : ApplicationService
{
var end = createTimeEnd.Value;
return order =>
- (!hasCreateUserFilter || order.CreateUserId == createUserIdValue) &&
+ (!hasCustomerFilter || order.CustomerId == customerIdValue) &&
(!hasStatusFilter || order.OrderStatus == status) &&
(!hasKeywordFilter ||
order.ServiceNo.Contains(keyword!) ||
@@ -508,7 +522,7 @@ public partial class OrderService : ApplicationService
}
return order =>
- (!hasCreateUserFilter || order.CreateUserId == createUserIdValue) &&
+ (!hasCustomerFilter || order.CustomerId == customerIdValue) &&
(!hasStatusFilter || order.OrderStatus == status) &&
(!hasKeywordFilter ||
order.ServiceNo.Contains(keyword!) ||
@@ -516,17 +530,20 @@ public partial class OrderService : ApplicationService
(order.TrackNo ?? string.Empty).Contains(keyword!));
}
- private void EnsureCustomerCanAccessOrder(Order order)
+ private async Task EnsureCustomerCanAccessOrderAsync(Order order)
{
- var createUserId = OmsSessionHelper.TryGetCustomerCreateUserId(CurrentUser);
- if (createUserId is null)
+ var customerId = await OmsSessionHelper.ResolveListCustomerIdAsync(
+ CustomerRepository,
+ CurrentUser,
+ null);
+ if (!customerId.HasValue)
{
return;
}
- if (order.CreateUserId != createUserId.Value)
+ if (order.CustomerId != customerId.Value)
{
- throw new BusinessException("无权访问该订单");
+ throw new BusinessException("订单不存在");
}
}
@@ -538,7 +555,7 @@ public partial class OrderService : ApplicationService
throw new BusinessException("订单不存在");
}
- EnsureCustomerCanAccessOrder(entity);
+ await EnsureCustomerCanAccessOrderAsync(entity);
return entity;
}
diff --git a/src/Oms.Application/Services/Orders/ParcelQuoteContext.cs b/src/Oms.Application/Services/Orders/ParcelQuoteContext.cs
index 6f9d410..4c8ea33 100644
--- a/src/Oms.Application/Services/Orders/ParcelQuoteContext.cs
+++ b/src/Oms.Application/Services/Orders/ParcelQuoteContext.cs
@@ -3,7 +3,7 @@ namespace Oms.Application.Services.Orders;
///
/// 查价/试算用的地址与件重尺上下文(不落库)。
///
-public sealed class ParcelQuoteContext
+internal sealed class ParcelQuoteContext
{
public string CountryCode { get; init; } = string.Empty;
diff --git a/src/Oms.Application/Services/Orders/ParcelQuoteResult.cs b/src/Oms.Application/Services/Orders/ParcelQuoteResult.cs
index 1624c5c..5402a5f 100644
--- a/src/Oms.Application/Services/Orders/ParcelQuoteResult.cs
+++ b/src/Oms.Application/Services/Orders/ParcelQuoteResult.cs
@@ -5,7 +5,7 @@ namespace Oms.Application.Services.Orders;
///
/// 单产品销售产品试算结果(与 parcel/create 预报计费同源)。
///
-public sealed class ParcelQuoteResult
+internal sealed class ParcelQuoteResult
{
public int ProductId { get; init; }
diff --git a/src/Oms.Application/Services/Recharge/RechargeService.cs b/src/Oms.Application/Services/Recharge/RechargeService.cs
index a3769f8..bba5176 100644
--- a/src/Oms.Application/Services/Recharge/RechargeService.cs
+++ b/src/Oms.Application/Services/Recharge/RechargeService.cs
@@ -14,6 +14,9 @@ using Oms.Domain.RechargeAggregate.Repositories;
namespace Oms.Application.Services.Recharge;
+///
+/// 充值相关 API 服务。
+///
[ApiExplorerSettings(GroupName = "OMS-Recharge")]
public class RechargeService : ApplicationService
{
@@ -245,6 +248,7 @@ public class RechargeService : ApplicationService
/// 将充值分页请求对象转换为仓储可执行的查询表达式。
///
/// 入参:充值分页查询条件对象。
+ /// 入参:客户 ID,空值表示不过滤。
/// 出参:充值记录查询表达式。
private Expression> BuildPaginatedPredicate(
RechargeRecordPaginatedInput input,
@@ -304,6 +308,7 @@ public class RechargeService : ApplicationService
/// 将充值导出请求对象转换为仓储可执行的查询表达式。
///
/// 入参:充值导出筛选条件对象。
+ /// 入参:客户 ID,空值表示不过滤。
/// 出参:充值记录查询表达式。
private Expression> BuildExportPredicate(RechargeExportInput input, int? customerId)
{
diff --git a/src/Oms.Application/Services/System/CountryService.cs b/src/Oms.Application/Services/System/CountryService.cs
index 3f465cd..8174c0e 100644
--- a/src/Oms.Application/Services/System/CountryService.cs
+++ b/src/Oms.Application/Services/System/CountryService.cs
@@ -5,6 +5,9 @@ using Oms.Domain.SystemAggregate.Repositories;
namespace Oms.Application.Services.System;
+///
+/// 国家 API 服务。
+///
[ApiExplorerSettings(GroupName = "OMS-System")]
public class CountryService : ApplicationService
{
diff --git a/src/Oms.Application/Services/System/DictService.cs b/src/Oms.Application/Services/System/DictService.cs
index 9fc63b7..c9be9cb 100644
--- a/src/Oms.Application/Services/System/DictService.cs
+++ b/src/Oms.Application/Services/System/DictService.cs
@@ -9,6 +9,9 @@ using Oms.Domain.SystemAggregate.Repositories;
namespace Oms.Application.Services.System;
+///
+/// 字典 API 服务。
+///
[ApiExplorerSettings(GroupName = "OMS-System")]
public class DictService : ApplicationService
{
diff --git a/src/Oms.Application/Services/System/NoticeService.cs b/src/Oms.Application/Services/System/NoticeService.cs
index 57112b1..a455746 100644
--- a/src/Oms.Application/Services/System/NoticeService.cs
+++ b/src/Oms.Application/Services/System/NoticeService.cs
@@ -12,6 +12,9 @@ using Oms.Domain.SystemAggregate.Repositories;
namespace Oms.Application.Services.System;
+///
+/// 公告 API 服务。
+///
[ApiExplorerSettings(GroupName = "OMS-System")]
public class NoticeService : ApplicationService
{
diff --git a/src/Oms.Application/Services/System/WarehouseService.cs b/src/Oms.Application/Services/System/WarehouseService.cs
index d061640..eac127a 100644
--- a/src/Oms.Application/Services/System/WarehouseService.cs
+++ b/src/Oms.Application/Services/System/WarehouseService.cs
@@ -10,6 +10,9 @@ using Oms.Domain.SystemAggregate.Repositories;
namespace Oms.Application.Services.System;
+///
+/// 仓库 API 服务。
+///
[ApiExplorerSettings(GroupName = "OMS-System")]
public class WarehouseService : ApplicationService
{
diff --git a/src/Oms.Application/Shared/OmsDocHelper.cs b/src/Oms.Application/Shared/OmsDocHelper.cs
index cd29d3a..3299407 100644
--- a/src/Oms.Application/Shared/OmsDocHelper.cs
+++ b/src/Oms.Application/Shared/OmsDocHelper.cs
@@ -5,6 +5,9 @@ using Oms.Domain.SystemAggregate.Consts;
namespace Oms.Application.Shared;
+///
+/// OMS 通用文档与展示辅助方法。
+///
public static class OmsDocHelper
{
private static readonly JsonSerializerOptions JsonOptions = new()
@@ -12,10 +15,19 @@ public static class OmsDocHelper
PropertyNameCaseInsensitive = true
};
+ ///
+ /// 将页码规范为至少 1。
+ ///
public static int NormalizePage(int page) => page <= 0 ? 1 : page;
+ ///
+ /// 将每页条数规范为 1~200。
+ ///
public static int NormalizePageSize(int pageSize) => pageSize <= 0 ? 20 : Math.Min(pageSize, 200);
+ ///
+ /// 将默认 DateTime 转为 null。
+ ///
public static DateTime? NullIfDefault(DateTime value) => value == default ? null : value;
///
@@ -32,6 +44,9 @@ public static class OmsDocHelper
return ConvertJsonElement(document.RootElement);
}
+ ///
+ /// 反序列化 JSON 字符串为指定类型。
+ ///
public static T? DeserializeJson(string? json)
{
if (string.IsNullOrWhiteSpace(json))
@@ -95,8 +110,14 @@ public static class OmsDocHelper
_ => element.GetRawText()
};
+ ///
+ /// 反序列化 JSON 字符串数组。
+ ///
public static List DeserializeStringList(string? json) => JsonStringArrayHelper.Deserialize(json);
+ ///
+ /// 将订单状态码转为中文名称。
+ ///
public static string? GetOrderStatusName(string statusCode)
{
return statusCode switch
@@ -117,6 +138,9 @@ public static class OmsDocHelper
};
}
+ ///
+ /// 将仓库类型码转为中文名称。
+ ///
public static string GetWarehouseTypeName(string warehouseType)
{
return warehouseType switch
diff --git a/src/Oms.Application/Shared/OmsSessionHelper.cs b/src/Oms.Application/Shared/OmsSessionHelper.cs
index 45f840d..9085804 100644
--- a/src/Oms.Application/Shared/OmsSessionHelper.cs
+++ b/src/Oms.Application/Shared/OmsSessionHelper.cs
@@ -10,10 +10,16 @@ namespace Oms.Application.Shared;
///
public static class OmsSessionHelper
{
+ ///
+ /// JWT 中标识登录类型的 Claim 名称。
+ ///
public const string LoginTypeClaim = "loginType";
private const string CustomerLoginType = "1";
+ ///
+ /// 当前会话是否为客户门户登录。
+ ///
public static bool IsCustomerLogin(ICurrentUser currentUser) =>
string.Equals(
currentUser.FindClaimOrNull(LoginTypeClaim)?.Value,
@@ -59,7 +65,7 @@ public static class OmsSessionHelper
if (requestedCustomerId is > 0 && requestedCustomerId.Value != sessionCustomer.Id)
{
- throw new BusinessException("无权为该客户提交充值");
+ throw new BusinessException("客户ID非法");
}
return sessionCustomer;