fix: [eaccount] 계좌 입출금내역 적요 중복 표시 수정
- BankTransaction::cleanSummary() 메서드 추가: 상대계좌예금주명(cast) 중복 제거 - parseTransactionLogs: 적요 표시 시 remark2 중복 제거 적용 - cacheApiTransactions: DB 저장 시에도 중복 제거 적용 - 기존 DB 데이터 45건 정리 완료
This commit is contained in:
@@ -49,19 +49,40 @@ public function tenant(): BelongsTo
|
||||
return $this->belongsTo(Tenant::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 적요(summary)에서 상대계좌예금주명(cast/remark2) 중복 제거
|
||||
* 바로빌 API 응답에서 TransRemark1에 TransRemark2가 포함되는 경우 정리
|
||||
*/
|
||||
public static function cleanSummary(string $summary, string $remark): string
|
||||
{
|
||||
if (empty($remark) || empty($summary) || ! str_contains($summary, $remark)) {
|
||||
return $summary;
|
||||
}
|
||||
|
||||
$result = rtrim($summary);
|
||||
|
||||
while (str_ends_with($result, $remark) && strlen($result) > strlen($remark)) {
|
||||
$result = rtrim(substr($result, 0, -strlen($remark)));
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 거래 고유 키 생성 (매칭용)
|
||||
* 숫자는 정수로 변환하여 형식 통일
|
||||
*/
|
||||
public function getUniqueKeyAttribute(): string
|
||||
{
|
||||
$cleanSummary = self::cleanSummary($this->summary ?? '', $this->cast ?? '');
|
||||
|
||||
return implode('|', [
|
||||
$this->bank_account_num,
|
||||
$this->trans_dt,
|
||||
(int) $this->deposit,
|
||||
(int) $this->withdraw,
|
||||
(int) $this->balance,
|
||||
$this->summary ?? '',
|
||||
$cleanSummary,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user