feat: streamline occupancy check-in and imports

This commit is contained in:
2026-07-14 12:23:53 +08:00
parent 718c58589f
commit d84f37e98f
11 changed files with 322 additions and 78 deletions

View File

@@ -77,7 +77,7 @@ export class OccupanciesController {
@RequirePermission('occupancy:checkin')
async checkIn(@Body() dto: CheckInDto, @Request() req: any) {
const { ipAddress, userAgent } = extractRequestInfo(req);
const result = await this.service.checkIn(dto);
const result = await this.service.checkIn(dto, req.user?.id);
await this.logService.log({
userId: req.user?.id,
username: req.user?.username,
@@ -201,17 +201,20 @@ export class OccupanciesController {
ws.columns = [
{ header: '宿舍号', key: 'roomNumber', width: 12 },
{ header: '楼栋', key: 'building', width: 12 },
{ header: '床位号', key: 'bedNumber', width: 10 },
{ header: '柜子号', key: 'lockerNumber', width: 10 },
{ header: '学生姓名', key: 'studentName', width: 12 },
{ header: '性别', key: 'gender', width: 8 },
{ header: '电话', key: 'phone', width: 18 },
{ header: '学号/身份证', key: 'idNumber', width: 22 },
{ header: '所属机构', key: 'organization', width: 18 },
{ header: '负责人/班主任', key: 'supervisor', width: 15 },
{ header: '入住日期', key: 'checkInDate', width: 14 },
{ header: '退宿日期', key: 'checkOutDate', width: 14 },
{ header: '计费起始', key: 'billingStartDate', width: 14 },
{ header: '计费截止', key: 'billingEndDate', width: 14 },
{ header: '退宿原因', key: 'checkOutReason', width: 12 },
{ header: '入住类型', key: 'stayType', width: 10 },
{ header: '退宿原因', key: 'checkOutReason', width: 16 },
{ header: '备注', key: 'notes', width: 24 },
];
ws.getRow(1).font = { bold: true };
ws.getRow(1).fill = { type: 'pattern', pattern: 'solid', fgColor: { argb: 'FFE0E0E0' } };
@@ -219,17 +222,20 @@ export class OccupanciesController {
ws.addRow({
roomNumber: r.room?.roomNumber || '',
building: r.room?.building || '',
bedNumber: r.bed?.bedNumber || '',
lockerNumber: r.locker?.lockerNumber || '',
studentName: r.student?.name || '',
gender: r.student?.gender || '',
phone: r.student?.phone || '',
idNumber: r.student?.idNumber || '',
organization: r.student?.organization?.name || '',
supervisor: r.student?.supervisor || '',
checkInDate: r.checkInDate || '',
checkOutDate: r.checkOutDate || '',
billingStartDate: r.billingStartDate || '',
billingEndDate: r.billingEndDate || '',
stayType: r.stayType === 'long' ? '长租' : '短租',
checkOutReason: r.checkOutReason || '',
notes: r.notes || '',
});
}
res!.setHeader(