-
Notifications
You must be signed in to change notification settings - Fork 1
[Fix] 계약 생성시 상태변경이력 동기화 안되는 버그 수정 #349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,7 @@ | |
|
|
||
| import java.math.BigDecimal; | ||
| import java.time.LocalDate; | ||
| import java.time.OffsetDateTime; | ||
| import java.util.List; | ||
| import java.util.ArrayList; | ||
| import java.util.LinkedHashMap; | ||
|
|
@@ -201,7 +202,21 @@ public ContractCreateResponse createContract(ContractCreateRequest request) { | |
| calculateCapCheckOrRegisterReview(contractId, paymentStage, command); | ||
| } | ||
|
|
||
| // TODO(FUN-026, 2차): 계약 생성 상태 사건 이력을 등록한다. | ||
| // 계약 상세의 상태 변경 이력에서 생성 당시의 최초 상태도 확인할 수 있도록 | ||
| // 계약일을 효력일로 하는 event_seq=1 사건을 같은 트랜잭션에 남긴다. | ||
| OffsetDateTime receivedAt = DateUtil.nowSeoul(); | ||
| OffsetDateTime effectiveAt = request.getContractDate() | ||
| .atStartOfDay(DateUtil.SEOUL_ZONE) | ||
| .toOffsetDateTime(); | ||
| int insertedStatusEvents = contractStatusEventMapper.insertInitialEvent( | ||
| contractId, | ||
| request.getContractStatus(), | ||
| effectiveAt, | ||
| receivedAt | ||
| ); | ||
| if (insertedStatusEvents != 1) { | ||
| throw new FgcBusinessException(FgcErrorCode.COMMON_500); | ||
| } | ||
|
Comment on lines
+205
to
+219
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 범위 위반 — 인터페이스정의서의 명시적 결정 사항(C안):
즉 1차에서 이 테이블에 값이 채워지는 유일한 경로는 시드 데이터이며, 애플리케이션 코드(계약 생성 API)가 INSERT하는 것은 문서상 2차(CONT-W04, 추가 근거:
또한 인터페이스정의서는 원래 있던 |
||
|
|
||
| auditLogService.record(AuditLogService.AuditEvent.builder() | ||
| .actionCode(AUDIT_CONTRACT_CREATED) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,17 @@ | |
|
|
||
| <mapper namespace="com.susukkang.fgc.contract.mapper.ContractStatusEventMapper"> | ||
|
|
||
| <insert id="insertInitialEvent"> | ||
| INSERT INTO fgc.contract_status_event | ||
| (contract_id, event_seq, previous_status, new_status, | ||
| effective_at, received_at, reason_code, | ||
| source_system, source_event_key, data_origin) | ||
| VALUES | ||
| (#{contractId}, 1, NULL, #{newStatus}, | ||
| #{effectiveAt}, #{receivedAt}, 'NEW_CONTRACT', | ||
| 'FGC_MANUAL', CONCAT('CONTRACT_CREATED:', #{contractId}), 'MANUAL') | ||
| </insert> | ||
|
Comment on lines
+8
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 같은 이슈: 이 INSERT 경로 자체가 문서상 1차 범위 밖입니다 (docs/05_인터페이스정의서_v2_0.md:905 — "1차 = 시드 적재 + CONT-W02 탭1 읽기(IF-API-16) + 배치 소비만, 등록 API·화면은 2차 유지"). ContractService.java 쪽 코멘트 참고. 부수적으로, |
||
|
|
||
| <select id="selectByContractId" | ||
| resultType="com.susukkang.fgc.contract.dto.ContractStatusEventRow"> | ||
| SELECT contract_status_event_id, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
receivedAt을 계약 수신 시점에 캡처하세요.DateUtil.nowSeoul()은 계약 저장, 스냅샷 생성, 스케줄 생성, 한도 검증이 끝난 뒤 호출됩니다. 따라서received_at에 FGC 수신 시각이 아니라 이벤트 INSERT 직전 시각이 저장됩니다. 처리 시간이 길면 지연 및 순서 판정이 실제 수신 순서와 달라질 수 있습니다.createContract진입 직후 서울 현재 시각을 한 번 캡처하고, 같은 값을insertInitialEvent에 전달하세요.수신 시각 캡처 위치 수정 예시
`@Transactional` public ContractCreateResponse createContract(ContractCreateRequest request) { + OffsetDateTime receivedAt = DateUtil.nowSeoul(); validateInput(request); ... - OffsetDateTime receivedAt = DateUtil.nowSeoul(); OffsetDateTime effectiveAt = request.getContractDate()As per path instructions:
docs/FGC_가상_GA_운영정책서_v1_0.md의effective_at·received_at분리 및 수신 시점 기준을 적용했습니다(제공된 문서 발췌에는 문서 줄 번호가 없습니다).🤖 Prompt for AI Agents
Source: Path instructions