Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fzm-joying
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
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
lei
fzm-joying
Commits
d32bd475
Commit
d32bd475
authored
Jul 26, 2021
by
tangtuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
纪念版nft详情页面加入文件路径 文件名
parent
767bab7a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
9 deletions
+39
-9
ChainDto.java
...mon/src/main/java/com/fzm/common/entity/dto/ChainDto.java
+19
-0
CommemorateNftVo.java
.../main/java/com/fzm/common/entity/vo/CommemorateNftVo.java
+8
-0
NftServiceImpl.java
...main/java/com/fzm/common/service/impl/NftServiceImpl.java
+11
-8
application.yml
joying-portal/src/main/resources/application.yml
+1
-1
No files found.
joying-common/src/main/java/com/fzm/common/entity/dto/ChainDto.java
0 → 100644
View file @
d32bd475
package
com
.
fzm
.
common
.
entity
.
dto
;
import
lombok.Data
;
/**
* @author tangtuo
* @date 2021/7/22 16:28
*/
@Data
public
class
ChainDto
{
private
String
author
;
private
String
name
;
private
String
hash
;
private
String
publishAddress
;
}
joying-common/src/main/java/com/fzm/common/entity/vo/CommemorateNftVo.java
View file @
d32bd475
...
@@ -34,6 +34,12 @@ public class CommemorateNftVo {
...
@@ -34,6 +34,12 @@ public class CommemorateNftVo {
@ApiModelProperty
(
"头像"
)
@ApiModelProperty
(
"头像"
)
private
String
avatar
;
private
String
avatar
;
@ApiModelProperty
(
"文件名"
)
private
String
fileName
;
@ApiModelProperty
(
"文件路径"
)
private
String
fileUrl
;
@ApiModelProperty
(
"钱包地址"
)
@ApiModelProperty
(
"钱包地址"
)
private
String
publishAddress
;
private
String
publishAddress
;
...
@@ -66,6 +72,8 @@ public class CommemorateNftVo {
...
@@ -66,6 +72,8 @@ public class CommemorateNftVo {
this
.
publishTime
=
nft
.
getPublishTime
();
this
.
publishTime
=
nft
.
getPublishTime
();
this
.
synopsis
=
nft
.
getSynopsis
();
this
.
synopsis
=
nft
.
getSynopsis
();
this
.
cover
=
nft
.
getCover
();
this
.
cover
=
nft
.
getCover
();
this
.
fileName
=
nft
.
getFileName
();
this
.
fileUrl
=
nft
.
getFileUrl
();
}
}
}
}
joying-common/src/main/java/com/fzm/common/service/impl/NftServiceImpl.java
View file @
d32bd475
...
@@ -13,6 +13,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
...
@@ -13,6 +13,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import
com.fzm.common.constant.RedisConstant
;
import
com.fzm.common.constant.RedisConstant
;
import
com.fzm.common.constant.SystemConstant
;
import
com.fzm.common.constant.SystemConstant
;
import
com.fzm.common.entity.*
;
import
com.fzm.common.entity.*
;
import
com.fzm.common.entity.dto.ChainDto
;
import
com.fzm.common.entity.vo.CollectionNftVo
;
import
com.fzm.common.entity.vo.CollectionNftVo
;
import
com.fzm.common.entity.vo.NftListVo
;
import
com.fzm.common.entity.vo.NftListVo
;
import
com.fzm.common.enums.ResultCode
;
import
com.fzm.common.enums.ResultCode
;
...
@@ -113,17 +114,19 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe
...
@@ -113,17 +114,19 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe
long
tokenId
=
Long
.
parseLong
(
split
[
1
]);
long
tokenId
=
Long
.
parseLong
(
split
[
1
]);
Nft
nft
=
getById
(
nftDto
.
getId
());
Nft
nft
=
getById
(
nftDto
.
getId
());
// 构建上链信息
// 构建上链信息
HashMap
<
String
,
String
>
map
=
new
HashMap
<>();
ChainDto
chainDto
=
new
ChainDto
();
map
.
put
(
"author"
,
nft
.
getAuthor
());
chainDto
.
setName
(
nft
.
getName
());
map
.
put
(
"name"
,
nft
.
getName
());
chainDto
.
setAuthor
(
nft
.
getAuthor
());
chainDto
.
setHash
(
nft
.
getFileHash
());
chainDto
.
setPublishAddress
(
wallet
);
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"hash"
,
nft
.
getFileHash
());
map
.
put
(
"hash"
,
nft
.
getFileHash
());
map
.
put
(
"publishAddress"
,
nft
.
getPublishAddress
());
log
.
info
(
"加密上链数据: {}"
,
chainDto
);
String
tokenInfo
=
JSONUtil
.
toJsonStr
(
map
);
String
tradeHash
=
paraChainClient
.
evmSetTokenInfo
(
contractName
,
tokenId
,
JSONUtil
.
toJsonStr
(
map
),
wallet
,
privkey
,
true
);
log
.
info
(
"加密上链数据: {}"
,
tokenInfo
);
String
tradeHash
=
paraChainClient
.
evmSetTokenInfo
(
contractName
,
tokenId
,
tokenInfo
,
wallet
,
privkey
,
true
);
if
(
StringUtils
.
isBlank
(
tradeHash
))
{
if
(
StringUtils
.
isBlank
(
tradeHash
))
{
throw
GlobalException
.
newException
(
ResultCode
.
PUBLISH_ERROR
,
"nft发行失败"
);
throw
GlobalException
.
newException
(
ResultCode
.
PUBLISH_ERROR
,
"nft发行失败"
);
}
}
log
.
info
(
"tokenInfo:{}"
,
paraChainClient
.
evmGetTokenInfo
(
contractName
,
paraChainClient
.
evmQueryAddrByName
(
contractName
),
tokenId
,
wallet
));
// 确认交易结果
// 确认交易结果
TxResult
txResult
=
paraChainClient
.
cycleConfirmTxWithHash
(
hash
,
true
,
1000
);
TxResult
txResult
=
paraChainClient
.
cycleConfirmTxWithHash
(
hash
,
true
,
1000
);
if
(!
TxStatusEnum
.
SUCCESS
.
equals
(
txResult
.
getStatus
()))
{
if
(!
TxStatusEnum
.
SUCCESS
.
equals
(
txResult
.
getStatus
()))
{
...
@@ -267,7 +270,7 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe
...
@@ -267,7 +270,7 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe
@Override
@Override
public
String
generateNftId
(
Integer
categoryId
)
{
public
String
generateNftId
(
Integer
categoryId
)
{
Category
category
=
categoryService
.
get
Category
ById
(
categoryId
);
Category
category
=
categoryService
.
getById
(
categoryId
);
if
(
category
==
null
)
{
if
(
category
==
null
)
{
throw
GlobalException
.
newException
(
ResultCode
.
DATA_ERROR
,
"没找到此类目"
);
throw
GlobalException
.
newException
(
ResultCode
.
DATA_ERROR
,
"没找到此类目"
);
}
}
...
...
joying-portal/src/main/resources/application.yml
View file @
d32bd475
spring
:
spring
:
profiles
:
profiles
:
active
:
test
active
:
local
application
:
application
:
name
:
joying-portal
name
:
joying-portal
servlet
:
servlet
:
...
...
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