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

Commit f8b13145 authored by jiangxiulong's avatar jiangxiulong

支付回调超时支付也记录支付信息

parent 3fc0a7cb
......@@ -598,53 +598,56 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService {
if (Objects.equals(1, syncOrderParam.getStatus())) {
String uid = orderVo.getUserId();
Integer orderStatusOld = orderVo.getStatus();
LocalDateTime now = LocalDateTime.now();
if (Objects.equals(orderVo.getStatus(), GoblinStatusConst.NftStatus.ORDER_STATUS_3.getValue())) {// 超时支付
log.info("Nft订单超时支付 param:[orderCode:{}]", orderCode);
// 处理为退款中
orderVo.setStatus(GoblinStatusConst.NftStatus.ORDER_STATUS_4.getValue());
orderVo.setUpdatedAt(now);
LinkedList<String> sqls = CollectionUtil.linkedListString();
LinkedList<Object[]> sqlDataOrder = CollectionUtil.linkedListObjectArr();
sqls.add(SqlMapping.get("goblin_nft_order.update.refund"));
sqlDataOrder.add(new Object[]{
orderVo.getStatus(), now, orderId, now, now
});
nftOrderUtils.setNftOrder(orderVo);
// mongo
goblinMongoUtils.updateGoblinNftOrderVo(orderVo);
// mysql
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.GOBLIN_NFT_ORDER.getKey(),
SqlMapping.gets(sqls, sqlDataOrder));
// 退款
nftOrderUtils.refundOrderSku(orderId, syncOrderParam.getPaymentId(), syncOrderParam.getPaymentType(), orderVo.getPayType());
} else {// 正常流程
// 更新订单信息
if (StringUtil.isEmpty(syncOrderParam.getPaymentType())) {
orderVo.setPaymentType("");
} else {
orderVo.setPaymentType(syncOrderParam.getPaymentType());
}
if (StringUtil.isEmpty(syncOrderParam.getPaymentId())) {
orderVo.setPaymentId("");
} else {
orderVo.setPaymentId(syncOrderParam.getPaymentId());
}
if (StringUtil.isEmpty(syncOrderParam.getCode())) {
orderVo.setPayCode("");
} else {
orderVo.setPayCode(syncOrderParam.getCode());
}
if (StringUtil.isEmpty(syncOrderParam.getPaymentAt())) {
orderVo.setPayTime(now);
} else {
LocalDateTime payTime = LocalDateTime.parse(syncOrderParam.getPaymentAt(), DTF_YMD_HMS);
orderVo.setPayTime(payTime);
}
orderVo.setUpdatedAt(now);
if (Objects.equals(orderStatusOld, GoblinStatusConst.NftStatus.ORDER_STATUS_3.getValue())) {// 超时支付 退款中状态
orderVo.setStatus(GoblinStatusConst.NftStatus.ORDER_STATUS_4.getValue());
} else {// 正常流程 已付款状态
orderVo.setStatus(GoblinStatusConst.NftStatus.ORDER_STATUS_2.getValue());
orderVo.setUpdatedAt(now);
LinkedList<String> sqls = CollectionUtil.linkedListString();
LinkedList<Object[]> sqlDataOrder = CollectionUtil.linkedListObjectArr();
sqls.add(SqlMapping.get("goblin_nft_order.update.pay"));
sqlDataOrder.add(new Object[]{
orderVo.getPaymentType(), orderVo.getPaymentId(), orderVo.getPayCode(),
orderVo.getPayTime(), orderVo.getStatus(), orderVo.getUpdatedAt(),
orderId, now, now
});
// redis
nftOrderUtils.setNftOrder(orderVo);
// mongo
goblinMongoUtils.updateGoblinNftOrderVo(orderVo);
// mysql
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.GOBLIN_NFT_ORDER.getKey(),
SqlMapping.gets(sqls, sqlDataOrder));
}
// redis
nftOrderUtils.setNftOrder(orderVo);
// mongo
goblinMongoUtils.updateGoblinNftOrderVo(orderVo);
// mysql
LinkedList<String> sqls = CollectionUtil.linkedListString();
LinkedList<Object[]> sqlDataOrder = CollectionUtil.linkedListObjectArr();
sqls.add(SqlMapping.get("goblin_nft_order.update.pay"));
sqlDataOrder.add(new Object[]{
orderVo.getPaymentType(), orderVo.getPaymentId(), orderVo.getPayCode(),
orderVo.getPayTime(), orderVo.getStatus(), orderVo.getUpdatedAt(),
orderId, now, now
});
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.GOBLIN_NFT_ORDER.getKey(),
SqlMapping.gets(sqls, sqlDataOrder));
// 处理订单退款和其他流程
if (Objects.equals(orderStatusOld, GoblinStatusConst.NftStatus.ORDER_STATUS_3.getValue())) {// 超时支付 退款
log.info("Nft订单超时支付 param:[orderCode:{}]", orderCode);
nftOrderUtils.refundOrderSku(orderId, syncOrderParam.getPaymentId(), syncOrderParam.getPaymentType(), orderVo.getPayType());
} else {// 正常流程
// 通知生成藏品
// GoblinQueueBizArtworkGenDto artworkGenDto = GoblinQueueBizArtworkGenDto.getNew();
// artworkGenDto.setOrderId(orderId);
......@@ -653,13 +656,10 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService {
// artworkGenDto.setSource(1);
// queueUtils.sendMsgByRedis(MQConst.GoblinQueue.BIZ_ARTWORK_GEN.getKey(), artworkGenDto.toJson());
this.generateUserArtwork(orderVo);
// 增加销量
goblinRedisUtils.incrSkuSaleCount(orderVo.getSpuId(), orderVo.getSkuId(), orderVo.getNum());
// 加积分
goblinOrderUtils.doTask(uid, orderVo.getPriceActual());
}
// 写入用户订单列表 因取消的订单不展示 所以放在这里
nftOrderUtils.addNftOrderList(uid, orderVo.getOrderId());
......
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