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

Commit f4b6e45e authored by anjiabin's avatar anjiabin

实现xuper发行购买功能

parent ea0af45b
package com.liquidnet.common.third.xuper.dto;
import lombok.Data;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
......@@ -9,7 +11,15 @@ package com.liquidnet.common.third.xuper.dto;
* @Copyright: LightNet @ Copyright (c) 2022
* @date 2022/4/18 15:10
*/
@Data
public class Xuper011ListSdsByAddrReqDto {
//要拉取的区块链账户地址
private String addr = "";
//要拉取页数,第一页为1
private int page = 1;
//每页拉取数量,默认20,最大50(可选)
private int limit = 50;
private static final Xuper011ListSdsByAddrReqDto obj = new Xuper011ListSdsByAddrReqDto();
public static Xuper011ListSdsByAddrReqDto getNew() {
try {
......
package com.liquidnet.common.third.xuper.dto;
import lombok.Data;
import java.util.ArrayList;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
......@@ -9,7 +13,52 @@ package com.liquidnet.common.third.xuper.dto;
* @Copyright: LightNet @ Copyright (c) 2022
* @date 2022/4/18 15:10
*/
@Data
public class Xuper011ListSdsByAddrRespDto {
public long requestId;
public int errNo;
public String errMsg;
public ArrayList<ShardMeta> list;
public int totalCnt;
@Data
public static class ShardMeta {
public long assetId;
public long shardId;
public String ownerAddr;
public long uid;
public long price;
public int status;
public String txId;
public ShardAssetInfo assetInfo;
public long ctime;
}
@Data
public static class ShardAssetInfo {
public String title;
public int assetCate;
public Thumb[] thumb;
public String shortDesc;
public String createAddr;
public long groupId;
}
@Data
public static class Thumb {
private Urls urls;
private String width;
private String height;
}
@Data
public static class Urls {
private String icon;
private String url1;
private String url2;
private String url3;
}
private static final Xuper011ListSdsByAddrRespDto obj = new Xuper011ListSdsByAddrRespDto();
public static Xuper011ListSdsByAddrRespDto getNew() {
try {
......
......@@ -436,12 +436,18 @@ public class XuperSdkUtil {
Xuper011ListSdsByAddrRespDto respDto = Xuper011ListSdsByAddrRespDto.getNew();
try{
//要拉取的区块链账户地址
String addr = "";
String addr = reqDto.getAddr();
//要拉取页数,第一页为1
int page = 1;
int page = reqDto.getPage();
//每页拉取数量,默认20,最大50(可选)
int limit = 20;
int limit = reqDto.getLimit();
BaseDef.Resp<BaseDef.ListPageResp> listPageResp = getAsset().listShardsAddr(addr, page, limit);
log.debug("xuper011ListSdsByAddr resp : "+ JsonUtils.toJson(listPageResp));
BaseDef.RequestRes requestRes = listPageResp.res;
if(requestRes.httpCode==200){
log.debug("xuper011ListSdsByAddr apiResp : "+ JsonUtils.toJson(listPageResp.apiResp));
respDto = JsonUtils.fromJson(JsonUtils.toJson(listPageResp.apiResp),new TypeReference<Xuper011ListSdsByAddrRespDto>(){});
}
}catch(Exception e){
log.error(e.getMessage(),e);
throw new XupterException(XuperErrorEnum.SERVER_INNER_ERROR.getCode(),XuperErrorEnum.SERVER_INNER_ERROR.getMsg());
......
......@@ -342,13 +342,13 @@ public class TestXuperSdkUtil {
Xuper006ListAssetByAddrRespDto respDto = null;
try {
//资产状态。0:全部 1:初试 3:发行中 4:发行成功。默认 0(可选)
int status = 0;
int status = 4;
//要拉取的区块链账户地址
String addr = xuperSdkUtil.getAccount(creatorMnemonic).getAddress();
//要拉取页数,第一页为1
int page = 1;
//每页拉取数量,默认20,最大50(可选)
int limit = 20;
int limit = 50;
reqDto.setStatus(status);
reqDto.setAddr(addr);
reqDto.setPage(page);
......@@ -470,24 +470,27 @@ public class TestXuperSdkUtil {
@Test
public void testXuper011ListSdsByAddr(){
Xuper004PublishAssetReqDto reqDto = Xuper004PublishAssetReqDto.getNew();
//要查询的区块链账户地址
String addr = xuperConfig.getNftPlatformAddress();
//xuper-userid-002
addr = "acsuf4Mrz9r38KERQGabsoDsa4MPEcF85";
Xuper011ListSdsByAddrReqDto reqDto = Xuper011ListSdsByAddrReqDto.getNew();
// 定义返回结果对象
Xuper004PublishAssetRespDto respDto = null;
long assetId = 171095615845019437l;
// long assetId = 1532351545249738541l;
Xuper011ListSdsByAddrRespDto respDto = null;
try {
reqDto.setMnemonic(creatorMnemonic);
reqDto.setAssetId(assetId);
XuperResponseDto<Xuper004PublishAssetRespDto> xuperResponseDto = xuperSdkUtil.xuper004PublishAsset(reqDto);
reqDto.setAddr(addr);
reqDto.setPage(1);
reqDto.setLimit(50);
XuperResponseDto<Xuper011ListSdsByAddrRespDto> xuperResponseDto = xuperSdkUtil.xuper011ListSdsByAddr(reqDto);
if(xuperResponseDto.isSuccess()){
respDto = xuperResponseDto.getParseData(Xuper004PublishAssetRespDto.class);
respDto = xuperResponseDto.getParseData(Xuper011ListSdsByAddrRespDto.class);
}
}catch (XupterException e) {
log.error("biz error msg "+e.getMessage(),e);
}catch (Exception e) {
log.error("sys error msg "+e.getMessage(),e);
}
log.info("testXuper004PublishAsset resp : "+ JsonUtils.toJson(respDto));
log.info("testXuper011ListSdsByAddr resp : "+ JsonUtils.toJson(respDto));
}
@Test
......@@ -509,29 +512,29 @@ public class TestXuperSdkUtil {
}catch (Exception e) {
log.error("sys error msg "+e.getMessage(),e);
}
log.info("testXuper004PublishAsset resp : "+ JsonUtils.toJson(respDto));
log.info("testXuper012ListSdsByAst resp : "+ JsonUtils.toJson(respDto));
}
@Test
public void testXuper013History(){
Xuper004PublishAssetReqDto reqDto = Xuper004PublishAssetReqDto.getNew();
Xuper013HistoryReqDto reqDto = Xuper013HistoryReqDto.getNew();
// 定义返回结果对象
Xuper004PublishAssetRespDto respDto = null;
long assetId = 171095615845019437l;
Xuper013HistoryRespDto respDto = null;
long assetId = 139521326019882797l;
// long assetId = 1532351545249738541l;
try {
reqDto.setMnemonic(creatorMnemonic);
reqDto.setAssetId(assetId);
XuperResponseDto<Xuper004PublishAssetRespDto> xuperResponseDto = xuperSdkUtil.xuper004PublishAsset(reqDto);
// reqDto.setMnemonic(creatorMnemonic);
// reqDto.setAssetId(assetId);
XuperResponseDto<Xuper013HistoryRespDto> xuperResponseDto = xuperSdkUtil.xuper013History(reqDto);
if(xuperResponseDto.isSuccess()){
respDto = xuperResponseDto.getParseData(Xuper004PublishAssetRespDto.class);
respDto = xuperResponseDto.getParseData(Xuper013HistoryRespDto.class);
}
}catch (XupterException e) {
log.error("biz error msg "+e.getMessage(),e);
}catch (Exception e) {
log.error("sys error msg "+e.getMessage(),e);
}
log.info("testXuper004PublishAsset resp : "+ JsonUtils.toJson(respDto));
log.info("testXuper013History resp : "+ JsonUtils.toJson(respDto));
}
@Test
......
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