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