Bläddra i källkod

fix: queryTransferStatus强制传入enterpriseId走DB配置,禁止getClient()

- 去掉无参getClient()调用,全部改为getClient(enterpriseId)
- queryTransferStatus签名新增enterpriseId参数
- retryDealingTransfers/transferSyncAllService传入transfer.getEnterpriseId()
alphaH 8 timmar sedan
förälder
incheckning
e08d021fcf

BIN
frontend/dist.zip


+ 7 - 6
java/src/main/java/com/payment/platform/module/payment/account/service/AlipayTransferService.java

@@ -1,7 +1,6 @@
 package com.payment.platform.module.payment.account.service;
 
 import com.alipay.api.AlipayApiException;
-import com.alipay.api.AlipayClient;
 import com.alipay.api.domain.AccessParams;
 import com.alipay.api.domain.AlipayFundAccountbookCreateModel;
 import com.alipay.api.domain.AlipayFundAccountbookQueryModel;
@@ -681,7 +680,7 @@ public class AlipayTransferService {
      * alipay.fund.trans.common.query
      * orderId / outBizNo 二选一必填
      */
-    public Map<String, String> queryTransferStatus(String orderId, String outBizNo) {
+    public Map<String, String> queryTransferStatus(String orderId, String outBizNo, String enterpriseId) {
         try {
             AlipayFundTransCommonQueryModel model = new AlipayFundTransCommonQueryModel();
             model.setProductCode(PRODUCT_CODE);
@@ -697,8 +696,8 @@ public class AlipayTransferService {
             AlipayFundTransCommonQueryRequest request = new AlipayFundTransCommonQueryRequest();
             request.setBizModel(model);
 
-            AlipayClient client = alipayClientFactory.getClient();
-            AlipayFundTransCommonQueryResponse response = client.execute(request);
+            AlipayFundTransCommonQueryResponse response =
+                    alipayClientFactory.getClient(enterpriseId).certificateExecute(request);
 
             if (!response.isSuccess()) {
                 log.warn("查询转账状态失败: code={}, msg={}", response.getCode(), response.getMsg());
@@ -844,7 +843,8 @@ public class AlipayTransferService {
 
                 try {
                     Map<String, String> status = queryTransferStatus(
-                            !orderNo.isEmpty() ? orderNo : null, outBizNo);
+                            !orderNo.isEmpty() ? orderNo : null, outBizNo,
+                            transfer.getEnterpriseId());
                     String s = status.get("status");
                     if ("SUCCESS".equals(s) || "FAIL".equals(s) || "REFUND".equals(s)) {
                         TransferEntity patch = new TransferEntity();
@@ -912,7 +912,8 @@ public class AlipayTransferService {
             if (outBizNo == null) continue;
             try {
                 Map<String, String> status = queryTransferStatus(
-                        !orderNo.isEmpty() ? orderNo : null, outBizNo);
+                        !orderNo.isEmpty() ? orderNo : null, outBizNo,
+                        t.getEnterpriseId());
                 String s = status.get("status");
                 if ("SUCCESS".equals(s) || "FAIL".equals(s) || "REFUND".equals(s)) {
                     t.setStatus(s);

+ 1 - 1
java/src/main/java/com/payment/platform/module/payment/enterprise/scheduler/EnterpriseNameSyncScheduler.java

@@ -70,7 +70,7 @@ public class EnterpriseNameSyncScheduler {
         AlipayCommerceEcEnterpriseInfoQueryRequest request = new AlipayCommerceEcEnterpriseInfoQueryRequest();
         request.setBizModel(model);
         AlipayCommerceEcEnterpriseInfoQueryResponse response =
-                alipayClientFactory.getClientByProvider(entity.getServiceProviderId()).execute(request);
+                alipayClientFactory.getClientByProvider(entity.getServiceProviderId()).certificateExecute(request);
         if (!response.isSuccess()) {
             throw new BusinessException(400, response.getSubMsg() != null ? response.getSubMsg() : response.getMsg());
         }

+ 2 - 2
java/src/main/java/com/payment/platform/module/payment/expense/institution/service/InstitutionScopeSyncService.java

@@ -150,7 +150,7 @@ public class InstitutionScopeSyncService {
                             new AlipayEbppInvoiceInstitutionScopeModifyRequest();
                     scopeRequest.setBizModel(scopeModel);
                     AlipayEbppInvoiceInstitutionScopeModifyResponse scopeResponse =
-                            alipayClientFactory.getClient(enterpriseId).execute(scopeRequest);
+                            alipayClientFactory.getClient(enterpriseId).certificateExecute(scopeRequest);
                     if (!scopeResponse.isSuccess()) {
                         log.warn("scope.modify 移除部门失败: {}",
                                 scopeResponse.getSubMsg() != null ? scopeResponse.getSubMsg() : scopeResponse.getMsg());
@@ -297,7 +297,7 @@ public class InstitutionScopeSyncService {
                                 new AlipayEbppInvoiceInstitutionScopeModifyRequest();
                         scopeRequest.setBizModel(scopeModel);
                         AlipayEbppInvoiceInstitutionScopeModifyResponse scopeResponse =
-                                alipayClientFactory.getClient(enterpriseId).execute(scopeRequest);
+                                alipayClientFactory.getClient(enterpriseId).certificateExecute(scopeRequest);
                         if (!scopeResponse.isSuccess()) {
                             log.warn("scope.modify 移除员工失败: {}",
                                     scopeResponse.getSubMsg() != null ? scopeResponse.getSubMsg() : scopeResponse.getMsg());

+ 13 - 13
java/src/main/java/com/payment/platform/module/payment/expense/institution/service/InstitutionService.java

@@ -101,7 +101,7 @@ public class InstitutionService {
                         new AlipayEbppInvoiceInstitutionDetailinfoQueryRequest();
                 queryRequest.setBizModel(queryModel);
                 AlipayEbppInvoiceInstitutionDetailinfoQueryResponse queryResponse =
-                        alipayClientFactory.getClient(enterpriseId).execute(queryRequest);
+                        alipayClientFactory.getClient(enterpriseId).certificateExecute(queryRequest);
                 if (queryResponse.isSuccess()) {
                     InstitutionVO vo = new InstitutionVO();
                     vo.setInstitutionId(queryResponse.getInstitutionId());
@@ -391,7 +391,7 @@ public class InstitutionService {
         Map<String, String> standardIdMapping = new java.util.HashMap<>();
         try {
             AlipayEbppInvoiceInstitutionCreateResponse createResponse =
-                    alipayClientFactory.getClient(enterpriseId).execute(createRequest);
+                    alipayClientFactory.getClient(enterpriseId).certificateExecute(createRequest);
             if (!createResponse.isSuccess()) {
                 throw new BusinessException(400, "创建费控制度失败: " +
                         (createResponse.getSubMsg() != null ? createResponse.getSubMsg() : createResponse.getMsg()));
@@ -435,7 +435,7 @@ public class InstitutionService {
                         new AlipayEbppInvoiceInstitutionScopeModifyRequest();
                 scopeReq.setBizModel(scopeModel);
                 AlipayEbppInvoiceInstitutionScopeModifyResponse scopeResp =
-                        alipayClientFactory.getClient(enterpriseId).execute(scopeReq);
+                        alipayClientFactory.getClient(enterpriseId).certificateExecute(scopeReq);
                 if (!scopeResp.isSuccess()) {
                     throw new BusinessException(400, "设置适用范围失败: " +
                             (scopeResp.getSubMsg() != null ? scopeResp.getSubMsg() : scopeResp.getMsg()));
@@ -452,7 +452,7 @@ public class InstitutionService {
                 AlipayEbppInvoiceInstitutionDeleteRequest rollbackReq =
                         new AlipayEbppInvoiceInstitutionDeleteRequest();
                 rollbackReq.setBizModel(rollbackModel);
-                alipayClientFactory.getClient(enterpriseId).execute(rollbackReq);
+                alipayClientFactory.getClient(enterpriseId).certificateExecute(rollbackReq);
             } catch (Exception ignored) {
                 log.warn("回滚删除支付宝制度失败: institutionId={}", institutionId);
             }
@@ -496,7 +496,7 @@ public class InstitutionService {
                         new AlipayEbppInvoiceIssueruleCreateRequest();
                 irReq.setBizModel(irModel);
                 AlipayEbppInvoiceIssueruleCreateResponse irResp =
-                        alipayClientFactory.getClient(enterpriseId).execute(irReq);
+                        alipayClientFactory.getClient(enterpriseId).certificateExecute(irReq);
                 if (!irResp.isSuccess()) {
                     throw new BusinessException(400, "创建发放规则失败: " +
                             (irResp.getSubMsg() != null ? irResp.getSubMsg() : irResp.getMsg()));
@@ -514,7 +514,7 @@ public class InstitutionService {
                     AlipayEbppInvoiceInstitutionDeleteRequest rollbackReq =
                             new AlipayEbppInvoiceInstitutionDeleteRequest();
                     rollbackReq.setBizModel(rollbackModel);
-                    alipayClientFactory.getClient(enterpriseId).execute(rollbackReq);
+                    alipayClientFactory.getClient(enterpriseId).certificateExecute(rollbackReq);
                 } catch (Exception ignored) {
                     log.warn("回滚删除支付宝制度失败: institutionId={}", institutionId);
                 }
@@ -785,7 +785,7 @@ public class InstitutionService {
                     new AlipayEbppInvoiceInstitutionModifyRequest();
             modifyRequest.setBizModel(modifyModel);
             AlipayEbppInvoiceInstitutionModifyResponse modifyResponse =
-                    alipayClientFactory.getClient(existing.getEnterpriseId()).execute(modifyRequest);
+                    alipayClientFactory.getClient(existing.getEnterpriseId()).certificateExecute(modifyRequest);
             if (!modifyResponse.isSuccess()) {
                 log.warn("支付宝 institution.modify 失败: {}",
                         modifyResponse.getSubMsg() != null ? modifyResponse.getSubMsg() : modifyResponse.getMsg());
@@ -807,7 +807,7 @@ public class InstitutionService {
                 detailModel.setEnterpriseId(existing.getEnterpriseId());
                 var detailReq = new AlipayEbppInvoiceInstitutionDetailinfoQueryRequest();
                 detailReq.setBizModel(detailModel);
-                var detailResp = alipayClientFactory.getClient(existing.getEnterpriseId()).execute(detailReq);
+                var detailResp = alipayClientFactory.getClient(existing.getEnterpriseId()).certificateExecute(detailReq);
 
                 if (detailResp.isSuccess() && detailResp.getStandardInfoDetailList() != null) {
                     String periodFactor = mapPeriodTypeToFactor(existing.getPeriodType());
@@ -898,7 +898,7 @@ public class InstitutionService {
                             @Override
                             public com.alipay.api.AlipayObject getBizModel() { return null; }
                         };
-                        client.execute(request, null);
+                        client.certificateExecute(request, null);
                         log.info("已同步 modify_standard_detail_info: amount={}, singleLimit={}",
                                 dto.getAmount(), dto.getSingleLimit());
                     }
@@ -925,7 +925,7 @@ public class InstitutionService {
                 AlipayEbppInvoiceInstitutionScopeModifyRequest scopeReq =
                         new AlipayEbppInvoiceInstitutionScopeModifyRequest();
                 scopeReq.setBizModel(scopeModel);
-                alipayClientFactory.getClient(existing.getEnterpriseId()).execute(scopeReq);
+                alipayClientFactory.getClient(existing.getEnterpriseId()).certificateExecute(scopeReq);
                 log.info("修改制度时同步适用范围成功: institutionId={}, adapterType={}",
                         existing.getInstitutionId(), adapterType);
             } catch (Exception e) {
@@ -989,7 +989,7 @@ public class InstitutionService {
                     new AlipayEbppInvoiceInstitutionDeleteRequest();
             deleteRequest.setBizModel(deleteModel);
             AlipayEbppInvoiceInstitutionDeleteResponse deleteResponse =
-                    alipayClientFactory.getClient(enterpriseId).execute(deleteRequest);
+                    alipayClientFactory.getClient(enterpriseId).certificateExecute(deleteRequest);
             if (!deleteResponse.isSuccess()) {
                 log.warn("支付宝删除失败(可能已删): {}",
                         deleteResponse.getSubMsg() != null ? deleteResponse.getSubMsg() : deleteResponse.getMsg());
@@ -1055,7 +1055,7 @@ public class InstitutionService {
                     new AlipayEbppInvoiceInstitutionScopepageinfoQueryRequest();
             queryRequest.setBizModel(queryModel);
             AlipayEbppInvoiceInstitutionScopepageinfoQueryResponse queryResponse =
-                    alipayClientFactory.getClient(enterpriseId).execute(queryRequest);
+                    alipayClientFactory.getClient(enterpriseId).certificateExecute(queryRequest);
             if (!queryResponse.isSuccess()) {
                 throw new BusinessException(400, "查询适用范围失败: " +
                         (queryResponse.getSubMsg() != null ? queryResponse.getSubMsg() : queryResponse.getMsg()));
@@ -1249,7 +1249,7 @@ public class InstitutionService {
                     new AlipayEbppInvoiceInstitutionScopeModifyRequest();
             scopeRequest.setBizModel(scopeModel);
             AlipayEbppInvoiceInstitutionScopeModifyResponse scopeResponse =
-                    alipayClientFactory.getClient(enterpriseId).execute(scopeRequest);
+                    alipayClientFactory.getClient(enterpriseId).certificateExecute(scopeRequest);
             if (!scopeResponse.isSuccess()) {
                 throw new BusinessException(400, "设置适用范围失败: " +
                         (scopeResponse.getSubMsg() != null ? scopeResponse.getSubMsg() : scopeResponse.getMsg()));

+ 2 - 2
java/src/main/java/com/payment/platform/module/payment/expense/quota/service/IssueBatchService.java

@@ -138,7 +138,7 @@ public class IssueBatchService {
             AlipayEbppInvoiceExpensecontrolIssuebatchCreateRequest request = new AlipayEbppInvoiceExpensecontrolIssuebatchCreateRequest();
             request.setBizModel(model);
 
-            AlipayEbppInvoiceExpensecontrolIssuebatchCreateResponse response = alipayClientFactory.getClient(model.getEnterpriseId()).execute(request);
+            AlipayEbppInvoiceExpensecontrolIssuebatchCreateResponse response = alipayClientFactory.getClient(model.getEnterpriseId()).certificateExecute(request);
 
             if (!response.isSuccess()) {
                 throw new BusinessException(400, "批量发放失败: " + (response.getSubMsg() != null ? response.getSubMsg() : response.getMsg()));
@@ -175,7 +175,7 @@ public class IssueBatchService {
             AlipayEbppInvoiceExpensecontrolIssuebatchCancelRequest request = new AlipayEbppInvoiceExpensecontrolIssuebatchCancelRequest();
             request.setBizModel(model);
 
-            AlipayEbppInvoiceExpensecontrolIssuebatchCancelResponse response = alipayClientFactory.getClient(model.getEnterpriseId()).execute(request);
+            AlipayEbppInvoiceExpensecontrolIssuebatchCancelResponse response = alipayClientFactory.getClient(model.getEnterpriseId()).certificateExecute(request);
 
             if (!response.isSuccess()) {
                 throw new BusinessException(400, "作废批次失败: " + (response.getSubMsg() != null ? response.getSubMsg() : response.getMsg()));

+ 3 - 3
java/src/main/java/com/payment/platform/module/payment/expense/rule/service/RuleService.java

@@ -168,7 +168,7 @@ public class RuleService {
             request.setBizModel(model);
 
             AlipayEbppInvoiceInstitutionExpenseruleCreateResponse response =
-                    alipayClientFactory.getClient(model.getEnterpriseId()).execute(request);
+                    alipayClientFactory.getClient(model.getEnterpriseId()).certificateExecute(request);
 
             if (!response.isSuccess()) {
                 throw new BusinessException(400, "创建使用规则失败: " +
@@ -219,7 +219,7 @@ public class RuleService {
             request.setBizModel(model);
 
             AlipayEbppInvoiceInstitutionExpenseruleModifyResponse response =
-                    alipayClientFactory.getClient(model.getEnterpriseId()).execute(request);
+                    alipayClientFactory.getClient(model.getEnterpriseId()).certificateExecute(request);
 
             if (!response.isSuccess()) {
                 throw new BusinessException(400, "修改使用规则失败: " +
@@ -265,7 +265,7 @@ public class RuleService {
             request.setBizModel(model);
 
             AlipayEbppInvoiceInstitutionExpenseruleDeleteResponse response =
-                    alipayClientFactory.getClient(model.getEnterpriseId()).execute(request);
+                    alipayClientFactory.getClient(model.getEnterpriseId()).certificateExecute(request);
 
             if (!response.isSuccess()) {
                 throw new BusinessException(400, "删除使用规则失败: " +