记得上下班打卡 | 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
5d01ab7e
Commit
5d01ab7e
authored
May 14, 2022
by
anjiabin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
至信链数字账户开通调整
parent
8987c844
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
719 additions
and
142 deletions
+719
-142
GalaxyConstant.java
...com/liquidnet/service/galaxy/constant/GalaxyConstant.java
+2
-1
GalaxyNftUserException.java
...dnet/service/galaxy/exception/GalaxyNftUserException.java
+32
-0
MQConst.java
...ain/java/com/liquidnet/service/base/constant/MQConst.java
+2
-2
ConsumerGalaxyJsonNftUserRegisterConfig.java
...kylin/config/ConsumerGalaxyJsonNftUserRegisterConfig.java
+54
-0
ConsumerGalaxyJsonNftUserRegisterReceiver.java
...n/receiver/ConsumerGalaxyJsonNftUserRegisterReceiver.java
+58
-0
ConsumerGalaxyJsonNftUserRegisterProcessor.java
...processor/ConsumerGalaxyJsonNftUserRegisterProcessor.java
+34
-0
pom.xml
...et-service-goblin/liquidnet-service-goblin-common/pom.xml
+10
-0
ZxinUserCommonBiz.java
...net/service/galaxy/router/zxin/biz/ZxinUserCommonBiz.java
+484
-0
AbstractDataUtils.java
...com/liquidnet/service/galaxy/utils/AbstractDataUtils.java
+29
-0
sqlmap-galaxy.properties
...goblin-common/src/main/resources/sqlmap-galaxy.properties
+2
-0
GalaxyTradeController.java
...dnet/service/galaxy/controller/GalaxyTradeController.java
+5
-0
ZxinUserBiz.java
...liquidnet/service/galaxy/router/zxin/biz/ZxinUserBiz.java
+7
-139
No files found.
liquidnet-bus-api/liquidnet-service-galaxy-api/src/main/java/com/liquidnet/service/galaxy/constant/GalaxyConstant.java
View file @
5d01ab7e
...
...
@@ -21,7 +21,8 @@ public class GalaxyConstant {
//以下禁止删除
public
static
final
String
REDIS_KEY_GALAXY_PUBLISH_NFT
=
"galaxy:publish:nft:"
;
//nft索引递增记录
public
static
final
String
SERIES_NAME_PREFIX
=
"NOW_ZXL_"
;
// 系列存储目录名称和系列声明
public
static
final
String
ADAM_USER_SYNC_URL
=
"/rsc/syn/certmeta"
;
// adam用户开通数字账户信息同步url
public
static
final
String
SERIES_NAME_PREFIX
=
"NOW_ZXL_"
;
// 系列存储目录名称和系列声明
}
liquidnet-bus-api/liquidnet-service-galaxy-api/src/main/java/com/liquidnet/service/galaxy/exception/GalaxyNftUserException.java
0 → 100644
View file @
5d01ab7e
package
com
.
liquidnet
.
service
.
galaxy
.
exception
;
import
lombok.Data
;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: 自定义异常类
* @class: GalaxyNftUserException
* @Package com.liquidnet.service.galaxy.exception
* @Copyright: LightNet @ Copyright (c) 2022
* @date 2022/5/12 13:44
*/
@Data
public
class
GalaxyNftUserException
extends
RuntimeException
{
private
static
final
long
serialVersionUID
=
-
3916918823313768482L
;
private
String
code
;
private
String
message
;
public
GalaxyNftUserException
(
String
code
,
String
message
)
{
super
(
message
);
this
.
code
=
code
;
this
.
message
=
message
;
}
public
GalaxyNftUserException
(
String
code
,
String
message
,
Throwable
t
)
{
super
(
message
,
t
);
this
.
code
=
code
;
this
.
message
=
message
;
}
}
liquidnet-bus-common/liquidnet-common-service-base/src/main/java/com/liquidnet/service/base/constant/MQConst.java
View file @
5d01ab7e
...
...
@@ -328,8 +328,8 @@ public class MQConst {
SQL_NFT_ORDER_INFO
(
"galaxy:stream:rk.sql.nftOrderInfo"
,
"group.sql.nftOrderInfo"
,
"订单信息"
),
SQL_NFT_TRADE_INFO
(
"galaxy:stream:rk.sql.nftTradeInfo"
,
"group.sql.nftTradeInfo"
,
"交易信息"
),
SQL_NFT_ORDER_FAIL_LOG
(
"galaxy:stream:rk.sql.nftOrderFailLog"
,
"group.sql.nftOrderFailLog"
,
"交易发行购买失败记录"
),
JSON_NFT_PUBLISH_AND_BUY
(
"galaxy:stream:rk.json.nftPublishAndBuy"
,
"group.
sql
.nftPublishAndBuy"
,
"NFT发行和购买"
),
;
JSON_NFT_PUBLISH_AND_BUY
(
"galaxy:stream:rk.json.nftPublishAndBuy"
,
"group.
json
.nftPublishAndBuy"
,
"NFT发行和购买"
),
JSON_NFT_USER_REGISTER
(
"galaxy:stream:rk.json.userRegister"
,
"group.json.userRegister"
,
"NFT用户注册"
)
;
private
final
String
key
;
private
final
String
group
;
private
final
String
desc
;
...
...
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-kylin/src/main/java/com/liquidnet/service/consumer/kylin/config/ConsumerGalaxyJsonNftUserRegisterConfig.java
0 → 100644
View file @
5d01ab7e
package
com
.
liquidnet
.
service
.
consumer
.
kylin
.
config
;
import
com.liquidnet.common.cache.redis.config.RedisStreamConfig
;
import
com.liquidnet.service.base.constant.MQConst
;
import
com.liquidnet.service.consumer.kylin.receiver.ConsumerGalaxyJsonNftUserRegisterReceiver
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.data.redis.connection.RedisConnectionFactory
;
import
org.springframework.data.redis.connection.stream.Consumer
;
import
org.springframework.data.redis.connection.stream.MapRecord
;
import
org.springframework.data.redis.connection.stream.ReadOffset
;
import
org.springframework.data.redis.connection.stream.StreamOffset
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.data.redis.stream.StreamMessageListenerContainer
;
import
org.springframework.data.redis.stream.Subscription
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: 区块链nft订单相关
* @class: ConsumerSqlNftOrderInfoConfig
* @Package com.liquidnet.service.consumer.galaxy.config
* @Copyright: LightNet @ Copyright (c) 2022
* @date 2022/3/25 14:45
*/
@Configuration
public
class
ConsumerGalaxyJsonNftUserRegisterConfig
extends
RedisStreamConfig
{
@Autowired
private
ConsumerGalaxyJsonNftUserRegisterReceiver
jsonNftUserRegisterReceiver
;
@Autowired
StringRedisTemplate
stringRedisTemplate
;
@Bean
public
List
<
Subscription
>
subscriptionJsonNftPublishAndBuy
(
RedisConnectionFactory
factory
)
{
List
<
Subscription
>
subscriptionList
=
new
ArrayList
<>();
MQConst
.
GalaxyQueue
stream
=
MQConst
.
GalaxyQueue
.
JSON_NFT_USER_REGISTER
;
this
.
initStream
(
stringRedisTemplate
,
stream
.
getKey
(),
stream
.
getGroup
());
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
StreamMessageListenerContainer
<
String
,
MapRecord
<
String
,
String
,
String
>>
listenerContainer
=
this
.
buildStreamMessageListenerContainer
(
factory
);
subscriptionList
.
add
(
listenerContainer
.
receiveAutoAck
(
Consumer
.
from
(
stream
.
getGroup
(),
getConsumerName
(
stream
.
name
()
+
i
)),
StreamOffset
.
create
(
stream
.
getKey
(),
ReadOffset
.
lastConsumed
()),
jsonNftUserRegisterReceiver
));
listenerContainer
.
start
();
}
return
subscriptionList
;
}
}
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-kylin/src/main/java/com/liquidnet/service/consumer/kylin/receiver/ConsumerGalaxyJsonNftUserRegisterReceiver.java
0 → 100644
View file @
5d01ab7e
package
com
.
liquidnet
.
service
.
consumer
.
kylin
.
receiver
;
import
com.liquidnet.commons.lang.util.CollectionUtil
;
import
com.liquidnet.commons.lang.util.JsonUtils
;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.base.constant.MQConst
;
import
com.liquidnet.service.consumer.kylin.service.processor.ConsumerGalaxyJsonNftUserRegisterProcessor
;
import
com.liquidnet.service.galaxy.dto.param.GalaxyUserRegisterReqDto
;
import
com.liquidnet.service.galaxy.dto.param.GalaxyUserRegisterRespDto
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.connection.stream.StreamRecords
;
import
org.springframework.stereotype.Component
;
import
java.util.HashMap
;
@Slf4j
@Component
public
class
ConsumerGalaxyJsonNftUserRegisterReceiver
extends
AbstractBizRedisReceiver
{
@Autowired
private
ConsumerGalaxyJsonNftUserRegisterProcessor
jsonNftUserRegisterProcessor
;
@Override
protected
boolean
consumerMessageHandler
(
String
msg
)
{
boolean
aBoolean
=
false
;
try
{
GalaxyUserRegisterReqDto
textMessage
=
JsonUtils
.
fromJson
(
msg
,
GalaxyUserRegisterReqDto
.
class
);
if
(
textMessage
==
null
)
{
aBoolean
=
true
;
}
else
{
//执行计数
ResponseDto
<
GalaxyUserRegisterRespDto
>
responseDto
=
jsonNftUserRegisterProcessor
.
userRegister
(
textMessage
);
// if(responseDto.isSuccess()){
aBoolean
=
true
;
// }
}
}
catch
(
Exception
e
)
{
log
.
error
(
"CONSUMER MSG EX_HANDLE ==> [{}]:{}"
,
this
.
getRedisStreamKey
(),
msg
,
e
);
}
finally
{
if
(!
aBoolean
)
{
HashMap
<
String
,
String
>
map
=
CollectionUtil
.
mapStringString
();
map
.
put
(
"message"
,
msg
);
stringRedisTemplate
.
opsForStream
().
add
(
StreamRecords
.
mapBacked
(
map
).
withStreamKey
(
this
.
getRedisStreamKey
()));
}
}
return
aBoolean
;
}
@Override
protected
String
getRedisStreamKey
()
{
return
MQConst
.
GalaxyQueue
.
JSON_NFT_USER_REGISTER
.
getKey
();
}
@Override
protected
String
getRedisStreamGroup
()
{
return
MQConst
.
GalaxyQueue
.
JSON_NFT_USER_REGISTER
.
getGroup
();
}
}
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-kylin/src/main/java/com/liquidnet/service/consumer/kylin/service/processor/ConsumerGalaxyJsonNftUserRegisterProcessor.java
0 → 100644
View file @
5d01ab7e
package
com
.
liquidnet
.
service
.
consumer
.
kylin
.
service
.
processor
;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.galaxy.dto.param.GalaxyUserRegisterReqDto
;
import
com.liquidnet.service.galaxy.dto.param.GalaxyUserRegisterRespDto
;
import
com.liquidnet.service.galaxy.router.zxin.biz.ZxinUserCommonBiz
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: ConsumerJsonNftPublishAndBuyProcessor
* @Package com.liquidnet.service.consumer.kylin.service.processor
* @Copyright: LightNet @ Copyright (c) 2022
* @date 2022/3/29 17:04
*/
@Slf4j
@Component
public
class
ConsumerGalaxyJsonNftUserRegisterProcessor
{
@Autowired
private
ZxinUserCommonBiz
zxinUserCommonBiz
;
/**
* 执行用户注册
* @param reqDto
* @return
*/
public
ResponseDto
<
GalaxyUserRegisterRespDto
>
userRegister
(
GalaxyUserRegisterReqDto
reqDto
)
{
return
zxinUserCommonBiz
.
userRegister
(
reqDto
);
}
}
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-common/pom.xml
View file @
5d01ab7e
...
...
@@ -31,5 +31,15 @@
<artifactId>
liquidnet-service-galaxy-api
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
com.liquidnet
</groupId>
<artifactId>
liquidnet-service-goblin-api
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
com.liquidnet
</groupId>
<artifactId>
liquidnet-service-adam-api
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
</dependencies>
</project>
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-common/src/main/java/com/liquidnet/service/galaxy/router/zxin/biz/ZxinUserCommonBiz.java
0 → 100644
View file @
5d01ab7e
This diff is collapsed.
Click to expand it.
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-common/src/main/java/com/liquidnet/service/galaxy/utils/AbstractDataUtils.java
View file @
5d01ab7e
...
...
@@ -42,6 +42,7 @@ public abstract class AbstractDataUtils {
userInfoVo
.
setCreatedAt
(
LocalDateTime
.
now
());
this
.
getMongoTemplate
().
save
(
userInfoVo
,
GalaxyUserInfoVo
.
class
.
getSimpleName
());
// insert into galaxy_user_info (mid, user_id, user_name, user_type, mobile, id_card_type
// , id_card, mnemonic, index,user_identification, user_pub_key
// , user_pri_key, block_chain_address, router_type,created_at, updated_at)
...
...
@@ -60,6 +61,34 @@ public abstract class AbstractDataUtils {
}
}
public
void
updateGalaxyUserInfo
(
String
routerType
,
String
userId
,
GalaxyUserInfoBo
userInfoBo
)
{
String
userType
=
GalaxyEnum
.
RegisterTypeEnum
.
PERSON
.
getCode
();
this
.
getRedisUtil
().
set
(
GalaxyConstant
.
REDIS_KEY_GALAXY_USER
.
concat
(
routerType
).
concat
(
":"
)
+
userId
,
userInfoBo
);
//入库mongo
GalaxyUserInfoVo
userInfoVo
=
GalaxyUserInfoVo
.
getNew
();
BeanUtil
.
copy
(
userInfoBo
,
userInfoVo
);
userInfoVo
.
setCreatedAt
(
LocalDateTime
.
now
());
this
.
getMongoTemplate
().
save
(
userInfoVo
,
GalaxyUserInfoVo
.
class
.
getSimpleName
());
// insert into galaxy_user_info (mid, user_id, user_name, user_type, mobile, id_card_type
// , id_card, mnemonic, index,user_identification, user_pub_key
// , user_pri_key, block_chain_address, router_type,created_at, updated_at)
try
{
this
.
getQueueUtil
().
sendMySqlRedis
(
SqlMapping
.
get
(
"galaxy_user_info.insert"
),
new
Object
[]{
userId
,
userInfoBo
.
getUserName
(),
userType
,
userInfoBo
.
getMobile
(),
userInfoBo
.
getIdCardType
()
,
userInfoBo
.
getIdCard
(),
userInfoBo
.
getMnemonic
(),
userInfoBo
.
getIndex
(),
userInfoBo
.
getUserIdentification
(),
userInfoBo
.
getUserPubKey
()
,
userInfoBo
.
getUserPriKey
(),
userInfoBo
.
getBlockChainAddress
(),
userInfoBo
.
getRouterType
(),
new
Date
(),
null
}
,
MQConst
.
GalaxyQueue
.
SQL_USER_INFO
.
getKey
()
);
}
catch
(
Exception
e
){
log
.
error
(
e
.
getMessage
(),
e
);
log
.
error
(
"#setGalaxyUserInfo error ==> MESSAGE:{}"
,
e
.
getMessage
());
}
}
public
GalaxyUserInfoBo
getGalaxyUserInfo
(
String
routerType
,
String
userId
)
{
Object
obj
=
this
.
getRedisUtil
().
get
(
GalaxyConstant
.
REDIS_KEY_GALAXY_USER
.
concat
(
routerType
).
concat
(
":"
)
+
userId
);
if
(
obj
!=
null
){
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-common/src/main/resources/sqlmap-galaxy.properties
View file @
5d01ab7e
...
...
@@ -26,3 +26,5 @@ galaxy_series_nft_info.updateSeriesNftCrtCount=update galaxy_series_nft_info t s
# ------------------------更新发行购买处理结果----------------------------
galaxy_nft_order_fail_log.updateDealWithStatus
=
update galaxy_nft_order_fail_log t set t.deal_with_status = ?,t.updated_at =? where t.nft_order_pay_id = ? and t.router_type = ?
# ------------------------同步用户数字账户信息到adam---------------------------
adam_user_busi_acct.add
=
INSERT INTO adam_user_busi_acct (`uid`, busi, uuid, `work`, ppwd, `state`, created_at) VALUES (?,?,?,?,?,?,?)
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/galaxy/controller/GalaxyTradeController.java
View file @
5d01ab7e
...
...
@@ -67,6 +67,11 @@ public class GalaxyTradeController {
@ApiOperation
(
value
=
"NFT发行购买结果查询"
)
@PostMapping
(
value
=
{
"nftPublishAndBuyResultQuery"
})
public
ResponseDto
<
GalaxyNftPublishAndBuyResultQueryRespDto
>
nftPublishAndBuyResultQuery
(
@Valid
@RequestBody
GalaxyNftPublishAndBuyResultQueryReqDto
reqDto
){
try
{
Thread
.
sleep
(
2000
l
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
return
galaxyTradeService
.
nftPublishAndBuyResultQuery
(
reqDto
);
}
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/galaxy/router/zxin/biz/ZxinUserBiz.java
View file @
5d01ab7e
package
com
.
liquidnet
.
service
.
galaxy
.
router
.
zxin
.
biz
;
import
com.liquidnet.common.third.zxlnft.biz.ZxlnftBiz
;
import
com.liquidnet.common.third.zxlnft.constant.ZxlErrorEnum
;
import
com.liquidnet.common.third.zxlnft.dto.*
;
import
com.liquidnet.common.third.zxlnft.dto.Nft016IdentityBindQueryReqDto
;
import
com.liquidnet.common.third.zxlnft.dto.Nft016IdentityBindQueryRespDto
;
import
com.liquidnet.common.third.zxlnft.dto.ZxlnftResponseDto
;
import
com.liquidnet.common.third.zxlnft.dto.nft.Nft016QueryRsData
;
import
com.liquidnet.common.third.zxlnft.dto.wallet.CreateMnemonicReq
;
import
com.liquidnet.common.third.zxlnft.dto.wallet.CreateMnemonicResp
;
import
com.liquidnet.common.third.zxlnft.dto.wallet.DeriveKeyPairReq
;
import
com.liquidnet.common.third.zxlnft.dto.wallet.DeriveKeyPairResp
;
import
com.liquidnet.common.third.zxlnft.exception.ZxlNftException
;
import
com.liquidnet.common.third.zxlnft.util.ZxlWalletSdkUtil
;
import
com.liquidnet.common.third.zxlnft.util.ZxlnftSdkUtil
;
import
com.liquidnet.commons.lang.util.BASE64Util
;
import
com.liquidnet.commons.lang.util.StringUtil
;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.galaxy.biz.GalaxyEnumBiz
;
import
com.liquidnet.service.galaxy.constant.GalaxyEnum
;
import
com.liquidnet.service.galaxy.dto.bo.GalaxyUserInfoBo
;
import
com.liquidnet.service.galaxy.dto.param.GalaxyUserBindStatusQueryReqDto
;
import
com.liquidnet.service.galaxy.dto.param.GalaxyUserBindStatusQueryRespDto
;
import
com.liquidnet.service.galaxy.dto.param.GalaxyUserRegisterReqDto
;
...
...
@@ -26,9 +18,6 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.io.UnsupportedEncodingException
;
import
java.util.List
;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
...
...
@@ -53,132 +42,11 @@ public class ZxinUserBiz {
@Autowired
private
GalaxyDataUtils
dataUtils
;
public
ResponseDto
<
GalaxyUserRegisterRespDto
>
userRegister
(
GalaxyUserRegisterReqDto
reqDto
)
{
String
userId
=
reqDto
.
getUserId
();
String
userName
=
reqDto
.
getUserName
();
String
mobile
=
reqDto
.
getMobile
();
String
idCardType
=
reqDto
.
getIdCardType
();
String
idCard
=
reqDto
.
getIdCard
();
String
mnemonic
=
null
;
Long
index
=
0L
;
String
userIdentification
=
null
;
String
address
=
null
;
String
userPubKey
=
null
;
String
userPriKey
=
null
;
GalaxyUserInfoBo
userInfoBo
=
dataUtils
.
getGalaxyUserInfo
(
reqDto
.
getRouterType
(),
userId
);
if
(
userInfoBo
!=
null
){
mnemonic
=
userInfoBo
.
getMnemonic
();
}
else
{
try
{
//生成助记词
CreateMnemonicReq
req
=
CreateMnemonicReq
.
getNew
();
CreateMnemonicResp
createMnemonicResp
=
zxlWalletSdkUtil
.
createMnemonic
(
req
);
mnemonic
=
createMnemonicResp
.
getMnemonic
();
}
catch
(
Exception
e
){
throw
new
ZxlNftException
(
ZxlErrorEnum
.
FAILURE
.
getCode
(),
"生成助记词失败!"
);
}
}
/**
* todo 把助记词进行redis存储 key=userID mnemonic/index/userIdentification/address
*/
if
(
StringUtil
.
isNotEmpty
(
mnemonic
)){
//生成公私钥
DeriveKeyPairReq
deriveKeyPairReq
=
DeriveKeyPairReq
.
getNew
();
deriveKeyPairReq
.
setMnemonic
(
mnemonic
);
// deriveKeyPairReq.setMnemonic(createMnemonicResp.getMnemonic());
deriveKeyPairReq
.
setIndex
(
index
);
try
{
DeriveKeyPairResp
deriveKeyPairResp
=
zxlWalletSdkUtil
.
deriveKeyPair
(
deriveKeyPairReq
);
if
(!
deriveKeyPairResp
.
getErr
().
equals
(
""
))
throw
new
Exception
(
"生成公私钥失败!"
);
userPubKey
=
BASE64Util
.
encoded
(
deriveKeyPairResp
.
getPubKey
());
userPriKey
=
BASE64Util
.
encoded
(
deriveKeyPairResp
.
getPriKey
());
}
catch
(
Exception
e
){
throw
new
ZxlNftException
(
ZxlErrorEnum
.
FAILURE
.
getCode
(),
e
.
getMessage
());
}
}
//1.2.1调用自然人注册实名(使用NFT平台签名)接口
Nft003RegisterPersonPlatformReqDto
nft003ReqDto
=
Nft003RegisterPersonPlatformReqDto
.
getNew
();
nft003ReqDto
.
setPersonName
(
userName
);
// reqDto.setEmail("");
nft003ReqDto
.
setMobile
(
mobile
);
nft003ReqDto
.
setIdCard
(
idCard
);
nft003ReqDto
.
setCardType
(
Integer
.
valueOf
(
idCardType
));
ZxlnftResponseDto
<
Nft003RegisterPersonPlatformRespDto
>
nft003Resp
=
zxlnftSdkUtil
.
nft003RegisterPersonPlatform
(
nft003ReqDto
);
if
(
nft003Resp
.
isSuccess
()){
userIdentification
=
nft003Resp
.
getData
().
getUserIdentification
();
}
else
{
return
ResponseDto
.
failure
(
nft003Resp
.
getCode
(),
nft003Resp
.
getMessage
());
}
GalaxyUserRegisterRespDto
respDto
=
GalaxyUserRegisterRespDto
.
getNew
();
if
(
StringUtil
.
isNotEmpty
(
userPubKey
)&&
StringUtil
.
isNotEmpty
(
userPriKey
)&&
StringUtil
.
isNotEmpty
(
userIdentification
)){
//1.2.2调用授信平台NFT地址绑定接口
Nft014IdentityBindSubmitByTrustedReqDto
nft014ReqDto
=
Nft014IdentityBindSubmitByTrustedReqDto
.
getNew
();
try
{
nft014ReqDto
.
setUserPubKey
(
BASE64Util
.
decode
(
userPubKey
));
nft014ReqDto
.
setUserIdentification
(
nft003Resp
.
getData
().
getUserIdentification
());
String
signature
=
zxlnftBiz
.
createSign
(
BASE64Util
.
decode
(
userPriKey
),
nft014ReqDto
.
getUserIdentification
());
nft014ReqDto
.
setUserSignData
(
signature
);
}
catch
(
UnsupportedEncodingException
e
)
{
log
.
error
(
"公私钥解密错误!"
);
}
ZxlnftResponseDto
<
Nft014IdentityBindSubmitByTrustedRespDto
>
nft014Resp
=
zxlnftSdkUtil
.
nft014IdentityBindSubmitByTrusted
(
nft014ReqDto
);
ZxlnftResponseDto
<
Nft016IdentityBindQueryRespDto
>
nft016Resp
=
null
;
if
(
nft014Resp
.
isSuccess
()){
//1.2.3调用绑定状态批量查询
Nft016IdentityBindQueryReqDto
nft016ReqDto
=
Nft016IdentityBindQueryReqDto
.
getNew
();
nft016ReqDto
.
setAddressList
(
nft014Resp
.
getData
().
getAddress
());
nft016Resp
=
zxlnftSdkUtil
.
nft016IdentityBindQuery
(
nft016ReqDto
);
}
else
{
log
.
info
(
"nft014Resp 返回结果:{}"
,
nft014Resp
.
toJson
());
return
ResponseDto
.
failure
(
nft014Resp
.
getCode
(),
nft014Resp
.
getMessage
());
}
if
(
StringUtil
.
isNotNull
(
nft016Resp
)&&
nft016Resp
.
isSuccess
()){
List
<
Nft016QueryRsData
>
queryRsDataList
=
nft016Resp
.
getData
().
getList
();
Nft016QueryRsData
queryRsData
=
queryRsDataList
.
get
(
0
);
address
=
queryRsData
.
getAddress
();
log
.
info
(
"nft016Resp 返回结果:{}"
,
nft016Resp
.
toJson
());
//构造返回参数
respDto
.
setUserId
(
userId
);
respDto
.
setBlockChainType
(
GalaxyEnum
.
RouterTypeEnum
.
ZXINCHAIN
.
getCode
());
respDto
.
setBlockChainAddress
(
address
);
}
else
{
return
ResponseDto
.
failure
(
nft016Resp
.
getMessage
());
}
@Autowired
private
ZxinUserCommonBiz
zxinUserCommonBiz
;
//构造缓存数据
if
(
userInfoBo
==
null
){
userInfoBo
=
GalaxyUserInfoBo
.
getNew
();
userInfoBo
.
setUserId
(
userId
);
userInfoBo
.
setUserName
(
userName
);
userInfoBo
.
setMobile
(
mobile
);
userInfoBo
.
setIdCardType
(
idCardType
);
userInfoBo
.
setIdCard
(
idCard
);
userInfoBo
.
setMnemonic
(
mnemonic
);
userInfoBo
.
setIndex
(
index
.
toString
());
userInfoBo
.
setUserIdentification
(
userIdentification
);
userInfoBo
.
setUserPubKey
(
userPubKey
);
userInfoBo
.
setUserPriKey
(
userPriKey
);
userInfoBo
.
setRouterType
(
GalaxyEnum
.
RouterTypeEnum
.
ZXINCHAIN
.
getCode
());
userInfoBo
.
setBlockChainAddress
(
address
);
dataUtils
.
setGalaxyUserInfo
(
reqDto
.
getRouterType
(),
reqDto
.
getUserId
(),
userInfoBo
);
}
}
return
ResponseDto
.
success
(
respDto
);
public
ResponseDto
<
GalaxyUserRegisterRespDto
>
userRegister
(
GalaxyUserRegisterReqDto
reqDto
)
{
return
zxinUserCommonBiz
.
userRegister
(
reqDto
);
}
public
ResponseDto
<
GalaxyUserBindStatusQueryRespDto
>
userBindStatusQuery
(
GalaxyUserBindStatusQueryReqDto
reqDto
){
...
...
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