|
@@ -1,5 +1,6 @@
|
|
|
package com.yingpaipay.business.service.impl;
|
|
package com.yingpaipay.business.service.impl;
|
|
|
|
|
|
|
|
|
|
+import com.yingpaipay.business.constant.DictTypeConst;
|
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
@@ -9,6 +10,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+import org.dromara.system.domain.vo.SysOssVo;
|
|
|
|
|
+import org.dromara.system.service.ISysDictDataService;
|
|
|
|
|
+import org.dromara.system.service.ISysDictTypeService;
|
|
|
|
|
+import org.dromara.system.service.ISysOssService;
|
|
|
|
|
+import org.dromara.system.service.ISysUserService;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.yingpaipay.business.domain.bo.DocumentBo;
|
|
import com.yingpaipay.business.domain.bo.DocumentBo;
|
|
|
import com.yingpaipay.business.domain.vo.DocumentVo;
|
|
import com.yingpaipay.business.domain.vo.DocumentVo;
|
|
@@ -16,9 +22,7 @@ import com.yingpaipay.business.domain.Document;
|
|
|
import com.yingpaipay.business.mapper.DocumentMapper;
|
|
import com.yingpaipay.business.mapper.DocumentMapper;
|
|
|
import com.yingpaipay.business.service.IDocumentService;
|
|
import com.yingpaipay.business.service.IDocumentService;
|
|
|
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
-import java.util.Map;
|
|
|
|
|
-import java.util.Collection;
|
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 文档Service业务层处理
|
|
* 文档Service业务层处理
|
|
@@ -33,6 +37,11 @@ public class DocumentServiceImpl implements IDocumentService {
|
|
|
|
|
|
|
|
private final DocumentMapper baseMapper;
|
|
private final DocumentMapper baseMapper;
|
|
|
|
|
|
|
|
|
|
+ private final ISysDictTypeService dictTypeService;
|
|
|
|
|
+ private final ISysOssService ossService;
|
|
|
|
|
+ private final ISysUserService userService;
|
|
|
|
|
+ private final CommonFolderService folderService;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 查询文档
|
|
* 查询文档
|
|
|
*
|
|
*
|
|
@@ -55,9 +64,40 @@ public class DocumentServiceImpl implements IDocumentService {
|
|
|
public TableDataInfo<DocumentVo> queryPageList(DocumentBo bo, PageQuery pageQuery) {
|
|
public TableDataInfo<DocumentVo> queryPageList(DocumentBo bo, PageQuery pageQuery) {
|
|
|
LambdaQueryWrapper<Document> lqw = buildQueryWrapper(bo);
|
|
LambdaQueryWrapper<Document> lqw = buildQueryWrapper(bo);
|
|
|
Page<DocumentVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
Page<DocumentVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
|
|
|
+ dealVo(result.getRecords());
|
|
|
return TableDataInfo.build(result);
|
|
return TableDataInfo.build(result);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private void dealVo(List<DocumentVo> documents) {
|
|
|
|
|
+ List<Long> ossIds = new ArrayList<>();
|
|
|
|
|
+ Map<Long, SysOssVo> ossMap = new HashMap<>();
|
|
|
|
|
+ List<Long> folderIds = new ArrayList<>();
|
|
|
|
|
+ Map<Long, String> folderMap = new HashMap<>();
|
|
|
|
|
+ List<Long> userIds = new ArrayList<>();
|
|
|
|
|
+ Map<String, String> planDocumentTypeMap = new HashMap<>();
|
|
|
|
|
+ Map<String, String> centerFileSpecificationMap = new HashMap<>();
|
|
|
|
|
+ Map<String, String> projectFileSpecificationMap = new HashMap<>();
|
|
|
|
|
+ dictTypeService.selectDictDataByType(DictTypeConst.PLAN_DOCUMENT_TYPE)
|
|
|
|
|
+ .forEach(e -> planDocumentTypeMap.put(e.getDictValue(), e.getDictLabel()));
|
|
|
|
|
+ dictTypeService.selectDictDataByType(DictTypeConst.CENTER_FILE_SPECIFICATION)
|
|
|
|
|
+ .forEach(e -> centerFileSpecificationMap.put(e.getDictValue(), e.getDictLabel()));
|
|
|
|
|
+ dictTypeService.selectDictDataByType(DictTypeConst.PROJECT_FILE_SPECIFICATION)
|
|
|
|
|
+ .forEach(e -> projectFileSpecificationMap.put(e.getDictValue(), e.getDictLabel()));
|
|
|
|
|
+ documents.forEach(e -> {
|
|
|
|
|
+ ossIds.add(e.getOssId());
|
|
|
|
|
+ folderIds.add(e.getFolderId());
|
|
|
|
|
+ userIds.add(e.getSubmitterId());
|
|
|
|
|
+ });
|
|
|
|
|
+ ossService.queryListByIds(ossIds).forEach(e -> ossMap.put(e.getOssId(), e));
|
|
|
|
|
+ documents.forEach(e -> {
|
|
|
|
|
+ SysOssVo ossVo = ossMap.get(e.getOssId());
|
|
|
|
|
+ if (ossVo != null) {
|
|
|
|
|
+ e.setUrl(ossVo.getUrl());
|
|
|
|
|
+ e.setFileName(ossVo.getOriginalName());
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 查询符合条件的文档列表
|
|
* 查询符合条件的文档列表
|
|
|
*
|
|
*
|
|
@@ -67,19 +107,21 @@ public class DocumentServiceImpl implements IDocumentService {
|
|
|
@Override
|
|
@Override
|
|
|
public List<DocumentVo> queryList(DocumentBo bo) {
|
|
public List<DocumentVo> queryList(DocumentBo bo) {
|
|
|
LambdaQueryWrapper<Document> lqw = buildQueryWrapper(bo);
|
|
LambdaQueryWrapper<Document> lqw = buildQueryWrapper(bo);
|
|
|
- return baseMapper.selectVoList(lqw);
|
|
|
|
|
|
|
+ List<DocumentVo> vos = baseMapper.selectVoList(lqw);
|
|
|
|
|
+ dealVo(vos);
|
|
|
|
|
+ return vos;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private LambdaQueryWrapper<Document> buildQueryWrapper(DocumentBo bo) {
|
|
private LambdaQueryWrapper<Document> buildQueryWrapper(DocumentBo bo) {
|
|
|
Map<String, Object> params = bo.getParams();
|
|
Map<String, Object> params = bo.getParams();
|
|
|
LambdaQueryWrapper<Document> lqw = Wrappers.lambdaQuery();
|
|
LambdaQueryWrapper<Document> lqw = Wrappers.lambdaQuery();
|
|
|
- lqw.orderByAsc(Document::getId);
|
|
|
|
|
|
|
+ lqw.orderByDesc(Document::getId);
|
|
|
lqw.eq(bo.getFolderId() != null, Document::getFolderId, bo.getFolderId());
|
|
lqw.eq(bo.getFolderId() != null, Document::getFolderId, bo.getFolderId());
|
|
|
- lqw.eq(StringUtils.isNotBlank(bo.getFileSpecification()), Document::getFileSpecification, bo.getFileSpecification());
|
|
|
|
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getSpecification()), Document::getSpecification, bo.getSpecification());
|
|
|
lqw.like(StringUtils.isNotBlank(bo.getName()), Document::getName, bo.getName());
|
|
lqw.like(StringUtils.isNotBlank(bo.getName()), Document::getName, bo.getName());
|
|
|
lqw.eq(bo.getStatus() != null, Document::getStatus, bo.getStatus());
|
|
lqw.eq(bo.getStatus() != null, Document::getStatus, bo.getStatus());
|
|
|
- lqw.between(params.get("beginScheduledUploadTime") != null && params.get("endScheduledUploadTime") != null,
|
|
|
|
|
- Document::getScheduledUploadTime ,params.get("beginScheduledUploadTime"), params.get("endScheduledUploadTime"));
|
|
|
|
|
|
|
+ lqw.between(params.get("beginSubmitDeadline") != null && params.get("endSubmitDeadline") != null,
|
|
|
|
|
+ Document::getSubmitDeadline ,params.get("beginSubmitDeadline"), params.get("endSubmitDeadline"));
|
|
|
lqw.between(params.get("beginCreateTime") != null && params.get("endCreateTime") != null,
|
|
lqw.between(params.get("beginCreateTime") != null && params.get("endCreateTime") != null,
|
|
|
Document::getCreateTime ,params.get("beginCreateTime"), params.get("endCreateTime"));
|
|
Document::getCreateTime ,params.get("beginCreateTime"), params.get("endCreateTime"));
|
|
|
lqw.between(params.get("beginUpdateTime") != null && params.get("endUpdateTime") != null,
|
|
lqw.between(params.get("beginUpdateTime") != null && params.get("endUpdateTime") != null,
|