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.DelegateTask; import com.ruili.wcp.engine.flow.delegate.TaskListener; import zbooksoft.fams.common.BusinessException; import zbooksoft.fams.service.AssetApplyService; /** * 资产使用流程「申请」节点的“操作完成前”事件:校验并给所选资产加在途锁,失败则阻断提交 * @author ycq * @date 2026-10-16 */ public class AssetApplySubmitListener implements TaskListener { @Override public void notify(DelegateTask delegateTask) throws Exception { FlowRuntimeExecution execution = delegateTask.getProcessInstance(); AssetApplyService service = (AssetApplyService) SpringContextUtil.getBean(AssetApplyService.class); try { service.submit(service.typeOfTable(execution.getTableId()), execution.getKeyId()); } catch (BusinessException e) { // 平台捕获监听器异常后会中断提交并把消息提示给办理人 throw new Exception(e.getMessage(), e); } } }