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

Commit bc010d65 authored by GaoHu's avatar GaoHu

Merge remote-tracking branch 'origin/dev_nft_411' into dev_nft_411

parents 2a623edf 38cc3042
......@@ -63,25 +63,26 @@ public class GoblinStoreMgtDigitalGoodsAddSkuParam implements Serializable {
@Min(value = 0, message = "线上库存必须大于0")
private Integer stock;
@ApiModelProperty(position = 22, required = false, value = "概率[0.01~100%],`unbox=1`时有效", example = "0")
@DecimalMin(value = "0", message = "概率超出可填范围0~100")
@DecimalMin(value = "0", message = "概率超出可填范围0.01~100")
@DecimalMax(value = "100", message = "概率超出可填范围0.01~100")
private BigDecimal hitRatio;
@ApiModelProperty(position = 23, required = true, value = "藏品价格[20,2]", example = "0.01")
@NotNull(message = "藏品价格不能为空")
@DecimalMin(value = "0.01", message = "藏品价格必须大于0")
private BigDecimal price;
@ApiModelProperty(position = 23, required = true, value = "IOS价格ID[20]", example = "NGoods1")
// @NotNull(message = "IOS价格ID不能为空")// TODO: 2022/4/8 ==zhanggb
@NotNull(message = "IOS价格ID不能为空")
private String productId;
// @ApiModelProperty(position = 24, required = false, value = "藏品会员价格[20,2]", example = "0")
// @DecimalMin(value = "0.01", message = "藏品会员价格必须大于0")
// private BigDecimal priceMember;
@ApiModelProperty(position = 25, required = false, value = "限购[0-无限制|X:限购数量],`unbox=0`时必传", example = "1")
// @NotNull(message = "限购数量不能为空")// TODO: 2022/4/11 ==zhanggb.open
@NotNull(message = "限购数量不能为空")
@Min(value = 1, message = "限购数量必须大于0")
private Integer buyLimit;
@ApiModelProperty(position = 26, required = false, value = "购买限制[0-全部用户|1-仅会员],`unbox=0`时必传", example = "0")
// @NotBlank(message = "购买条件不能为空")// TODO: 2022/4/11 ==zhanggb.open
@NotBlank(message = "购买条件不能为空")
@Pattern(regexp = "\\b(0|1)\\b", message = "购买条件参数无效")
private String buyFactor;
@ApiModelProperty(position = 27, required = false, value = "是否隐藏[0-默认展示|1-隐藏],`unbox=0`时必传", example = "0")
......@@ -167,6 +168,9 @@ public class GoblinStoreMgtDigitalGoodsAddSkuParam implements Serializable {
initVo.setSoldoutStatus("0");
initVo.setDelFlg("0");
initVo.setBuyLimit(this.getBuyLimit());//
initVo.setBuyFactor(this.getBuyFactor());//
initVo.setUnbox(notUnboxFlg ? "0" : "1");
if (notUnboxFlg) {
initVo.setSubtitle(this.getSubtitle());//0
......@@ -176,15 +180,15 @@ public class GoblinStoreMgtDigitalGoodsAddSkuParam implements Serializable {
initVo.setSkuStock(this.getStock());//0
// initVo.setGiftStock(this.getGiftStock());//0
initVo.setHitRatio(this.getHitRatio());//0
initVo.setBuyLimit(this.getBuyLimit());//0
initVo.setBuyFactor(this.getBuyFactor());//0
// initVo.setBuyLimit(this.getBuyLimit());//0
// initVo.setBuyFactor(this.getBuyFactor());//0
initVo.setSkuAppear(this.getSkuAppear());//0
initVo.setSkuCanbuy(this.getSkuCanbuy());//0
} else {
initVo.setStock(0);
initVo.setSkuStock(0);
initVo.setBuyLimit(this.getBuyLimit());//
initVo.setBuyFactor(this.getBuyFactor());//
// initVo.setBuyLimit(this.getBuyLimit());//
// initVo.setBuyFactor(this.getBuyFactor());//
initVo.setSkuAppear("0");
initVo.setSkuCanbuy("1");
initVo.setOpeningTime(DateUtil.Formatter.yyyyMMddHHmmss.parse(this.getOpeningTime()));//1
......@@ -203,17 +207,20 @@ public class GoblinStoreMgtDigitalGoodsAddSkuParam implements Serializable {
updateVo.setShelvesTime(this.getShelvesTime());
updateVo.setSaleStartTime(DateUtil.Formatter.yyyyMMddHHmmss.parse(this.getSaleStartTime()));
updateVo.setBuyLimit(this.getBuyLimit());//
updateVo.setBuyFactor(this.getBuyFactor());//
switch (this.getUnbox()) {
case "0":
updateVo.setHitRatio(this.getHitRatio());//0
updateVo.setBuyLimit(this.getBuyLimit());//0
updateVo.setBuyFactor(this.getBuyFactor());//0
// updateVo.setBuyLimit(this.getBuyLimit());//0
// updateVo.setBuyFactor(this.getBuyFactor());//0
updateVo.setSkuAppear(this.getSkuAppear());//0
updateVo.setSkuCanbuy(this.getSkuCanbuy());//0
break;
case "1":
updateVo.setBuyLimit(this.getBuyLimit());//
updateVo.setBuyFactor(this.getBuyFactor());//
// updateVo.setBuyLimit(this.getBuyLimit());//
// updateVo.setBuyFactor(this.getBuyFactor());//
updateVo.setSkuAppear("0");//
updateVo.setSkuCanbuy("1");//
updateVo.setName(this.getName());//1
......
......@@ -2,7 +2,6 @@ package com.liquidnet.service.consumer.kylin.config;
import com.liquidnet.common.cache.redis.config.RedisStreamConfig;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.consumer.kylin.receiver.ConsumerGoblinBizArtworkGenRdsReceiver;
import com.liquidnet.service.consumer.kylin.receiver.ConsumerGoblinBizArtworkClqRdsReceiver;
import com.liquidnet.service.consumer.kylin.receiver.ConsumerGoblinBizArtworkUplRdsReceiver;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -28,8 +27,8 @@ public class ConsumerCommonBizRedisStreamConfig extends RedisStreamConfig {
ConsumerGoblinBizArtworkUplRdsReceiver consumerGoblinBizArtworkUplRdsReceiver;
@Autowired
ConsumerGoblinBizArtworkClqRdsReceiver consumerGoblinBizArtworkClqRdsReceiver;
@Autowired
ConsumerGoblinBizArtworkGenRdsReceiver consumerGoblinBizArtworkGenRdsReceiver;
// @Autowired
// ConsumerGoblinBizArtworkGenRdsReceiver consumerGoblinBizArtworkGenRdsReceiver;
@Bean// 藏品上传声明
public List<Subscription> subscriptionBizArtworkUpl(RedisConnectionFactory factory) {
......@@ -63,19 +62,19 @@ public class ConsumerCommonBizRedisStreamConfig extends RedisStreamConfig {
return subscriptionList;
}
@Bean// 藏品生成
public List<Subscription> subscriptionBizArtworkGen(RedisConnectionFactory factory) {
List<Subscription> subscriptionList = new ArrayList<>();
MQConst.GoblinQueue stream = MQConst.GoblinQueue.BIZ_ARTWORK_GEN;
this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup());
for (int i = 0; i < 20; 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()), consumerGoblinBizArtworkGenRdsReceiver
));
listenerContainer.start();
}
return subscriptionList;
}
// @Bean// 藏品生成
// public List<Subscription> subscriptionBizArtworkGen(RedisConnectionFactory factory) {
// List<Subscription> subscriptionList = new ArrayList<>();
// MQConst.GoblinQueue stream = MQConst.GoblinQueue.BIZ_ARTWORK_GEN;
// this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup());
// for (int i = 0; i < 20; 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()), consumerGoblinBizArtworkGenRdsReceiver
// ));
// listenerContainer.start();
// }
// return subscriptionList;
// }
}
......@@ -79,12 +79,12 @@ public abstract class AbstractOrderCloseReceiver implements StreamListener<Strin
long durationToMillis = Duration.between(createdAt, closeTime).toMillis();
if (durationToMillis >= 0) {
if (type.equals("GOBLIN")) {
switch (type) {
case "GOBLIN":
return checkOrderTime(orderCode, type);
}
if (type.equals("NFT")) {
case "NFT":
return checkNftOrderTime(orderCode);
} else {
default:
return false;
}
} else {
......
......@@ -890,18 +890,23 @@ public class GoblinStoreMgtGoodsController {
if (mgtGoodsInfoVo.getSpuType() == 0) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "无效操作,该商品非数字藏品");
}
BigDecimal hitRatio = mgtDigitalGoodsEditSkuParam.getHitRatio();
if (null != hitRatio && hitRatio.scale() > 2) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "概率值只支持小数点后两位");
}
if ("3".equals(mgtDigitalGoodsEditSkuParam.getShelvesHandle()) && StringUtils.isEmpty(mgtDigitalGoodsEditSkuParam.getShelvesTime())) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "请指定预约上架时间");
}
mgtDigitalGoodsEditSkuParam.setUnbox(mgtGoodsSkuInfoVo.getUnbox());
switch (mgtGoodsSkuInfoVo.getUnbox()) {
case "0":// 非盲盒
if (null == mgtDigitalGoodsEditSkuParam.getBuyLimit()) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "限购数量不能为空");
}
String buyFactor = mgtDigitalGoodsEditSkuParam.getBuyFactor();
if (StringUtils.isEmpty(buyFactor))
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "请指定藏品购买条件");
// if (null == mgtDigitalGoodsEditSkuParam.getBuyLimit()) {
// return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "限购数量不能为空");
// }
// String buyFactor = mgtDigitalGoodsEditSkuParam.getBuyFactor();
// if (StringUtils.isEmpty(buyFactor)) {
// return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "请指定藏品购买条件");
// }
// if (buyFactor.equals("2")) {// 购买条件:指定用户时
// if (StringUtils.isEmpty(mgtDigitalGoodsEditSkuParam.getBuyRosterType())) {
// return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "请指定购买限制人员名单操作类型");
......@@ -1057,12 +1062,13 @@ public class GoblinStoreMgtGoodsController {
if (goodsInfoVo.getSpuType() == 0) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "无效操作,该商品非数字藏品");
}
BigDecimal hitRatio = mgtDigitalGoodsAddSkuParam.getHitRatio();
if (null != hitRatio && hitRatio.scale() > 2) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "概率值只支持小数点后两位");
}
if (goblinMongoUtils.countMgtGoodsSkuInfoVo(mgtDigitalGoodsAddSkuParam.getName(), 1) > 0) {
return ResponseDto.failure(ErrorMapping.get("149018"));
}
if (StringUtils.isBlank(mgtDigitalGoodsAddSkuParam.getProductId())) {// TODO: 2022/4/8 ==zhanggb.del
mgtDigitalGoodsAddSkuParam.setProductId("NGoods1");
}
JsonNode priceVNode = goblinRedisUtils.getIosProducts().get(mgtDigitalGoodsAddSkuParam.getProductId());
if (null == priceVNode) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "无效的IOS商品ID");
......@@ -1076,13 +1082,13 @@ public class GoblinStoreMgtGoodsController {
if (StringUtils.isEmpty(mgtDigitalGoodsAddSkuParam.getMaterialType()) || StringUtils.isBlank(mgtDigitalGoodsAddSkuParam.getMaterialUrl())) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "我的藏品展示类型或文件不能为空");
}
if (null == mgtDigitalGoodsAddSkuParam.getBuyLimit()) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "限购数量不能为空");
}
String buyFactor = mgtDigitalGoodsAddSkuParam.getBuyFactor();
if (StringUtils.isEmpty(buyFactor)) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "请指定藏品购买条件");
}
// if (null == mgtDigitalGoodsAddSkuParam.getBuyLimit()) {
// return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "限购数量不能为空");
// }
// String buyFactor = mgtDigitalGoodsAddSkuParam.getBuyFactor();
// if (StringUtils.isEmpty(buyFactor)) {
// return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "请指定藏品购买条件");
// }
// if (buyFactor.equals("2")) {// 购买条件:指定用户时
// if (StringUtils.isEmpty(mgtDigitalGoodsAddSkuParam.getBuyRosterType())) {
// return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "请指定购买限制人员名单操作类型");
......@@ -1092,12 +1098,6 @@ public class GoblinStoreMgtGoodsController {
// }
// }
} else {// 盲盒校验
if (null == mgtDigitalGoodsAddSkuParam.getBuyLimit()) {// TODO: 2022/4/11 ==zhanggb.del
mgtDigitalGoodsAddSkuParam.setBuyLimit(1);
}
if (StringUtils.isEmpty(mgtDigitalGoodsAddSkuParam.getBuyFactor())) {// TODO: 2022/4/11 ==zhanggb.del
mgtDigitalGoodsAddSkuParam.setBuyFactor("0");
}
if (StringUtils.isEmpty(mgtDigitalGoodsAddSkuParam.getOpeningTime())) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "盲盒开启时间不能为空");
}
......
......@@ -1472,6 +1472,13 @@ public class GoblinMongoUtils {
return pagedResult.setList(voList).setTotal(count, 20);
}
/**
* 记录用户藏品数据
*/
public void insertUserDigitalArtworkVo(GoblinUserDigitalArtworkVo vo) {
mongoTemplate.insert(vo, GoblinUserDigitalArtworkVo.class.getSimpleName());
}
/* ---------------------------------------- ---------------------------------------- */
/* ---------------------------------------- ---------------------------------------- */
}
......@@ -1544,6 +1544,9 @@ public class GoblinRedisUtils {
/* ---------------------------------------- 我的藏品 ---------------------------------------- */
/**
* 获取用户藏品ID集合
*/
public List<String> getUserDigitalArtworkIds(String uid) {
return (List<String>) redisUtil.get(GoblinRedisConst.USER_DIGITAL_ARTWORK_IDS.concat(uid));
}
......@@ -1561,6 +1564,9 @@ public class GoblinRedisUtils {
return (GoblinUserDigitalArtworkVo) redisUtil.get(GoblinRedisConst.USER_DIGITAL_ARTWORK.concat(artworkId));
}
/**
* 缓存用户藏品详情
*/
public boolean setUserDigitalArtworkVo(GoblinUserDigitalArtworkVo vo) {
return redisUtil.set(GoblinRedisConst.USER_DIGITAL_ARTWORK.concat(vo.getArtworkId()), vo);
}
......@@ -1573,6 +1579,40 @@ public class GoblinRedisUtils {
return redisUtil.set(GoblinRedisConst.USER_DIGITAL_ARTWORK.concat(vo.getArtworkId()), vo, 259200);
}
/* ----------------------------------- 我的藏品生成 ----------------------------------- */
/**
* 标记订单藏品生成
*/
public boolean markGenUserDigitalArtwork(String uid, String skuId, String orderId) {
return redisUtil.set(GoblinRedisConst.USER_DIGITAL_ARTWORK_GENMARK.concat(uid).concat(skuId).concat(orderId), 1, 259200);
}
/**
* 判断订单藏品生成
*/
public boolean hasGenUserDigitalArtwork(String uid, String skuId, String orderId) {
return redisUtil.hasKey(GoblinRedisConst.USER_DIGITAL_ARTWORK_GENMARK.concat(uid).concat(skuId).concat(orderId));
}
/**
* 缓存并更新用户藏品ID集合
*/
public boolean addUserDigitalArtworkIds(String uid, String artworkId) {
List<String> ids = this.getUserDigitalArtworkIds(uid);
if (CollectionUtils.isEmpty(ids)) {
ids = CollectionUtil.arrayListString();
ids.add(artworkId);
} else {
ids.add(0, artworkId);
int size = ids.size();
if (size > 30) ids.remove(size - 1);
}
return redisUtil.set(GoblinRedisConst.USER_DIGITAL_ARTWORK_IDS.concat(uid), ids);
}
/* ----------------------------------- ---------- ----------------------------------- */
// 记录用户开通数字账户
public void setNftNumAccount(String userId) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_NFT_NUM_ACCOUNT.concat(userId);
......
......@@ -130,6 +130,7 @@ goblin_store_coupon_rule.update_del=UPDATE goblin_store_coupon_rule SET del_flg=
goblin_user_coupon.insert=INSERT INTO goblin_user_coupon (ucoupon_id, store_coupon_id, uid, state, bind_at, dued_at, operator, created_at)VALUES(?,?,?,?,?,?,?,?)
goblin_user_coupon.updateState=UPDATE goblin_user_coupon SET state = ? , used_for = ? ,updated_at = ? where ucoupon_id = ?
#---- \u6211\u7684\u85CF\u54C1
goblin_user_digital_artwork.insert=INSERT INTO goblin_user_digital_artwork (artwork_id, sku_id, uid, order_id, source, state, created_at)VALUES(?,?,?,?,?,?,?)
goblin_user_digital_artwork.update_for_chain=UPDATE goblin_user_digital_artwork SET edition_sn=?,nft_id=?,release_txhash=?,release_at=?,trading_txhash=?,trading_at=?,state=?,updated_at=? WHERE artwork_id=? AND state<>1
goblin_user_digital_artwork.update_for_unboxing=UPDATE goblin_user_digital_artwork SET state=1,del_flg='1',opening_at=?,updated_at=?,deleted_at=? WHERE artwork_id=? AND state<>1
#----
......
package com.liquidnet.service.order.service.impl;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.liquidnet.commons.lang.util.*;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.base.SqlMapping;
......@@ -645,12 +646,13 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService {
SqlMapping.gets(sqls, sqlDataOrder));
// 通知生成藏品
GoblinQueueBizArtworkGenDto artworkGenDto = GoblinQueueBizArtworkGenDto.getNew();
artworkGenDto.setOrderId(orderId);
artworkGenDto.setUid(uid);
artworkGenDto.setSkuId(orderVo.getSkuId());
artworkGenDto.setSource(1);
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.BIZ_ARTWORK_GEN.getKey(), artworkGenDto.toJson());
// GoblinQueueBizArtworkGenDto artworkGenDto = GoblinQueueBizArtworkGenDto.getNew();
// artworkGenDto.setOrderId(orderId);
// artworkGenDto.setUid(uid);
// artworkGenDto.setSkuId(orderVo.getSkuId());
// artworkGenDto.setSource(1);
// queueUtils.sendMsgByRedis(MQConst.GoblinQueue.BIZ_ARTWORK_GEN.getKey(), artworkGenDto.toJson());
this.generateUserArtwork(orderVo);
// 增加销量
goblinRedisUtils.incrSkuSaleCount(orderVo.getSpuId(), orderVo.getSkuId(), orderVo.getNum());
......@@ -730,4 +732,60 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService {
}
return "success";
}
/* --------------------------------------------------------------------------------- */
/**
* 生成我的藏品
*
* @param orderVo
*/
private void generateUserArtwork(GoblinNftOrderVo orderVo) {
String uid = orderVo.getUserId(), skuId = orderVo.getSkuId(), orderId = orderVo.getOrderId(), spuId = orderVo.getSpuId();
Integer source = 1;
if (goblinRedisUtils.hasGenUserDigitalArtwork(uid, skuId, orderId)) {// 已生成
log.warn("#GEN_ARTWORK EXIST_ART[uid={},skuId={},orderId={},source={}]", uid, skuId, orderId, source);
return;
}
GoblinGoodsInfoVo goodsInfoVo = goblinRedisUtils.getGoodsInfoVo(spuId);
LocalDateTime now = LocalDateTime.now();
GoblinUserDigitalArtworkVo digitalArtworkVo = GoblinUserDigitalArtworkVo.getNew();
String artworkId = IDGenerator.nextMilliId2();
digitalArtworkVo.setArtworkId(artworkId);
digitalArtworkVo.setSkuId(skuId);
digitalArtworkVo.setUid(uid);
digitalArtworkVo.setOrderId(orderId);
digitalArtworkVo.setSource(source);
digitalArtworkVo.setState(0);
digitalArtworkVo.setDelFlg("0");
digitalArtworkVo.setCreatedAt(now);
digitalArtworkVo.setAuthor(goodsInfoVo.getAuthor());
digitalArtworkVo.setPublisher(goodsInfoVo.getPublisher());
// Mongo记录VO
goblinMongoUtils.insertGoblinUserDigitalArtworkVo(digitalArtworkVo);
// Redis记录VO
goblinRedisUtils.setGoblinUserDigitalArtworkVo(digitalArtworkVo);
// Redis更新藏品ID列表
goblinRedisUtils.addGoblinUserDigitalArtworkIds(uid, artworkId);
// 缓存用户藏品数
goblinRedisUtils.incrGoblinUserDigitalArtworks(uid);
// Redis生成标记(缓存三天),用于上面的生成检查
goblinRedisUtils.markGenUserDigitalArtwork(uid, skuId, orderId);
GoblinGoodsSkuInfoVo goodsSkuInfoVo = goblinRedisUtils.getGoodsSkuInfoVo(skuId);
if ("0".equals(goodsSkuInfoVo.getUnbox())) {// 非盲盒,NFT发行购买
ObjectNode bizNftBuyNode = JsonUtils.OM().createObjectNode().put("nftOrderPayId", orderId).put("routerType", goodsSkuInfoVo.getRouteType())
.put("skuId", skuId).put("userId", uid).put("buyTimestamp", DateUtil.Formatter.yyyyMMddHHmmss.format(now));;
queueUtils.sendMsgByRedis(MQConst.GalaxyQueue.JSON_NFT_PUBLISH_AND_BUY.getKey(), bizNftBuyNode.toString());
}
// Mysql持久化
LinkedList<String> toMqSqls = CollectionUtil.linkedListString();
toMqSqls.add(SqlMapping.get("goblin_user_digital_artwork.insert"));
LinkedList<Object[]> initUserDigitalArtworkObjs = CollectionUtil.linkedListObjectArr();
initUserDigitalArtworkObjs.add(new Object[]{digitalArtworkVo.getArtworkId(), skuId, uid, orderId, source, digitalArtworkVo.getState(), now});
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_ARTWORK_GEN.getKey(), SqlMapping.gets(toMqSqls, initUserDigitalArtworkObjs));
}
}
......@@ -136,4 +136,10 @@ public class GoblinMongoUtils {
object);
}
/**
* 记录用户藏品数据
*/
public void insertGoblinUserDigitalArtworkVo(GoblinUserDigitalArtworkVo vo) {
mongoTemplate.insert(vo, GoblinUserDigitalArtworkVo.class.getSimpleName());
}
}
......@@ -4,15 +4,9 @@ import com.fasterxml.jackson.core.type.TypeReference;
import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.commons.lang.util.RandomUtil;
import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import com.liquidnet.service.goblin.constant.GoblinStatusConst;
import com.liquidnet.service.goblin.dto.GoblinStoreMarketDto;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinMgtCategorySpecVo;
import com.liquidnet.service.goblin.dto.vo.*;
import com.liquidnet.service.goblin.entity.GoblinFrontBanner;
import com.liquidnet.service.goblin.entity.GoblinFrontHotWord;
import com.liquidnet.service.goblin.entity.GoblinFrontNavigation;
import com.liquidnet.service.kylin.constant.KylinRedisConst;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
......@@ -20,11 +14,8 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import static com.liquidnet.service.goblin.constant.GoblinRedisConst.REDIS_GOBLIN_TEMP_COUPON_MARKET;
@Component
public class GoblinRedisUtils {
@Autowired
......@@ -410,4 +401,68 @@ public class GoblinRedisUtils {
return true;
}
}
/* ----------------------------------- 我的藏品生成 ----------------------------------- */
/**
* 标记订单藏品生成
*/
public boolean markGenUserDigitalArtwork(String uid, String skuId, String orderId) {
return redisUtil.set(GoblinRedisConst.USER_DIGITAL_ARTWORK_GENMARK.concat(uid).concat(skuId).concat(orderId), 1, 259200);
}
/**
* 判断订单藏品生成
*/
public boolean hasGenUserDigitalArtwork(String uid, String skuId, String orderId) {
return redisUtil.hasKey(GoblinRedisConst.USER_DIGITAL_ARTWORK_GENMARK.concat(uid).concat(skuId).concat(orderId));
}
/**
* 缓存用户藏品详情
*/
public boolean setGoblinUserDigitalArtworkVo(GoblinUserDigitalArtworkVo vo) {
return redisUtil.set(GoblinRedisConst.USER_DIGITAL_ARTWORK.concat(vo.getArtworkId()), vo);
}
/**
* 获取用户藏品ID集合
*/
public List<String> getGoblinUserDigitalArtworkIds(String uid) {
return (List<String>) redisUtil.get(GoblinRedisConst.USER_DIGITAL_ARTWORK_IDS.concat(uid));
}
/**
* 缓存用户藏品ID集合
*/
public boolean setGoblinUserDigitalArtworkIds(String uid, List<String> userDigitalArtworkIds) {
return redisUtil.set(GoblinRedisConst.USER_DIGITAL_ARTWORK_IDS.concat(uid), userDigitalArtworkIds);
}
/**
* 缓存并更新用户藏品ID集合
*/
public boolean addGoblinUserDigitalArtworkIds(String uid, String artworkId) {
List<String> ids = this.getGoblinUserDigitalArtworkIds(uid);
if (CollectionUtils.isEmpty(ids)) {
ids = CollectionUtil.arrayListString();
ids.add(artworkId);
} else {
ids.add(0, artworkId);
int size = ids.size();
if (size > 30) ids.remove(size - 1);
}
return redisUtil.set(GoblinRedisConst.USER_DIGITAL_ARTWORK_IDS.concat(uid), ids);
}
/**
* 缓存用户累计藏品数
*/
public long incrGoblinUserDigitalArtworks(String uid) {
return redisUtil.incr(GoblinRedisConst.USER_DIGITAL_ARTWORK_CT.concat(uid), 1);
}
/* ----------------------------------- ---------- ----------------------------------- */
/* ----------------------------------- ----------------------------------- */
}
kylin_order_ticket_entities.updateStatusByStation=UPDATE kylin_order_ticket_entities SET `status`=?,check_client=?,updated_at=? WHERE order_ticket_entities_id=?
# ------------------------缺票登记(不用考虑并发)----------------------------
# ------------------------\u7F3A\u7968\u767B\u8BB0(\u4E0D\u7528\u8003\u8651\u5E76\u53D1)----------------------------
kylin_lack_register.insert=INSERT INTO `kylin_lack_registers`(`lack_registers_id` ,`performance_id` ,`ticket_id` ,`user_id` ,`user_name` ,`user_mobile` ,`send_status` ,`ip_address` ,`created_at`)VALUES(? ,? ,? ,? ,? ,? ,? ,? ,?);
# ------------------------PV/UV----------------------------
bi_ticket_access_records.insert=INSERT INTO `bi_ticket_access_records` ( `user_id`, `access_type`, `performance_id`, `order_id`, `order_code`,`ip_address`, `area`, `area_province`, `area_city`, `area_county`,`created_at`) VALUES (?,?,?,?,?,?,?,?,?,?,?);
# ------------------------创建订单----------------------------
# ------------------------\u521B\u5EFA\u8BA2\u5355----------------------------
kylin_order_ticket.add=INSERT INTO kylin_order_tickets(order_tickets_id,user_id,user_name,user_mobile,performance_title,order_code,qr_code,order_type,order_version,`number`,price,price_member,price_total,price_voucher,price_actual,price_express,price_refund,refund_number,pay_type,payment_type,time_pay,express_contacts,express_address,express_phone,coupon_type,get_ticket_type,get_ticket_describe,pay_countdown_minute,`comment`,created_at,updated_at,pay_code,ip_address,area,area_province,area_city,area_county)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
kylin_order_ticket_relation.add=INSERT INTO kylin_order_ticket_relations(order_ticket_relations_id ,order_id ,transfer_id ,live_id ,agent_id ,is_member ,performance_id ,time_id ,ticket_id ,created_at ,updated_at,agent_status,agent_distributions,agent_id_master,agent_distributions_master)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
kylin_order_ticket_status.add=INSERT INTO kylin_order_ticket_status(order_ticket_status_id ,order_id ,express_type ,is_student ,transfer_status ,`status` ,pay_status , produce_code ,created_at ,updated_at)VALUES(?,?,?,?,?,?,?,?,?,?)
kylin_order_ticket_entities.add=INSERT INTO kylin_order_ticket_entities(order_ticket_entities_id ,order_id ,ticket_id ,user_id ,time_id ,performance_id ,enter_type ,enter_name ,enter_mobile,enter_id_code,`status`,sys_damai,check_client,is_payment,`comment`,created_at,updated_at)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
kylin_order_coupon.add=INSERT INTO kylin_order_coupons(order_id ,coupon_code ,coupon_type ,coupon_price,created_at,updated_at)VALUES(?,?,?,?,?,?)
# ------------------------再次支付----------------------------
# ------------------------\u518D\u6B21\u652F\u4ED8----------------------------
kylin_order_ticket.payAgain=UPDATE kylin_order_tickets SET updated_at = ? , pay_code = ?, pay_type = ? WHERE order_tickets_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
kylin_order_ticket_status.payAgain=UPDATE kylin_order_ticket_status SET updated_at = ? WHERE order_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
kylin_order_ticket_relation.payAgain=UPDATE kylin_order_ticket_relations SET updated_at = ? WHERE order_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
kylin_order_ticket_entities.payAgain=UPDATE kylin_order_ticket_entities SET updated_at = ? WHERE order_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
# ------------------------支付回调----------------------------
# ------------------------\u652F\u4ED8\u56DE\u8C03----------------------------
kylin_order_ticket.synPay=UPDATE kylin_order_tickets SET payment_id =? ,payment_type = ? ,pay_code = ? , time_pay = ?, qr_code = ? , updated_at = ? WHERE order_tickets_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
kylin_order_ticket_status.synPay=UPDATE kylin_order_ticket_status SET `status` = ?,pay_status = ?,updated_at = ? WHERE order_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
kylin_order_ticket_relation.synPay=UPDATE kylin_order_ticket_relations SET updated_at = ? WHERE order_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
kylin_order_ticket_entities.synPay=UPDATE kylin_order_ticket_entities SET is_payment = ?,updated_at = ?,sys_damai = 1 WHERE order_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
# ------------------------超时支付申请退款----------------------------
# ------------------------\u8D85\u65F6\u652F\u4ED8\u7533\u8BF7\u9000\u6B3E----------------------------
kylin_order_ticket_status.overtimeRefund=UPDATE kylin_order_ticket_status SET status = ? ,updated_at = ? WHERE order_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
kylin_order_tickets.overtimeRefund=UPDATE kylin_order_tickets SET payment_id = ? , payment_type = ? ,updated_at = ? WHERE order_tickets_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
kylin_order_ticket_entities.overtimeRefund=UPDATE kylin_order_ticket_entities SET is_payment = ? ,updated_at = ? WHERE order_ticket_entities_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
......@@ -29,13 +29,13 @@ kylin_order_refund_entities.overtimeRefund=INSERT INTO kylin_order_refund_entiti
#-------- 商城 -------
#-------- \u5546\u57CE -------
goblin.order.create.order_insert=INSERT INTO goblin_store_order (`master_order_code`,`order_id`,`store_id`,`store_name`,`order_code`,`user_id`,`user_name`,`user_mobile`,`price_total`,`pay_code`,`price_actual`,`price_refund`,`price_express`,`price_coupon`,`store_price_coupon`,`price_voucher`,`status`,`ucoupon_id`,`store_coupon_id`,`pay_type`,`device_from`,`source`,`version`,`is_member`,`order_type`,`write_off_code`,`pay_countdown_minute`,`ip_address`,`market_id`,`market_type`,`created_at`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
goblin.order.create.attr_insert=INSERT INTO goblin_order_attr (`order_attr_id`,`order_id`,`express_contacts`,`express_address`,`express_address_detail`,`express_phone`,`express_type`,`created_at`) VALUES (?,?,?,?,?,?,?,?)
goblin.order.create.sku_insert=INSERT INTO goblin_order_sku (`order_sku_id`,`order_id`,`spu_id`,`spu_name`,`spu_pic`,`sku_id`,`num`,`sku_price`,`sku_price_actual`,`sku_name`,`sku_no`,`sku_image`,`sku_specs`,`price_voucher`,`created_at`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
#---- 再次支付
#---- \u518D\u6B21\u652F\u4ED8
goblin_order.pay.again=UPDATE goblin_store_order SET pay_type = ? ,device_from = ? ,pay_code = ? WHERE order_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
#---- 订单创建&支付
#---- \u8BA2\u5355\u521B\u5EFA&\u652F\u4ED8
goblin_order.pay.order=UPDATE goblin_store_order SET payment_type = ? ,payment_id=?,pay_code = ? ,pay_time = ?,write_off_code = ? ,status = ? ,updated_at = ? WHERE order_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
goblin_order.pay.sku=UPDATE goblin_order_sku SET status = ? ,updated_at = ? WHERE order_sku_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
goblin_order.store.refundPrice=UPDATE goblin_store_order SET price_refund = ? ,status = ? , updated_at = ? WHERE order_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
......@@ -52,3 +52,4 @@ goblin_nft_order.update.pay=UPDATE goblin_nft_order SET payment_type = ?, paymen
goblin_nft_order.update.refund=UPDATE goblin_nft_order SET status = ?, updated_at = ? WHERE order_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
goblin_nft_order_refund.insert=INSERT INTO goblin_nft_order_refund (`order_refund_id`,`refund_code`,`order_id`,`order_code`,`store_id`,`user_id`,`price`,`status`,`error_reason`,`created_at`) VALUES (?,?,?,?,?,?,?,?,?,?)
goblin_nft_order_refund.refund=UPDATE goblin_nft_order_refund SET status = ?, refund_at = ?, updated_at = ? WHERE order_refund_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
goblin_user_digital_artwork.insert=INSERT INTO goblin_user_digital_artwork (artwork_id, sku_id, uid, order_id, source, state, created_at)VALUES(?,?,?,?,?,?,?)
\ No newline at end of file
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