修改文件查询接口,添加异常处理
This commit is contained in:
@ -23,6 +23,7 @@ import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.model.AttachmentEntity;
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.model.DownloadEntity;
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.model.UploadObject;
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.service.DocumentCenterService;
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.vo.query.QueryResult;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -79,18 +80,20 @@ public class DefaultAttachmentClient implements AttachmentClient {
|
||||
String json = documentCenterService.fetchDetails(businessIdList);
|
||||
log.debug("document center return: {}", json);
|
||||
|
||||
AttachmentDetail detail = new AttachmentDetail();
|
||||
Optional<QueryResult> op = modelConvertor.toQueryResult(json);
|
||||
|
||||
// 组织数据存储
|
||||
modelConvertor.toQueryResult(json).ifPresent(result -> {
|
||||
Optional.ofNullable(result.getData()).ifPresent(data -> {
|
||||
if (op.isPresent()) {
|
||||
AttachmentDetail detail = new AttachmentDetail();
|
||||
|
||||
Optional.ofNullable(op.get().getData()).ifPresent(data -> {
|
||||
data.forEach(item -> {
|
||||
detail.add(new AttachmentEntity().setBid(item.getObjectId()).setId(item.getFileId())
|
||||
.setFilename(item.getOriginalName()).setKey(item.getFileName()));
|
||||
});
|
||||
});
|
||||
});
|
||||
return Optional.of(detail);
|
||||
return Optional.of(detail);
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -32,7 +32,7 @@ public class DocumentCenterServiceFallback implements DocumentCenterService {
|
||||
|
||||
@Override
|
||||
public byte[] download(String fileId) {
|
||||
return null;
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,4 +6,4 @@ server.max-http-header-size=2048576
|
||||
|
||||
# document center id
|
||||
document.center.service.id=core-service-document-center
|
||||
document.center.ip-address=http://10.238.25.112:8100/doc/
|
||||
document.center.ip-address=http://10.242.31.158:8806/doc/
|
@ -5,15 +5,11 @@ import org.springframework.stereotype.Component;
|
||||
import com.chinaunicom.mall.ebtp.cloud.security.starter.client.UserCenterClient;
|
||||
import com.chinaunicom.mall.ebtp.cloud.security.starter.entity.SecurityUser;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class UserCenterClientFallback implements UserCenterClient {
|
||||
|
||||
@Override
|
||||
public SecurityUser getUserInfo() {
|
||||
log.error("Feign Fallback.");
|
||||
return new SecurityUser();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user