Browse Source

feat: 同步银行参数为空的问题

xdd 2 days ago
parent
commit
c8e2517638

+ 42 - 0
fs-admin/src/main/java/com/fs/task/PaymentTask.java

@@ -1,12 +1,22 @@
 package com.fs.task;
 
+import com.alibaba.fastjson.JSON;
 import com.fs.common.annotation.QuartzRunnable;
+import com.fs.pay.pay.domain.OrderResult;
+import com.fs.pay.pay.dto.OrderQueryDTO;
+import com.fs.pay.pay.service.PayService;
+import com.fs.store.domain.FsPayConfig;
+import com.fs.store.domain.FsStorePayment;
+import com.fs.store.mapper.FsStorePaymentMapper;
 import com.fs.store.service.IFsStoreOrderService;
 import com.fs.store.service.IFsStorePaymentService;
+import com.fs.system.service.ISysConfigService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 @Slf4j
 @Service("paymentTask")
 public class PaymentTask {
@@ -15,6 +25,16 @@ public class PaymentTask {
     @Autowired
     private IFsStoreOrderService fsStoreOrderService;
 
+    @Autowired
+    private FsStorePaymentMapper fsStorePaymentMapper;
+
+    @Autowired
+    private ISysConfigService configService;
+
+    @Autowired
+    private PayService payService;
+
+
     /**
      * 补偿机制,定时反查台州银行
      */
@@ -30,4 +50,26 @@ public class PaymentTask {
     public void orderCancel(){
         fsStoreOrderService.orderCancel();
     }
+
+    /**
+     * 同步银行参数为空的问题
+     */
+    @QuartzRunnable(name = "同步银行参数为空的问题")
+    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);
+        }
+    }
 }

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

@@ -384,7 +384,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='yb' and bank_transaction_id is null")
     List<FsStorePayment> queryNormalData();
 
     List<FsStorePayment> queryByBankTrxId(@Param("list") List<String> bankTrxIds);