From d4ff6dae252b2d6929fe9c01d57cce8a6b1890a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B3=B4=EA=B3=A4?= Date: Tue, 10 Feb 2026 12:17:09 +0900 Subject: [PATCH] =?UTF-8?q?fix:=EC=9D=BC=EC=9D=BC=EC=9E=90=EA=B8=88?= =?UTF-8?q?=EC=9D=BC=EB=B3=B4=20=EC=A4=91=EB=B3=B5=20=EC=A0=9C=EA=B1=B0=20?= =?UTF-8?q?=ED=82=A4=EC=97=90=20balance=20=EC=B6=94=EA=B0=80=ED=95=98?= =?UTF-8?q?=EC=97=AC=20=EB=8F=99=EC=9D=BC=20=EA=B8=88=EC=95=A1=20=EB=8B=A4?= =?UTF-8?q?=EB=A5=B8=20=EA=B1=B0=EB=9E=98=20=EA=B5=AC=EB=B6=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 계좌 입출금내역과 동일한 문제: balance 없이 중복 제거하면 같은 출금금액의 서로 다른 거래가 하나로 합쳐지는 문제 수정. BankTransaction 모델의 unique_key 속성(balance 포함)을 재사용. Co-Authored-By: Claude Opus 4.6 --- app/Http/Controllers/Finance/DailyFundController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Finance/DailyFundController.php b/app/Http/Controllers/Finance/DailyFundController.php index 4f1f3200..53ce76eb 100644 --- a/app/Http/Controllers/Finance/DailyFundController.php +++ b/app/Http/Controllers/Finance/DailyFundController.php @@ -174,12 +174,12 @@ public function periodReport(Request $request): JsonResponse $startDateYmd = str_replace('-', '', $startDate); $endDateYmd = str_replace('-', '', $endDate); - // 기간 내 거래내역 조회 (중복 제거: 동일 trans_dt + 금액 조합이면 최신 id(정확한 잔액)만 사용) + // 기간 내 거래내역 조회 (중복 제거: balance 포함 고유키로 동일 거래만 제거) $transactions = BarobillBankTransaction::where('tenant_id', $tenantId) ->whereBetween('trans_date', [$startDateYmd, $endDateYmd]) ->orderBy('id', 'desc') // 최신 ID 우선 (올바른 잔액) ->get() - ->unique(fn($tx) => $tx->bank_account_num . '|' . $tx->trans_dt . '|' . (int)$tx->deposit . '|' . (int)$tx->withdraw) + ->unique(fn($tx) => $tx->unique_key) ->sortByDesc('trans_date') ->sortByDesc(fn($tx) => $tx->trans_date . $tx->trans_time) ->values();