返回文件输出流
This commit is contained in:
@ -3,6 +3,7 @@ package com.chinaunicom.mall.ebtp.extend.templatewarehouse.sevice.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.convertor.ModelConvertor;
|
||||
import com.chinaunicom.mall.ebtp.common.util.JsonUtils;
|
||||
import com.chinaunicom.mall.ebtp.extend.feign.client.DocumentCenterService;
|
||||
import com.chinaunicom.mall.ebtp.extend.templatewarehouse.entity.BizBidClientVersion;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@ -42,11 +43,18 @@ public class BizBidClientVersionServiceImpl extends BaseServiceImpl<BizBidClient
|
||||
|
||||
@Override
|
||||
public FileOutputStream downloadFileByObjectId(String objectId) throws IOException {
|
||||
Optional<byte[]> optionalBytes = modelConvertor.toByteArray(documentCenterService.getObjectDetail(objectId));
|
||||
log.info("文档中心文件下载传入数据:"+ JsonUtils.objectToJson(objectId));
|
||||
String objectInfo = documentCenterService.getObjectDetail(objectId);
|
||||
log.info("文档中心文件下载返回数据:"+ JsonUtils.objectToJson(objectInfo));
|
||||
Optional<byte[]> optionalBytes = modelConvertor.toByteArray(objectInfo);
|
||||
log.info("文档中心文件下载返回数据转为byte[]数据:"+ JsonUtils.objectToJson(optionalBytes));
|
||||
FileOutputStream fileOutputStream = null;
|
||||
if(optionalBytes.isPresent()){
|
||||
ByteArrayOutputStream fileStream = new ByteArrayOutputStream();
|
||||
fileStream.write(optionalBytes.get());
|
||||
log.info("文档中心文件下载返回数据转为ByteArrayOutputStream数据:"+ JsonUtils.objectToJson(fileStream));
|
||||
fileOutputStream.write(fileStream.toByteArray());
|
||||
log.info("文档中心文件下载返回数据转为ByteArrayOutputStream数据:"+ JsonUtils.objectToJson(fileOutputStream));
|
||||
}
|
||||
return fileOutputStream;
|
||||
}
|
||||
|
Reference in New Issue
Block a user