txErr:=tx.First(&edge,"workflow_process_id = ? and source = ? and condition_expression = ?",oldWfm.WorkflowProcessID,nodeInfo.ID,oldWfm.Param).Error
iftxErr!=nil{
returntxErr,[]model.WorkflowMove{}
}
newWfm=append(newWfm,model.WorkflowMove{
BusinessID:oldWfm.BusinessID,
BusinessType:oldWfm.BusinessType,
PromoterID:oldWfm.PromoterID,
OperatorID:0,
WorkflowNodeID:edge.Target,
WorkflowProcessID:oldWfm.WorkflowProcessID,
Param:"",
Action:"",
IsActive:true,})
returnnil,newWfm
casemodel.INCLUSIVE_GATEWAY:
// 当为包容网关时,需要等待其他网关执行结束才进行创建
txErr:=tx.Find(&edges,"workflow_process_id = ? and target = ?",oldWfm.WorkflowProcessID,nodeInfo.ID).Error
iftxErr!=nil{
returntxErr,[]model.WorkflowMove{}
}
varsourceIds[]string
for_,v:=rangeedges{
sourceIds=append(sourceIds,v.Source)
}
txErr=tx.Find(&wfms,"workflow_process_id = ? and business_id = ? and workflow_node_id in (?) and is_active = ?",oldWfm.WorkflowProcessID,oldWfm.BusinessID,sourceIds,false).Error
iftxErr!=nil{
returntxErr,[]model.WorkflowMove{}
}
iflen(wfms)!=len(edges){
returnnil,[]model.WorkflowMove{}
}
iflen(wfms)==len(edges){
//var params string
//for _,v := range wfms{
// params += v.Param
//}
//参数携带模式暂时未定
txErr:=tx.First(&edge,"workflow_process_id = ? and source = ?",oldWfm.WorkflowProcessID,nodeInfo.ID).Error
iftxErr!=nil{
returntxErr,[]model.WorkflowMove{}
}
newWfm=append(newWfm,model.WorkflowMove{
BusinessID:oldWfm.BusinessID,
BusinessType:oldWfm.BusinessType,
PromoterID:oldWfm.PromoterID,
OperatorID:0,
WorkflowNodeID:edge.Target,
WorkflowProcessID:oldWfm.WorkflowProcessID,
Param:"",
Action:"",
IsActive:true,})
}
returnnil,newWfm
casemodel.PARELLEL_GATEWAY:
// 当为并行网关时候 找出所有线路创建并行节点
txErr:=tx.Find(&edges,"workflow_process_id = ? and source = ?",oldWfm.WorkflowProcessID,nodeInfo.ID).Error
iftxErr!=nil{
returntxErr,[]model.WorkflowMove{}
}
for_,v:=rangeedges{
newWfm=append(newWfm,model.WorkflowMove{
BusinessID:oldWfm.BusinessID,
BusinessType:oldWfm.BusinessType,
PromoterID:oldWfm.PromoterID,
OperatorID:0,
WorkflowNodeID:v.Target,
WorkflowProcessID:oldWfm.WorkflowProcessID,
Param:"",
Action:"",
IsActive:true,})
}
returnnil,newWfm
return&model.WorkflowMove{
default:
newWfm=append(newWfm,model.WorkflowMove{
BusinessID:oldWfm.BusinessID,
BusinessType:oldWfm.BusinessType,
PromoterID:oldWfm.PromoterID,
@ -285,7 +385,8 @@ func createNewWorkflowMove(oldWfm *model.WorkflowMove, targetNodeID string) (new