|
|
@@ -9,10 +9,7 @@ import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
@@ -96,7 +93,21 @@ public class SysFileController
|
|
|
log.error("下载文件失败", e);
|
|
|
throw new RuntimeException(e);
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 路径参数
|
|
|
+ * @param response
|
|
|
+ * @param code
|
|
|
+ */
|
|
|
+ @GetMapping("/getFile/{code}")
|
|
|
+ public void getFile(HttpServletResponse response, @PathVariable String code){
|
|
|
+ try {
|
|
|
+ String filePath = DesUtil.decode(code, secretKey);
|
|
|
+ sysFileService.downloadFile(response,filePath);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("下载文件失败", e);
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
}
|
|
|
}
|