package com.ruoyi.task.event;
|
|
import com.ruoyi.common.core.event.FollowupCompletedEvent;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.context.ApplicationEventPublisher;
|
import org.springframework.stereotype.Component;
|
|
import java.util.Date;
|
|
/**
|
* 随访完成事件发布器。
|
*
|
* <p>任务模块在子任务状态更新为已完成(sendstate=6)后发布事件,
|
* 档案等下游模块通过 {@code @TransactionalEventListener} 异步消费。</p>
|
*
|
* @author ruoyi
|
* @date 2026-11-11
|
*/
|
@Slf4j
|
@Component
|
public class FollowupCompletedEventPublisher {
|
|
@Autowired
|
private ApplicationEventPublisher applicationEventPublisher;
|
|
public void publish(Long subId) {
|
if (subId == null) {
|
return;
|
}
|
try {
|
applicationEventPublisher.publishEvent(new FollowupCompletedEvent(subId, new Date()));
|
} catch (Exception e) {
|
log.error("发布随访完成事件失败,subId={}", subId, e);
|
}
|
}
|
}
|