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