|
|
|
@ -7,14 +7,11 @@ 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; |
|
|
|
@ -49,8 +46,6 @@ 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); |
|
|
|
@ -112,8 +107,6 @@ 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); |
|
|
|
|