File storage and Excel
The three Maven Central components use group com.kaiwuzaidao and version 0.2.0. Use kaiwu-system-starter for platform integration and optional storage, kaiwu-data-scope for row filtering and kaiwu-excel for workbook I/O. Starter · Data scopes · Excel
Bind storage to a project
A platform administrator configures an account in Object Storage. From the entry repository, complete CLI sign-in, then call the System launcher. Substitute your account and project for assets and order-center.
cli=./workspace/kaiwu-system-service/scripts/kaiwu.sh
"$cli" storage accounts
"$cli" storage test assets
"$cli" storage bind order-center --account assets --max-mb 10 --types image/png,image/jpeg
"$cli" storage bindings order-centerIn v0.2.0, Gateway is missing some storage administration routes. If an administrator gets a 404 when listing accounts or bindings, see the Gateway fix.
The probe writes and deletes a test object. Enable storage in the backend and select the kaiwu provider for three built-in safeguards:
- Long-term keys stay inside System: OSS / S3 credentials remain encrypted in System; apps receive only STS temporary credentials scoped to
{bucket}/{projectCode}/*(prefetched and renewed in the background). - File bytes bypass System: Uploads and presigned downloads go straight to object storage so the control plane never becomes a traffic bottleneck.
- Reference-based storage, zero URL lock-in: Business tables store
storage_refandobject_keyrather than full URLs, so existing files remain readable through their original binding while that binding and the objects remain available.
When a project needs a unified file ledger, create a migration from docs/storage-file.sql in the Starter repository and enable StoredFileService for upload confirmation, soft-delete retention, and automated orphan cleanup (kaiwu.file.purge). Enforce ownership and permissions in your business endpoints, test upload/read as a member, verify denial for unauthorized users, and check rejected writes on a READ_ONLY binding. Configuration examples · Registry contract
Import and export an order list
Add com.kaiwuzaidao:kaiwu-excel:0.2.0 in the business domain module. ExcelTable enforces strict safety bounds out of the box—unencrypted single-sheet XLSX only, ordered header contracts, formula rejection, ZIP entry (256) and expanded-size (16 MiB) caps, and fail-fast limits instead of silent truncation. The example binds the workbook to the declared column order. Import com.kaiwu.excel.ExcelTable.
var headers = List.of("Order number", "Amount");
byte[] template = ExcelTable.template(headers);
var rows = ExcelTable.read(file.getInputStream(), headers, 5 * 1024 * 1024, 5000);
var result = ExcelTable.process(rows, row -> validateAndSave(row));Implement validateAndSave in the application and return a safe error message or null. Test the template with one invalid amount and verify the reported row number. For exports reuse the list’s filters, permission checks and row scope. Query at most the limit plus one, reject an oversized result, then call ExcelTable.write. Treat order numbers as text to preserve leading zeros. Supported XLSX format and limits