feat: support WPS report material workbooks

This commit is contained in:
hectorzhao
2026-09-04 17:10:04 +08:00
parent 48d0363920
commit fb39c8b606
29 changed files with 2737 additions and 734 deletions
@@ -93,7 +93,9 @@ export class ReportMaterialsController {
}
@Post('imports/analyze')
@UseInterceptors(FileInterceptor('file', { limits: { fileSize: 10 * 1024 * 1024, files: 1, fields: 12, parts: 13 } }))
@UseInterceptors(
FileInterceptor('file', { limits: { fileSize: 100 * 1024 * 1024, files: 1, fields: 12, parts: 13 } }),
)
analyzeImport(
@UploadedFile() file: UploadedWorkbook,
@Body() body: Record<string, string>,
@@ -102,7 +104,7 @@ export class ReportMaterialsController {
if (!file) throw new BadRequestException('请选择 XLSX 文件');
return this.service.analyzeImport(file, {
tenantId: body.tenantId,
applicationId: body.applicationId || undefined,
applicationId: body.applicationId,
reportType: body.reportType as 'signature' | 'drainage',
sheetName: body.sheetName || undefined,
headerRowCount: Number(body.headerRowCount || 1),
@@ -161,13 +163,25 @@ export class ReportMaterialsController {
}
@Get('batches/:id/download')
async downloadBatch(@Param('id') id: string, @Res() response: DownloadResponse) {
this.sendDownload(response, await this.batchDownloads.exportBundle(await this.service.getBatch(id)));
async downloadBatch(
@Param('id') id: string,
@Query('outputFormat') outputFormat: 'excel_drawing' | 'wps_cell_image' | undefined,
@Res() response: DownloadResponse,
) {
this.sendDownload(response, await this.batchDownloads.exportBundle(await this.service.getBatch(id), outputFormat));
}
@Get('batches/:id/files/:fileId/download')
async downloadBatchFile(@Param('id') id: string, @Param('fileId') fileId: string, @Res() response: DownloadResponse) {
this.sendDownload(response, await this.batchDownloads.exportFile(await this.service.getBatch(id), fileId));
async downloadBatchFile(
@Param('id') id: string,
@Param('fileId') fileId: string,
@Query('outputFormat') outputFormat: 'excel_drawing' | 'wps_cell_image' | undefined,
@Res() response: DownloadResponse,
) {
this.sendDownload(
response,
await this.batchDownloads.exportFile(await this.service.getBatch(id), fileId, outputFormat),
);
}
@Get('batches/:id')