Procházet zdrojové kódy

@
fix: createFullFlow conditionInfo 序列化为扁平 Map 格式

之前序列化为 JSON 数组 [{"rule_factor":"QUOTA_TOTAL",...}],
与 RuleService.toVO 期望的 {"max_amount":"100"} 扁平对象格式不兼容。
改为 QUOTA_TOTAL→max_amount 映射的扁平 Map 格式。
@

alphaH před 7 hodinami
rodič
revize
51c2aba7d6

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

@@ -592,11 +592,20 @@ public class InstitutionService {
                 rule.setTenantId(tenantId);
                 rule.setSingleLimit(singleLimitVal);
 
-                // 序列化 condition_info 为 JSON
+                // 序列化 condition_info 为扁平 Map(与 RuleService.toVO 格式一致)
                 if (conditionList != null) {
                     try {
+                        Map<String, Object> flat = new LinkedHashMap<>();
+                        for (Map<String, Object> c : conditionList) {
+                            String factor = (String) c.get("rule_factor");
+                            if ("QUOTA_TOTAL".equals(factor)) {
+                                flat.put("max_amount", c.get("rule_value"));
+                            } else if (factor != null) {
+                                flat.put(factor.toLowerCase(), c.get("rule_value"));
+                            }
+                        }
                         rule.setConditionInfo(
-                                new com.fasterxml.jackson.databind.ObjectMapper().writeValueAsString(conditionList));
+                                new com.fasterxml.jackson.databind.ObjectMapper().writeValueAsString(flat));
                     } catch (Exception e) {
                         log.warn("保存使用规则 - 序列化 conditionInfo 失败: {}", e.getMessage());
                     }