记得上下班打卡 | 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
9fb61de5
Commit
9fb61de5
authored
Mar 14, 2022
by
anjiabin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
实现zxtnft购买功能
parent
ad72f5f3
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
822 additions
and
237 deletions
+822
-237
GalaxyConstant.java
...com/liquidnet/service/galaxy/constant/GalaxyConstant.java
+1
-1
GalaxyArtSeriesClaimReqDto.java
...uidnet/service/galaxy/dto/GalaxyArtSeriesClaimReqDto.java
+52
-0
GalaxyArtSeriesClaimRespDto.java
...idnet/service/galaxy/dto/GalaxyArtSeriesClaimRespDto.java
+13
-0
GalaxyNftBuyReqDto.java
.../com/liquidnet/service/galaxy/dto/GalaxyNftBuyReqDto.java
+80
-0
GalaxyNftBuyRespDto.java
...com/liquidnet/service/galaxy/dto/GalaxyNftBuyRespDto.java
+13
-0
GalaxyNftUploadReqDto.java
...m/liquidnet/service/galaxy/dto/GalaxyNftUploadReqDto.java
+43
-0
GalaxyNftUploadRespDto.java
.../liquidnet/service/galaxy/dto/GalaxyNftUploadRespDto.java
+44
-0
IGalaxyArtworkService.java
...quidnet/service/galaxy/service/IGalaxyArtworkService.java
+9
-0
GalaxyRequestLogAspect.java
.../liquidnet/service/galaxy/aop/GalaxyRequestLogAspect.java
+220
-220
GalaxyArtworkController.java
...et/service/galaxy/controller/GalaxyArtworkController.java
+76
-0
GalaxyNftTradeController.java
...t/service/galaxy/controller/GalaxyNftTradeController.java
+24
-0
GalaxyArtworkServiceImpl.java
...service/galaxy/service/impl/GalaxyArtworkServiceImpl.java
+221
-0
TestZxlWalletSdkUtil.java
...va/com/liquidnet/service/galaxy/TestZxlWalletSdkUtil.java
+3
-2
TestZxlnftSdkUtil.java
.../java/com/liquidnet/service/galaxy/TestZxlnftSdkUtil.java
+7
-5
TestZxlnftService.java
.../java/com/liquidnet/service/galaxy/TestZxlnftService.java
+16
-9
No files found.
liquidnet-bus-api/liquidnet-service-galaxy-api/src/main/java/com/liquidnet/service/galaxy/constant/GalaxyConstant.java
View file @
9fb61de5
...
...
@@ -10,7 +10,7 @@ package com.liquidnet.service.galaxy.constant;
* @date 2022/3/8 11:25
*/
public
class
GalaxyConstant
{
public
static
final
String
REDIS_KET_PAY_CODE
=
"dragon:pay:code:"
;
// 支付流水号
public
static
final
String
SERIES_STORE_NAME
=
"NOW_ZXL_NFT_PIC"
;
// 系列存储目录名称
public
enum
RouterEnum
{
ZXINCHAIN
(
"zxinchain"
,
"至信链"
),
...
...
liquidnet-bus-api/liquidnet-service-galaxy-api/src/main/java/com/liquidnet/service/galaxy/dto/GalaxyArtSeriesClaimReqDto.java
0 → 100644
View file @
9fb61de5
package
com
.
liquidnet
.
service
.
galaxy
.
dto
;
import
com.liquidnet.commons.lang.util.JsonUtils
;
import
io.swagger.annotations.ApiModel
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: GalaxyArtSeriesClaimReqDto
* @Package com.liquidnet.service.galaxy.dto
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2022/3/14 11:10
*/
@ApiModel
(
value
=
"GalaxyArtSeriesClaimReqDto"
,
description
=
"NFT系列声明"
)
@Data
public
class
GalaxyArtSeriesClaimReqDto
implements
Serializable
,
Cloneable
{
/**
* skuId
*/
private
String
skuId
;
/**
* 系列一共有多少个,0表示没有限制
*/
private
Long
totalCount
;
/**
* 系列封面url,不超过1024个字符
*/
private
String
coverUrl
;
/**
* 系列描述信息,不超过500个字符
*/
private
String
desc
;
@Override
public
String
toString
(){
return
JsonUtils
.
toJson
(
this
);
}
private
static
final
GalaxyArtSeriesClaimReqDto
obj
=
new
GalaxyArtSeriesClaimReqDto
();
public
static
GalaxyArtSeriesClaimReqDto
getNew
()
{
try
{
return
(
GalaxyArtSeriesClaimReqDto
)
obj
.
clone
();
}
catch
(
CloneNotSupportedException
e
)
{
return
new
GalaxyArtSeriesClaimReqDto
();
}
}
}
liquidnet-bus-api/liquidnet-service-galaxy-api/src/main/java/com/liquidnet/service/galaxy/dto/GalaxyArtSeriesClaimRespDto.java
0 → 100644
View file @
9fb61de5
package
com
.
liquidnet
.
service
.
galaxy
.
dto
;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: GalaxyArtSeriesClaimRespDto
* @Package com.liquidnet.service.galaxy.dto
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2022/3/14 11:21
*/
public
class
GalaxyArtSeriesClaimRespDto
{
}
liquidnet-bus-api/liquidnet-service-galaxy-api/src/main/java/com/liquidnet/service/galaxy/dto/GalaxyNftBuyReqDto.java
0 → 100644
View file @
9fb61de5
//package com.liquidnet.service.galaxy.dto;
//
//import com.liquidnet.commons.lang.util.JsonUtils;
//import io.swagger.annotations.ApiModel;
//import io.swagger.annotations.ApiModelProperty;
//import lombok.Data;
//
//import javax.validation.constraints.NotBlank;
//import javax.validation.constraints.Size;
//import java.io.Serializable;
//
///**
// * @author AnJiabin <anjiabin@zhengzai.tv>
// * @version V1.0
// * @Description: NFT购买(涉及NFT发行、NFT购买)
// * @class: GalaxyNftBuyReqDto
// * @Package com.liquidnet.service.galaxy.dto
// * @Copyright: LightNet @ Copyright (c) 2021
// * @date 2022/3/14 18:13
// */
//@ApiModel(value = "GalaxyNftBuyReqDto", description = "NFT购买")
//@Data
//public class GalaxyNftBuyReqDto implements Serializable,Cloneable {
// @ApiModelProperty(position = 1, required = true, value = "用户ID[30]")
// @NotBlank(message = "用户ID不能为空!")
// @Size(min = 1, max = 30, message = "用户ID限制2-30位且不能包含特殊字符")
// private String userId;
// /**
// * skuId
// */
// private String skuId;
// /**
// * nft名字(sku名称),中英文数字均可,不超过256个字符
// */
// private String name;
// /**
// * nftUrl,不超过1024个字符
// */
// private String url;
// /**
// * 预览图url,不超过1024个字符。(至信链浏览器展示预览图尺寸为290*290,请上传比例为1:1的图片)
// */
// private String displayUrl;
// /**
// * nft简介,500个字符以内
// */
// private String desc;
// /**
// * 系列一共有多少个,0表示没有限制
// */
// private Long totalCount;
// /**
// * 系列封面url,不超过1024个字符
// */
// private String coverUrl;
// /**
// * 系列描述信息,不超过500个字符
// */
// private String desc;
// /**
// * 标签,【文创】,游戏,动漫,30个字符以内
// * 非必填
// */
// private String flag;
//
// @Override
// public String toString(){
// return JsonUtils.toJson(this);
// }
//
// private static final GalaxyNftBuyReqDto obj = new GalaxyNftBuyReqDto();
//
// public static GalaxyNftBuyReqDto getNew() {
// try {
// return (GalaxyNftBuyReqDto) obj.clone();
// } catch (CloneNotSupportedException e) {
// return new GalaxyNftBuyReqDto();
// }
// }
//}
liquidnet-bus-api/liquidnet-service-galaxy-api/src/main/java/com/liquidnet/service/galaxy/dto/GalaxyNftBuyRespDto.java
0 → 100644
View file @
9fb61de5
package
com
.
liquidnet
.
service
.
galaxy
.
dto
;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: GalaxyNftBuyRespDto
* @Package com.liquidnet.service.galaxy.dto
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2022/3/14 18:13
*/
public
class
GalaxyNftBuyRespDto
{
}
liquidnet-bus-api/liquidnet-service-galaxy-api/src/main/java/com/liquidnet/service/galaxy/dto/GalaxyNftUploadReqDto.java
0 → 100644
View file @
9fb61de5
package
com
.
liquidnet
.
service
.
galaxy
.
dto
;
import
com.liquidnet.commons.lang.util.JsonUtils
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: GalaxyNtfUploadReqDto
* @Package com.liquidnet.service.galaxy.dto
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2022/3/12 00:09
*/
@ApiModel
(
value
=
"GalaxyNftUploadReqDto"
,
description
=
"NFT素材上传"
)
@Data
public
class
GalaxyNftUploadReqDto
implements
Serializable
,
Cloneable
{
@ApiModelProperty
(
position
=
1
,
required
=
true
,
value
=
"上传原始图片url"
)
private
String
imageUrl
;
@ApiModelProperty
(
position
=
2
,
required
=
true
,
value
=
"商品唯一规格ID"
)
private
String
skuID
;
@Override
public
String
toString
(){
return
JsonUtils
.
toJson
(
this
);
}
private
static
final
GalaxyNftUploadReqDto
obj
=
new
GalaxyNftUploadReqDto
();
public
static
GalaxyNftUploadReqDto
getNew
()
{
try
{
return
(
GalaxyNftUploadReqDto
)
obj
.
clone
();
}
catch
(
CloneNotSupportedException
e
)
{
return
new
GalaxyNftUploadReqDto
();
}
}
}
\ No newline at end of file
liquidnet-bus-api/liquidnet-service-galaxy-api/src/main/java/com/liquidnet/service/galaxy/dto/GalaxyNftUploadRespDto.java
0 → 100644
View file @
9fb61de5
package
com
.
liquidnet
.
service
.
galaxy
.
dto
;
import
com.liquidnet.commons.lang.util.JsonUtils
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: GalaxyUserRegisterRespDto
* @Package com.liquidnet.service.galaxy.dto
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2022/3/10 20:46
*/
@ApiModel
(
value
=
"GalaxyUserRegisterRespDto"
,
description
=
"素材上传"
)
@Data
public
class
GalaxyNftUploadRespDto
implements
Serializable
,
Cloneable
{
@ApiModelProperty
(
position
=
1
,
required
=
true
,
value
=
"用户区块链类型"
)
private
String
blockChainType
;
@ApiModelProperty
(
position
=
1
,
required
=
true
,
value
=
"素材访问地址"
)
private
String
materialAccessUrl
;
@Override
public
String
toString
(){
return
JsonUtils
.
toJson
(
this
);
}
private
static
final
GalaxyNftUploadRespDto
obj
=
new
GalaxyNftUploadRespDto
();
public
static
GalaxyNftUploadRespDto
getNew
()
{
try
{
return
(
GalaxyNftUploadRespDto
)
obj
.
clone
();
}
catch
(
CloneNotSupportedException
e
)
{
return
new
GalaxyNftUploadRespDto
();
}
}
}
liquidnet-bus-api/liquidnet-service-galaxy-api/src/main/java/com/liquidnet/service/galaxy/service/IGalaxyArtworkService.java
View file @
9fb61de5
package
com
.
liquidnet
.
service
.
galaxy
.
service
;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.galaxy.dto.GalaxyArtSeriesClaimReqDto
;
import
com.liquidnet.service.galaxy.dto.GalaxyArtSeriesClaimRespDto
;
import
com.liquidnet.service.galaxy.dto.GalaxyNftUploadReqDto
;
import
com.liquidnet.service.galaxy.dto.GalaxyNftUploadRespDto
;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
...
...
@@ -10,4 +16,7 @@ package com.liquidnet.service.galaxy.service;
* @date 2022/3/8 11:45
*/
public
interface
IGalaxyArtworkService
{
ResponseDto
<
GalaxyNftUploadRespDto
>
nftUpload
(
GalaxyNftUploadReqDto
reqDto
);
ResponseDto
<
GalaxyArtSeriesClaimRespDto
>
seriesClaim
(
GalaxyArtSeriesClaimReqDto
reqDto
);
}
liquidnet-bus-service/liquidnet-service-galaxy/liquidnet-service-galaxy-impl/src/main/java/com/liquidnet/service/galaxy/aop/GalaxyRequestLogAspect.java
View file @
9fb61de5
package
com
.
liquidnet
.
service
.
galaxy
.
aop
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.serializer.SerializerFeature
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.liquidnet.commons.lang.util.CurrentUtil
;
import
com.liquidnet.commons.lang.util.StringUtil
;
import
com.liquidnet.service.galaxy.aop.annotation.ControllerLog
;
import
lombok.extern.slf4j.Slf4j
;
import
org.aspectj.lang.JoinPoint
;
import
org.aspectj.lang.ProceedingJoinPoint
;
import
org.aspectj.lang.annotation.*
;
import
org.aspectj.lang.reflect.MethodSignature
;
import
org.bouncycastle.asn1.ocsp.ResponseData
;
import
org.springframework.core.LocalVariableTableParameterNameDiscoverer
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.context.request.RequestAttributes
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.lang.reflect.Method
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: GalaxyRequestLogAspect
* @Package com.liquidnet.service.galaxy.aop
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2022/3/11 12:46
*/
@Component
@Aspect
@Slf4j
public
class
GalaxyRequestLogAspect
{
// 定义切点Pointcut
// @Pointcut("@annotation(com.xxxx.aop.ICache)")
//package com.liquidnet.service.galaxy.aop;
//
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.serializer.SerializerFeature;
//import com.fasterxml.jackson.databind.ObjectMapper;
//import com.liquidnet.commons.lang.util.CurrentUtil;
//import com.liquidnet.commons.lang.util.StringUtil;
//import com.liquidnet.service.galaxy.aop.annotation.ControllerLog;
//import lombok.extern.slf4j.Slf4j;
//import org.aspectj.lang.JoinPoint;
//import org.aspectj.lang.ProceedingJoinPoint;
//import org.aspectj.lang.annotation.*;
//import org.aspectj.lang.reflect.MethodSignature;
//import org.bouncycastle.asn1.ocsp.ResponseData;
//import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
//import org.springframework.stereotype.Component;
//import org.springframework.web.context.request.RequestAttributes;
//import org.springframework.web.context.request.RequestContextHolder;
//import org.springframework.web.context.request.ServletRequestAttributes;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.lang.reflect.Method;
//import java.util.Arrays;
//import java.util.HashMap;
//import java.util.Map;
//
///**
// * @author AnJiabin <anjiabin@zhengzai.tv>
// * @version V1.0
// * @Description: TODO
// * @class: GalaxyRequestLogAspect
// * @Package com.liquidnet.service.galaxy.aop
// * @Copyright: LightNet @ Copyright (c) 2021
// * @date 2022/3/11 12:46
// */
//@Component
//@Aspect
//@Slf4j
//public class GalaxyRequestLogAspect {
//
// // 定义切点Pointcut
//// @Pointcut("@annotation(com.xxxx.aop.ICache)")
//// public void requestServer() {
//// }
//
// /**
// * 定义切点
// */
// @Pointcut("execution(* com.liquidnet.service.galaxy.controller..*(..))")
// public void requestServer() {
// }
/**
* 定义切点
*/
@Pointcut
(
"execution(* com.liquidnet.service.galaxy.controller..*(..))"
)
public
void
requestServer
()
{
}
@Around
(
"requestServer()"
)
public
Object
doAround
(
ProceedingJoinPoint
pjp
)
{
//记录请求开始执行时间:
long
beginTime
=
System
.
currentTimeMillis
();
//获取请求信息
ServletRequestAttributes
sra
=
(
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
();
HttpServletRequest
request
=
sra
.
getRequest
();
//获取代理地址、请求地址、请求类名、方法名
String
remoteAddress
=
CurrentUtil
.
getCliIpAddr
();
String
requestURI
=
request
.
getRequestURI
();
String
methodName
=
pjp
.
getSignature
().
getName
();
String
clazzName
=
pjp
.
getTarget
().
getClass
().
getSimpleName
();
//获取请求参数:
MethodSignature
ms
=
(
MethodSignature
)
pjp
.
getSignature
();
//获取请求参数类型
String
[]
parameterNames
=
ms
.
getParameterNames
();
//获取请求参数值
Object
[]
parameterValues
=
pjp
.
getArgs
();
StringBuilder
sb
=
new
StringBuilder
();
//组合请求参数,进行日志打印
if
(
parameterNames
!=
null
&&
parameterNames
.
length
>
0
)
{
for
(
int
i
=
0
;
i
<
parameterNames
.
length
;
i
++)
{
if
(
parameterNames
[
i
].
equals
(
"bindingResult"
))
{
break
;
}
if
((
parameterValues
[
i
]
instanceof
HttpServletRequest
)
||
(
parameterValues
[
i
]
instanceof
HttpServletResponse
))
{
sb
.
append
(
"["
).
append
(
parameterNames
[
i
]).
append
(
"="
).
append
(
parameterValues
[
i
])
.
append
(
"]"
);
}
else
{
sb
.
append
(
"["
).
append
(
parameterNames
[
i
]).
append
(
"="
)
.
append
(
JSON
.
toJSONString
(
parameterValues
[
i
],
SerializerFeature
.
WriteDateUseDateFormat
))
.
append
(
"]"
);
}
}
}
Object
result
=
null
;
try
{
result
=
pjp
.
proceed
();
}
catch
(
Throwable
throwable
)
{
//请求操纵失败
//记录错误日志
log
.
error
(
"切面处理请求错误! IP信息:【{}】 "
+
"URI信息:【{}】 请求映射控制类:【{}】 "
+
"请求方法:【{}】 请求参数列表:【{}】"
,
remoteAddress
,
requestURI
,
clazzName
,
methodName
,
sb
.
toString
());
// log.error("(ง•̀_•́)ง (っ•̀ω•́)っ 切面处理请求错误! IP信息(ง•̀_•́)ง->: 【{}}】 " +
// "URI信息(ง•̀_•́)ง->:【{}】 请求映射控制类(ง•̀_•́)ง->:【{}】 " +
// "请求方法(ง•̀_•́)ง->:【{}】 请求参数列表(ง•̀_•́)ง->:【{}】", remoteAddress, requestURI, clazzName, methodName,
//
// @Around("requestServer()")
// public Object doAround(ProceedingJoinPoint pjp) {
// //记录请求开始执行时间:
// long beginTime = System.currentTimeMillis();
// //获取请求信息
// ServletRequestAttributes sra = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
// HttpServletRequest request = sra.getRequest();
//
// //获取代理地址、请求地址、请求类名、方法名
// String remoteAddress = CurrentUtil.getCliIpAddr();
// String requestURI = request.getRequestURI();
// String methodName = pjp.getSignature().getName();
// String clazzName = pjp.getTarget().getClass().getSimpleName();
//
// //获取请求参数:
// MethodSignature ms = (MethodSignature) pjp.getSignature();
// //获取请求参数类型
// String[] parameterNames = ms.getParameterNames();
// //获取请求参数值
// Object[] parameterValues = pjp.getArgs();
// StringBuilder sb = new StringBuilder();
// //组合请求参数,进行日志打印
// if (parameterNames != null && parameterNames.length > 0) {
// for (int i = 0; i < parameterNames.length; i++) {
// if (parameterNames[i].equals("bindingResult")) {
// break;
// }
// if ((parameterValues[i] instanceof HttpServletRequest) || (parameterValues[i] instanceof HttpServletResponse)) {
// sb.
// append("[").
// append(parameterNames[i]).append("=").append(parameterValues[i])
// .append("]");
// } else {
// sb.
// append("[").
// append(parameterNames[i]).append("=")
// .append(JSON.toJSONString(parameterValues[i], SerializerFeature.WriteDateUseDateFormat))
// .append("]");
// }
// }
// }
// Object result = null;
// try {
// result = pjp.proceed();
// } catch (Throwable throwable) {
// //请求操纵失败
// //记录错误日志
// log.error("切面处理请求错误! IP信息:【{}】 " +
// "URI信息:【{}】 请求映射控制类:【{}】 " +
// "请求方法:【{}】 请求参数列表:【{}】", remoteAddress, requestURI, clazzName, methodName,
// sb.toString());
}
//请求操作成功
String
resultJosnString
=
""
;
if
(
result
!=
null
)
{
if
(
result
instanceof
ResponseData
)
{
resultJosnString
=
JSON
.
toJSONString
(
result
,
SerializerFeature
.
WriteDateUseDateFormat
);
}
else
{
resultJosnString
=
String
.
valueOf
(
result
);
}
}
//记录请求完成执行时间:
long
endTime
=
System
.
currentTimeMillis
();
long
usedTime
=
endTime
-
beginTime
;
//记录日志
log
.
info
(
"请求操作成功! 请求耗时:【{}ms】 "
,
usedTime
);
// log.info("请求操作成功! 请求耗时:【{}】 " +
// "IP信息(◍'౪`◍)ノ゙->: 【{}}】 URI信息(◍'౪`◍)ノ゙->:【{}】 " +
// "请求映射控制类(◍'౪`◍)ノ゙->:【{}】 请求方法(◍'౪`◍)ノ゙->:【{}】 " +
// "请求参数列表(◍'౪`◍)ノ゙->:【{}】 返回值(◍'౪`◍)ノ゙->:【{}】", usedTime, remoteAddress, requestURI, clazzName,
// methodName, sb.toString(), resultJosnString);
return
result
;
}
@Before
(
"requestServer()"
)
public
void
before
(
JoinPoint
joinPoint
){
RequestAttributes
requestAttributes
=
RequestContextHolder
.
getRequestAttributes
();
ServletRequestAttributes
servletRequestAttributes
=
(
ServletRequestAttributes
)
requestAttributes
;
HttpServletRequest
request
=
servletRequestAttributes
.
getRequest
();
//这一步获取到的方法有可能是代理方法也有可能是真实方法
Method
m
=
((
MethodSignature
)
joinPoint
.
getSignature
()).
getMethod
();
//判断代理对象本身是否是连接点所在的目标对象,不是的话就要通过反射重新获取真实方法
if
(
joinPoint
.
getThis
().
getClass
()
!=
joinPoint
.
getTarget
().
getClass
())
{
m
=
this
.
getMethod
(
joinPoint
.
getTarget
().
getClass
(),
m
.
getName
(),
m
.
getParameterTypes
());
}
//通过真实方法获取该方法的参数名称
LocalVariableTableParameterNameDiscoverer
paramNames
=
new
LocalVariableTableParameterNameDiscoverer
();
String
[]
parameterNames
=
paramNames
.
getParameterNames
(
m
);
//获取连接点方法运行时的入参列表
Object
[]
args
=
joinPoint
.
getArgs
();
//将参数名称与入参值一一对应起来
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
//自己写的一个判空类方法
if
(!
StringUtil
.
isEmpty
(
parameterNames
)){
for
(
int
i
=
0
;
i
<
parameterNames
.
length
;
i
++)
{
//这里加一个判断,如果使用requestParam接受参数,加了require=false,这里会存现不存在的现象
if
(
StringUtil
.
isEmpty
(
args
[
i
])){
continue
;
}
//通过所在类转换,获取值,包含各种封装类都可以
ObjectMapper
objectMapper
=
new
ObjectMapper
();
objectMapper
.
convertValue
(
args
[
i
],
args
[
i
].
getClass
());
params
.
put
(
parameterNames
[
i
],
JSON
.
toJSON
(
objectMapper
.
convertValue
(
args
[
i
],
args
[
i
].
getClass
())));
}
}
log
.
info
(
"----------【{}】before start:---------------------"
,
getMethodDesc
(
m
));
log
.
info
(
"URL : "
+
request
.
getRequestURL
().
toString
());
log
.
info
(
"HTTP_METHOD : "
+
request
.
getMethod
());
log
.
info
(
"IP : "
+
request
.
getRemoteAddr
());
log
.
info
(
"CLASS_METHOD : "
+
joinPoint
.
getSignature
().
getDeclaringTypeName
()+
"."
+
joinPoint
.
getSignature
().
getName
());
//这里经过处理,就可以获得参数名字与值一一对应
log
.
info
(
"ARGS-JSON : "
+
params
);
//这个就是纯粹拿到参数,值需要自己匹配
log
.
info
(
"ARGS : "
+
Arrays
.
toString
(
joinPoint
.
getArgs
()));
log
.
info
(
"----------【{}】before end:---------------------"
,
getMethodDesc
(
m
));
}
@AfterThrowing
(
"requestServer()"
)
public
void
AfterThrowing
(){
System
.
out
.
println
(
"异常通知...."
);
}
// @After("requestServer()")
// public void after(JoinPoint point){
// System.out.println("@After:模拟释放资源...");
//// log.error("(ง•̀_•́)ง (っ•̀ω•́)っ 切面处理请求错误! IP信息(ง•̀_•́)ง->: 【{}}】 " +
//// "URI信息(ง•̀_•́)ง->:【{}】 请求映射控制类(ง•̀_•́)ง->:【{}】 " +
//// "请求方法(ง•̀_•́)ง->:【{}】 请求参数列表(ง•̀_•́)ง->:【{}】", remoteAddress, requestURI, clazzName, methodName,
//// sb.toString());
// }
// //请求操作成功
// String resultJosnString = "";
// if (result != null) {
// if (result instanceof ResponseData) {
// resultJosnString = JSON.toJSONString(result, SerializerFeature.WriteDateUseDateFormat);
// } else {
// resultJosnString = String.valueOf(result);
// }
// }
// //记录请求完成执行时间:
// long endTime = System.currentTimeMillis();
// long usedTime = endTime - beginTime;
// //记录日志
// log.info("请求操作成功! 请求耗时:【{}ms】 ", usedTime);
//// log.info("请求操作成功! 请求耗时:【{}】 " +
//// "IP信息(◍'౪`◍)ノ゙->: 【{}}】 URI信息(◍'౪`◍)ノ゙->:【{}】 " +
//// "请求映射控制类(◍'౪`◍)ノ゙->:【{}】 请求方法(◍'౪`◍)ノ゙->:【{}】 " +
//// "请求参数列表(◍'౪`◍)ノ゙->:【{}】 返回值(◍'౪`◍)ノ゙->:【{}】", usedTime, remoteAddress, requestURI, clazzName,
//// methodName, sb.toString(), resultJosnString);
//
// return result;
// }
//
// @Before("requestServer()")
// public void before(JoinPoint joinPoint){
// RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
// ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) requestAttributes;
// HttpServletRequest request = servletRequestAttributes.getRequest();
// //这一步获取到的方法有可能是代理方法也有可能是真实方法
// Method m = ((MethodSignature) joinPoint.getSignature()).getMethod();
// //判断代理对象本身是否是连接点所在的目标对象,不是的话就要通过反射重新获取真实方法
// if (joinPoint.getThis().getClass() != joinPoint.getTarget().getClass()) {
// m = this.getMethod(joinPoint.getTarget().getClass(), m.getName(), m.getParameterTypes());
// }
// //通过真实方法获取该方法的参数名称
// LocalVariableTableParameterNameDiscoverer paramNames = new LocalVariableTableParameterNameDiscoverer();
// String[] parameterNames = paramNames.getParameterNames(m);
// //获取连接点方法运行时的入参列表
// Object[] args = joinPoint.getArgs();
// //将参数名称与入参值一一对应起来
// Map<String, Object> params = new HashMap<>();
// //自己写的一个判空类方法
// if (!StringUtil.isEmpty(parameterNames)){
// for (int i = 0; i < parameterNames.length; i++) {
// //这里加一个判断,如果使用requestParam接受参数,加了require=false,这里会存现不存在的现象
// if (StringUtil.isEmpty(args[i])){
// continue;
// }
// //通过所在类转换,获取值,包含各种封装类都可以
// ObjectMapper objectMapper = new ObjectMapper();
// objectMapper.convertValue(args[i],args[i].getClass());
// params.put(parameterNames[i],JSON.toJSON(objectMapper.convertValue(args[i],args[i].getClass())));
// }
// }
// log.info("----------【{}】before start:---------------------",getMethodDesc(m));
// log.info("URL : " + request.getRequestURL().toString());
// log.info("HTTP_METHOD : " + request.getMethod());
// log.info("IP : " + request.getRemoteAddr());
// log.info("CLASS_METHOD : " + joinPoint.getSignature().getDeclaringTypeName()+ "." + joinPoint.getSignature().getName());
// //这里经过处理,就可以获得参数名字与值一一对应
// log.info("ARGS-JSON : " + params);
// //这个就是纯粹拿到参数,值需要自己匹配
// log.info("ARGS : "+ Arrays.toString(joinPoint.getArgs()));
// log.info("----------【{}】before end:---------------------",getMethodDesc(m));
//
// }
//
// @AfterThrowing("requestServer()")
// public void AfterThrowing(){
// System.out.println("异常通知....");
// }
//
//// @After("requestServer()")
//// public void after(JoinPoint point){
//// System.out.println("@After:模拟释放资源...");
////
//// log.info("before return+++++++++++++++++++++++++++");
//// log.info("@After:目标方法为:" +
//// point.getSignature().getDeclaringTypeName() +
//// "." + point.getSignature().getName());
//// log.info("@After:参数为:" + Arrays.toString(point.getArgs()));
//// System.out.println("@After:被织入的目标对象为:" + point.getTarget());
//// log.info("end return++++++++++++++++++++++++++++++++");
//// }
//
// @AfterReturning(value = "requestServer()",returning = "rtv")
// public void AfterReturning(JoinPoint joinPoint, Object rtv){
// log.info("before return+++++++++++++++++++++++++++");
// log.info("@After:目标方法为:" +
// point.getSignature().getDeclaringTypeName() +
// "." + point.getSignature().getName());
// log.info("@After:参数为:" + Arrays.toString(point.getArgs()));
// System.out.println("@After:被织入的目标对象为:" + point.getTarget());
// log.info("responseBody:"+ JSON.toJSONString(rtv, SerializerFeature.WriteMapNullValue));
// log.info("end return++++++++++++++++++++++++++++++++");
// }
@AfterReturning
(
value
=
"requestServer()"
,
returning
=
"rtv"
)
public
void
AfterReturning
(
JoinPoint
joinPoint
,
Object
rtv
){
log
.
info
(
"before return+++++++++++++++++++++++++++"
);
log
.
info
(
"responseBody:"
+
JSON
.
toJSONString
(
rtv
,
SerializerFeature
.
WriteMapNullValue
));
log
.
info
(
"end return++++++++++++++++++++++++++++++++"
);
}
private
Method
getMethod
(
Class
<?>
classt
,
String
methodName
,
Class
<?>[]
parameterTypes
){
Method
rsMethod
=
null
;
Method
[]
methods
=
classt
.
getMethods
();
String
description
=
""
;
for
(
Method
method
:
methods
)
{
if
(
method
.
getName
().
equals
(
methodName
))
{
rsMethod
=
method
;
// Class[] clazzs = method.getParameterTypes();
// if (clazzs.length == parameterTypes.length) {
// description = method.getAnnotation(ControllerLog.class).description();
// break;
//
// private Method getMethod(Class<?> classt,String methodName,Class<?>[] parameterTypes){
// Method rsMethod = null;
// Method[] methods = classt.getMethods();
// String description = "";
// for (Method method : methods) {
// if (method.getName().equals(methodName)) {
// rsMethod = method;
//// Class[] clazzs = method.getParameterTypes();
//// if (clazzs.length == parameterTypes.length) {
//// description = method.getAnnotation(ControllerLog.class).description();
//// break;
//// }
// }
// }
// return rsMethod;
// }
}
}
return
rsMethod
;
}
private
String
getMethodDesc
(
Method
method
){
String
rsMethodDesc
=
"未知方法"
;
if
(!
StringUtil
.
isNull
(
method
)){
rsMethodDesc
=
method
.
getAnnotation
(
ControllerLog
.
class
).
description
();
}
return
rsMethodDesc
;
}
}
\ No newline at end of file
//
// private String getMethodDesc(Method method){
// String rsMethodDesc = "未知方法";
// if(!StringUtil.isNull(method)){
// rsMethodDesc = method.getAnnotation(ControllerLog.class).description();
// }
// return rsMethodDesc;
// }
//
//}
\ No newline at end of file
liquidnet-bus-service/liquidnet-service-galaxy/liquidnet-service-galaxy-impl/src/main/java/com/liquidnet/service/galaxy/controller/GalaxyArtworkController.java
0 → 100644
View file @
9fb61de5
package
com
.
liquidnet
.
service
.
galaxy
.
controller
;
import
com.github.xiaoymin.knife4j.annotations.ApiOperationSupport
;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.galaxy.aop.annotation.ControllerLog
;
import
com.liquidnet.service.galaxy.dto.GalaxyArtSeriesClaimReqDto
;
import
com.liquidnet.service.galaxy.dto.GalaxyArtSeriesClaimRespDto
;
import
com.liquidnet.service.galaxy.dto.GalaxyNftUploadReqDto
;
import
com.liquidnet.service.galaxy.dto.GalaxyNftUploadRespDto
;
import
com.liquidnet.service.galaxy.service.IGalaxyArtworkService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.validation.Valid
;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: NFT上传,系列声明
* @class: GalaxyArtworkController
* @Package com.liquidnet.service.galaxy.controller
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2022/3/14 13:59
*/
@Api
(
tags
=
"NFT艺术品相关"
)
@RestController
@RequestMapping
(
"artwork"
)
@Validated
@Slf4j
public
class
GalaxyArtworkController
{
@Autowired
private
IGalaxyArtworkService
galaxyArtworkService
;
@ControllerLog
(
description
=
"NFT素材上传"
)
@ApiOperationSupport
(
order
=
1
)
@ApiOperation
(
value
=
"NFT素材上传"
)
@PostMapping
(
value
=
{
"nftUpload"
})
public
ResponseDto
<
GalaxyNftUploadRespDto
>
nftUpload
(
@Valid
@RequestBody
GalaxyNftUploadReqDto
reqDto
)
{
return
galaxyArtworkService
.
nftUpload
(
reqDto
);
}
@ControllerLog
(
description
=
"NFT系列声明"
)
@ApiOperationSupport
(
order
=
2
)
@ApiOperation
(
value
=
"NFT系列声明"
)
@PostMapping
(
value
=
{
"seriesClaim"
})
public
ResponseDto
<
GalaxyArtSeriesClaimRespDto
>
seriesClaim
(
@Valid
@RequestBody
GalaxyArtSeriesClaimReqDto
reqDto
)
{
return
galaxyArtworkService
.
seriesClaim
(
reqDto
);
}
// @ControllerLog(description = "NFT素材上传(form-data文件提交)")
// @ApiOperationSupport(order = 1)
// @ApiOperation(value = "NFT素材上传")
// @PostMapping(value = {"nftFileUpload"})
// public ResponseDto<GalaxyNftUploadRespDto> nftFileUpload(@RequestParam("file") MultipartFile file) {
// if (file.isEmpty()) {
// return ResponseDto.failure("上传失败,请选择文件");
// }
// GalaxyNftUploadReqDto reqDto = GalaxyNftUploadReqDto.getNew();
// reqDto.setImageUrl("");
// try {
// File upFile = file.getResource().getFile();
// reqDto.setFile(upFile);
// } catch (IOException e) {
// e.printStackTrace();
// }
// reqDto.setSeriesName("");
// return galaxyArtworkService.nftUpload(reqDto);
// }
}
liquidnet-bus-service/liquidnet-service-galaxy/liquidnet-service-galaxy-impl/src/main/java/com/liquidnet/service/galaxy/controller/GalaxyNftTradeController.java
0 → 100644
View file @
9fb61de5
package
com
.
liquidnet
.
service
.
galaxy
.
controller
;
import
io.swagger.annotations.Api
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: NFT购买
* @class: GalaxyNftTradeController
* @Package com.liquidnet.service.galaxy.controller
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2022/3/14 18:08
*/
@Api
(
tags
=
"NFT艺术品相关"
)
@RestController
@RequestMapping
(
"nftTrade"
)
@Validated
@Slf4j
public
class
GalaxyNftTradeController
{
}
liquidnet-bus-service/liquidnet-service-galaxy/liquidnet-service-galaxy-impl/src/main/java/com/liquidnet/service/galaxy/service/impl/GalaxyArtworkServiceImpl.java
0 → 100644
View file @
9fb61de5
package
com
.
liquidnet
.
service
.
galaxy
.
service
.
impl
;
import
com.liquidnet.common.third.zxlnft.biz.ZxlnftBiz
;
import
com.liquidnet.common.third.zxlnft.config.ZxlnftConfig
;
import
com.liquidnet.common.third.zxlnft.constant.ZxlErrorEnum
;
import
com.liquidnet.common.third.zxlnft.constant.ZxlnftEnum
;
import
com.liquidnet.common.third.zxlnft.dto.*
;
import
com.liquidnet.common.third.zxlnft.dto.wallet.UploadToCosReq
;
import
com.liquidnet.common.third.zxlnft.dto.wallet.UploadToCosResp
;
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.DateUtil
;
import
com.liquidnet.commons.lang.util.IDGenerator
;
import
com.liquidnet.commons.lang.util.StringUtil
;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.galaxy.dto.GalaxyArtSeriesClaimReqDto
;
import
com.liquidnet.service.galaxy.dto.GalaxyArtSeriesClaimRespDto
;
import
com.liquidnet.service.galaxy.dto.GalaxyNftUploadReqDto
;
import
com.liquidnet.service.galaxy.dto.GalaxyNftUploadRespDto
;
import
com.liquidnet.service.galaxy.service.IGalaxyArtworkService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
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: GalaxyArtworkServiceImpl
* @Package com.liquidnet.service.galaxy.service.impl
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2022/3/12 00:14
*/
@Slf4j
@Service
public
class
GalaxyArtworkServiceImpl
implements
IGalaxyArtworkService
{
@Autowired
private
ZxlnftSdkUtil
zxlnftSdkUtil
;
@Autowired
private
ZxlWalletSdkUtil
zxlWalletSdkUtil
;
@Autowired
private
ZxlnftBiz
zxlnftBiz
;
@Autowired
private
ZxlnftConfig
zxlnftConfig
;
@Value
(
"${liquidnet.galaxy.temp-file-path:/Users/anjiabin/mdsky_gitlab/galaxy/tempFilePath}"
)
private
String
tempFilePath
;
@Override
public
ResponseDto
<
GalaxyNftUploadRespDto
>
nftUpload
(
GalaxyNftUploadReqDto
reqDto
)
{
String
imageUrl
=
reqDto
.
getImageUrl
();
String
seriesName
=
"NOW_ZXL_NFT_PIC_skuId002"
;
//系列名字 skuId
String
filePath
=
"/Users/anjiabin/Downloads/myFileTemp/zxl_image_test_001.jpg"
;
String
fileName
=
IDGenerator
.
getZxlNftImageCosCode
()
+
".jpg"
;
//通过图片url地址上传
File
cosFile
=
this
.
inputStreamToFile
(
reqDto
.
getImageUrl
(),
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.1调用图片内容检测接口
Nft008QueryImageModerationReqDto
nft008ReqDto
=
Nft008QueryImageModerationReqDto
.
getNew
();
nft008ReqDto
.
setImageUrl
(
imageUrl
);
ZxlnftResponseDto
<
Nft008QueryImageModerationRespDto
>
nft008RespDto
=
zxlnftSdkUtil
.
nft008QueryImageModeration
(
nft008ReqDto
);
if
(!
nft008RespDto
.
getData
().
getSuggestion
().
equals
(
ZxlnftEnum
.
SuggestionEnum
.
PASS
.
getCode
())){
throw
new
ZxlNftException
(
ZxlErrorEnum
.
IMAGE_CHECK_ERROR
.
getCode
(),
ZxlErrorEnum
.
IMAGE_CHECK_ERROR
.
getMsg
());
}
// 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
.
setMaterialAccessUrl
(
fullFilePath
);
return
ResponseDto
.
success
(
galaxyNftUploadRespDto
);
// 1.4.4调用查询素材地址接口 -- 非必需
// Nft021UploadUrlReqDto nft021ReqDto = Nft021UploadUrlReqDto.getNew();
// nft021ReqDto.setSeriesName(seriesName);
// nft021ReqDto.setPlatformIdentification(zxlnftConfig.getPlatformIdentification());
// //如果上传人就是平台管理员,以下需要注释掉,因为会导致返回的地址多了一级目录
//// nft021ReqDto.setUserIdentification(zxlnftConfig.getPlatformIdentification());
// ZxlnftResponseDto<Nft021UploadUrlRespDto> resp = zxlnftSdkUtil.nft021UploadUrl(nft021ReqDto);
}
@Override
public
ResponseDto
<
GalaxyArtSeriesClaimRespDto
>
seriesClaim
(
GalaxyArtSeriesClaimReqDto
reqDto
)
{
/**
* 进行系列声明
*/
// Nft030SeriesClaimReqDto nft030ReqDto = Nft030SeriesClaimReqDto.getNew();
// nft030ReqDto.setPubKey(zxlnftConfig.getNftPlatformPubKey());
// nft030ReqDto.setSeriesName(seriesName);
// //无限制系列 设置为0
// nft030ReqDto.setTotalCount(0l);
// nft030ReqDto.setOperateId(IDGenerator.get32UUID());
// //系列封面
// nft030ReqDto.setCoverUrl("https://zhixinliantest-1302317679.cos.ap-guangzhou.myqcloud.com/nft/4e40d5f6f65aa8ec9bc33ab424e0167e68783bbe95d4d265086314d749808eef/ZXLNFTIMAGE202202241512003609141721.jpg");
// nft030ReqDto.setDesc("系列描述信息不超过500字符");
// nft030ReqDto.setMaxPublishCount(0);
// nft030ReqDto.setSeriesBeginFromZero(false);
// ZxlnftResponseDto<Nft030SeriesClaimRespDto> nft30RespDto = zxlnftSdkUtil.nft030SeriesClaim(reqDto);
//
// //{"taskId":"49d1cccc-e62c-40bc-923c-bfac31325351_nft-series-claim_1"}
// if(nft30RespDto.isSuccess()){
// //系列声明结果查询
// Nft031SeriesClaimResultReqDto nft031ReqDto = Nft031SeriesClaimResultReqDto.getNew();
// //第零个系列 无限制系列
// nft031ReqDto.setTaskId(nft30RespDto.getData().getTaskId());
//
// int count = 0;
// while(StringUtil.isEmpty(seriesId)){
// //休眠1秒钟,等待执行结果
// try {
// Thread.sleep(1000l);
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
//
// count++;
// log.info("=======执行第{}次查询,taskId:{}",count,nft031ReqDto.getTaskId());
// ZxlnftResponseDto<Nft031SeriesClaimResultRespDto> nft031RespDtoTemp = zxlnftSdkUtil.nft031SeriesClaimResult(nft031ReqDto);
// if(nft031RespDtoTemp.getData().getTaskStatus().toString().equals(ZxlnftEnum.TaskStatusEnum.TASK_SUCCESS.getCode())){
// seriesId = nft031RespDtoTemp.getData().getSeriesId();
// break;
// }else if(nft031RespDtoTemp.getData().getTaskStatus().toString().equals(ZxlnftEnum.TaskStatusEnum.TASK_FAIL.getCode())){
// log.info("任务执行失败!taskId:{}",nft031ReqDto.getTaskId());
// break;
// }
//
// if(count==6){
// log.info("=======查询共6次,跳出循环!taskId:{}",nft031ReqDto.getTaskId());
// break;
// }
// }
//
// log.info("系列声明结果查询 seriesId :{}",seriesId);
// }
return
null
;
}
/**
* 大美 通过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/test/java/com/liquidnet/service/galaxy/TestZxlWalletSdkUtil.java
View file @
9fb61de5
...
...
@@ -81,10 +81,11 @@ public class TestZxlWalletSdkUtil {
public
void
uploadToCos
(){
// String filePath = "/Users/anjiabin/Downloads/zxl_image_test_002.jpeg";
// String filePath = "/Users/anjiabin/Downloads/zxl_image_series_test_001.jpeg";
String
filePath
=
"/Users/anjiabin/Downloads/zxl_image_test_001.jpg"
;
// String filePath = "/Users/anjiabin/Downloads/zxl_image_test_001.jpg";
String
filePath
=
"https://img.zhengzai.tv/other/2022/03/09/1f88d2bc6fea40e19430227326410cb3.jpg"
;
String
seriesName
=
"NOW_ZXL_NFT_PIC001_skuId001_test"
;
// String fileName = "/"+ seriesName + "/" + DateUtil.getNowTime()+"/"+ IDGenerator.getZxlNftImageCosCode() +".jpg";
String
fileName
=
"/"
+
DateUtil
.
getNowTime
(
)+
"/"
+
IDGenerator
.
getZxlNftImageCosCode
()
+
".jpg"
;
String
fileName
=
DateUtil
.
getNowTime
(
DateUtil
.
DATE_SMALL_STR
)+
"/"
+
IDGenerator
.
getZxlNftImageCosCode
()
+
".jpg"
;
//调用生成素材上传临时密钥接口
Nft022UploadSecretReqDto
nft022ReqDto
=
Nft022UploadSecretReqDto
.
getNew
();
...
...
liquidnet-bus-service/liquidnet-service-galaxy/liquidnet-service-galaxy-impl/src/test/java/com/liquidnet/service/galaxy/TestZxlnftSdkUtil.java
View file @
9fb61de5
...
...
@@ -287,9 +287,10 @@ public class TestZxlnftSdkUtil {
@Test
public
void
nft021UploadUrl
(){
Nft021UploadUrlReqDto
reqDto
=
Nft021UploadUrlReqDto
.
getNew
();
reqDto
.
setSeriesName
(
"NOW_ZXL_NFT_PIC001_test_skuId001"
);
// reqDto.setSeriesName("NOW_ZXL_NFT_PIC001_test_skuId001");
reqDto
.
setSeriesName
(
"SERIES_STORE_NAME"
);
reqDto
.
setPlatformIdentification
(
zxlnftConfig
.
getPlatformIdentification
());
reqDto
.
setUserIdentification
(
zxlnftConfig
.
getPlatformIdentification
());
//暂时素材上传人和平台管理员是同一个人
//
reqDto.setUserIdentification(zxlnftConfig.getPlatformIdentification()); //暂时素材上传人和平台管理员是同一个人
ZxlnftResponseDto
<
Nft021UploadUrlRespDto
>
resp
=
zxlnftSdkUtil
.
nft021UploadUrl
(
reqDto
);
System
.
out
.
println
(
resp
.
toJson
());
...
...
@@ -438,9 +439,9 @@ public class TestZxlnftSdkUtil {
//无限制系列 NOW_ZXL_NFT_PIC_skuId001
// reqDto.setSeriesId("4e40d5f6f65aa8ec9bc33ab424e0167e68783bbe95d4d265086314d749808eef_8a827e181b695fb8d9b081d3855d2895ced1d003ee186622a005cec37ea77e59");
//无限制系列 NOW_ZXL_NFT_PIC_skuId002
reqDto
.
setSeriesId
(
"4e40d5f6f65aa8ec9bc33ab424e0167e68783bbe95d4d265086314d749808eef_b9b105d186742e44691c540bbacddd1c3a883a49d899b81c5b1a5cf10b4ad4e6"
);
//
reqDto.setSeriesId("4e40d5f6f65aa8ec9bc33ab424e0167e68783bbe95d4d265086314d749808eef_b9b105d186742e44691c540bbacddd1c3a883a49d899b81c5b1a5cf10b4ad4e6");
//第一个系列
//
reqDto.setSeriesId("4e40d5f6f65aa8ec9bc33ab424e0167e68783bbe95d4d265086314d749808eef_ca49b5ebadd5f73ab057fe869bf897cbcc0f31e0b89db71cc3ec78bca2d16ed6");
reqDto
.
setSeriesId
(
"4e40d5f6f65aa8ec9bc33ab424e0167e68783bbe95d4d265086314d749808eef_ca49b5ebadd5f73ab057fe869bf897cbcc0f31e0b89db71cc3ec78bca2d16ed6"
);
//第二个系列
// reqDto.setSeriesId("4e40d5f6f65aa8ec9bc33ab424e0167e68783bbe95d4d265086314d749808eef_31ff9f7d4c33c98518e095fec6cecdab8d337751602cf6e651eb7d131cff5b61");
ZxlnftResponseDto
<
Nft032SeriesRespDto
>
resp
=
zxlnftSdkUtil
.
nft032Series
(
reqDto
);
...
...
@@ -508,7 +509,7 @@ public class TestZxlnftSdkUtil {
//无限制零系列
// reqDto.setSeriesId("4e40d5f6f65aa8ec9bc33ab424e0167e68783bbe95d4d265086314d749808eef_8a827e181b695fb8d9b081d3855d2895ced1d003ee186622a005cec37ea77e59");
// //系列001
reqDto
.
setSeriesId
(
"4e40d5f6f65aa8ec9bc33ab424e0167e68783bbe95d4d265086314d749808eef_ca49b5ebadd5f73ab057fe869bf897cbcc0f31e0b89db71cc3ec78bca2d16ed6"
);
//
reqDto.setSeriesId("4e40d5f6f65aa8ec9bc33ab424e0167e68783bbe95d4d265086314d749808eef_ca49b5ebadd5f73ab057fe869bf897cbcc0f31e0b89db71cc3ec78bca2d16ed6");
// //系列002
// reqDto.setSeriesId("4e40d5f6f65aa8ec9bc33ab424e0167e68783bbe95d4d265086314d749808eef_31ff9f7d4c33c98518e095fec6cecdab8d337751602cf6e651eb7d131cff5b61");
reqDto
.
setSeriesBeginIndex
(
6
);
...
...
@@ -549,6 +550,7 @@ public class TestZxlnftSdkUtil {
//系列001 发行ID6 共6个
reqDto
.
setTaskId
(
"2f1eae08-6b52-42ff-ac69-78cca7bf6913_nft-publish_3"
);
reqDto
.
setTaskId
(
"4efaab86-deb3-436f-9aca-de59033ec79c_nft-publish_3"
);
reqDto
.
setTaskId
(
"878dddd8-0e10-4e0b-99d0-0f2221ea3a48_nft-publish_3"
);
ZxlnftResponseDto
<
Nft035PublishResultRespDto
>
resp
=
zxlnftSdkUtil
.
nft035PublishResult
(
reqDto
);
System
.
out
.
println
(
resp
.
toJson
());
}
...
...
liquidnet-bus-service/liquidnet-service-galaxy/liquidnet-service-galaxy-impl/src/test/java/com/liquidnet/service/galaxy/TestZxlnftService.java
View file @
9fb61de5
...
...
@@ -301,34 +301,41 @@ public class TestZxlnftService {
String
name
=
"上海草莓音乐节2022"
;
String
url
=
"https://zhixinliantest-1302317679.cos.ap-guangzhou.myqcloud.com/nft/4e40d5f6f65aa8ec9bc33ab424e0167e68783bbe95d4d265086314d749808eef/ZXLNFTIMAGE202202241512003609141721.jpg"
;
String
displayUrl
=
"https://zhixinliantest-1302317679.cos.ap-guangzhou.myqcloud.com/nft/4e40d5f6f65aa8ec9bc33ab424e0167e68783bbe95d4d265086314d749808eef/ZXLNFTIMAGE202202241512003609141721.jpg"
;
//第二中图片
url
=
"https://zhixinliantest-1302317679.cos.ap-guangzhou.myqcloud.com/nft/4e40d5f6f65aa8ec9bc33ab424e0167e68783bbe95d4d265086314d749808eef/NOW_ZXL_NFT_PIC_skuId002/ZXLNFTIMAGE202203141616443229613632.jpg"
;
displayUrl
=
"https://zhixinliantest-1302317679.cos.ap-guangzhou.myqcloud.com/nft/4e40d5f6f65aa8ec9bc33ab424e0167e68783bbe95d4d265086314d749808eef/ZXLNFTIMAGE202202241512003609141721.jpg"
;
String
desc
=
"NFT描述信息"
;
String
flag
=
"文创"
;
//发行个数
Long
publishCount
=
1L
;
//开始索引
Integer
seriesBeginIndex
=
3
;
Integer
seriesBeginIndex
=
8
;
Long
sellCount
=
1000L
;
//积分
//无限制系列
String
seriesId
=
"4e40d5f6f65aa8ec9bc33ab424e0167e68783bbe95d4d265086314d749808eef_8a827e181b695fb8d9b081d3855d2895ced1d003ee186622a005cec37ea77e59"
;
//
String seriesId = "4e40d5f6f65aa8ec9bc33ab424e0167e68783bbe95d4d265086314d749808eef_8a827e181b695fb8d9b081d3855d2895ced1d003ee186622a005cec37ea77e59";
//系列001
//
String seriesId = "4e40d5f6f65aa8ec9bc33ab424e0167e68783bbe95d4d265086314d749808eef_ca49b5ebadd5f73ab057fe869bf897cbcc0f31e0b89db71cc3ec78bca2d16ed6";
String
seriesId
=
"4e40d5f6f65aa8ec9bc33ab424e0167e68783bbe95d4d265086314d749808eef_ca49b5ebadd5f73ab057fe869bf897cbcc0f31e0b89db71cc3ec78bca2d16ed6"
;
//系列002
//String seriesId = "4e40d5f6f65aa8ec9bc33ab424e0167e68783bbe95d4d265086314d749808eef_31ff9f7d4c33c98518e095fec6cecdab8d337751602cf6e651eb7d131cff5b61";
//
Nft032SeriesReqDto
nft02ReqDto
=
Nft032SeriesReqDto
.
getNew
();
Nft032SeriesReqDto
nft032ReqDto
=
Nft032SeriesReqDto
.
getNew
();
nft032ReqDto
.
setSeriesId
(
seriesId
);
//第零个系列 无限制系列查询
nft0
2ReqDto
.
setSeriesId
(
"4e40d5f6f65aa8ec9bc33ab424e0167e68783bbe95d4d265086314d749808eef_8a827e181b695fb8d9b081d3855d2895ced1d003ee186622a005cec37ea77e59"
);
// nft03
2ReqDto.setSeriesId("4e40d5f6f65aa8ec9bc33ab424e0167e68783bbe95d4d265086314d749808eef_8a827e181b695fb8d9b081d3855d2895ced1d003ee186622a005cec37ea77e59");
//第一个系列
//
r
eqDto.setSeriesId("4e40d5f6f65aa8ec9bc33ab424e0167e68783bbe95d4d265086314d749808eef_ca49b5ebadd5f73ab057fe869bf897cbcc0f31e0b89db71cc3ec78bca2d16ed6");
//
nft032R
eqDto.setSeriesId("4e40d5f6f65aa8ec9bc33ab424e0167e68783bbe95d4d265086314d749808eef_ca49b5ebadd5f73ab057fe869bf897cbcc0f31e0b89db71cc3ec78bca2d16ed6");
//第二个系列
//
r
eqDto.setSeriesId("4e40d5f6f65aa8ec9bc33ab424e0167e68783bbe95d4d265086314d749808eef_31ff9f7d4c33c98518e095fec6cecdab8d337751602cf6e651eb7d131cff5b61");
ZxlnftResponseDto
<
Nft032SeriesRespDto
>
resp
=
zxlnftSdkUtil
.
nft032Series
(
nft02ReqDto
);
//
nft032R
eqDto.setSeriesId("4e40d5f6f65aa8ec9bc33ab424e0167e68783bbe95d4d265086314d749808eef_31ff9f7d4c33c98518e095fec6cecdab8d337751602cf6e651eb7d131cff5b61");
ZxlnftResponseDto
<
Nft032SeriesRespDto
>
resp
=
zxlnftSdkUtil
.
nft032Series
(
nft0
3
2ReqDto
);
//该系列已经发行多少个nft
Long
crtCount
=
resp
.
getData
().
getSeriesInfo
().
getCrtCount
();
log
.
info
(
"系列:{} 已发行 :{}"
,
seriesId
,
crtCount
);
//3.1.2调用NFT发行接口
/**
...
...
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