feat(API): 부실채권, 재고, 입고 기능 개선
- BadDebt 컨트롤러/서비스 기능 확장 - StockService 재고 조회 로직 개선 - ProcessReceivingRequest 검증 규칙 수정 - Item, Order, CommonCode, Shipment 모델 업데이트 - TodayIssueObserverService 개선 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -87,14 +87,19 @@ public function handleOrderDeleted(Order $order): void
|
||||
}
|
||||
|
||||
/**
|
||||
* 미수금(주식 이슈) 생성/삭제
|
||||
* 미수금(추심 이슈) 생성/삭제
|
||||
*
|
||||
* is_active가 true로 설정(토글 ON)되면 오늘의 이슈에 추가
|
||||
* is_active가 false로 설정(토글 OFF)되면 오늘의 이슈에서 삭제
|
||||
*/
|
||||
public function handleBadDebtChange(BadDebt $badDebt): void
|
||||
{
|
||||
// 추심 진행 중인 건만 이슈 생성
|
||||
if (in_array($badDebt->status, ['in_progress', 'legal_action'])) {
|
||||
// is_active(설정 토글)이 켜져 있고, 추심중 또는 법적조치 상태인 경우 이슈 생성
|
||||
$isActiveStatus = in_array($badDebt->status, [BadDebt::STATUS_COLLECTING, BadDebt::STATUS_LEGAL_ACTION]);
|
||||
|
||||
if ($badDebt->is_active && $isActiveStatus) {
|
||||
$clientName = $badDebt->client?->name ?? __('message.today_issue.unknown_client');
|
||||
$amount = number_format($badDebt->total_amount ?? 0);
|
||||
$amount = number_format($badDebt->debt_amount ?? 0);
|
||||
$days = $badDebt->overdue_days ?? 0;
|
||||
|
||||
$this->createIssueWithFcm(
|
||||
@@ -112,6 +117,7 @@ public function handleBadDebtChange(BadDebt $badDebt): void
|
||||
expiresAt: null // 해결될 때까지 유지
|
||||
);
|
||||
} else {
|
||||
// is_active가 false이거나 상태가 회수완료/대손처리인 경우 이슈 삭제
|
||||
TodayIssue::removeBySource($badDebt->tenant_id, TodayIssue::SOURCE_BAD_DEBT, $badDebt->id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user