修改了版本号和天梯仓库路径
This commit is contained in:
@ -52,6 +52,7 @@ public interface AttachmentClient {
|
||||
* @return
|
||||
*/
|
||||
Optional<byte[]> downloadFileByObjectId(String objectId);
|
||||
|
||||
|
||||
/**
|
||||
* 上传资源文件
|
||||
@ -61,7 +62,7 @@ public interface AttachmentClient {
|
||||
* @return
|
||||
*/
|
||||
Optional<UploadObject> upload(String businessId, File file);
|
||||
Optional<UploadObject> upload(Long businessId, File file);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@ -72,6 +73,5 @@ public interface AttachmentClient {
|
||||
* @return
|
||||
*/
|
||||
Optional<UploadObject> upload(String businessId, String filename, byte[] array);
|
||||
Optional<UploadObject> upload(Long businessId, String filename, byte[] array);
|
||||
|
||||
}
|
||||
|
@ -1,22 +1,27 @@
|
||||
package com.chinaunicom.ebtp.mall.cloud.attachment.sdk.api;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.convertor.FileConvertor;
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.convertor.ModelConvertor;
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.model.AttachmentDetail;
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.model.AttachmentEntity;
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.model.FeedbackMessage;
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.model.Snowflake;
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.model.UploadObject;
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.param.QueryParameter;
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.service.QueryService;
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.service.DocumentCenterService;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 附件工具客户端默认实现
|
||||
@ -25,22 +30,50 @@ import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.service.QueryService;
|
||||
*/
|
||||
@Primary
|
||||
@Component
|
||||
@Slf4j
|
||||
public class DefaultAttachmentClient implements AttachmentClient {
|
||||
|
||||
/* 附件工具类服务 */
|
||||
private @Autowired QueryService queryService;
|
||||
private @Autowired DocumentCenterService documentCenterService;
|
||||
|
||||
/* 模型转换器 */
|
||||
private @Autowired ModelConvertor modelConvertor;
|
||||
|
||||
/* 文件转换器 */
|
||||
private @Autowired FileConvertor fileConvertor;
|
||||
|
||||
/**
|
||||
* 获取业务ID
|
||||
* 根据业务id列表查询详单
|
||||
*
|
||||
* @param businessIdList
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Optional<AttachmentDetail> findByBusinessId(List<String> businessIdList) {
|
||||
log.debug("query bids: {}", businessIdList);
|
||||
String json = documentCenterService.fetchDetails(businessIdList);
|
||||
log.debug("fetch content: {}", json);
|
||||
|
||||
AttachmentDetail detail = new AttachmentDetail();
|
||||
|
||||
// 组织数据存储
|
||||
modelConvertor.toQueryResult(json).ifPresent(result -> {
|
||||
result.getData().stream().forEach(data -> {
|
||||
detail.add(new AttachmentEntity().setBid(data.getObjectId()).setId(data.getFileId())
|
||||
.setFilename(data.getOriginalName()));
|
||||
});
|
||||
});
|
||||
return Optional.ofNullable(detail);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成业务id
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Optional<String> getBusinessId() {
|
||||
Snowflake snowflake = queryService.getSnokflakId();
|
||||
|
||||
if (Objects.isNull(snowflake)) {
|
||||
return Optional.empty();
|
||||
}
|
||||
return Optional.of(snowflake.getId());
|
||||
return Optional.of(String.format("{\"id\":\"%s\"}", IdUtil.getSnowflake(23, 16).nextIdStr()));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -51,90 +84,83 @@ public class DefaultAttachmentClient implements AttachmentClient {
|
||||
*/
|
||||
@Override
|
||||
public Optional<AttachmentEntity> findByObjectId(String objectId) {
|
||||
AttachmentEntity entity = queryService.getObjectDetail(objectId);
|
||||
return Optional.ofNullable(entity);
|
||||
return modelConvertor.toAttachmentEntity(documentCenterService.getObjectDetail(objectId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过业务ID查找附件信息
|
||||
* 通过对象id下载附件
|
||||
*
|
||||
* @param businessIdList 业务ID列表
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Optional<AttachmentDetail> findByBusinessId(List<String> businessIdList) {
|
||||
QueryParameter param = new QueryParameter(businessIdList);
|
||||
AttachmentDetail attachemtnDetail = queryService.getAttachmentDetails(param);
|
||||
|
||||
return Optional.ofNullable(attachemtnDetail);
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件下载
|
||||
*
|
||||
* @param businessId 业务id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Optional<byte[]> downloadFilesByBusinessId(String businessId) {
|
||||
return Optional.ofNullable(queryService.downloadByBid(businessId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件下载
|
||||
*
|
||||
* @param objectId 对象id
|
||||
* @param objectId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Optional<byte[]> downloadFileByObjectId(String objectId) {
|
||||
return Optional.ofNullable(queryService.downloadByOid(objectId));
|
||||
return modelConvertor.toByteArray(documentCenterService.getObjectDetail(objectId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传附件
|
||||
* 根据业务id下载文件
|
||||
*
|
||||
* @param businessId 业务id
|
||||
* @param file 文件
|
||||
* @param businessId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Optional<byte[]> downloadFilesByBusinessId(String businessId) {
|
||||
Optional<AttachmentDetail> op = findByBusinessId(Arrays.asList(businessId));
|
||||
|
||||
if (op.isPresent()) {
|
||||
List<AttachmentEntity> list = op.get().get(businessId);
|
||||
|
||||
// 如果业务id下只包含单独一个文件,则直接返回该文件数据
|
||||
if (list.size() == 1) {
|
||||
return downloadFileByObjectId(list.get(0).getId());
|
||||
}
|
||||
// 如果大于1个则下载返回压缩包数据流
|
||||
else if (list.size() > 1) {
|
||||
try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
|
||||
try (ZipOutputStream zout = new ZipOutputStream(out)) {
|
||||
list.stream().forEach(data -> {
|
||||
try {
|
||||
zout.putNextEntry(new ZipEntry(data.getId() + data.getFilename()));// 文件项名称
|
||||
zout.write(downloadFileByObjectId(data.getId()).get());// 文件数据流
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
return Optional.ofNullable(out.toByteArray());
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
*
|
||||
* @param businessId
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Optional<UploadObject> upload(String businessId, File file) {
|
||||
Objects.requireNonNull(businessId);
|
||||
Objects.requireNonNull(file);
|
||||
String res = documentCenterService.upload("ebtp-mall-cloud", businessId, fileConvertor.toMultipartFile(file));
|
||||
|
||||
FeedbackMessage feedback = queryService.handleFileUpload(businessId, FileConvertor.toMultipartFile(file));
|
||||
log.debug(res);
|
||||
|
||||
return Optional.ofNullable(new UploadObject().setId(feedback.getOid()));
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<UploadObject> upload(Long businessId, File file) {
|
||||
return upload(businessId.toString(), file);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传附件
|
||||
*
|
||||
* @param businessId 业务ID
|
||||
* @param filename 文件名称
|
||||
* @param array 文件字节组
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Optional<UploadObject> upload(String businessId, String filename, byte[] array) {
|
||||
Objects.requireNonNull(businessId);
|
||||
Objects.requireNonNull(array);
|
||||
String res = documentCenterService.upload("ebtp-mall-cloud", businessId,
|
||||
fileConvertor.toMultipartFile(filename, array));
|
||||
|
||||
FeedbackMessage feedback = queryService.handleFileUpload(businessId,
|
||||
FileConvertor.toMultipartFile(filename, array));
|
||||
log.debug(res);
|
||||
|
||||
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);
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,8 +0,0 @@
|
||||
package com.chinaunicom.ebtp.mall.cloud.attachment.sdk.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class FeignSupportConfig {
|
||||
|
||||
}
|
@ -1,14 +1,34 @@
|
||||
package com.chinaunicom.ebtp.mall.cloud.attachment.sdk.config;
|
||||
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.convertor.FileConvertor;
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.convertor.ModelConvertor;
|
||||
|
||||
@Configuration
|
||||
@EnableFeignClients(basePackages = "com.chinaunicom.ebtp.mall.cloud.attachment.sdk")
|
||||
@ComponentScan(basePackages = "com.chinaunicom.ebtp.mall.cloud.attachment.sdk")
|
||||
@PropertySource("classpath:attachment-sdk-cofiguration.properties")
|
||||
public class SDKAutoConfiguration {
|
||||
|
||||
/**
|
||||
* @return 数据模型转换器
|
||||
*/
|
||||
@Bean
|
||||
public ModelConvertor modelConvertor() {
|
||||
return new ModelConvertor();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 文件转换器
|
||||
*/
|
||||
@Bean
|
||||
public FileConvertor fileConvertor() {
|
||||
return new FileConvertor();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,21 +1,23 @@
|
||||
package com.chinaunicom.ebtp.mall.cloud.attachment.sdk.convertor;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import org.apache.commons.fileupload.FileItem;
|
||||
import org.apache.commons.fileupload.FileItemFactory;
|
||||
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 文件转换器
|
||||
*
|
||||
* @author Ajaxfan
|
||||
*/
|
||||
@Slf4j
|
||||
public final class FileConvertor {
|
||||
|
||||
/**
|
||||
@ -24,21 +26,13 @@ public final class FileConvertor {
|
||||
* @param file 原始文件对象
|
||||
* @return
|
||||
*/
|
||||
public static MultipartFile toMultipartFile(File file) {
|
||||
FileItemFactory factory = new DiskFileItemFactory(16, null);
|
||||
FileItem item = factory.createItem("file", "text/plain", true, file.getName());
|
||||
public MultipartFile toMultipartFile(File file) {
|
||||
FileItem item = createFileItem(file.getName());
|
||||
|
||||
int bytesRead = 0;
|
||||
byte[] buffer = new byte[8192];
|
||||
|
||||
try (FileInputStream fis = new FileInputStream(file)) {
|
||||
try (OutputStream os = item.getOutputStream()) {
|
||||
while ((bytesRead = fis.read(buffer, 0, 8192)) != -1) {
|
||||
os.write(buffer, 0, bytesRead);
|
||||
}
|
||||
}
|
||||
try {
|
||||
FileUtils.copyFile(file, item.getOutputStream());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
return new CommonsMultipartFile(item);
|
||||
}
|
||||
@ -50,16 +44,26 @@ public final class FileConvertor {
|
||||
* @param array 文件字节组
|
||||
* @return
|
||||
*/
|
||||
public static MultipartFile toMultipartFile(String filename, byte[] array) {
|
||||
FileItemFactory factory = new DiskFileItemFactory(16, null);
|
||||
FileItem item = factory.createItem("file", "text/plain", true, filename);
|
||||
public MultipartFile toMultipartFile(String filename, byte[] array) {
|
||||
FileItem item = createFileItem(filename);
|
||||
|
||||
try (OutputStream os = item.getOutputStream()) {
|
||||
os.write(array);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
return new CommonsMultipartFile(item);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////// private
|
||||
/////////////////////////////////////////////////////////////////////////// Method
|
||||
|
||||
/**
|
||||
* @param filename
|
||||
* @return
|
||||
*/
|
||||
private FileItem createFileItem(String filename) {
|
||||
return new DiskFileItemFactory(16, null).createItem("file", "text/plain", true, filename);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,97 @@
|
||||
package com.chinaunicom.ebtp.mall.cloud.attachment.sdk.convertor;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.model.AttachmentEntity;
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.vo.down.DownStream;
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.vo.down.SysStorageVO;
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.vo.query.QueryResult;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 山分数据模型转换为吉林数据模型
|
||||
*
|
||||
* @author Ajaxfan
|
||||
*/
|
||||
@Slf4j
|
||||
public class ModelConvertor {
|
||||
|
||||
private ObjectMapper objectMapper;
|
||||
|
||||
public ModelConvertor() {
|
||||
objectMapper = new ObjectMapper();
|
||||
/** 实体中存在未定义的属性是不报出错误 */
|
||||
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 山分接口返回的json数据包转换为吉林实体模型
|
||||
*
|
||||
* @param json
|
||||
* @return
|
||||
*/
|
||||
public Optional<AttachmentEntity> toAttachmentEntity(String json) {
|
||||
AttachmentEntity entity = null;
|
||||
|
||||
try {
|
||||
SysStorageVO vo = toSysStorageVO(json);
|
||||
log.debug("convert to model: {}", vo);
|
||||
|
||||
entity = new AttachmentEntity();
|
||||
entity.setId(vo.getFileId()).setFilename(vo.getOriginalName()).setBid(vo.getObjectId());
|
||||
} catch (JsonProcessingException e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
return Optional.ofNullable(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param json
|
||||
* @return
|
||||
*/
|
||||
public Optional<QueryResult> toQueryResult(String json) {
|
||||
QueryResult result = null;
|
||||
try {
|
||||
result = objectMapper.readValue(json, QueryResult.class);
|
||||
} catch (JsonProcessingException e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
return Optional.ofNullable(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param json
|
||||
* @return
|
||||
*/
|
||||
public Optional<byte[]> toByteArray(String json) {
|
||||
byte[] array = null;
|
||||
|
||||
try {
|
||||
array = toSysStorageVO(json).getFileStream();
|
||||
} catch (JsonProcessingException e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
return Optional.ofNullable(array);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////// private
|
||||
/////////////////////////////////////////////////////////////////////////// method
|
||||
/**
|
||||
* Json转换为业务实体
|
||||
*
|
||||
* @param json
|
||||
* @return
|
||||
* @throws JsonMappingException
|
||||
* @throws JsonProcessingException
|
||||
*/
|
||||
private SysStorageVO toSysStorageVO(String json) throws JsonMappingException, JsonProcessingException {
|
||||
log.debug("current convertor json is: {}", json);
|
||||
return objectMapper.readValue(json, DownStream.class).getData().getSysStorageVO();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.chinaunicom.ebtp.mall.cloud.attachment.sdk.fallback;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.service.DocumentCenterService;
|
||||
|
||||
@Component
|
||||
public class DocumentCenterServiceFallback implements DocumentCenterService {
|
||||
|
||||
@Override
|
||||
public String getObjectDetail(String fileId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String fetchDetails(List<String> bids) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String upload(String appCode, String objectId, MultipartFile multipartFiles) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package com.chinaunicom.ebtp.mall.cloud.attachment.sdk.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Hashtable;
|
||||
import java.util.List;
|
||||
|
||||
@ -11,4 +12,16 @@ import java.util.List;
|
||||
public class AttachmentDetail extends Hashtable<String, List<AttachmentEntity>> {
|
||||
private static final long serialVersionUID = -6579549900874220624L;
|
||||
|
||||
/**
|
||||
* 清单项入库操作
|
||||
*
|
||||
* @param entity
|
||||
*/
|
||||
public void add(AttachmentEntity entity) {
|
||||
String bid = entity.getBid();
|
||||
List<AttachmentEntity> list = containsKey(bid) ? get(bid) : new ArrayList<>();
|
||||
list.add(entity);
|
||||
put(bid, list);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,51 @@
|
||||
package com.chinaunicom.ebtp.mall.cloud.attachment.sdk.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RequestPart;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.fallback.DocumentCenterServiceFallback;
|
||||
|
||||
/**
|
||||
* 连接山分的文档中心服务
|
||||
*
|
||||
* @author Ajaxfan
|
||||
*/
|
||||
@FeignClient(name = "DocumentCenterService", url = "${document.center.ip-address}", fallback = DocumentCenterServiceFallback.class)
|
||||
public interface DocumentCenterService {
|
||||
|
||||
/**
|
||||
* 通过附件id查询明细
|
||||
*
|
||||
* @param fileId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = "v1.0/files/downloadAllStream")
|
||||
String getObjectDetail(@RequestParam("fileId") String fileId);
|
||||
|
||||
/**
|
||||
* 通过业务id列表获取明细
|
||||
*
|
||||
* @param bids
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = "v1.0/files/queryReturn")
|
||||
String fetchDetails(@RequestBody List<String> bids);
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = "/v1.0/files/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
String upload(@RequestPart("appCode") String appCode, @RequestPart("objectId") String objectId,
|
||||
@RequestPart("multipartFiles") MultipartFile multipartFiles);
|
||||
|
||||
}
|
@ -10,7 +10,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestPart;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.config.FeignSupportConfig;
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.fallback.QueryServiceFallback;
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.model.AttachmentDetail;
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.model.AttachmentEntity;
|
||||
@ -18,7 +17,7 @@ import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.model.FeedbackMessage;
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.model.Snowflake;
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.param.QueryParameter;
|
||||
|
||||
@FeignClient(value = "core-service-ebtp-updownload", configuration = FeignSupportConfig.class, fallback = QueryServiceFallback.class)
|
||||
@FeignClient(value = "core-service-ebtp-updownload", fallback = QueryServiceFallback.class)
|
||||
public interface QueryService {
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = "v1/business/id")
|
||||
|
@ -0,0 +1,13 @@
|
||||
package com.chinaunicom.ebtp.mall.cloud.attachment.sdk.vo.down;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DownStream {
|
||||
|
||||
private Integer code;
|
||||
private Boolean success;
|
||||
private String message;
|
||||
private DownStreamData data;
|
||||
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.chinaunicom.ebtp.mall.cloud.attachment.sdk.vo.down;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DownStreamData {
|
||||
|
||||
private SysStorageVO sysStorageVO;
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.chinaunicom.ebtp.mall.cloud.attachment.sdk.vo.down;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SysStorageVO {
|
||||
|
||||
/* 文件原始名称 */
|
||||
private String originalName;
|
||||
|
||||
/* 附件id */
|
||||
private String fileId;
|
||||
|
||||
/* 业务id */
|
||||
private String objectId;
|
||||
|
||||
/* 文件流 */
|
||||
private byte[] fileStream;
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.chinaunicom.ebtp.mall.cloud.attachment.sdk.vo.query;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class QueryData {
|
||||
|
||||
private String fileId;
|
||||
private String objectId;
|
||||
private String originalName;
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.chinaunicom.ebtp.mall.cloud.attachment.sdk.vo.query;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class QueryResult {
|
||||
|
||||
private List<QueryData> data;
|
||||
|
||||
}
|
@ -1,2 +1,6 @@
|
||||
ribbon.ReadTimeout=1800000
|
||||
ribbon.SocketTimeout=1800000
|
||||
|
||||
# document center id
|
||||
document.center.service.id=core-service-document-center
|
||||
document.center.ip-address=http://10.242.31.158:8801/
|
Reference in New Issue
Block a user