返回文件输出流
This commit is contained in:
@ -79,6 +79,20 @@ public class TemplateWarehouseController {
|
|||||||
return BaseResponse.success(clientVersion);
|
return BaseResponse.success(clientVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得客户端配置文件相关信息
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation("获得客户端配置文件文件id")
|
||||||
|
@GetMapping("/client/filess")
|
||||||
|
public BaseResponse<FileOutputStream> getClientFiless() throws IOException {
|
||||||
|
String type = "ipassConfigFile";
|
||||||
|
BizBidTemplateWarehouse templateWarehouse = templateWarehouseService.getTemplateByType(type);
|
||||||
|
FileOutputStream clientVersion = bizBidClientVersionService.downloadFileByObjectIdss(templateWarehouse.getDocumentCenterId());
|
||||||
|
return BaseResponse.success(clientVersion);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过版本号获得对应客户端文件id
|
* 通过版本号获得对应客户端文件id
|
||||||
*
|
*
|
||||||
|
@ -24,4 +24,6 @@ public interface BizBidClientVersionService extends IBaseService<BizBidClientVer
|
|||||||
FileOutputStream downloadFileByObjectId(String oId) throws IOException;
|
FileOutputStream downloadFileByObjectId(String oId) throws IOException;
|
||||||
|
|
||||||
FileOutputStream downloadFileByObjectIds(String oId) throws IOException;
|
FileOutputStream downloadFileByObjectIds(String oId) throws IOException;
|
||||||
|
|
||||||
|
FileOutputStream downloadFileByObjectIdss(String oId) throws IOException;
|
||||||
}
|
}
|
||||||
|
@ -77,4 +77,24 @@ public class BizBidClientVersionServiceImpl extends BaseServiceImpl<BizBidClient
|
|||||||
}
|
}
|
||||||
return fileOutputStream;
|
return fileOutputStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FileOutputStream downloadFileByObjectIdss(String objectId) throws IOException {
|
||||||
|
log.info("文档中心s文件下载传入数据:"+ JsonUtils.objectToJson(objectId));
|
||||||
|
String objectInfo = documentCenterService.getObjectDetail(objectId);
|
||||||
|
log.info("文档中心s文件下载返回数据:"+ JsonUtils.objectToJson(objectInfo));
|
||||||
|
Optional<byte[]> optionalBytes = modelConvertor.toByteArray(objectInfo);
|
||||||
|
log.info("文档中心s文件下载返回数据转为byte[]数据:"+ JsonUtils.objectToJson(optionalBytes));
|
||||||
|
FileOutputStream fileOutputStream = null;
|
||||||
|
if(optionalBytes.isPresent()){
|
||||||
|
ByteArrayOutputStream fileStream = new ByteArrayOutputStream();
|
||||||
|
fileStream.write(optionalBytes.get());
|
||||||
|
log.info("文档中心s文件下载返回数据转为ByteArrayOutputStream数据:"+ JsonUtils.objectToJson(fileStream));
|
||||||
|
fileOutputStream = new FileOutputStream("C:\\test.txt");
|
||||||
|
fileOutputStream.write(fileStream.toByteArray());
|
||||||
|
log.info("文档中心s文件下载返回数据转为ByteArrayOutputStream数据:"+ JsonUtils.objectToJson(fileOutputStream));
|
||||||
|
}
|
||||||
|
return fileOutputStream;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user