Forráskód Böngészése

feat: 同步银行参数优化

xdd 1 hónapja
szülő
commit
0c35f13249

+ 20 - 16
fs-admin/src/main/java/com/fs/task/PaymentTask.java

@@ -2,6 +2,9 @@ package com.fs.task;
 
 import com.alibaba.fastjson.JSON;
 import com.fs.common.annotation.QuartzRunnable;
+import com.fs.huifuPay.domain.HuiFuQueryOrderResult;
+import com.fs.huifuPay.sdk.opps.core.request.V2TradePaymentScanpayQueryRequest;
+import com.fs.huifuPay.service.HuiFuService;
 import com.fs.pay.pay.domain.OrderResult;
 import com.fs.pay.pay.dto.OrderQueryDTO;
 import com.fs.pay.pay.service.PayService;
@@ -15,6 +18,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.text.SimpleDateFormat;
 import java.util.List;
 
 @Slf4j
@@ -29,11 +33,7 @@ public class PaymentTask {
     private FsStorePaymentMapper fsStorePaymentMapper;
 
     @Autowired
-    private ISysConfigService configService;
-
-    @Autowired
-    private PayService payService;
-
+    private HuiFuService huiFuService;
 
     /**
      * 补偿机制,定时反查台州银行
@@ -58,18 +58,22 @@ public class PaymentTask {
     public void fixTransactionNull(){
         List<FsStorePayment> list = fsStorePaymentMapper.queryNormalData();
         for (FsStorePayment fsStorePayment : list) {
-            String json = configService.selectConfigByKey("store.pay");
-            FsPayConfig fsPayConfig = JSON.parseObject(json, FsPayConfig.class);
-            OrderQueryDTO orderQueryDTO = new OrderQueryDTO();
-            orderQueryDTO.setAccount(fsPayConfig.getYbAccount());
-            orderQueryDTO.setUpOrderId(fsStorePayment.getTradeNo());
-            OrderResult order = payService.getOrder(orderQueryDTO);
-            if(order != null) {
-                fsStorePayment.setBankTransactionId(order.getBankTrxId());
-                fsStorePayment.setBankSerialNo(order.getBankOrderId());
-            }
 
-            fsStorePaymentMapper.updateFsStorePayment(fsStorePayment);
+            V2TradePaymentScanpayQueryRequest request = new V2TradePaymentScanpayQueryRequest();
+            request.setOrgReqDate(new SimpleDateFormat("yyyyMMdd").format(fsStorePayment.getCreateTime()));
+            request.setOrgHfSeqId(fsStorePayment.getTradeNo());
+            HuiFuQueryOrderResult huiFuQueryOrderResult;
+            try {
+                huiFuQueryOrderResult = huiFuService.queryOrder(request);
+            } catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+            log.info("汇付返回 {}",huiFuQueryOrderResult);
+            if ("00000000".equals(huiFuQueryOrderResult.getResp_code())) {
+                fsStorePayment.setBankTransactionId(huiFuQueryOrderResult.getOut_trans_id());
+                fsStorePayment.setBankSerialNo(huiFuQueryOrderResult.getParty_order_id());
+                fsStorePaymentMapper.updateFsStorePayment(fsStorePayment);
+            }
         }
     }
 }

+ 1 - 1
fs-service-system/src/main/java/com/fs/store/mapper/FsStorePaymentMapper.java

@@ -385,7 +385,7 @@ public interface FsStorePaymentMapper
     @Select("select count(1) from fs_store_payment where order_id=${orderId} limit 1")
     Integer selectFsStorePaymentByOrderIdExists(Long orderId);
 
-    @Select("select * from fs_store_payment where business_type=2 and status =1 and pay_mode='yb' and bank_transaction_id is null")
+    @Select("select * from fs_store_payment where business_type=2 and status =1 and pay_mode='hf' and bank_transaction_id is null")
     List<FsStorePayment> queryNormalData();
 
     List<FsStorePayment> queryByBankTrxId(@Param("list") List<String> bankTrxIds);