package com.hdkj.lt.job.controller;

import com.hdkj.hussar.ApiResponse;
import com.hdkj.lt.job.service.IDistOSSSvgFileService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotBlank;

/**
 * @Description
 * @Author wcx
 * @Date 2025/6/25 8:59
 * @Version 1.0
 */
@Validated
@RestController
@RequiredArgsConstructor
public class DistOSSSvgFileController {

    private final IDistOSSSvgFileService distOSSSvgFileService;

    @GetMapping("getAndSaveFile")
    public ApiResponse<String> getAndSaveFileInfo(@NotBlank(message = "文件夹不能为空") String fileDir) {
        distOSSSvgFileService.getAndSaveFileInfo(fileDir);
        return ApiResponse.success("获取配电云主站并保存文件操作成功");
    }

    @GetMapping("batchSaveFile")
    public ApiResponse<String> batchSaveFile(@NotBlank(message = "文件夹不能为空") String fileDir) {
        distOSSSvgFileService.saveBatchFileInfo(fileDir);
        return ApiResponse.success("获取配电云主站并下载文件操作成功");
    }
}
