fix: 오버라이드 insurance_type_cond 미적용 과지급 수정 (PL 우선순위 진행)

- fix(HIGH): CalcOverrideStep base 가 override_rule.insurance_type_cond 를 무시하고
  하위 설계사의 전 보험종류 실적 합계에 율을 곱해 과지급. 룰에 보험종류 조건이
  지정되면(LIFE 등) 해당 종류 실적만 base 로 집계하도록 수정.
  (현 시드는 insurance_type_cond NULL 이라 잠복상태였으나 종류한정 룰 도입 시 과지급)
- add: RecruitLedgerMapper/MaintainLedgerMapper.sumByAgentMonthAndType + XML
- test: CalcOverrideStepTest — LIFE 한정 룰 base 필터 검증
- 전체 build+test GREEN: 153건 0실패

잔여 백로그(정책결정 필요 — 자동수정 보류): 1200%룰 초과분 clip/이연(지급정책),
계약승계 from검증(다단계 체인+contract.agent_id 갱신정책), 정착지원금 환수공식(입력
스키마), 회계 원천세 예수금 분개(회계정책), net음수 클램프(이월저장), 세금 3중경로 통일.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
GA Pro
2026-06-03 10:38:09 +09:00
parent eac0b813d6
commit 60c4cbae78
6 changed files with 137 additions and 3 deletions
@@ -27,6 +27,11 @@ public interface MaintainLedgerMapper {
BigDecimal sumByAgentMonth(@Param("agentId") Long agentId,
@Param("settleMonth") String settleMonth);
/** 정산월 + 설계사 + 보험종류 합계 (오버라이드 insurance_type_cond 적용용) */
BigDecimal sumByAgentMonthAndType(@Param("agentId") Long agentId,
@Param("settleMonth") String settleMonth,
@Param("insuranceType") String insuranceType);
/** 계약별 유지 원장 수수료 합산 (1200%룰 누적 검증용) */
BigDecimal sumByContract(@Param("contractId") Long contractId);
}
@@ -31,6 +31,11 @@ public interface RecruitLedgerMapper {
BigDecimal sumByAgentMonth(@Param("agentId") Long agentId,
@Param("settleMonth") String settleMonth);
/** 정산월 + 설계사 + 보험종류 합계 (오버라이드 insurance_type_cond 적용용) */
BigDecimal sumByAgentMonthAndType(@Param("agentId") Long agentId,
@Param("settleMonth") String settleMonth,
@Param("insuranceType") String insuranceType);
/** 계약별 신계약 원장 수수료 합산 (1200%룰 누적 검증용) */
BigDecimal sumByContract(@Param("contractId") Long contractId);
@@ -112,6 +112,12 @@
WHERE agent_id = #{agentId} AND settle_month = #{settleMonth}
</select>
<select id="sumByAgentMonthAndType" resultType="java.math.BigDecimal">
SELECT COALESCE(SUM(agent_amount), 0) FROM maintain_ledger
WHERE agent_id = #{agentId} AND settle_month = #{settleMonth}
AND insurance_type = #{insuranceType}
</select>
<select id="sumByContract" resultType="java.math.BigDecimal">
SELECT COALESCE(SUM(agent_amount), 0) FROM maintain_ledger
WHERE contract_id = #{contractId}
@@ -129,6 +129,12 @@
WHERE agent_id = #{agentId} AND settle_month = #{settleMonth}
</select>
<select id="sumByAgentMonthAndType" resultType="java.math.BigDecimal">
SELECT COALESCE(SUM(agent_amount), 0) FROM recruit_ledger
WHERE agent_id = #{agentId} AND settle_month = #{settleMonth}
AND insurance_type = #{insuranceType}
</select>
<select id="sumByContract" resultType="java.math.BigDecimal">
SELECT COALESCE(SUM(agent_amount), 0) FROM recruit_ledger
WHERE contract_id = #{contractId}