|
|
|
|
@ -33,6 +33,7 @@ import org.dromara.oa.crm.mapper.CrmGiftIssueRecordMapper;
|
|
|
|
|
import org.dromara.oa.crm.service.ICrmGiftApplyService;
|
|
|
|
|
import org.dromara.system.api.RemoteCodeRuleService;
|
|
|
|
|
import org.dromara.workflow.api.RemoteWorkflowService;
|
|
|
|
|
import org.dromara.workflow.api.domain.RemoteFlowInstanceBizExt;
|
|
|
|
|
import org.dromara.workflow.api.domain.RemoteStartProcess;
|
|
|
|
|
import org.dromara.workflow.api.event.ProcessEvent;
|
|
|
|
|
import org.springframework.context.event.EventListener;
|
|
|
|
|
@ -308,6 +309,19 @@ public class CrmGiftApplyServiceImpl implements ICrmGiftApplyService {
|
|
|
|
|
this.updateByBo(bo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bo.getVariables() == null) {
|
|
|
|
|
bo.setVariables(new HashMap<>(16));
|
|
|
|
|
}
|
|
|
|
|
if (bo.getBizExt() == null) {
|
|
|
|
|
bo.setBizExt(new RemoteFlowInstanceBizExt());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 这里必须以后端落库后的真实编号为准,避免“新建后直接提交”时前端还拿着空 applicationCode
|
|
|
|
|
bo.getVariables().put("giftApplyId", bo.getGiftApplyId());
|
|
|
|
|
bo.getVariables().put("applicationCode", bo.getApplicationCode());
|
|
|
|
|
bo.getBizExt().setBusinessId(String.valueOf(bo.getGiftApplyId()));
|
|
|
|
|
bo.getBizExt().setBusinessCode(bo.getApplicationCode());
|
|
|
|
|
|
|
|
|
|
// 4. 后端发起需要忽略权限
|
|
|
|
|
bo.getVariables().put("ignore", true);
|
|
|
|
|
|
|
|
|
|
@ -317,7 +331,9 @@ public class CrmGiftApplyServiceImpl implements ICrmGiftApplyService {
|
|
|
|
|
startProcess.setFlowCode(bo.getFlowCode());
|
|
|
|
|
startProcess.setVariables(bo.getVariables());
|
|
|
|
|
startProcess.setBizExt(bo.getBizExt());
|
|
|
|
|
bo.getBizExt().setBusinessId(startProcess.getBusinessId());
|
|
|
|
|
// 再次覆盖流程入参,原因是流程引擎最终读取的是 startProcess.bizExt,不能依赖前端初始值
|
|
|
|
|
startProcess.getBizExt().setBusinessId(startProcess.getBusinessId());
|
|
|
|
|
startProcess.getBizExt().setBusinessCode(bo.getApplicationCode());
|
|
|
|
|
boolean flagOne = remoteWorkflowService.startCompleteTask(startProcess);
|
|
|
|
|
if (!flagOne) {
|
|
|
|
|
throw new ServiceException("流程发起异常");
|
|
|
|
|
|