From 3fac36b394206df5f8002fa32bd360021fec743f Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期四, 09 二月 2023 19:13:13 +0800
Subject: [PATCH] 1

---
 src/main/java/com/lf/server/controller/sys/ReportController.java |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/lf/server/controller/sys/ReportController.java b/src/main/java/com/lf/server/controller/sys/ReportController.java
index e8c033e..37918ec 100644
--- a/src/main/java/com/lf/server/controller/sys/ReportController.java
+++ b/src/main/java/com/lf/server/controller/sys/ReportController.java
@@ -5,6 +5,7 @@
 import com.lf.server.entity.all.ResponseMsg;
 import com.lf.server.entity.sys.ReportEntity;
 import com.lf.server.entity.sys.UserEntity;
+import com.lf.server.service.all.UploadAttachService;
 import com.lf.server.service.sys.ReportService;
 import com.lf.server.service.sys.TokenService;
 import io.swagger.annotations.Api;
@@ -13,8 +14,10 @@
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 
 /**
@@ -30,6 +33,11 @@
 
     @Autowired
     TokenService tokenService;
+
+    @Autowired
+    UploadAttachService uploadAttachService;
+
+    private final static String TAB_NAME = "lf.sys_report";
 
     @SysLog()
     @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟")
@@ -165,4 +173,24 @@
             return fail(ex.getMessage(), -1);
         }
     }
+
+    @SysLog()
+    @ApiOperation(value = "涓婁紶鏂囦欢")
+    @ResponseBody
+    @PostMapping(value = "/upload")
+    public ResponseMsg<String> upload(@RequestParam("file") MultipartFile file, HttpServletRequest req) {
+        UserEntity ue = tokenService.getCurrentUser(req);
+
+        return uploadAttachService.upload(ue, TAB_NAME, file, this);
+    }
+
+    @SysLog()
+    @ApiOperation(value = "涓嬭浇鏂囦欢")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "guid", value = "闄勪欢Guid", dataType = "String", paramType = "body")
+    })
+    @GetMapping(value = "/download")
+    public void download(String guid, HttpServletResponse res) {
+        uploadAttachService.download(guid, res);
+    }
 }

--
Gitblit v1.9.3