修改附件sdk的校验
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
package com.chinaunicom.ebtp.mall.cloud.attachment.sdk.convertor;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.model.AttachmentEntity;
|
||||
@ -11,7 +10,6 @@ import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.vo.SysStorageVO;
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.vo.down.DownStream;
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.vo.query.QueryResult;
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.vo.upload.UploadStream;
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.vo.upload.UploadStreamData;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||
@ -136,7 +134,8 @@ public class ModelConvertor {
|
||||
*/
|
||||
private SysStorageVO tpDownPO(String json) throws JsonMappingException, JsonProcessingException {
|
||||
log.debug("current convertor json is: {}", json);
|
||||
return objectMapper.readValue(json, DownStream.class).getData().getSysStorageVO();
|
||||
return Optional.ofNullable(objectMapper.readValue(json, DownStream.class))
|
||||
.map(ds -> ds.getData().getSysStorageVO()).orElseGet(SysStorageVO::new);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -147,9 +146,9 @@ public class ModelConvertor {
|
||||
*/
|
||||
private SysStorageVO toUploadPO(String json) throws JsonMappingException, JsonProcessingException {
|
||||
log.debug("current convertor json is: {}", json);
|
||||
List<UploadStreamData> list = objectMapper.readValue(json, UploadStream.class).getData();
|
||||
|
||||
return list.stream().findFirst().map(obj -> obj.getSysStorageVO()).orElseGet(SysStorageVO::new);
|
||||
return Optional.ofNullable(objectMapper.readValue(json, UploadStream.class).getData())
|
||||
.map(ls -> ls.stream().findFirst().map(obj -> obj.getSysStorageVO()).orElseGet(() -> null))
|
||||
.orElseGet(SysStorageVO::new);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user