|
|
|
@ -209,8 +209,6 @@ public class FlowRuntime
|
|
|
|
|
{
|
|
|
|
|
return ChildNodes.Where(x => x.Id == "end").First().Id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// return ChildNodes.Where(x => x.Pid == nodeId).First().Id;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -233,155 +231,66 @@ public class FlowRuntime
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var conditions = conditionNodes[i].Conditions;
|
|
|
|
|
var conditionalCollections = new List<ConditionalCollections>();
|
|
|
|
|
if (conditions.LogicalOperator == "and")
|
|
|
|
|
{
|
|
|
|
|
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
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
var nodeSection = conditionNodes[i].Conditions;
|
|
|
|
|
var list = new List<ConditionalCollections>();
|
|
|
|
|
var conditionList = new List<KeyValuePair<WhereType, ConditionalModel>>(nodeSection.Conditions.Count);
|
|
|
|
|
|
|
|
|
|
if (conditionList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
conditionalCollections.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)
|
|
|
|
|
var whereType = Enum.Parse<WhereType>(nodeSection.LogicalOperator, true);
|
|
|
|
|
foreach (var item in nodeSection.Conditions)
|
|
|
|
|
{
|
|
|
|
|
conditionList.Add(new KeyValuePair<WhereType, ConditionalModel>
|
|
|
|
|
(whereType,
|
|
|
|
|
new ConditionalModel
|
|
|
|
|
{
|
|
|
|
|
groupList.Add(new KeyValuePair<WhereType, ConditionalModel>
|
|
|
|
|
(WhereType.Or,
|
|
|
|
|
new ConditionalModel
|
|
|
|
|
{
|
|
|
|
|
FieldName = item1.Field,
|
|
|
|
|
ConditionalType = GetConditionalType(item1.Operator),
|
|
|
|
|
FieldValue = item1.Value
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
FieldName = item.Field,
|
|
|
|
|
ConditionalType = GetConditionalType(item.Operator),
|
|
|
|
|
FieldValue = item.Value
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (groupList.Count > 0)
|
|
|
|
|
if (conditionList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
list.Add(new ConditionalCollections
|
|
|
|
|
{
|
|
|
|
|
conditionalCollections.Add(new ConditionalCollections
|
|
|
|
|
{
|
|
|
|
|
ConditionalList = groupList
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
ConditionalList = conditionList
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
|
|
|
|
|
var groupList = new List<KeyValuePair<WhereType, ConditionalModel>>();
|
|
|
|
|
foreach (var group in nodeSection.Groups)
|
|
|
|
|
{
|
|
|
|
|
var conditionList = new List<KeyValuePair<WhereType, ConditionalModel>>();
|
|
|
|
|
foreach (var item in conditions.Conditions)
|
|
|
|
|
WhereType whereType2 = Enum.Parse<WhereType>(group.LogicalOperator, true);
|
|
|
|
|
for (int j = 0; j < group.Conditions.Count; j++)
|
|
|
|
|
{
|
|
|
|
|
conditionList.Add(new KeyValuePair<WhereType, ConditionalModel>
|
|
|
|
|
(WhereType.Or,
|
|
|
|
|
var item1 = group.Conditions[j];
|
|
|
|
|
groupList.Add(new KeyValuePair<WhereType, ConditionalModel>
|
|
|
|
|
(j == 0 ? whereType : whereType2,
|
|
|
|
|
new ConditionalModel
|
|
|
|
|
{
|
|
|
|
|
FieldName = item.Field,
|
|
|
|
|
ConditionalType = GetConditionalType(item.Operator),
|
|
|
|
|
FieldValue = item.Value
|
|
|
|
|
FieldName = item1.Field,
|
|
|
|
|
ConditionalType = GetConditionalType(item1.Operator),
|
|
|
|
|
FieldValue = item1.Value
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (conditionList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
conditionalCollections.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)
|
|
|
|
|
if (groupList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
list.Add(new ConditionalCollections
|
|
|
|
|
{
|
|
|
|
|
conditionalCollections.Add(new ConditionalCollections
|
|
|
|
|
{
|
|
|
|
|
ConditionalList = groupList
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
ConditionalList = groupList
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var conditionalModels = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(JsonConvert.SerializeObject(conditionalCollections));
|
|
|
|
|
if (conditionalModels.Count == 0) //跳过默认条件
|
|
|
|
|
if (list.Count == 0) //跳过默认条件
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
//string json = JsonConvert.SerializeObject(list);
|
|
|
|
|
//db.Utilities.JsonToConditionalModels(json);
|
|
|
|
|
List<IConditionalModel> conditionalModels = [.. list];
|
|
|
|
|
|
|
|
|
|
ISqlSugarClient sugarClient = tenantDb ?? db;
|
|
|
|
|
var exists = sugarClient.Queryable<object>().AS(ColumnView).Where("Id=@Id", new { Id = BusinessId }).Where(conditionalModels).Any();
|
|
|
|
|
if (exists)
|
|
|
|
|