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

Commit 62fefc75 authored by anjiabin's avatar anjiabin

更新购买逻辑修复购买失败记录

parent 0b831df9
...@@ -75,10 +75,11 @@ public class ZxinTradeCommonBiz { ...@@ -75,10 +75,11 @@ public class ZxinTradeCommonBiz {
//获取订单信息 //获取订单信息
GalaxyNftOrderBo nftOrderBo = dataUtils.getNftOrderBo(reqDto.getRouterType(),reqDto.getNftOrderPayId()); GalaxyNftOrderBo nftOrderBo = dataUtils.getNftOrderBo(reqDto.getRouterType(),reqDto.getNftOrderPayId());
if(StringUtil.isNotNull(nftOrderBo)){ //初始化订单数据
/** if(nftOrderBo==null){
* 如果已经发行购买成功 nftOrderBo = galaxyBeanTransferBiz.buildNftOrderBo(reqDto.getNftOrderPayId(),userInfoBo,seriesNftInfoBo);
*/ dataUtils.setNftOrderBo(reqDto.getRouterType(),reqDto.getNftOrderPayId(),nftOrderBo);
}else if(StringUtil.isNotNull(nftOrderBo)){
if(nftOrderBo.getNftPublishStatus().equalsIgnoreCase(GalaxyEnum.TaskStatusEnum.TASK_SUCCESS.getCode()) if(nftOrderBo.getNftPublishStatus().equalsIgnoreCase(GalaxyEnum.TaskStatusEnum.TASK_SUCCESS.getCode())
&&nftOrderBo.getNftBuyStatus().equalsIgnoreCase(GalaxyEnum.TaskStatusEnum.TASK_SUCCESS.getCode())){ &&nftOrderBo.getNftBuyStatus().equalsIgnoreCase(GalaxyEnum.TaskStatusEnum.TASK_SUCCESS.getCode())){
return ResponseDto.failure(GalaxyErrorEnum.PUBLISH_FAIL_ALREADY_EXIST.getCode(), GalaxyErrorEnum.PUBLISH_FAIL_ALREADY_EXIST.getMessage()); return ResponseDto.failure(GalaxyErrorEnum.PUBLISH_FAIL_ALREADY_EXIST.getCode(), GalaxyErrorEnum.PUBLISH_FAIL_ALREADY_EXIST.getMessage());
...@@ -146,12 +147,6 @@ public class ZxinTradeCommonBiz { ...@@ -146,12 +147,6 @@ public class ZxinTradeCommonBiz {
} }
seriesBeginIndex = nftOrderBindBo.getNftIdIndex(); seriesBeginIndex = nftOrderBindBo.getNftIdIndex();
//初始化订单数据
if(nftOrderBo==null){
nftOrderBo = galaxyBeanTransferBiz.buildNftOrderBo(reqDto.getNftOrderPayId(),userInfoBo,seriesNftInfoBo);
dataUtils.setNftOrderBo(reqDto.getRouterType(),reqDto.getNftOrderPayId(),nftOrderBo);
}
// //查询系列信息(暂时不通过系列查询获取发行序列号) // //查询系列信息(暂时不通过系列查询获取发行序列号)
// Nft032SeriesReqDto nft032ReqDto = Nft032SeriesReqDto.getNew(); // Nft032SeriesReqDto nft032ReqDto = Nft032SeriesReqDto.getNew();
// nft032ReqDto.setSeriesId(seriesId); // nft032ReqDto.setSeriesId(seriesId);
...@@ -165,6 +160,14 @@ public class ZxinTradeCommonBiz { ...@@ -165,6 +160,14 @@ public class ZxinTradeCommonBiz {
// seriesBeginIndex = Integer.parseInt(String.valueOf(crtCount.longValue() + 1)); // seriesBeginIndex = Integer.parseInt(String.valueOf(crtCount.longValue() + 1));
// } // }
/**
* 如果已经发行购买成功
*/
if(nftOrderBo.getNftPublishStatus().equalsIgnoreCase(GalaxyEnum.TaskStatusEnum.PROCESSING.getCode())){
if(StringUtil.isNotEmpty(nftOrderBo.getNftPublishTaskId())){
publishTaskId = nftOrderBo.getNftPublishTaskId();
}
}else if(nftOrderBo.getNftPublishStatus().equalsIgnoreCase(GalaxyEnum.TaskStatusEnum.INIT.getCode())){
//3.1.2调用NFT发行接口 //3.1.2调用NFT发行接口
/** /**
* 发行无限制系列 * 发行无限制系列
...@@ -186,12 +189,14 @@ public class ZxinTradeCommonBiz { ...@@ -186,12 +189,14 @@ public class ZxinTradeCommonBiz {
nft034ReqDto.setMetaData(seriesNftInfoBo.getNftHash()); nft034ReqDto.setMetaData(seriesNftInfoBo.getNftHash());
ZxlnftResponseDto<Nft034PublishRespDto> nft034RespDto = zxlnftSdkUtil.nft034Publish(nft034ReqDto); ZxlnftResponseDto<Nft034PublishRespDto> nft034RespDto = zxlnftSdkUtil.nft034Publish(nft034ReqDto);
if (nft034RespDto.isSuccess()){
if (nft034RespDto.isSuccess()) {
try{
publishTaskId = nft034RespDto.getData().getTaskId(); publishTaskId = nft034RespDto.getData().getTaskId();
nftOrderBo.setNftPublishTaskId(publishTaskId); nftOrderBo.setNftPublishTaskId(publishTaskId);
}
}
if (StringUtil.isNotEmpty(publishTaskId)){
try{
//3.1.4查询 NFT发行结果 //3.1.4查询 NFT发行结果
Nft035PublishResultReqDto nft035ReqDto = Nft035PublishResultReqDto.getNew(); Nft035PublishResultReqDto nft035ReqDto = Nft035PublishResultReqDto.getNew();
nft035ReqDto.setTaskId(publishTaskId); nft035ReqDto.setTaskId(publishTaskId);
...@@ -226,6 +231,7 @@ public class ZxinTradeCommonBiz { ...@@ -226,6 +231,7 @@ public class ZxinTradeCommonBiz {
//赋值返回参数 //赋值返回参数
nftId = nftIdBegin; nftId = nftIdBegin;
nftOrderBo.setNftId(nftId);
log.info("发行NFT后返回给前端nftID:{}", nftIdBegin); log.info("发行NFT后返回给前端nftID:{}", nftIdBegin);
log.info("总共执行了{}次查询 总耗时:{} MS", count, (System.currentTimeMillis() - timeStart)); log.info("总共执行了{}次查询 总耗时:{} MS", count, (System.currentTimeMillis() - timeStart));
}catch (GalaxyNftPublishException e){ }catch (GalaxyNftPublishException e){
...@@ -237,7 +243,7 @@ public class ZxinTradeCommonBiz { ...@@ -237,7 +243,7 @@ public class ZxinTradeCommonBiz {
} }
}else{ }else{
//发行失败 //发行失败
throw new GalaxyNftPublishException(GalaxyErrorEnum.NFT_PUBLISH_ERROR.getCode(),"nft034Publish_resp:"+nft034RespDto.getMessage()); throw new GalaxyNftPublishException(GalaxyErrorEnum.NFT_PUBLISH_ERROR.getCode(),"nft034Publish_resp:taskId : "+publishTaskId);
} }
}catch (GalaxyNftPublishException e) { }catch (GalaxyNftPublishException e) {
failDesc = e.getMessage(); failDesc = e.getMessage();
...@@ -250,9 +256,18 @@ public class ZxinTradeCommonBiz { ...@@ -250,9 +256,18 @@ public class ZxinTradeCommonBiz {
if(StringUtil.isNotEmpty(failDesc)){ if(StringUtil.isNotEmpty(failDesc)){
//记录发行异常信息 //记录发行异常信息
try{ try{
//发行异常或者失败记录任务id
if(StringUtil.isNotNull(nftOrderBo)&&StringUtil.isNotEmpty(nftOrderBo.getNftPublishTaskId())){
nftOrderBo.setNftPublishStatus(GalaxyEnum.TaskStatusEnum.PROCESSING.getCode());
nftOrderBo.setUpdatedAt(LocalDateTime.now());
//更新nft发行状态为处理中
dataUtils.updateNftOrderPublishInfo(reqDto.getRouterType(),reqDto.getNftOrderPayId(),nftOrderBo);
}else{
//记录错误信息
GalaxyNftOrderFailLogVo nftOrderFailLogVo = galaxyBeanTransferBiz.buildNftOrderFailLogVo(GalaxyEnum.TradeTypeEnum.TRADE_PUBLISH,reqDto,GalaxyEnum.OrderDealWithStatusEnum.DATA_INIT,failDesc,null GalaxyNftOrderFailLogVo nftOrderFailLogVo = galaxyBeanTransferBiz.buildNftOrderFailLogVo(GalaxyEnum.TradeTypeEnum.TRADE_PUBLISH,reqDto,GalaxyEnum.OrderDealWithStatusEnum.DATA_INIT,failDesc,null
,userInfoBo,seriesNftInfoBo,nftOrderBo); ,userInfoBo,seriesNftInfoBo,nftOrderBo);
dataUtils.setNftOrderFailLogVo(reqDto.getRouterType(),nftOrderFailLogVo); dataUtils.setNftOrderFailLogVo(reqDto.getRouterType(),nftOrderFailLogVo);
}
}catch(Exception e){ }catch(Exception e){
log.error(reqDto.getNftOrderPayId()+"发行setNftOrderFailLogVo记录异常:"+e.getMessage(),e); log.error(reqDto.getNftOrderPayId()+"发行setNftOrderFailLogVo记录异常:"+e.getMessage(),e);
} }
...@@ -260,8 +275,7 @@ public class ZxinTradeCommonBiz { ...@@ -260,8 +275,7 @@ public class ZxinTradeCommonBiz {
} }
//更新订单缓存数据状态 //更新订单缓存数据状态
if(StringUtil.isNotEmpty(nftId)){ if(StringUtil.isNotEmpty(nftOrderBo.getNftId())){
nftOrderBo.setNftId(nftId);
if(StringUtil.isNotNull(nftPublishChainTimestamp)){ if(StringUtil.isNotNull(nftPublishChainTimestamp)){
//设置时间 //设置时间
String nftPublishChainTimestampStr = DateUtil.format(new Date(nftPublishChainTimestamp*1000),DateUtil.Formatter.yyyyMMddHHmmss); String nftPublishChainTimestampStr = DateUtil.format(new Date(nftPublishChainTimestamp*1000),DateUtil.Formatter.yyyyMMddHHmmss);
...@@ -279,7 +293,7 @@ public class ZxinTradeCommonBiz { ...@@ -279,7 +293,7 @@ public class ZxinTradeCommonBiz {
} }
//第二步:执行购买逻辑 //第二步:执行购买逻辑
if(StringUtil.isNotEmpty(nftId)){ if(StringUtil.isNotEmpty(nftOrderBo.getNftId())){
GalaxyNftPublishAndBuyRespDto nftPublishAndBuyRespDto = this.executeBuyBusiness(reqDto,userInfoBo,seriesNftInfoBo,nftOrderBo); GalaxyNftPublishAndBuyRespDto nftPublishAndBuyRespDto = this.executeBuyBusiness(reqDto,userInfoBo,seriesNftInfoBo,nftOrderBo);
if(StringUtil.isNotNull(nftPublishAndBuyRespDto)&&StringUtil.isNotEmpty(nftPublishAndBuyRespDto.getNftId())){ if(StringUtil.isNotNull(nftPublishAndBuyRespDto)&&StringUtil.isNotEmpty(nftPublishAndBuyRespDto.getNftId())){
return ResponseDto.success(nftPublishAndBuyRespDto); return ResponseDto.success(nftPublishAndBuyRespDto);
......
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