feat(finance): expose inbound code on bill lines

This commit is contained in:
2026-09-02 20:25:54 +08:00
parent e4ee999098
commit 6f5398770b
3 changed files with 9 additions and 2 deletions
@@ -131,6 +131,7 @@ public final class FinanceReadModels {
int sourceVersion,
Long orderId,
Long inboundId,
String inboundCode,
String feeItemCode,
String feeItemName,
BigDecimal amount,
@@ -188,9 +188,13 @@ public class FinanceQueryService {
rs.getLong("created_by"), rs.getString("created_by_name"), time(rs, "created_at"),
rs.getLong("updated_by"), rs.getString("updated_by_name"), time(rs, "updated_at")), customerId, billId);
if (rows.isEmpty()) throw new BizException(ResultCode.NOT_FOUND, "账单不存在或不属于客户");
List<StatementLine> lines = jdbc.query("SELECT id,source_type,source_id,source_version,order_id,inbound_id,fee_item_code,fee_item_name,amount,currency_code FROM fin_bill_line WHERE tenant_id=? AND bill_id=? ORDER BY id",
List<StatementLine> lines = jdbc.query("SELECT l.id,l.source_type,l.source_id,l.source_version,l.order_id,l.inbound_id," +
"NULLIF(JSON_UNQUOTE(JSON_EXTRACT(f.source_snapshot,'$.inboundCode')),'null') inbound_code," +
"l.fee_item_code,l.fee_item_name,l.amount,l.currency_code FROM fin_bill_line l " +
"LEFT JOIN fin_fee_source f ON f.id=l.source_id AND f.customer_id=l.tenant_id " +
"WHERE l.tenant_id=? AND l.bill_id=? ORDER BY l.id",
(rs, rowNum) -> new StatementLine(rs.getLong("id"), rs.getString("source_type"), rs.getLong("source_id"), rs.getInt("source_version"),
nullableLong(rs, "order_id"), nullableLong(rs, "inbound_id"), rs.getString("fee_item_code"), rs.getString("fee_item_name"),
nullableLong(rs, "order_id"), nullableLong(rs, "inbound_id"), rs.getString("inbound_code"), rs.getString("fee_item_code"), rs.getString("fee_item_name"),
rs.getBigDecimal("amount"), rs.getString("currency_code")), customerId, billId);
return new StatementDetail(rows.get(0), lines);
}
@@ -79,6 +79,8 @@ class FinancePlatformListContractTest {
"lastReceiptAt", "submittedAt", "reviewedAt", "issuedAt");
assertRecordFields(com.baiyue.finance.dto.FinanceReadModels.Statement.class,
"createdBy", "createdByName", "updatedBy", "updatedByName");
assertRecordFields(com.baiyue.finance.dto.FinanceReadModels.StatementLine.class,
"orderId", "inboundId", "inboundCode", "feeItemName", "amount");
assertRecordFields(com.baiyue.finance.dto.FinanceReadModels.BillRevision.class,
"createdBy", "createdByName");
assertRecordFields(com.baiyue.finance.dto.ReconciliationStatementDtos.ReconciliationDetail.class,