feat: OA流程补充收款人银行账号 (#1270)

This commit is contained in:
yueyang 2026-11-19 15:26:33 +08:00
parent 3afbf6320f
commit 805fc38cf9
11 changed files with 342 additions and 13 deletions

View File

@ -0,0 +1,51 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
private function connection(): string
{
return (string) config('upstream_mirrors.connection', 'business_mirror');
}
public function up(): void
{
if (app()->environment('testing')
|| (string) config('system_database.mode', 'bootstrap') === 'bootstrap') {
return;
}
$schema = Schema::connection($this->connection());
if (! $schema->hasTable('ding_process_detail_mirror')
|| $schema->hasColumn('ding_process_detail_mirror', 'payee_name')) {
return;
}
$schema->table('ding_process_detail_mirror', function (Blueprint $table): void {
$table->string('payee_name', 255)->nullable()->after('paid_at');
$table->string('payee_bank_name', 255)->nullable()->after('payee_name');
$table->string('payee_bank_account', 100)->nullable()->after('payee_bank_name');
});
}
public function down(): void
{
if (app()->environment('testing')
|| (string) config('system_database.mode', 'bootstrap') === 'bootstrap') {
return;
}
$schema = Schema::connection($this->connection());
if (! $schema->hasTable('ding_process_detail_mirror')
|| ! $schema->hasColumn('ding_process_detail_mirror', 'payee_name')) {
return;
}
$schema->table('ding_process_detail_mirror', function (Blueprint $table): void {
$table->dropColumn(['payee_name', 'payee_bank_name', 'payee_bank_account']);
});
}
};

View File

