fix: 정산 배치 파이프라인 정합 — 매퍼 NULL 파라미터 + override_settle 제약 + 정산지급 데이터

정산/지급 화면이 전부 비어있던 원인: 운영 DB에서 정산 배치가 실행된 적 없음.
MONTHLY_SETTLEMENT 배치를 돌리는 과정에서 발견한 버그 수정 + 데이터 구성.

매퍼 버그 (PG: could not determine data type of parameter):
- RegulatoryLimitMapper/ChargebackGradeMapper/InstallmentRatioMapper:
  #{productCategory} 가 IS NULL 비교에 쓰여 타입 추론 실패 -> jdbcType=VARCHAR 명시
- ForecastKpiMonthlyMapper: #{targetOrgId} 동일 -> jdbcType=BIGINT 명시

스키마 (V79):
- override_settle.settle_id NOT NULL 완화 — calcOverride(Step7)는 settle_master
  생성(Step8) 전 단계라 settle_id 를 채울 수 없음

데이터 (V80):
- 배치 실행 결과: settle_master 150 / 원장 433 / 명세서 112 / 분개 433 (2026-02~04)
- payment 는 settle_master 파생 생성, 운영성 도메인(공제/마감/세금계산서/이의신청/
  시책/정정)은 대표 샘플 시드 (멱등 NOT EXISTS)

검증: 배치 12스텝 COMPLETED, 정산/지급 10개 엔드포인트 200 OK.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
GA Pro
2026-05-22 00:48:08 +09:00
parent 6b44be2101
commit c2a92d13cb
6 changed files with 159 additions and 12 deletions
@@ -113,8 +113,8 @@
FROM chargeback_grade g
WHERE g.months_from &lt;= #{monthsElapsed}
AND (g.months_to IS NULL OR g.months_to >= #{monthsElapsed})
AND (g.product_category = #{productCategory}
OR (#{productCategory} IS NULL AND g.product_category IS NULL))
AND (g.product_category = #{productCategory,jdbcType=VARCHAR}
OR (#{productCategory,jdbcType=VARCHAR} IS NULL AND g.product_category IS NULL))
<include refid="activeCondition"/>
ORDER BY g.effective_from DESC
LIMIT 1
@@ -137,8 +137,8 @@
chargeback_percent, effective_from, effective_to, is_active,
created_at, created_by, updated_at, updated_by
FROM chargeback_grade g
WHERE (g.product_category = #{productCategory}
OR (#{productCategory} IS NULL AND g.product_category IS NULL))
WHERE (g.product_category = #{productCategory,jdbcType=VARCHAR}
OR (#{productCategory,jdbcType=VARCHAR} IS NULL AND g.product_category IS NULL))
<include refid="activeCondition"/>
ORDER BY g.months_from
</select>
@@ -96,8 +96,8 @@
created_at, created_by, updated_at, updated_by
FROM installment_ratio
WHERE plan_year = #{planYear}
AND (product_category = #{productCategory}
OR (#{productCategory} IS NULL AND product_category IS NULL))
AND (product_category = #{productCategory,jdbcType=VARCHAR}
OR (#{productCategory,jdbcType=VARCHAR} IS NULL AND product_category IS NULL))
AND is_active = TRUE
AND effective_from &lt;= #{baseDate}::DATE
AND (effective_to IS NULL OR effective_to >= #{baseDate}::DATE)
@@ -111,8 +111,8 @@
effective_from, effective_to, is_active,
created_at, created_by, updated_at, updated_by
FROM installment_ratio
WHERE (product_category = #{productCategory}
OR (#{productCategory} IS NULL AND product_category IS NULL))
WHERE (product_category = #{productCategory,jdbcType=VARCHAR}
OR (#{productCategory,jdbcType=VARCHAR} IS NULL AND product_category IS NULL))
AND is_active = TRUE
AND effective_from &lt;= #{baseDate}::DATE
AND (effective_to IS NULL OR effective_to >= #{baseDate}::DATE)
@@ -52,8 +52,8 @@
DELETE FROM forecast_kpi_monthly
WHERE forecast_month = #{forecastMonth}
AND metric_code = #{metricCode}
AND ((#{targetOrgId} IS NULL AND target_org_id IS NULL)
OR target_org_id = #{targetOrgId})
AND ((#{targetOrgId,jdbcType=BIGINT} IS NULL AND target_org_id IS NULL)
OR target_org_id = #{targetOrgId,jdbcType=BIGINT})
</delete>
<insert id="upsertBatch">
@@ -111,8 +111,8 @@
created_at, created_by, updated_at, updated_by
FROM regulatory_limit
WHERE limit_type = #{limitType}
AND (product_category = #{productCategory}
OR (#{productCategory} IS NULL AND product_category IS NULL))
AND (product_category = #{productCategory,jdbcType=VARCHAR}
OR (#{productCategory,jdbcType=VARCHAR} IS NULL AND product_category IS NULL))
AND is_active = TRUE
AND effective_from &lt;= #{baseDate}::DATE
AND (effective_to IS NULL OR effective_to >= #{baseDate}::DATE)