|
|
@@ -11,7 +11,6 @@ import com.github.jfcloud.excel.editor.docdeal.bean.FileUpload;
|
|
|
import com.github.jfcloud.excel.editor.docdeal.bean.PreviewVo;
|
|
|
import com.github.jfcloud.excel.editor.docdeal.oss.OssProperties;
|
|
|
import com.github.jfcloud.excel.editor.docdeal.oss.service.OssTemplate;
|
|
|
-import com.github.jfcloud.excel.editor.docdeal.service.FileUploadService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
@@ -20,8 +19,6 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.IOException;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
|
|
|
@Slf4j
|
|
|
@Controller
|
|
|
@@ -31,9 +28,6 @@ public class FileController {
|
|
|
@Autowired
|
|
|
OssProperties ossProperties;
|
|
|
|
|
|
- @Autowired
|
|
|
- private FileUploadService uploadService;
|
|
|
-
|
|
|
@ResponseBody
|
|
|
@PostMapping(value = "upload")
|
|
|
public FileUpload upload(@RequestPart("file") MultipartFile file, @RequestParam(required = false) String bucket) throws Exception {
|
|
|
@@ -52,13 +46,10 @@ public class FileController {
|
|
|
log.info("上传文档已保存,bucket={} name={}", bucket, fileName);
|
|
|
|
|
|
FileUpload upload = new FileUpload();
|
|
|
- upload.setUploadDate(new Date());
|
|
|
upload.setFileType(FileNameUtil.getSuffix(fileName));
|
|
|
upload.setFilePath(String.format("/admin/sys-file/%s/%s", bucket, fileName));
|
|
|
upload.setFileName(file.getOriginalFilename());
|
|
|
upload.setFileSize(file.getSize());
|
|
|
- uploadService.save(upload);
|
|
|
-
|
|
|
return upload;
|
|
|
}
|
|
|
|
|
|
@@ -102,15 +93,4 @@ public class FileController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 查询所有上传文档信息接口
|
|
|
- *
|
|
|
- * @return
|
|
|
- */
|
|
|
- @GetMapping("/filelist")
|
|
|
- @ResponseBody
|
|
|
- public List<FileUpload> listFile() {
|
|
|
- return uploadService.lambdaQuery().orderByDesc(FileUpload::getUploadDate).list();
|
|
|
- }
|
|
|
-
|
|
|
}
|