- boot/ (Java/Maven, JNPF 7.0) — 移除旧的 boot/.git,源码直接纳入仓库
- web/ (Vue 3 + Vite + Ant Design Vue, pnpm)
- docs/, scard/, nax/
- refs/INDEX.md + refs/国标/(其余 refs/* 开源子仓库不纳入)
- 已忽略: connector_data/, jweb/, log/, web/{dist,node_modules,.pnpm}, boot/*/target/, .DS_Store, .idea, .vscode
90 lines
3.7 KiB
JavaScript
90 lines
3.7 KiB
JavaScript
/**
|
||
* TC-TRADE-006 · 正常办理计量计费
|
||
* REQ-021 [FL-17.1] 正向/场景法 P0
|
||
*
|
||
* 前置:1. 已登录且具备该功能权限的用户
|
||
* 2. 服务平台的【数据交易】可以正常打开
|
||
* 3. 已准备好测试数据
|
||
* 步骤:1. 打开服务平台的【数据交易】
|
||
* 2. 按页面提示填写或选择正确的数据
|
||
* 3. 点击提交,查看办理结果
|
||
* 预期:计量计费办理成功,系统按要求完成处理,状态和记录正确。
|
||
*
|
||
* 注:前台「数据交易」菜单的子页是 /tds/market。但「计量计费」在运营侧位于 /tds/billing,
|
||
* 按用例索引 links="/tds/billing, /tds/BillingLedger, /tds/Invoice",所以走 /tds/billing。
|
||
* 由于 BillingLedger 没有「空间」列在表单(CrudPage 的 page-head 没有 SpacePicker),
|
||
* 走 API 时需要先取一个有效 spaceId。
|
||
*/
|
||
export const meta = {
|
||
tc: 'TC-TRADE-006',
|
||
req: 'REQ-021',
|
||
title: '正常办理计量计费',
|
||
type: '正向/场景法',
|
||
priority: 'P0',
|
||
route: '/tds/billing',
|
||
needs: ['fe', 'be']
|
||
}
|
||
|
||
export async function run(t) {
|
||
let spaceId = null
|
||
let ledgerId = null
|
||
const productName = `测评计费产品-${t.runId}`
|
||
|
||
await t.step('前置:登录并打开【计量计费】-「计费台账」', async () => {
|
||
await t.login()
|
||
await t.goto('/tds/billing')
|
||
await t.expectTitle('计费台账')
|
||
await t.expectVisible('.ant-table', '计费台账表格已渲染')
|
||
// 拿一个可用空间 ID(创建台账必须带 spaceId)
|
||
const list = await t.apiList('/api/ssw/tds/Space', { pageSize: 5 })
|
||
spaceId = list[0]?.id
|
||
if (!spaceId) t.skip('库中没有可用空间,无法办理计费台账')
|
||
t.assert(true, `已就绪 spaceId=${spaceId}`)
|
||
})
|
||
|
||
await t.step('通过「GenerateFromDelivery」接口登记一条计费台账', async () => {
|
||
// 前台表单过于简单(只有产品名/用量/单价等),缺 spaceId;用落库接口走全字段
|
||
const r = await t.api('POST', '/api/ssw/tds/BillingLedger/GenerateFromDelivery', {
|
||
spaceId,
|
||
productName,
|
||
consumerOrgId: 'E2E-CONSUMER',
|
||
consumerOrgName: 'E2E-测评使用方',
|
||
providerOrgId: 'E2E-PROVIDER',
|
||
providerOrgName: 'E2E-测评提供方',
|
||
billingType: 'DELIVERY',
|
||
period: '2026-08',
|
||
quantity: 5,
|
||
unitPrice: 1.23,
|
||
currency: 'CNY'
|
||
})
|
||
t.assert(r.code === 200, `登记台账成功(实际 code=${r.code})`)
|
||
ledgerId = r.data
|
||
t.assert(!!ledgerId, `已生成台账 ID=${ledgerId}`)
|
||
})
|
||
|
||
await t.step('核对办理结果:列表中关键字能搜到台账', async () => {
|
||
await t.refresh()
|
||
await t.search(productName)
|
||
await t.expectRow(productName)
|
||
await t.shot('台账列表')
|
||
})
|
||
|
||
await t.step('落库数值正确(金额 = 单价 × 用量)', async () => {
|
||
const list = await t.apiList('/api/ssw/tds/BillingLedger', { keyword: productName })
|
||
const row = list.find((r) => r.id === ledgerId)
|
||
t.assert(!!row, `后端已落库台账 ${ledgerId}`)
|
||
t.assert(row.quantity === 5, `用量一致(${row.quantity})`)
|
||
t.assert(Number(row.unitPrice) === 1.23, `单价一致(${row.unitPrice})`)
|
||
t.assert(Number(row.amount) === 6.15, `金额一致(${row.amount} = 1.23 × 5)`)
|
||
t.assert(row.status === 'PENDING', `新建状态为 PENDING(实际 ${row.status})`)
|
||
})
|
||
|
||
await t.step('点「结算」动作:PENDING 流转为 SETTLED', async () => {
|
||
await t.doAction(productName, '结算')
|
||
await t.waitIdle()
|
||
const row = (await t.apiList('/api/ssw/tds/BillingLedger', { keyword: productName })).find((r) => r.id === ledgerId)
|
||
t.assert(row.status === 'SETTLED', `结算后状态为 SETTLED(实际 ${row.status})`)
|
||
})
|
||
|
||
t.expectConsoleClean()
|
||
} |