提交
This commit is contained in:
@ -11,6 +11,7 @@ import io.swagger.annotations.ApiParam;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
@ -58,38 +59,10 @@ public class TemplateWarehouseController {
|
|||||||
*/
|
*/
|
||||||
@ApiOperation("获得客户端配置文件文件id")
|
@ApiOperation("获得客户端配置文件文件id")
|
||||||
@GetMapping("/client/file")
|
@GetMapping("/client/file")
|
||||||
public BaseResponse<FileOutputStream> getClientFile() throws IOException {
|
public BaseResponse<ByteArrayOutputStream> getClientFile() throws IOException {
|
||||||
String type = "ipassConfigFile";
|
String type = "ipassConfigFile";
|
||||||
BizBidTemplateWarehouse templateWarehouse = templateWarehouseService.getTemplateByType(type);
|
BizBidTemplateWarehouse templateWarehouse = templateWarehouseService.getTemplateByType(type);
|
||||||
FileOutputStream clientVersion = bizBidClientVersionService.downloadFileByObjectId(templateWarehouse.getDocumentCenterId());
|
ByteArrayOutputStream clientVersion = bizBidClientVersionService.downloadFileByOId(templateWarehouse.getDocumentCenterId());
|
||||||
return BaseResponse.success(clientVersion);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得客户端配置文件相关信息
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@ApiOperation("获得客户端配置文件文件id")
|
|
||||||
@GetMapping("/client/files")
|
|
||||||
public BaseResponse<FileOutputStream> getClientFiles() throws IOException {
|
|
||||||
String type = "ipassConfigFile";
|
|
||||||
BizBidTemplateWarehouse templateWarehouse = templateWarehouseService.getTemplateByType(type);
|
|
||||||
FileOutputStream clientVersion = bizBidClientVersionService.downloadFileByObjectIds(templateWarehouse.getDocumentCenterId());
|
|
||||||
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);
|
return BaseResponse.success(clientVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,8 +73,8 @@ public class TemplateWarehouseController {
|
|||||||
*/
|
*/
|
||||||
@ApiOperation("通过版本号获得对应客户端文件id")
|
@ApiOperation("通过版本号获得对应客户端文件id")
|
||||||
@GetMapping("/client/{version}")
|
@GetMapping("/client/{version}")
|
||||||
public BaseResponse<BizBidClientVersion> getClientByVersion(@ApiParam(value = "版本号", required = true) @PathVariable String version){
|
public BaseResponse<ByteArrayOutputStream> getClientByVersion(@ApiParam(value = "版本号", required = true) @PathVariable String version) throws IOException {
|
||||||
BizBidClientVersion clientVersion = bizBidClientVersionService.getClientByVersion(version);
|
ByteArrayOutputStream clientVersion = bizBidClientVersionService.getClientByVersion(version);
|
||||||
return BaseResponse.success(clientVersion);
|
return BaseResponse.success(clientVersion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ package com.chinaunicom.mall.ebtp.extend.templatewarehouse.sevice;
|
|||||||
import com.chinaunicom.mall.ebtp.common.base.service.IBaseService;
|
import com.chinaunicom.mall.ebtp.common.base.service.IBaseService;
|
||||||
import com.chinaunicom.mall.ebtp.extend.templatewarehouse.entity.BizBidClientVersion;
|
import com.chinaunicom.mall.ebtp.extend.templatewarehouse.entity.BizBidClientVersion;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
@ -19,11 +20,7 @@ public interface BizBidClientVersionService extends IBaseService<BizBidClientVer
|
|||||||
* @param version
|
* @param version
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
BizBidClientVersion getClientByVersion(String version);
|
ByteArrayOutputStream getClientByVersion(String version) throws IOException;
|
||||||
|
|
||||||
FileOutputStream downloadFileByObjectId(String oId) throws IOException;
|
ByteArrayOutputStream downloadFileByOId(String oId) throws IOException;
|
||||||
|
|
||||||
FileOutputStream downloadFileByObjectIds(String oId) throws IOException;
|
|
||||||
|
|
||||||
FileOutputStream downloadFileByObjectIdss(String oId) throws IOException;
|
|
||||||
}
|
}
|
||||||
|
@ -35,66 +35,38 @@ public class BizBidClientVersionServiceImpl extends BaseServiceImpl<BizBidClient
|
|||||||
private final ModelConvertor modelConvertor;
|
private final ModelConvertor modelConvertor;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BizBidClientVersion getClientByVersion(String version) {
|
public ByteArrayOutputStream getClientByVersion(String version) throws IOException {
|
||||||
QueryWrapper<BizBidClientVersion> query = new QueryWrapper<>(new BizBidClientVersion().setIpassVersion(version));
|
QueryWrapper<BizBidClientVersion> query = new QueryWrapper<>(new BizBidClientVersion().setIpassVersion(version));
|
||||||
return this.getOne(query);
|
BizBidClientVersion clientVersion = this.getOne(query);
|
||||||
|
return this.downloadClientByOId(clientVersion.getDocumentCenterId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FileOutputStream downloadFileByObjectId(String objectId) throws IOException {
|
public ByteArrayOutputStream downloadFileByOId(String objectId) throws IOException {
|
||||||
log.info("文档中心文件下载传入数据:"+ JsonUtils.objectToJson(objectId));
|
log.info("文档中心文件下载传入数据:"+ JsonUtils.objectToJson(objectId));
|
||||||
String objectInfo = documentCenterService.getFileObjectDetail(objectId);
|
String objectInfo = documentCenterService.getObjectDetail(objectId);
|
||||||
log.info("文档中心文件下载返回数据:"+ JsonUtils.objectToJson(objectInfo));
|
log.info("文档中心文件下载返回数据:"+ JsonUtils.objectToJson(objectInfo));
|
||||||
Optional<byte[]> optionalBytes = modelConvertor.toByteArray(objectInfo);
|
Optional<byte[]> optionalBytes = modelConvertor.toByteArray(objectInfo);
|
||||||
log.info("文档中心文件下载返回数据转为byte[]数据:"+ optionalBytes.get());
|
log.info("文档中心文件下载返回数据转为byte[]数据:"+ optionalBytes.get());
|
||||||
FileOutputStream fileOutputStream = null;
|
|
||||||
if(optionalBytes.isPresent()){
|
|
||||||
ByteArrayOutputStream fileStream = new ByteArrayOutputStream();
|
ByteArrayOutputStream fileStream = new ByteArrayOutputStream();
|
||||||
|
if(optionalBytes.isPresent()){
|
||||||
fileStream.write(optionalBytes.get());
|
fileStream.write(optionalBytes.get());
|
||||||
log.info("文档中心文件下载返回数据转为ByteArrayOutputStream数据:"+fileStream);
|
|
||||||
fileOutputStream.write(fileStream.toByteArray());
|
|
||||||
log.info("文档中心文件下载返回数据转为ByteArrayOutputStream数据:"+fileOutputStream);
|
|
||||||
}
|
}
|
||||||
return fileOutputStream;
|
return fileStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ByteArrayOutputStream downloadClientByOId(String objectId) throws IOException {
|
||||||
@Override
|
|
||||||
public FileOutputStream downloadFileByObjectIds(String objectId) throws IOException {
|
|
||||||
log.info("文档中心s文件下载传入数据:"+ JsonUtils.objectToJson(objectId));
|
log.info("文档中心s文件下载传入数据:"+ JsonUtils.objectToJson(objectId));
|
||||||
String objectInfo = documentCenterService.getObjectDetail(objectId);
|
String objectInfo = documentCenterService.getObjectDetail(objectId);
|
||||||
log.info("文档中心s文件下载返回数据:"+ JsonUtils.objectToJson(objectInfo));
|
log.info("文档中心s文件下载返回数据:"+ JsonUtils.objectToJson(objectInfo));
|
||||||
Optional<byte[]> optionalBytes = modelConvertor.toByteArray(objectInfo);
|
Optional<byte[]> optionalBytes = modelConvertor.toByteArray(objectInfo);
|
||||||
log.info("文档中心s文件下载返回数据转为byte[]数据:"+ optionalBytes.get());
|
log.info("文档中心s文件下载返回数据转为byte[]数据:"+ optionalBytes.get());
|
||||||
FileOutputStream fileOutputStream = null;
|
|
||||||
if(optionalBytes.isPresent()){
|
|
||||||
ByteArrayOutputStream fileStream = new ByteArrayOutputStream();
|
ByteArrayOutputStream fileStream = new ByteArrayOutputStream();
|
||||||
|
if(optionalBytes.isPresent()){
|
||||||
fileStream.write(optionalBytes.get());
|
fileStream.write(optionalBytes.get());
|
||||||
log.info("文档中心s文件下载返回数据转为ByteArrayOutputStream数据:"+fileStream);
|
|
||||||
fileOutputStream.write(fileStream.toByteArray());
|
|
||||||
log.info("文档中心s文件下载返回数据转为ByteArrayOutputStream数据:"+fileOutputStream);
|
|
||||||
}
|
}
|
||||||
return fileOutputStream;
|
return fileStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@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[]数据:"+ optionalBytes.get());
|
|
||||||
FileOutputStream fileOutputStream = null;
|
|
||||||
if(optionalBytes.isPresent()){
|
|
||||||
ByteArrayOutputStream fileStream = new ByteArrayOutputStream();
|
|
||||||
fileStream.write(optionalBytes.get());
|
|
||||||
log.info("文档中心s文件下载返回数据转为ByteArrayOutputStream数据:"+fileStream);
|
|
||||||
fileOutputStream = new FileOutputStream("C:\\test.txt");
|
|
||||||
fileOutputStream.write(fileStream.toByteArray());
|
|
||||||
log.info("文档中心s文件下载返回数据转为ByteArrayOutputStream数据:"+fileOutputStream);
|
|
||||||
}
|
|
||||||
return fileOutputStream;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
server:
|
server:
|
||||||
port: 18018
|
port: 9018
|
||||||
servlet:
|
servlet:
|
||||||
context-path: /
|
context-path: /
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user