Przeglądaj źródła

- 文档新增功能完成

Huanyi 1 dzień temu
rodzic
commit
62fa09a965

+ 2 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/ISysOssService.java

@@ -36,6 +36,8 @@ public interface ISysOssService {
      */
     List<SysOssVo> listByIds(Collection<Long> ossIds);
 
+    List<SysOssVo> queryListByIds(Collection<Long> ossIds);
+
     /**
      * 根据 ossId 从缓存或数据库中获取 SysOssVo 对象
      *

+ 8 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysOssServiceImpl.java

@@ -95,6 +95,14 @@ public class SysOssServiceImpl implements ISysOssService, OssService {
         return list;
     }
 
+    @Override
+    public List<SysOssVo> queryListByIds(Collection<Long> ossIds) {
+        if (ossIds.isEmpty()) {
+            return List.of();
+        }
+        return baseMapper.selectVoByIds(ossIds);
+    }
+
     /**
      * 根据一组 ossIds 获取对应文件的 URL 列表
      *

+ 7 - 1
ruoyi-modules/yingpaipay-business/src/main/java/com/yingpaipay/business/constant/DictTypeConst.java

@@ -3,7 +3,7 @@ package com.yingpaipay.business.constant;
 /**
  * @Author: Huanyi
  * @CreateTime: 2025-12-09
- * @Description:
+ * @Description: 业务字典
  * @Version: 1.0
  */
 
@@ -13,4 +13,10 @@ public interface DictTypeConst {
 
     String PROJECT_LANGUAGE = "project_language";
 
+    String PLAN_DOCUMENT_TYPE = "plan_document_type";
+
+    String PROJECT_FILE_SPECIFICATION = "project_file_specification";
+
+    String CENTER_FILE_SPECIFICATION = "center_file_specification";
+
 }

+ 6 - 3
ruoyi-modules/yingpaipay-business/src/main/java/com/yingpaipay/business/domain/Document.java

@@ -37,12 +37,12 @@ public class Document extends TenantEntity {
     /**
      * 文档标识
      */
-    private String fileSpecification;
+    private String specification;
 
     /**
      * 计划文件类型
      */
-    private String type;
+    private String planType;
 
     /**
      * 计划名称
@@ -57,7 +57,7 @@ public class Document extends TenantEntity {
     /**
      * 递交截止时间
      */
-    private Date submissionDeadline;
+    private Date submitDeadline;
 
     /**
      * 文档本体
@@ -75,5 +75,8 @@ public class Document extends TenantEntity {
     @TableLogic
     private String delFlag;
 
+    private Integer type;
+
+    private Long submitterId;
 
 }

+ 29 - 15
ruoyi-modules/yingpaipay-business/src/main/java/com/yingpaipay/business/domain/bo/DocumentBo.java

@@ -25,48 +25,62 @@ public class DocumentBo extends BaseEntity {
     /**
      * 序号
      */
-    @NotNull(message = "序号不能为空", groups = { EditGroup.class })
     private Long id;
 
+    /**
+     * 文档标识
+     */
+    private String specification;
+
+    /**
+     * 名称/计划名称
+     */
+    private String name;
+
     /**
      * 所属文件夹
      */
-    @NotNull(message = "所属文件夹不能为空", groups = { AddGroup.class, EditGroup.class })
     private Long folderId;
 
     /**
-     * 文档标识
+     * 文档类型
+     * 0 -> 非计划文档
+     * 1 -> 计划文档
      */
-    @NotBlank(message = "文档标识不能为空", groups = { AddGroup.class, EditGroup.class })
-    private String fileSpecification;
+    private Integer type;
 
     /**
-     * 计划名称
+     * 递交人
      */
-    @NotBlank(message = "计划名称不能为空", groups = { AddGroup.class, EditGroup.class })
-    private String name;
+    private Long submitterId;
 
     /**
-     * 状态
+     * 递交截止日期
      */
-    @NotNull(message = "状态不能为空", groups = { AddGroup.class, EditGroup.class })
-    private Integer status;
+    private Date submitDeadline;
 
     /**
-     * 计划上传时间
+     * 计划文件类型
+     * 字典值,对应的字典类型 : plan_document_type
      */
-    @NotNull(message = "递交截止时间", groups = { AddGroup.class, EditGroup.class })
-    private Date submissionDeadline;
+    private String planType;
 
     /**
-     * 文档本体
+     * 文件本体
+     * 使用文件上传逻辑,可参考系统设置中的OSS设置
      */
     private Long ossId;
 
+    /**
+     * 递交时间
+     */
+    private Date submitTime;
+
     /**
      * 备注
      */
     private String note;
 
+    private Integer status;
 
 }

+ 28 - 5
ruoyi-modules/yingpaipay-business/src/main/java/com/yingpaipay/business/domain/vo/DocumentVo.java

@@ -2,6 +2,7 @@ package com.yingpaipay.business.domain.vo;
 
 import java.util.Date;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.yingpaipay.business.constant.DictTypeConst;
 import com.yingpaipay.business.domain.Document;
 import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
 import cn.idev.excel.annotation.ExcelProperty;
@@ -9,6 +10,10 @@ import org.dromara.common.excel.annotation.ExcelDictFormat;
 import org.dromara.common.excel.convert.ExcelDictConvert;
 import io.github.linpeilie.annotations.AutoMapper;
 import lombok.Data;
+import org.dromara.common.translation.annotation.Translation;
+import org.dromara.common.translation.constant.TransConstant;
+import org.dromara.system.domain.SysOss;
+import org.dromara.system.domain.vo.SysOssVo;
 
 import java.io.Serial;
 import java.io.Serializable;
@@ -40,20 +45,26 @@ public class DocumentVo implements Serializable {
      * 所属文件夹
      */
     @ExcelProperty(value = "所属文件夹")
+    private String folderName;
     private Long folderId;
 
     /**
      * 文档标识
      */
     @ExcelProperty(value = "文档标识")
-    private String fileSpecification;
+    private String specificationLabel;
+    private String specification;
 
     /**
      * 计划名称
      */
-    @ExcelProperty(value = "计划名称")
+    @ExcelProperty(value = "计划文件名称/文件名称")
     private String name;
 
+    @ExcelProperty(value = "计划文件类型")
+    private String palnDocumentTypeLabel;
+    private String planDocumentType;
+
     /**
      * 状态
      */
@@ -63,15 +74,21 @@ public class DocumentVo implements Serializable {
     /**
      * 计划上传时间
      */
-    @ExcelProperty(value = "计划上传时间")
-    private Date scheduledUploadTime;
+    @ExcelProperty(value = "递交截止时间")
+    private Date submitDeadline;
 
     /**
      * 文档本体
      */
-    @ExcelProperty(value = "文档本体")
+    @ExcelProperty(value = "实际文档")
+    private String url;
+    private String fileName;
     private Long ossId;
 
+    @ExcelProperty(value = "递交时间")
+    private Date submitTime;
+
+
     /**
      * 备注
      */
@@ -90,5 +107,11 @@ public class DocumentVo implements Serializable {
     @ExcelProperty(value = "更新时间")
     private Date updateTime;
 
+    @ExcelProperty(value = "计划递交人")
+    @Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "submitterId")
+    private String submitter;
+    private Long submitterId;
+
+    private Integer type;
 
 }

+ 7 - 5
ruoyi-modules/yingpaipay-business/src/main/java/com/yingpaipay/business/domain/vo/ProjectVo.java

@@ -53,15 +53,13 @@ public class ProjectVo implements Serializable {
     /**
      * 项目语言
      */
-    @ExcelProperty(value = "项目语言", converter = ExcelDictConvert.class)
-    @ExcelDictFormat(dictType = "project_language")
+    @ExcelProperty(value = "项目语言")
     private String language;
 
     /**
      * 项目类型
      */
-    @ExcelProperty(value = "项目类型", converter = ExcelDictConvert.class)
-    @ExcelDictFormat(dictType = "project_type")
+    @ExcelProperty(value = "项目类型")
     private String type;
 
     /**
@@ -124,7 +122,11 @@ public class ProjectVo implements Serializable {
     @ExcelProperty(value = "更新时间")
     private Date updateTime;
 
-    private Long icon;
+    /**
+     * 图标
+     */
+    @ExcelProperty(value = "图标")
     private String iconUrl;
+    private Long icon;
 
 }

+ 50 - 8
ruoyi-modules/yingpaipay-business/src/main/java/com/yingpaipay/business/service/impl/DocumentServiceImpl.java

@@ -1,5 +1,6 @@
 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.StringUtils;
 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 lombok.RequiredArgsConstructor;
 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 com.yingpaipay.business.domain.bo.DocumentBo;
 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.service.IDocumentService;
 
-import java.util.List;
-import java.util.Map;
-import java.util.Collection;
+import java.util.*;
 
 /**
  * 文档Service业务层处理
@@ -33,6 +37,11 @@ public class DocumentServiceImpl implements IDocumentService {
 
     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) {
         LambdaQueryWrapper<Document> lqw = buildQueryWrapper(bo);
         Page<DocumentVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
+        dealVo(result.getRecords());
         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
     public List<DocumentVo> queryList(DocumentBo 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) {
         Map<String, Object> params = bo.getParams();
         LambdaQueryWrapper<Document> lqw = Wrappers.lambdaQuery();
-        lqw.orderByAsc(Document::getId);
+        lqw.orderByDesc(Document::getId);
         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.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,
             Document::getCreateTime ,params.get("beginCreateTime"), params.get("endCreateTime"));
         lqw.between(params.get("beginUpdateTime") != null && params.get("endUpdateTime") != null,