package digital.laboratory.platform.entrustment.controller;

import digital.laboratory.platform.common.core.util.R;
import digital.laboratory.platform.entrustment.service.ExcelUploadService;
import digital.laboratory.platform.entrustment.utils.ExcelUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * @author ChenJiangBao
 * @version 1.0
 * @description: excel上传接口控制器
 * @date 2025/4/16 9:48
 */
@RestController
@RequestMapping("/papp/excel")
@Api(tags = "20-excel上传接口控制器接口管理", description = "excel上传接口控制器接口管理")
public class ExcelUploadController {

    @Resource
    private ExcelUploadService excelUploadService;

    @ApiOperation("上传两社人员名单excel文件")
    @PostMapping("/uploadHairInspect")
    public R<Boolean> uploadHairInspectExcel(@RequestPart("file") MultipartFile file, @RequestParam("entrustId") String entrustId) {
        try {
            Boolean success = excelUploadService.uploadHairInspectExcel(file, entrustId);
            return R.ok(success);
        } catch (Exception e) {
            e.printStackTrace();
            return R.failed(e.getMessage());
        }
    }
}
