文件上传及删除流程优化
This commit is contained in:
parent
19d674cf91
commit
6eeb93f90b
@ -39,7 +39,7 @@ public class FileBean {
|
||||
@Column(columnDefinition="int(1) comment '存储类型'")
|
||||
private Integer storageType;
|
||||
|
||||
@Column(columnDefinition="varchar(32) comment 'md5唯一标识'")
|
||||
@Column(columnDefinition="varchar(200) comment 'md5唯一标识'")
|
||||
private String identifier;
|
||||
|
||||
@Column(columnDefinition="varchar(25) comment '创建时间'")
|
||||
|
@ -8,7 +8,9 @@ import lombok.Data;
|
||||
import javax.persistence.*;
|
||||
|
||||
@Data
|
||||
@Table(name = "recoveryfile")
|
||||
@Table(name = "recoveryfile", uniqueConstraints = {
|
||||
@UniqueConstraint(name = "user_file_id_index3", columnNames = {"userFileId"})
|
||||
})
|
||||
@Entity
|
||||
@TableName("recoveryfile")
|
||||
public class RecoveryFile {
|
||||
|
@ -22,7 +22,7 @@ public class UploadTask {
|
||||
@Column(columnDefinition = "bigint(20) comment '用户id'")
|
||||
private String userId;
|
||||
|
||||
@Column(columnDefinition="varchar(32) comment 'md5唯一标识'")
|
||||
@Column(columnDefinition="varchar(200) comment 'md5唯一标识'")
|
||||
private String identifier;
|
||||
|
||||
@Column(columnDefinition="varchar(100) comment '文件名称'")
|
||||
|
@ -37,6 +37,6 @@ public class UploadTaskDetail {
|
||||
@Column(columnDefinition="bigint(10) comment '文件总大小'")
|
||||
private Integer totalSize;
|
||||
|
||||
@Column(columnDefinition="varchar(32) comment '文件md5唯一标识'")
|
||||
@Column(columnDefinition="varchar(200) comment '文件md5唯一标识'")
|
||||
private String identifier;
|
||||
}
|
||||
|
@ -18,17 +18,17 @@ public class QiwenFile {
|
||||
private boolean isDirectory;
|
||||
|
||||
public QiwenFile(String pathname, boolean isDirectory) {
|
||||
if (StringUtils.isEmpty(pathname)) {
|
||||
throw new QiwenException("file name format error,pathname:" + pathname);
|
||||
}
|
||||
// if (StringUtils.isEmpty(pathname)) {
|
||||
// throw new QiwenException("file name format error,pathname:" + pathname);
|
||||
// }
|
||||
this.path = formatPath(pathname);
|
||||
this.isDirectory = isDirectory;
|
||||
}
|
||||
|
||||
public QiwenFile(String parent, String child, boolean isDirectory) {
|
||||
if (StringUtils.isEmpty(child)) {
|
||||
throw new QiwenException("file name format error,parent:" + parent +", child:" + child);
|
||||
}
|
||||
// if (StringUtils.isEmpty(child)) {
|
||||
// throw new QiwenException("file name format error,parent:" + parent +", child:" + child);
|
||||
// }
|
||||
if (parent != null) {
|
||||
String parentPath = separator.equals(formatPath(parent)) ? "" : formatPath(parent);
|
||||
String childPath = formatPath(child);
|
||||
@ -47,6 +47,9 @@ public class QiwenFile {
|
||||
if ("/".equals(path)) {
|
||||
return path;
|
||||
}
|
||||
if (!path.startsWith(separator)) {
|
||||
path = separator + path;
|
||||
}
|
||||
if (path.endsWith("/")) {
|
||||
int length = path.length();
|
||||
return path.substring(0, length - 1);
|
||||
|
Loading…
Reference in New Issue
Block a user