feat: workplace claimed stats and receiver address parse improvements

Add claimed count to workplace stats; refine receiver address parse DTOs/helpers and AI skill seed wiring.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zzh 2026-08-09 19:06:49 +08:00
parent 7e442180cd
commit 654a65aba4
8 changed files with 45 additions and 8 deletions

View File

@ -40,6 +40,11 @@ public class OrderOutput
/// </summary>
public string? ProductName { get; set; }
/// <summary>
/// 销售产品最大时效(天)。
/// </summary>
public int? MaxTimeliness { get; set; }
/// <summary>
/// 渠道编码。
/// </summary>

View File

@ -17,6 +17,10 @@ public class OrderReceiverParseAddressInput
/// <summary>可选模型覆盖。</summary>
[MaxLength(128)]
public string? Model { get; set; }
/// <summary>可选 Skill Key;为空时使用内置「oms-receiver-address-parse」。</summary>
[MaxLength(128)]
public string? SkillKey { get; set; }
}
/// <summary>地址解析结果 + 完整性校验。</summary>

View File

@ -50,6 +50,11 @@ public class OrderWorkplaceStatsOutput
/// </summary>
public int Problematic { get; set; }
/// <summary>
/// 理赔件数量。
/// </summary>
public int Claimed { get; set; }
/// <summary>
/// 店铺数量。
/// </summary>

File diff suppressed because one or more lines are too long

View File

@ -19,12 +19,14 @@ public class AiSkillService : ApplicationService
public const string SceneBillingConditionFormula = "billingConditionFormula";
public const string SceneReceiverAddressParse = "receiverAddressParse";
public const string SceneItfxPrefixScript = "itfxPrefixScript";
public const string SceneItfxParameterMap = "itfxParameterMap";
public const string KeyPricePublish = "oms-sales-price-publish-risk";
public const string KeyAutoTriggerFormula = "oms-auto-trigger-formula";
public const string KeyBillingConditionFormula = "oms-billing-condition-formula";
public const string KeyReceiverAddressParse = "oms-receiver-address-parse";
public const string KeyItfxPrefixScript = "itfx-prefix-script";
public const string KeyItfxCreateOrderMap = "itfx-create-order-map";
private IAiSkillRepository AiSkillRepository => LazyServiceProvider.GetRequiredService<IAiSkillRepository>();
@ -209,6 +211,8 @@ public class AiSkillService : ApplicationService
"解析粘贴的收件地址为结构化字段并做粗校验", payload.Address, 30),
new SeedDef(KeyItfxPrefixScript, SceneItfxPrefixScript, "接口通前置脚本",
"按用户需求生成 Natasha C# 前置签名脚本", payload.Itfx, 40),
new SeedDef(KeyItfxCreateOrderMap, SceneItfxParameterMap, "创建订单自动映射",
"按订单基本信息/收件人/发件人/申报信息四模块初步匹配上下游参数", payload.ParameterMap, 50),
];
}
@ -242,5 +246,6 @@ public class AiSkillService : ApplicationService
public string BillingCondition { get; set; } = string.Empty;
public string Itfx { get; set; } = string.Empty;
public string Address { get; set; } = string.Empty;
public string ParameterMap { get; set; } = string.Empty;
}
}

View File

@ -14,6 +14,7 @@ using Oms.Application.Services.Orders.Templates;
using Oms.Application.Shared;
using Oms.Domain.OrdersAggregate;
using Oms.Domain.ChannelsAggregate.Consts;
using Oms.Domain.ChannelsAggregate.Entities;
using Oms.Domain.OrdersAggregate.Consts;
using Oms.Domain.OrdersAggregate.Entities;
using Oms.Domain.SystemAggregate.Entities;
@ -126,6 +127,12 @@ public partial class OrderService
customerCode = customer.CustomerCode;
}
SalesProduct? product = null;
if (!string.IsNullOrWhiteSpace(order.ProductCode))
{
productMap.TryGetValue(order.ProductCode.Trim(), out product);
}
return new OrderOutput
{
Id = order.Id,
@ -134,10 +141,8 @@ public partial class OrderService
DownstreamServiceNo = order.DownstreamServiceNo,
ServiceNo = order.ServiceNo,
ProductCode = order.ProductCode,
ProductName = !string.IsNullOrWhiteSpace(order.ProductCode)
&& productMap.TryGetValue(order.ProductCode.Trim(), out var product)
? product.ProductName
: null,
ProductName = product?.ProductName,
MaxTimeliness = product?.MaxTimeliness,
ChannelCode = order.ChannelCode,
DownstreamSupplierCode = order.DownstreamSupplierCode,
DownstreamAppKey = order.DownstreamAppKey,

View File

@ -83,9 +83,21 @@ public partial class OrderService
var provider = await ResolveAiProviderAsync(customerId, input.ProviderKey);
var skillService = LazyServiceProvider.GetRequiredService<AiSkillService>();
var systemPrompt =
await skillService.TryGetContentByKeyAsync(AiSkillService.KeyReceiverAddressParse)
?? DefaultReceiverAddressParseSkill;
var skillKey = string.IsNullOrWhiteSpace(input.SkillKey)
? AiSkillService.KeyReceiverAddressParse
: input.SkillKey.Trim();
var systemPrompt = await skillService.TryGetContentByKeyAsync(skillKey);
if (string.IsNullOrWhiteSpace(systemPrompt))
{
if (skillKey == AiSkillService.KeyReceiverAddressParse)
{
systemPrompt = DefaultReceiverAddressParseSkill;
}
else
{
throw new BusinessException($"Skill「{skillKey}」未配置或未启用");
}
}
var userPrompt = "请解析以下收件信息:\n" + raw;
string modelText;

View File

@ -76,6 +76,7 @@ public partial class OrderService
Shipped = shipped,
PendingPayment = GetCount(OrderStatusCodes.PendingPayment),
Problematic = GetCount(OrderStatusCodes.Problematic),
Claimed = GetCount(OrderStatusCodes.Claimed),
StoreCount = storeCount,
StoreOrderPending = storeOrderPending,
};