wangqifan 3 жил өмнө
parent
commit
b5ee2c8df4

+ 8 - 2
src/main/java/com/izouma/nineth/service/GiftOrderService.java

@@ -69,6 +69,7 @@ public class GiftOrderService {
     private GeneralProperties generalProperties;
     private SnowflakeIdWorker snowflakeIdWorker;
     private ErrorOrderRepo    errorOrderRepo;
+    private GiftOrderService  giftOrderService;
 
     @Transactional
     public GiftOrder gift(Long userId, Long assetId, Long toUserId) {
@@ -131,7 +132,8 @@ public class GiftOrderService {
 
             assetService.transfer(asset, asset.getPrice(), newOwner, "转赠", null);
         } else {
-            log.error("转赠回调出错 状态错误 orderid={} transactionid={} status={}", orderId, transactionId, giftOrder.getStatus());
+            log.error("转赠回调出错 状态错误 orderid={} transactionid={} status={}", orderId, transactionId, giftOrder
+                    .getStatus());
             errorOrderRepo.save(ErrorOrder.builder()
                     .orderId(orderId)
                     .transactionId(transactionId)
@@ -223,6 +225,9 @@ public class GiftOrderService {
             throw new BusinessException("不支持此渠道");
         }
         GiftOrder order = giftOrderRepo.findById(id).orElseThrow(new BusinessException("订单不存在"));
+        if (order.getGasPrice().compareTo(BigDecimal.ZERO) == 0) {
+            giftOrderService.giftNotify(id, PayMethod.ALIPAY, id.toString());
+        }
         User invitor = null;
         if (order.getStatus() != OrderStatus.NOT_PAID) {
             throw new BusinessException("订单状态错误");
@@ -268,7 +273,8 @@ public class GiftOrderService {
             case "alipay_qr":
                 return MapUtils.getString(MapUtils.getMap(response, "expend"), "qrcode_url");
             case "wx_pub":
-                JSONObject payParams = JSON.parseObject(MapUtils.getString(MapUtils.getMap(response, "expend"), "pay_info"));
+                JSONObject payParams = JSON
+                        .parseObject(MapUtils.getString(MapUtils.getMap(response, "expend"), "pay_info"));
                 payParams.put("timestamp", payParams.get("timeStamp"));
                 payParams.remove("timeStamp");
                 return payParams;