|
|
@@ -2,13 +2,20 @@ package com.fs.live.service.impl;
|
|
|
|
|
|
|
|
|
import com.fs.common.utils.DateUtils;
|
|
|
+import com.fs.huifuPay.domain.HuiFuQueryOrderResult;
|
|
|
+import com.fs.huifuPay.sdk.opps.core.request.V2TradePaymentScanpayQueryRequest;
|
|
|
+import com.fs.huifuPay.service.HuiFuService;
|
|
|
import com.fs.live.domain.LiveOrderPayment;
|
|
|
import com.fs.live.mapper.LiveOrderPaymentMapper;
|
|
|
import com.fs.live.service.ILiveOrderPaymentService;
|
|
|
+import com.fs.live.service.ILiveOrderService;
|
|
|
import com.fs.live.vo.LiveOrderPaymentVo;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.checkerframework.checker.units.qual.A;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.Collections;
|
|
|
import java.util.List;
|
|
|
|
|
|
@@ -19,6 +26,7 @@ import java.util.List;
|
|
|
* @date 2025-08-07
|
|
|
*/
|
|
|
@Service
|
|
|
+@Slf4j
|
|
|
public class LiveOrderPaymentServiceImpl implements ILiveOrderPaymentService {
|
|
|
@Autowired
|
|
|
private LiveOrderPaymentMapper baseMapper;
|
|
|
@@ -62,6 +70,39 @@ public class LiveOrderPaymentServiceImpl implements ILiveOrderPaymentService {
|
|
|
return baseMapper.selectLiveOrderPaymentByOrderId(id);
|
|
|
}
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private HuiFuService huiFuService;
|
|
|
+ @Autowired
|
|
|
+ private ILiveOrderService liveOrderService;
|
|
|
+ @Override
|
|
|
+ public boolean queryHf(LiveOrderPayment liveOrderPayment) {
|
|
|
+ V2TradePaymentScanpayQueryRequest request = new V2TradePaymentScanpayQueryRequest();
|
|
|
+ request.setOrgReqDate(new SimpleDateFormat("yyyyMMdd").format(liveOrderPayment.getCreateTime()));
|
|
|
+ request.setOrgHfSeqId(liveOrderPayment.getTradeNo());
|
|
|
+ HuiFuQueryOrderResult huiFuQueryOrderResult;
|
|
|
+ try {
|
|
|
+ huiFuQueryOrderResult = huiFuService.queryOrder(request);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ log.info("汇付返回"+huiFuQueryOrderResult);
|
|
|
+ if ("00000000".equals(huiFuQueryOrderResult.getResp_code())) {
|
|
|
+ if (huiFuQueryOrderResult.getTrans_stat().equals("S")) {
|
|
|
+ // 如果查询支付成功 更新订单状态
|
|
|
+ String bankTrxId = huiFuQueryOrderResult.getOut_trans_id();
|
|
|
+ String bankOrderId = huiFuQueryOrderResult.getParty_order_id();
|
|
|
+ liveOrderService.payConfirm(1, Long.valueOf(liveOrderPayment.getBusinessId()), liveOrderPayment.getPayCode(),
|
|
|
+ liveOrderPayment.getTradeNo(),bankTrxId, bankOrderId);
|
|
|
+ return true;
|
|
|
+ } else if(huiFuQueryOrderResult.getTrans_stat().equals("F")){
|
|
|
+ liveOrderPayment.setStatus(-2);
|
|
|
+ this.updateLiveOrderPayment(liveOrderPayment);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 新增支付明细
|
|
|
*
|