1、新增文档分类管理

2、新增资源管理开发
This commit is contained in:
pan
2024-08-28 17:40:03 +08:00
parent 2a75898712
commit a272e06018
12 changed files with 769 additions and 133 deletions

View File

@@ -0,0 +1,26 @@
package com.rzdata.common.config;
import cn.hutool.core.lang.Snowflake;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* 雪花算法订单号生成
* @author lanhai
*/
@Configuration
public class SnowflakeConfig {
@Value("${application.datacenterId}")
private Long datacenterId;
@Value("${application.workerId}")
private Long workerId;
@Bean
public Snowflake snowflake() {
return new Snowflake(workerId, datacenterId);
}
}

View File

@@ -0,0 +1,54 @@
package com.rzdata.common.core.domain;
import com.rzdata.common.annotation.Excel;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* 文档资源分类管理对象 t_document_category
*
* @author spongepan
* @date 2024-08-27
*/
@Data
public class DocumentCategory extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private String id;
/** 分类名称 */
@Excel(name = "分类名称")
private String categoryName;
/** 分类描述 */
@Excel(name = "分类描述")
private String categoryDescription;
/** 父分类ID如果是一级分类则为空 */
@Excel(name = "父分类ID如果是一级分类则为空")
private String parentId;
/** 创建人id */
@Excel(name = "创建人id")
private String createById;
/** 更新人id */
@Excel(name = "更新人id")
private String updateById;
/** 类型system:系统user:用户创建) */
@Excel(name = "类型")
private String types;
/** 文档分类id */
@Excel(name = "文档分类id")
private String docCategoryId;
/** 子分类 */
private List<DocumentCategory> children = new ArrayList<DocumentCategory>();
}

View File

@@ -6,12 +6,14 @@ import java.util.stream.Collectors;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.rzdata.common.core.domain.entity.SysDept;
import com.rzdata.common.core.domain.entity.SysMenu;
import lombok.Data;
/**
* Treeselect树结构实体类
*
* @author ruoyi
*/
@Data
public class TreeSelect implements Serializable
{
private static final long serialVersionUID = 1L;
@@ -22,6 +24,9 @@ public class TreeSelect implements Serializable
/** 节点名称 */
private String label;
/** 类型 */
private String types;
/** 子节点 */
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<TreeSelect> children;
@@ -45,33 +50,14 @@ public class TreeSelect implements Serializable
this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
}
public Long getId()
public TreeSelect(DocumentCategory docCategory)
{
return id;
this.id = Long.valueOf(docCategory.getId());
this.label = docCategory.getCategoryName();
this.types = docCategory.getTypes();
this.children = docCategory.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
}
public void setId(Long id)
{
this.id = id;
}
public String getLabel()
{
return label;
}
public void setLabel(String label)
{
this.label = label;
}
public List<TreeSelect> getChildren()
{
return children;
}
public void setChildren(List<TreeSelect> children)
{
this.children = children;
}
}

View File

@@ -5,6 +5,8 @@ import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Objects;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.rzdata.common.listener.PutObjectProgressListener;
import org.apache.commons.io.FilenameUtils;
import org.springframework.util.Assert;
@@ -280,4 +282,50 @@ public class FileUploadUtils
}
return extension;
}
/**
* 生成合并后的文件路径
*
* @param baseDir 文件存储根目录
* @param fileName 上传的文件名
* @return 合并后文件的完整路径
*/
public static String generateMergedFilePath(String baseDir, String fileName) {
// 获取当前日期路径
String datePath = DateUtil.today().replace("-", "/");
// 获取文件的基本名称和扩展名
String baseName = StrUtil.subBefore(fileName, ".", true);
String extension = StrUtil.subAfter(fileName, ".", true);
// 生成唯一文件名,使用时间戳
String uniqueFileName = baseName + "_" + System.currentTimeMillis() + "." + extension;
// 合并文件路径: baseDir/yyyy/MM/dd/uploadId/uniqueFileName
String mergedFilePath = Paths.get(baseDir, datePath, uniqueFileName).toString();
return mergedFilePath;
}
/**
* 获取文件名称
*
* @param baseDir 文件存储根目录
* @param fileNames 上传的文件名
* @return 合并后文件的完整路径
*/
public static String getFilePath(String baseDir, String fileNames) {
String extension = StrUtil.subAfter(fileNames, ".", true);
String fileName = StringUtils.format("{}/{}_{}.{}", DateUtils.datePath(),
FilenameUtils.getBaseName(fileNames), Seq.getId(Seq.uploadSeqType), extension);;
try {
return getPathFileName(baseDir, fileName);
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
}