feat: complete reporting and filing workflows

This commit is contained in:
hectorzhao
2026-07-28 20:28:47 +08:00
parent 352a6293b4
commit 99c8c7c68b
52 changed files with 3490 additions and 376 deletions
@@ -3,7 +3,7 @@ import { FileInterceptor } from '@nestjs/platform-express';
import { ApiTags } from '@nestjs/swagger';
import { RequireRecentAuthentication } from '../auth/require-recent-authentication.decorator';
import { CurrentSessionUserId } from '../auth/current-session-user.decorator';
import { CreateImportProfileDto, CreateReportBatchDto, ImportCommitDto, ReportMaterialsService } from './report-materials.service';
import { CreateImportProfileDto, CreateReportBatchDto, ImportCommitDto, ReportMaterialsService, ReviewImportItemsDto } from './report-materials.service';
type UploadedWorkbook = { originalname: string; mimetype: string; size: number; buffer: Buffer };
type DownloadResponse = { setHeader(name: string, value: string): void; send(content: Buffer): void };
@@ -14,8 +14,17 @@ export class ReportMaterialsController {
constructor(private readonly service: ReportMaterialsService) {}
@Get('pending')
listPending(@Query('reportType') reportType?: 'signature' | 'drainage', @Query('tenantId') tenantId?: string, @Query('applicationId') applicationId?: string) {
return this.service.listPending({ reportType, tenantId, applicationId });
listPending(
@Query('reportType') reportType?: 'signature' | 'drainage',
@Query('tenantId') tenantId?: string,
@Query('applicationId') applicationId?: string,
@Query('keyword') keyword?: string,
@Query('startAt') startAt?: string,
@Query('endAt') endAt?: string,
@Query('page') page?: string,
@Query('pageSize') pageSize?: string,
) {
return this.service.listPending({ reportType, tenantId, applicationId, keyword, startAt, endAt, page: Number(page), pageSize: Number(pageSize) });
}
@Get('templates/:reportType')
@@ -62,9 +71,34 @@ export class ReportMaterialsController {
return this.service.commitImport(id, { ...body, operatorId });
}
@Get('imports/review-batches')
listImportReviewBatches(
@Query('reportType') reportType?: 'signature' | 'drainage',
@Query('status') status?: string,
@Query('keyword') keyword?: string,
@Query('startAt') startAt?: string,
@Query('endAt') endAt?: string,
@Query('page') page?: string,
@Query('pageSize') pageSize?: string,
) {
return this.service.listImportReviewBatches({ reportType, status, keyword, startAt, endAt, page: Number(page), pageSize: Number(pageSize) });
}
@Post('imports/:id/review')
@RequireRecentAuthentication()
reviewImportItems(@Param('id') id: string, @Body() body: ReviewImportItemsDto, @CurrentSessionUserId() reviewerId?: string) {
return this.service.reviewImportItems(id, { ...body, reviewerId });
}
@Get('batches')
listBatches() {
return this.service.listBatches();
listBatches(
@Query('keyword') keyword?: string,
@Query('startAt') startAt?: string,
@Query('endAt') endAt?: string,
@Query('page') page?: string,
@Query('pageSize') pageSize?: string,
) {
return this.service.listBatches({ keyword, startAt, endAt, page: Number(page), pageSize: Number(pageSize) });
}
@Post('batches/preflight')