refactor: remove scheduled cron sync, manual trigger only

This commit is contained in:
2026-07-09 10:24:12 +08:00
parent e8dec3b171
commit 731f74e51a
4 changed files with 362 additions and 14 deletions

View File

@@ -49,6 +49,32 @@ export class SyncController {
return this.syncService.getLogs(platform, limit ? Number(limit) : 50);
}
// ── 排班同步 ──
/** 触发排班同步到钉钉考勤排班 */
@Post('schedule/sync')
@RequirePermission('sync:trigger')
async syncSchedule(
@Query('dateFrom') dateFrom?: string,
@Query('days') days?: string,
) {
const result = await this.syncService.syncScheduleToDingTalk(
dateFrom,
days ? parseInt(days, 10) : 30,
);
return { success: true, data: result };
}
/** 查询钉钉排班状态(核对本地 vs 钉钉) */
@Get('schedule/status')
@RequirePermission('sync:read')
async getScheduleStatus(
@Query('date') date?: string,
) {
const status = await this.syncService.getScheduleSyncStatus(date);
return { success: true, data: status };
}
private parseRootDeptId(rootDeptId: string): number {
const parsed = parseInt(rootDeptId, 10);
if (isNaN(parsed)) {