upload 的方法创建多态版本 long 和 String类型id
This commit is contained in:
@ -18,7 +18,7 @@ public interface AttachmentClient {
|
||||
/**
|
||||
* @return 创建业务ID
|
||||
*/
|
||||
Optional<Long> getBusinessId();
|
||||
Optional<String> getBusinessId();
|
||||
|
||||
/**
|
||||
* 查询业务ID下的所有附件信息
|
||||
@ -61,6 +61,8 @@ public interface AttachmentClient {
|
||||
* @return
|
||||
*/
|
||||
Optional<UploadObject> upload(String businessId, File file);
|
||||
Optional<UploadObject> upload(Long businessId, File file);
|
||||
|
||||
|
||||
/**
|
||||
* 上传资源文件
|
||||
@ -70,5 +72,6 @@ public interface AttachmentClient {
|
||||
* @return
|
||||
*/
|
||||
Optional<UploadObject> upload(String businessId, String filename, byte[] array);
|
||||
Optional<UploadObject> upload(Long businessId, String filename, byte[] array);
|
||||
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ public class DefaultAttachmentClient implements AttachmentClient {
|
||||
* 获取业务ID
|
||||
*/
|
||||
@Override
|
||||
public Optional<Long> getBusinessId() {
|
||||
public Optional<String> getBusinessId() {
|
||||
Snowflake snowflake = queryService.getSnokflakId();
|
||||
|
||||
if (Objects.isNull(snowflake)) {
|
||||
@ -108,6 +108,11 @@ public class DefaultAttachmentClient implements AttachmentClient {
|
||||
return Optional.ofNullable(new UploadObject().setId(feedback.getOid()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<UploadObject> upload(Long businessId, File file) {
|
||||
return upload(businessId.toString(), file);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传附件
|
||||
*
|
||||
@ -127,4 +132,9 @@ public class DefaultAttachmentClient implements AttachmentClient {
|
||||
return Optional.ofNullable(new UploadObject().setId(feedback.getOid()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<UploadObject> upload(Long businessId, String filename, byte[] array) {
|
||||
return upload(businessId.toString(), filename, array);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,6 +5,6 @@ import lombok.Data;
|
||||
@Data
|
||||
public class Snowflake {
|
||||
|
||||
private Long id;
|
||||
private String id;
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user