feat: 분급 비율 회차(월) 단위 등록 지원 (V81)
- installment_ratio.plan_month INT NULL 컬럼 추가 - NULL = 연 단위(연차 합계, 기존 동작) - 1~12 = 해당 회차(월) 단위 비율 - UNIQUE 재정의: NULLS NOT DISTINCT (product_category, plan_year, plan_month, effective_from) - InstallmentPlanGenerator: planMonth=NULL이면 1, NOT NULL이면 그대로 사용해 settle_month 계산 - 분급비율 화면: 회차(월) 컬럼·입력 추가, "(연차-1)*12+월" 통합 회차 표기
This commit is contained in:
@@ -11,6 +11,7 @@ public class InstallmentRatioResp {
|
||||
private String productCategory;
|
||||
private String productCategoryName;
|
||||
private Integer planYear;
|
||||
private Integer planMonth;
|
||||
private BigDecimal ratioPercent;
|
||||
private LocalDate effectiveFrom;
|
||||
private LocalDate effectiveTo;
|
||||
|
||||
@@ -19,6 +19,11 @@ public class InstallmentRatioSaveReq {
|
||||
@Max(value = 7, message = "분급 연차는 7 이하여야 합니다")
|
||||
private Integer planYear;
|
||||
|
||||
// null = 연 단위(연차 합계 비율), 1~12 = 회차(월) 단위
|
||||
@Min(value = 1, message = "회차(월)는 1 이상이어야 합니다")
|
||||
@Max(value = 12, message = "회차(월)는 12 이하여야 합니다")
|
||||
private Integer planMonth;
|
||||
|
||||
@NotNull(message = "비율은 필수입니다")
|
||||
@Positive(message = "비율은 양수여야 합니다")
|
||||
private BigDecimal ratioPercent;
|
||||
|
||||
@@ -9,5 +9,6 @@ import lombok.EqualsAndHashCode;
|
||||
public class InstallmentRatioSearchParam extends SearchParam {
|
||||
private String productCategory;
|
||||
private Integer planYear;
|
||||
private Integer planMonth;
|
||||
private String effectiveDate; // YYYY-MM-DD — 해당 날짜 유효 비율 필터
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ public class InstallmentRatioVO {
|
||||
private Long ratioId;
|
||||
private String productCategory; // NULL = ALL 상품
|
||||
private Integer planYear; // 1~7
|
||||
private Integer planMonth; // NULL = 연 단위(연차 합계), 1~12 = 회차(월) 단위
|
||||
private BigDecimal ratioPercent;
|
||||
private LocalDate effectiveFrom;
|
||||
private LocalDate effectiveTo; // NULL = 현재 유효
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
<id property="ratioId" column="ratio_id"/>
|
||||
<result property="productCategory" column="product_category"/>
|
||||
<result property="planYear" column="plan_year"/>
|
||||
<result property="planMonth" column="plan_month"/>
|
||||
<result property="ratioPercent" column="ratio_percent"/>
|
||||
<result property="effectiveFrom" column="effective_from"/>
|
||||
<result property="effectiveTo" column="effective_to"/>
|
||||
@@ -26,6 +27,7 @@
|
||||
<result property="productCategory" column="product_category"/>
|
||||
<result property="productCategoryName" column="product_category_name"/>
|
||||
<result property="planYear" column="plan_year"/>
|
||||
<result property="planMonth" column="plan_month"/>
|
||||
<result property="ratioPercent" column="ratio_percent"/>
|
||||
<result property="effectiveFrom" column="effective_from"/>
|
||||
<result property="effectiveTo" column="effective_to"/>
|
||||
@@ -40,6 +42,7 @@
|
||||
(SELECT cc.code_name FROM common_code cc
|
||||
WHERE cc.group_code = 'PRODUCT_CATEGORY' AND cc.code = r.product_category) AS product_category_name,
|
||||
r.plan_year,
|
||||
r.plan_month,
|
||||
r.ratio_percent,
|
||||
r.effective_from,
|
||||
r.effective_to,
|
||||
@@ -60,12 +63,15 @@
|
||||
<if test="planYear != null">
|
||||
AND r.plan_year = #{planYear}
|
||||
</if>
|
||||
<if test="planMonth != null">
|
||||
AND r.plan_month = #{planMonth}
|
||||
</if>
|
||||
<if test="effectiveDate != null and effectiveDate != ''">
|
||||
AND r.effective_from <= #{effectiveDate}::DATE
|
||||
AND (r.effective_to IS NULL OR r.effective_to >= #{effectiveDate}::DATE)
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY r.plan_year, r.effective_from DESC
|
||||
ORDER BY r.plan_year, r.plan_month NULLS FIRST, r.effective_from DESC
|
||||
</select>
|
||||
|
||||
<!-- 단건 조회 (Resp: 코드명 포함) -->
|
||||
@@ -77,7 +83,7 @@
|
||||
|
||||
<!-- 단건 조회 (VO: CUD용) -->
|
||||
<select id="selectById" resultMap="VOMap">
|
||||
SELECT ratio_id, product_category, plan_year, ratio_percent,
|
||||
SELECT ratio_id, product_category, plan_year, plan_month, ratio_percent,
|
||||
effective_from, effective_to, is_active,
|
||||
created_at, created_by, updated_at, updated_by
|
||||
FROM installment_ratio
|
||||
@@ -91,7 +97,7 @@
|
||||
effective_from DESC 정렬로 최신 개정본 우선 반환.
|
||||
-->
|
||||
<select id="selectActive" resultMap="VOMap">
|
||||
SELECT ratio_id, product_category, plan_year, ratio_percent,
|
||||
SELECT ratio_id, product_category, plan_year, plan_month, ratio_percent,
|
||||
effective_from, effective_to, is_active,
|
||||
created_at, created_by, updated_at, updated_by
|
||||
FROM installment_ratio
|
||||
@@ -107,7 +113,7 @@
|
||||
|
||||
<!-- 1~7년 차 전체 비율 조회 (분급 계획 일괄 생성 시 사용) -->
|
||||
<select id="selectAllActiveRatios" resultMap="VOMap">
|
||||
SELECT ratio_id, product_category, plan_year, ratio_percent,
|
||||
SELECT ratio_id, product_category, plan_year, plan_month, ratio_percent,
|
||||
effective_from, effective_to, is_active,
|
||||
created_at, created_by, updated_at, updated_by
|
||||
FROM installment_ratio
|
||||
@@ -116,7 +122,7 @@
|
||||
AND is_active = TRUE
|
||||
AND effective_from <= #{baseDate}::DATE
|
||||
AND (effective_to IS NULL OR effective_to >= #{baseDate}::DATE)
|
||||
ORDER BY plan_year
|
||||
ORDER BY plan_year, plan_month NULLS FIRST
|
||||
</select>
|
||||
|
||||
<!-- ==================== INSERT ==================== -->
|
||||
@@ -124,13 +130,13 @@
|
||||
<insert id="insert" parameterType="com.ga.core.vo.installment.InstallmentRatioVO"
|
||||
useGeneratedKeys="true" keyProperty="ratioId">
|
||||
INSERT INTO installment_ratio (
|
||||
product_category, plan_year, ratio_percent,
|
||||
product_category, plan_year, plan_month, ratio_percent,
|
||||
effective_from, effective_to, is_active,
|
||||
created_at, created_by
|
||||
) VALUES (
|
||||
#{productCategory}, #{planYear}, #{ratioPercent},
|
||||
#{effectiveFrom}, #{effectiveTo}, COALESCE(#{isActive}, TRUE),
|
||||
NOW(), #{createdBy}
|
||||
#{productCategory,jdbcType=VARCHAR}, #{planYear}, #{planMonth,jdbcType=INTEGER}, #{ratioPercent},
|
||||
#{effectiveFrom}, #{effectiveTo,jdbcType=DATE}, COALESCE(#{isActive}, TRUE),
|
||||
NOW(), #{createdBy,jdbcType=BIGINT}
|
||||
)
|
||||
</insert>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user