资质证书预览

master
anthonywj 2 years ago
parent 0560a079d9
commit 1c61862ae3

@ -1,5 +1,6 @@
package com.glxp.api.upload;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@ -14,16 +15,18 @@ import java.io.OutputStream;
@RestController
public class DownloadController {
@Value("${file_path}")
private String filePath;
@GetMapping(value = "/udiwms/image/register/file/getImage")
public void getImage(HttpServletResponse response
, @RequestParam String type
, @RequestParam String name) throws IOException {
if (name.endsWith("pdf")) {
if (name.endsWith("pdf") || name.endsWith("doc")) {
OutputStream os = null;
try {
FileInputStream input = new FileInputStream(new File("d:/1s/udiwms/register/file/" + type + "/" + name));
FileInputStream input = new FileInputStream(new File(filePath + "/register/file/" + type + "/" + name));
OutputStream out = response.getOutputStream();
byte[] b = new byte[2048];
int len;
@ -44,7 +47,7 @@ public class DownloadController {
try {
// 读取图片
BufferedImage image = ImageIO.read(
new FileInputStream(new File("d:/1s/udiwms/register/file/" + type + "/" + name)));
new FileInputStream(new File(filePath + "/register/file/" + type + "/" + name)));
response.setContentType("image/png");
os = response.getOutputStream();

Loading…
Cancel
Save