|
|
@@ -4,16 +4,18 @@ import cn.hutool.core.lang.Dict;
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.yingpaipay.business.constant.*;
|
|
|
-import com.yingpaipay.business.domain.DocumentAuditLog;
|
|
|
-import com.yingpaipay.business.domain.Folder;
|
|
|
-import com.yingpaipay.business.domain.Project;
|
|
|
+import com.yingpaipay.business.domain.*;
|
|
|
import com.yingpaipay.business.domain.bo.*;
|
|
|
import com.yingpaipay.business.domain.excel.ProjectExcel;
|
|
|
import com.yingpaipay.business.domain.vo.*;
|
|
|
import com.yingpaipay.business.enumeration.DocumentStatusEnum;
|
|
|
import com.yingpaipay.business.enumeration.MailTemplateEnum;
|
|
|
import com.yingpaipay.business.mapper.DocumentAuditLogMapper;
|
|
|
+import com.yingpaipay.business.service.IFolderKeywordService;
|
|
|
+import com.yingpaipay.common.mabatis.utils.WrapperUtils;
|
|
|
import com.yingpaipay.common.file.util.PdfUtils;
|
|
|
+import com.yingpaipay.setting.domain.vo.KeywordSettingVo;
|
|
|
+import com.yingpaipay.setting.service.IKeywordSettingService;
|
|
|
import com.yingpaipay.system.mapper.SysUserFoldersMapper;
|
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
|
import org.apache.commons.io.FilenameUtils;
|
|
|
@@ -47,7 +49,6 @@ import org.dromara.system.service.ISysUserService;
|
|
|
import org.springframework.context.i18n.LocaleContextHolder;
|
|
|
import org.springframework.http.MediaType;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-import com.yingpaipay.business.domain.Document;
|
|
|
import com.yingpaipay.business.mapper.DocumentMapper;
|
|
|
import com.yingpaipay.business.service.IDocumentService;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
@@ -83,6 +84,8 @@ public class DocumentServiceImpl implements IDocumentService {
|
|
|
private final ISysUserService userService;
|
|
|
private final CommonFolderService folderService;
|
|
|
private final CommonProjectService projectService;
|
|
|
+ private final IFolderKeywordService folderKeywordService;
|
|
|
+ private final IKeywordSettingService keywordSettingService;
|
|
|
|
|
|
/**
|
|
|
* 水印的锁
|
|
|
@@ -592,10 +595,12 @@ public class DocumentServiceImpl implements IDocumentService {
|
|
|
@Override
|
|
|
public AppletMineCountVo getCount() {
|
|
|
AppletMineCountVo vo = new AppletMineCountVo();
|
|
|
+ List<Long> projects = projectService.queryUnderway().stream().map(Project::getId).toList();
|
|
|
List<Document> documentList = baseMapper.selectList(
|
|
|
Wrappers.lambdaQuery(Document.class)
|
|
|
.eq(Document::getPlanSubmitter, LoginHelper.getUserId())
|
|
|
.in(Document::getStatus, List.of(DocumentStatusEnum.UN_UPLOAD.getValue(), DocumentStatusEnum.UN_AUDIT.getValue(), DocumentStatusEnum.AUDIT_REJECT.getValue()))
|
|
|
+ .in(Document::getProjectId, WrapperUtils.convertIds(projects))
|
|
|
);
|
|
|
vo.setToSubmit(
|
|
|
documentList
|
|
|
@@ -659,10 +664,12 @@ public class DocumentServiceImpl implements IDocumentService {
|
|
|
|
|
|
@Override
|
|
|
public TableDataInfo<AppletDocumentScanSubmitVo> listToSubmit(AppletDocumentScanSubmitBo bo, PageQuery pageQuery) {
|
|
|
+
|
|
|
IPage<Document> page = baseMapper.selectPage(
|
|
|
pageQuery.build(),
|
|
|
Wrappers.lambdaQuery(Document.class)
|
|
|
.eq(Document::getPlanSubmitter, LoginHelper.getUserId())
|
|
|
+ .in(Document::getProjectId, WrapperUtils.convertIds(projectService.queryUnderway().stream().map(Project::getId).toList()))
|
|
|
.in(Document::getStatus, List.of(DocumentStatusEnum.UN_UPLOAD.getValue(), DocumentStatusEnum.AUDIT_REJECT.getValue()))
|
|
|
.like(StringUtils.isNotBlank(bo.getName()), Document::getName, bo.getName())
|
|
|
.orderByDesc(Document::getId)
|
|
|
@@ -836,24 +843,60 @@ public class DocumentServiceImpl implements IDocumentService {
|
|
|
}
|
|
|
SysOssVo ossVo = ossService.upload(file);
|
|
|
|
|
|
+ /**
|
|
|
+ * 先确认文件夹
|
|
|
+ */
|
|
|
List<Folder> folders = folderService.queryByProjectIds(List.of(bo.getProjectId()));
|
|
|
- Map<Long, Folder> folderMap = new HashMap<>();
|
|
|
- folders.forEach(e -> folderMap.put(e.getId(), e));
|
|
|
+// List<Long> folderIds = new ArrayList<>();
|
|
|
+// Map<Long, Folder> folderMap = new HashMap<>();
|
|
|
+// folders.forEach(e -> {
|
|
|
+// folderMap.put(e.getId(), e);
|
|
|
+// folderIds.add(e.getId());
|
|
|
+// });
|
|
|
Map<Long, List<Folder>> childrenMap = folders.stream().filter(e -> e.getParentId() != null).collect(Collectors.groupingBy(Folder::getParentId));
|
|
|
List<Long> selected = new ArrayList<>();
|
|
|
+ // 确认层级 -> 项目、国家、中心
|
|
|
if (bo.getCenter() != 0L) {
|
|
|
- buildFolders(selected, folderMap.get(bo.getCenter()), childrenMap);
|
|
|
+ List<Folder> list = childrenMap.get(bo.getCenter());
|
|
|
+ for (Folder folder : list) {
|
|
|
+ buildFolders(selected, folder, childrenMap);
|
|
|
+ }
|
|
|
+ } else if (bo.getCountry() != 0L) {
|
|
|
+ List<Folder> list = childrenMap.get(bo.getCountry());
|
|
|
+ for (Folder folder : list) {
|
|
|
+ if (!folder.getType().equals(FolderTypeConst.CENTER)) {
|
|
|
+ buildFolders(selected, folder, childrenMap);
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {
|
|
|
- if (bo.getCountry() != 0L) {
|
|
|
- buildFolders(selected, folderMap.get(bo.getCountry()), childrenMap);
|
|
|
- } else {
|
|
|
- selected = folders.stream().map(Folder::getId).toList();
|
|
|
+ List<Folder> list = folders.stream().filter(e -> e.getParentId() == null).filter(e -> e.getType().equals(FolderTypeConst.NORMAL)).toList();
|
|
|
+ for (Folder folder : list) {
|
|
|
+ if (!folder.getType().equals(FolderTypeConst.CENTER)) {
|
|
|
+ buildFolders(selected, folder, childrenMap);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ // 正式开始锁定
|
|
|
+ Long folderId, keyword = null;
|
|
|
+ String[] strs = bo.getName().split("-");
|
|
|
+ List<KeywordSettingVo> words = keywordSettingService.list();
|
|
|
+ for (KeywordSettingVo word : words) {
|
|
|
+ if (strs[DocumentNameConst.SPECIFIC_NAME].contains(word.getContent())) {
|
|
|
+ keyword = word.getId();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ folderId = folderKeywordService.getByKeywordAndFolderIds(selected, keyword);
|
|
|
+ if (folderId == null) {
|
|
|
+ folderId = bo.getCenter() != null ? bo.getCenter() : bo.getCountry() != null ? bo.getCountry() : 0L;
|
|
|
+ }
|
|
|
+
|
|
|
List<Document> documents = baseMapper.selectList(
|
|
|
Wrappers.lambdaQuery(Document.class)
|
|
|
- .in(Document::getFolderId, selected)
|
|
|
+ .eq(Document::getFolderId, folderId)
|
|
|
);
|
|
|
+
|
|
|
+ // 再锁定具体文件
|
|
|
for (Document document : documents) {
|
|
|
if (document.getName().equals(bo.getName())) {
|
|
|
document.setActualDocument(ossVo.getOssId());
|
|
|
@@ -866,7 +909,7 @@ public class DocumentServiceImpl implements IDocumentService {
|
|
|
}
|
|
|
|
|
|
Document document = new Document();
|
|
|
- document.setFolderId(bo.getCenter() != 0L ? bo.getCenter() : bo.getCountry());
|
|
|
+ document.setFolderId(folderId);
|
|
|
document.setName(bo.getName());
|
|
|
document.setStatus(DocumentStatusEnum.UN_AUDIT.getValue());
|
|
|
document.setActualDocument(ossVo.getOssId());
|
|
|
@@ -1090,6 +1133,10 @@ public class DocumentServiceImpl implements IDocumentService {
|
|
|
|
|
|
private LambdaQueryWrapper<Document> buildListWrapperOnWorkbench() {
|
|
|
LambdaQueryWrapper<Document> wrapper = Wrappers.lambdaQuery(Document.class);
|
|
|
+
|
|
|
+ List<Long> projects = projectService.queryUnderway().stream().map(Project::getId).toList();
|
|
|
+ wrapper.in(Document::getProjectId, WrapperUtils.convertIds(projects));
|
|
|
+
|
|
|
wrapper.and(w -> w
|
|
|
.eq(Document::getPlanSubmitter, LoginHelper.getUserId())
|
|
|
.eq(Document::getStatus, DocumentStatusEnum.UN_UPLOAD.getValue())
|
|
|
@@ -1130,7 +1177,7 @@ public class DocumentServiceImpl implements IDocumentService {
|
|
|
|
|
|
private LambdaQueryWrapper<Document> buildOnSearchWrapper(DocumentSearchBo bo, List<Long> projectIds) {
|
|
|
return Wrappers.lambdaQuery(Document.class)
|
|
|
- .in(StringUtils.isNotBlank(bo.getProjectName()) || StringUtils.isNotBlank(bo.getProjectCode()), Document::getProjectId, projectIds.isEmpty() ? List.of(-1L) : projectIds)
|
|
|
+ .in(StringUtils.isNotBlank(bo.getProjectName()) || StringUtils.isNotBlank(bo.getProjectCode()), Document::getProjectId, WrapperUtils.convertIds(projectIds))
|
|
|
.like(StringUtils.isNotBlank(bo.getName()), Document::getName, bo.getName())
|
|
|
.eq(bo.getStatus() != null, Document::getStatus, bo.getStatus())
|
|
|
.eq(bo.getType() != null, Document::getPlanType, bo.getType())
|