package com.hotwj.platform.workbench.controller;

import cn.dev33.satoken.annotation.SaIgnore;
import com.hotwj.platform.workbench.service.IHotHiddenDangerDailyStatsService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R;
import org.dromara.common.web.core.BaseController;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/workbench/task")
@Tag(name = "日统计任务", description = "手动触发日统计任务")
public class DailyStatsManualController extends BaseController {

    private final IHotHiddenDangerDailyStatsService dailyStatsService;

    @SaIgnore
    @PostMapping("/dailyStats/run")
    @Operation(summary = "手动触发日统计任务（隐患、培训）")
    public R<Void> runDailyStats() {
        dailyStatsService.generateDailyStats();
        return R.ok();
    }
}

