|
@@ -1,12 +1,13 @@
|
|
|
package org.dromara.filemanager.controller;
|
|
|
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
|
import jakarta.validation.constraints.*;
|
|
|
+import org.dromara.filemanager.domain.TblArchives;
|
|
|
import org.dromara.filemanager.domain.bo.TblArchivesFileBo;
|
|
|
import org.dromara.filemanager.domain.vo.TblArchivesFileVo;
|
|
|
import org.dromara.filemanager.service.ITblArchivesFileService;
|
|
@@ -134,13 +135,49 @@ public class TblArchivesController extends BaseController {
|
|
|
@PutMapping("/save/{id}/{fileids}")
|
|
|
public R<Void> savefiles(@PathVariable Long id,@PathVariable String fileids) {
|
|
|
if(!StrUtil.isEmptyIfStr(fileids)){
|
|
|
+
|
|
|
+ Map<String,Object> newfiles = new HashMap<>();
|
|
|
+ List<String> filelist = new ArrayList<>();
|
|
|
+
|
|
|
List<TblArchivesFileBo> fileBoList = Arrays.stream(fileids.split(",")).map(t->{
|
|
|
TblArchivesFileBo bo = new TblArchivesFileBo();
|
|
|
bo.setArchiveId(id);
|
|
|
bo.setOssFileId(Long.parseLong(t));
|
|
|
+ filelist.add(t);
|
|
|
return bo;
|
|
|
}).toList();
|
|
|
- tblArchivesFileService.insertBatch(fileBoList);
|
|
|
+ tblArchivesFileService.insertBatch(fileBoList);
|
|
|
+
|
|
|
+
|
|
|
+ try{
|
|
|
+ TblArchivesBo projectnew = new TblArchivesBo();
|
|
|
+
|
|
|
+ //新增文件变跟待审核
|
|
|
+ TblArchivesVo project = tblArchivesService.queryById(id);
|
|
|
+ projectnew.setId(project.getId());
|
|
|
+ if(project.getExt2()!=null){
|
|
|
+ newfiles = JSONUtil.parseObj(project.getExt2());
|
|
|
+ }
|
|
|
+ if(newfiles.get("newfile")!=null){
|
|
|
+ List<String> newfilelist = (List<String>) newfiles.get("newfile");
|
|
|
+ newfilelist.addAll(filelist);
|
|
|
+ newfiles.put("newfile",newfilelist);
|
|
|
+ }else{
|
|
|
+ newfiles.put("newfile",filelist);
|
|
|
+ }
|
|
|
+ projectnew.setExt2(JSONUtil.toJsonStr(newfiles));
|
|
|
+ if(project.getStatus().equals("3")||project.getStatus().equals("4")){
|
|
|
+ //待提交与未通过均不改变状态
|
|
|
+ }else{
|
|
|
+ projectnew.setStatus("2");
|
|
|
+ }
|
|
|
+ tblArchivesService.updateByBo(projectnew);
|
|
|
+
|
|
|
+ }catch (Exception e){
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}else{
|
|
|
return R.fail("缺少文件!");
|
|
|
}
|