Merge branch 'feature/p132_74-risk-engine' of https://gitee.glmszq.com/gsty/onederiv/trs into feature/p132_74-risk-engine

This commit is contained in:
ruisu
2026-07-09 18:08:40 +08:00
30 changed files with 544 additions and 3 deletions
@@ -5,6 +5,7 @@ using YLErp.Modules.RiskEngine.Dto;
namespace YLErp.Web.Controllers
{
/// <summary>风控引擎管理控制器,提供规则、应用配置、变量池和审计日志的 CRUD 接口</summary>
[Route("risk-engine")]
public class RiskRuleController : BaseController
{
@@ -14,6 +15,7 @@ namespace YLErp.Web.Controllers
[HttpGet("risk-rules")]
[MyAuthorize("风险控制-风控规则查看")]
/// <summary>查询风控规则列表(分页)</summary>
public JsonResult QueryRiskRules(QueryRiskRuleReq req)
{
try
@@ -35,6 +37,7 @@ namespace YLErp.Web.Controllers
[HttpGet("risk-rules/{id}")]
[MyAuthorize("风险控制-风控规则查看")]
/// <summary>获取风控规则详情</summary>
public JsonResult GetRiskRule(long id)
{
try
@@ -56,6 +59,7 @@ namespace YLErp.Web.Controllers
[HttpGet("risk-rules/{id}/versions")]
[MyAuthorize("风险控制-风控规则查看")]
/// <summary>获取风控规则版本历史</summary>
public JsonResult GetRiskRuleVersions(long id)
{
try
@@ -77,6 +81,7 @@ namespace YLErp.Web.Controllers
[HttpPost("risk-rules")]
[MyAuthorize("风险控制-风控规则新增")]
/// <summary>创建风控规则</summary>
public JsonResult CreateRiskRule([FromBody] CreateRiskRuleReq req)
{
try
@@ -98,6 +103,7 @@ namespace YLErp.Web.Controllers
[HttpPut("risk-rules/{id}")]
[MyAuthorize("风险控制-风控规则编辑")]
/// <summary>更新风控规则</summary>
public JsonResult UpdateRiskRule(long id, [FromBody] UpdateRiskRuleReq req)
{
try
@@ -119,6 +125,7 @@ namespace YLErp.Web.Controllers
[HttpDelete("risk-rules/{id}")]
[MyAuthorize("风险控制-风控规则删除")]
/// <summary>删除风控规则(软删除)</summary>
public JsonResult DeleteRiskRule(long id)
{
try
@@ -140,6 +147,7 @@ namespace YLErp.Web.Controllers
[HttpDelete("risk-rules/batch")]
[MyAuthorize("风险控制-风控规则删除")]
/// <summary>批量删除风控规则</summary>
public JsonResult BatchDeleteRiskRules([FromBody] List<long> ids)
{
try
@@ -161,6 +169,7 @@ namespace YLErp.Web.Controllers
[HttpPost("risk-rules/{id}/enable")]
[MyAuthorize("风险控制-风控规则启停")]
/// <summary>启用风控规则</summary>
public JsonResult EnableRiskRule(long id)
{
try
@@ -182,6 +191,7 @@ namespace YLErp.Web.Controllers
[HttpPost("risk-rules/{id}/disable")]
[MyAuthorize("风险控制-风控规则启停")]
/// <summary>停用风控规则</summary>
public JsonResult DisableRiskRule(long id)
{
try
@@ -203,6 +213,7 @@ namespace YLErp.Web.Controllers
[HttpGet("risk-rules/{id}/applications")]
[MyAuthorize("风险控制-风控规则查看")]
/// <summary>获取规则关联的应用配置列表</summary>
public JsonResult GetRuleApplications(long id)
{
try
@@ -224,6 +235,7 @@ namespace YLErp.Web.Controllers
[HttpGet("risk-rules/list")]
[MyAuthorize("风险控制-风控规则查看")]
/// <summary>获取所有启用规则列表(供下拉选择)</summary>
public JsonResult GetAllRiskRules()
{
try
@@ -249,6 +261,7 @@ namespace YLErp.Web.Controllers
[HttpGet("risk-applications")]
[MyAuthorize("风险控制-风控应用查看")]
/// <summary>查询应用配置列表(分页)</summary>
public JsonResult QueryRiskApplications(QueryRiskApplicationReq req)
{
try
@@ -270,6 +283,7 @@ namespace YLErp.Web.Controllers
[HttpGet("risk-applications/{id}")]
[MyAuthorize("风险控制-风控应用查看")]
/// <summary>获取应用配置详情</summary>
public JsonResult GetRiskApplication(long id)
{
try
@@ -291,6 +305,7 @@ namespace YLErp.Web.Controllers
[HttpPost("risk-applications")]
[MyAuthorize("风险控制-风控应用新增")]
/// <summary>创建应用配置</summary>
public JsonResult CreateRiskApplication([FromBody] CreateRiskApplicationReq req)
{
try
@@ -312,6 +327,7 @@ namespace YLErp.Web.Controllers
[HttpPut("risk-applications/{id}")]
[MyAuthorize("风险控制-风控应用编辑")]
/// <summary>更新应用配置</summary>
public JsonResult UpdateRiskApplication(long id, [FromBody] UpdateRiskApplicationReq req)
{
try
@@ -333,6 +349,7 @@ namespace YLErp.Web.Controllers
[HttpDelete("risk-applications/{id}")]
[MyAuthorize("风险控制-风控应用删除")]
/// <summary>删除应用配置(软删除)</summary>
public JsonResult DeleteRiskApplication(long id)
{
try
@@ -354,6 +371,7 @@ namespace YLErp.Web.Controllers
[HttpPost("risk-applications/{id}/enable")]
[MyAuthorize("风险控制-风控应用启停")]
/// <summary>启用应用配置</summary>
public JsonResult EnableRiskApplication(long id)
{
try
@@ -375,6 +393,7 @@ namespace YLErp.Web.Controllers
[HttpPost("risk-applications/{id}/disable")]
[MyAuthorize("风险控制-风控应用启停")]
/// <summary>停用应用配置</summary>
public JsonResult DisableRiskApplication(long id)
{
try
@@ -396,6 +415,7 @@ namespace YLErp.Web.Controllers
[HttpPost("risk-applications/batch-enable")]
[MyAuthorize("风险控制-风控应用启停")]
/// <summary>批量启用应用配置</summary>
public JsonResult BatchEnableRiskApplications([FromBody] List<long> ids)
{
try
@@ -417,6 +437,7 @@ namespace YLErp.Web.Controllers
[HttpPost("risk-applications/batch-disable")]
[MyAuthorize("风险控制-风控应用启停")]
/// <summary>批量停用应用配置</summary>
public JsonResult BatchDisableRiskApplications([FromBody] List<long> ids)
{
try
@@ -442,6 +463,7 @@ namespace YLErp.Web.Controllers
[HttpGet("risk-variables")]
[MyAuthorize("风险控制-风控变量查看")]
/// <summary>查询变量列表</summary>
public JsonResult QueryRiskVariables(QueryRiskVariableReq req)
{
try
@@ -463,6 +485,7 @@ namespace YLErp.Web.Controllers
[HttpGet("risk-variables/{id}")]
[MyAuthorize("风险控制-风控变量查看")]
/// <summary>获取变量详情</summary>
public JsonResult GetRiskVariable(long id)
{
try
@@ -484,6 +507,7 @@ namespace YLErp.Web.Controllers
[HttpGet("risk-variables/list")]
[MyAuthorize("风险控制-风控变量查看")]
/// <summary>获取所有变量列表(供下拉选择)</summary>
public JsonResult GetAllRiskVariables()
{
try
@@ -505,6 +529,7 @@ namespace YLErp.Web.Controllers
[HttpPost("risk-variables")]
[MyAuthorize("风险控制-风控变量新增")]
/// <summary>创建变量</summary>
public JsonResult CreateRiskVariable([FromBody] CreateRiskVariableReq req)
{
try
@@ -526,6 +551,7 @@ namespace YLErp.Web.Controllers
[HttpPut("risk-variables/{id}")]
[MyAuthorize("风险控制-风控变量编辑")]
/// <summary>更新变量(含级联更新引用规则的 RuleExpr</summary>
public JsonResult UpdateRiskVariable(long id, [FromBody] UpdateRiskVariableReq req)
{
try
@@ -547,6 +573,7 @@ namespace YLErp.Web.Controllers
[HttpDelete("risk-variables/{id}")]
[MyAuthorize("风险控制-风控变量删除")]
/// <summary>删除变量</summary>
public JsonResult DeleteRiskVariable(long id)
{
try
@@ -572,6 +599,7 @@ namespace YLErp.Web.Controllers
[HttpGet("trade-types")]
[MyAuthorize("风险控制-风控应用查看")]
/// <summary>获取合约类型列表</summary>
public JsonResult GetTradeTypes()
{
try
@@ -601,6 +629,7 @@ namespace YLErp.Web.Controllers
[HttpGet("risk-audit-logs")]
[MyAuthorize("风险控制-风控日志查看")]
/// <summary>查询风控操作日志列表(分页)</summary>
public JsonResult QueryRiskAuditLogs(QueryRiskAuditLogReq req)
{
try
@@ -622,6 +651,7 @@ namespace YLErp.Web.Controllers
[HttpGet("risk-audit-logs/{id}")]
[MyAuthorize("风险控制-风控日志查看")]
/// <summary>获取风控操作日志详情</summary>
public JsonResult GetRiskAuditLogDetail(long id)
{
try
@@ -643,6 +673,7 @@ namespace YLErp.Web.Controllers
[HttpGet("risk-audit-logs/export")]
[MyAuthorize("风险控制-风控日志导出")]
/// <summary>导出风控操作日志为 Excel</summary>
public IActionResult ExportRiskAuditLogs(QueryRiskAuditLogReq req)
{
try