package zbooksoft.fams.delegate;
|
|
import com.ruili.wcp.common.SpringContextUtil;
|
import com.ruili.wcp.data.entity.management.FlowRuntimeExecution;
|
import com.ruili.wcp.engine.flow.delegate.DelegateExecution;
|
import com.ruili.wcp.engine.flow.delegate.ExecutionListener;
|
import org.slf4j.Logger;
|
import org.slf4j.LoggerFactory;
|
import zbooksoft.fams.service.AssetApplyService;
|
|
/**
|
* 资产使用流程的流程终止监听器:解除资产在途锁,单据改为已终止
|
* @author ycq
|
* @date 2026-10-16
|
*/
|
public class AssetApplyTerminateListener implements ExecutionListener {
|
|
private static final Logger LOGGER = LoggerFactory.getLogger(AssetApplyTerminateListener.class);
|
|
@Override
|
public void notify(DelegateExecution execution) {
|
if (!(execution instanceof FlowRuntimeExecution)) {
|
LOGGER.error("流程终止监听器收到的执行对象类型不支持:{},资产锁未释放", execution == null ? null : execution.getClass());
|
return;
|
}
|
FlowRuntimeExecution runtime = (FlowRuntimeExecution) execution;
|
AssetApplyService service = (AssetApplyService) SpringContextUtil.getBean(AssetApplyService.class);
|
service.terminate(service.typeOfTable(runtime.getTableId()), runtime.getKeyId());
|
}
|
}
|