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

Commit ce45e624 authored by jiangxiulong's avatar jiangxiulong

数字账户同步

parent b8182d7f
......@@ -120,11 +120,12 @@ public class GoblinRedisConst {
/* --------------------------------NFT--------------------------------- */
public static final String REDIS_GOBLIN_NFT_ORDER_INFO = PREFIX.concat("nftOrder:");// nft订单详情 orderId
public static final String REDIS_GOBLIN_NFT_ORDER_ID_OF_CODE = PREFIX.concat("nftOrder:orderCode:");// nft订单详情 orderCode
public static final String REDIS_GOBLIN_NFT_ORDER_ID_OF_CODE = PREFIX.concat("nftOrder:orderCode:");// nft订单ID获取 orderCode
public static final String REDIS_GOBLIN_NFT_ORDER_USER_ID_LIST = PREFIX.concat("nftOrder:idList:user:");// nft用户订单id列表 userId
public static final String REDIS_GOBLIN_NFT_ORDER_REFUND_INFO = PREFIX.concat("nftOrder:refund:");// nft退款订单详情 orderId
public static final String REDIS_GOBLIN_NFT_ORDER_BUG_LOCK = PREFIX.concat("nftOrder:lock:userId:");// nft购买用户锁 userId
public static final String REDIS_GOBLIN_NFT_GOODS_LIST = PREFIX.concat("nftGoodsList");// nft商品列表
public static final String REDIS_GOBLIN_NFT_NUM_ACCOUNT = PREFIX.concat("nftNumAccount:");// nft用户数字账户是否开通 userId
......
package com.liquidnet.service.goblin.controller;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.service.impl.GoblinNftNumAccountServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@Slf4j
@Api(tags = "NFT数字账户-adam使用")
@RestController
@Validated
@RequestMapping("/nftNumAccount")
public class GoblinNftNumAccountController {
@Autowired
GoblinNftNumAccountServiceImpl accountService;
@PostMapping("sync")
@ApiOperation("数字账户开通同步通知")
@ApiImplicitParams({
@ApiImplicitParam(type = "form", dataType = "String", name = "userId", value = "用户ID", example = "1", required = true),
})
public ResponseDto<Boolean> syncNotice(
@RequestParam("userId") String userId
) {
Boolean notice = accountService.syncNotice(userId);
if (notice) {
return ResponseDto.success();
} else {
return ResponseDto.failure();
}
}
}
package com.liquidnet.service.goblin.service.impl;
import com.liquidnet.service.goblin.util.GoblinRedisUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
@Slf4j
public class GoblinNftNumAccountServiceImpl {
@Autowired
private GoblinRedisUtils goblinRedisUtils;
public Boolean syncNotice(String userId) {
// TODO: jxl 2022/4/6 请求adam
// 写入redis
goblinRedisUtils.setNftNumAccount(userId);
return true;
}
}
......@@ -1396,6 +1396,12 @@ public class GoblinRedisUtils {
return redisUtil.set(GoblinRedisConst.USER_DIGITAL_ARTWORK.concat(vo.getArtworkId()), vo, 259200);
}
//
public void setNftNumAccount(String userId) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_NFT_NUM_ACCOUNT.concat(userId);
// redisUtil.set(redisKey, 1);
}
/* ---------------------------------------- ---------------------------------------- */
/* ---------------------------------------- ---------------------------------------- */
}
......@@ -63,7 +63,13 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService {
return ResponseDto.failure("排队处理中,请勿重复操作~");
} else {
try {
// 基础参数
// 认证验证
boolean numAccount = goblinRedisUtils.getNftNumAccount(uid);
if (!numAccount) {
return ResponseDto.failure("您还未开通数字账户~");
}
// 是否存在此商品信息 是否隐藏
String skuId = payParam.getSkuId();
int number = 1;
GoblinGoodsSkuInfoVo skuVo = goblinRedisUtils.getGoodsSkuInfoVo(skuId);
......@@ -72,8 +78,6 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService {
}
String spuId = skuVo.getSpuId();
// TODO: jxl 2022/3/30 认证验证
// 判断是否藏品
if (!Objects.equals(1, skuVo.getSkuType())) {
return ResponseDto.failure("该商品不属于藏品~");
......
......@@ -400,4 +400,14 @@ public class GoblinRedisUtils {
return (List<String>) obj;
}
}
public boolean getNftNumAccount(String userId) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_NFT_NUM_ACCOUNT.concat(userId);
Object obj = redisUtil.get(redisKey);
if (obj == null) {
return false;
} else {
return true;
}
}
}
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