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

Commit b6a90a1e authored by zhanggb's avatar zhanggb

Merge remote-tracking branch 'origin/jxl_0512_nft_acc' into pre

# Conflicts:
#	liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/util/GoblinRedisUtils.java
parents e0ebe06e ebbdb186
...@@ -15,4 +15,6 @@ public interface IAdamRealNameService { ...@@ -15,4 +15,6 @@ public interface IAdamRealNameService {
void add(AdamRealName realName); void add(AdamRealName realName);
void upsert(AdamRealName realName, boolean updateFlg); void upsert(AdamRealName realName, boolean updateFlg);
void update(AdamRealName realName, String mobile);
} }
...@@ -70,4 +70,6 @@ public interface IAdamUserService { ...@@ -70,4 +70,6 @@ public interface IAdamUserService {
AdamRealInfoVo identity(String uid, String name, String idCard, String mobile); AdamRealInfoVo identity(String uid, String name, String idCard, String mobile);
AdamRealInfoVo identityForUpsert(String uid, String name, String idCard, String mobile, boolean updateFlg); AdamRealInfoVo identityForUpsert(String uid, String name, String idCard, String mobile, boolean updateFlg);
AdamRealInfoVo identityForUpdate(String uid, String mobile, int idType, int node, String idCard, String idName);
} }
...@@ -11,6 +11,7 @@ package com.liquidnet.service.galaxy.constant; ...@@ -11,6 +11,7 @@ package com.liquidnet.service.galaxy.constant;
*/ */
public class GalaxyConstant { public class GalaxyConstant {
//可删除key //可删除key
public static final String REDIS_KEY_GALAXY_USER_ID_CARD="galaxy:user_id_card:";
public static final String REDIS_KEY_GALAXY_USER="galaxy:user:"; public static final String REDIS_KEY_GALAXY_USER="galaxy:user:";
public static final String REDIS_KEY_GALAXY_SERIES="galaxy:series:"; public static final String REDIS_KEY_GALAXY_SERIES="galaxy:series:";
public static final String REDIS_KEY_GALAXY_SERIES_NFT_UPLOAD="galaxy:series:nft:upload:"; public static final String REDIS_KEY_GALAXY_SERIES_NFT_UPLOAD="galaxy:series:nft:upload:";
...@@ -21,7 +22,8 @@ public class GalaxyConstant { ...@@ -21,7 +22,8 @@ public class GalaxyConstant {
//以下禁止删除 //以下禁止删除
public static final String REDIS_KEY_GALAXY_PUBLISH_NFT="galaxy:publish:nft:"; //nft索引递增记录 public static final String REDIS_KEY_GALAXY_PUBLISH_NFT="galaxy:publish:nft:"; //nft索引递增记录
public static final String SERIES_NAME_PREFIX="NOW_ZXL_";// 系列存储目录名称和系列声明
public static final String ADAM_USER_SYNC_URL="/adam/rsc/syn/certmeta";// adam用户开通数字账户信息同步url
public static final String SERIES_NAME_PREFIX="NOW_ZXL_";// 系列存储目录名称和系列声明
} }
...@@ -32,7 +32,8 @@ public enum GalaxyErrorEnum { ...@@ -32,7 +32,8 @@ public enum GalaxyErrorEnum {
NFT_PUBLISH_AND_BUY_QUERY_FAIL("NFT0010019","NFT发行和购买结果查询失败!"), NFT_PUBLISH_AND_BUY_QUERY_FAIL("NFT0010019","NFT发行和购买结果查询失败!"),
NFT_QUERY_FAIL_ORDER_NOT_EXIST("NFT0010020","NFT订单不存在!"), NFT_QUERY_FAIL_ORDER_NOT_EXIST("NFT0010020","NFT订单不存在!"),
NFT_QUERY_FAIL_NFT_NOT_EXIST("NFT0010021","NFT信息查询不存在!"), NFT_QUERY_FAIL_NFT_NOT_EXIST("NFT0010021","NFT信息查询不存在!"),
NFT_QUERY_FAIL_SERIES_NOT_EXIST("NFT0010022","系列信息查询不存在!"); NFT_QUERY_FAIL_SERIES_NOT_EXIST("NFT0010022","系列信息查询不存在!"),
NFT_USER_HAS_OPEN_ACCOUNT("NFT0010023","用户已经开通过数字账户!");
private String code; private String code;
......
package com.liquidnet.service.galaxy.exception;
import lombok.Data;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: 自定义异常类
* @class: GalaxyNftUserException
* @Package com.liquidnet.service.galaxy.exception
* @Copyright: LightNet @ Copyright (c) 2022
* @date 2022/5/12 13:44
*/
@Data
public class GalaxyNftUserException extends RuntimeException{
private static final long serialVersionUID = -3916918823313768482L;
private String code;
private String message;
public GalaxyNftUserException(String code, String message) {
super(message);
this.code = code;
this.message = message;
}
public GalaxyNftUserException(String code, String message, Throwable t) {
super(message, t);
this.code = code;
this.message = message;
}
}
...@@ -133,6 +133,12 @@ public class GoblinRedisConst { ...@@ -133,6 +133,12 @@ public class GoblinRedisConst {
public static final String REDIS_GOBLIN_NFT_GOODS_LIST = PREFIX.concat("nft:goodsList");// nft商品列表 public static final String REDIS_GOBLIN_NFT_GOODS_LIST = PREFIX.concat("nft:goodsList");// nft商品列表
public static final String REDIS_GOBLIN_NFT_GOODS_LIST_INFO = PREFIX.concat("nft:goodsList:info:");// nft商品列表单藏品详情 skuId public static final String REDIS_GOBLIN_NFT_GOODS_LIST_INFO = PREFIX.concat("nft:goodsList:info:");// nft商品列表单藏品详情 skuId
public static final String REDIS_GOBLIN_NFT_NUM_ACCOUNT = PREFIX.concat("nft:account:");// nft用户数字账户是否开通 userId public static final String REDIS_GOBLIN_NFT_NUM_ACCOUNT = PREFIX.concat("nft:account:");// nft用户数字账户是否开通 userId
public static final String REDIS_GOBLIN_NFT_NUM_ACCOUNT_INFO = PREFIX.concat("nft:account:info:");// nft用户数字账户开通信息 userId
/**
* {goblin:nft:certmeta:{idType+idNo},{idname,mobile}}
*/
public static final String REDIS_GOBLIN_NFT_CERTMETA = PREFIX.concat("nft:certmeta:");
public static final String REDIS_GOBLIN_NFT_CERTMETA_JUNK = PREFIX.concat("nft:certmeta_junk:");
......
package com.liquidnet.service.goblin.constant;
public class NftAccStatusEnum {
/**
* 数字账户开通状态
*/
public enum StatusAcc {
ING("1000", "开通中"),
SUCCESS("2000", "开通成功"),
FAILURE1("3000", "实名失败"),
FAILURE2("3001", "开通失败可重试"),
FAILURE3("3002", "该身份证已开通数字账号 不可重复操作"),
;
private final String code;
private final String msg;
StatusAcc(String code, String msg) {
this.code = code;
this.msg = msg;
}
public String getCode() {
return code;
}
public String getMsg() {
return msg;
}
}
}
package com.liquidnet.service.goblin.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.liquidnet.commons.lang.util.DateUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
@ApiModel(value = "GoblinUserNftAccInfoVo", description = "数字账户开通信息")
@Data
public class GoblinUserNftAccInfoVo implements Serializable, Cloneable {
private static final long serialVersionUID = 9036417838200526658L;
@ApiModelProperty(position = 11, value = "状态码 1000开通中 2000开通成功 3000实名失败 3001开通失败可重试 3002该身份证已开通数字账号 不可重复操作")
private String code;
@ApiModelProperty(position = 12, value = "提示信息")
private String msg;
@ApiModelProperty(position = 13, value = "最后操作的时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DateUtil.DATE_FULL_STR)
private LocalDateTime time;
private static final GoblinUserNftAccInfoVo obj = new GoblinUserNftAccInfoVo();
public static GoblinUserNftAccInfoVo getNew() {
try {
return (GoblinUserNftAccInfoVo) obj.clone();
} catch (CloneNotSupportedException e) {
return new GoblinUserNftAccInfoVo();
}
}
}
package com.liquidnet.service.goblin.service; package com.liquidnet.service.goblin.service;
import com.liquidnet.service.base.ResponseDto; import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.dto.GoblinUserNftAccInfoVo;
public interface IGoblinNftUserService { public interface IGoblinNftUserService {
...@@ -12,7 +13,7 @@ public interface IGoblinNftUserService { ...@@ -12,7 +13,7 @@ public interface IGoblinNftUserService {
* @param name 证件名 * @param name 证件名
* @param idCard 证件号 * @param idCard 证件号
* @param mobile 手机号 * @param mobile 手机号
* @return Integer[1-成功] * @return ResponseDto<GoblinUserNftAccInfoVo>
*/ */
ResponseDto<Integer> openNftAccount(String uid, String bizCode, String name, String idCard, String mobile); ResponseDto<GoblinUserNftAccInfoVo> openNftAccount(String uid, String bizCode, String name, String idCard, String mobile);
} }
...@@ -328,8 +328,8 @@ public class MQConst { ...@@ -328,8 +328,8 @@ public class MQConst {
SQL_NFT_ORDER_INFO("galaxy:stream:rk.sql.nftOrderInfo", "group.sql.nftOrderInfo", "订单信息"), SQL_NFT_ORDER_INFO("galaxy:stream:rk.sql.nftOrderInfo", "group.sql.nftOrderInfo", "订单信息"),
SQL_NFT_TRADE_INFO("galaxy:stream:rk.sql.nftTradeInfo", "group.sql.nftTradeInfo", "交易信息"), SQL_NFT_TRADE_INFO("galaxy:stream:rk.sql.nftTradeInfo", "group.sql.nftTradeInfo", "交易信息"),
SQL_NFT_ORDER_FAIL_LOG("galaxy:stream:rk.sql.nftOrderFailLog", "group.sql.nftOrderFailLog", "交易发行购买失败记录"), SQL_NFT_ORDER_FAIL_LOG("galaxy:stream:rk.sql.nftOrderFailLog", "group.sql.nftOrderFailLog", "交易发行购买失败记录"),
JSON_NFT_PUBLISH_AND_BUY("galaxy:stream:rk.json.nftPublishAndBuy", "group.sql.nftPublishAndBuy", "NFT发行和购买"), JSON_NFT_PUBLISH_AND_BUY("galaxy:stream:rk.json.nftPublishAndBuy", "group.json.nftPublishAndBuy", "NFT发行和购买"),
; JSON_NFT_USER_REGISTER("galaxy:stream:rk.json.userRegister", "group.json.userRegister", "NFT用户注册");
private final String key; private final String key;
private final String group; private final String group;
private final String desc; private final String desc;
......
...@@ -2,6 +2,8 @@ package com.liquidnet.service.adam.controller; ...@@ -2,6 +2,8 @@ package com.liquidnet.service.adam.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport; import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.liquidnet.commons.lang.util.DESUtils;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.adam.dto.rsc.AdamChimeUinfoDto; import com.liquidnet.service.adam.dto.rsc.AdamChimeUinfoDto;
import com.liquidnet.service.adam.dto.rsc.AdamChimeUinfoReq; import com.liquidnet.service.adam.dto.rsc.AdamChimeUinfoReq;
import com.liquidnet.service.adam.dto.vo.*; import com.liquidnet.service.adam.dto.vo.*;
...@@ -172,4 +174,31 @@ public class AdamRscController { ...@@ -172,4 +174,31 @@ public class AdamRscController {
} }
return ResponseDto.success(true); return ResponseDto.success(true);
} }
@ApiOperationSupport(order = 50)
@ApiOperation(value = "@API:NFT三要素", notes = "用于NFT认证成功的用户同步更新用户账号实名信息")
@PostMapping(value = {"syn/certmeta"})
public void syncUpdateReal(@NotBlank @RequestBody String certmeta) {
try {
String certmetaPlain = DESUtils.DES().decrypt(certmeta);// {uid},{mobile},{证件类型}{证件号},{姓名}
log.info("NFT三要素同步实名信息:加解密信息[{} => {}]", certmeta, certmetaPlain);
String[] certmetaPlainArr = certmetaPlain.split(",");
String uid = certmetaPlainArr[0], mobile = certmetaPlainArr[1], idTypeCardNo = certmetaPlainArr[2];
String uidByMobile = adamRdmService.getUidByMobile(mobile);
if (org.apache.commons.lang3.StringUtils.isEmpty(uidByMobile) || !org.apache.commons.lang3.StringUtils.equals(uidByMobile, uid)) {
log.warn("NFT三要素同步实名信息:手机号未注册/不匹配[{}]", certmetaPlain);
return;
}
AdamRealInfoVo realInfoVoByUidPlain = adamRdmService.getRealInfoVoByUidPlain(uid);
if (null == realInfoVoByUidPlain || realInfoVoByUidPlain.getNode() == 2) {
int idType = Integer.parseInt(idTypeCardNo.substring(0, 1));
adamUserService.identityForUpdate(uid, mobile, idType, 3, idTypeCardNo.substring(1), certmetaPlainArr[3]);
} else {
log.warn("NFT三要素同步实名信息:三要素信息已存在[certmetaPlain={},realInfoVoByUidPlain={}]", certmetaPlain, JsonUtils.toJson(realInfoVoByUidPlain));
}
} catch (Exception e) {
log.warn("NFT三要素同步实名信息:参数解析失败[certmeta={}]", certmeta, e);
}
}
} }
...@@ -119,4 +119,43 @@ public class AdamRealNameServiceImpl implements IAdamRealNameService { ...@@ -119,4 +119,43 @@ public class AdamRealNameServiceImpl implements IAdamRealNameService {
); );
log.debug("#MQ耗时:{}ms", System.currentTimeMillis() - s); log.debug("#MQ耗时:{}ms", System.currentTimeMillis() - s);
} }
@Override
public void update(AdamRealName realName, String mobile) {
List<Object> paramList = Arrays.asList(
realName.getRealNameId(),
realName.getUid(),
realName.getType(),
realName.getNode(),
realName.getName(),
realName.getIdCard(),
realName.getState(),
realName.getCreatedAt()
);
LinkedList<String> toMqSqls = CollectionUtil.linkedListString();
LinkedList<Object[]> initUserRealInfoObjs = CollectionUtil.linkedListObjectArr(),
delUserRealInfoObjs = CollectionUtil.linkedListObjectArr(),
updateUserMobileLocateObjs = CollectionUtil.linkedListObjectArr();
toMqSqls.add(SqlMapping.get("adam_real_name.del_by_nft"));
delUserRealInfoObjs.add(new Object[]{realName.getCreatedAt(), realName.getUid()});
toMqSqls.add(SqlMapping.get("adam_real_name.add"));
initUserRealInfoObjs.add(paramList.toArray());
String[] mobileLocateArr = adamRdmService.getMobileLocateArr(mobile);
toMqSqls.add(SqlMapping.get("adam_user_mobile_locate.real_name"));
if (null != mobileLocateArr && mobileLocateArr.length > 0) {
updateUserMobileLocateObjs.add(new Object[]{
realName.getName(), realName.getIdCard(), realName.getCreatedAt(), realName.getUid()
});
}
long s = System.currentTimeMillis();
queueUtils.sendMsgByRedis(
MQConst.AdamQueue.SQL_UCENTER.getKey(),
SqlMapping.gets(toMqSqls, delUserRealInfoObjs, initUserRealInfoObjs, updateUserMobileLocateObjs)
);
log.debug("#MQ耗时:{}ms", System.currentTimeMillis() - s);
}
} }
...@@ -476,4 +476,25 @@ public class AdamUserServiceImpl implements IAdamUserService { ...@@ -476,4 +476,25 @@ public class AdamUserServiceImpl implements IAdamUserService {
log.debug("#RDS耗时:{}ms", System.currentTimeMillis() - s); log.debug("#RDS耗时:{}ms", System.currentTimeMillis() - s);
return vo; return vo;
} }
@Override
public AdamRealInfoVo identityForUpdate(String uid, String mobile, int idType, int node, String idCard, String idName) {
AdamRealName realName = new AdamRealName();
realName.setRealNameId(IDGenerator.nextSnowId() + "");
realName.setUid(uid);
realName.setType(idType);
realName.setNode(node);
realName.setName(idName);
realName.setIdCard(idCard);
realName.setState(1);
realName.setCreatedAt(LocalDateTime.now());
adamRealNameService.update(realName, mobile);
AdamRealInfoVo vo = AdamRealInfoVo.getNew().copy(realName);
long s = System.currentTimeMillis();
adamRdmService.setRealInfoVoByUid(uid, vo);
log.debug("#RDS耗时:{}ms", System.currentTimeMillis() - s);
return vo;
}
} }
...@@ -12,7 +12,8 @@ adam_user_info.update_qr_code=UPDATE adam_user_info SET qr_code=? WHERE uid=? ...@@ -12,7 +12,8 @@ adam_user_info.update_qr_code=UPDATE adam_user_info SET qr_code=? WHERE uid=?
# ---------------------------------------------------- # ----------------------------------------------------
adam_real_name.add=INSERT INTO adam_real_name (real_name_id,`uid`,`type`,`node`,`name`,id_card,`state`,created_at) VALUES (?,?,?,?,?,?,?,?) adam_real_name.add=INSERT INTO adam_real_name (real_name_id,`uid`,`type`,`node`,`name`,id_card,`state`,created_at) VALUES (?,?,?,?,?,?,?,?)
adam_real_name.del=UPDATE adam_real_name SET `state`=2, updated_at=?, comment='三要素认证覆盖' WHERE `uid`=? and `state`=1 and node=2 adam_real_name.del=UPDATE adam_real_name SET `state`=2, updated_at=?, comment='\u4E09\u8981\u7D20\u8BA4\u8BC1\u8986\u76D6' WHERE `uid`=? and `state`=1 and node=2
adam_real_name.del_by_nft=UPDATE adam_real_name SET `state`=2, updated_at=?, comment='\u4E09\u8981\u7D20\u8BA4\u8BC1\u8986\u76D6NFT' WHERE `uid`=? and `state`=1
adam_real_name.close=UPDATE adam_real_name SET `state`=2, updated_at=?, comment='close' WHERE `uid`=? adam_real_name.close=UPDATE adam_real_name SET `state`=2, updated_at=?, comment='close' WHERE `uid`=?
# ---------------------------------------------------- # ----------------------------------------------------
......
package com.liquidnet.service.consumer.kylin.receiver;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.consumer.kylin.service.processor.ConsumerGalaxyJsonNftUserRegisterProcessor;
import com.liquidnet.service.galaxy.dto.param.GalaxyUserRegisterReqDto;
import com.liquidnet.service.galaxy.dto.param.GalaxyUserRegisterRespDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.stream.StreamRecords;
import org.springframework.stereotype.Component;
import java.util.HashMap;
@Slf4j
@Component
public class ConsumerGalaxyJsonNftUserRegisterReceiver extends AbstractBizRedisReceiver {
@Autowired
private ConsumerGalaxyJsonNftUserRegisterProcessor jsonNftUserRegisterProcessor;
@Override
protected boolean consumerMessageHandler(String msg) {
boolean aBoolean = false;
try {
GalaxyUserRegisterReqDto textMessage = JsonUtils.fromJson(msg, GalaxyUserRegisterReqDto.class);
if (textMessage == null) {
aBoolean = true;
} else {
//执行计数
ResponseDto<GalaxyUserRegisterRespDto> responseDto = jsonNftUserRegisterProcessor.userRegister(textMessage);
// if(responseDto.isSuccess()){
aBoolean = true;
// }
}
} catch (Exception e) {
log.error("CONSUMER MSG EX_HANDLE ==> [{}]:{}", this.getRedisStreamKey(), msg, e);
} finally {
if (!aBoolean) {
HashMap<String, String> map = CollectionUtil.mapStringString();
map.put("message", msg);
stringRedisTemplate.opsForStream().add(StreamRecords.mapBacked(map).withStreamKey(this.getRedisStreamKey()));
}
}
return aBoolean;
}
@Override
protected String getRedisStreamKey() {
return MQConst.GalaxyQueue.JSON_NFT_USER_REGISTER.getKey();
}
@Override
protected String getRedisStreamGroup() {
return MQConst.GalaxyQueue.JSON_NFT_USER_REGISTER.getGroup();
}
}
package com.liquidnet.service.consumer.kylin.service.processor;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.galaxy.dto.param.GalaxyUserRegisterReqDto;
import com.liquidnet.service.galaxy.dto.param.GalaxyUserRegisterRespDto;
import com.liquidnet.service.galaxy.router.zxin.biz.ZxinUserCommonBiz;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: ConsumerJsonNftPublishAndBuyProcessor
* @Package com.liquidnet.service.consumer.kylin.service.processor
* @Copyright: LightNet @ Copyright (c) 2022
* @date 2022/3/29 17:04
*/
@Slf4j
@Component
public class ConsumerGalaxyJsonNftUserRegisterProcessor {
@Autowired
private ZxinUserCommonBiz zxinUserCommonBiz;
/**
* 执行用户注册
* @param reqDto
* @return
*/
public ResponseDto<GalaxyUserRegisterRespDto> userRegister(GalaxyUserRegisterReqDto reqDto) {
return zxinUserCommonBiz.userRegister(reqDto);
}
}
package com.liquidnet.service.consumer.nft.config;
import com.liquidnet.common.cache.redis.config.RedisStreamConfig;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.consumer.nft.receiver.ConsumerGalaxyJsonNftUserRegisterReceiver;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.stream.Consumer;
import org.springframework.data.redis.connection.stream.MapRecord;
import org.springframework.data.redis.connection.stream.ReadOffset;
import org.springframework.data.redis.connection.stream.StreamOffset;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.stream.StreamMessageListenerContainer;
import org.springframework.data.redis.stream.Subscription;
import java.util.ArrayList;
import java.util.List;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: 区块链nft订单相关
* @class: ConsumerSqlNftOrderInfoConfig
* @Package com.liquidnet.service.consumer.galaxy.config
* @Copyright: LightNet @ Copyright (c) 2022
* @date 2022/3/25 14:45
*/
@Configuration
public class ConsumerGalaxyJsonNftUserRegisterConfig extends RedisStreamConfig {
@Autowired
private ConsumerGalaxyJsonNftUserRegisterReceiver jsonNftUserRegisterReceiver;
@Autowired
StringRedisTemplate stringRedisTemplate;
@Bean
public List<Subscription> subscriptionJsonNftUserRegister(RedisConnectionFactory factory) {
List<Subscription> subscriptionList = new ArrayList<>();
MQConst.GalaxyQueue stream = MQConst.GalaxyQueue.JSON_NFT_USER_REGISTER;
this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup());
for (int i = 0; i < 10; i++) {
StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer = this.buildStreamMessageListenerContainer(factory);
subscriptionList.add(listenerContainer.receiveAutoAck(
Consumer.from(stream.getGroup(), getConsumerName(stream.name() + i)),
StreamOffset.create(stream.getKey(), ReadOffset.lastConsumed()), jsonNftUserRegisterReceiver
));
listenerContainer.start();
}
return subscriptionList;
}
}
package com.liquidnet.service.consumer.nft.receiver;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.consumer.nft.service.processor.ConsumerGalaxyJsonNftUserRegisterProcessor;
import com.liquidnet.service.galaxy.dto.param.GalaxyUserRegisterReqDto;
import com.liquidnet.service.galaxy.dto.param.GalaxyUserRegisterRespDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.stream.StreamRecords;
import org.springframework.stereotype.Component;
import java.util.HashMap;
@Slf4j
@Component
public class ConsumerGalaxyJsonNftUserRegisterReceiver extends AbstractBizRedisReceiver {
@Autowired
private ConsumerGalaxyJsonNftUserRegisterProcessor jsonNftUserRegisterProcessor;
@Override
protected boolean consumerMessageHandler(String msg) {
boolean aBoolean = false;
try {
GalaxyUserRegisterReqDto textMessage = JsonUtils.fromJson(msg, GalaxyUserRegisterReqDto.class);
if (textMessage == null) {
aBoolean = true;
} else {
//执行计数
ResponseDto<GalaxyUserRegisterRespDto> responseDto = jsonNftUserRegisterProcessor.userRegister(textMessage);
// if(responseDto.isSuccess()){
aBoolean = true;
// }
}
} catch (Exception e) {
log.error("CONSUMER MSG EX_HANDLE ==> [{}]:{}", this.getRedisStreamKey(), msg, e);
} finally {
if (!aBoolean) {
HashMap<String, String> map = CollectionUtil.mapStringString();
map.put("message", msg);
stringRedisTemplate.opsForStream().add(StreamRecords.mapBacked(map).withStreamKey(this.getRedisStreamKey()));
}
}
return aBoolean;
}
@Override
protected String getRedisStreamKey() {
return MQConst.GalaxyQueue.JSON_NFT_USER_REGISTER.getKey();
}
@Override
protected String getRedisStreamGroup() {
return MQConst.GalaxyQueue.JSON_NFT_USER_REGISTER.getGroup();
}
}
package com.liquidnet.service.consumer.nft.service.processor;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.galaxy.dto.param.GalaxyUserRegisterReqDto;
import com.liquidnet.service.galaxy.dto.param.GalaxyUserRegisterRespDto;
import com.liquidnet.service.galaxy.router.zxin.biz.ZxinUserCommonBiz;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: ConsumerJsonNftPublishAndBuyProcessor
* @Package com.liquidnet.service.consumer.kylin.service.processor
* @Copyright: LightNet @ Copyright (c) 2022
* @date 2022/3/29 17:04
*/
@Slf4j
@Component
public class ConsumerGalaxyJsonNftUserRegisterProcessor {
@Autowired
private ZxinUserCommonBiz zxinUserCommonBiz;
/**
* 执行用户注册
* @param reqDto
* @return
*/
public ResponseDto<GalaxyUserRegisterRespDto> userRegister(GalaxyUserRegisterReqDto reqDto) {
return zxinUserCommonBiz.userRegister(reqDto);
}
}
...@@ -31,5 +31,15 @@ ...@@ -31,5 +31,15 @@
<artifactId>liquidnet-service-galaxy-api</artifactId> <artifactId>liquidnet-service-galaxy-api</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency>
<groupId>com.liquidnet</groupId>
<artifactId>liquidnet-service-goblin-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.liquidnet</groupId>
<artifactId>liquidnet-service-adam-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
...@@ -11,6 +11,8 @@ galaxy_nft_trade_info.insert=insert into galaxy_nft_trade_info (user_id, nft_id, ...@@ -11,6 +11,8 @@ galaxy_nft_trade_info.insert=insert into galaxy_nft_trade_info (user_id, nft_id,
# ------------------------数字藏品发行购买失败记录---------------------------- # ------------------------数字藏品发行购买失败记录----------------------------
galaxy_nft_order_fail_log.insert=insert into galaxy_nft_order_fail_log (nft_order_pay_id, user_id, nft_id, nft_name, series_name, series_id,series_code, taskId, fail_reason_desc, fail_reason_desc_second, deal_with_status, trade_type,router_type, created_at, updated_at)values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) galaxy_nft_order_fail_log.insert=insert into galaxy_nft_order_fail_log (nft_order_pay_id, user_id, nft_id, nft_name, series_name, series_id,series_code, taskId, fail_reason_desc, fail_reason_desc_second, deal_with_status, trade_type,router_type, created_at, updated_at)values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
# ------------------------更新用户注册信息----------------------------
galaxy_user_info.update=update galaxy_user_info set user_name = ?,id_card_type = ?,id_card = ?,mobile = ?,block_chain_address = ?,updated_at =? where router_type = ? and user_id = ?
# ------------------------更新系列声明信息---------------------------- # ------------------------更新系列声明信息----------------------------
galaxy_series_info.updateSeriesIdAndStatus=update galaxy_series_info t set t.series_id = ?,t.chain_timestamp = ?,t.trade_hash = ?,t.series_claim_status = ? ,t.updated_at =? where t.series_code = ? galaxy_series_info.updateSeriesIdAndStatus=update galaxy_series_info t set t.series_id = ?,t.chain_timestamp = ?,t.trade_hash = ?,t.series_claim_status = ? ,t.updated_at =? where t.series_code = ?
# ------------------------更新系列NFT信息---------------------------- # ------------------------更新系列NFT信息----------------------------
...@@ -26,3 +28,5 @@ galaxy_series_nft_info.updateSeriesNftCrtCount=update galaxy_series_nft_info t s ...@@ -26,3 +28,5 @@ galaxy_series_nft_info.updateSeriesNftCrtCount=update galaxy_series_nft_info t s
# ------------------------更新发行购买处理结果---------------------------- # ------------------------更新发行购买处理结果----------------------------
galaxy_nft_order_fail_log.updateDealWithStatus=update galaxy_nft_order_fail_log t set t.deal_with_status = ?,t.updated_at =? where t.nft_order_pay_id = ? and t.router_type = ? galaxy_nft_order_fail_log.updateDealWithStatus=update galaxy_nft_order_fail_log t set t.deal_with_status = ?,t.updated_at =? where t.nft_order_pay_id = ? and t.router_type = ?
# ------------------------同步用户数字账户信息到adam---------------------------
adam_user_busi_acct.add=INSERT INTO adam_user_busi_acct (`uid`, busi, uuid, `work`, ppwd, `state`, created_at) VALUES (?,?,?,?,?,?,?)
...@@ -67,6 +67,11 @@ public class GalaxyTradeController { ...@@ -67,6 +67,11 @@ public class GalaxyTradeController {
@ApiOperation(value = "NFT发行购买结果查询") @ApiOperation(value = "NFT发行购买结果查询")
@PostMapping(value = {"nftPublishAndBuyResultQuery"}) @PostMapping(value = {"nftPublishAndBuyResultQuery"})
public ResponseDto<GalaxyNftPublishAndBuyResultQueryRespDto> nftPublishAndBuyResultQuery(@Valid @RequestBody GalaxyNftPublishAndBuyResultQueryReqDto reqDto){ public ResponseDto<GalaxyNftPublishAndBuyResultQueryRespDto> nftPublishAndBuyResultQuery(@Valid @RequestBody GalaxyNftPublishAndBuyResultQueryReqDto reqDto){
try {
Thread.sleep(2000l);
} catch (InterruptedException e) {
e.printStackTrace();
}
return galaxyTradeService.nftPublishAndBuyResultQuery(reqDto); return galaxyTradeService.nftPublishAndBuyResultQuery(reqDto);
} }
......
...@@ -353,7 +353,12 @@ public class ZxinArtworkBiz { ...@@ -353,7 +353,12 @@ public class ZxinArtworkBiz {
seriesInfoBo.setTradeHash(resp.getData().getTxHash()); seriesInfoBo.setTradeHash(resp.getData().getTxHash());
seriesInfoBo.setSeriesId(resp.getData().getSeriesId()); seriesInfoBo.setSeriesId(resp.getData().getSeriesId());
seriesInfoBo.setUpdatedAt(LocalDateTime.now()); seriesInfoBo.setUpdatedAt(LocalDateTime.now());
dataUtils.updateSeriesClaimStatus(reqDto.getRouterType(),seriesCode,seriesInfoBo);
//根据系列编号更新系列声明状态 1对多skuId
// dataUtils.updateSeriesClaimStatus(reqDto.getRouterType(),seriesCode,seriesInfoBo);
//根据skuId更新系列声明状态 1对1
dataUtils.updateSeriesClaimStatus(reqDto.getRouterType(),seriesCode,seriesInfoBo,reqDto.getSkuId());
//设置成功返回参数 //设置成功返回参数
GalaxyArtSeriesClaimResultQueryRespDto resultQueryRespDto = this.buildGalaxyArtSeriesClaimResultQueryRespDto(reqDto,seriesInfoBo,ZxlnftEnum.TaskStatusEnum.TASK_SUCCESS.getCode()); GalaxyArtSeriesClaimResultQueryRespDto resultQueryRespDto = this.buildGalaxyArtSeriesClaimResultQueryRespDto(reqDto,seriesInfoBo,ZxlnftEnum.TaskStatusEnum.TASK_SUCCESS.getCode());
...@@ -362,7 +367,14 @@ public class ZxinArtworkBiz { ...@@ -362,7 +367,14 @@ public class ZxinArtworkBiz {
}else if(resp.getData().getTaskStatus().toString().equals(ZxlnftEnum.TaskStatusEnum.TASK_FAIL.getCode())){ }else if(resp.getData().getTaskStatus().toString().equals(ZxlnftEnum.TaskStatusEnum.TASK_FAIL.getCode())){
seriesInfoBo.setSeriesClaimStatus(GalaxyEnum.SeriesClaimStatusEnum.FAIL.getCode()); seriesInfoBo.setSeriesClaimStatus(GalaxyEnum.SeriesClaimStatusEnum.FAIL.getCode());
seriesInfoBo.setUpdatedAt(LocalDateTime.now()); seriesInfoBo.setUpdatedAt(LocalDateTime.now());
dataUtils.updateSeriesClaimStatus(reqDto.getRouterType(),seriesCode,seriesInfoBo);
//根据系列编号更新系列声明状态 1对多skuId
// dataUtils.updateSeriesClaimStatus(reqDto.getRouterType(),seriesCode,seriesInfoBo);
//根据skuId更新系列声明状态 1对1
dataUtils.updateSeriesClaimStatus(reqDto.getRouterType(),seriesCode,seriesInfoBo,reqDto.getSkuId());
return ResponseDto.failure(GalaxyErrorEnum.SERIES_CLAIM_ERROR.getCode(), GalaxyErrorEnum.SERIES_CLAIM_ERROR.getMessage()); return ResponseDto.failure(GalaxyErrorEnum.SERIES_CLAIM_ERROR.getCode(), GalaxyErrorEnum.SERIES_CLAIM_ERROR.getMessage());
} }
} }
......
package com.liquidnet.service.galaxy.router.zxin.biz; package com.liquidnet.service.galaxy.router.zxin.biz;
import com.liquidnet.common.third.zxlnft.biz.ZxlnftBiz; import com.liquidnet.common.third.zxlnft.biz.ZxlnftBiz;
import com.liquidnet.common.third.zxlnft.constant.ZxlErrorEnum; import com.liquidnet.common.third.zxlnft.dto.Nft016IdentityBindQueryReqDto;
import com.liquidnet.common.third.zxlnft.dto.*; import com.liquidnet.common.third.zxlnft.dto.Nft016IdentityBindQueryRespDto;
import com.liquidnet.common.third.zxlnft.dto.ZxlnftResponseDto;
import com.liquidnet.common.third.zxlnft.dto.nft.Nft016QueryRsData; import com.liquidnet.common.third.zxlnft.dto.nft.Nft016QueryRsData;
import com.liquidnet.common.third.zxlnft.dto.wallet.CreateMnemonicReq;
import com.liquidnet.common.third.zxlnft.dto.wallet.CreateMnemonicResp;
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.ZxlWalletSdkUtil;
import com.liquidnet.common.third.zxlnft.util.ZxlnftSdkUtil; 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.base.ResponseDto;
import com.liquidnet.service.galaxy.biz.GalaxyEnumBiz; import com.liquidnet.service.galaxy.biz.GalaxyEnumBiz;
import com.liquidnet.service.galaxy.constant.GalaxyEnum;
import com.liquidnet.service.galaxy.dto.bo.GalaxyUserInfoBo;
import com.liquidnet.service.galaxy.dto.param.GalaxyUserBindStatusQueryReqDto; import com.liquidnet.service.galaxy.dto.param.GalaxyUserBindStatusQueryReqDto;
import com.liquidnet.service.galaxy.dto.param.GalaxyUserBindStatusQueryRespDto; import com.liquidnet.service.galaxy.dto.param.GalaxyUserBindStatusQueryRespDto;
import com.liquidnet.service.galaxy.dto.param.GalaxyUserRegisterReqDto; import com.liquidnet.service.galaxy.dto.param.GalaxyUserRegisterReqDto;
...@@ -26,9 +18,6 @@ import lombok.extern.slf4j.Slf4j; ...@@ -26,9 +18,6 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.io.UnsupportedEncodingException;
import java.util.List;
/** /**
* @author AnJiabin <anjiabin@zhengzai.tv> * @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0 * @version V1.0
...@@ -53,132 +42,11 @@ public class ZxinUserBiz { ...@@ -53,132 +42,11 @@ public class ZxinUserBiz {
@Autowired @Autowired
private GalaxyDataUtils dataUtils; private GalaxyDataUtils dataUtils;
public ResponseDto<GalaxyUserRegisterRespDto> userRegister(GalaxyUserRegisterReqDto reqDto) { @Autowired
String userId = reqDto.getUserId(); private ZxinUserCommonBiz zxinUserCommonBiz;
String userName = reqDto.getUserName();
String mobile = reqDto.getMobile();
String idCardType = reqDto.getIdCardType();
String idCard = reqDto.getIdCard();
String mnemonic = null;
Long index = 0L;
String userIdentification = null;
String address = null;
String userPubKey = null;
String userPriKey = null;
GalaxyUserInfoBo userInfoBo = dataUtils.getGalaxyUserInfo(reqDto.getRouterType(),userId);
if(userInfoBo!=null){
mnemonic = userInfoBo.getMnemonic();
}else{
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 返回结果:{}",nft014Resp.toJson());
return ResponseDto.failure(nft014Resp.getCode(),nft014Resp.getMessage());
}
if(StringUtil.isNotNull(nft016Resp)&&nft016Resp.isSuccess()){
List<Nft016QueryRsData> queryRsDataList = nft016Resp.getData().getList();
Nft016QueryRsData queryRsData = queryRsDataList.get(0);
address = queryRsData.getAddress();
log.info("nft016Resp 返回结果:{}",nft016Resp.toJson());
//构造返回参数
respDto.setUserId(userId);
respDto.setBlockChainType(GalaxyEnum.RouterTypeEnum.ZXINCHAIN.getCode());
respDto.setBlockChainAddress(address);
}else{
return ResponseDto.failure(nft016Resp.getMessage());
}
//构造缓存数据 public ResponseDto<GalaxyUserRegisterRespDto> userRegister(GalaxyUserRegisterReqDto reqDto) {
if(userInfoBo==null){ return zxinUserCommonBiz.userRegister(reqDto);
userInfoBo = GalaxyUserInfoBo.getNew();
userInfoBo.setUserId(userId);
userInfoBo.setUserName(userName);
userInfoBo.setMobile(mobile);
userInfoBo.setIdCardType(idCardType);
userInfoBo.setIdCard(idCard);
userInfoBo.setMnemonic(mnemonic);
userInfoBo.setIndex(index.toString());
userInfoBo.setUserIdentification(userIdentification);
userInfoBo.setUserPubKey(userPubKey);
userInfoBo.setUserPriKey(userPriKey);
userInfoBo.setRouterType(GalaxyEnum.RouterTypeEnum.ZXINCHAIN.getCode());
userInfoBo.setBlockChainAddress(address);
dataUtils.setGalaxyUserInfo(reqDto.getRouterType(),reqDto.getUserId(),userInfoBo);
}
}
return ResponseDto.success(respDto);
} }
public ResponseDto<GalaxyUserBindStatusQueryRespDto> userBindStatusQuery(GalaxyUserBindStatusQueryReqDto reqDto){ public ResponseDto<GalaxyUserBindStatusQueryRespDto> userBindStatusQuery(GalaxyUserBindStatusQueryReqDto reqDto){
......
...@@ -7,6 +7,8 @@ import com.liquidnet.commons.lang.util.CurrentUtil; ...@@ -7,6 +7,8 @@ import com.liquidnet.commons.lang.util.CurrentUtil;
import com.liquidnet.commons.lang.util.IDCardUtil; import com.liquidnet.commons.lang.util.IDCardUtil;
import com.liquidnet.service.base.ErrorMapping; import com.liquidnet.service.base.ErrorMapping;
import com.liquidnet.service.base.ResponseDto; import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.constant.NftAccStatusEnum;
import com.liquidnet.service.goblin.dto.GoblinUserNftAccInfoVo;
import com.liquidnet.service.goblin.service.IGoblinNftUserService; import com.liquidnet.service.goblin.service.IGoblinNftUserService;
import com.liquidnet.service.goblin.util.GoblinRedisUtils; import com.liquidnet.service.goblin.util.GoblinRedisUtils;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -18,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -18,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.Pattern; import javax.validation.constraints.Pattern;
import java.time.LocalDateTime;
@Api(tags = "NFT:账号相关") @Api(tags = "NFT:账号相关")
@Slf4j @Slf4j
...@@ -38,10 +41,10 @@ public class GoblinNFTUserController { ...@@ -38,10 +41,10 @@ public class GoblinNFTUserController {
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "idCard", value = "身份证号"), @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "idCard", value = "身份证号"),
}) })
@PostMapping(value = "open/account") @PostMapping(value = "open/account")
public ResponseDto<Integer> openAccount(@Pattern(regexp = "\\b(NFT_ZX)\\b", message = "业务码无效") public ResponseDto<GoblinUserNftAccInfoVo> openAccount(@Pattern(regexp = "\\b(NFT_ZX)\\b", message = "业务码无效")
@RequestParam String bizCode, @RequestParam String bizCode,
@RequestParam(required = true) String name, @RequestParam String name,
@RequestParam(required = true) String idCard) { @RequestParam String idCard) {
if (!java.util.regex.Pattern.matches(LnsRegex.Valid.CN_HANZI, name)) { if (!java.util.regex.Pattern.matches(LnsRegex.Valid.CN_HANZI, name)) {
return ResponseDto.failure(ErrorMapping.get("140013")); return ResponseDto.failure(ErrorMapping.get("140013"));
} }
...@@ -51,10 +54,21 @@ public class GoblinNFTUserController { ...@@ -51,10 +54,21 @@ public class GoblinNFTUserController {
if (IDCardUtil.getAge(idCard) < 18) { if (IDCardUtil.getAge(idCard) < 18) {
return ResponseDto.failure(ErrorMapping.get("140010")); return ResponseDto.failure(ErrorMapping.get("140010"));
} }
String currentUid = CurrentUtil.getCurrentUid();
String mobile = (String) CurrentUtil.getTokenClaims().get(CurrentUtil.TOKEN_MOBILE);
try { try {
String currentUid = CurrentUtil.getCurrentUid();
String mobile = (String) CurrentUtil.getTokenClaims().get(CurrentUtil.TOKEN_MOBILE);
if (goblinRedisUtils.isCertmetaJunk(1, idCard, name, mobile)) {// 实名认证失败缓存命中
return ResponseDto.failure(ErrorMapping.get("140016"));
}
GoblinUserNftAccInfoVo openAccountInfo = goblinRedisUtils.getOpenAccountInfo(currentUid);
if (null != openAccountInfo) {// 已申请开通或开通处理中
String code = openAccountInfo.getCode();
if (!"3000".equals(code) && !"3001".equals(code)) { // 不可重试
return ResponseDto.success(openAccountInfo);
}
}
return goblinNftUserService.openNftAccount(currentUid, bizCode, name, idCard, mobile); return goblinNftUserService.openNftAccount(currentUid, bizCode, name, idCard, mobile);
} catch (Exception e) { } catch (Exception e) {
if (e instanceof LiquidnetServiceException) { if (e instanceof LiquidnetServiceException) {
...@@ -66,9 +80,21 @@ public class GoblinNFTUserController { ...@@ -66,9 +80,21 @@ public class GoblinNFTUserController {
} }
@ApiOperationSupport(order = 11) @ApiOperationSupport(order = 11)
@ApiOperation(value = "业务账号是否开通") @ApiOperation(value = "业务账号是否开通 废弃")
@GetMapping(value = "open/account") @GetMapping(value = "open/account")
public ResponseDto<Boolean> openAccount() { public ResponseDto<Boolean> openAccount() {
return ResponseDto.success(goblinRedisUtils.getNftNumAccount(CurrentUtil.getCurrentUid())); return ResponseDto.success(goblinRedisUtils.getNftNumAccount(CurrentUtil.getCurrentUid()));
} }
@ApiOperationSupport(order = 11)
@ApiOperation(value = "业务账号开通信息")
@GetMapping(value = "open/account/info")
public ResponseDto<GoblinUserNftAccInfoVo> openAccountInfo() {
/*GoblinUserNftAccInfoVo nftAccInfoVo = GoblinUserNftAccInfoVo.getNew();
nftAccInfoVo.setCode(NftAccStatusEnum.StatusAcc.ING.getCode());
nftAccInfoVo.setMsg(NftAccStatusEnum.StatusAcc.ING.getMsg());
nftAccInfoVo.setTime(LocalDateTime.now());
goblinRedisUtils.setOpenAccountInfo(CurrentUtil.getCurrentUid(), nftAccInfoVo);*/
return ResponseDto.success(goblinRedisUtils.getOpenAccountInfo(CurrentUtil.getCurrentUid()));
}
} }
package com.liquidnet.service.goblin.service.impl; package com.liquidnet.service.goblin.service.impl;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.adam.constant.AdamEnum; import com.liquidnet.service.adam.constant.AdamEnum;
import com.liquidnet.service.base.ErrorMapping; import com.liquidnet.service.base.ErrorMapping;
import com.liquidnet.service.base.ResponseDto; import com.liquidnet.service.base.ResponseDto;
...@@ -9,6 +10,8 @@ import com.liquidnet.service.galaxy.constant.GalaxyEnum; ...@@ -9,6 +10,8 @@ import com.liquidnet.service.galaxy.constant.GalaxyEnum;
import com.liquidnet.service.galaxy.dto.param.GalaxyUserRegisterReqDto; import com.liquidnet.service.galaxy.dto.param.GalaxyUserRegisterReqDto;
import com.liquidnet.service.galaxy.dto.param.GalaxyUserRegisterRespDto; import com.liquidnet.service.galaxy.dto.param.GalaxyUserRegisterRespDto;
import com.liquidnet.service.galaxy.service.IGalaxyUserService; import com.liquidnet.service.galaxy.service.IGalaxyUserService;
import com.liquidnet.service.goblin.constant.NftAccStatusEnum;
import com.liquidnet.service.goblin.dto.GoblinUserNftAccInfoVo;
import com.liquidnet.service.goblin.service.IGoblinNftUserService; import com.liquidnet.service.goblin.service.IGoblinNftUserService;
import com.liquidnet.service.goblin.util.GoblinRedisUtils; import com.liquidnet.service.goblin.util.GoblinRedisUtils;
import com.liquidnet.service.goblin.util.QueueUtils; import com.liquidnet.service.goblin.util.QueueUtils;
...@@ -30,8 +33,8 @@ public class GoblinNftUserServiceImpl implements IGoblinNftUserService { ...@@ -30,8 +33,8 @@ public class GoblinNftUserServiceImpl implements IGoblinNftUserService {
private IGalaxyUserService galaxyUserService; private IGalaxyUserService galaxyUserService;
@Override @Override
public ResponseDto<Integer> openNftAccount(String uid, String bizCode, String name, String idCard, String mobile) { public ResponseDto<GoblinUserNftAccInfoVo> openNftAccount(String uid, String bizCode, String name, String idCard, String mobile) {
if (goblinRedisUtils.getNftNumAccount(uid)) return ResponseDto.success(1); GoblinUserNftAccInfoVo openAccountInfo;
switch (bizCode) { switch (bizCode) {
case "NFT_ZX": case "NFT_ZX":
GalaxyUserRegisterReqDto userRegisterReqDto = GalaxyUserRegisterReqDto.getNew(); GalaxyUserRegisterReqDto userRegisterReqDto = GalaxyUserRegisterReqDto.getNew();
...@@ -39,25 +42,23 @@ public class GoblinNftUserServiceImpl implements IGoblinNftUserService { ...@@ -39,25 +42,23 @@ public class GoblinNftUserServiceImpl implements IGoblinNftUserService {
userRegisterReqDto.setUserName(name); userRegisterReqDto.setUserName(name);
userRegisterReqDto.setIdCard(idCard); userRegisterReqDto.setIdCard(idCard);
userRegisterReqDto.setMobile(mobile); userRegisterReqDto.setMobile(mobile);
userRegisterReqDto.setIdCardType("1"); userRegisterReqDto.setIdCardType("1");// 同步com.liquidnet.service.galaxy.constant.GalaxyEnum.CardTypeEnum
userRegisterReqDto.setRouterType(GalaxyEnum.RouterTypeEnum.ZXINCHAIN.getCode()); userRegisterReqDto.setRouterType(GalaxyEnum.RouterTypeEnum.ZXINCHAIN.getCode());
ResponseDto<GalaxyUserRegisterRespDto> userRegisterRespDto = galaxyUserService.userRegister(userRegisterReqDto); // galaxyUserService.userRegister(userRegisterReqDto);
if (userRegisterRespDto.isSuccess()) { queueUtils.sendMsgByRedis(MQConst.GalaxyQueue.JSON_NFT_USER_REGISTER.getKey(), JsonUtils.toJson(userRegisterReqDto));
goblinRedisUtils.setNftNumAccount(uid);
GalaxyUserRegisterRespDto userRegisterRespDtoData = userRegisterRespDto.getData(); openAccountInfo = GoblinUserNftAccInfoVo.getNew();
openAccountInfo.setCode(NftAccStatusEnum.StatusAcc.ING.getCode());
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_STORE.getKey(), openAccountInfo.setMsg(NftAccStatusEnum.StatusAcc.ING.getMsg());
SqlMapping.get("adam_user_busi_acct.add", uid, AdamEnum.BizAcct.NFT_ZX.name(), userRegisterRespDtoData.getBlockChainAddress(), null, null, 1, LocalDateTime.now())
);
return ResponseDto.success(1);
}
break; break;
default: default:
log.warn("#开通业务账号:无效的业务码[UID={},bizCode={}]", bizCode, uid); log.warn("#开通业务账号:无效的业务码[UID={},bizCode={},name={},idCard={},mobile={}]", uid, bizCode, name, idCard, mobile);
break; return ResponseDto.failure(ErrorMapping.get("140015"));
} }
return ResponseDto.failure(ErrorMapping.get("140015")); openAccountInfo.setTime(LocalDateTime.now());
goblinRedisUtils.setOpenAccountInfo(uid, openAccountInfo);
return ResponseDto.success(openAccountInfo);
} }
} }
package com.liquidnet.service.goblin.util; package com.liquidnet.service.goblin.util;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.ObjectNode;
import com.liquidnet.common.cache.redis.util.RedisUtil; import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.commons.lang.util.CollectionUtil; import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.JsonUtils; import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.commons.lang.util.RandomUtil; import com.liquidnet.commons.lang.util.RandomUtil;
import com.liquidnet.commons.lang.util.StringUtil;
import com.liquidnet.service.goblin.constant.GoblinRedisConst; import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import com.liquidnet.service.goblin.constant.GoblinStatusConst; import com.liquidnet.service.goblin.constant.GoblinStatusConst;
import com.liquidnet.service.goblin.dto.GoblinStoreMarketDto; import com.liquidnet.service.goblin.dto.GoblinStoreMarketDto;
import com.liquidnet.service.goblin.dto.GoblinUserNftAccInfoVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinGoodsAnticipateValueVo; import com.liquidnet.service.goblin.dto.manage.vo.GoblinGoodsAnticipateValueVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinMgtCategorySpecVo; import com.liquidnet.service.goblin.dto.manage.vo.GoblinMgtCategorySpecVo;
import com.liquidnet.service.goblin.dto.vo.*; import com.liquidnet.service.goblin.dto.vo.*;
...@@ -2018,12 +2017,6 @@ public class GoblinRedisUtils { ...@@ -2018,12 +2017,6 @@ public class GoblinRedisUtils {
redisUtil.set(redisKey, spuList); redisUtil.set(redisKey, spuList);
} }
// 记录用户开通数字账户
public void setNftNumAccount(String userId) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_NFT_NUM_ACCOUNT.concat(userId);
redisUtil.set(redisKey, 1);
}
public boolean getNftNumAccount(String userId) { public boolean getNftNumAccount(String userId) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_NFT_NUM_ACCOUNT.concat(userId); String redisKey = GoblinRedisConst.REDIS_GOBLIN_NFT_NUM_ACCOUNT.concat(userId);
Object obj = redisUtil.get(redisKey); Object obj = redisUtil.get(redisKey);
...@@ -2034,6 +2027,20 @@ public class GoblinRedisUtils { ...@@ -2034,6 +2027,20 @@ public class GoblinRedisUtils {
} }
} }
public GoblinUserNftAccInfoVo getOpenAccountInfo(String userId) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_NFT_NUM_ACCOUNT_INFO.concat(userId);
Object obj = redisUtil.get(redisKey);
if (obj == null) {
return null;
} else {
return (GoblinUserNftAccInfoVo) obj;
}
}
public void setOpenAccountInfo(String userId, GoblinUserNftAccInfoVo nftAccInfoVo) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_NFT_NUM_ACCOUNT_INFO.concat(userId);
redisUtil.set(redisKey, nftAccInfoVo);
}
public int getIsExchange(String skuId) { public int getIsExchange(String skuId) {
String redisKey = GoblinRedisConst.ACTIVITY_SKU_TIME.concat(skuId); String redisKey = GoblinRedisConst.ACTIVITY_SKU_TIME.concat(skuId);
Object obj = redisUtil.get(redisKey); Object obj = redisUtil.get(redisKey);
...@@ -2232,6 +2239,29 @@ public class GoblinRedisUtils { ...@@ -2232,6 +2239,29 @@ public class GoblinRedisUtils {
} }
} }
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | NFT三要素认证缓存的<ID_TYPE+ID_NO, "ID_NAME,MOBILE"> */
public boolean setCertmetaJunk(int idType, String idNo, String idName, String mobile) {
return redisUtil.set(GoblinRedisConst.REDIS_GOBLIN_NFT_CERTMETA_JUNK + idType + idNo, idName.concat(",").concat(mobile), 604800);
}
public boolean isCertmetaJunk(int idType, String idNo, String idName, String mobile) {
String val = (String) redisUtil.get(GoblinRedisConst.REDIS_GOBLIN_NFT_CERTMETA_JUNK + idType + idNo);
return !StringUtils.isEmpty(val) && val.equals(idName.concat(",").concat(mobile));
}
public boolean setCertmeta(int idType, String idNo, String idName, String mobile) {
return redisUtil.set(GoblinRedisConst.REDIS_GOBLIN_NFT_CERTMETA + idType + idNo, idName.concat(",").concat(mobile));
}
public int isCertmeta(int idType, String idNo, String idName, String mobile) {
String o = (String) redisUtil.get(GoblinRedisConst.REDIS_GOBLIN_NFT_CERTMETA + idType + idNo);
if (StringUtils.isEmpty(o)) {
return -1;
}
return o.equals(idName.concat(",").concat(mobile)) ? 1 : 0;
}
/* ---------------------------------------- ---------------------------------------- */ /* ---------------------------------------- ---------------------------------------- */
/* ---------------------------------------- ---------------------------------------- */ /* ---------------------------------------- ---------------------------------------- */
} }
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
140013=\u8EAB\u4EFD\u8BC1\u59D3\u540D\u4E0D\u5408\u89C4 140013=\u8EAB\u4EFD\u8BC1\u59D3\u540D\u4E0D\u5408\u89C4
140014=\u8EAB\u4EFD\u8BC1\u53F7\u7801\u4E0D\u5408\u89C4 140014=\u8EAB\u4EFD\u8BC1\u53F7\u7801\u4E0D\u5408\u89C4
140015=\u8D26\u53F7\u5F00\u901A\u5931\u8D25\uFF0C\u8BF7\u8054\u7CFB\u5BA2\u670D 140015=\u8D26\u53F7\u5F00\u901A\u5931\u8D25\uFF0C\u8BF7\u8054\u7CFB\u5BA2\u670D
140016=\u8BC1\u4EF6\u4FE1\u606F\u6216\u624B\u673A\u53F7\u4E0D\u4E00\u81F4
......
...@@ -3,12 +3,15 @@ package com.liquidnet.service.order.service.impl; ...@@ -3,12 +3,15 @@ package com.liquidnet.service.order.service.impl;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.ObjectNode;
import com.liquidnet.commons.lang.util.*; import com.liquidnet.commons.lang.util.*;
import com.liquidnet.service.base.ErrorMapping;
import com.liquidnet.service.base.ResponseDto; import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.base.SqlMapping; import com.liquidnet.service.base.SqlMapping;
import com.liquidnet.service.base.UserPathDto; import com.liquidnet.service.base.UserPathDto;
import com.liquidnet.service.base.constant.MQConst; import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.goblin.constant.GoblinRedisConst; import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import com.liquidnet.service.goblin.constant.GoblinStatusConst; import com.liquidnet.service.goblin.constant.GoblinStatusConst;
import com.liquidnet.service.goblin.constant.NftAccStatusEnum;
import com.liquidnet.service.goblin.dto.GoblinUserNftAccInfoVo;
import com.liquidnet.service.goblin.dto.vo.*; import com.liquidnet.service.goblin.dto.vo.*;
import com.liquidnet.service.goblin.entity.GoblinNftOrder; import com.liquidnet.service.goblin.entity.GoblinNftOrder;
import com.liquidnet.service.goblin.param.GoblinNftOrderPayAgainParam; import com.liquidnet.service.goblin.param.GoblinNftOrderPayAgainParam;
...@@ -23,6 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -23,6 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
...@@ -65,8 +69,8 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService { ...@@ -65,8 +69,8 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService {
} else { } else {
try { try {
// 认证验证 // 认证验证
boolean numAccount = goblinRedisUtils.getNftNumAccount(uid); GoblinUserNftAccInfoVo openAccountInfo = goblinRedisUtils.getOpenAccountInfo(uid);
if (!numAccount) { if (null == openAccountInfo || !NftAccStatusEnum.StatusAcc.SUCCESS.getCode().equals(openAccountInfo.getCode())) {
return ResponseDto.failure("您还未开通数字账户~"); return ResponseDto.failure("您还未开通数字账户~");
} }
...@@ -530,75 +534,73 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService { ...@@ -530,75 +534,73 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService {
return ResponseDto.failure("暂不支持此接口"); return ResponseDto.failure("暂不支持此接口");
/*String uid = CurrentUtil.getCurrentUid(); /*String uid = CurrentUtil.getCurrentUid();
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
//检查订单时间 是否关闭 GoblinNftOrderVo nftOrder = nftOrderUtils.getNftOrder(param.getOrderId());
GoblinStoreOrderVo storeOrderVo = goblinRedisUtils.getGoblinOrder(param.getOrderId()); // 检查订单时间
if (nftOrder == null) {
if (storeOrderVo == null) {
return ResponseDto.failure("订单不存在"); return ResponseDto.failure("订单不存在");
} }
if (!nftOrder.getUserId().equals(uid)) {
if (!storeOrderVo.getUserId().equals(uid)) {
return ResponseDto.failure(ErrorMapping.get("20003")); return ResponseDto.failure(ErrorMapping.get("20003"));
} }
if (nftOrder.getStatus() != GoblinStatusConst.Status.ORDER_STATUS_0.getValue()) {
if (storeOrderVo.getStatus() != GoblinStatusConst.Status.ORDER_STATUS_0.getValue()) { return ResponseDto.failure("当前订单状态不支持支付");
return ResponseDto.failure("订单无法支付");//订单
} }
MultiValueMap<String, String> header = CollectionUtil.linkedMultiValueMapStringString(); MultiValueMap<String, String> header = CollectionUtil.linkedMultiValueMapStringString();
header.add("Accept", "application/json;charset=UTF-8"); header.add("Accept", "application/json;charset=UTF-8");
String returnCheckData = HttpUtil.get(checkUrl + "?code=" + storeOrderVo.getPayCode(), null, header); String returnCheckData = HttpUtil.get(checkUrl + "?code=" + nftOrder.getPayCode(), null, header);
ResponseDto<GoblinPayInnerResultVo> checkVo = JsonUtils.fromJson(returnCheckData, new TypeReference<ResponseDto<GoblinPayInnerResultVo>>() { ResponseDto<GoblinPayInnerResultVo> checkVo = JsonUtils.fromJson(returnCheckData, new TypeReference<ResponseDto<GoblinPayInnerResultVo>>() {
}); });
if (checkVo.getData().getStatus() == 1) { if (checkVo.getData().getStatus() == 1) {
return ResponseDto.failure("订单已支付"); return ResponseDto.failure("订单已支付");
} }
BigDecimal price = BigDecimal.ZERO; // 获取支付参数
String[] orderIds = goblinRedisUtils.getMasterCode(storeOrderVo.getMasterOrderCode());
for (String orderId : orderIds) {
GoblinStoreOrderVo orderVo = goblinRedisUtils.getGoblinOrder(orderId);
price = price.add(orderVo.getPriceActual());
}
GoblinNftPayResultVo NftPayResultVo = GoblinNftPayResultVo.getNew(); GoblinNftPayResultVo NftPayResultVo = GoblinNftPayResultVo.getNew();
if (!storeOrderVo.getPayType().equals("FREE")) { if (!nftOrder.getPayType().equals("FREE")) {
// 调用支付 // 调用支付
LinkedMultiValueMap<String, String> httpData = CollectionUtil.linkedMultiValueMapStringString(); LinkedMultiValueMap<String, String> httpData = CollectionUtil.linkedMultiValueMapStringString();
httpData.add("type", "PRODUCT"); httpData.add("type", "NFT");
httpData.add("price", price.toString()); httpData.add("price", nftOrder.getPriceActual().toString());
httpData.add("name", goblinRedisUtils.getStoreInfoVo(storeOrderVo.getStoreId()).getStoreName()); httpData.add("name", nftOrder.getStoreName());
httpData.add("detail", "查找最初订单"); httpData.add("detail", nftOrder.getSkuTitle());
httpData.add("orderCode", storeOrderVo.getMasterOrderCode()); httpData.add("orderCode", nftOrder.getOrderCode());
httpData.add("clientIp", storeOrderVo.getIpAddress()); httpData.add("clientIp", nftOrder.getIpAddress());
httpData.add("notifyUrl", synUrl); httpData.add("notifyUrl", synUrl);
httpData.add("createDate", storeOrderVo.getCreatedAt()); httpData.add("createDate", nftOrder.getCreatedAt().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
httpData.add("expireTime", storeOrderVo.getPayCountdownMinute().toString()); httpData.add("expireTime", nftOrder.getPayCountdownMinute().toString());
httpData.add("payType", param.getPayType()); httpData.add("payType", param.getPayType());
httpData.add("deviceFrom", param.getDeviceFrom()); httpData.add("deviceFrom", param.getDeviceFrom());
if (param.getDeviceFrom().equals("js") || param.getDeviceFrom().equals("applet")) { if (param.getDeviceFrom().equals("js") || param.getDeviceFrom().equals("applet")) {
httpData.add("openId", param.getOpenId()); httpData.add("openId", param.getOpenId());
} }
httpData.add("showUrl", param.getShowUrl() + storeOrderVo.getMasterOrderCode()); String showUrl = param.getShowUrl().concat(nftOrder.getOrderCode());
httpData.add("returnUrl", param.getReturnUrl() + storeOrderVo.getMasterOrderCode()); String returnUrl = param.getReturnUrl().concat(nftOrder.getOrderCode());
httpData.add("showUrl", showUrl);
httpData.add("returnUrl", returnUrl);
String returnData = HttpUtil.post(payUrl, httpData); String returnData = HttpUtil.post(payUrl, httpData);
log.debug("调用 DRAGON 结果 = " + returnData); log.info("调用 DRAGON 结果 = " + returnData);
ResponseDto<GoblinPayInnerResultVo> dto = JsonUtils.fromJson(returnData, new TypeReference<ResponseDto<GoblinPayInnerResultVo>>() { ResponseDto<GoblinPayInnerResultVo> dto = JsonUtils.fromJson(returnData, new TypeReference<ResponseDto<GoblinPayInnerResultVo>>() {
}); });
NftPayResultVo.setCode(dto.getData().getCode()); GoblinPayInnerResultVo dtoData = dto.getData();
NftPayResultVo.setOrderCode(storeOrderVo.getMasterOrderCode());
String payCode = dtoData.getCode();
NftPayResultVo.setCode(payCode);
NftPayResultVo.setOrderCode(nftOrder.getOrderCode());
NftPayResultVo.setPayData(dto.getData().getPayData()); NftPayResultVo.setPayData(dto.getData().getPayData());
NftPayResultVo.setOrderId(storeOrderVo.getMasterOrderCode()); NftPayResultVo.setOrderId(nftOrder.getOrderId());
NftPayResultVo.setPayType(param.getPayType()); NftPayResultVo.setPayData(dtoData.getPayData());
NftPayResultVo.setPrice(price); NftPayResultVo.setPayType(nftOrder.getPayType());
NftPayResultVo.setShowUrl(param.getShowUrl() + storeOrderVo.getMasterOrderCode()); NftPayResultVo.setPrice(nftOrder.getPriceActual());
NftPayResultVo.setReturnUrl(param.getReturnUrl() + storeOrderVo.getMasterOrderCode()); NftPayResultVo.setShowUrl(showUrl);
//redis NftPayResultVo.setReturnUrl(returnUrl);
storeOrderVo.setPayType(param.getPayType()); // redis
storeOrderVo.setDeviceFrom(param.getDeviceFrom()); nftOrder.setPayType(param.getPayType());
storeOrderVo.setPayCode(NftPayResultVo.getCode()); nftOrder.setDeviceFrom(param.getDeviceFrom());
goblinRedisUtils.setGoblinOrder(storeOrderVo.getOrderId(), storeOrderVo); nftOrder.setPayCode(NftPayResultVo.getCode());
//mongo nftOrderUtils.setNftOrder(nftOrder);
goblinMongoUtils.updateGoblinStoreOrderVo(storeOrderVo.getOrderId(), storeOrderVo); // mongo
//mysql goblinOrderUtils.setMongoList(GoblinNftOrderVo.class.getSimpleName(), "orderId", nftOrder.getOrderId(), GoblinRedisConst.REDIS_GOBLIN_NFT_ORDER_INFO, 2);
// mysql
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.GOBLIN_ORDER_AGAIN.getKey(), queueUtils.sendMsgByRedis(MQConst.GoblinQueue.GOBLIN_ORDER_AGAIN.getKey(),
SqlMapping.get("goblin_order.pay.again", param.getPayType(), param.getDeviceFrom(), NftPayResultVo.getCode(), param.getOrderId(), now, now)); SqlMapping.get("goblin_order.pay.again", param.getPayType(), param.getDeviceFrom(), NftPayResultVo.getCode(), param.getOrderId(), now, now));
log.info(UserPathDto.setData("再次支付[新支付方式]", param, NftPayResultVo)); log.info(UserPathDto.setData("再次支付[新支付方式]", param, NftPayResultVo));
......
...@@ -6,6 +6,7 @@ import com.liquidnet.commons.lang.util.CollectionUtil; ...@@ -6,6 +6,7 @@ import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.JsonUtils; import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.goblin.constant.GoblinRedisConst; import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import com.liquidnet.service.goblin.constant.GoblinStatusConst; import com.liquidnet.service.goblin.constant.GoblinStatusConst;
import com.liquidnet.service.goblin.dto.GoblinUserNftAccInfoVo;
import com.liquidnet.service.goblin.dto.vo.*; import com.liquidnet.service.goblin.dto.vo.*;
import com.liquidnet.service.kylin.constant.KylinRedisConst; import com.liquidnet.service.kylin.constant.KylinRedisConst;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -623,13 +624,13 @@ public class GoblinRedisUtils { ...@@ -623,13 +624,13 @@ public class GoblinRedisUtils {
} }
} }
public boolean getNftNumAccount(String userId) { public GoblinUserNftAccInfoVo getOpenAccountInfo(String userId) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_NFT_NUM_ACCOUNT.concat(userId); String redisKey = GoblinRedisConst.REDIS_GOBLIN_NFT_NUM_ACCOUNT_INFO.concat(userId);
Object obj = redisUtil.get(redisKey); Object obj = redisUtil.get(redisKey);
if (obj == null) { if (obj == null) {
return false; return null;
} else { } else {
return true; return (GoblinUserNftAccInfoVo) obj;
} }
} }
......
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