package com.boman.report.controller;

import com.boman.domain.dto.AjaxResult;
import com.boman.domain.dto.ImportDto;
import com.boman.report.service.IImportServcie;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 报表导入
 */
@RestController
@RequestMapping("/cs/file")
public class ImportController {

    @Autowired
    private IImportServcie importServcie;

    /**
     * 功能描述: 导入接口
     *
     * @param importDto     tableName
     * @return void
     */
    @PostMapping("/import")
    public AjaxResult importData(@RequestBody ImportDto importDto) {
        try {
            return importServcie.importData(importDto.getFile(), importDto.getPersonnelId(), importDto.getTableName());
        } catch (Exception e) {
            e.printStackTrace();
        }
        return AjaxResult.error("失败");
    }
}
