🔨 批量上传.

This commit is contained in:
lijiahang
2024-05-10 11:23:22 +08:00
parent cf17cf93b0
commit cd312ef5c8
28 changed files with 658 additions and 213 deletions

View File

@@ -53,6 +53,9 @@ public class FileUploadMessageDispatcher extends AbstractWebSocketHandler {
} else if (FileUploadOperatorType.FINISH.equals(type)) {
// 上传完成
handler.finish();
} else if (FileUploadOperatorType.ERROR.equals(type)) {
// 上传失败
handler.error();
}
}

View File

@@ -24,6 +24,11 @@ public enum FileUploadOperatorType {
*/
FINISH("finish"),
/**
* 上传失败
*/
ERROR("error"),
;
private final String type;

View File

@@ -106,6 +106,18 @@ public class FileUploadHandler implements IFileUploadHandler {
this.send(resp);
}
@Override
public void error() {
// 释放资源
this.close();
// 返回上传路径
FileUploadResponse resp = FileUploadResponse.builder()
.type(FileUploadReceiverType.ERROR.getType())
.fileId(this.fileId)
.build();
this.send(resp);
}
@Override
public void close() {
if (closed) {

View File

@@ -30,4 +30,9 @@ public interface IFileUploadHandler extends SafeCloseable {
*/
void finish();
/**
* 上传失败
*/
void error();
}