业务对接审批流程,是通过
@ProcessListener
监听审批流程执行事件,然后做相应的处理
saas_process.process_rule
前端当然已经做好标准的提交、反提交的交互
ProcessStartedEvent
事件ProcessCancelledEvent
事件ProcessApprovedEvent
事件销售订单
/**
* 审批流程发起
*
* @param event
*/
@ProcessListener("Sale")
public void onProcessStartedEvent(ProcessStartedEvent event) {
Sale sale = new Sale();
sale.setId(event.getBizId());
sale.setSa_status(Status.SUBMITTED.getDisplay());
sale.setSa_statuscode(Status.SUBMITTED.name());
sale.setUpdateTime(new Date());
sale.setUpdaterName(event.getLauncher());
sale.setUpdaterId(event.getLauncherId());
saleMapper.updateByPrimaryKeySelective(sale);
DocBaseDTO baseDTO = new DocBaseDTO();
baseDTO.setId(event.getBizId());
baseDTO.setCode(event.getBizCode());
baseDTO.setName(event.getBizType());
// 发布操作事件
BizOperationEvent.submit(baseDTO).publish();
}
/**
* 审批流程取消
*
* @param event
*/
@ProcessListener("Sale")
public void onProcessCancelledEvent(ProcessCancelledEvent event) {
// 反提交,流程取消
if (!event.isApproved()) {
Sale sale = new Sale();
sale.setId(event.getBizId());
sale.setSa_status(Status.UNAUDITED.getDisplay());
sale.setSa_statuscode(Status.UNAUDITED.name());
sale.setUpdateTime(new Date());
sale.setUpdaterName(event.getTerminator());
sale.setUpdaterId(event.getTerminatorId());
saleMapper.updateByPrimaryKeySelective(sale);
DocBaseDTO baseDTO = new DocBaseDTO();
baseDTO.setId(event.getBizId());
baseDTO.setCode(event.getBizCode());
baseDTO.setName(event.getBizType());
// 发布操作事件
BizOperationEvent.unSubmit(baseDTO).publish();
}
}
/**
* 流程审批通过,执行审核操作
*
* @param event
*/
@ProcessListener("Sale")
public void onProcessApprovedEvent(ProcessApprovedEvent event) {
// 审核方法执行完成发起BizOperationEvent的时候,一定要标记来源为该ProcessApprovedEvent
// 否则会引起循环调用
singleAudit(event.getBizId(), event);
}