feat(common): 添加 BusinessException/GlobalExceptionHandler/CompanyContext/状态枚举 (T007/T008/T012-T015)
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
package com.label.common.statemachine;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public enum DatasetStatus {
|
||||
PENDING_REVIEW, APPROVED, REJECTED;
|
||||
|
||||
public static final Map<DatasetStatus, Set<DatasetStatus>> TRANSITIONS = Map.of(
|
||||
PENDING_REVIEW, Set.of(APPROVED, REJECTED)
|
||||
// APPROVED/REJECTED: terminal states
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.label.common.statemachine;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public enum SourceStatus {
|
||||
PENDING, PREPROCESSING, EXTRACTING, QA_REVIEW, APPROVED;
|
||||
|
||||
public static final Map<SourceStatus, Set<SourceStatus>> TRANSITIONS = Map.of(
|
||||
PENDING, Set.of(EXTRACTING, PREPROCESSING),
|
||||
PREPROCESSING, Set.of(PENDING),
|
||||
EXTRACTING, Set.of(QA_REVIEW),
|
||||
QA_REVIEW, Set.of(APPROVED)
|
||||
);
|
||||
}
|
||||
16
src/main/java/com/label/common/statemachine/TaskStatus.java
Normal file
16
src/main/java/com/label/common/statemachine/TaskStatus.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package com.label.common.statemachine;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public enum TaskStatus {
|
||||
UNCLAIMED, IN_PROGRESS, SUBMITTED, APPROVED, REJECTED;
|
||||
|
||||
public static final Map<TaskStatus, Set<TaskStatus>> TRANSITIONS = Map.of(
|
||||
UNCLAIMED, Set.of(IN_PROGRESS),
|
||||
IN_PROGRESS, Set.of(SUBMITTED, UNCLAIMED, IN_PROGRESS), // IN_PROGRESS->IN_PROGRESS for ADMIN reassign
|
||||
SUBMITTED, Set.of(APPROVED, REJECTED),
|
||||
REJECTED, Set.of(IN_PROGRESS)
|
||||
// APPROVED: terminal state, no outgoing transitions
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.label.common.statemachine;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public enum VideoJobStatus {
|
||||
PENDING, RUNNING, SUCCESS, FAILED, RETRYING;
|
||||
|
||||
/**
|
||||
* Automatic state machine transitions.
|
||||
* Note: FAILED → PENDING is a manual ADMIN operation, handled separately in VideoProcessService.reset().
|
||||
*/
|
||||
public static final Map<VideoJobStatus, Set<VideoJobStatus>> TRANSITIONS = Map.of(
|
||||
PENDING, Set.of(RUNNING),
|
||||
RUNNING, Set.of(SUCCESS, FAILED, RETRYING),
|
||||
RETRYING, Set.of(RUNNING, FAILED)
|
||||
// SUCCESS: terminal state
|
||||
// FAILED → PENDING: manual ADMIN reset, NOT in this automatic transitions map
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user