|
|
@ -209,8 +209,6 @@ public class FlowRuntime
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return ChildNodes.Where(x => x.Id == "end").First().Id;
|
|
|
|
return ChildNodes.Where(x => x.Id == "end").First().Id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// return ChildNodes.Where(x => x.Pid == nodeId).First().Id;
|
|
|
|
// return ChildNodes.Where(x => x.Pid == nodeId).First().Id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -233,155 +231,66 @@ public class FlowRuntime
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var conditions = conditionNodes[i].Conditions;
|
|
|
|
var nodeSection = conditionNodes[i].Conditions;
|
|
|
|
var conditionalCollections = new List<ConditionalCollections>();
|
|
|
|
var list = new List<ConditionalCollections>();
|
|
|
|
if (conditions.LogicalOperator == "and")
|
|
|
|
var conditionList = new List<KeyValuePair<WhereType, ConditionalModel>>(nodeSection.Conditions.Count);
|
|
|
|
{
|
|
|
|
|
|
|
|
var conditionList = new List<KeyValuePair<WhereType, ConditionalModel>>();
|
|
|
|
|
|
|
|
foreach (var item in conditions.Conditions)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
conditionList.Add(new KeyValuePair<WhereType, ConditionalModel>
|
|
|
|
|
|
|
|
(WhereType.And,
|
|
|
|
|
|
|
|
new ConditionalModel
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
FieldName = item.Field,
|
|
|
|
|
|
|
|
ConditionalType = GetConditionalType(item.Operator),
|
|
|
|
|
|
|
|
FieldValue = item.Value
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (conditionList.Count > 0)
|
|
|
|
var whereType = Enum.Parse<WhereType>(nodeSection.LogicalOperator, true);
|
|
|
|
{
|
|
|
|
foreach (var item in nodeSection.Conditions)
|
|
|
|
conditionalCollections.Add(new ConditionalCollections
|
|
|
|
{
|
|
|
|
{
|
|
|
|
conditionList.Add(new KeyValuePair<WhereType, ConditionalModel>
|
|
|
|
ConditionalList = conditionList
|
|
|
|
(whereType,
|
|
|
|
}
|
|
|
|
new ConditionalModel
|
|
|
|
)
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var groupList = new List<KeyValuePair<WhereType, ConditionalModel>>();
|
|
|
|
|
|
|
|
foreach (var group in conditions.Groups)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (group.LogicalOperator == "and")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
foreach (var item1 in group.Conditions)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
groupList.Add(new KeyValuePair<WhereType, ConditionalModel>
|
|
|
|
|
|
|
|
(WhereType.And,
|
|
|
|
|
|
|
|
new ConditionalModel
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
FieldName = item1.Field,
|
|
|
|
|
|
|
|
ConditionalType = GetConditionalType(item1.Operator),
|
|
|
|
|
|
|
|
FieldValue = item1.Value
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
foreach (var item1 in group.Conditions)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
groupList.Add(new KeyValuePair<WhereType, ConditionalModel>
|
|
|
|
FieldName = item.Field,
|
|
|
|
(WhereType.Or,
|
|
|
|
ConditionalType = GetConditionalType(item.Operator),
|
|
|
|
new ConditionalModel
|
|
|
|
FieldValue = item.Value
|
|
|
|
{
|
|
|
|
})
|
|
|
|
FieldName = item1.Field,
|
|
|
|
);
|
|
|
|
ConditionalType = GetConditionalType(item1.Operator),
|
|
|
|
}
|
|
|
|
FieldValue = item1.Value
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (groupList.Count > 0)
|
|
|
|
if (conditionList.Count > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
list.Add(new ConditionalCollections
|
|
|
|
{
|
|
|
|
{
|
|
|
|
conditionalCollections.Add(new ConditionalCollections
|
|
|
|
ConditionalList = conditionList
|
|
|
|
{
|
|
|
|
});
|
|
|
|
ConditionalList = groupList
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
|
|
|
|
|
|
|
|
var groupList = new List<KeyValuePair<WhereType, ConditionalModel>>();
|
|
|
|
|
|
|
|
foreach (var group in nodeSection.Groups)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var conditionList = new List<KeyValuePair<WhereType, ConditionalModel>>();
|
|
|
|
WhereType whereType2 = Enum.Parse<WhereType>(group.LogicalOperator, true);
|
|
|
|
foreach (var item in conditions.Conditions)
|
|
|
|
for (int j = 0; j < group.Conditions.Count; j++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
conditionList.Add(new KeyValuePair<WhereType, ConditionalModel>
|
|
|
|
var item1 = group.Conditions[j];
|
|
|
|
(WhereType.Or,
|
|
|
|
groupList.Add(new KeyValuePair<WhereType, ConditionalModel>
|
|
|
|
|
|
|
|
(j == 0 ? whereType : whereType2,
|
|
|
|
new ConditionalModel
|
|
|
|
new ConditionalModel
|
|
|
|
{
|
|
|
|
{
|
|
|
|
FieldName = item.Field,
|
|
|
|
FieldName = item1.Field,
|
|
|
|
ConditionalType = GetConditionalType(item.Operator),
|
|
|
|
ConditionalType = GetConditionalType(item1.Operator),
|
|
|
|
FieldValue = item.Value
|
|
|
|
FieldValue = item1.Value
|
|
|
|
})
|
|
|
|
})
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (conditionList.Count > 0)
|
|
|
|
if (groupList.Count > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
conditionalCollections.Add(new ConditionalCollections
|
|
|
|
list.Add(new ConditionalCollections
|
|
|
|
{
|
|
|
|
|
|
|
|
ConditionalList = conditionList
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var groupList = new List<KeyValuePair<WhereType, ConditionalModel>>();
|
|
|
|
|
|
|
|
foreach (var group in conditions.Groups)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (group.LogicalOperator == "and")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
foreach (var item1 in group.Conditions)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
groupList.Add(new KeyValuePair<WhereType, ConditionalModel>
|
|
|
|
|
|
|
|
(WhereType.And,
|
|
|
|
|
|
|
|
new ConditionalModel
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
FieldName = item1.Field,
|
|
|
|
|
|
|
|
ConditionalType = GetConditionalType(item1.Operator),
|
|
|
|
|
|
|
|
FieldValue = item1.Value
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
foreach (var item1 in group.Conditions)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
groupList.Add(new KeyValuePair<WhereType, ConditionalModel>
|
|
|
|
|
|
|
|
(WhereType.Or,
|
|
|
|
|
|
|
|
new ConditionalModel
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
FieldName = item1.Field,
|
|
|
|
|
|
|
|
ConditionalType = GetConditionalType(item1.Operator),
|
|
|
|
|
|
|
|
FieldValue = item1.Value
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (groupList.Count > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
conditionalCollections.Add(new ConditionalCollections
|
|
|
|
ConditionalList = groupList
|
|
|
|
{
|
|
|
|
});
|
|
|
|
ConditionalList = groupList
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var conditionalModels = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(JsonConvert.SerializeObject(conditionalCollections));
|
|
|
|
if (list.Count == 0) //跳过默认条件
|
|
|
|
if (conditionalModels.Count == 0) //跳过默认条件
|
|
|
|
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//string json = JsonConvert.SerializeObject(list);
|
|
|
|
|
|
|
|
//db.Utilities.JsonToConditionalModels(json);
|
|
|
|
|
|
|
|
List<IConditionalModel> conditionalModels = [.. list];
|
|
|
|
|
|
|
|
|
|
|
|
ISqlSugarClient sugarClient = tenantDb ?? db;
|
|
|
|
ISqlSugarClient sugarClient = tenantDb ?? db;
|
|
|
|
var exists = sugarClient.Queryable<object>().AS(ColumnView).Where("Id=@Id", new { Id = BusinessId }).Where(conditionalModels).Any();
|
|
|
|
var exists = sugarClient.Queryable<object>().AS(ColumnView).Where("Id=@Id", new { Id = BusinessId }).Where(conditionalModels).Any();
|
|
|
|
if (exists)
|
|
|
|
if (exists)
|
|
|
@ -414,7 +323,7 @@ public class FlowRuntime
|
|
|
|
return ChildNodes.Where(x => x.Id == childId).First(); //下一个节点
|
|
|
|
return ChildNodes.Where(x => x.Id == childId).First(); //下一个节点
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//todo:前端组织JSON结构有误,加入临时修复代码,待前端改正后移除
|
|
|
|
//todo:前端组织JSON结构有误,加入临时修复代码,待前端改正后移除
|
|
|
|
else if (nextChild.Type == null)
|
|
|
|
else if (nextChild.Type == null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
nextChild.Id = nextChild.Type = FlowChild.END;
|
|
|
|
nextChild.Id = nextChild.Type = FlowChild.END;
|
|
|
|
nextChild.Name = "结束";
|
|
|
|
nextChild.Name = "结束";
|
|
|
|