Revert "feat(风控引擎): RiskRuleService/RiskRuleController 权限控制及需求对齐"
This reverts commit a259b745ce.
This commit is contained in:
@@ -160,17 +160,3 @@ csharp_preserve_single_line_statements = true
|
||||
|
||||
# CA1819: Properties should not return arrays
|
||||
dotnet_diagnostic.CA1819.severity = silent
|
||||
|
||||
# JavaScript 和 TypeScript 文件
|
||||
[*.{js,jsx,ts,tsx}]
|
||||
# 缩进和间距
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
tab_width = 4
|
||||
|
||||
# 新行首选项
|
||||
end_of_line = crlf
|
||||
insert_final_newline = false
|
||||
|
||||
# 拖尾逗号不添加
|
||||
trailing_comma = none
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
namespace YLErp.DBModels
|
||||
{
|
||||
public enum RiskControlStrategy
|
||||
{
|
||||
Block = 1,
|
||||
Approval = 2,
|
||||
ShowTip = 3
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
namespace YLErp.DBModels
|
||||
{
|
||||
public enum RiskRuleStatus
|
||||
{
|
||||
Active = 1,
|
||||
Disabled = 2,
|
||||
Deleted = 3
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
namespace YLErp.DBModels
|
||||
{
|
||||
public enum RiskVariableCategory
|
||||
{
|
||||
BookingElement = 1,
|
||||
MarketData = 2,
|
||||
SystemCalc = 3,
|
||||
BooleanCheck = 4
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
namespace YLErp.DBModels
|
||||
{
|
||||
public enum RiskVariableDataType
|
||||
{
|
||||
Numeric = 1,
|
||||
Date = 2,
|
||||
Boolean = 3
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace YLErp.DBModels
|
||||
{
|
||||
[Table("glms_risk_rule")]
|
||||
public class glms_risk_rule : DBModelWithOperator
|
||||
{
|
||||
public string RuleCode { get; set; }
|
||||
public string RuleName { get; set; }
|
||||
public string RuleDescription { get; set; }
|
||||
public string FormulaJson { get; set; }
|
||||
public string FormulaText { get; set; }
|
||||
public RiskRuleStatus Status { get; set; } = RiskRuleStatus.Active;
|
||||
public int Version { get; set; } = 1;
|
||||
public int? UpdateOptId { get; set; }
|
||||
public string UpdateOptName { get; set; }
|
||||
public DateTime? UpdateDate { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace YLErp.DBModels
|
||||
{
|
||||
[Table("glms_risk_rule_application")]
|
||||
public class glms_risk_rule_application : DBModelWithOperator
|
||||
{
|
||||
public string ApplicationCode { get; set; }
|
||||
public long RuleId { get; set; }
|
||||
public RiskRuleStatus Status { get; set; } = RiskRuleStatus.Active;
|
||||
public RiskControlStrategy ControlStrategy { get; set; }
|
||||
public string TriggerPoints { get; set; }
|
||||
public string ScopeAssetBookIds { get; set; }
|
||||
public string ScopeClientIds { get; set; }
|
||||
public string ScopeUnderlyingTypes { get; set; }
|
||||
public string ScopeTradeTypes { get; set; }
|
||||
public bool ScopeIsGlobal { get; set; }
|
||||
public int Version { get; set; } = 1;
|
||||
public int? UpdateOptId { get; set; }
|
||||
public string UpdateOptName { get; set; }
|
||||
public DateTime? UpdateDate { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace YLErp.DBModels
|
||||
{
|
||||
[Table("glms_risk_rule_audit_log")]
|
||||
public class glms_risk_rule_audit_log : DBModelBase
|
||||
{
|
||||
public string OperationType { get; set; }
|
||||
public string TargetType { get; set; }
|
||||
public long TargetId { get; set; }
|
||||
public string TargetName { get; set; }
|
||||
public string TargetCode { get; set; }
|
||||
public string OperationDetail { get; set; }
|
||||
public string Result { get; set; }
|
||||
public string SnapshotData { get; set; }
|
||||
public long OptId { get; set; }
|
||||
public string OptName { get; set; }
|
||||
public DateTime OptDate { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace YLErp.DBModels
|
||||
{
|
||||
[Table("glms_risk_variable")]
|
||||
public class glms_risk_variable : DBModelWithOperator
|
||||
{
|
||||
public string VariableCode { get; set; }
|
||||
public string VariableName { get; set; }
|
||||
public RiskVariableCategory Category { get; set; }
|
||||
public RiskVariableDataType DataType { get; set; }
|
||||
public string Unit { get; set; }
|
||||
public string ValueDomain { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string ImplementationScript { get; set; }
|
||||
public string SourceExpression { get; set; }
|
||||
public bool IsImplemented { get; set; }
|
||||
public int Version { get; set; } = 1;
|
||||
public int SortOrder { get; set; }
|
||||
public int? UpdateOptId { get; set; }
|
||||
public string UpdateOptName { get; set; }
|
||||
public DateTime? UpdateDate { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
SET FOREIGN_KEY_CHECKS=0;
|
||||
|
||||
CREATE TABLE `glms_risk_rule` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键Id',
|
||||
`RuleCode` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '规则编码(RISK-YYYYMMDD-NNNN)',
|
||||
`RuleName` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '规则名称',
|
||||
`RuleDescription` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '规则描述',
|
||||
`FormulaJson` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '公式JSON表达式',
|
||||
`FormulaText` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '公式可读文本',
|
||||
`Status` tinyint NOT NULL DEFAULT 1 COMMENT '状态: 1=Active, 2=Disabled, 3=Deleted',
|
||||
`Version` int NOT NULL DEFAULT 1 COMMENT '版本号(乐观锁)',
|
||||
`OptId` int NULL DEFAULT NULL COMMENT '创建人Id',
|
||||
`OptName` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人名称',
|
||||
`OptDate` datetime NULL DEFAULT NULL COMMENT '创建时间',
|
||||
`UpdateOptId` int NULL DEFAULT NULL COMMENT '最后修改人Id',
|
||||
`UpdateOptName` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '最后修改人名称',
|
||||
`UpdateDate` datetime NULL DEFAULT NULL COMMENT '最后修改时间',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE INDEX `uk_rule_code`(`RuleCode` ASC) USING BTREE,
|
||||
INDEX `idx_status`(`Status` ASC) USING BTREE
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '风控规则定义表' ROW_FORMAT = Dynamic;
|
||||
|
||||
CREATE TABLE `glms_risk_rule_application` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键Id',
|
||||
`ApplicationCode` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '应用编码(APP-YYYYMMDD-NNNN)',
|
||||
`RuleId` bigint NOT NULL COMMENT '关联规则Id',
|
||||
`Status` tinyint NOT NULL DEFAULT 1 COMMENT '状态: 1=Active, 2=Disabled, 3=Deleted',
|
||||
`ControlStrategy` tinyint NOT NULL COMMENT '控制策略: 1=Block, 2=Approval, 3=Warning',
|
||||
`TriggerPoints` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '触发时点(逗号分隔)',
|
||||
`ScopeAssetBookIds` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '适用账户Id列表',
|
||||
`ScopeClientIds` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '适用对手方Id列表',
|
||||
`ScopeUnderlyingTypes` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '适用标的类型',
|
||||
`ScopeTradeTypes` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '适用合约类型',
|
||||
`ScopeIsGlobal` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否全局适用: 0=否, 1=是',
|
||||
`Version` int NOT NULL DEFAULT 1 COMMENT '版本号(乐观锁)',
|
||||
`OptId` int NULL DEFAULT NULL COMMENT '创建人Id',
|
||||
`OptName` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人名称',
|
||||
`OptDate` datetime NULL DEFAULT NULL COMMENT '创建时间',
|
||||
`UpdateOptId` int NULL DEFAULT NULL COMMENT '最后修改人Id',
|
||||
`UpdateOptName` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '最后修改人名称',
|
||||
`UpdateDate` datetime NULL DEFAULT NULL COMMENT '最后修改时间',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE INDEX `uk_application_code`(`ApplicationCode` ASC) USING BTREE,
|
||||
INDEX `idx_rule_id`(`RuleId` ASC) USING BTREE,
|
||||
INDEX `idx_status`(`Status` ASC) USING BTREE
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '风控规则应用配置表' ROW_FORMAT = Dynamic;
|
||||
|
||||
CREATE TABLE `glms_risk_rule_audit_log` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键Id',
|
||||
`OperationType` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '操作类型(RULE_CREATE/RULE_UPDATE等)',
|
||||
`TargetType` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '目标类型(RULE/APPLICATION/VARIABLE)',
|
||||
`TargetId` bigint NOT NULL COMMENT '目标记录Id',
|
||||
`TargetName` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '目标名称',
|
||||
`TargetCode` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '目标编码',
|
||||
`OperationDetail` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '操作详情',
|
||||
`Result` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '操作结果',
|
||||
`SnapshotData` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '快照数据(JSON)',
|
||||
`OptId` bigint NOT NULL COMMENT '操作人Id',
|
||||
`OptName` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '操作人名称',
|
||||
`OptDate` datetime NOT NULL COMMENT '操作时间',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `idx_opt_date`(`OptDate` ASC) USING BTREE,
|
||||
INDEX `idx_operation_type`(`OperationType` ASC) USING BTREE,
|
||||
INDEX `idx_target_type`(`TargetType` ASC) USING BTREE,
|
||||
INDEX `idx_target_id`(`TargetId` ASC) USING BTREE
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '风控规则操作审计日志表' ROW_FORMAT = Dynamic;
|
||||
|
||||
CREATE TABLE `glms_risk_variable` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键Id',
|
||||
`VariableCode` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '变量编码',
|
||||
`VariableName` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '变量名称',
|
||||
`Category` tinyint NOT NULL COMMENT '分类: 1=BookingElement, 2=MarketData, 3=SystemCalc, 4=BooleanCheck',
|
||||
`DataType` tinyint NOT NULL COMMENT '数据类型: 1=Numeric, 2=Date, 3=Boolean',
|
||||
`Unit` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '单位',
|
||||
`ValueDomain` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '值域描述',
|
||||
`Description` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '描述',
|
||||
`ImplementationScript` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '实现脚本(C#表达式)',
|
||||
`SourceExpression` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '来源表达式',
|
||||
`IsImplemented` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否已实现: 0=否, 1=是',
|
||||
`Version` int NOT NULL DEFAULT 1 COMMENT '版本号(乐观锁)',
|
||||
`SortOrder` int NOT NULL DEFAULT 0 COMMENT '排序',
|
||||
`OptId` int NULL DEFAULT NULL COMMENT '创建人Id',
|
||||
`OptName` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人名称',
|
||||
`OptDate` datetime NULL DEFAULT NULL COMMENT '创建时间',
|
||||
`UpdateOptId` int NULL DEFAULT NULL COMMENT '最后修改人Id',
|
||||
`UpdateOptName` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '最后修改人名称',
|
||||
`UpdateDate` datetime NULL DEFAULT NULL COMMENT '最后修改时间',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE INDEX `uk_variable_code`(`VariableCode` ASC) USING BTREE
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '风控变量池定义表' ROW_FORMAT = Dynamic;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS=1;
|
||||
@@ -1,4 +1,4 @@
|
||||
using BaseOUDAL;
|
||||
using BaseOUDAL;
|
||||
using YLErp.Core.DBModels;
|
||||
using YLErp.Model;
|
||||
|
||||
@@ -408,10 +408,5 @@ namespace YLErp.BLL
|
||||
public DbSet<trade_contract_oa_result> tradeContractOaResult { get; set; }
|
||||
public DbSet<BondPayment> bondPayment { get; set; }
|
||||
|
||||
public DbSet<glms_risk_rule> glms_risk_rule { get; set; }
|
||||
public DbSet<glms_risk_rule_application> glms_risk_rule_application { get; set; }
|
||||
public DbSet<glms_risk_rule_audit_log> glms_risk_rule_audit_log { get; set; }
|
||||
public DbSet<glms_risk_variable> glms_risk_variable { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
namespace YLErp.Modules.RiskEngine.Dto
|
||||
{
|
||||
public class BatchOperationResult
|
||||
{
|
||||
public bool Success { get; set; }
|
||||
public int TotalCount { get; set; }
|
||||
public int SuccessCount { get; set; }
|
||||
public string ErrorMessage { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using YLErp.DBModels;
|
||||
|
||||
namespace YLErp.Modules.RiskEngine.Dto
|
||||
{
|
||||
public class CreateRiskApplicationReq
|
||||
{
|
||||
public long RuleId { get; set; }
|
||||
public RiskControlStrategy ControlStrategy { get; set; }
|
||||
public string TriggerPoints { get; set; }
|
||||
public string ScopeAssetBookIds { get; set; }
|
||||
public string ScopeClientIds { get; set; }
|
||||
public string ScopeUnderlyingTypes { get; set; }
|
||||
public string ScopeTradeTypes { get; set; }
|
||||
public bool ScopeIsGlobal { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
namespace YLErp.Modules.RiskEngine.Dto
|
||||
{
|
||||
public class CreateRiskRuleReq
|
||||
{
|
||||
public string RuleName { get; set; }
|
||||
public string RuleDescription { get; set; }
|
||||
public string FormulaJson { get; set; }
|
||||
public string FormulaText { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
using YLErp.DBModels;
|
||||
|
||||
namespace YLErp.Modules.RiskEngine.Dto
|
||||
{
|
||||
public class CreateRiskVariableReq
|
||||
{
|
||||
public string VariableCode { get; set; }
|
||||
public string VariableName { get; set; }
|
||||
public RiskVariableCategory Category { get; set; }
|
||||
public RiskVariableDataType DataType { get; set; }
|
||||
public string Unit { get; set; }
|
||||
public string ValueDomain { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string ImplementationScript { get; set; }
|
||||
public string SourceExpression { get; set; }
|
||||
public bool IsImplemented { get; set; }
|
||||
public int SortOrder { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
namespace YLErp.Modules.RiskEngine.Dto
|
||||
{
|
||||
public class FormulaCondition
|
||||
{
|
||||
public string VariableCode { get; set; }
|
||||
public string VariableName { get; set; }
|
||||
public string VariableType { get; set; }
|
||||
public string Operator { get; set; }
|
||||
public string ThresholdType { get; set; }
|
||||
public object Value { get; set; }
|
||||
public string ThresholdVariableCode { get; set; }
|
||||
public string ThresholdVariableName { get; set; }
|
||||
public string Unit { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace YLErp.Modules.RiskEngine.Dto
|
||||
{
|
||||
public class FormulaDefinition
|
||||
{
|
||||
public string LogicOperator { get; set; }
|
||||
public List<FormulaCondition> Conditions { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using BaseOUDAL;
|
||||
using YLErp.DBModels;
|
||||
|
||||
namespace YLErp.Modules.RiskEngine.Dto
|
||||
{
|
||||
public class QueryRiskApplicationReq : BaseSearchReq
|
||||
{
|
||||
public string Keyword { get; set; }
|
||||
public RiskRuleStatus? Status { get; set; }
|
||||
public RiskControlStrategy? Strategy { get; set; }
|
||||
public string TriggerPoint { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using System;
|
||||
using BaseOUDAL;
|
||||
|
||||
namespace YLErp.Modules.RiskEngine.Dto
|
||||
{
|
||||
public class QueryRiskAuditLogReq : BaseSearchReq
|
||||
{
|
||||
public string OperationType { get; set; }
|
||||
public string TargetType { get; set; }
|
||||
public DateTime? StartDate { get; set; }
|
||||
public DateTime? EndDate { get; set; }
|
||||
public string Keyword { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using BaseOUDAL;
|
||||
using YLErp.DBModels;
|
||||
|
||||
namespace YLErp.Modules.RiskEngine.Dto
|
||||
{
|
||||
public class QueryRiskRuleReq : BaseSearchReq
|
||||
{
|
||||
public string Keyword { get; set; }
|
||||
public RiskRuleStatus? Status { get; set; }
|
||||
public string VariableCode { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
using BaseOUDAL;
|
||||
using YLErp.DBModels;
|
||||
|
||||
namespace YLErp.Modules.RiskEngine.Dto
|
||||
{
|
||||
public class QueryRiskVariableReq : BaseSearchReq
|
||||
{
|
||||
public RiskVariableCategory? Category { get; set; }
|
||||
public string Keyword { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using System;
|
||||
using YLErp.DBModels;
|
||||
|
||||
namespace YLErp.Modules.RiskEngine.Dto
|
||||
{
|
||||
public class RiskApplicationDetail
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string ApplicationCode { get; set; }
|
||||
public long RuleId { get; set; }
|
||||
public string RuleCode { get; set; }
|
||||
public string RuleName { get; set; }
|
||||
public string FormulaJson { get; set; }
|
||||
public string FormulaText { get; set; }
|
||||
public RiskRuleStatus Status { get; set; }
|
||||
public RiskControlStrategy ControlStrategy { get; set; }
|
||||
public string TriggerPoints { get; set; }
|
||||
public string ScopeAssetBookIds { get; set; }
|
||||
public string ScopeClientIds { get; set; }
|
||||
public string ScopeUnderlyingTypes { get; set; }
|
||||
public string ScopeTradeTypes { get; set; }
|
||||
public bool ScopeIsGlobal { get; set; }
|
||||
public int Version { get; set; }
|
||||
public string OptName { get; set; }
|
||||
public DateTime OptDate { get; set; }
|
||||
public string UpdateOptName { get; set; }
|
||||
public DateTime UpdateDate { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
using System;
|
||||
using YLErp.DBModels;
|
||||
|
||||
namespace YLErp.Modules.RiskEngine.Dto
|
||||
{
|
||||
public class RiskApplicationListItem
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string ApplicationCode { get; set; }
|
||||
public long RuleId { get; set; }
|
||||
public string RuleCode { get; set; }
|
||||
public string RuleName { get; set; }
|
||||
public string FormulaText { get; set; }
|
||||
public RiskRuleStatus Status { get; set; }
|
||||
public RiskControlStrategy ControlStrategy { get; set; }
|
||||
public string TriggerPoints { get; set; }
|
||||
public string ScopeAssetBookIds { get; set; }
|
||||
public string ScopeClientIds { get; set; }
|
||||
public string ScopeUnderlyingTypes { get; set; }
|
||||
public string ScopeTradeTypes { get; set; }
|
||||
public bool ScopeIsGlobal { get; set; }
|
||||
public int Version { get; set; }
|
||||
public string OptName { get; set; }
|
||||
public DateTime OptDate { get; set; }
|
||||
public string UpdateOptName { get; set; }
|
||||
public DateTime UpdateDate { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace YLErp.Modules.RiskEngine.Dto
|
||||
{
|
||||
public class RiskAuditLogDetail
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string OperationType { get; set; }
|
||||
public string TargetType { get; set; }
|
||||
public long TargetId { get; set; }
|
||||
public string TargetName { get; set; }
|
||||
public string TargetCode { get; set; }
|
||||
public string OperationDetail { get; set; }
|
||||
public string Result { get; set; }
|
||||
public string SnapshotData { get; set; }
|
||||
public long OptId { get; set; }
|
||||
public string OptName { get; set; }
|
||||
public DateTime OptDate { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace YLErp.Modules.RiskEngine.Dto
|
||||
{
|
||||
public class RiskAuditLogListItem
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string OperationType { get; set; }
|
||||
public string TargetType { get; set; }
|
||||
public long TargetId { get; set; }
|
||||
public string TargetName { get; set; }
|
||||
public string TargetCode { get; set; }
|
||||
public string OperationDetail { get; set; }
|
||||
public string Result { get; set; }
|
||||
public string OptName { get; set; }
|
||||
public DateTime OptDate { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using YLErp.DBModels;
|
||||
|
||||
namespace YLErp.Modules.RiskEngine.Dto
|
||||
{
|
||||
public class RiskRuleApplicationSummary
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string ApplicationCode { get; set; }
|
||||
public RiskRuleStatus Status { get; set; }
|
||||
public RiskControlStrategy ControlStrategy { get; set; }
|
||||
public string TriggerPoints { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using YLErp.DBModels;
|
||||
|
||||
namespace YLErp.Modules.RiskEngine.Dto
|
||||
{
|
||||
public class RiskRuleDetail
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string RuleCode { get; set; }
|
||||
public string RuleName { get; set; }
|
||||
public string RuleDescription { get; set; }
|
||||
public string FormulaJson { get; set; }
|
||||
public string FormulaText { get; set; }
|
||||
public RiskRuleStatus Status { get; set; }
|
||||
public int Version { get; set; }
|
||||
public string OptName { get; set; }
|
||||
public DateTime OptDate { get; set; }
|
||||
public string UpdateOptName { get; set; }
|
||||
public DateTime UpdateDate { get; set; }
|
||||
public List<RiskRuleApplicationSummary> Applications { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
using System;
|
||||
using YLErp.DBModels;
|
||||
|
||||
namespace YLErp.Modules.RiskEngine.Dto
|
||||
{
|
||||
public class RiskRuleListItem
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string RuleCode { get; set; }
|
||||
public string RuleName { get; set; }
|
||||
public string RuleDescription { get; set; }
|
||||
public string FormulaText { get; set; }
|
||||
public RiskRuleStatus Status { get; set; }
|
||||
public int Version { get; set; }
|
||||
public string OptName { get; set; }
|
||||
public DateTime OptDate { get; set; }
|
||||
public string UpdateOptName { get; set; }
|
||||
public DateTime UpdateDate { get; set; }
|
||||
public int ApplicationCount { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace YLErp.Modules.RiskEngine.Dto
|
||||
{
|
||||
public class RiskRuleVersionItem
|
||||
{
|
||||
public int Version { get; set; }
|
||||
public string OperationType { get; set; }
|
||||
public string OperationDetail { get; set; }
|
||||
public string OptName { get; set; }
|
||||
public DateTime OptDate { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
using System;
|
||||
using YLErp.DBModels;
|
||||
|
||||
namespace YLErp.Modules.RiskEngine.Dto
|
||||
{
|
||||
public class RiskVariableDetail
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string VariableCode { get; set; }
|
||||
public string VariableName { get; set; }
|
||||
public RiskVariableCategory Category { get; set; }
|
||||
public RiskVariableDataType DataType { get; set; }
|
||||
public string Unit { get; set; }
|
||||
public string ValueDomain { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string ImplementationScript { get; set; }
|
||||
public string SourceExpression { get; set; }
|
||||
public bool IsImplemented { get; set; }
|
||||
public int Version { get; set; }
|
||||
public int SortOrder { get; set; }
|
||||
public string OptName { get; set; }
|
||||
public DateTime OptDate { get; set; }
|
||||
public string UpdateOptName { get; set; }
|
||||
public DateTime UpdateDate { get; set; }
|
||||
public int ReferenceCount { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
using YLErp.DBModels;
|
||||
|
||||
namespace YLErp.Modules.RiskEngine.Dto
|
||||
{
|
||||
public class RiskVariableListItem
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string VariableCode { get; set; }
|
||||
public string VariableName { get; set; }
|
||||
public RiskVariableCategory Category { get; set; }
|
||||
public RiskVariableDataType DataType { get; set; }
|
||||
public string Unit { get; set; }
|
||||
public string ValueDomain { get; set; }
|
||||
public string Description { get; set; }
|
||||
public bool IsImplemented { get; set; }
|
||||
public int Version { get; set; }
|
||||
public int SortOrder { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using YLErp.DBModels;
|
||||
|
||||
namespace YLErp.Modules.RiskEngine.Dto
|
||||
{
|
||||
public class RiskVariableSimpleItem
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string VariableCode { get; set; }
|
||||
public string VariableName { get; set; }
|
||||
public RiskVariableCategory Category { get; set; }
|
||||
public RiskVariableDataType DataType { get; set; }
|
||||
public string Unit { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using YLErp.DBModels;
|
||||
|
||||
namespace YLErp.Modules.RiskEngine.Dto
|
||||
{
|
||||
public class UpdateRiskApplicationReq
|
||||
{
|
||||
public RiskControlStrategy ControlStrategy { get; set; }
|
||||
public string TriggerPoints { get; set; }
|
||||
public string ScopeAssetBookIds { get; set; }
|
||||
public string ScopeClientIds { get; set; }
|
||||
public string ScopeUnderlyingTypes { get; set; }
|
||||
public string ScopeTradeTypes { get; set; }
|
||||
public bool ScopeIsGlobal { get; set; }
|
||||
public int ExpectedVersion { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
namespace YLErp.Modules.RiskEngine.Dto
|
||||
{
|
||||
public class UpdateRiskRuleReq
|
||||
{
|
||||
public string RuleName { get; set; }
|
||||
public string RuleDescription { get; set; }
|
||||
public string FormulaJson { get; set; }
|
||||
public string FormulaText { get; set; }
|
||||
public int ExpectedVersion { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
using YLErp.DBModels;
|
||||
|
||||
namespace YLErp.Modules.RiskEngine.Dto
|
||||
{
|
||||
public class UpdateRiskVariableReq
|
||||
{
|
||||
public string VariableName { get; set; }
|
||||
public RiskVariableCategory Category { get; set; }
|
||||
public RiskVariableDataType DataType { get; set; }
|
||||
public string Unit { get; set; }
|
||||
public string ValueDomain { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string ImplementationScript { get; set; }
|
||||
public string SourceExpression { get; set; }
|
||||
public bool IsImplemented { get; set; }
|
||||
public int SortOrder { get; set; }
|
||||
public int ExpectedVersion { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -125,16 +125,6 @@ namespace YLErp.Modules.RiskEngine
|
||||
public class RiskEngineService : YLBaseService
|
||||
{
|
||||
IYcLogger _logger = LogFactory.GetLogger("RiskEngineService");
|
||||
|
||||
private static readonly Lazy<RiskEngineService> _instance =
|
||||
new Lazy<RiskEngineService>(() => new RiskEngineService());
|
||||
|
||||
public static RiskEngineService GetInstance() => _instance.Value;
|
||||
|
||||
private RiskEngineService() : base((OptUserInfo)null)
|
||||
{
|
||||
}
|
||||
|
||||
public RiskEngineService(OptUserInfo userInfo) : base(userInfo)
|
||||
{
|
||||
}
|
||||
@@ -147,73 +137,6 @@ namespace YLErp.Modules.RiskEngine
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 规则内存缓存(启动预热写入,EvaluateRisk 读取)
|
||||
/// </summary>
|
||||
private static volatile List<RiskRule> _cachedRules;
|
||||
private static volatile List<RiskRuleApplication> _cachedApplications;
|
||||
private static readonly object _cacheLock = new object();
|
||||
|
||||
/// <summary>
|
||||
/// 预热:加载规则与应用到内存,并预编译所有规则到 RuleCompiledCache。
|
||||
/// 项目启动时调用一次;规则/应用更新后调用 RefreshCache 刷新。
|
||||
/// </summary>
|
||||
public void Preload()
|
||||
{
|
||||
lock (_cacheLock)
|
||||
{
|
||||
_logger.Info("[风控引擎] Preload 开始 - 加载规则与应用并预编译");
|
||||
|
||||
var rules = LoadRulesFromDb();
|
||||
var applications = LoadApplicationsFromDb();
|
||||
List<int> res = new List<int>();
|
||||
foreach(var i in applications)
|
||||
{
|
||||
if(i.Status!= RiskRuleStatus.Active)
|
||||
{
|
||||
res.Add(i.Id);
|
||||
}
|
||||
}
|
||||
// 预编译所有规则到 RuleCompiledCache
|
||||
foreach (var rule in rules)
|
||||
{
|
||||
var ruleId = rule.Id.ToString();
|
||||
if (RuleCompiledCache.TryGet(ruleId, out _))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var compileResult = RuleCompiler.ValidateAndCompileRule(rule);
|
||||
if (!compileResult.Success)
|
||||
{
|
||||
_logger.Info($"[风控引擎] 规则预编译失败 - RuleId: {rule.Id}, Error: {compileResult.ErrorMessage}");
|
||||
}
|
||||
}
|
||||
|
||||
_cachedRules = rules;
|
||||
_cachedApplications = applications;
|
||||
|
||||
_logger.Info($"[风控引擎] Preload 完成 - 规则数: {rules.Count}, 应用数: {applications.Count}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 刷新缓存:清空已编译委托与内存缓存后重新预加载。
|
||||
/// 规则/应用配置更新后调用。
|
||||
/// </summary>
|
||||
public void RefreshCache()
|
||||
{
|
||||
_logger.Info("[风控引擎] RefreshCache 被调用 - 清空缓存并重新预加载");
|
||||
lock (_cacheLock)
|
||||
{
|
||||
_cachedRules = null;
|
||||
_cachedApplications = null;
|
||||
RuleCompiledCache.Clear();
|
||||
}
|
||||
|
||||
Preload();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从内存缓存获取规则列表;缓存为空时兜底加载并填充缓存。
|
||||
/// </summary>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -10,8 +10,7 @@
|
||||
</FunctionParent>
|
||||
<FunctionParent Name="交易管理" Title="交易管理">
|
||||
<FunctionSub Name="交易搜索" Title="期权交易"></FunctionSub>
|
||||
<FunctionSub Name="查看所有交易" Title="查看所有交易" Type="Operate"
|
||||
Note="是否可以查看所有交易,没有这个权限在交易列表中只能看到自己所在的簿记账户的交易"></FunctionSub>
|
||||
<FunctionSub Name="查看所有交易" Title="查看所有交易" Type="Operate" Note="是否可以查看所有交易,没有这个权限在交易列表中只能看到自己所在的簿记账户的交易" ></FunctionSub>
|
||||
<FunctionSub Name="交易新增" Title="交易新增" Type="Operate" Note="是否有新增交易权限" ></FunctionSub>
|
||||
<FunctionSub Name="交易编辑" Title="交易编辑" Type="Operate" Note="是否有交易编辑权限" ></FunctionSub>
|
||||
<FunctionSub Name="交易删除" Title="交易删除" Type="Operate" Note="是否有交易删除权限" ></FunctionSub>
|
||||
@@ -61,23 +60,6 @@
|
||||
<FunctionSub Name="VaR计算" Title="VaR计算"></FunctionSub>
|
||||
<FunctionSub Name="观察事件" Title="观察事件"></FunctionSub>
|
||||
<FunctionSub Name="风险预警/禁止查询" Title="风险预警/禁止查询"></FunctionSub>
|
||||
<FunctionSub Name="异常交易监控" Title="异常交易监控"></FunctionSub>
|
||||
<FunctionSub Name="风控规则查看" Title="规则管理Tab" Note="控制规则管理Tab可见性"></FunctionSub>
|
||||
<FunctionSub Name="风控规则新增" Type="Operate" Note="是否有权限新增风控规则"></FunctionSub>
|
||||
<FunctionSub Name="风控规则编辑" Type="Operate" Note="是否有权限编辑风控规则"></FunctionSub>
|
||||
<FunctionSub Name="风控规则删除" Type="Operate" Note="是否有权限删除/批量删除风控规则"></FunctionSub>
|
||||
<FunctionSub Name="风控规则启停" Type="Operate" Note="是否有权限启用/停用风控规则"></FunctionSub>
|
||||
<FunctionSub Name="风控应用查看" Title="规则应用Tab" Note="控制规则应用Tab可见性"></FunctionSub>
|
||||
<FunctionSub Name="风控应用新增" Type="Operate" Note="是否有权限新增应用配置"></FunctionSub>
|
||||
<FunctionSub Name="风控应用编辑" Type="Operate" Note="是否有权限编辑应用配置"></FunctionSub>
|
||||
<FunctionSub Name="风控应用删除" Type="Operate" Note="是否有权限删除应用配置"></FunctionSub>
|
||||
<FunctionSub Name="风控应用启停" Type="Operate" Note="是否有权限启用/停用/批量操作应用配置"></FunctionSub>
|
||||
<FunctionSub Name="风控变量查看" Title="变量池Tab" Note="控制变量池Tab可见性"></FunctionSub>
|
||||
<FunctionSub Name="风控变量新增" Type="Operate" Note="是否有权限新增变量"></FunctionSub>
|
||||
<FunctionSub Name="风控变量编辑" Type="Operate" Note="是否有权限编辑变量"></FunctionSub>
|
||||
<FunctionSub Name="风控变量删除" Type="Operate" Note="是否有权限删除变量"></FunctionSub>
|
||||
<FunctionSub Name="风控日志查看" Title="操作日志Tab" Note="控制操作日志Tab可见性"></FunctionSub>
|
||||
<FunctionSub Name="风控日志导出" Type="Operate" Note="是否有权限导出日志Excel"></FunctionSub>
|
||||
</FunctionParent>
|
||||
<FunctionParent Name="结算管理" Title="结算财务">
|
||||
<FunctionSub Name="成交簿记" Title="成交簿记"></FunctionSub>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using YLErp.DBModels.Consts;
|
||||
using YLErp.DBModels.Consts;
|
||||
using YLErp.Model.Enum;
|
||||
using YLErp.Modules.ClientModule;
|
||||
using YLErp.Modules.ClientModule.Models;
|
||||
@@ -280,7 +280,7 @@ namespace YLErp.Web
|
||||
|
||||
if (user.Roles.Any(n => n.Name == "权限管理员"))
|
||||
{
|
||||
var rightStrs = new string[] { "部门管理", "系统管理", "角色管理", "角色新增", "角色修改", "用户管理", "用户新增", "用户修改", "用户禁用", "基础缓存", "风控规则查看", "风控规则新增", "风控规则编辑", "风控规则删除", "风控规则启停", "风控应用查看", "风控应用新增", "风控应用编辑", "风控应用删除", "风控应用启停", "风控变量查看", "风控变量新增", "风控变量编辑", "风控变量删除", "风控日志查看", "风控日志导出" };
|
||||
var rightStrs = new string[] { "部门管理", "系统管理", "角色管理", "角色新增", "角色修改", "用户管理", "用户新增", "用户修改", "用户禁用", "基础缓存" };
|
||||
var query1 = db.Functions.Where(o => rightStrs.Contains(o.Name)).Select(n => n.Id);
|
||||
var query2 = from roleFunc in db.RoleFunctions
|
||||
join roleUsr in db.RoleUsers on roleFunc.RoleId equals roleUsr.RoleId
|
||||
|
||||
@@ -1,616 +0,0 @@
|
||||
using Qdp.Foundation.Utilities;
|
||||
using YLErp.Modules.RiskEngine;
|
||||
using YLErp.Modules.RiskEngine.Dto;
|
||||
|
||||
namespace YLErp.Web.Controllers
|
||||
{
|
||||
[Route("risk-engine")]
|
||||
public class RiskRuleController : BaseController
|
||||
{
|
||||
private readonly IYcLogger _logger = LogFactory.GetLogger("RiskRuleController");
|
||||
|
||||
#region Rule Management
|
||||
|
||||
[HttpGet("risk-rules")]
|
||||
[MyAuthorize("风控规则查看")]
|
||||
public JsonResult QueryRiskRules(QueryRiskRuleReq req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.QueryRuleList(req);
|
||||
return Json(new { success = true, data = result });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
{
|
||||
return Json(new { success = false, message = ex.Message });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "查询风控规则列表");
|
||||
return Json(new { success = false, message = "系统异常,请联系管理员" });
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("risk-rules/{id}")]
|
||||
[MyAuthorize("风控规则查看")]
|
||||
public JsonResult GetRiskRule(long id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.GetRuleDetail(id);
|
||||
return Json(new { success = true, data = result });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
{
|
||||
return Json(new { success = false, message = ex.Message });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "查询风控规则详情");
|
||||
return Json(new { success = false, message = "系统异常,请联系管理员" });
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("risk-rules/{id}/versions")]
|
||||
[MyAuthorize("风控规则查看")]
|
||||
public JsonResult GetRiskRuleVersions(long id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.GetRuleVersions(id);
|
||||
return Json(new { success = true, data = result });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
{
|
||||
return Json(new { success = false, message = ex.Message });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "查询风控规则版本历史");
|
||||
return Json(new { success = false, message = "系统异常,请联系管理员" });
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost("risk-rules")]
|
||||
[MyAuthorize("风控规则新增")]
|
||||
public JsonResult CreateRiskRule([FromBody] CreateRiskRuleReq req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.CreateRule(req);
|
||||
return Json(new { success = true, data = result });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
{
|
||||
return Json(new { success = false, message = ex.Message });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "创建风控规则");
|
||||
return Json(new { success = false, message = "系统异常,请联系管理员" });
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut("risk-rules/{id}")]
|
||||
[MyAuthorize("风控规则编辑")]
|
||||
public JsonResult UpdateRiskRule(long id, [FromBody] UpdateRiskRuleReq req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.UpdateRule(id, req);
|
||||
return Json(new { success = true, data = result });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
{
|
||||
return Json(new { success = false, message = ex.Message });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "更新风控规则");
|
||||
return Json(new { success = false, message = "系统异常,请联系管理员" });
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("risk-rules/{id}")]
|
||||
[MyAuthorize("风控规则删除")]
|
||||
public JsonResult DeleteRiskRule(long id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
service.DeleteRule(id);
|
||||
return Json(new { success = true });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
{
|
||||
return Json(new { success = false, message = ex.Message });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "删除风控规则");
|
||||
return Json(new { success = false, message = "系统异常,请联系管理员" });
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("risk-rules/batch")]
|
||||
[MyAuthorize("风控规则删除")]
|
||||
public JsonResult BatchDeleteRiskRules([FromBody] List<long> ids)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.BatchDeleteRules(ids);
|
||||
return Json(new { success = true, data = result });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
{
|
||||
return Json(new { success = false, message = ex.Message });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "批量删除风控规则");
|
||||
return Json(new { success = false, message = "系统异常,请联系管理员" });
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost("risk-rules/{id}/enable")]
|
||||
[MyAuthorize("风控规则启停")]
|
||||
public JsonResult EnableRiskRule(long id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
service.EnableRule(id);
|
||||
return Json(new { success = true });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
{
|
||||
return Json(new { success = false, message = ex.Message });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "启用风控规则");
|
||||
return Json(new { success = false, message = "系统异常,请联系管理员" });
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost("risk-rules/{id}/disable")]
|
||||
[MyAuthorize("风控规则启停")]
|
||||
public JsonResult DisableRiskRule(long id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
service.DisableRule(id);
|
||||
return Json(new { success = true });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
{
|
||||
return Json(new { success = false, message = ex.Message });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "停用风控规则");
|
||||
return Json(new { success = false, message = "系统异常,请联系管理员" });
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("risk-rules/{id}/applications")]
|
||||
[MyAuthorize("风控规则查看")]
|
||||
public JsonResult GetRuleApplications(long id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.GetRuleApplications(id);
|
||||
return Json(new { success = true, data = result });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
{
|
||||
return Json(new { success = false, message = ex.Message });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "查询规则关联应用列表");
|
||||
return Json(new { success = false, message = "系统异常,请联系管理员" });
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Application Management
|
||||
|
||||
[HttpGet("risk-applications")]
|
||||
[MyAuthorize("风控应用查看")]
|
||||
public JsonResult QueryRiskApplications(QueryRiskApplicationReq req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.QueryApplicationList(req);
|
||||
return Json(new { success = true, data = result });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
{
|
||||
return Json(new { success = false, message = ex.Message });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "查询应用配置列表");
|
||||
return Json(new { success = false, message = "系统异常,请联系管理员" });
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("risk-applications/{id}")]
|
||||
[MyAuthorize("风控应用查看")]
|
||||
public JsonResult GetRiskApplication(long id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.GetApplicationDetail(id);
|
||||
return Json(new { success = true, data = result });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
{
|
||||
return Json(new { success = false, message = ex.Message });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "查询应用配置详情");
|
||||
return Json(new { success = false, message = "系统异常,请联系管理员" });
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost("risk-applications")]
|
||||
[MyAuthorize("风控应用新增")]
|
||||
public JsonResult CreateRiskApplication([FromBody] CreateRiskApplicationReq req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.CreateApplication(req);
|
||||
return Json(new { success = true, data = result });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
{
|
||||
return Json(new { success = false, message = ex.Message });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "创建应用配置");
|
||||
return Json(new { success = false, message = "系统异常,请联系管理员" });
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut("risk-applications/{id}")]
|
||||
[MyAuthorize("风控应用编辑")]
|
||||
public JsonResult UpdateRiskApplication(long id, [FromBody] UpdateRiskApplicationReq req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.UpdateApplication(id, req);
|
||||
return Json(new { success = true, data = result });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
{
|
||||
return Json(new { success = false, message = ex.Message });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "更新应用配置");
|
||||
return Json(new { success = false, message = "系统异常,请联系管理员" });
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("risk-applications/{id}")]
|
||||
[MyAuthorize("风控应用删除")]
|
||||
public JsonResult DeleteRiskApplication(long id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
service.DeleteApplication(id);
|
||||
return Json(new { success = true });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
{
|
||||
return Json(new { success = false, message = ex.Message });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "删除应用配置");
|
||||
return Json(new { success = false, message = "系统异常,请联系管理员" });
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost("risk-applications/{id}/enable")]
|
||||
[MyAuthorize("风控应用启停")]
|
||||
public JsonResult EnableRiskApplication(long id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
service.EnableApplication(id);
|
||||
return Json(new { success = true });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
{
|
||||
return Json(new { success = false, message = ex.Message });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "启用应用配置");
|
||||
return Json(new { success = false, message = "系统异常,请联系管理员" });
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost("risk-applications/{id}/disable")]
|
||||
[MyAuthorize("风控应用启停")]
|
||||
public JsonResult DisableRiskApplication(long id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
service.DisableApplication(id);
|
||||
return Json(new { success = true });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
{
|
||||
return Json(new { success = false, message = ex.Message });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "停用应用配置");
|
||||
return Json(new { success = false, message = "系统异常,请联系管理员" });
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost("risk-applications/batch-enable")]
|
||||
[MyAuthorize("风控应用启停")]
|
||||
public JsonResult BatchEnableRiskApplications([FromBody] List<long> ids)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.BatchEnableApplications(ids);
|
||||
return Json(new { success = true, data = result });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
{
|
||||
return Json(new { success = false, message = ex.Message });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "批量启用应用配置");
|
||||
return Json(new { success = false, message = "系统异常,请联系管理员" });
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost("risk-applications/batch-disable")]
|
||||
[MyAuthorize("风控应用启停")]
|
||||
public JsonResult BatchDisableRiskApplications([FromBody] List<long> ids)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.BatchDisableApplications(ids);
|
||||
return Json(new { success = true, data = result });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
{
|
||||
return Json(new { success = false, message = ex.Message });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "批量停用应用配置");
|
||||
return Json(new { success = false, message = "系统异常,请联系管理员" });
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Variable Management
|
||||
|
||||
[HttpGet("risk-variables")]
|
||||
[MyAuthorize("风控变量查看")]
|
||||
public JsonResult QueryRiskVariables(QueryRiskVariableReq req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.QueryVariableList(req);
|
||||
return Json(new { success = true, data = result });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
{
|
||||
return Json(new { success = false, message = ex.Message });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "查询变量列表");
|
||||
return Json(new { success = false, message = "系统异常,请联系管理员" });
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("risk-variables/{id}")]
|
||||
[MyAuthorize("风控变量查看")]
|
||||
public JsonResult GetRiskVariable(long id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.GetVariableDetail(id);
|
||||
return Json(new { success = true, data = result });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
{
|
||||
return Json(new { success = false, message = ex.Message });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "查询变量详情");
|
||||
return Json(new { success = false, message = "系统异常,请联系管理员" });
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("risk-variables/list")]
|
||||
[MyAuthorize("风控变量查看")]
|
||||
public JsonResult GetAllRiskVariables()
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.GetAllVariableList();
|
||||
return Json(new { success = true, data = result });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
{
|
||||
return Json(new { success = false, message = ex.Message });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "查询全部变量列表");
|
||||
return Json(new { success = false, message = "系统异常,请联系管理员" });
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost("risk-variables")]
|
||||
[MyAuthorize("风控变量新增")]
|
||||
public JsonResult CreateRiskVariable([FromBody] CreateRiskVariableReq req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.CreateVariable(req);
|
||||
return Json(new { success = true, data = result });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
{
|
||||
return Json(new { success = false, message = ex.Message });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "创建变量");
|
||||
return Json(new { success = false, message = "系统异常,请联系管理员" });
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut("risk-variables/{id}")]
|
||||
[MyAuthorize("风控变量编辑")]
|
||||
public JsonResult UpdateRiskVariable(long id, [FromBody] UpdateRiskVariableReq req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.UpdateVariable(id, req);
|
||||
return Json(new { success = true, data = result });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
{
|
||||
return Json(new { success = false, message = ex.Message });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "更新变量");
|
||||
return Json(new { success = false, message = "系统异常,请联系管理员" });
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("risk-variables/{id}")]
|
||||
[MyAuthorize("风控变量删除")]
|
||||
public JsonResult DeleteRiskVariable(long id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
service.DeleteVariable(id);
|
||||
return Json(new { success = true });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
{
|
||||
return Json(new { success = false, message = ex.Message });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "删除变量");
|
||||
return Json(new { success = false, message = "系统异常,请联系管理员" });
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Audit Log
|
||||
|
||||
[HttpGet("risk-audit-logs")]
|
||||
[MyAuthorize("风控日志查看")]
|
||||
public JsonResult QueryRiskAuditLogs(QueryRiskAuditLogReq req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.QueryAuditLogs(req);
|
||||
return Json(new { success = true, data = result });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
{
|
||||
return Json(new { success = false, message = ex.Message });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "查询风控操作日志列表");
|
||||
return Json(new { success = false, message = "系统异常,请联系管理员" });
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("risk-audit-logs/{id}")]
|
||||
[MyAuthorize("风控日志查看")]
|
||||
public JsonResult GetRiskAuditLogDetail(long id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.GetAuditLogDetail(id);
|
||||
return Json(new { success = true, data = result });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
{
|
||||
return Json(new { success = false, message = ex.Message });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "查询风控操作日志详情");
|
||||
return Json(new { success = false, message = "系统异常,请联系管理员" });
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("risk-audit-logs/export")]
|
||||
[MyAuthorize("风控日志导出")]
|
||||
public IActionResult ExportRiskAuditLogs(QueryRiskAuditLogReq req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var bytes = service.ExportAuditLogs(req);
|
||||
return File(bytes, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "风控操作日志.xlsx");
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
{
|
||||
return Json(new { success = false, message = ex.Message });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "导出风控操作日志");
|
||||
return Json(new { success = false, message = "系统异常,请联系管理员" });
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -7,15 +7,15 @@
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"ConnectionStrings": {
|
||||
"ylcms": "server=10.250.202.35;uid=onederiv@OneDeriv#wx_dtpp_test;pooling=true;port=2883;pwd=Onederiv@2026;database=yltrs_ylcms;charset=utf8;Allow User Variables=True;SslMode=none;Connection Timeout=30;IgnoreCommandTransaction=true;",
|
||||
"yladmin": "server=10.250.202.35;uid=onederiv@OneDeriv#wx_dtpp_test;pooling=true;port=2883;pwd=Onederiv@2026;database=yltrs_admin;charset=utf8;Allow User Variables=True;SslMode=none;Connection Timeout=30;IgnoreCommandTransaction=true;",
|
||||
"ylclient": "server=10.250.202.35;uid=onederiv@OneDeriv#wx_dtpp_test;pooling=true;port=2883;pwd=Onederiv@2026;database=yltrs_client;charset=utf8;Allow User Variables=True;SslMode=none;Connection Timeout=30;IgnoreCommandTransaction=true;",
|
||||
"bondoms": "server=10.250.202.35;uid=onederiv@OneDeriv#wx_dtpp_test;pooling=true;port=2883;pwd=Onederiv@2026;database=bond_oms;charset=utf8;Allow User Variables=True;SslMode=none;Connection Timeout=30;IgnoreCommandTransaction=true;"
|
||||
"ylcms": "server=192.168.2.96;uid=DBAdmin;pooling=true;port=3306;pwd=YieldChain$$2025;database=glms_yltrs_ylcms;charset=utf8;Allow User Variables=True;SslMode=none;Connection Timeout=30;IgnoreCommandTransaction=true;",
|
||||
"yladmin": "server=192.168.2.96;uid=DBAdmin;pooling=true;port=3306;pwd=YieldChain$$2025;database=glms_yltrs_admin;charset=utf8;Allow User Variables=True;SslMode=none;Connection Timeout=30;IgnoreCommandTransaction=true;",
|
||||
"ylclient": "server=192.168.2.96;uid=DBAdmin;pooling=true;port=3306;pwd=YieldChain$$2025;database=glms_yltrs_client;charset=utf8;Allow User Variables=True;SslMode=none;Connection Timeout=30;IgnoreCommandTransaction=true;",
|
||||
"bondoms": "server=192.168.2.96;uid=DBAdmin;pooling=true;port=3306;pwd=YieldChain$$2025;database=glms_bond_oms;charset=utf8;Allow User Variables=True;SslMode=none;Connection Timeout=30;IgnoreCommandTransaction=true;"
|
||||
},
|
||||
"AppSettings": {
|
||||
"VirtualPathRoot": "",
|
||||
"UseRightAligned": "",
|
||||
"PluginFolder": "D:\\workspace\\onederiv\\trs\\Plugins\\YLErp.Plugins.GuoLian\\obj\\Debug\\net6.0" // 改为本地目录地址
|
||||
"PluginFolder": "D:\\workspace\\glms\\zszq-trs\\Plugins\\YLErp.Plugins.GuoLian\\obj\\Debug\\net6.0"
|
||||
},
|
||||
"LibreOffice": {
|
||||
"ExePath": "",
|
||||
@@ -75,15 +75,12 @@
|
||||
"SendKafakaCron": "10 0 * * *",
|
||||
"MaxThreadPercent": 0.6, //占系统资源最多60%的线程数量
|
||||
"oa_confg": {
|
||||
"BaseUrl": "http://10.250.202.40:13590",
|
||||
"SubUrl": "/gateway/oaflow/createOaFlow",
|
||||
"QueryUrl": "/gateway/oaflow/getRequestData",
|
||||
"DownloadFileUrl": "/gateway/oaflow/downloadSingleFile",
|
||||
"SystemToken": "QIkox8sv3rVLtiT1wmI4Dp8wSjX9D84Glkp121vRino9fLobWnDiy8ppmqJcv1676TYuxZsGrYelx0whRCMaPyums2VnzIYrpqCFf5tyc3/x22Elf25xgRmd5pH8tLcnPuVOjMrUf0GsoytQCGFkhnrPajhsKq/mSwYQ4OA=", //OA系统key
|
||||
"SystemName": "onederiv",
|
||||
"IsNextFlow": 1, //是否自动提交 默认0
|
||||
"FlowId": 779115,
|
||||
"UploadUrl": "http://10.250.202.40:13590/gateway/oaflow/uploadDoc"
|
||||
"BaseUrl": "http://ip:port",
|
||||
"SubUrl": "",
|
||||
"UploadUrl": "/api/oa/upload", // OA附件上传接口路径
|
||||
"SystemToken": "your-system-token", // OA系统鉴权Token
|
||||
"SystemName": "OTC_TRADE", // 调用方系统标识
|
||||
"IsNextFlow": 0
|
||||
},
|
||||
"GeneralSSO": {
|
||||
"enable": true, //是否启用通用SSO登录
|
||||
|
||||
Reference in New Issue
Block a user