package com.rongwei.controller;

import com.rongwei.bscommon.sys.service.impl.ExportServiceImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;

@RestController
@RequestMapping("/export")
public class ExportController {
    private final Logger log = LoggerFactory.getLogger(this.getClass().getName());
    @Autowired
    private ExportServiceImpl exportService;

    /**
     * 根据Id 导出8D问题
     *
     * @param id
     * @return
     */
    @PostMapping("/excel/8d")
    public void export8dExcel(@RequestParam String id, HttpServletResponse response) {
        log.info("接口入参：{}", id);
        exportService.export8dExcel(id, response);
    }

    /**
     * 根据Id 导出问题跟踪解决
     *
     * @param id
     * @return
     */
    @PostMapping("/word/ptar")
    public void exportProblemTrackingAndResolutionWord(@RequestParam String id, HttpServletResponse response) {
        log.info("接口入参：{}", id);
        exportService.exportProblemTrackingAndResolutionWord(id, response);
    }
}
