- 원리금균등 상환표를 은행 조회액과 정확히 맞추기 위한 고정 월 상환금 선택 저장 - wallet.loan_payment 컬럼(ALTER IF NOT EXISTS), 도메인·DTO·매퍼 반영 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -35,6 +35,7 @@ public class Wallet implements Serializable {
|
|||||||
private String loanMethod; // 상환방식: EQUAL_PAYMENT / EQUAL_PRINCIPAL / BULLET (LOAN 전용)
|
private String loanMethod; // 상환방식: EQUAL_PAYMENT / EQUAL_PRINCIPAL / BULLET (LOAN 전용)
|
||||||
private Integer loanMonths; // 대출기간(개월) (LOAN 전용)
|
private Integer loanMonths; // 대출기간(개월) (LOAN 전용)
|
||||||
private LocalDate loanStart; // 대출시작일 (LOAN 전용)
|
private LocalDate loanStart; // 대출시작일 (LOAN 전용)
|
||||||
|
private Long loanPayment; // 월 상환금(고정, 원리금균등) — 은행 조회액과 정확히 맞추기 위한 선택 입력 (LOAN 전용)
|
||||||
private Integer sortOrder; // 표시 순서 (타입 내 정렬)
|
private Integer sortOrder; // 표시 순서 (타입 내 정렬)
|
||||||
private LocalDateTime createdAt;
|
private LocalDateTime createdAt;
|
||||||
private LocalDateTime updatedAt;
|
private LocalDateTime updatedAt;
|
||||||
|
|||||||
@@ -53,4 +53,5 @@ public class WalletRequest {
|
|||||||
|
|
||||||
private Integer loanMonths; // 대출기간(개월)
|
private Integer loanMonths; // 대출기간(개월)
|
||||||
private LocalDate loanStart; // 대출시작일
|
private LocalDate loanStart; // 대출시작일
|
||||||
|
private Long loanPayment; // 월 상환금(고정, 원리금균등) — 선택
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ public class WalletResponse {
|
|||||||
private String loanMethod; // EQUAL_PAYMENT / EQUAL_PRINCIPAL / BULLET
|
private String loanMethod; // EQUAL_PAYMENT / EQUAL_PRINCIPAL / BULLET
|
||||||
private Integer loanMonths; // 대출기간(개월)
|
private Integer loanMonths; // 대출기간(개월)
|
||||||
private LocalDate loanStart; // 대출시작일
|
private LocalDate loanStart; // 대출시작일
|
||||||
|
private Long loanPayment; // 월 상환금(고정, 원리금균등) — 선택 입력
|
||||||
|
|
||||||
public static WalletResponse from(Wallet w, long balance) {
|
public static WalletResponse from(Wallet w, long balance) {
|
||||||
return WalletResponse.builder()
|
return WalletResponse.builder()
|
||||||
@@ -56,6 +57,7 @@ public class WalletResponse {
|
|||||||
.loanMethod(w.getLoanMethod())
|
.loanMethod(w.getLoanMethod())
|
||||||
.loanMonths(w.getLoanMonths())
|
.loanMonths(w.getLoanMonths())
|
||||||
.loanStart(w.getLoanStart())
|
.loanStart(w.getLoanStart())
|
||||||
|
.loanPayment(w.getLoanPayment())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -659,6 +659,7 @@ public class AccountService {
|
|||||||
.loanMethod(isLoan ? blankToNull(req.getLoanMethod()) : null)
|
.loanMethod(isLoan ? blankToNull(req.getLoanMethod()) : null)
|
||||||
.loanMonths(isLoan ? req.getLoanMonths() : null)
|
.loanMonths(isLoan ? req.getLoanMonths() : null)
|
||||||
.loanStart(isLoan ? req.getLoanStart() : null)
|
.loanStart(isLoan ? req.getLoanStart() : null)
|
||||||
|
.loanPayment(isLoan ? req.getLoanPayment() : null)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ ALTER TABLE wallet ADD COLUMN IF NOT EXISTS loan_method VARCHAR(20) NULL COMME
|
|||||||
ALTER TABLE wallet ADD COLUMN IF NOT EXISTS loan_months INT NULL COMMENT '대출기간(개월)';
|
ALTER TABLE wallet ADD COLUMN IF NOT EXISTS loan_months INT NULL COMMENT '대출기간(개월)';
|
||||||
ALTER TABLE wallet ADD COLUMN IF NOT EXISTS loan_start DATE NULL COMMENT '대출시작일';
|
ALTER TABLE wallet ADD COLUMN IF NOT EXISTS loan_start DATE NULL COMMENT '대출시작일';
|
||||||
ALTER TABLE wallet ADD COLUMN IF NOT EXISTS loan_amount BIGINT NULL COMMENT '대출 실행 금액(원금, 처음 빌린 금액)';
|
ALTER TABLE wallet ADD COLUMN IF NOT EXISTS loan_amount BIGINT NULL COMMENT '대출 실행 금액(원금, 처음 빌린 금액)';
|
||||||
|
ALTER TABLE wallet ADD COLUMN IF NOT EXISTS loan_payment BIGINT NULL COMMENT '월 상환금(고정, 원리금균등) — 은행 조회액과 맞추기 위한 선택 입력';
|
||||||
-- 계좌번호 암호화 저장(AES-GCM)으로 평문보다 길어 VARCHAR(255) 필요 — 운영 적용 완료(CREATE TABLE 정의에 반영).
|
-- 계좌번호 암호화 저장(AES-GCM)으로 평문보다 길어 VARCHAR(255) 필요 — 운영 적용 완료(CREATE TABLE 정의에 반영).
|
||||||
-- 매 기동 MODIFY 는 라이브 테이블 락 위험이 있어 제거. 기존 환경 확장이 필요하면 1회 수동 적용:
|
-- 매 기동 MODIFY 는 라이브 테이블 락 위험이 있어 제거. 기존 환경 확장이 필요하면 1회 수동 적용:
|
||||||
-- ALTER TABLE wallet MODIFY account_number VARCHAR(255) NULL;
|
-- ALTER TABLE wallet MODIFY account_number VARCHAR(255) NULL;
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
<result property="loanMethod" column="loan_method"/>
|
<result property="loanMethod" column="loan_method"/>
|
||||||
<result property="loanMonths" column="loan_months"/>
|
<result property="loanMonths" column="loan_months"/>
|
||||||
<result property="loanStart" column="loan_start"/>
|
<result property="loanStart" column="loan_start"/>
|
||||||
|
<result property="loanPayment" column="loan_payment"/>
|
||||||
<result property="sortOrder" column="sort_order"/>
|
<result property="sortOrder" column="sort_order"/>
|
||||||
<result property="createdAt" column="created_at"/>
|
<result property="createdAt" column="created_at"/>
|
||||||
<result property="updatedAt" column="updated_at"/>
|
<result property="updatedAt" column="updated_at"/>
|
||||||
@@ -27,7 +28,7 @@
|
|||||||
|
|
||||||
<sql id="cols">id, member_id, type, name, issuer, account_number, card_type,
|
<sql id="cols">id, member_id, type, name, issuer, account_number, card_type,
|
||||||
opening_balance, opening_date, current_value,
|
opening_balance, opening_date, current_value,
|
||||||
loan_amount, loan_rate, loan_method, loan_months, loan_start,
|
loan_amount, loan_rate, loan_method, loan_months, loan_start, loan_payment,
|
||||||
sort_order, created_at, updated_at</sql>
|
sort_order, created_at, updated_at</sql>
|
||||||
|
|
||||||
<select id="findByMember" parameterType="long" resultMap="walletResultMap">
|
<select id="findByMember" parameterType="long" resultMap="walletResultMap">
|
||||||
@@ -45,12 +46,12 @@
|
|||||||
useGeneratedKeys="true" keyProperty="id">
|
useGeneratedKeys="true" keyProperty="id">
|
||||||
INSERT INTO wallet (member_id, type, name, issuer, account_number, card_type,
|
INSERT INTO wallet (member_id, type, name, issuer, account_number, card_type,
|
||||||
opening_balance, opening_date, current_value,
|
opening_balance, opening_date, current_value,
|
||||||
loan_amount, loan_rate, loan_method, loan_months, loan_start,
|
loan_amount, loan_rate, loan_method, loan_months, loan_start, loan_payment,
|
||||||
sort_order, created_at, updated_at)
|
sort_order, created_at, updated_at)
|
||||||
VALUES (#{memberId}, #{type}, #{name}, #{issuer},
|
VALUES (#{memberId}, #{type}, #{name}, #{issuer},
|
||||||
#{accountNumber, typeHandler=com.sb.web.common.crypto.EncryptedStringTypeHandler}, #{cardType},
|
#{accountNumber, typeHandler=com.sb.web.common.crypto.EncryptedStringTypeHandler}, #{cardType},
|
||||||
#{openingBalance}, #{openingDate}, #{currentValue},
|
#{openingBalance}, #{openingDate}, #{currentValue},
|
||||||
#{loanAmount}, #{loanRate}, #{loanMethod}, #{loanMonths}, #{loanStart},
|
#{loanAmount}, #{loanRate}, #{loanMethod}, #{loanMonths}, #{loanStart}, #{loanPayment},
|
||||||
#{sortOrder}, NOW(), NOW())
|
#{sortOrder}, NOW(), NOW())
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@@ -63,7 +64,7 @@
|
|||||||
current_value = #{currentValue},
|
current_value = #{currentValue},
|
||||||
loan_amount = #{loanAmount},
|
loan_amount = #{loanAmount},
|
||||||
loan_rate = #{loanRate}, loan_method = #{loanMethod},
|
loan_rate = #{loanRate}, loan_method = #{loanMethod},
|
||||||
loan_months = #{loanMonths}, loan_start = #{loanStart}
|
loan_months = #{loanMonths}, loan_start = #{loanStart}, loan_payment = #{loanPayment}
|
||||||
WHERE id = #{id} AND member_id = #{memberId}
|
WHERE id = #{id} AND member_id = #{memberId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user