添加文件审批

master
xiong_cl 8 months ago
parent b7caa407fb
commit abf16522a4
  1. 22
      shandan-system/src/main/java/com/keyware/shandan/bianmu/service/impl/ReviewRecordServiceImpl.java

@ -165,6 +165,21 @@ public class ReviewRecordServiceImpl extends BaseServiceImpl<ReviewRecordMapper,
return true; return true;
} }
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean directoryFileReview(String id, ReviewStatus status, String opinion, Boolean sendNotice) {
ReviewEntityType type = ReviewEntityType.FILE;
DirectoryVo dir = directoryService.getById(id);
Assert.notNull(dir, "数据资源审核异常,数据未找到!id=" + id);
dir.setReviewStatus(status);
directoryService.updateById(dir);
//保存审核记录
ReviewRecordVo record = saveReviewRecord(id, type, status, opinion);
if (sendNotice) {
notificationService.sendNotification(newReviewNotify(record, dir.getDirectoryName(), dir.getDirectoryName()));
}
return true;
}
private ReviewRecordVo saveReviewRecord(String entityId, ReviewEntityType entityType, ReviewStatus reviewOperate, String reviewOpinion) { private ReviewRecordVo saveReviewRecord(String entityId, ReviewEntityType entityType, ReviewStatus reviewOperate, String reviewOpinion) {
ReviewRecordVo record = new ReviewRecordVo(entityId, entityType, reviewOperate, reviewOpinion); ReviewRecordVo record = new ReviewRecordVo(entityId, entityType, reviewOperate, reviewOpinion);
@ -225,10 +240,13 @@ public class ReviewRecordServiceImpl extends BaseServiceImpl<ReviewRecordMapper,
private List<DirectoryVo> updateDirAndChildrenStatus(DirectoryVo dir, ReviewStatus status) { private List<DirectoryVo> updateDirAndChildrenStatus(DirectoryVo dir, ReviewStatus status) {
QueryWrapper<DirectoryVo> wrapper = new QueryWrapper<>(); QueryWrapper<DirectoryVo> wrapper = new QueryWrapper<>();
wrapper.likeRight("DIRECTORY_PATH", dir.getDirectoryPath() + "/").in("DIRECTORY_TYPE", DirectoryType.DIRECTORY, DirectoryType.LINK_DIR); wrapper.likeRight("DIRECTORY_PATH", dir.getDirectoryPath() + "/").in("DIRECTORY_TYPE", DirectoryType.DIRECTORY, DirectoryType.LINK_DIR,DirectoryType.FILE);
List<DirectoryVo> list = directoryService.list(wrapper); List<DirectoryVo> list = directoryService.list(wrapper);
list.add(dir); list.add(dir);
list.forEach(item -> item.setReviewStatus(status)); //提交文件时将文件状态改成PASS
list.forEach(item -> {
item.setReviewStatus("FILE".equals(item.getDirectoryType().getValue()) && "SUBMITTED".equals(status.getValue()) ? ReviewStatus.valueOf("PASS") : status);
});
directoryService.saveOrUpdateBatch(list); directoryService.saveOrUpdateBatch(list);
return list; return list;
} }