feat: refine deposit room type workflows

This commit is contained in:
2026-07-17 17:36:04 +08:00
parent a5bda6f093
commit b3d0bafc22
11 changed files with 724 additions and 140 deletions

View File

@@ -16,8 +16,8 @@ import { Repository } from 'typeorm';
import { Student } from '../entities/student.entity';
import { DepositsService } from './deposits.service';
import { NotificationsService } from '../notifications/notifications.service';
import { NotificationType } from '../entities/notification.entity';
import {
BatchCreateDepositDto,
CreateDepositDto,
CreateDepositInstallmentDto,
RefundDepositDto,
@@ -44,6 +44,13 @@ export class DepositsController {
return this.service.getStudentLookups();
}
@Get('eligible-students')
@RequirePermission('deposit:view')
getEligibleStudents(@Query('roomType') roomType?: string) {
return this.service.getEligibleStudents(roomType || undefined);
}
@Get()
@RequirePermission('deposit:view')
findAll(
@@ -99,6 +106,25 @@ export class DepositsController {
return result;
}
@Post('batch')
@RequirePermission('deposit:create')
async batchCreate(@Body() dto: BatchCreateDepositDto, @Request() req: any) {
const { ipAddress, userAgent } = extractRequestInfo(req);
const result = await this.service.batchCreate(dto, req.user?.id);
await this.logService.log({
userId: req.user?.id,
username: req.user?.username,
module: '押金管理',
action: '批量收取押金',
targetType: 'deposit',
detail: `批量收取${result.count}人,每人¥${result.amount}${dto.roomType ? `,房型:${dto.roomType}` : ''}${dto.notes ? `,备注:${dto.notes}` : ''}`,
ipAddress,
userAgent,
});
return result;
}
@Post(':id/installments')
@RequirePermission('deposit:edit')
async addInstallment(