|
@@ -1,10 +1,17 @@
|
|
|
package org.dromara.filemanager.controller;
|
|
|
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
|
import jakarta.validation.constraints.*;
|
|
|
+import org.dromara.filemanager.domain.bo.TblArchivesFileBo;
|
|
|
+import org.dromara.filemanager.domain.vo.TblArchivesFileVo;
|
|
|
+import org.dromara.filemanager.service.ITblArchivesFileService;
|
|
|
+import org.dromara.system.domain.SysOss;
|
|
|
+import org.dromara.system.domain.vo.SysOssVo;
|
|
|
import org.dromara.system.service.ISysOssService;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
@@ -36,6 +43,8 @@ public class TblArchivesController extends BaseController {
|
|
|
|
|
|
private final ITblArchivesService tblArchivesService;
|
|
|
|
|
|
+ private final ITblArchivesFileService tblArchivesFileService;
|
|
|
+
|
|
|
|
|
|
private final ISysOssService sysOssService;
|
|
|
|
|
@@ -108,12 +117,33 @@ public class TblArchivesController extends BaseController {
|
|
|
return toAjax(tblArchivesService.deleteWithValidByIds(List.of(ids), true));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 查询电子档案文件列表
|
|
|
+ *
|
|
|
+ * @param id 主键
|
|
|
+ */
|
|
|
@GetMapping("/{id}/files")
|
|
|
- public R<Void> files(@PathVariable Long id) {
|
|
|
-
|
|
|
-// sysOssService.queryPageList()
|
|
|
+ public R<List<SysOssVo>> files(@PathVariable Long id) {
|
|
|
+ TblArchivesFileBo bo = new TblArchivesFileBo();
|
|
|
+ bo.setArchiveId(id);
|
|
|
+ List<TblArchivesFileVo> afiles = tblArchivesFileService.queryList(bo);
|
|
|
+ List<SysOssVo> files = sysOssService.listByIds(afiles.stream().map(t->t.getOssFileId()).toList());
|
|
|
+ return R.ok(files);
|
|
|
+ }
|
|
|
|
|
|
-// return toAjax(tblArchivesService.updateByBo(bo));
|
|
|
+ @PutMapping("/save/{id}/{fileids}")
|
|
|
+ public R<Void> savefiles(@PathVariable Long id,@PathVariable String fileids) {
|
|
|
+ if(!StrUtil.isEmptyIfStr(fileids)){
|
|
|
+ List<TblArchivesFileBo> fileBoList = Arrays.stream(fileids.split(",")).map(t->{
|
|
|
+ TblArchivesFileBo bo = new TblArchivesFileBo();
|
|
|
+ bo.setArchiveId(id);
|
|
|
+ bo.setOssFileId(Long.parseLong(t));
|
|
|
+ return bo;
|
|
|
+ }).toList();
|
|
|
+ tblArchivesFileService.insertBatch(fileBoList);
|
|
|
+ }else{
|
|
|
+ return R.fail("缺少文件!");
|
|
|
+ }
|
|
|
return R.ok();
|
|
|
}
|
|
|
}
|