记得上下班打卡 | 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
3c6637bb
Commit
3c6637bb
authored
Apr 02, 2022
by
张国柄
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
~api.call:goblin.galaxy;
parent
4eb0a10d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
81 additions
and
18 deletions
+81
-18
HttpUtil.java
...c/main/java/com/liquidnet/commons/lang/util/HttpUtil.java
+12
-18
pom.xml
...dnet-service-goblin/liquidnet-service-goblin-impl/pom.xml
+9
-0
GoblinGalaxyService.java
...ervice/goblin/service/impl/inner/GoblinGalaxyService.java
+60
-0
No files found.
liquidnet-bus-common/liquidnet-common-base/src/main/java/com/liquidnet/commons/lang/util/HttpUtil.java
View file @
3c6637bb
...
...
@@ -16,7 +16,7 @@ import java.util.List;
import
java.util.Map
;
public
class
HttpUtil
{
private
static
RestTemplate
restTemplate
;
private
static
final
RestTemplate
restTemplate
;
static
{
restTemplate
=
RestTemplateConfig
.
getRestTemplate
();
...
...
@@ -81,9 +81,9 @@ public class HttpUtil {
}
public
static
String
postJson
(
String
url
,
String
jsonStr
)
{
MultiValueMap
<
String
,
String
>
headers
=
new
LinkedMultiValueMap
();
headers
.
add
(
"Content-Type"
,
"application/json;charset=UTF-8"
);
headers
.
add
(
"Accept"
,
"application/json;charset=UTF-8"
);
MultiValueMap
<
String
,
String
>
headers
=
CollectionUtil
.
linkedMultiValueMapStringString
();
headers
.
add
(
"Content-Type"
,
MediaType
.
APPLICATION_JSON_UTF8_VALUE
);
headers
.
add
(
"Accept"
,
MediaType
.
APPLICATION_JSON_UTF8_VALUE
);
if
(
url
==
null
||
url
.
trim
().
isEmpty
())
{
return
null
;
...
...
@@ -103,9 +103,9 @@ public class HttpUtil {
}
public
static
String
postJson
(
String
url
,
String
jsonStr
,
MultiValueMap
<
String
,
String
>
headers
)
{
MultiValueMap
<
String
,
String
>
commonHeader
=
new
LinkedMultiValueMap
();
commonHeader
.
add
(
"Content-Type"
,
"application/json;charset=UTF-8"
);
commonHeader
.
add
(
"Accept"
,
"application/json;charset=UTF-8"
);
MultiValueMap
<
String
,
String
>
commonHeader
=
CollectionUtil
.
linkedMultiValueMapStringString
();
headers
.
add
(
"Content-Type"
,
MediaType
.
APPLICATION_JSON_UTF8_VALUE
);
headers
.
add
(
"Accept"
,
MediaType
.
APPLICATION_JSON_UTF8_VALUE
);
if
(
url
==
null
||
url
.
trim
().
isEmpty
())
{
return
null
;
...
...
@@ -139,21 +139,15 @@ public class HttpUtil {
String
result
=
null
;
try
{
MultiValueMap
<
String
,
String
>
commonHeader
=
new
LinkedMultiValueMap
();
commonHeader
.
add
(
"Content-Type"
,
"application/json;charset=UTF-8"
);
commonHeader
.
add
(
"Accept"
,
"application/json;charset=UTF-8"
);
MultiValueMap
<
String
,
String
>
commonHeader
=
CollectionUtil
.
linkedMultiValueMapStringString
();
commonHeader
.
add
(
"Content-Type"
,
MediaType
.
APPLICATION_JSON_UTF8_VALUE
);
commonHeader
.
add
(
"Accept"
,
MediaType
.
APPLICATION_JSON_UTF8_VALUE
);
if
(
url
==
null
||
url
.
trim
().
isEmpty
())
{
return
null
;
}
// header
HttpHeaders
httpHeaders
=
new
HttpHeaders
();
if
(
commonHeader
!=
null
)
{
httpHeaders
.
addAll
(
commonHeader
);
}
HttpEntity
<
String
>
httpEntity
=
new
HttpEntity
(
jsonParam
,
httpHeaders
);
HttpEntity
<
String
>
httpEntity
=
new
HttpEntity
(
jsonParam
,
new
HttpHeaders
(
commonHeader
));
ResponseEntity
<
String
>
response
=
restTemplate
.
exchange
(
url
,
HttpMethod
.
POST
,
httpEntity
,
String
.
class
);
if
(
response
.
getStatusCodeValue
()
==
200
)
{
result
=
response
.
getBody
();
...
...
@@ -331,7 +325,7 @@ public class HttpUtil {
// header
HttpHeaders
httpHeaders
=
new
HttpHeaders
();
httpHeaders
.
add
(
"Accept"
,
MediaType
.
APPLICATION_JSON
.
toString
());
httpHeaders
.
set
(
"Content-Type"
,
"application/json;charset=UTF-8"
);
httpHeaders
.
set
(
"Content-Type"
,
MediaType
.
APPLICATION_JSON_UTF8_VALUE
);
if
(
headers
!=
null
)
{
httpHeaders
.
addAll
(
headers
);
}
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/pom.xml
View file @
3c6637bb
...
...
@@ -48,6 +48,14 @@
<version>
1.0-SNAPSHOT
</version>
<scope>
compile
</scope>
</dependency>
<dependency>
<groupId>
com.liquidnet
</groupId>
<artifactId>
liquidnet-service-galaxy-api
</artifactId>
<version>
1.0-SNAPSHOT
</version>
<scope>
compile
</scope>
</dependency>
<dependency>
<groupId>
com.liquidnet
</groupId>
<artifactId>
liquidnet-common-sms
</artifactId>
...
...
@@ -55,6 +63,7 @@
<scope>
compile
</scope>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
easyexcel
</artifactId>
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/service/impl/inner/GoblinGalaxyService.java
View file @
3c6637bb
...
...
@@ -5,6 +5,10 @@ import com.liquidnet.commons.lang.util.CollectionUtil;
import
com.liquidnet.commons.lang.util.CurrentUtil
;
import
com.liquidnet.commons.lang.util.HttpUtil
;
import
com.liquidnet.commons.lang.util.JsonUtils
;
import
com.liquidnet.service.galaxy.dto.param.GalaxyArtSeriesClaimReqDto
;
import
com.liquidnet.service.galaxy.dto.param.GalaxyArtSeriesClaimRespDto
;
import
com.liquidnet.service.galaxy.dto.param.GalaxyNftUploadReqDto
;
import
com.liquidnet.service.galaxy.dto.param.GalaxyNftUploadRespDto
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.core.env.Environment
;
...
...
@@ -28,6 +32,62 @@ public class GoblinGalaxyService {
// @Value("${liquidnet.service.galaxy.url}")// TODO: 2022/3/31 ==zhanggb
// private String sevGalaxyUrl;
/**
* NFT素材上传
*
* @param nftUploadReqDto GalaxyNftUploadReqDto
* @return GalaxyNftUploadRespDto
*/
public
GalaxyNftUploadRespDto
uploadNftMaterial
(
GalaxyNftUploadReqDto
nftUploadReqDto
)
{
// String postUrl = sevGalaxyUrl + "/user/register", blockChainAddress;// TODO: 2022/3/31 ==zhanggb
String
postUrl
=
"https://ENVgalaxy.zhengzai.tv/galaxy/artwork/nftUpload"
.
replace
(
"ENV"
,
env
.
getProperty
(
CurrentUtil
.
CK_ENV_ACTIVE
)),
blockChainAddress
;
String
postBody
=
JsonUtils
.
toJson
(
nftUploadReqDto
);
try
{
String
postRespStr
=
HttpUtil
.
postRaw
(
postUrl
,
postBody
,
null
);
JsonNode
postRespJNode
=
JsonUtils
.
fromJson
(
postRespStr
,
JsonNode
.
class
),
postRespCode
;
if
(
null
==
postRespJNode
||
null
==
(
postRespCode
=
postRespJNode
.
get
(
"code"
))
||
!
postRespCode
.
asText
().
equals
(
"0"
))
{
log
.
warn
(
"#NFT素材上传:请求失败[paramsStr={},postRespStr={}]"
,
postBody
,
postRespStr
);
return
null
;
}
return
JsonUtils
.
OM
().
convertValue
(
postRespJNode
.
get
(
"data"
),
GalaxyNftUploadRespDto
.
class
);
}
catch
(
Exception
e
)
{
log
.
error
(
"Ex.NFT素材上传:请求异常[url={},paramsStr={}],ex:{}"
,
postUrl
,
postBody
,
e
.
getMessage
());
return
null
;
}
}
/**
* NFT系列声明
*
* @param seriesClaimReqDto GalaxyArtSeriesClaimReqDto
* @return GalaxyArtSeriesClaimRespDto
*/
public
GalaxyArtSeriesClaimRespDto
claimNftSeries
(
GalaxyArtSeriesClaimReqDto
seriesClaimReqDto
)
{
// String postUrl = sevGalaxyUrl + "/user/register", blockChainAddress;// TODO: 2022/3/31 ==zhanggb
String
postUrl
=
"https://ENVgalaxy.zhengzai.tv/galaxy/artwork/nftUpload"
.
replace
(
"ENV"
,
env
.
getProperty
(
CurrentUtil
.
CK_ENV_ACTIVE
)),
blockChainAddress
;
String
postBody
=
JsonUtils
.
toJson
(
seriesClaimReqDto
);
try
{
String
postRespStr
=
HttpUtil
.
postRaw
(
postUrl
,
postBody
,
null
);
JsonNode
postRespJNode
=
JsonUtils
.
fromJson
(
postRespStr
,
JsonNode
.
class
),
postRespCode
;
if
(
null
==
postRespJNode
||
null
==
(
postRespCode
=
postRespJNode
.
get
(
"code"
))
||
!
postRespCode
.
asText
().
equals
(
"0"
))
{
log
.
warn
(
"#NFT系列声明:请求失败[paramsStr={},postRespStr={}]"
,
postBody
,
postRespStr
);
return
null
;
}
return
JsonUtils
.
OM
().
convertValue
(
postRespJNode
.
get
(
"data"
),
GalaxyArtSeriesClaimRespDto
.
class
);
}
catch
(
Exception
e
)
{
log
.
error
(
"Ex.NFT系列声明:请求异常[url={},paramsStr={}],ex:{}"
,
postUrl
,
postBody
,
e
.
getMessage
());
return
null
;
}
}
/**
* NFT发行、购买结果查询
*
* @param uid
* @param orderId
* @param routerType
* @return
*/
public
List
<
String
>
checkNftTradeResult
(
String
uid
,
String
orderId
,
String
routerType
)
{
LinkedMultiValueMap
<
String
,
String
>
paramsMap
=
CollectionUtil
.
linkedMultiValueMapStringString
();
paramsMap
.
add
(
"userId"
,
uid
);
...
...
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