记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
董敬伟
liquidnet-bus-v1
Commits
159a1775
Commit
159a1775
authored
Mar 23, 2022
by
anjiabin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改文件上传接口
parent
d1221962
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
278 additions
and
112 deletions
+278
-112
GalaxySeriesInfoBo.java
...m/liquidnet/service/galaxy/dto/bo/GalaxySeriesInfoBo.java
+5
-1
GalaxyArtSeriesClaimResultQueryRespDto.java
...axy/dto/param/GalaxyArtSeriesClaimResultQueryRespDto.java
+1
-1
GalaxyBaseReqDto.java
.../liquidnet/service/galaxy/dto/param/GalaxyBaseReqDto.java
+1
-1
GalaxyNftUploadReqDto.java
...idnet/service/galaxy/dto/param/GalaxyNftUploadReqDto.java
+5
-2
GalaxyNftUploadRespDto.java
...dnet/service/galaxy/dto/param/GalaxyNftUploadRespDto.java
+10
-4
GalaxySeriesInfoVo.java
...idnet/service/galaxy/dto/vo/mongo/GalaxySeriesInfoVo.java
+5
-1
pom.xml
...dnet-service-galaxy/liquidnet-service-galaxy-impl/pom.xml
+5
-0
GalaxyCommonBiz.java
...t/service/galaxy/router/strategy/biz/GalaxyCommonBiz.java
+60
-0
GalaxyEnumBiz.java
...net/service/galaxy/router/strategy/biz/GalaxyEnumBiz.java
+93
-0
ZxinArtworkBiz.java
...uidnet/service/galaxy/router/zxin/biz/ZxinArtworkBiz.java
+81
-95
ZxinUserBiz.java
...liquidnet/service/galaxy/router/zxin/biz/ZxinUserBiz.java
+5
-2
GalaxyRouterStrategyZxlArtworkImpl.java
...uter/zxin/service/GalaxyRouterStrategyZxlArtworkImpl.java
+1
-1
TestZxinArtworkBiz.java
...java/com/liquidnet/service/galaxy/TestZxinArtworkBiz.java
+1
-1
TestZxlnftSdkUtil.java
.../java/com/liquidnet/service/galaxy/TestZxlnftSdkUtil.java
+5
-3
No files found.
liquidnet-bus-api/liquidnet-service-galaxy-api/src/main/java/com/liquidnet/service/galaxy/dto/bo/GalaxySeriesInfoBo.java
View file @
159a1775
...
@@ -40,7 +40,11 @@ public class GalaxySeriesInfoBo implements Serializable,Cloneable {
...
@@ -40,7 +40,11 @@ public class GalaxySeriesInfoBo implements Serializable,Cloneable {
/**
/**
* nft素材原始地址
* nft素材原始地址
*/
*/
private
String
nftOriginalUrl
;
private
String
originalNftUrl
;
/**
* nft显示素材原始地址
*/
private
String
originalDisplayUrl
;
/**
/**
* 系列发布状态
* 系列发布状态
*/
*/
...
...
liquidnet-bus-api/liquidnet-service-galaxy-api/src/main/java/com/liquidnet/service/galaxy/dto/param/GalaxyArtSeriesClaimResultQueryRespDto.java
View file @
159a1775
...
@@ -20,7 +20,7 @@ import java.io.Serializable;
...
@@ -20,7 +20,7 @@ import java.io.Serializable;
@Data
@Data
public
class
GalaxyArtSeriesClaimResultQueryRespDto
implements
Serializable
,
Cloneable
{
public
class
GalaxyArtSeriesClaimResultQueryRespDto
implements
Serializable
,
Cloneable
{
/**
/**
* 标记任务状态,
2:任务执行中 7:任务成功 10
:任务失败
* 标记任务状态,
0:任务执行中 1:任务成功 2
:任务失败
*/
*/
@ApiModelProperty
(
position
=
3
,
required
=
true
,
value
=
"标记任务状态,0:任务执行中 1:任务成功 2:任务失败"
)
@ApiModelProperty
(
position
=
3
,
required
=
true
,
value
=
"标记任务状态,0:任务执行中 1:任务成功 2:任务失败"
)
private
Integer
taskStatus
;
private
Integer
taskStatus
;
...
...
liquidnet-bus-api/liquidnet-service-galaxy-api/src/main/java/com/liquidnet/service/galaxy/dto/param/GalaxyBaseReqDto.java
View file @
159a1775
...
@@ -24,7 +24,7 @@ public class GalaxyBaseReqDto implements Serializable,Cloneable{
...
@@ -24,7 +24,7 @@ public class GalaxyBaseReqDto implements Serializable,Cloneable{
*/
*/
@ApiModelProperty
(
position
=
1
,
required
=
true
,
value
=
"路由类型(至信链zxinchain、以太坊eth)"
)
@ApiModelProperty
(
position
=
1
,
required
=
true
,
value
=
"路由类型(至信链zxinchain、以太坊eth)"
)
@NotBlank
(
message
=
"路由类型不能为空!"
)
@NotBlank
(
message
=
"路由类型不能为空!"
)
private
String
routeType
=
GalaxyConstant
.
RouterTypeEnum
.
ZXINCHAIN
.
getCode
();
private
String
route
r
Type
=
GalaxyConstant
.
RouterTypeEnum
.
ZXINCHAIN
.
getCode
();
@Override
@Override
public
String
toString
(){
public
String
toString
(){
...
...
liquidnet-bus-api/liquidnet-service-galaxy-api/src/main/java/com/liquidnet/service/galaxy/dto/param/GalaxyNftUploadReqDto.java
View file @
159a1775
...
@@ -19,8 +19,11 @@ import java.io.Serializable;
...
@@ -19,8 +19,11 @@ import java.io.Serializable;
@ApiModel
(
value
=
"GalaxyNftUploadReqDto"
,
description
=
"NFT素材上传"
)
@ApiModel
(
value
=
"GalaxyNftUploadReqDto"
,
description
=
"NFT素材上传"
)
@Data
@Data
public
class
GalaxyNftUploadReqDto
extends
GalaxyBaseReqDto
implements
Serializable
,
Cloneable
{
public
class
GalaxyNftUploadReqDto
extends
GalaxyBaseReqDto
implements
Serializable
,
Cloneable
{
@ApiModelProperty
(
position
=
1
,
required
=
true
,
value
=
"上传原始素材url"
)
@ApiModelProperty
(
position
=
1
,
required
=
true
,
value
=
"nft原始素材url"
)
private
String
nftOriginalUrl
;
private
String
originalNftUrl
;
@ApiModelProperty
(
position
=
1
,
required
=
true
,
value
=
"显示图原始素材url"
)
private
String
originalDisplayUrl
;
@ApiModelProperty
(
position
=
2
,
required
=
true
,
value
=
"商品唯一规格ID"
)
@ApiModelProperty
(
position
=
2
,
required
=
true
,
value
=
"商品唯一规格ID"
)
private
String
skuId
;
private
String
skuId
;
...
...
liquidnet-bus-api/liquidnet-service-galaxy-api/src/main/java/com/liquidnet/service/galaxy/dto/param/GalaxyNftUploadRespDto.java
View file @
159a1775
...
@@ -22,11 +22,17 @@ public class GalaxyNftUploadRespDto implements Serializable,Cloneable {
...
@@ -22,11 +22,17 @@ public class GalaxyNftUploadRespDto implements Serializable,Cloneable {
@ApiModelProperty
(
position
=
1
,
required
=
true
,
value
=
"skuId"
)
@ApiModelProperty
(
position
=
1
,
required
=
true
,
value
=
"skuId"
)
private
String
skuId
;
private
String
skuId
;
@ApiModelProperty
(
position
=
2
,
required
=
true
,
value
=
"素材原始地址
"
)
@ApiModelProperty
(
position
=
1
,
required
=
true
,
value
=
"nft原始素材url
"
)
private
String
nftOriginal
Url
;
private
String
originalNft
Url
;
@ApiModelProperty
(
position
=
3
,
required
=
true
,
value
=
"素材访问地址"
)
@ApiModelProperty
(
position
=
1
,
required
=
true
,
value
=
"显示图原始素材url"
)
private
String
materialAccessUrl
;
private
String
originalDisplayUrl
;
@ApiModelProperty
(
position
=
2
,
required
=
true
,
value
=
"nft链上访问地址"
)
private
String
nftUrl
;
@ApiModelProperty
(
position
=
3
,
required
=
true
,
value
=
"缩略图链上访问地址"
)
private
String
displayUrl
;
@Override
@Override
...
...
liquidnet-bus-api/liquidnet-service-galaxy-api/src/main/java/com/liquidnet/service/galaxy/dto/vo/mongo/GalaxySeriesInfoVo.java
View file @
159a1775
...
@@ -40,7 +40,11 @@ public class GalaxySeriesInfoVo implements Serializable,Cloneable {
...
@@ -40,7 +40,11 @@ public class GalaxySeriesInfoVo implements Serializable,Cloneable {
/**
/**
* nft素材原始地址
* nft素材原始地址
*/
*/
private
String
nftOriginalUrl
;
private
String
originalNftUrl
;
/**
* nft显示素材原始地址
*/
private
String
originalDisplayUrl
;
/**
/**
* 系列发布状态
* 系列发布状态
*/
*/
...
...
liquidnet-bus-service/liquidnet-service-galaxy/liquidnet-service-galaxy-impl/pom.xml
View file @
159a1775
...
@@ -21,6 +21,11 @@
...
@@ -21,6 +21,11 @@
<artifactId>
liquidnet-common-third-zxlnft
</artifactId>
<artifactId>
liquidnet-common-third-zxlnft
</artifactId>
<version>
1.0-SNAPSHOT
</version>
<version>
1.0-SNAPSHOT
</version>
</dependency>
</dependency>
<dependency>
<groupId>
com.liquidnet
</groupId>
<artifactId>
liquidnet-common-third-antchain
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
<dependency>
<dependency>
<groupId>
com.liquidnet
</groupId>
<groupId>
com.liquidnet
</groupId>
<artifactId>
liquidnet-service-galaxy-api
</artifactId>
<artifactId>
liquidnet-service-galaxy-api
</artifactId>
...
...
liquidnet-bus-service/liquidnet-service-galaxy/liquidnet-service-galaxy-impl/src/main/java/com/liquidnet/service/galaxy/router/strategy/biz/GalaxyCommonBiz.java
0 → 100644
View file @
159a1775
package
com
.
liquidnet
.
service
.
galaxy
.
router
.
strategy
.
biz
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: GalaxyCommonBiz
* @Package com.liquidnet.service.galaxy.router.strategy.biz
* @Copyright: LightNet @ Copyright (c) 2022
* @date 2022/3/23 11:20
*/
@Slf4j
@Component
public
class
GalaxyCommonBiz
{
@Value
(
"${liquidnet.galaxy.temp-file-path:/Users/anjiabin/mdsky_gitlab/galaxy/tempFilePath}"
)
private
String
tempFilePath
;
/**
* 通过URL上传
* @param url
* @param name
* @return
*/
public
File
inputStreamToFile
(
String
url
,
String
name
)
{
try
{
HttpURLConnection
httpUrl
=
(
HttpURLConnection
)
new
URL
(
url
).
openConnection
();
httpUrl
.
connect
();
InputStream
ins
=
httpUrl
.
getInputStream
();
// File file = new File(System.getProperty("java.io.tmpdir") + File.separator + name);
File
file
=
new
File
(
tempFilePath
+
File
.
separator
+
name
);
if
(
file
.
exists
())
{
return
file
;
}
OutputStream
os
=
new
FileOutputStream
(
file
);
int
bytesRead
;
int
len
=
8192
;
byte
[]
buffer
=
new
byte
[
len
];
while
((
bytesRead
=
ins
.
read
(
buffer
,
0
,
len
))
!=
-
1
)
{
os
.
write
(
buffer
,
0
,
bytesRead
);
}
os
.
close
();
ins
.
close
();
return
file
;
}
catch
(
Exception
e
)
{
log
.
error
(
"inputStreamToFileUrlError"
,
e
);
return
null
;
}
}
}
liquidnet-bus-service/liquidnet-service-galaxy/liquidnet-service-galaxy-impl/src/main/java/com/liquidnet/service/galaxy/router/strategy/biz/GalaxyEnumBiz.java
0 → 100644
View file @
159a1775
package
com
.
liquidnet
.
service
.
galaxy
.
router
.
strategy
.
biz
;
import
com.liquidnet.common.third.antchain.constant.AntchainEnum
;
import
com.liquidnet.common.third.zxlnft.constant.ZxlnftEnum
;
import
com.liquidnet.service.galaxy.constant.GalaxyConstant
;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: GalaxyConstantBiz
* @Package com.liquidnet.service.galaxy.router.strategy
* @Copyright: LightNet @ Copyright (c) 2022
* @date 2022/3/22 12:11
*/
public
class
GalaxyEnumBiz
{
/**
* 任务状态转换
* @param routerTypeEnum
* @param code
* @return
*/
public
static
GalaxyConstant
.
TaskStatusEnum
getTaskStatusEnum
(
GalaxyConstant
.
RouterTypeEnum
routerTypeEnum
,
String
code
){
GalaxyConstant
.
TaskStatusEnum
taskStatusEnum
=
null
;
switch
(
routerTypeEnum
.
getCode
()){
case
"zxinchain"
:
if
(
code
.
equalsIgnoreCase
(
ZxlnftEnum
.
TaskStatusEnum
.
PROCESSING
.
getCode
())){
taskStatusEnum
=
GalaxyConstant
.
TaskStatusEnum
.
PROCESSING
;
break
;
}
else
if
(
code
.
equalsIgnoreCase
(
ZxlnftEnum
.
TaskStatusEnum
.
TASK_SUCCESS
.
getCode
())){
taskStatusEnum
=
GalaxyConstant
.
TaskStatusEnum
.
TASK_SUCCESS
;
break
;
}
else
if
(
code
.
equalsIgnoreCase
(
ZxlnftEnum
.
TaskStatusEnum
.
TASK_FAIL
.
getCode
())){
taskStatusEnum
=
GalaxyConstant
.
TaskStatusEnum
.
TASK_FAIL
;
break
;
}
case
"antchain"
:
if
(
code
.
equalsIgnoreCase
(
AntchainEnum
.
TaskStatusEnum
.
PROCESSING
.
getCode
())){
taskStatusEnum
=
GalaxyConstant
.
TaskStatusEnum
.
PROCESSING
;
break
;
}
else
if
(
code
.
equalsIgnoreCase
(
AntchainEnum
.
TaskStatusEnum
.
TASK_SUCCESS
.
getCode
())){
taskStatusEnum
=
GalaxyConstant
.
TaskStatusEnum
.
TASK_SUCCESS
;
break
;
}
else
if
(
code
.
equalsIgnoreCase
(
AntchainEnum
.
TaskStatusEnum
.
TASK_FAIL
.
getCode
())){
taskStatusEnum
=
GalaxyConstant
.
TaskStatusEnum
.
TASK_FAIL
;
break
;
}
}
return
taskStatusEnum
;
}
/**
* 用户绑定状态
* @param routerType
* @param code
* @return
*/
public
static
GalaxyConstant
.
UserBindStatusEnum
getUserBindStatusEnum
(
String
routerType
,
String
code
)
{
GalaxyConstant
.
UserBindStatusEnum
userBindStatusEnum
=
null
;
switch
(
routerType
)
{
case
"zxinchain"
:
if
(
code
.
equalsIgnoreCase
(
ZxlnftEnum
.
UserBindStatusEnum
.
BIND_PROCESSING
.
getCode
()))
{
userBindStatusEnum
=
GalaxyConstant
.
UserBindStatusEnum
.
BIND_PROCESSING
;
break
;
}
else
if
(
code
.
equalsIgnoreCase
(
ZxlnftEnum
.
UserBindStatusEnum
.
BIND_SUCCESS
.
getCode
()))
{
userBindStatusEnum
=
GalaxyConstant
.
UserBindStatusEnum
.
BIND_SUCCESS
;
break
;
}
else
if
(
code
.
equalsIgnoreCase
(
ZxlnftEnum
.
UserBindStatusEnum
.
BIND_FAIL
.
getCode
()))
{
userBindStatusEnum
=
GalaxyConstant
.
UserBindStatusEnum
.
BIND_FAIL
;
break
;
}
else
if
(
code
.
equalsIgnoreCase
(
ZxlnftEnum
.
UserBindStatusEnum
.
BIND_CANNOT_QUERY
.
getCode
()))
{
userBindStatusEnum
=
GalaxyConstant
.
UserBindStatusEnum
.
BIND_CANNOT_QUERY
;
break
;
}
case
"antchain"
:
if
(
code
.
equalsIgnoreCase
(
AntchainEnum
.
UserBindStatusEnum
.
BIND_PROCESSING
.
getCode
()))
{
userBindStatusEnum
=
GalaxyConstant
.
UserBindStatusEnum
.
BIND_PROCESSING
;
break
;
}
else
if
(
code
.
equalsIgnoreCase
(
AntchainEnum
.
UserBindStatusEnum
.
BIND_SUCCESS
.
getCode
()))
{
userBindStatusEnum
=
GalaxyConstant
.
UserBindStatusEnum
.
BIND_SUCCESS
;
break
;
}
else
if
(
code
.
equalsIgnoreCase
(
AntchainEnum
.
UserBindStatusEnum
.
BIND_FAIL
.
getCode
()))
{
userBindStatusEnum
=
GalaxyConstant
.
UserBindStatusEnum
.
BIND_FAIL
;
break
;
}
else
if
(
code
.
equalsIgnoreCase
(
AntchainEnum
.
UserBindStatusEnum
.
BIND_CANNOT_QUERY
.
getCode
()))
{
userBindStatusEnum
=
GalaxyConstant
.
UserBindStatusEnum
.
BIND_CANNOT_QUERY
;
break
;
}
}
return
userBindStatusEnum
;
}
}
liquidnet-bus-service/liquidnet-service-galaxy/liquidnet-service-galaxy-impl/src/main/java/com/liquidnet/service/galaxy/router/zxin/biz/ZxinArtworkBiz.java
View file @
159a1775
...
@@ -19,19 +19,14 @@ import com.liquidnet.service.galaxy.constant.GalaxyConstant;
...
@@ -19,19 +19,14 @@ import com.liquidnet.service.galaxy.constant.GalaxyConstant;
import
com.liquidnet.service.galaxy.constant.GalaxyErrorCodeEnum
;
import
com.liquidnet.service.galaxy.constant.GalaxyErrorCodeEnum
;
import
com.liquidnet.service.galaxy.dto.bo.GalaxySeriesInfoBo
;
import
com.liquidnet.service.galaxy.dto.bo.GalaxySeriesInfoBo
;
import
com.liquidnet.service.galaxy.dto.param.*
;
import
com.liquidnet.service.galaxy.dto.param.*
;
import
com.liquidnet.service.galaxy.router.strategy.biz.GalaxyCommonBiz
;
import
com.liquidnet.service.galaxy.utils.DataUtils
;
import
com.liquidnet.service.galaxy.utils.DataUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.io.File
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
/**
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @author AnJiabin <anjiabin@zhengzai.tv>
...
@@ -60,8 +55,8 @@ public class ZxinArtworkBiz {
...
@@ -60,8 +55,8 @@ public class ZxinArtworkBiz {
@Autowired
@Autowired
private
DataUtils
dataUtils
;
private
DataUtils
dataUtils
;
@
Value
(
"${liquidnet.galaxy.temp-file-path:/Users/anjiabin/mdsky_gitlab/galaxy/tempFilePath}"
)
@
Autowired
private
String
tempFilePath
;
private
GalaxyCommonBiz
galaxyCommonBiz
;
public
ResponseDto
<
GalaxyNftImageRespDto
>
nftImageCheck
(
GalaxyNftImageReqDto
reqDto
)
{
public
ResponseDto
<
GalaxyNftImageRespDto
>
nftImageCheck
(
GalaxyNftImageReqDto
reqDto
)
{
Nft008QueryImageModerationReqDto
nft008ReqDto
=
Nft008QueryImageModerationReqDto
.
getNew
();
Nft008QueryImageModerationReqDto
nft008ReqDto
=
Nft008QueryImageModerationReqDto
.
getNew
();
...
@@ -78,66 +73,21 @@ public class ZxinArtworkBiz {
...
@@ -78,66 +73,21 @@ public class ZxinArtworkBiz {
public
ResponseDto
<
GalaxyNftUploadRespDto
>
nftUpload
(
GalaxyNftUploadReqDto
reqDto
)
{
public
ResponseDto
<
GalaxyNftUploadRespDto
>
nftUpload
(
GalaxyNftUploadReqDto
reqDto
)
{
String
imageUrl
=
reqDto
.
getNftOriginalUrl
();
String
originalNftUrl
=
reqDto
.
getOriginalNftUrl
();
String
originalDisplayUrl
=
reqDto
.
getOriginalDisplayUrl
();
//上传系列名只用来目录区分
//上传系列名只用来目录区分
String
seriesName
=
GalaxyConstant
.
SERIES_NAME_PREFIX
+
reqDto
.
getSkuId
();
//素材存储目录
String
seriesName
=
GalaxyConstant
.
SERIES_NAME_PREFIX
+
reqDto
.
getSkuId
();
//素材存储目录
String
filePath
=
null
;
String
imageType
=
imageUrl
.
substring
(
imageUrl
.
lastIndexOf
(
"."
),
imageUrl
.
length
());
String
fileName
=
IDGenerator
.
getZxlNftImageCosCode
()
+
imageType
;
//通过图片url地址上传
File
cosFile
=
this
.
inputStreamToFile
(
reqDto
.
getNftOriginalUrl
(),
fileName
);
filePath
=
cosFile
.
getAbsolutePath
();
log
.
info
(
"cosFile.getPath() :{}"
,
cosFile
.
getPath
());
log
.
info
(
"cosFile.getAbsoluteFile() :{}"
,
cosFile
.
getAbsoluteFile
());
//完整全路径 https://zhixinliantest-1302317679.cos.ap-guangzhou.myqcloud.com/nft/4e40d5f6f65aa8ec9bc33ab424e0167e68783bbe95d4d265086314d749808eef/NOW_ZXL_NFT_PIC001_test_skuId001/2022-03-04/ZXLNFTIMAGE202203041707466694345291.jpg
String
fullFilePath
=
null
;
//需要保存,返回给调用者
String
seriesId
=
null
;
// 1.4.2调用生成素材上传临时密钥接口
Nft022UploadSecretReqDto
nft022ReqDto
=
Nft022UploadSecretReqDto
.
getNew
();
nft022ReqDto
.
setSeriesName
(
seriesName
);
nft022ReqDto
.
setTimestamp
(
DateUtil
.
getNowSeconds
().
toString
());
nft022ReqDto
.
setUserPubKey
(
zxlnftConfig
.
getNftPlatformPubKey
());
//系列为空
String
userData
=
nft022ReqDto
.
getTimestamp
();
//系列不为空
if
(
StringUtil
.
isNotEmpty
(
nft022ReqDto
.
getSeriesName
())){
userData
=
nft022ReqDto
.
getTimestamp
()
+
"_"
+
nft022ReqDto
.
getSeriesName
();
}
nft022ReqDto
.
setUserSignedData
(
zxlnftBiz
.
createSign
(
zxlnftConfig
.
getNftPlatformPriKey
(),
userData
));
ZxlnftResponseDto
<
Nft022UploadSecretRespDto
>
nft022RespDto
=
zxlnftSdkUtil
.
nft022UploadSecret
(
nft022ReqDto
);
if
(!
nft022RespDto
.
isSuccess
()){
throw
new
ZxlNftException
(
ZxlErrorEnum
.
UPLOAD_TEMP_SECRET
.
getCode
(),
ZxlErrorEnum
.
UPLOAD_TEMP_SECRET
.
getMsg
());
}
// 1.4.3调用sdk接口-上传cos接口
if
(
nft022RespDto
.
isSuccess
()){
fullFilePath
=
nft022RespDto
.
getData
().
getUploadAddress
().
concat
(
fileName
);
UploadToCosReq
req
=
UploadToCosReq
.
getNew
();
req
.
setCosPath
(
fullFilePath
);
req
.
setTempSecretId
(
nft022RespDto
.
getData
().
getTempSecretId
());
req
.
setTempSecretKey
(
nft022RespDto
.
getData
().
getTempSecretKey
());
req
.
setSessionToken
(
nft022RespDto
.
getData
().
getSessionToken
());
req
.
setFilePath
(
filePath
);
UploadToCosResp
uploadToCosResp
=
zxlWalletSdkUtil
.
uploadToCos
(
req
);
}
log
.
info
(
"完整的素材访问fullFilePath url:{}"
,
fullFilePath
);
//进行系列声明
//返回素材上传结果
GalaxyNftUploadRespDto
galaxyNftUploadRespDto
=
GalaxyNftUploadRespDto
.
getNew
();
GalaxyNftUploadRespDto
galaxyNftUploadRespDto
=
GalaxyNftUploadRespDto
.
getNew
();
galaxyNftUploadRespDto
.
setMaterialAccessUrl
(
fullFilePath
);
galaxyNftUploadRespDto
.
setSkuId
(
reqDto
.
getSkuId
());
galaxyNftUploadRespDto
.
setSkuId
(
reqDto
.
getSkuId
());
galaxyNftUploadRespDto
.
setNftOriginalUrl
(
reqDto
.
getNftOriginalUrl
());
galaxyNftUploadRespDto
.
setNftUrl
(
this
.
getFullFilePath
(
seriesName
,
originalNftUrl
));
galaxyNftUploadRespDto
.
setOriginalNftUrl
(
reqDto
.
getOriginalNftUrl
());
galaxyNftUploadRespDto
.
setDisplayUrl
(
this
.
getFullFilePath
(
seriesName
,
originalDisplayUrl
));
galaxyNftUploadRespDto
.
setOriginalDisplayUrl
(
reqDto
.
getOriginalDisplayUrl
());
return
ResponseDto
.
success
(
galaxyNftUploadRespDto
);
return
ResponseDto
.
success
(
galaxyNftUploadRespDto
);
// 1.4.4调用查询素材地址接口 -- 非必需
// 1.4.4调用查询素材地址接口 -- 非必需
// Nft021UploadUrlReqDto nft021ReqDto = Nft021UploadUrlReqDto.getNew();
// Nft021UploadUrlReqDto nft021ReqDto = Nft021UploadUrlReqDto.getNew();
// nft021ReqDto.setSeriesName(seriesName);
// nft021ReqDto.setSeriesName(seriesName);
// nft021ReqDto.setPlatformIdentification(zxlnftConfig.getPlatformIdentification());
// nft021ReqDto.setPlatformIdentification(zxlnftConfig.getPlatformIdentification());
...
@@ -247,6 +197,75 @@ public class ZxinArtworkBiz {
...
@@ -247,6 +197,75 @@ public class ZxinArtworkBiz {
return
ResponseDto
.
success
(
seriesClaimRespDto
);
return
ResponseDto
.
success
(
seriesClaimRespDto
);
}
}
public
ResponseDto
<
GalaxyArtSeriesClaimResultQueryRespDto
>
seriesClaimResultQuery
(
GalaxyArtSeriesClaimResultQueryReqDto
reqDto
)
{
Nft031SeriesClaimResultReqDto
nft031SeriesClaimResultReqDto
=
Nft031SeriesClaimResultReqDto
.
getNew
();
ZxlnftResponseDto
<
Nft031SeriesClaimResultRespDto
>
resp
=
zxlnftSdkUtil
.
nft031SeriesClaimResult
(
nft031SeriesClaimResultReqDto
);
if
(
resp
.
isSuccess
()){
GalaxyArtSeriesClaimResultQueryRespDto
resultQueryRespDto
=
GalaxyArtSeriesClaimResultQueryRespDto
.
getNew
();
BeanUtil
.
copy
(
resp
.
getData
(),
resultQueryRespDto
);
return
ResponseDto
.
success
(
resultQueryRespDto
);
}
else
{
return
ResponseDto
.
failure
(
GalaxyErrorCodeEnum
.
SERIES_CLAIM_ERROR
.
getCode
(),
GalaxyErrorCodeEnum
.
SERIES_CLAIM_ERROR
.
getMessage
());
}
}
private
String
getFullFilePath
(
String
seriesName
,
String
originalUrl
){
String
filePath
=
null
;
String
imageType
=
null
;
if
(
originalUrl
.
lastIndexOf
(
"?"
)!=-
1
){
String
tempUrl
=
originalUrl
.
substring
(
0
,
originalUrl
.
lastIndexOf
(
"?"
));
imageType
=
tempUrl
.
substring
(
tempUrl
.
lastIndexOf
(
"."
),
tempUrl
.
length
());
}
else
{
imageType
=
originalUrl
.
substring
(
originalUrl
.
lastIndexOf
(
"."
),
originalUrl
.
length
());
}
String
fileName
=
IDGenerator
.
getZxlNftImageCosCode
()
+
imageType
;
//通过图片url地址上传
File
cosFile
=
galaxyCommonBiz
.
inputStreamToFile
(
originalUrl
,
fileName
);
filePath
=
cosFile
.
getAbsolutePath
();
log
.
info
(
"cosFile.getPath() :{}"
,
cosFile
.
getPath
());
log
.
info
(
"cosFile.getAbsoluteFile() :{}"
,
cosFile
.
getAbsoluteFile
());
//完整全路径 https://zhixinliantest-1302317679.cos.ap-guangzhou.myqcloud.com/nft/4e40d5f6f65aa8ec9bc33ab424e0167e68783bbe95d4d265086314d749808eef/NOW_ZXL_NFT_PIC001_test_skuId001/2022-03-04/ZXLNFTIMAGE202203041707466694345291.jpg
String
fullFilePath
=
null
;
//需要保存,返回给调用者
// 1.4.2调用生成素材上传临时密钥接口
Nft022UploadSecretReqDto
nft022ReqDto
=
Nft022UploadSecretReqDto
.
getNew
();
nft022ReqDto
.
setSeriesName
(
seriesName
);
nft022ReqDto
.
setTimestamp
(
DateUtil
.
getNowSeconds
().
toString
());
nft022ReqDto
.
setUserPubKey
(
zxlnftConfig
.
getNftPlatformPubKey
());
//系列为空
String
userData
=
nft022ReqDto
.
getTimestamp
();
//系列不为空
if
(
StringUtil
.
isNotEmpty
(
nft022ReqDto
.
getSeriesName
())){
userData
=
nft022ReqDto
.
getTimestamp
()
+
"_"
+
nft022ReqDto
.
getSeriesName
();
}
nft022ReqDto
.
setUserSignedData
(
zxlnftBiz
.
createSign
(
zxlnftConfig
.
getNftPlatformPriKey
(),
userData
));
ZxlnftResponseDto
<
Nft022UploadSecretRespDto
>
nft022RespDto
=
zxlnftSdkUtil
.
nft022UploadSecret
(
nft022ReqDto
);
if
(!
nft022RespDto
.
isSuccess
()){
throw
new
ZxlNftException
(
ZxlErrorEnum
.
UPLOAD_TEMP_SECRET
.
getCode
(),
ZxlErrorEnum
.
UPLOAD_TEMP_SECRET
.
getMsg
());
}
// 1.4.3调用sdk接口-上传cos接口
if
(
nft022RespDto
.
isSuccess
()){
fullFilePath
=
nft022RespDto
.
getData
().
getUploadAddress
().
concat
(
fileName
);
UploadToCosReq
req
=
UploadToCosReq
.
getNew
();
req
.
setCosPath
(
fullFilePath
);
req
.
setTempSecretId
(
nft022RespDto
.
getData
().
getTempSecretId
());
req
.
setTempSecretKey
(
nft022RespDto
.
getData
().
getTempSecretKey
());
req
.
setSessionToken
(
nft022RespDto
.
getData
().
getSessionToken
());
req
.
setFilePath
(
filePath
);
UploadToCosResp
uploadToCosResp
=
zxlWalletSdkUtil
.
uploadToCos
(
req
);
}
log
.
info
(
"完整的素材访问fullFilePath url:{}"
,
fullFilePath
);
return
fullFilePath
;
}
private
GalaxySeriesInfoBo
buildSeriesInfoBo
(
boolean
isInit
,
String
skuId
,
String
seriesName
,
String
seriesId
,
Long
totalCount
,
Long
crtCount
private
GalaxySeriesInfoBo
buildSeriesInfoBo
(
boolean
isInit
,
String
skuId
,
String
seriesName
,
String
seriesId
,
Long
totalCount
,
Long
crtCount
,
String
author
,
String
nftName
,
String
nftUrl
,
String
displayUrl
,
String
nftDesc
,
String
nftFlag
,
String
sellCount
,
String
coverUrl
,
String
seriesDesc
){
,
String
author
,
String
nftName
,
String
nftUrl
,
String
displayUrl
,
String
nftDesc
,
String
nftFlag
,
String
sellCount
,
String
coverUrl
,
String
seriesDesc
){
...
@@ -278,37 +297,4 @@ public class ZxinArtworkBiz {
...
@@ -278,37 +297,4 @@ public class ZxinArtworkBiz {
seriesInfoBo
.
setSeriesDesc
(
seriesDesc
);
seriesInfoBo
.
setSeriesDesc
(
seriesDesc
);
return
seriesInfoBo
;
return
seriesInfoBo
;
}
}
/**
* 通过URL上传
* @param url
* @param name
* @return
*/
public
File
inputStreamToFile
(
String
url
,
String
name
)
{
try
{
HttpURLConnection
httpUrl
=
(
HttpURLConnection
)
new
URL
(
url
).
openConnection
();
httpUrl
.
connect
();
InputStream
ins
=
httpUrl
.
getInputStream
();
// File file = new File(System.getProperty("java.io.tmpdir") + File.separator + name);
File
file
=
new
File
(
tempFilePath
+
File
.
separator
+
name
);
if
(
file
.
exists
())
{
return
file
;
}
OutputStream
os
=
new
FileOutputStream
(
file
);
int
bytesRead
;
int
len
=
8192
;
byte
[]
buffer
=
new
byte
[
len
];
while
((
bytesRead
=
ins
.
read
(
buffer
,
0
,
len
))
!=
-
1
)
{
os
.
write
(
buffer
,
0
,
bytesRead
);
}
os
.
close
();
ins
.
close
();
return
file
;
}
catch
(
Exception
e
)
{
log
.
error
(
"inputStreamToFileUrlError"
,
e
);
return
null
;
}
}
}
}
liquidnet-bus-service/liquidnet-service-galaxy/liquidnet-service-galaxy-impl/src/main/java/com/liquidnet/service/galaxy/router/zxin/biz/ZxinUserBiz.java
View file @
159a1775
...
@@ -13,7 +13,6 @@ import com.liquidnet.common.third.zxlnft.exception.ZxlNftException;
...
@@ -13,7 +13,6 @@ import com.liquidnet.common.third.zxlnft.exception.ZxlNftException;
import
com.liquidnet.common.third.zxlnft.util.ZxlWalletSdkUtil
;
import
com.liquidnet.common.third.zxlnft.util.ZxlWalletSdkUtil
;
import
com.liquidnet.common.third.zxlnft.util.ZxlnftSdkUtil
;
import
com.liquidnet.common.third.zxlnft.util.ZxlnftSdkUtil
;
import
com.liquidnet.commons.lang.util.BASE64Util
;
import
com.liquidnet.commons.lang.util.BASE64Util
;
import
com.liquidnet.commons.lang.util.BeanUtil
;
import
com.liquidnet.commons.lang.util.StringUtil
;
import
com.liquidnet.commons.lang.util.StringUtil
;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.galaxy.constant.GalaxyConstant
;
import
com.liquidnet.service.galaxy.constant.GalaxyConstant
;
...
@@ -22,6 +21,7 @@ import com.liquidnet.service.galaxy.dto.param.GalaxyUserBindStatusQueryReqDto;
...
@@ -22,6 +21,7 @@ import com.liquidnet.service.galaxy.dto.param.GalaxyUserBindStatusQueryReqDto;
import
com.liquidnet.service.galaxy.dto.param.GalaxyUserBindStatusQueryRespDto
;
import
com.liquidnet.service.galaxy.dto.param.GalaxyUserBindStatusQueryRespDto
;
import
com.liquidnet.service.galaxy.dto.param.GalaxyUserRegisterReqDto
;
import
com.liquidnet.service.galaxy.dto.param.GalaxyUserRegisterReqDto
;
import
com.liquidnet.service.galaxy.dto.param.GalaxyUserRegisterRespDto
;
import
com.liquidnet.service.galaxy.dto.param.GalaxyUserRegisterRespDto
;
import
com.liquidnet.service.galaxy.router.strategy.biz.GalaxyEnumBiz
;
import
com.liquidnet.service.galaxy.utils.DataUtils
;
import
com.liquidnet.service.galaxy.utils.DataUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -192,7 +192,10 @@ public class ZxinUserBiz {
...
@@ -192,7 +192,10 @@ public class ZxinUserBiz {
GalaxyUserBindStatusQueryRespDto
userBindStatusQueryRespDto
=
GalaxyUserBindStatusQueryRespDto
.
getNew
();
GalaxyUserBindStatusQueryRespDto
userBindStatusQueryRespDto
=
GalaxyUserBindStatusQueryRespDto
.
getNew
();
if
(
zxlnftResponseDto
.
isSuccess
()){
if
(
zxlnftResponseDto
.
isSuccess
()){
BeanUtil
.
copy
(
zxlnftResponseDto
.
getData
().
getList
().
get
(
0
),
userBindStatusQueryRespDto
);
Nft016QueryRsData
nft016QueryRsData
=
zxlnftResponseDto
.
getData
().
getList
().
get
(
0
);
userBindStatusQueryRespDto
.
setBlockChainAddress
(
nft016QueryRsData
.
getAddress
());
Integer
userBindStatus
=
Integer
.
valueOf
(
GalaxyEnumBiz
.
getUserBindStatusEnum
(
reqDto
.
getRouteType
(),
nft016QueryRsData
.
getStatus
()).
getCode
());
userBindStatusQueryRespDto
.
setUserBindStatus
(
userBindStatus
);
}
else
{
}
else
{
return
ResponseDto
.
failure
();
return
ResponseDto
.
failure
();
}
}
...
...
liquidnet-bus-service/liquidnet-service-galaxy/liquidnet-service-galaxy-impl/src/main/java/com/liquidnet/service/galaxy/router/zxin/service/GalaxyRouterStrategyZxlArtworkImpl.java
View file @
159a1775
...
@@ -43,6 +43,6 @@ public class GalaxyRouterStrategyZxlArtworkImpl implements IGalaxyRouterStrategy
...
@@ -43,6 +43,6 @@ public class GalaxyRouterStrategyZxlArtworkImpl implements IGalaxyRouterStrategy
@Override
@Override
public
ResponseDto
<
GalaxyArtSeriesClaimResultQueryRespDto
>
seriesClaimResultQuery
(
GalaxyArtSeriesClaimResultQueryReqDto
reqDto
)
{
public
ResponseDto
<
GalaxyArtSeriesClaimResultQueryRespDto
>
seriesClaimResultQuery
(
GalaxyArtSeriesClaimResultQueryReqDto
reqDto
)
{
return
null
;
return
zxinArtworkBiz
.
seriesClaimResultQuery
(
reqDto
)
;
}
}
}
}
liquidnet-bus-service/liquidnet-service-galaxy/liquidnet-service-galaxy-impl/src/test/java/com/liquidnet/service/galaxy/TestZxinArtworkBiz.java
View file @
159a1775
...
@@ -31,7 +31,7 @@ public class TestZxinArtworkBiz {
...
@@ -31,7 +31,7 @@ public class TestZxinArtworkBiz {
public
void
nftUpload
(){
public
void
nftUpload
(){
GalaxyNftUploadReqDto
nftUploadReqDto
=
GalaxyNftUploadReqDto
.
getNew
();
GalaxyNftUploadReqDto
nftUploadReqDto
=
GalaxyNftUploadReqDto
.
getNew
();
nftUploadReqDto
.
setSkuId
(
"video_test_001"
);
nftUploadReqDto
.
setSkuId
(
"video_test_001"
);
nftUploadReqDto
.
set
NftOriginal
Url
(
oldUrl
);
nftUploadReqDto
.
set
OriginalNft
Url
(
oldUrl
);
nftUploadReqDto
.
setRouteType
(
GalaxyConstant
.
RouterTypeEnum
.
ZXINCHAIN
.
getCode
());
nftUploadReqDto
.
setRouteType
(
GalaxyConstant
.
RouterTypeEnum
.
ZXINCHAIN
.
getCode
());
artworkBiz
.
nftUpload
(
nftUploadReqDto
);
artworkBiz
.
nftUpload
(
nftUploadReqDto
);
}
}
...
...
liquidnet-bus-service/liquidnet-service-galaxy/liquidnet-service-galaxy-impl/src/test/java/com/liquidnet/service/galaxy/TestZxlnftSdkUtil.java
View file @
159a1775
...
@@ -149,10 +149,12 @@ public class TestZxlnftSdkUtil {
...
@@ -149,10 +149,12 @@ public class TestZxlnftSdkUtil {
@Test
@Test
public
void
nft008QueryImageModeration
(){
public
void
nft008QueryImageModeration
(){
String
nftUrl
=
"https://zhixinliantest-1302317679.cos.ap-guangzhou.myqcloud.com/nft/4e40d5f6f65aa8ec9bc33ab424e0167e68783bbe95d4d265086314d749808eef/ZXLNFTIMAGE202202241512003609141721.jpg"
;
nftUrl
=
"https://zhixinliantest-1302317679.cos.ap-guangzhou.myqcloud.com/nft/4e40d5f6f65aa8ec9bc33ab424e0167e68783bbe95d4d265086314d749808eef/NOW_ZXL_video_test_001/ZXLNFTIMAGE202203191704225564978300.mp4"
;
Nft008QueryImageModerationReqDto
reqDto
=
Nft008QueryImageModerationReqDto
.
getNew
();
Nft008QueryImageModerationReqDto
reqDto
=
Nft008QueryImageModerationReqDto
.
getNew
();
reqDto
.
setImageUrl
(
"https://zhixinliantest-1302317679.cos.ap-guangzhou.myqcloud.com/nft/4e40d5f6f65aa8ec9bc33ab424e0167e68783bbe95d4d265086314d749808eef/ZXLNFTIMAGE202202241512003609141721.jpg"
);
reqDto
.
setImageUrl
(
nftUrl
);
//
reqDto.setIntrval(0);
reqDto
.
setIntrval
(
0
);
//
reqDto.setMaxFrames(1);
reqDto
.
setMaxFrames
(
1
);
ZxlnftResponseDto
<
Nft008QueryImageModerationRespDto
>
resp
=
zxlnftSdkUtil
.
nft008QueryImageModeration
(
reqDto
);
ZxlnftResponseDto
<
Nft008QueryImageModerationRespDto
>
resp
=
zxlnftSdkUtil
.
nft008QueryImageModeration
(
reqDto
);
System
.
out
.
println
(
resp
.
toJson
());
System
.
out
.
println
(
resp
.
toJson
());
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment