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

Commit 29b6b521 authored by zhanggb's avatar zhanggb

~queue:consumer-base.BIZ_ARTWORK:恢复;

parent de77ac07
......@@ -12,7 +12,6 @@ import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo;
import com.liquidnet.service.goblin.util.GoblinMongoUtils;
import com.liquidnet.service.goblin.util.GoblinRedisUtils;
import com.liquidnet.service.goblin.util.QueueUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -20,23 +19,26 @@ import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;
import org.springframework.data.redis.connection.stream.StreamRecords;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.LinkedList;
@Slf4j
@Service
public class GoblinQueBizArtworkClqService {
@Autowired
QueueUtils queueUtils;
@Autowired
GoblinRedisUtils goblinRedisUtils;
@Autowired
GoblinMongoUtils goblinMongoUtils;
@Autowired
MongoTemplate mongoTemplate;
@Autowired
StringRedisTemplate stringRedisTemplate;
@Resource(name = "galaxyArtworkServiceImpl")
private IGalaxyArtworkService galaxyArtworkService;
......@@ -76,15 +78,14 @@ public class GoblinQueBizArtworkClqService {
goblinRedisUtils.del(GoblinRedisConst.BASIC_GOODS_SKU.concat(skuId));
// Mysql持久化
// HashMap<String, String> sqlUpdateMap = CollectionUtil.mapStringString();
HashMap<String, String> sqlUpdateMap = CollectionUtil.mapStringString();
LinkedList<String> toMqSqls = CollectionUtil.linkedListString();
toMqSqls.add(SQL_UPDATE_GOODS_SKU_NFT);
LinkedList<Object[]> updateGoodsSkuNftObjs = CollectionUtil.linkedListObjectArr();
updateGoodsSkuNftObjs.add(new Object[]{1, seriesId, txHash, nftHash, chainTimestamp, now, skuId});
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_GOODS.getKey(), SqlMapping.gets(toMqSqls, updateGoodsSkuNftObjs));
// sqlUpdateMap.put(MQConst.QUEUE_MESSAGE_KEY, SqlMapping.gets(toMqSqls, updateGoodsSkuNftObjs));
// stringRedisTemplate.opsForStream().add(StreamRecords.mapBacked(sqlUpdateMap).withStreamKey(MQConst.GoblinQueue.SQL_GOODS.getKey()));
sqlUpdateMap.put(MQConst.QUEUE_MESSAGE_KEY, SqlMapping.gets(toMqSqls, updateGoodsSkuNftObjs));
stringRedisTemplate.opsForStream().add(StreamRecords.mapBacked(sqlUpdateMap).withStreamKey(MQConst.GoblinQueue.SQL_GOODS.getKey()));
return ResponseDto.success();
}
......
......@@ -15,7 +15,6 @@ import com.liquidnet.service.goblin.dto.vo.GoblinGoodsInfoVo;
import com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo;
import com.liquidnet.service.goblin.util.GoblinMongoUtils;
import com.liquidnet.service.goblin.util.GoblinRedisUtils;
import com.liquidnet.service.goblin.util.QueueUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -23,23 +22,27 @@ import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;
import org.springframework.data.redis.connection.stream.StreamRecords;
import org.springframework.data.redis.core.StreamOperations;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.LinkedList;
@Slf4j
@Service
public class GoblinQueBizArtworkUplService {
@Autowired
QueueUtils queueUtils;
@Autowired
GoblinRedisUtils goblinRedisUtils;
@Autowired
GoblinMongoUtils goblinMongoUtils;
@Autowired
MongoTemplate mongoTemplate;
@Autowired
StringRedisTemplate stringRedisTemplate;
@Resource(name = "galaxyArtworkServiceImpl")
private IGalaxyArtworkService galaxyArtworkService;
......@@ -102,23 +105,20 @@ public class GoblinQueBizArtworkUplService {
goblinRedisUtils.del(GoblinRedisConst.BASIC_GOODS_SKU.concat(skuId));
// Mysql持久化
// HashMap<String, String> sqlUpdateMap = CollectionUtil.mapStringString();
HashMap<String, String> sqlUpdateMap = CollectionUtil.mapStringString();
LinkedList<String> toMqSqls = CollectionUtil.linkedListString();
toMqSqls.add(SQL_UPDATE_GOODS_SKU_NFT);
LinkedList<Object[]> updateGoodsSkuNftObjs = CollectionUtil.linkedListObjectArr();
updateGoodsSkuNftObjs.add(new Object[]{upchain, displayUrl, nftUrl, skuId});
// sqlUpdateMap.put(MQConst.QUEUE_MESSAGE_KEY, SqlMapping.gets(toMqSqls, updateGoodsSkuNftObjs));
sqlUpdateMap.put(MQConst.QUEUE_MESSAGE_KEY, SqlMapping.gets(toMqSqls, updateGoodsSkuNftObjs));
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_GOODS.getKey(), SqlMapping.gets(toMqSqls, updateGoodsSkuNftObjs));
// StreamOperations<String, Object, Object> streamOperations = stringRedisTemplate.opsForStream();
// streamOperations.add(StreamRecords.mapBacked(sqlUpdateMap).withStreamKey(MQConst.GoblinQueue.SQL_GOODS.getKey()));
StreamOperations<String, Object, Object> streamOperations = stringRedisTemplate.opsForStream();
streamOperations.add(StreamRecords.mapBacked(sqlUpdateMap).withStreamKey(MQConst.GoblinQueue.SQL_GOODS.getKey()));
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.BIZ_ARTWORK_CLQ.getKey(), skuId.concat(",").concat(String.valueOf(LocalDateTime.now())));
// HashMap<String, String> toQueueBeClaimQueryMsg = CollectionUtil.mapStringString();
// toQueueBeClaimQueryMsg.put(MQConst.QUEUE_MESSAGE_KEY, skuId.concat(",").concat(String.valueOf(LocalDateTime.now())));
// streamOperations.add(StreamRecords.mapBacked(toQueueBeClaimQueryMsg).withStreamKey(MQConst.GoblinQueue.BIZ_ARTWORK_CLQ.getKey()));
// return true;
HashMap<String, String> toQueueBeClaimQueryMsg = CollectionUtil.mapStringString();
toQueueBeClaimQueryMsg.put(MQConst.QUEUE_MESSAGE_KEY, skuId.concat(",").concat(String.valueOf(LocalDateTime.now())));
streamOperations.add(StreamRecords.mapBacked(toQueueBeClaimQueryMsg).withStreamKey(MQConst.GoblinQueue.BIZ_ARTWORK_CLQ.getKey()));
return ResponseDto.success();
}
......
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