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

Commit 2e7ebd3a authored by anjiabin's avatar anjiabin

Merge branch 'dev_nft_411' of...

Merge branch 'dev_nft_411' of http://gitlab.zhengzai.tv/dongjingwei/liquidnet-bus-v1 into dev_nft_411
parents 90e75c02 04113830
......@@ -27,6 +27,10 @@ public class GoblinPayOrderDetailsVo implements Serializable, Cloneable {
private String skuPic;
@ApiModelProperty(position = 21, value = "单品现价[20,2]")
private BigDecimal price;
@ApiModelProperty(value = "商铺名称")
private String storeName;
@ApiModelProperty(position = 22, value = "数量")
private Integer num;
@ApiModelProperty(position = 23, value = "总价")
......
package com.liquidnet.service.consumer.kylin.receiver;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.DateUtil;
......@@ -37,7 +38,6 @@ public class ConsumerGoblinBizArtworkGenRdsReceiver extends AbstractBizRedisRece
private MongoTemplate mongoTemplate;
private static final String SQL_INSERT_ARTWORK = "INSERT INTO goblin_user_digital_artwork (artwork_id, sku_id, uid, order_id, source, state, created_at)VALUES(?,?,?,?,?,?,?)";
private static final String QUEUE_MSG_TL = "{\"nftOrderPayId\":\"1\",\"routerType\":\"zxinchain\",\"skuId\":\"2\",\"userId\":\"3\",\"buyTimestamp\":\"4\"}";
private static final String QUEUE_KEY_NFT = "galaxy:stream:rk.json.nftPublishAndBuy";
@Override
......@@ -154,7 +154,10 @@ public class ConsumerGoblinBizArtworkGenRdsReceiver extends AbstractBizRedisRece
streamOperations.add(StreamRecords.mapBacked(sqlArtworkMap).withStreamKey(MQConst.GoblinQueue.SQL_ARTWORK_GEN.getKey()));
// NFT发行购买
HashMap<String, String> bizNftBuyMap = CollectionUtil.mapStringString();
bizNftBuyMap.put("message", QUEUE_MSG_TL.replace("1", orderId).replace("2", skuId).replace("3", uid).replace("4", DateUtil.Formatter.yyyyMMddHHmmss.format(now)));
ObjectNode bizNftBuyNode = JsonUtils.OM().createObjectNode();
bizNftBuyNode.put("nftOrderPayId", orderId).put("routerType", "zxinchain")
.put("skuId", skuId).put("userId", uid).put("buyTimestamp", DateUtil.Formatter.yyyyMMddHHmmss.format(now));
bizNftBuyMap.put("message", bizNftBuyNode.toString());
streamOperations.add(StreamRecords.mapBacked(bizNftBuyMap).withStreamKey(QUEUE_KEY_NFT));// TODO: 2022/3/30 ==zhanggb.anjiabin
redisUtil.incr(GoblinRedisConst.USER_DIGITAL_ARTWORK_CT.concat(uid), 1);
......
......@@ -31,14 +31,14 @@ public class GoblinRscController {
@ApiImplicitParams({
@ApiImplicitParam(type = "form", dataType = "String", name = "userId", value = "用户ID", example = "1", required = true),
})
public ResponseDto<Boolean> syncNotice(
public ResponseDto syncNotice(
@RequestParam("userId") @NotBlank(message = "用户ID不能为空") String userId
) {
Boolean notice = accountService.syncNotice(userId);
if (notice) {
return ResponseDto.success();
return ResponseDto.success("同步成功");
} else {
return ResponseDto.failure();
return ResponseDto.failure("未获取到数据");
}
}
......
package com.liquidnet.service.goblin.service.impl;
import com.fasterxml.jackson.core.type.TypeReference;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.HttpUtil;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.adam.dto.vo.AdamUserBizAcctVo;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.util.GoblinRedisUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import org.springframework.util.MultiValueMap;
@Service
@Slf4j
......@@ -12,11 +21,26 @@ public class GoblinNftNumAccountServiceImpl {
@Autowired
private GoblinRedisUtils goblinRedisUtils;
@Value("${liquidnet.service.adam.url}")
private String adamUrl;
public Boolean syncNotice(String userId) {
// TODO: jxl 2022/4/6 请求adam
// 写入redis
goblinRedisUtils.setNftNumAccount(userId);
return true;
// 请求adam
MultiValueMap<String, String> headers = CollectionUtil.linkedMultiValueMapStringString();
headers.add("Accept", MediaType.APPLICATION_JSON_UTF8_VALUE);
headers.set("Content-Type", MediaType.APPLICATION_FORM_URLENCODED_VALUE);
String returnData = HttpUtil.getByUri(adamUrl.concat("/adam/rsc/inquire/bizacc?bizCode=NFT_ZX&uid=".concat(userId)), headers);
ResponseDto<AdamUserBizAcctVo> rsp = JsonUtils.fromJson(returnData, new TypeReference<ResponseDto<AdamUserBizAcctVo>>() {
});
AdamUserBizAcctVo rspData = rsp.getData();
if (null != rspData) {
// 写入redis
goblinRedisUtils.setNftNumAccount(userId);
return true;
} else {
log.info("同步数字账号失败,信息不存在 [userId:{}]", userId);
return false;
}
}
}
......@@ -93,6 +93,9 @@ public class GoblinNftOrderAppServiceImpl implements IGoblinNftOrderAppService {
GoblinPayOrderDetailsVo payOrderDetailsVo = GoblinPayOrderDetailsVo.getNew().copy(goodsSkuInfoVo);
payOrderDetailsVo.setNum(1);
payOrderDetailsVo.setPriceTotal(payOrderDetailsVo.getPrice());
GoblinStoreInfoVo storeInfoVo = goblinRedisUtils.getStoreInfoVo(goodsSkuInfoVo.getStoreId());
payOrderDetailsVo.setStoreName(storeInfoVo.getStoreName());
return payOrderDetailsVo;
} else {
return null;
......
......@@ -1399,7 +1399,7 @@ public class GoblinRedisUtils {
//
public void setNftNumAccount(String userId) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_NFT_NUM_ACCOUNT.concat(userId);
// redisUtil.set(redisKey, 1);
redisUtil.set(redisKey, 1);
}
/* ---------------------------------------- ---------------------------------------- */
......
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