2025-07-18 16:38:18 +08:00
|
|
|
package com.bjtds.brichat.controller;
|
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.bjtds.brichat.entity.dto.UploadFileDto;
|
|
|
|
import com.bjtds.brichat.service.FileService;
|
|
|
|
import com.bjtds.brichat.util.ResultUtils;
|
|
|
|
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.io.IOException;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 文件上传下载
|
|
|
|
* @author zhoujinghui
|
|
|
|
* @since 2024-1-15 10:45:52
|
|
|
|
*/
|
|
|
|
@RestController
|
|
|
|
@RequestMapping("/fileManage")
|
|
|
|
@CrossOrigin(value = "*",maxAge = 3600)
|
|
|
|
public class FileController {
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private FileService fileService;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 钥匙柜文件上传
|
|
|
|
* @param file 对象
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
@PostMapping("/upload")
|
|
|
|
public ResultUtils upload(@RequestBody MultipartFile file) {
|
|
|
|
String fileName = fileService.fileUpload(file,null);
|
|
|
|
return ResultUtils.success(fileName);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 文件下载
|
|
|
|
* @param uploadFileDto 对象
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
@GetMapping("/download")
|
|
|
|
public void download(UploadFileDto uploadFileDto, HttpServletRequest request, HttpServletResponse response) {
|
|
|
|
fileService.download(uploadFileDto.getFileName(),request,response);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***
|
|
|
|
* @explain: 接收ai组手传过来的pdf文件
|
|
|
|
* @return: com.bjtds.brichat.util.ResultUtils
|
|
|
|
* @author zhoujinghui
|
|
|
|
* @date: 2025/3/31 9:15
|
|
|
|
*/
|
2025-08-07 17:01:06 +08:00
|
|
|
// @PostMapping("/filePreview")
|
|
|
|
// public ResultUtils filePreview(@RequestBody(required = false) Map<String,Object> traceJson) throws IOException {
|
|
|
|
// // return ResultUtils.success(fileService.pdfFileBrowse(jsonObject));
|
|
|
|
// // ResultUtils.success(fileService.genTraceFiles(traceJson));
|
|
|
|
// return ResultUtils.success(ResultUtils.success(fileService.genTraceFiles(traceJson)));
|
|
|
|
// }
|
2025-07-18 16:38:18 +08:00
|
|
|
|
|
|
|
// @GetMapping("/getFilePathList")
|
|
|
|
// public ResultUtils getFilePathList(@RequestParam String userKey) {
|
|
|
|
// return ResultUtils.success(fileService.getFilePathList(userKey));
|
|
|
|
// }
|
|
|
|
|
2025-08-07 17:01:06 +08:00
|
|
|
// @GetMapping("/getTraceFileList")
|
|
|
|
// public ResultUtils getFilePathList(@RequestParam("conversationId") String conversationId,@RequestParam("messageId") String messageId) {
|
|
|
|
// return ResultUtils.success(fileService.getFilePathList(conversationId, messageId));
|
|
|
|
// }
|
2025-07-18 16:38:18 +08:00
|
|
|
|
|
|
|
}
|