@ -43,7 +43,7 @@
| 已接入待首次同步 | 店铺营销账户余额的京东账户读取 `js_data_middle_platform.dbo.jd_jzt_finance_records` 镜像 `jsm_jd_jzt_finance_records`;按 `id` 稳定断点、`updated_at` 重叠增量,页面不直连上游。 |
| 本次接入 | 普通商品资料的工作平台采购价格接入 `jiansun.dbo.pm_priceAdjustment`(镜像 `js_pm_price_adjustment`):按 `skuCode` 关联 `jst_sku.sku_id`,取 `effectTime` 不晚于当前时间的最新 `purchasePrice`,并在页面和导出中标记“工作平台价格”;源表没有可靠更新时间,按 `Id` 稳定键追加,首次全量完成前只显示普通商品自身采购价。 |
| 待有效凭据后首次同步 | 普通商品当前成本价、商品类型和更新时间继续读取 `operations_replica.rpt.jst_sku`;`rpt.fys_skuCostPriceUpdate` 是一 SKU 一行的旧快照,不能充当变价历史。完整成本价变更仍读取聚水潭经典开放平台“商品操作日志查询”接口 `worklog.query`,只镜像操作内容含“采购价”的记录到 `jushuitan_cost_price_history_rows`;经典接口必须在服务器私有配置中使用同一应用的 `JUSHUITAN_PARTNER_ID / JUSHUITAN_PARTNER_KEY / JUSHUITAN_TOKEN`,不得把新开放平台的 App Key / App Secret / Access Token 混用。页面在首次同步完成前明确显示待同步或失败,不把 0 条解释为真实无历史。 |
| 本次接入 | 流程明细读取 `operations_replica/rpt.ding_Workflow + rpt.ding_WorkflowScheme` 的结构化审批主表、费用明细和付款明细,写入 `ding_process_detail_mirror`、`ding_process_payment_mirror` 与付款按明细行分摊的 `ding_process_payment_line_mirror`;主表的 `originatorDeptName` 作为发起人部门单独保留,费用明细行的“店铺”字段规范化写入 `store_name`。禁止先把明细表和付款表铺平成 CSV 后逐行求和;付款明细必须按“对应序号”关联到代表明细行,但合计始终读取独立付款事实。管理费用按分摊后的付款月份统计,跨月分笔付款不会把整张审批重复计入多月。每个纳入范围的源审批至少保留一条页面记录,没有费用金额的审批以空金额显示,不静默隐藏。首次全量先运行 `business-mirror:sync-ding-process-details --full --dry-run` 校验,再使用 `business-mirror:sync-ding-process-details --full` 发布;日常通过 `updateAt/createAt` 48 小时重叠增量同步。当前纳入日常报销、应付、线上代发、种菜、快递面单、固定资产、日常物品、样品、一次性采买、板材、工资、外贸费用和种菜充值等 14 个财务流程;发现新的明细流程编码时全量同步报错并保留上一版。 |
| 本次接入 | 流程明细读取 `operations_replica/rpt.ding_Workflow + rpt.ding_WorkflowScheme` 的结构化审批主表、费用明细和付款明细,写入 `ding_process_detail_mirror`、`ding_process_payment_mirror` 与付款按明细行分摊的 `ding_process_payment_line_mirror`;主表的 `originatorDeptName` 作为发起人部门单独保留,费用明细行的“店铺”字段规范化写入 `store_name`。审批表单表头的 `收款人全称 / 开户银行 / 银行账号` 分别写入 `payee_name / payee_bank_name / payee_bank_account`,同一审批下的每条费用明细继承对应值;行级或付款明细存在更具体值时优先使用。禁止先把明细表和付款表铺平成 CSV 后逐行求和;付款明细必须按“对应序号”关联到代表明细行,但合计始终读取独立付款事实。管理费用按分摊后的付款月份统计,跨月分笔付款不会把整张审批重复计入多月。每个纳入范围的源审批至少保留一条页面记录,没有费用金额的审批以空金额显示,不静默隐藏。首次全量先运行 `business-mirror:sync-ding-process-details --full --dry-run` 校验,再使用 `business-mirror:sync-ding-process-details --full` 发布;日常通过 `updateAt/createAt` 48 小时重叠增量同步。当前纳入日常报销、应付、线上代发、种菜、快递面单、固定资产、日常物品、样品、一次性采买、板材、工资、外贸费用和种菜充值等 14 个财务流程;发现新的明细流程编码时全量同步报错并保留上一版。 |
| 本次接入 | 财务经营报表 › 管理费用使用 `oa_process_account_mapping` 保存流程科目映射;当前快照包含原工作簿 191 个科目和补充的 `5601.11.01 货代费`、`1221.07 种菜备用金`、`5602.11.03.19 AI阿里云软件费`,共 194 个科目,其中 37 个进费比科目和 126 个分摊规则。页面按打款时间提供整月选择并默认展示上个月 OA 流程中审批状态为“已完成”、涉及付款且出纳已打款的明细,不涉及付款或出纳未打款的数据不进入汇总,按费用大类和二级汇总进费比/不进费比/未映射金额,点击二级查看三级汇总与 9 列明细模板。审批完成时间写入 `ding_process_detail_mirror.approval_finished_at`,页面月份筛选使用 `ding_process_detail_mirror.paid_at`;钉钉副本把费用明细表保存为未命名字段时,按配置中的金额列识别包含该列的未命名表格组件,避免只抓到付款明细而漏掉费用科目和金额。明细行没有科目时,使用同一审批表单表头的 `科目编码 / 科目名称` 回填;行级科目始终优先。 |
| 本次接入 | 订单利润的包材费、快递费、账单费用直接读取聚胜算订单利润页面接口 `pf.erp321.com/WebApi/PF/OrderSku/GetOrderSkuList`(支付/发货时间口径各分页抓取),导入 `ops_shengsuan_order_profit_rows`,页面按“店铺 + 线上/内部单号”原样回填,不把 0 或推算值写入缺口。异常订单再通过 `GetPfOrderDetList` 按每批最多 50 单抓取完整订单商品明细,保存至 `ops_shengsuan_order_profit_detail_snapshots`,包括全部订单字段、销售商品明细、退货商品明细和缺成本商品编码。主表抓取脚本为 `scripts/order-profit-shengsuan-sync.py`,明细补同步脚本为 `scripts/order-profit-shengsuan-details-sync.py`;导入命令分别为 `order-profit:import-shengsuan-rows`、`order-profit:import-shengsuan-details`。脚本依赖本机已登录胜算的 Chrome 调试窗口,不能由服务器容器直连页面。`成本/运费异常`按主表“商品成本或快递费任一为0/空”筛选,分别标记“成本异常”“运费异常”,并在订单下按具体商品编码展示缺成本条码,以发货时间为监控日期。 |

View File

