diff --git a/src/components/list/ListJobProgress.tsx b/src/components/list/ListJobProgress.tsx
index 00e848a..a361caa 100644
--- a/src/components/list/ListJobProgress.tsx
+++ b/src/components/list/ListJobProgress.tsx
@@ -9,6 +9,7 @@ import { useAuth } from '@/hooks/useAuth'
import { clientEnv } from '@/lib/env.client'
import { LIST_JOB_STAGE_LABEL, LIST_JOB_STATUS_LABEL, listJobLabel } from '@/const/listJobConst'
import { isActiveListJob, type ListJob, type ListJobFailurePage } from '@/types/list-job'
+import { formatMessageJobResult } from '@/utils/listJobResult'
type JobDetailPath = 'validation-errors' | 'sid-failures' | 'range-failures' | 'message-report/batches' | 'message-report/preparation-failures'
type JobDetailSection = { path: JobDetailPath; label: string }
@@ -68,9 +69,9 @@ function Progress({ job }: { job: ListJob }) {
const p = job.progress ?? {}
if (job.jobType.endsWith('_BULK')) return (
파일 처리 대상 {n(p.processedSidCnt)} · 작성 행 {n(p.writtenRowCnt)} · 작성 파일 {n(p.writtenFileCnt)}
@@ -166,15 +167,19 @@ export function ListJobProgress({ prjctIdx, job }: { prjctIdx: number; job: List
},
})
// 배정 작업은 진행 중일 때 operation에 따라 "배정 중"/"배정 초기화 중"으로 표시한다.
- const statusText = job.jobType === 'LIST_ASSIGN' && job.operation && job.jobStatus === 'RUNNING'
- ? `${listJobLabel(job.jobType, job.operation)} 중`
- : LIST_JOB_STATUS_LABEL[job.jobStatus]
+ let statusText = LIST_JOB_STATUS_LABEL[job.jobStatus]
+ if (job.jobType === 'LIST_ASSIGN' && job.operation && job.jobStatus === 'RUNNING') {
+ statusText = `${listJobLabel(job.jobType, job.operation)} 중`
+ } else if (job.jobType.endsWith('_BULK') && job.jobStatus === 'SUCCEEDED') {
+ statusText = '접수 완료'
+ }
return (
{active &&
창을 닫아도 작업은 계속되며, 완료 시 알림을 드립니다.
}
{statusText} · 단계: {stageLabel(job.jobStage)} · 접수 {job.regDt.replace('T', ' ').slice(0, 19)}
- {job.jobStatus !== 'SUCCEEDED' && !active &&
{job.errorMessage || (job.cancelReason === 'USER_REQUEST' ? '사용자 요청으로 중단됐습니다.' : '처리가 종료됐습니다.')} {job.jobStage === 'VALIDATION_FAILED' ? '파일 검증 단계에서 중단되어 리스트 데이터는 변경되지 않았습니다.' : '이미 반영된 내용이 있을 수 있으니 확인 후 다시 요청하세요.'}
}
+ {job.jobStatus === 'PARTIALLY_SUCCEEDED' &&
일부 대상은 접수되지 않았거나 접수 여부를 확인하지 못했습니다. 아래 접수 내역과 준비 실패 내역을 확인해 주세요.
}
+ {job.jobStatus !== 'SUCCEEDED' && job.jobStatus !== 'PARTIALLY_SUCCEEDED' && !active &&
{job.errorMessage || (job.cancelReason === 'USER_REQUEST' ? '사용자 요청으로 중단됐습니다.' : '처리가 종료됐습니다.')} {job.jobStage === 'VALIDATION_FAILED' ? '파일 검증 단계에서 중단되어 리스트 데이터는 변경되지 않았습니다.' : '이미 반영된 내용이 있을 수 있으니 확인 후 다시 요청하세요.'}
}
{job.jobStatus === 'FAILED' && job.failedChunkNo != null &&
실패한 처리 구간: {n(job.failedChunkNo)}번째
}
{(job.resultFiles.length > 0 || job.jobType === 'LIST_UPLOAD') &&
{job.resultFiles.map(file => file.ready
diff --git a/src/components/list/ListJobWatcher.tsx b/src/components/list/ListJobWatcher.tsx
index 21c2de1..643f0c5 100644
--- a/src/components/list/ListJobWatcher.tsx
+++ b/src/components/list/ListJobWatcher.tsx
@@ -13,7 +13,8 @@ import { useSelectedProject } from '@/hooks/useSelectedProject'
import { useDialog } from '@/hooks/useDialog'
import type { SelectedProject } from '@/store/jotai/project'
import { markListJobNotified, trackListJob, untrackListJob, useTrackedListJobs } from '@/store/list-job-tracker'
-import { LIST_JOB_VIEW, listJobLabel } from '@/const/listJobConst'
+import { LIST_JOB_VIEW } from '@/const/listJobConst'
+import { getListJobResultNotification } from '@/utils/listJobResult'
import { isActiveListJob, isListJobType, parseListJob, type ListJob } from '@/types/list-job'
function isProjectSelection(value: unknown, projectId: number): value is SelectedProject {
@@ -100,14 +101,12 @@ export function ListJobWatcher({ userId, prjctIdx }: { userId: string; prjctIdx:
void qc.invalidateQueries({ queryKey: key })
}
if (openRequest?.opened && openRequest.jobKey === tracked.jobKey) return
- const label = listJobLabel(job.jobType, job.operation)
const open = { label: '보기', onClick: () => {
hideAll()
setOpenRequest({ userId, prjctIdx: tracked.prjctIdx, jobType: tracked.jobType, jobKey: tracked.jobKey, opened: false })
} }
- if (job.jobStatus === 'SUCCEEDED') toast.success(`${label} 작업이 완료됐습니다.`, { action: open })
- else if (job.jobStatus === 'CANCELLED') toast.info(`${label} 작업이 중단됐습니다.`, { action: open })
- else toast.error(`${label} 작업이 실패했습니다.`, { action: open })
+ const notification = getListJobResultNotification(job)
+ toast[notification.kind](notification.message, { action: open, description: notification.description })
})
}, [details, trackedJobs, openRequest, setOpenRequest, qc, userId, hideAll])
diff --git a/src/const/listJobConst.ts b/src/const/listJobConst.ts
index 570e42e..9588803 100644
--- a/src/const/listJobConst.ts
+++ b/src/const/listJobConst.ts
@@ -29,7 +29,7 @@ export const listJobLabel = (jobType: string, operation?: ListJobOperation | nul
}
export const LIST_JOB_STATUS_LABEL: Record = {
- QUEUED: '대기', RUNNING: '진행 중', CANCEL_REQUESTED: '중단 요청 중', SUCCEEDED: '완료',
+ QUEUED: '대기', RUNNING: '진행 중', CANCEL_REQUESTED: '중단 요청 중', SUCCEEDED: '완료', PARTIALLY_SUCCEEDED: '일부 접수 완료',
FAILED: '실패', CANCELLED: '중단', REJECTED: '접수 거절',
}
diff --git a/src/types/list-job.ts b/src/types/list-job.ts
index c5a75e2..5ec7547 100644
--- a/src/types/list-job.ts
+++ b/src/types/list-job.ts
@@ -1,4 +1,4 @@
-export type ListJobStatus = 'QUEUED' | 'RUNNING' | 'CANCEL_REQUESTED' | 'SUCCEEDED' | 'FAILED' | 'CANCELLED' | 'REJECTED'
+export type ListJobStatus = 'QUEUED' | 'RUNNING' | 'CANCEL_REQUESTED' | 'SUCCEEDED' | 'PARTIALLY_SUCCEEDED' | 'FAILED' | 'CANCELLED' | 'REJECTED'
// 배정·배정 초기화는 LIST_ASSIGN 하나로 통합됐다. 두 명령은 operation(ASSIGN/RESET)으로만 구분한다.
export const LIST_JOB_TYPES = [
@@ -83,7 +83,7 @@ export type ListJobAvailability = {
export const isActiveListJob = (status: ListJobStatus) =>
status === 'QUEUED' || status === 'RUNNING' || status === 'CANCEL_REQUESTED'
-const statuses: string[] = ['QUEUED', 'RUNNING', 'CANCEL_REQUESTED', 'SUCCEEDED', 'FAILED', 'CANCELLED', 'REJECTED']
+const statuses: string[] = ['QUEUED', 'RUNNING', 'CANCEL_REQUESTED', 'SUCCEEDED', 'PARTIALLY_SUCCEEDED', 'FAILED', 'CANCELLED', 'REJECTED']
const isJobKeyOrNull = (value: unknown) => value === null || (typeof value === 'string' && /^[a-f0-9]{32}$/.test(value))
export function parseListJob(value: unknown): ListJob {
diff --git a/src/utils/listJobResult.ts b/src/utils/listJobResult.ts
new file mode 100644
index 0000000..6436f80
--- /dev/null
+++ b/src/utils/listJobResult.ts
@@ -0,0 +1,58 @@
+import { listJobLabel } from '@/const/listJobConst'
+import type { ListJob } from '@/types/list-job'
+
+/** SID와 수신자 건수는 단위가 다르므로 합산하지 않는다. */
+export function formatMessageJobResult(progress: ListJob['progress']): string {
+ const p = progress ?? {}
+ const accepted = p.acceptedRecipientCnt
+ const parts = [typeof accepted === 'number' && Number.isSafeInteger(accepted) && accepted >= 0
+ ? `${accepted.toLocaleString()}건 접수 완료` : '접수 건수 확인 불가']
+ const fields = [
+ ['preparationFailedSidCnt', '준비 실패 SID', '개'],
+ ['noDestinationSkippedSidCnt', '수신처 없음 SID', '개 제외'],
+ ['failedRecipientCnt', '접수 실패', '건'],
+ ['unknownRecipientCnt', '접수 여부 불명', '건'],
+ ] as const
+ for (const [field, label, unit] of fields) {
+ const value = p[field]
+ if (typeof value === 'number' && Number.isSafeInteger(value) && value > 0) {
+ parts.push(`${label} ${value.toLocaleString()}${unit}`)
+ }
+ }
+ return parts.join(', ')
+}
+
+type JobNotification = {
+ kind: 'success' | 'warning' | 'info' | 'error'
+ message: string
+ description?: string
+}
+
+/** errorCode가 있어도 최종 성공 여부는 서버 jobStatus를 따른다. */
+export function getListJobResultNotification(job: ListJob): JobNotification {
+ const label = listJobLabel(job.jobType, job.operation)
+ const messageJob = job.jobType.endsWith('_BULK')
+ const summary = messageJob ? formatMessageJobResult(job.progress) : undefined
+ switch (job.jobStatus) {
+ case 'SUCCEEDED':
+ return {
+ kind: 'success',
+ message: messageJob ? `${label} 접수 완료` : `${label} 작업이 완료됐습니다.`,
+ description: summary,
+ }
+ case 'PARTIALLY_SUCCEEDED':
+ return {
+ kind: 'warning',
+ message: `${label} 일부 접수 완료`,
+ description: [summary, '접수는 실제 전달 완료가 아닙니다. 전체 재발송 전에 접수 내역을 확인해 주세요.'].filter(Boolean).join('\n'),
+ }
+ case 'CANCELLED':
+ return { kind: 'info', message: `${label} 작업이 중단됐습니다.`, description: summary }
+ default:
+ return {
+ kind: 'error',
+ message: job.jobStatus === 'REJECTED' ? `${label} 접수가 거절됐습니다.` : `${label} 작업이 실패했습니다.`,
+ description: [job.errorMessage, summary].filter(Boolean).join('\n'),
+ }
+ }
+}