|
@@ -4,9 +4,12 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.yingpaipay.business.constant.DictTypeConst;
|
|
import com.yingpaipay.business.constant.DictTypeConst;
|
|
|
import com.yingpaipay.business.constant.DocumentAuditorTypeConst;
|
|
import com.yingpaipay.business.constant.DocumentAuditorTypeConst;
|
|
|
import com.yingpaipay.business.constant.DocumentStatusConst;
|
|
import com.yingpaipay.business.constant.DocumentStatusConst;
|
|
|
|
|
+import com.yingpaipay.business.constant.DocumentTypeConst;
|
|
|
import com.yingpaipay.business.domain.DocumentAuditLog;
|
|
import com.yingpaipay.business.domain.DocumentAuditLog;
|
|
|
import com.yingpaipay.business.domain.bo.*;
|
|
import com.yingpaipay.business.domain.bo.*;
|
|
|
import com.yingpaipay.business.domain.vo.DocumentAuditLogVo;
|
|
import com.yingpaipay.business.domain.vo.DocumentAuditLogVo;
|
|
|
|
|
+import com.yingpaipay.business.domain.vo.TaskCenterAuditListVo;
|
|
|
|
|
+import com.yingpaipay.business.domain.vo.TaskCenterSubmissionListVo;
|
|
|
import com.yingpaipay.business.mapper.DocumentAuditLogMapper;
|
|
import com.yingpaipay.business.mapper.DocumentAuditLogMapper;
|
|
|
import org.dromara.common.core.exception.BusinessException;
|
|
import org.dromara.common.core.exception.BusinessException;
|
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
@@ -53,6 +56,7 @@ public class DocumentServiceImpl implements IDocumentService {
|
|
|
private final ISysOssService ossService;
|
|
private final ISysOssService ossService;
|
|
|
private final ISysUserService userService;
|
|
private final ISysUserService userService;
|
|
|
private final CommonFolderService folderService;
|
|
private final CommonFolderService folderService;
|
|
|
|
|
+ private final CommonProjectService projectService;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 查询文档
|
|
* 查询文档
|
|
@@ -150,6 +154,9 @@ public class DocumentServiceImpl implements IDocumentService {
|
|
|
@Override
|
|
@Override
|
|
|
public Boolean insertByBo(DocumentBo bo) {
|
|
public Boolean insertByBo(DocumentBo bo) {
|
|
|
Document add = MapstructUtils.convert(bo, Document.class);
|
|
Document add = MapstructUtils.convert(bo, Document.class);
|
|
|
|
|
+
|
|
|
|
|
+ add.setSpecificationType(folderService.getSpecificationType(bo.getFolderId(), bo.getProjectId()));
|
|
|
|
|
+
|
|
|
validEntityBeforeSave(add);
|
|
validEntityBeforeSave(add);
|
|
|
boolean flag = baseMapper.insert(add) > 0;
|
|
boolean flag = baseMapper.insert(add) > 0;
|
|
|
if (flag) {
|
|
if (flag) {
|
|
@@ -289,6 +296,79 @@ public class DocumentServiceImpl implements IDocumentService {
|
|
|
) > 0;
|
|
) > 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public TableDataInfo<TaskCenterSubmissionListVo> listOnSubmission(TaskCenterSubmissionListBo bo, PageQuery pageQuery) {
|
|
|
|
|
+ List<Long> projectIds = projectService.queryIdsOnSubmission(bo.getProjectCode(), bo.getProjectName());
|
|
|
|
|
+ if (projectIds.isEmpty()) {
|
|
|
|
|
+ return TableDataInfo.build();
|
|
|
|
|
+ }
|
|
|
|
|
+ List<Long> folderIds = folderService.selectIdsOnSubmission(bo.getCenterName(), projectIds);
|
|
|
|
|
+ LambdaQueryWrapper<Document> wrapper = buildSubmissionListWrapper(bo, folderIds);
|
|
|
|
|
+ IPage<Document> page = baseMapper.selectPage(pageQuery.build(), wrapper);
|
|
|
|
|
+ return TableDataInfo.build(page.convert(e -> {
|
|
|
|
|
+ TaskCenterSubmissionListVo vo = new TaskCenterSubmissionListVo();
|
|
|
|
|
+ vo.setId(e.getId());
|
|
|
|
|
+ vo.setName(e.getName());
|
|
|
|
|
+ vo.setStatus(e.getStatus());
|
|
|
|
|
+ vo.setType(e.getType());
|
|
|
|
|
+ vo.setDocumentType(e.getPlanType());
|
|
|
|
|
+ vo.setSubmitterId(e.getSubmitterId());
|
|
|
|
|
+ vo.setDeadline(e.getSubmitDeadline());
|
|
|
|
|
+ vo.setSubmitTime(e.getSubmitTime());
|
|
|
|
|
+ vo.setCreateTime(e.getCreateTime());
|
|
|
|
|
+ return vo;
|
|
|
|
|
+ }));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public TableDataInfo<TaskCenterAuditListVo> listOnAudit(TaskCenterAuditListBo bo, PageQuery pageQuery) {
|
|
|
|
|
+ List<Long> projectIds = projectService.queryIdsOnSubmission(bo.getProjectCode(), bo.getProjectName());
|
|
|
|
|
+ if (projectIds.isEmpty()) {
|
|
|
|
|
+ return TableDataInfo.build();
|
|
|
|
|
+ }
|
|
|
|
|
+ List<Long> folderIds = folderService.selectIdsOnSubmission(bo.getCenterName(), projectIds);
|
|
|
|
|
+ LambdaQueryWrapper<Document> wrapper = buildAuditListWrapper(bo, folderIds);
|
|
|
|
|
+ IPage<Document> page = baseMapper.selectPage(pageQuery.build(), wrapper);
|
|
|
|
|
+ List<Long> ossIds = new ArrayList<>();
|
|
|
|
|
+ Map<Long, String> ossMap = new HashMap<>();
|
|
|
|
|
+ page.getRecords().forEach(e -> ossIds.add(e.getOssId()));
|
|
|
|
|
+ ossService.queryListByIds(ossIds).forEach(e -> ossMap.put(e.getOssId(), e.getUrl()));
|
|
|
|
|
+ return TableDataInfo.build(page.convert(e -> {
|
|
|
|
|
+ TaskCenterAuditListVo vo = new TaskCenterAuditListVo();
|
|
|
|
|
+ vo.setId(e.getId());
|
|
|
|
|
+ vo.setName(e.getName());
|
|
|
|
|
+ vo.setStatus(e.getStatus());
|
|
|
|
|
+ vo.setDeadline(e.getSubmitDeadline());
|
|
|
|
|
+ vo.setSubmitterId(e.getSubmitterId());
|
|
|
|
|
+ vo.setSubmitTime(e.getSubmitTime());
|
|
|
|
|
+ vo.setCreateTime(e.getCreateTime());
|
|
|
|
|
+ vo.setOssId(e.getOssId());
|
|
|
|
|
+ vo.setOssUrl(ossMap.get(e.getOssId()));
|
|
|
|
|
+ vo.setType(e.getType());
|
|
|
|
|
+ vo.setDocumentType(e.getPlanType());
|
|
|
|
|
+ return vo;
|
|
|
|
|
+ }));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private LambdaQueryWrapper<Document> buildAuditListWrapper(TaskCenterAuditListBo bo, List<Long> folderIds) {
|
|
|
|
|
+ return Wrappers.lambdaQuery(Document.class)
|
|
|
|
|
+ .like(StringUtils.isNotBlank(bo.getName()), Document::getName, bo.getName())
|
|
|
|
|
+ .eq(Document::getSubmitterId, LoginHelper.getUserId())
|
|
|
|
|
+ .in(!folderIds.isEmpty(), Document::getFolderId, folderIds)
|
|
|
|
|
+ .in(Document::getStatus, List.of(DocumentStatusConst.UN_AUDIT, DocumentStatusConst.UN_FILING))
|
|
|
|
|
+ .orderByDesc(Document::getId);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private LambdaQueryWrapper<Document> buildSubmissionListWrapper(TaskCenterSubmissionListBo bo, List<Long> folderIds) {
|
|
|
|
|
+ return Wrappers.lambdaQuery(Document.class)
|
|
|
|
|
+ .like(StringUtils.isNotBlank(bo.getName()), Document::getName, bo.getName())
|
|
|
|
|
+ .eq(bo.getStatus() != null, Document::getStatus, bo.getStatus())
|
|
|
|
|
+ .eq(Document::getSubmitterId, LoginHelper.getUserId())
|
|
|
|
|
+ .in(!folderIds.isEmpty(), Document::getFolderId, folderIds)
|
|
|
|
|
+ .in(Document::getStatus, List.of(DocumentStatusConst.UN_UPLOAD, DocumentStatusConst.AUDIT_REJECT))
|
|
|
|
|
+ .orderByDesc(Document::getId);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private DocumentAuditLog buildLog(Document document, String type, DocumentAuditBo bo) {
|
|
private DocumentAuditLog buildLog(Document document, String type, DocumentAuditBo bo) {
|
|
|
DocumentAuditLog log = new DocumentAuditLog();
|
|
DocumentAuditLog log = new DocumentAuditLog();
|
|
|
log.setDocumentId(document.getId());
|
|
log.setDocumentId(document.getId());
|