瀏覽代碼

feat: 转账到卡未指定时效时默认T0; 进件文件上传限制每类5张与前端对齐

alphaH 3 周之前
父節點
當前提交
2d040bb61e

+ 23 - 12
java/src/main/java/com/payment/platform/module/payment/account/service/AlipayTransferService.java

@@ -254,10 +254,12 @@ public class AlipayTransferService {
             throw new BusinessException(400, "转账场景截图不能为空");
         // 场景截图+资质文件合计最多5个
         int imgCnt = sceneImageKeys.split(",").length;
+        if (imgCnt  > 5)
+            throw new BusinessException(400, "场景截图最多5个");
         int qualCnt = (sceneQualificationImageKeys != null && !sceneQualificationImageKeys.isBlank())
                 ? sceneQualificationImageKeys.split(",").length : 0;
-        if (imgCnt + qualCnt > 5)
-            throw new BusinessException(400, "场景截图和资质文件合计最多5个");
+        if (qualCnt  > 5)
+            throw new BusinessException(400, "资质文件合计最多5个");
         String outBizNo = SnowflakeIdGenerator.nextIdStr();
         try {
             AlipayFundExpandindirectCreateModel model = new AlipayFundExpandindirectCreateModel();
@@ -592,17 +594,26 @@ public class AlipayTransferService {
 
             // 选填: businessParams(扩展参数透传给支付宝)
             // 支持: withdraw_timeliness(T0/T1)、transfer_scene_name、transfer_scene_report_infos
-            if (extInfo != null && (extInfo.containsKey("withdraw_timeliness")
-                    || extInfo.containsKey("transfer_scene_name")
-                    || extInfo.containsKey("transfer_scene_report_infos"))) {
+            // 注意: withdraw_timeliness 仅对转账到银行卡有效。对卡转账未显式指定时效时默认 T0
+            //(批量转账无时效选项,按业务约定默认当天到账); 支付宝账户转账不补默认值。
+            boolean isBankCard = "BANKCARD_ACCOUNT".equals(payeeInfo.get("identity_type"));
+            Map<String, Object> bizParams = new LinkedHashMap<>();
+            if (isBankCard) {
+                bizParams.put("withdraw_timeliness",
+                        extInfo != null && extInfo.containsKey("withdraw_timeliness")
+                                ? extInfo.get("withdraw_timeliness") : "T0");
+            } else if (extInfo != null && extInfo.containsKey("withdraw_timeliness")) {
+                // 非银行卡: 保留显式传入时效的透传行为,未传时不补默认值
+                bizParams.put("withdraw_timeliness", extInfo.get("withdraw_timeliness"));
+            }
+            if (extInfo != null) {
+                if (extInfo.containsKey("transfer_scene_name"))
+                    bizParams.put("transfer_scene_name", extInfo.get("transfer_scene_name"));
+                if (extInfo.containsKey("transfer_scene_report_infos"))
+                    bizParams.put("transfer_scene_report_infos", extInfo.get("transfer_scene_report_infos"));
+            }
+            if (!bizParams.isEmpty()) {
                 try {
-                    Map<String, Object> bizParams = new LinkedHashMap<>();
-                    if (extInfo.containsKey("withdraw_timeliness"))
-                        bizParams.put("withdraw_timeliness", extInfo.get("withdraw_timeliness"));
-                    if (extInfo.containsKey("transfer_scene_name"))
-                        bizParams.put("transfer_scene_name", extInfo.get("transfer_scene_name"));
-                    if (extInfo.containsKey("transfer_scene_report_infos"))
-                        bizParams.put("transfer_scene_report_infos", extInfo.get("transfer_scene_report_infos"));
                     model.setBusinessParams(objectMapper.writeValueAsString(bizParams));
                 } catch (Exception ignored) {}
             }