You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
82 lines
2.8 KiB
82 lines
2.8 KiB
|
3 weeks ago
|
package com.crm.lead.state;
|
||
|
|
|
||
|
|
import java.time.LocalDateTime;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 线索状态迁移命令——sealed 类型体系,每条迁移边一个子类型。
|
||
|
|
*
|
||
|
|
* <p>调用方负责预计算所有字段值(快照、deadline 等),
|
||
|
|
* {@link LeadTransition} 不查外部服务,保持对 crm-rule / crm-auth 零依赖。</p>
|
||
|
|
*/
|
||
|
|
public sealed interface TransitionCmd
|
||
|
|
permits TransitionCmd.ClaimCmd,
|
||
|
|
TransitionCmd.AssignToPoolCmd,
|
||
|
|
TransitionCmd.AssignToUserCmd,
|
||
|
|
TransitionCmd.FeedbackCmd,
|
||
|
|
TransitionCmd.ConvertCmd,
|
||
|
|
TransitionCmd.ReleaseCmd,
|
||
|
|
TransitionCmd.ActivateCmd {
|
||
|
|
|
||
|
|
/** 领取:待领取(2) → 已领取(3) */
|
||
|
|
record ClaimCmd(
|
||
|
|
Long operatorId,
|
||
|
|
String ownerNameSnapshot,
|
||
|
|
Long ownerDeptIdSnapshot,
|
||
|
|
LocalDateTime recycleDeadline
|
||
|
|
) implements TransitionCmd {}
|
||
|
|
|
||
|
|
/** 分配到公海池:未分发(1) → 待领取(2) */
|
||
|
|
record AssignToPoolCmd(
|
||
|
|
Long operatorId,
|
||
|
|
Long poolId,
|
||
|
|
String poolNameSnapshot,
|
||
|
|
Long deptId,
|
||
|
|
Long teamDeptId,
|
||
|
|
LocalDateTime expireDeadline
|
||
|
|
) implements TransitionCmd {}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 分配到销售:未分发(1)/待领取(2) → 已领取(3);线索作废(7) → 线索作废(7)(更新 owner)。
|
||
|
|
* 作废状态下 recycleDeadline 为 null。
|
||
|
|
*/
|
||
|
|
record AssignToUserCmd(
|
||
|
|
Long operatorId,
|
||
|
|
Long userId,
|
||
|
|
String ownerNameSnapshot,
|
||
|
|
Long ownerDeptIdSnapshot,
|
||
|
|
LocalDateTime recycleDeadline
|
||
|
|
) implements TransitionCmd {}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 提交反馈:已领取(3)/跟进中(4) → 跟进中(4)/线索作废(7);线索作废(7) → 已领取(3)(作废恢复)。
|
||
|
|
* recycleDeadline 为 null 表示目标状态为线索作废(清 owner,不设 deadline)。
|
||
|
|
*/
|
||
|
|
record FeedbackCmd(
|
||
|
|
Long operatorId,
|
||
|
|
int feedbackStatus,
|
||
|
|
String content,
|
||
|
|
String productCode,
|
||
|
|
String attachmentIds,
|
||
|
|
LocalDateTime recycleDeadline
|
||
|
|
) implements TransitionCmd {}
|
||
|
|
|
||
|
|
/** 转商机:已领取(3)/跟进中(4) → 已转商机(5)(outbound port 已被 service 调通) */
|
||
|
|
record ConvertCmd(
|
||
|
|
Long operatorId,
|
||
|
|
Long opportunityId,
|
||
|
|
String opportunityName
|
||
|
|
) implements TransitionCmd {}
|
||
|
|
|
||
|
|
/** 释放:已领取(3)/跟进中(4) → 待领取(2),清 owner,保留反馈快照 */
|
||
|
|
record ReleaseCmd(
|
||
|
|
Long operatorId
|
||
|
|
) implements TransitionCmd {}
|
||
|
|
|
||
|
|
/** 激活:过期失效(6) → 恢复失效前态,重置回收计时 N 和失效计时 M */
|
||
|
|
record ActivateCmd(
|
||
|
|
Long operatorId,
|
||
|
|
LocalDateTime newExpireDeadline,
|
||
|
|
LocalDateTime newRecycleDeadline
|
||
|
|
) implements TransitionCmd {}
|
||
|
|
}
|