11.11下载文件

dev
xiaohuo 8 months ago
parent 083f8e4ea2
commit 91b37cfe52
  1. 7
      ALOps_sys_backend/alops-admin/src/main/java/com/alops/web/controller/LlmKnowledgeController/FileController.java

@ -7,11 +7,14 @@ import javax.servlet.http.HttpServletResponse;
import com.alops.chat.entity.UploadedFile; import com.alops.chat.entity.UploadedFile;
import com.alops.chat.service.UploadedFileService; import com.alops.chat.service.UploadedFileService;
import com.alops.common.annotation.Log;
import com.alops.common.config.RuoYiConfig; import com.alops.common.config.RuoYiConfig;
import com.alops.common.core.controller.BaseController; import com.alops.common.core.controller.BaseController;
import com.alops.common.enums.BusinessType;
import com.alops.common.utils.file.FileUtils; import com.alops.common.utils.file.FileUtils;
import com.alops.common.utils.file.FileTypeUtils; import com.alops.common.utils.file.FileTypeUtils;
import com.alops.common.utils.StringUtils; import com.alops.common.utils.StringUtils;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -46,6 +49,8 @@ public class FileController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('QandA:knowledge:filedownload')") @PreAuthorize("@ss.hasPermi('QandA:knowledge:filedownload')")
@GetMapping("/download/{fileId}") @GetMapping("/download/{fileId}")
@Log(title = "下载文件", businessType = BusinessType.EXPORT)
@ApiOperation("下载文件")
public void download(@PathVariable Long fileId, HttpServletResponse response, HttpServletRequest request) { public void download(@PathVariable Long fileId, HttpServletResponse response, HttpServletRequest request) {
try { try {
UploadedFile uploadedFile = uploadedFileService.findById(fileId); UploadedFile uploadedFile = uploadedFileService.findById(fileId);
@ -107,6 +112,8 @@ public class FileController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('QandA:knowledge:filepreview')") @PreAuthorize("@ss.hasPermi('QandA:knowledge:filepreview')")
@GetMapping("/preview/{fileId}") @GetMapping("/preview/{fileId}")
@ApiOperation("预览文件")
@Log(title = "预览文件", businessType = BusinessType.SELECT)
public void preview(@PathVariable Long fileId, HttpServletResponse response, HttpServletRequest request) { public void preview(@PathVariable Long fileId, HttpServletResponse response, HttpServletRequest request) {
try { try {
UploadedFile uploadedFile = uploadedFileService.findById(fileId); UploadedFile uploadedFile = uploadedFileService.findById(fileId);

Loading…
Cancel
Save