package com.zt.life.export.controller;
|
|
import com.zt.life.export.dto.WordFile;
|
import com.zt.life.export.service.DownloadService;
|
import com.zt.life.export.service.WordFileService;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.servlet.http.HttpServletResponse;
|
import java.io.*;
|
|
@RestController
|
@RequestMapping("/export")
|
public class ExportController {
|
|
@Autowired
|
WordFileService wordFileService;
|
|
@Value("${zt.oss.local-path}")
|
private String path;
|
|
@GetMapping("module")
|
@ApiOperation("模板导出")
|
public void ExportWord(HttpServletResponse response, @RequestParam String resourcePath,@RequestParam String fileName) throws IOException {
|
// File directory = new File(resourcePath);
|
// String modulePath = directory.getCanonicalPath();
|
path += "template/" + fileName;
|
//String filepath = this.getClass().getResource(fileName).getPath();
|
DownloadService.download(response, path, fileName);
|
}
|
}
|