chore: initialize qiming workspace repository

This commit is contained in:
Codex
2026-05-29 14:22:48 +08:00
commit bfd67a0f2c
10750 changed files with 1885711 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>app-platform-file</artifactId>
<groupId>com.xspaceagi</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.xspaceagi</groupId>
<artifactId>app-platform-file-domain</artifactId>
<properties>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>
<dependencies>
<dependency>
<groupId>com.xspaceagi</groupId>
<artifactId>app-platform-file-spec</artifactId>
</dependency>
<dependency>
<groupId>com.xspaceagi</groupId>
<artifactId>system-domain</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,103 @@
package com.xspaceagi.file.domain.model;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 文件记录领域模型
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class FileRecordDomain {
/**
* 主键ID
*/
private Long id;
/**
* 租户ID
*/
private Long tenantId;
/**
* 用户ID
*/
private Long userId;
/**
* 来源对象类型
*/
private String targetType;
/**
* 来源对象ID
*/
private Long targetId;
/**
* 文件名称
*/
private String fileName;
/**
* 文件大小
*/
private Long fileSize;
/**
* 文件类型
*/
private String fileType;
/**
* 文件扩展名
*/
private String fileExtension;
/**
* 文件元数据
*/
private String metadata;
/**
* 文件key
*/
private String fileKey;
/**
* 存储类型
*/
private String storageType;
/**
* 文件URL
*/
private String fileUrl;
/**
* 是否需要认证访问
*/
private Boolean authRequired;
/**
* 状态
*/
private String status;
/**
* 创建时间
*/
private Date created;
/**
* 修改时间
*/
private Date modified;
}

View File

@@ -0,0 +1,88 @@
package com.xspaceagi.file.domain.repository;
import com.xspaceagi.file.domain.model.FileRecordDomain;
import java.util.List;
/**
* 文件记录仓储接口
*/
public interface FileRecordRepository {
/**
* 保存文件记录
*
* @param fileRecord 文件记录
* @return 文件记录
*/
FileRecordDomain save(FileRecordDomain fileRecord);
/**
* 根据ID查询文件记录
*
* @param id 文件ID
* @return 文件记录
*/
FileRecordDomain findById(Long id);
/**
* 根据文件key查询文件记录
*
* @param fileKey 文件key
* @return 文件记录
*/
FileRecordDomain findByFileKey(String fileKey);
/**
* 根据租户ID和用户ID查询文件列表
*
* @param tenantId 租户ID
* @param userId 用户ID
* @return 文件列表
*/
List<FileRecordDomain> findByTenantIdAndUserId(Long tenantId, Long userId);
/**
* 根据来源对象查询文件列表
*
* @param tenantId 租户ID
* @param targetType 来源对象类型
* @param targetId 来源对象ID
* @return 文件列表
*/
List<FileRecordDomain> findByTarget(Long tenantId, String targetType, Long targetId);
/**
* 根据存储类型查询文件列表
*
* @param tenantId 租户ID
* @param storageType 存储类型
* @return 文件列表
*/
List<FileRecordDomain> findByStorageType(Long tenantId, String storageType);
/**
* 更新文件记录
*
* @param fileRecord 文件记录
* @return 是否成功
*/
boolean update(FileRecordDomain fileRecord);
/**
* 批量更新文件状态
*
* @param ids 文件ID列表
* @param status 状态
* @return 更新数量
*/
int updateStatusByIds(List<Long> ids, String status);
/**
* 删除文件记录
*
* @param id 文件ID
* @return 是否成功
*/
boolean deleteById(Long id);
}

View File

@@ -0,0 +1,74 @@
package com.xspaceagi.file.domain.storage;
import java.io.InputStream;
/**
* 文件存储策略接口
*/
public interface FileStorageStrategy {
/**
* 上传文件
*
* @param inputStream 文件流
* @param fileName 文件名
* @param contentType 文件类型
* @param targetType 业务类型
* @return 文件key
*/
String upload(InputStream inputStream, String fileName, String contentType, String targetType);
/**
* 下载文件
*
* @param fileKey 文件key
* @return 文件流
*/
InputStream download(String fileKey);
/**
* 删除文件
*
* @param fileKey 文件key
* @return 是否成功
*/
boolean delete(String fileKey);
/**
* 获取文件访问URL
*
* @param fileKey 文件key
* @return 访问URL
*/
String getFileUrl(String fileKey);
/**
* 生成签名URL用于云存储
*
* @param fileKey 文件key
* @param expireSeconds 过期时间(秒)
* @return 签名URL如果不支持则返回null
*/
default String generatePresignedUrl(String fileKey, int expireSeconds) {
return null;
}
/**
* 生成签名URL用于云存储支持指定下载文件名
*
* @param fileKey 文件key
* @param expireSeconds 过期时间(秒)
* @param fileName 下载时的文件名
* @return 签名URL如果不支持则返回null
*/
default String generatePresignedUrl(String fileKey, int expireSeconds, String fileName) {
return generatePresignedUrl(fileKey, expireSeconds);
}
/**
* 获取存储类型
*
* @return 存储类型
*/
String getStorageType();
}