@ -133,6 +133,9 @@ class ProcessDetails extends Controller
$row['bank_amount'] ?? '',
(string) ($row['payment_method'] ?? ''),
(string) ($row['paid_at'] ?? ''),
(string) ($row['payee_name'] ?? ''),
(string) ($row['payee_bank_name'] ?? ''),
(string) ($row['payee_bank_account'] ?? ''),
(string) ($row['payment_state'] ?? ''),
isset($row['payment_difference'])
? number_format((float) $row['payment_difference'], 2, '.', '')

View File

@ -13,7 +13,7 @@ class DingProcessDetailMirrorImporter
public const DEFAULT_SCOPE = 'personal_permission';
public const HEADERS = [
public const REQUIRED_HEADERS = [
'序号',
'审批编号',
'发起人',
@ -31,6 +31,17 @@ class DingProcessDetailMirrorImporter
'打款时间',
];
public const OPTIONAL_HEADERS = [
'收款人全称',
'开户银行',
'银行账号',
];
public const HEADERS = [
...self::REQUIRED_HEADERS,
...self::OPTIONAL_HEADERS,
];
private readonly ConnectionInterface $connection;
public function __construct(DatabaseManager $database)
@ -97,6 +108,9 @@ class DingProcessDetailMirrorImporter
'bank_amount',
'payment_method',
'paid_at',
'payee_name',
'payee_bank_name',
'payee_bank_account',
'source_scope',
'synced_at',
'updated_at',
@ -171,7 +185,7 @@ class DingProcessDetailMirrorImporter
$header[0] = preg_replace('/^\xEF\xBB\xBF/', '', (string) $header[0]);
$header = array_map(static fn (mixed $value): string => trim((string) $value), $header);
$missing = array_values(array_diff(self::HEADERS, $header));
$missing = array_values(array_diff(self::REQUIRED_HEADERS, $header));
if ($missing !== []) {
throw new RuntimeException('流程明细 CSV 缺少列:' . implode('、', $missing));
@ -212,6 +226,9 @@ class DingProcessDetailMirrorImporter
}
$key = $businessId . '|' . (int) $lineNo;
$payeeNameIndex = $index['收款人全称'] ?? null;
$payeeBankNameIndex = $index['开户银行'] ?? null;
$payeeBankAccountIndex = $index['银行账号'] ?? null;
$candidate = [
'business_id' => mb_substr($businessId, 0, 32),
'line_no' => (int) $lineNo,
@ -230,6 +247,21 @@ class DingProcessDetailMirrorImporter
'bank_amount' => $this->decimal($data[$index['银行付款金额']] ?? null),
'payment_method' => mb_substr(trim((string) ($data[$index['付款方式']] ?? '')), 0, 50),
'paid_at' => mb_substr(trim((string) ($data[$index['打款时间']] ?? '')), 0, 50),
'payee_name' => mb_substr(
trim((string) ($payeeNameIndex === null ? '' : ($data[$payeeNameIndex] ?? ''))),
0,
255,
),
'payee_bank_name' => mb_substr(
trim((string) ($payeeBankNameIndex === null ? '' : ($data[$payeeBankNameIndex] ?? ''))),
0,
255,
),
'payee_bank_account' => mb_substr(
trim((string) ($payeeBankAccountIndex === null ? '' : ($data[$payeeBankAccountIndex] ?? ''))),
0,
100,
),
'source_scope' => $scope,
'synced_at' => $now,
'created_at' => $now,
@ -279,6 +311,9 @@ class DingProcessDetailMirrorImporter
$score += is_numeric($row['bank_amount'] ?? null) && (float) $row['bank_amount'] !== 0.0 ? 2 : 0;
$score += trim((string) ($row['paid_at'] ?? '')) !== ''
&& trim((string) ($row['paid_at'] ?? '')) !== '251' ? 1 : 0;
$score += trim((string) ($row['payee_name'] ?? '')) !== '' ? 1 : 0;
$score += trim((string) ($row['payee_bank_name'] ?? '')) !== '' ? 1 : 0;
$score += trim((string) ($row['payee_bank_account'] ?? '')) !== '' ? 1 : 0;
return $score;
}

View File

@ -968,6 +968,9 @@ class DingProcessDetailMirrorSynchronizer
'支付方式',
'付款方式',
'打款时间',
'收款人全称',
'开户银行',
'银行账号',
];
foreach ((array) config('upstream_mirrors.ding_process_details.processes', []) as $process) {
foreach ([
@ -1101,6 +1104,27 @@ class DingProcessDetailMirrorSynchronizer
if ($workflowDetails === []) {
$amount = $this->moneyFromFields($fields, (array) ($process['detail_amount_fields'] ?? []));
$approvalFields = (array) ($approvalSnapshot['form_values'] ?? []);
$payeeName = $this->rowOrFieldValue(
[],
$fields,
['收款人全称', '收款人名称', '收款人'],
) ?: $this->rowOrFieldValue(
[],
$approvalFields,
['收款人全称', '收款人名称', '收款人'],
);
$payeeBankName = $this->rowOrFieldValue([], $fields, ['开户银行', '开户行'])
?: $this->rowOrFieldValue([], $approvalFields, ['开户银行', '开户行']);
$payeeBankAccount = $this->rowOrFieldValue(
[],
$fields,
['银行账号', '银行帐号', '银行卡号'],
) ?: $this->rowOrFieldValue(
[],
$approvalFields,
['银行账号', '银行帐号', '银行卡号'],
);
$workflowDetails[] = $this->detailRecord(
$workflow,
$process,
@ -1113,6 +1137,9 @@ class DingProcessDetailMirrorSynchronizer
'',
'',
'',
$payeeName,
$payeeBankName,
$payeeBankAccount,
$this->storeName([], $fields),
$originator,
$documentType,
@ -1295,6 +1322,34 @@ class DingProcessDetailMirrorSynchronizer
$accountCode = trim((string) ($row['科目编码'] ?? ''));
$accountName = trim((string) ($row['科目名称'] ?? ''));
$storeName = $this->storeName($row, $fields);
$payeeName = $this->rowOrFieldValue(
$row,
$fields,
['收款人全称', '收款人名称', '收款人'],
);
$payeeBankName = $this->rowOrFieldValue($row, $fields, ['开户银行', '开户行']);
$payeeBankAccount = $this->rowOrFieldValue(
$row,
$fields,
['银行账号', '银行帐号', '银行卡号'],
);
if ($payeeName === '') {
$payeeName = $this->rowOrFieldValue(
[],
$approvalFields,
['收款人全称', '收款人名称', '收款人'],
);
}
if ($payeeBankName === '') {
$payeeBankName = $this->rowOrFieldValue([], $approvalFields, ['开户银行', '开户行']);
}
if ($payeeBankAccount === '') {
$payeeBankAccount = $this->rowOrFieldValue(
[],
$approvalFields,
['银行账号', '银行帐号', '银行卡号'],
);
}
if ($accountCode === '') {
$accountCode = trim((string) $this->scalarValue($fields['科目编码'] ?? null));
}
@ -1321,6 +1376,9 @@ class DingProcessDetailMirrorSynchronizer
$accountName,
$invoiceTitle,
$cashierPaymentTitle,
$payeeName,
$payeeBankName,
$payeeBankAccount,
$storeName,
$originator,
$documentType,
@ -1371,6 +1429,14 @@ class DingProcessDetailMirrorSynchronizer
'开票抬头',
'发票抬头',
'出纳打款抬头',
'收款人全称',
'收款人名称',
'收款人',
'开户银行',
'开户行',
'银行账号',
'银行帐号',
'银行卡号',
] as $field) {
if (trim((string) ($row[$field] ?? '')) === ''
&& trim((string) ($officialRow[$field] ?? '')) !== '') {
@ -1533,6 +1599,7 @@ class DingProcessDetailMirrorSynchronizer
'account_name' => mb_substr(trim((string) ($row['科目名称'] ?? '')), 0, 255),
'payment_method' => mb_substr(trim((string) ($row['付款方式'] ?? '')), 0, 50),
'paid_at' => mb_substr($paidAt, 0, 50),
...$this->payeeFields($row, $fields),
'source_scope' => $scope,
'synced_at' => $now,
'created_at' => $now,
@ -1573,6 +1640,7 @@ class DingProcessDetailMirrorSynchronizer
0,
50,
),
...$this->payeeFields([], $fields),
'source_scope' => $scope,
'synced_at' => $now,
'created_at' => $now,
@ -2064,6 +2132,19 @@ class DingProcessDetailMirrorSynchronizer
$detail['bank_account_name'] = $this->joinUnique($group, 'account_name', 255);
$detail['payment_method'] = $this->joinUnique($group, 'payment_method', 50);
$detail['paid_at'] = $this->joinUnique($group, 'paid_at', 50);
if (trim((string) ($detail['payee_name'] ?? '')) === '') {
$detail['payee_name'] = $this->joinUnique($group, 'payee_name', 255);
}
if (trim((string) ($detail['payee_bank_name'] ?? '')) === '') {
$detail['payee_bank_name'] = $this->joinUnique($group, 'payee_bank_name', 255);
}
if (trim((string) ($detail['payee_bank_account'] ?? '')) === '') {
$detail['payee_bank_account'] = $this->joinUnique(
$group,
'payee_bank_account',
100,
);
}
}
unset($detail);
}
@ -2085,6 +2166,9 @@ class DingProcessDetailMirrorSynchronizer
string $accountName,
string $invoiceTitle,
string $cashierPaymentTitle,
string $payeeName,
string $payeeBankName,
string $payeeBankAccount,
string $storeName,
string $originator,
string $documentType,
@ -2138,6 +2222,9 @@ class DingProcessDetailMirrorSynchronizer
'bank_amount' => null,
'payment_method' => null,
'paid_at' => null,
'payee_name' => mb_substr($payeeName, 0, 255),
'payee_bank_name' => mb_substr($payeeBankName, 0, 255),
'payee_bank_account' => mb_substr($payeeBankAccount, 0, 100),
'source_scope' => $scope,
'synced_at' => $now,
'created_at' => $now,
@ -2299,6 +2386,63 @@ class DingProcessDetailMirrorSynchronizer
return '';
}
/**
* @param array<string,string> $row
* @param array<string,mixed> $fields
* @param list<string> $names
*/
private function rowOrFieldValue(array $row, array $fields, array $names): string
{
foreach ($names as $name) {
if (array_key_exists($name, $row)) {
$value = trim((string) ($row[$name] ?? ''));
if ($value !== '') {
return $value;
}
}
$fieldValue = $fields[$name] ?? null;
if (is_array($fieldValue)
&& array_key_exists('value', $fieldValue)
&& is_scalar($fieldValue['value'])) {
$value = trim((string) $fieldValue['value']);
} else {
$value = $this->scalarValue($fieldValue);
}
if ($value !== '') {
return $value;
}
}
return '';
}
/**
* @param array<string,string> $row
* @param array<string,mixed> $fields
* @return array{payee_name:string,payee_bank_name:string,payee_bank_account:string}
*/
private function payeeFields(array $row, array $fields): array
{
return [
'payee_name' => mb_substr(
$this->rowOrFieldValue($row, $fields, ['收款人全称', '收款人名称', '收款人']),
0,
255,
),
'payee_bank_name' => mb_substr(
$this->rowOrFieldValue($row, $fields, ['开户银行', '开户行']),
0,
255,
),
'payee_bank_account' => mb_substr(
$this->rowOrFieldValue($row, $fields, ['银行账号', '银行帐号', '银行卡号']),
0,
100,
),
];
}
/**
* Store names are commonly nested JSON arrays in DingTalk table cells.
*
@ -2458,7 +2602,12 @@ class DingProcessDetailMirrorSynchronizer
return $row;
}, $details);
$payments = array_map(function (array $row): array {
unset($row['amount_cents']);
unset(
$row['amount_cents'],
$row['payee_name'],
$row['payee_bank_name'],
$row['payee_bank_account'],
);
return $row;
}, $payments);

View File

@ -750,7 +750,7 @@
}
.process-details-pending-detail__table {
min-width: 106rem;
min-width: 118rem;
}
.process-details-note-disclosure {
@ -825,7 +825,7 @@
.process-details-table {
width: 100%;
min-width: 106rem;
min-width: 118rem;
border-collapse: separate;
border-spacing: 0;
font-size: .78rem;
@ -1621,6 +1621,9 @@
<th class="num">付款差额</th>
<th>付款方式</th>
<th>打款时间</th>
<th>收款人全称</th>
<th>开户银行</th>
<th>银行账号</th>
</tr>
@endif
</thead>
@ -1703,11 +1706,14 @@
<td class="num {{ abs((float) ($row->payment_difference ?? 0)) > 0.01 ? 'is-difference' : '' }}">{{ $money($row->payment_difference) }}</td>
<td>{{ $text($row->payment_method) }}</td>
<td>{{ $text($row->paid_at) }}</td>
<td class="wide" title="{{ $row->payee_name ?? '' }}">{{ $text($row->payee_name ?? null) }}</td>
<td class="wide" title="{{ $row->payee_bank_name ?? '' }}">{{ $text($row->payee_bank_name ?? null) }}</td>
<td class="wide" title="{{ $row->payee_bank_account ?? '' }}">{{ $text($row->payee_bank_account ?? null) }}</td>
</tr>
@endif
@empty
<tr>
<td colspan="{{ $pendingPaymentSummaryMode ? 6 : ($approvalSummaryMode ? 7 : 23) }}" class="process-details-empty">
<td colspan="{{ $pendingPaymentSummaryMode ? 6 : ($approvalSummaryMode ? 7 : 26) }}" class="process-details-empty">
当前筛选条件没有OA流程数据。可以调整月份、单据类型、状态或关键词后重试。
</td>
</tr>

View File

@ -109,6 +109,9 @@
<th class="num">付款差额</th>
<th>付款方式</th>
<th>打款时间</th>
<th>收款人全称</th>
<th>开户银行</th>
<th>银行账号</th>
</tr>
</thead>
<tbody>
@ -141,10 +144,13 @@
<td class="num {{ abs((float) ($row->payment_difference ?? 0)) > 0.01 ? 'is-difference' : '' }}">{{ $money($row->payment_difference ?? null) }}</td>
<td>{{ $text($row->payment_method ?? null) }}</td>
<td>{{ $text($row->paid_at ?? null) }}</td>
<td class="wide" title="{{ $row->payee_name ?? '' }}">{{ $text($row->payee_name ?? null) }}</td>
<td class="wide" title="{{ $row->payee_bank_name ?? '' }}">{{ $text($row->payee_bank_name ?? null) }}</td>
<td class="wide" title="{{ $row->payee_bank_account ?? '' }}">{{ $text($row->payee_bank_account ?? null) }}</td>
</tr>
@empty
<tr>
<td colspan="23" class="process-details-empty">
<td colspan="26" class="process-details-empty">
当前审批人和筛选条件下没有待付款明细。
</td>
</tr>

View File

@ -47,6 +47,9 @@ class ProcessDetailsPageTest extends FeatureTestCase
'payment_difference' => 0.00,
'payment_method' => '银行卡',
'paid_at' => '2026-01-02 00:00',
'payee_name' => '沃曾朝',
'payee_bank_name' => '江南农村商业银行',
'payee_bank_account' => '623189110018550628',
],
],
'total' => 1,
@ -154,6 +157,12 @@ class ProcessDetailsPageTest extends FeatureTestCase
->assertDontSee('未核验')
->assertSee('<th class="num">付款明细金额</th>', false)
->assertSee('<th class="num">付款差额</th>', false)
->assertSee('<th>收款人全称</th>', false)
->assertSee('<th>开户银行</th>', false)
->assertSee('<th>银行账号</th>', false)
->assertSee('沃曾朝')
->assertSee('江南农村商业银行')
->assertSee('623189110018550628')
->assertDontSee('<span>付款合计</span>', false)
->assertDontSee('银行付款合计')
->assertSee('流程数据已超过 15 分钟未成功同步')
@ -434,6 +443,9 @@ class ProcessDetailsPageTest extends FeatureTestCase
'payment_difference' => 880.00,
'payment_method' => '',
'paid_at' => '',
'payee_name' => '沃曾朝',
'payee_bank_name' => '江南农村商业银行',
'payee_bank_account' => '623189110018550628',
],
],
'total' => 1,
@ -470,6 +482,12 @@ class ProcessDetailsPageTest extends FeatureTestCase
->assertSee('<th>发票抬头</th>', false)
->assertSee('<th>出纳打款抬头</th>', false)
->assertSee('<th class="num">付款差额</th>', false)
->assertSee('<th>收款人全称</th>', false)
->assertSee('<th>开户银行</th>', false)
->assertSee('<th>银行账号</th>', false)
->assertSee('沃曾朝')
->assertSee('江南农村商业银行')
->assertSee('623189110018550628')
->assertSee(
'href="'
. e(url('/1/workspace/process-data/oa-process/pending-payment-summary')
@ -786,6 +804,9 @@ class ProcessDetailsPageTest extends FeatureTestCase
'bank_amount' => '100.00',
'payment_method' => '银行卡',
'paid_at' => '2026-01-02 00:00',
'payee_name' => '沃曾朝',
'payee_bank_name' => '江南农村商业银行',
'payee_bank_account' => '623189110018550628',
];
});
$this->app->instance(DingProcessDetailMirrorRepository::class, $repository);
@ -817,6 +838,9 @@ class ProcessDetailsPageTest extends FeatureTestCase
'银行付款金额',
'付款方式',
'打款时间',
'收款人全称',
'开户银行',
'银行账号',
'付款状态',
'付款差额',
], $header);
@ -829,6 +853,9 @@ class ProcessDetailsPageTest extends FeatureTestCase
$this->assertStringContainsString('出纳打款抬头', $content);
$this->assertStringContainsString('江苏简尚品牌管理有限公司', $content);
$this->assertStringContainsString('常州欧伯娜家居有限公司', $content);
$this->assertStringContainsString('沃曾朝', $content);
$this->assertStringContainsString('江南农村商业银行', $content);
$this->assertStringContainsString('623189110018550628', $content);
$this->assertStringContainsString('管理费用_办公费', $content);
$this->assertStringContainsString('付款状态', $content);
$this->assertStringContainsString('已付款', $content);

View File

@ -71,6 +71,9 @@ class ImportDingProcessDetailsTest extends TestCase
$this->assertSame('5602.04', $row->account_code);
$this->assertSame('管理费用_办公费', $row->account_name);
$this->assertEqualsWithDelta(100.0, (float) $row->amount, 0.001);
$this->assertSame('沃曾朝', $row->payee_name);
$this->assertSame('江南农村商业银行', $row->payee_bank_name);
$this->assertSame('623189110018550628', $row->payee_bank_account);
$this->assertSame('202601', $row->business_month);
$this->assertSame('personal_permission', $row->source_scope);
@ -151,6 +154,43 @@ class ImportDingProcessDetailsTest extends TestCase
->table('ding_process_detail_mirror')->count());
}
public function test_legacy_csv_without_payee_columns_remains_importable(): void
{
$path = tempnam(sys_get_temp_dir(), 'ding-process-legacy-');
$handle = fopen($path, 'wb');
fputcsv($handle, DingProcessDetailMirrorImporter::REQUIRED_HEADERS);
fputcsv($handle, [
'1',
'202603011200000000003',
'王五',
'已完成',
'店铺日常报销',
'旧版流程文件',
'1',
'5601.01',
'销售费用',
'10.00',
'1002.01.003',
'银行-测试3',
'10.00',
'银行卡',
'2026-03-02 00:00',
]);
fclose($handle);
$this->tempFiles[] = $path;
$result = app(DingProcessDetailMirrorImporter::class)
->import($path, 'personal_permission', true);
$this->assertSame(1, $result['rows']);
$row = DB::connection('business_mirror')
->table('ding_process_detail_mirror')
->first();
$this->assertSame('', $row->payee_name);
$this->assertSame('', $row->payee_bank_name);
$this->assertSame('', $row->payee_bank_account);
}
public function test_placeholder_rows_are_skipped_and_the_better_duplicate_wins(): void
{
$path = $this->makeCsv([
@ -247,6 +287,9 @@ class ImportDingProcessDetailsTest extends TestCase
$table->decimal('bank_amount', 18, 2)->nullable();
$table->string('payment_method', 50)->nullable();
$table->string('paid_at', 50)->nullable();
$table->string('payee_name', 255)->nullable();
$table->string('payee_bank_name', 255)->nullable();
$table->string('payee_bank_account', 100)->nullable();
$table->string('source_scope', 40)->default('personal_permission')->index();
$table->dateTime('synced_at', 6);
$table->timestamps();

View File

@ -1,5 +1,5 @@
序号,审批编号,发起人,状态,单据类型,用途/摘要,单据内行号,科目编码,科目名称,金额(元),银行科目编码,银行科目名称,银行付款金额,付款方式,打款时间
1,202601011200000000001,张三,已完成,公摊日常报销,办公用品采购,1,5602.04,管理费用_办公费,100.00,1002.01.001,华夏银行-测试,100.00,银行卡,2026-01-02 00:00
2,202601011200000000001,张三,已完成,公摊日常报销,交通费,2,5602.06,管理费用_交通费,50.50,1002.01.001,华夏银行-测试,50.50,银行卡,2026-01-02 00:00
3,202602031200000000002,李四,审批中,应付申请流程,供应商货款,1,,,200.00,1002.01.002,银行-测试2,200.00,银行卡,
4,202602031200000000002,李四,审批中,应付申请流程,供应商货款,2,,,300.00,1002.01.002,银行-测试2,300.00,银行卡,
序号,审批编号,发起人,状态,单据类型,用途/摘要,单据内行号,科目编码,科目名称,金额(元),银行科目编码,银行科目名称,银行付款金额,付款方式,打款时间,收款人全称,开户银行,银行账号
1,202601011200000000001,张三,已完成,公摊日常报销,办公用品采购,1,5602.04,管理费用_办公费,100.00,1002.01.001,华夏银行-测试,100.00,银行卡,2026-01-02 00:00,沃曾朝,江南农村商业银行,623189110018550628
2,202601011200000000001,张三,已完成,公摊日常报销,交通费,2,5602.06,管理费用_交通费,50.50,1002.01.001,华夏银行-测试,50.50,银行卡,2026-01-02 00:00,沃曾朝,江南农村商业银行,623189110018550628
3,202602031200000000002,李四,审批中,应付申请流程,供应商货款,1,,,200.00,1002.01.002,银行-测试2,200.00,银行卡,,,,
4,202602031200000000002,李四,审批中,应付申请流程,供应商货款,2,,,300.00,1002.01.002,银行-测试2,300.00,银行卡,,,,

1 序号 审批编号 发起人 状态 单据类型 用途/摘要 单据内行号 科目编码 科目名称 金额(元) 银行科目编码 银行科目名称 银行付款金额 付款方式 打款时间 收款人全称 开户银行 银行账号
2 1 202601011200000000001 张三 已完成 公摊日常报销 办公用品采购 1 5602.04 管理费用_办公费 100.00 1002.01.001 华夏银行-测试 100.00 银行卡 2026-01-02 00:00 沃曾朝 江南农村商业银行 623189110018550628
3 2 202601011200000000001 张三 已完成 公摊日常报销 交通费 2 5602.06 管理费用_交通费 50.50 1002.01.001 华夏银行-测试 50.50 银行卡 2026-01-02 00:00 沃曾朝 江南农村商业银行 623189110018550628
4 3 202602031200000000002 李四 审批中 应付申请流程 供应商货款 1 200.00 1002.01.002 银行-测试2 200.00 银行卡
5 4 202602031200000000002 李四 审批中 应付申请流程 供应商货款 2 300.00 1002.01.002 银行-测试2 300.00 银行卡

View File

@ -121,6 +121,9 @@ class DingProcessDetailMirrorSynchronizerTest extends TestCase
->first();
$this->assertSame('江苏简尚品牌管理有限公司', $firstDetail->invoice_title);
$this->assertSame('常州欧伯娜家居有限公司', $firstDetail->cashier_payment_title);
$this->assertSame('沃曾朝', $firstDetail->payee_name);
$this->assertSame('江南农村商业银行', $firstDetail->payee_bank_name);
$this->assertSame('623189110018550628', $firstDetail->payee_bank_account);
$summary = app(DingProcessDetailMirrorRepository::class)
->paginate(['status' => '已完成'], 1, 50)['summary'];
@ -1434,6 +1437,9 @@ class DingProcessDetailMirrorSynchronizerTest extends TestCase
'收款费用明细' => json_encode($details, JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR),
'收款合计' => 1114.57,
'付款明细' => json_encode($payment, JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR),
'收款人全称' => '沃曾朝',
'开户银行' => '江南农村商业银行',
'银行账号' => '623189110018550628',
];
}
@ -1512,6 +1518,9 @@ class DingProcessDetailMirrorSynchronizerTest extends TestCase
$table->decimal('bank_amount', 18, 2)->nullable();
$table->string('payment_method', 50)->nullable();
$table->string('paid_at', 50)->nullable();
$table->string('payee_name', 255)->nullable();
$table->string('payee_bank_name', 255)->nullable();
$table->string('payee_bank_account', 100)->nullable();
$table->string('source_scope', 40);
$table->dateTime('synced_at', 6);
$table->timestamps();