Merge remote-tracking branch 'dest/glms/feature/1.4.2' into glms/feature/1.4.2
This commit is contained in:
@@ -19,7 +19,7 @@ namespace YLErp.Modules.RiskEngine
|
||||
|
||||
/// <summary>
|
||||
/// 【核心】条件JSON(结构化模式的条件列表存储),如
|
||||
/// {"conditions":[{"variableId":1,"operator":">","value":100000000}]}
|
||||
/// {"conditions":[{"variableId":1,"operator":"gt","value":100000000}]}
|
||||
/// 由 RuleCompiler 解析并编译为 CompiledScript
|
||||
/// </summary>
|
||||
public string ConditionJson { get; set; }
|
||||
|
||||
@@ -1093,7 +1093,16 @@ namespace YLErp.Modules.RiskEngine
|
||||
|
||||
foreach (var app in affectedApps)
|
||||
{
|
||||
var remainingIds = ParseStoredRuleIds(app.RuleIds).Where(id => id != ruleId).ToList();
|
||||
List<long> remainingIds;
|
||||
try
|
||||
{
|
||||
remainingIds = ParseStoredRuleIds(app.RuleIds).Where(id => id != ruleId).ToList();
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
{
|
||||
_logger.Error($"删除规则时解析应用关联规则 ID 格式异常,跳过应用 {app.id}:{ex.Message}");
|
||||
continue;
|
||||
}
|
||||
app.RuleIds = string.Join(",", remainingIds);
|
||||
app.Version++;
|
||||
app.UpdateOptId = UserId;
|
||||
@@ -1907,8 +1916,10 @@ namespace YLErp.Modules.RiskEngine
|
||||
/// </summary>
|
||||
private List<glms_risk_rule> GetRulesByVariableId(long variableId)
|
||||
{
|
||||
var idText = variableId.ToString();
|
||||
var allRules = DbContext.glms_risk_rule
|
||||
.Where(r => r.Status != RiskRuleStatus.Deleted && r.ConditionJson != null && r.ConditionJson != "")
|
||||
.Where(r => r.ConditionJson.Contains(idText))
|
||||
.ToList();
|
||||
|
||||
return allRules
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace YLErp.Modules.RiskEngine
|
||||
|
||||
var idText = variableId.ToString(CultureInfo.InvariantCulture);
|
||||
return VariableReferenceFields.Any(field =>
|
||||
Regex.IsMatch(conditionJson, $@"""{field}""\s*:\s*{idText}\b", RegexOptions.CultureInvariant));
|
||||
Regex.IsMatch(conditionJson, $@"""{field}""\s*:\s*{idText}(?=[,\s}}\]])", RegexOptions.CultureInvariant));
|
||||
}
|
||||
|
||||
public static string Build(
|
||||
|
||||
Reference in New Issue
Block a user