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

Commit 3b4771c8 authored by zhanggb's avatar zhanggb

~que:GoblinQueue.BIZ_ARTWORK_UPL:重新入队调整;

parent 0f1f5550
...@@ -58,11 +58,12 @@ public class ConsumerGoblinBizArtworkUplReceiver extends AbstractBizRedisReceive ...@@ -58,11 +58,12 @@ public class ConsumerGoblinBizArtworkUplReceiver extends AbstractBizRedisReceive
try { try {
postDataMap.add("skuId", skuId); postDataMap.add("skuId", skuId);
String postRespStr = HttpUtil.post(postUrl, postDataMap); String postRespStr = HttpUtil.post(postUrl, postDataMap);
JsonNode postRespJNode = JsonUtils.fromJson(postRespStr, JsonNode.class), postRespCode; // 失败重新入队逻辑改至`被调用API`实现
if (null == postRespJNode || null == (postRespCode = postRespJNode.get("code")) || !postRespCode.asText().equals("0")) { // JsonNode postRespJNode = JsonUtils.fromJson(postRespStr, JsonNode.class), postRespCode;
log.warn("#NFT素材上传:处理失败[paramsStr={},postRespStr={}]", postDataMap, postRespStr); // if (null == postRespJNode || null == (postRespCode = postRespJNode.get("code")) || !postRespCode.asText().equals("0")) {
return false; // log.warn("#NFT素材上传:处理失败[paramsStr={},postRespStr={}]", postDataMap, postRespStr);
} // return false;
// }
return true; return true;
} catch (Exception e) { } catch (Exception e) {
log.error("Ex.NFT素材上传:处理异常[url={},paramsStr={}],ex:{}", postUrl, postDataMap, e.getMessage()); log.error("Ex.NFT素材上传:处理异常[url={},paramsStr={}],ex:{}", postUrl, postDataMap, e.getMessage());
......
...@@ -15,6 +15,7 @@ import com.liquidnet.service.goblin.dto.vo.GoblinGoodsInfoVo; ...@@ -15,6 +15,7 @@ import com.liquidnet.service.goblin.dto.vo.GoblinGoodsInfoVo;
import com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo; import com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo;
import com.liquidnet.service.goblin.util.GoblinMongoUtils; import com.liquidnet.service.goblin.util.GoblinMongoUtils;
import com.liquidnet.service.goblin.util.GoblinRedisUtils; import com.liquidnet.service.goblin.util.GoblinRedisUtils;
import com.liquidnet.service.goblin.util.QueueUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -35,6 +36,8 @@ import java.util.LinkedList; ...@@ -35,6 +36,8 @@ import java.util.LinkedList;
@Slf4j @Slf4j
@Service @Service
public class GoblinQueBizArtworkUplService { public class GoblinQueBizArtworkUplService {
@Autowired
QueueUtils queueUtils;
@Autowired @Autowired
GoblinRedisUtils goblinRedisUtils; GoblinRedisUtils goblinRedisUtils;
@Autowired @Autowired
...@@ -50,6 +53,7 @@ public class GoblinQueBizArtworkUplService { ...@@ -50,6 +53,7 @@ public class GoblinQueBizArtworkUplService {
private static final String SQL_UPDATE_GOODS_SKU_NFT = "UPDATE goblin_goods_sku_nft SET upchain=?,display_url=?,nft_url=? WHERE sku_id=? AND upchain=0 "; private static final String SQL_UPDATE_GOODS_SKU_NFT = "UPDATE goblin_goods_sku_nft SET upchain=?,display_url=?,nft_url=? WHERE sku_id=? AND upchain=0 ";
public ResponseDto<String> bizArtworkUplProcessing(String skuId) { public ResponseDto<String> bizArtworkUplProcessing(String skuId) {
try {
GoblinGoodsSkuInfoVo mgtGoodsSkuInfoVo = goblinMongoUtils.getGoodsSkuInfoVo(skuId); GoblinGoodsSkuInfoVo mgtGoodsSkuInfoVo = goblinMongoUtils.getGoodsSkuInfoVo(skuId);
if (null == mgtGoodsSkuInfoVo) { if (null == mgtGoodsSkuInfoVo) {
log.warn("#NFT素材上传:藏品SKU不存在[skuId={}]", skuId); log.warn("#NFT素材上传:藏品SKU不存在[skuId={}]", skuId);
...@@ -73,6 +77,8 @@ public class GoblinQueBizArtworkUplService { ...@@ -73,6 +77,8 @@ public class GoblinQueBizArtworkUplService {
galaxyNftUploadReqDto.setRouterType(mgtGoodsSkuInfoVo.getRouteType()); galaxyNftUploadReqDto.setRouterType(mgtGoodsSkuInfoVo.getRouteType());
GalaxyNftUploadRespDto galaxyNftUploadRespDto = this.uploadNftMaterial(galaxyNftUploadReqDto); GalaxyNftUploadRespDto galaxyNftUploadRespDto = this.uploadNftMaterial(galaxyNftUploadReqDto);
if (null == galaxyNftUploadRespDto) { if (null == galaxyNftUploadRespDto) {
log.warn("#NFT素材上传:处理失败[skuId={}]", skuId);
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.BIZ_ARTWORK_UPL.getKey(), skuId);
return ResponseDto.failure(String.format("藏品上传失败[skuId:%s]", skuId));// 上传失败,重新入队处理 return ResponseDto.failure(String.format("藏品上传失败[skuId:%s]", skuId));// 上传失败,重新入队处理
} }
...@@ -119,6 +125,11 @@ public class GoblinQueBizArtworkUplService { ...@@ -119,6 +125,11 @@ public class GoblinQueBizArtworkUplService {
HashMap<String, String> toQueueBeClaimQueryMsg = CollectionUtil.mapStringString(); HashMap<String, String> toQueueBeClaimQueryMsg = CollectionUtil.mapStringString();
toQueueBeClaimQueryMsg.put(MQConst.QUEUE_MESSAGE_KEY, skuId.concat(",").concat(String.valueOf(LocalDateTime.now()))); 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())); streamOperations.add(StreamRecords.mapBacked(toQueueBeClaimQueryMsg).withStreamKey(MQConst.GoblinQueue.BIZ_ARTWORK_CLQ.getKey()));
} catch (Exception e) {
log.error("Ex.NFT素材上传:处理异常[skuId={}]", skuId, e);
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.BIZ_ARTWORK_UPL.getKey(), skuId);
return ResponseDto.failure(String.format("藏品上传异常[skuId:%s]", skuId));
}
return ResponseDto.success(); 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