在数据管控系统中目录审核页面添加文件批量驳回功能

master
xiong_cl 8 months ago
parent e30087346a
commit de2226e307
  1. 5
      shandan-system/src/main/java/com/keyware/shandan/bianmu/controller/MetadataCommonController.java
  2. 53
      shandan-system/src/main/java/com/keyware/shandan/bianmu/controller/ReviewRecordController.java

@ -121,12 +121,11 @@ public class MetadataCommonController {
*/ */
@GetMapping("/list/directory") @GetMapping("/list/directory")
@Transactional(readOnly = true) @Transactional(readOnly = true)
public Result<Page<DirectoryResource>> listByDirectory(Page<DirectoryResource> page, String directoryId, String resourceName, boolean allChild) { public Result<Page<DirectoryResource>> listByDirectory(Page<DirectoryResource> page, String directoryId, String resourceName, boolean allChild,String reviewStatus) {
if (StringUtils.isBlank(directoryId)) { if (StringUtils.isBlank(directoryId)) {
return Result.of(null, false, "参数不能为空"); return Result.of(null, false, "参数不能为空");
} }
Page<DirectoryResource> result = treeService.resourcePage(page, directoryId, resourceName, allChild,reviewStatus);
Page<DirectoryResource> result = treeService.resourcePage(page, directoryId, resourceName, allChild);
StreamUtil.as(result.getRecords()).peek(item -> { StreamUtil.as(result.getRecords()).peek(item -> {
if (StringUtils.hasText(item.getDirectoryPath())) { if (StringUtils.hasText(item.getDirectoryPath())) {
int i = item.getDirectoryPath().lastIndexOf("/"); int i = item.getDirectoryPath().lastIndexOf("/");

@ -6,6 +6,7 @@ import com.keyware.shandan.bianmu.entity.DirectoryVo;
import com.keyware.shandan.bianmu.entity.MetadataBasicVo; import com.keyware.shandan.bianmu.entity.MetadataBasicVo;
import com.keyware.shandan.bianmu.entity.ReviewRecordVo; import com.keyware.shandan.bianmu.entity.ReviewRecordVo;
import com.keyware.shandan.bianmu.enums.ReviewStatus; import com.keyware.shandan.bianmu.enums.ReviewStatus;
import com.keyware.shandan.bianmu.service.DirPermissionService;
import com.keyware.shandan.bianmu.service.DirectoryService; import com.keyware.shandan.bianmu.service.DirectoryService;
import com.keyware.shandan.bianmu.service.MetadataService; import com.keyware.shandan.bianmu.service.MetadataService;
import com.keyware.shandan.bianmu.service.ReviewRecordService; import com.keyware.shandan.bianmu.service.ReviewRecordService;
@ -13,10 +14,13 @@ import com.keyware.shandan.common.constants.DirConstant;
import com.keyware.shandan.common.controller.BaseController; import com.keyware.shandan.common.controller.BaseController;
import com.keyware.shandan.common.entity.Result; import com.keyware.shandan.common.entity.Result;
import com.keyware.shandan.common.util.StringUtils; import com.keyware.shandan.common.util.StringUtils;
import com.keyware.shandan.frame.config.security.SecurityUtil;
import com.keyware.shandan.system.entity.SysUser;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import java.util.Arrays;
import java.util.List; import java.util.List;
/** /**
@ -40,14 +44,23 @@ public class ReviewRecordController extends BaseController<ReviewRecordService,
@Autowired @Autowired
private DirectoryService directoryService; private DirectoryService directoryService;
@Autowired
private DirPermissionService dirPermissionService;
/** /**
* 目录审核页面 * 目录审核页面
* *
* @return * @return
*/ */
@GetMapping("/directory") @GetMapping("/directory")
public ModelAndView directoryReview() { public ModelAndView directoryReview(ModelAndView modelAndView) {
return new ModelAndView("review/directoryReview"); modelAndView.setViewName("review/directoryReview");
SysUser user = SecurityUtil.getLoginSysUser();
dirPermissionService.refreshCache();
modelAndView.addObject("readDirIds", dirPermissionService.getByReadPermis(user));
modelAndView.addObject("writeDirIds", dirPermissionService.getByWritePermis(user));
return modelAndView;
//return new ModelAndView("review/directoryReview");
} }
/** /**
@ -149,6 +162,42 @@ public class ReviewRecordController extends BaseController<ReviewRecordService,
} }
} }
/**
* 资源目录文件提交审核
*
* @param ids 主键
* @param status 要变更的审核状态
* @param opinion 审核意见
* @param sendNotice 是否发送通知
* @return 请求结果
*
* xiongcl 20240412
*/
@PostMapping("/directory/file/change")
public Result<Object> directoryFileSubmit(String ids, String status, String opinion, boolean sendNotice) {
if (StringUtils.isBlankAny(ids, status)) {
return Result.of(null, false, "参数错误");
}
try {
ReviewStatus reviewStatus = ReviewStatus.valueOf(status);
Arrays.stream(ids.split(",")).forEach(id -> {
try {
reviewRecordService.directoryFileReview(id, reviewStatus, opinion, sendNotice);
} catch (Exception e) {
throw new RuntimeException(e);
}
});
return Result.of(true, true);
} catch (RuntimeException e) {
e.printStackTrace();
return Result.of(false, false, e.getMessage());
}catch (Exception e) {
e.printStackTrace();
return Result.of(false, false, e.getMessage());
}
}
/** /**
* 根据数据实体ID获取最后一次审核记录 * 根据数据实体ID获取最后一次审核记录
* *