记得上下班打卡 | git大法好,push需谨慎

Commit 7f9937ae authored by anjiabin's avatar anjiabin

实现zxtnft购买功能

parent b5be8362
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.Pattern;
import javax.validation.constraints.Size;
import java.io.Serializable;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: GalaxyUserRegisterReqDto
* @Package com.liquidnet.service.galaxy.dto
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2022/3/10 20:46
*/
@ApiModel(value = "GalaxyUserRegisterReqDto", description = "用户实名注册")
@Data
public class GalaxyUserRegisterReqDto 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;
@ApiModelProperty(position = 2, required = true, value = "姓名[50]", example = "张三")
@Size(min = 1, max = 30, message = "姓名长度限制1-30位")
private String userName;
@ApiModelProperty(position = 3, required = true, value = "手机号[11]", example = "13111111111")
@Pattern(regexp = "\\d{11}", message = "手机号格式有误")
@NotBlank(message = "手机号不能为空")
@Size(min = 1, max = 11, message = "手机号长度限制1-11位")
private String mobile;
@ApiModelProperty(position = 4, required = true, value = "证件类型",example = "")
@NotBlank(message = "证件类型不能为空!")
@Size(min = 1, max = 2, message = "证件类型")
private String idCardType;
@ApiModelProperty(position = 5, required = true, value = "证件号")
@NotBlank(message = "证件号不能为空!")
@Size(min = 1, max = 18, message = "证件号限制1-18位且不能包含特殊字符")
private String idCard;
@Override
public String toString(){
return JsonUtils.toJson(this);
}
private static final GalaxyUserRegisterReqDto obj = new GalaxyUserRegisterReqDto();
public static GalaxyUserRegisterReqDto getNew() {
try {
return (GalaxyUserRegisterReqDto) obj.clone();
} catch (CloneNotSupportedException e) {
return new GalaxyUserRegisterReqDto();
}
}
}
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 GalaxyUserRegisterRespDto implements Serializable,Cloneable {
@ApiModelProperty(position = 1, required = true, value = "用户ID[30]")
private String userId;
@ApiModelProperty(position = 1, required = true, value = "用户区块链类型")
private String blockChainType;
@ApiModelProperty(position = 1, required = true, value = "用户区块链地址")
private String blockChainAddress;
@Override
public String toString(){
return JsonUtils.toJson(this);
}
private static final GalaxyUserRegisterRespDto obj = new GalaxyUserRegisterRespDto();
public static GalaxyUserRegisterRespDto getNew() {
try {
return (GalaxyUserRegisterRespDto) obj.clone();
} catch (CloneNotSupportedException e) {
return new GalaxyUserRegisterRespDto();
}
}
}
package com.liquidnet.service.galaxy.service; package com.liquidnet.service.galaxy.service;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.galaxy.dto.GalaxyUserRegisterReqDto;
import com.liquidnet.service.galaxy.dto.GalaxyUserRegisterRespDto;
/** /**
* @author AnJiabin <anjiabin@zhengzai.tv> * @author AnJiabin <anjiabin@zhengzai.tv>
...@@ -12,11 +15,5 @@ package com.liquidnet.service.galaxy.service; ...@@ -12,11 +15,5 @@ package com.liquidnet.service.galaxy.service;
* @date 2022/3/8 11:45 * @date 2022/3/8 11:45
*/ */
public interface IGalaxyUserService { public interface IGalaxyUserService {
// ResponseDto<DragonPayBaseRespDto> dragonPay(DragonPayBaseReqDto dragonPayBaseReqDto); ResponseDto<GalaxyUserRegisterRespDto> userRegister(GalaxyUserRegisterReqDto reqDto);
//
// String dragonNotify(HttpServletRequest request,String payType,String deviceFrom);
//
// DragonPayOrderQueryRespDto checkOrderStatusByCode(String code);
//
// boolean manulNotify(String code);
} }
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() {
}
@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,
// 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("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;
// }
}
}
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
package com.liquidnet.service.galaxy.aop.annotation;
import java.lang.annotation.*;
/**
*自定义注解 拦截Controller
*/
@Target({ElementType.PARAMETER, ElementType.METHOD}) //作用范围为方法和参数
@Retention(RetentionPolicy.RUNTIME) //指定生命周期为内存可读
@Documented //指定其为注解
public @interface ControllerLog {
/**
* 操作说明
*/
public String description() default "";
}
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.GalaxyUserRegisterReqDto;
import com.liquidnet.service.galaxy.dto.GalaxyUserRegisterRespDto;
import com.liquidnet.service.galaxy.service.IGalaxyUserService;
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: TODO
* @class: GalaxyUserController
* @Package com.liquidnet.service.galaxy.controller
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2022/3/11 12:11
*/
@Api(tags = "NFT-用户相关")
@RestController
@RequestMapping("user")
@Validated
@Slf4j
public class GalaxyUserController {
@Autowired
private IGalaxyUserService galaxyUserService;
@ControllerLog(description = "NFT用户注册")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "NFT用户注册")
@PostMapping(value = {"register"})
public ResponseDto<GalaxyUserRegisterRespDto> register(@Valid @RequestBody GalaxyUserRegisterReqDto reqDto) {
return galaxyUserService.userRegister(reqDto);
}
}
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.dto.*;
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.constant.GalaxyConstant;
import com.liquidnet.service.galaxy.dto.GalaxyUserRegisterReqDto;
import com.liquidnet.service.galaxy.dto.GalaxyUserRegisterRespDto;
import com.liquidnet.service.galaxy.service.IGalaxyUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.UnsupportedEncodingException;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: GalaxyUserServiceImpl
* @Package com.liquidnet.service.galaxy.service.impl
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2022/3/11 12:09
*/
@Slf4j
@Service
public class GalaxyUserServiceImpl implements IGalaxyUserService {
@Autowired
private ZxlnftSdkUtil zxlnftSdkUtil;
@Autowired
private ZxlWalletSdkUtil zxlWalletSdkUtil;
@Autowired
private ZxlnftBiz zxlnftBiz;
@Autowired
private ZxlnftConfig zxlnftConfig;
@Override
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 = "stuff name goat health siren dumb gorilla antique board tenant buffalo present"; //安家宾
// String mnemonic = "economy cost balance weapon flight also nut biology very sun slight about"; //周焕
Long index = 0L;
String userIdentification = null;
String address = null;
String userPubKey = null;
String userPriKey = null;
// 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.toJson());
return ResponseDto.failure(nft014Resp.getCode(),nft014Resp.getMessage());
}
if(StringUtil.isNotNull(nft016Resp)&&nft016Resp.isSuccess()){
log.info("返回结果:{}",nft016Resp.toJson());
//构造返回参数
respDto.setUserId(userId);
respDto.setBlockChainType(GalaxyConstant.RouterEnum.ZXINCHAIN.getCode());
respDto.setBlockChainAddress(nft016Resp.getData().getList().get(0).getAddress());
}else{
return ResponseDto.failure(nft016Resp.getMessage());
}
}
return ResponseDto.success(respDto);
}
}
...@@ -135,31 +135,31 @@ public class TestZxlnftService { ...@@ -135,31 +135,31 @@ public class TestZxlnftService {
// //
if(StringUtil.isNotEmpty(userPubKey)&&StringUtil.isNotEmpty(userPriKey)&&StringUtil.isNotEmpty(userIdentification)){ if(StringUtil.isNotEmpty(userPubKey)&&StringUtil.isNotEmpty(userPriKey)&&StringUtil.isNotEmpty(userIdentification)){
//1.2.2调用授信平台NFT地址绑定接口 //1.2.2调用授信平台NFT地址绑定接口
Nft014IdentityBindSubmitByTrustedReqDto nft004ReqDto = Nft014IdentityBindSubmitByTrustedReqDto.getNew(); Nft014IdentityBindSubmitByTrustedReqDto nft014ReqDto = Nft014IdentityBindSubmitByTrustedReqDto.getNew();
try { try {
nft004ReqDto.setUserPubKey(BASE64Util.decode(userPubKey)); nft014ReqDto.setUserPubKey(BASE64Util.decode(userPubKey));
nft004ReqDto.setUserIdentification(nft003Resp.getData().getUserIdentification()); nft014ReqDto.setUserIdentification(nft003Resp.getData().getUserIdentification());
String signature = zxlnftBiz.createSign(BASE64Util.decode(userPriKey),nft004ReqDto.getUserIdentification()); String signature = zxlnftBiz.createSign(BASE64Util.decode(userPriKey),nft014ReqDto.getUserIdentification());
nft004ReqDto.setUserSignData(signature); nft014ReqDto.setUserSignData(signature);
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
log.error("公私钥解密错误!"); log.error("公私钥解密错误!");
} }
ZxlnftResponseDto<Nft014IdentityBindSubmitByTrustedRespDto> nft004Resp = zxlnftSdkUtil.nft014IdentityBindSubmitByTrusted(nft004ReqDto); ZxlnftResponseDto<Nft014IdentityBindSubmitByTrustedRespDto> nft014Resp = zxlnftSdkUtil.nft014IdentityBindSubmitByTrusted(nft014ReqDto);
if(nft004Resp.isSuccess()){ if(nft014Resp.isSuccess()){
//1.2.3调用绑定状态批量查询 //1.2.3调用绑定状态批量查询
Nft016IdentityBindQueryReqDto nft016ReqDto = Nft016IdentityBindQueryReqDto.getNew(); Nft016IdentityBindQueryReqDto nft016ReqDto = Nft016IdentityBindQueryReqDto.getNew();
nft016ReqDto.setAddressList(nft004Resp.getData().getAddress()); nft016ReqDto.setAddressList(nft014Resp.getData().getAddress());
ZxlnftResponseDto<Nft016IdentityBindQueryRespDto> nft016Resp = zxlnftSdkUtil.nft016IdentityBindQuery(nft016ReqDto); ZxlnftResponseDto<Nft016IdentityBindQueryRespDto> nft016Resp = zxlnftSdkUtil.nft016IdentityBindQuery(nft016ReqDto);
if(nft016Resp.isSuccess()){ if(nft016Resp.isSuccess()){
log.info("返回结果:{}",nft016Resp.toJson()); log.info("返回结果:{}",nft016Resp.toJson());
} }
}else{ }else{
log.info("返回结果:{}",nft004Resp.toJson()); log.info("返回结果:{}",nft014Resp.toJson());
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment