优化异步逻辑
This commit is contained in:
@@ -863,6 +863,10 @@ namespace YLErp.Modules.RiskEngine
|
||||
if (rule == null)
|
||||
throw new ServiceException("仅已停用的规则可以启用");
|
||||
|
||||
var compileResult = RuleCompiler.ValidateAndCompileFormula(ruleId, rule.RuleExpr);
|
||||
if (!compileResult.Success)
|
||||
throw new ServiceException($"规则表达式编译失败:{compileResult.ErrorMessage}");
|
||||
|
||||
rule.Status = RiskRuleStatus.Active;
|
||||
rule.UpdateOptId = UserId;
|
||||
rule.UpdateOptName = UserName;
|
||||
@@ -1600,11 +1604,9 @@ namespace YLErp.Modules.RiskEngine
|
||||
|
||||
WriteAuditLog("VAR_UPDATE", "VARIABLE", variableId, req.VariableName, $"修改变量:{variable.VariableName}");
|
||||
|
||||
foreach (var rule in affectedRules)
|
||||
{
|
||||
WriteAuditLog("VAR_UPDATE_CASCADE", "RULE", rule.id, rule.RuleName,
|
||||
$"变量 [{variable.VariableName}] VariableExpr 变更,级联更新规则 RuleExpr");
|
||||
}
|
||||
var cascadedRuleIds = affectedRules.Select(r => r.id.ToString()).ToList();
|
||||
WriteAuditLog("VAR_UPDATE_CASCADE", "VARIABLE", variableId, req.VariableName,
|
||||
$"变量 [{variable.VariableName}] VariableExpr 变更,级联更新规则 {string.Join("、", cascadedRuleIds)}");
|
||||
|
||||
DbContext.SaveChanges();
|
||||
transaction.Commit();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Qdp.Foundation.Utilities;
|
||||
using System.Threading.Tasks;
|
||||
using YLErp.DBModels;
|
||||
using YLErp.Modules.RiskEngine;
|
||||
using YLErp.Modules.RiskEngine.Dto;
|
||||
@@ -11,17 +12,19 @@ namespace YLErp.Web.Controllers
|
||||
{
|
||||
private readonly IYcLogger _logger = LogFactory.GetLogger("RiskRuleController");
|
||||
|
||||
private RiskRuleService GetRiskRuleService() => new RiskRuleService(CurUser);
|
||||
|
||||
#region Rule Management
|
||||
|
||||
[HttpGet("risk-rules")]
|
||||
[MyAuthorize("风险控制-风控规则查看")]
|
||||
/// <summary>查询风控规则列表(分页)</summary>
|
||||
public JsonResult QueryRiskRules(QueryRiskRuleReq req)
|
||||
public async Task<JsonResult> QueryRiskRules(QueryRiskRuleReq req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.QueryRuleList(req);
|
||||
var service = GetRiskRuleService();
|
||||
var result = await Task.Run(() => service.QueryRuleList(req));
|
||||
return Json(new { success = true, data = result });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
@@ -38,12 +41,12 @@ namespace YLErp.Web.Controllers
|
||||
[HttpGet("risk-rules/{id}")]
|
||||
[MyAuthorize("风险控制-风控规则查看")]
|
||||
/// <summary>获取风控规则详情</summary>
|
||||
public JsonResult GetRiskRule(long id)
|
||||
public async Task<JsonResult> GetRiskRule(long id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.GetRuleDetail(id);
|
||||
var service = GetRiskRuleService();
|
||||
var result = await Task.Run(() => service.GetRuleDetail(id));
|
||||
return Json(new { success = true, data = result });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
@@ -60,12 +63,12 @@ namespace YLErp.Web.Controllers
|
||||
[HttpGet("risk-rules/{id}/versions")]
|
||||
[MyAuthorize("风险控制-风控规则查看")]
|
||||
/// <summary>获取风控规则版本历史</summary>
|
||||
public JsonResult GetRiskRuleVersions(long id)
|
||||
public async Task<JsonResult> GetRiskRuleVersions(long id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.GetRuleVersions(id);
|
||||
var service = GetRiskRuleService();
|
||||
var result = await Task.Run(() => service.GetRuleVersions(id));
|
||||
return Json(new { success = true, data = result });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
@@ -82,12 +85,12 @@ namespace YLErp.Web.Controllers
|
||||
[HttpPost("risk-rules")]
|
||||
[MyAuthorize("风险控制-风控规则新增")]
|
||||
/// <summary>创建风控规则</summary>
|
||||
public JsonResult CreateRiskRule([FromBody] CreateRiskRuleReq req)
|
||||
public async Task<JsonResult> CreateRiskRule([FromBody] CreateRiskRuleReq req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.CreateRule(req);
|
||||
var service = GetRiskRuleService();
|
||||
var result = await Task.Run(() => service.CreateRule(req));
|
||||
return Json(new { success = true, data = result });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
@@ -104,12 +107,12 @@ namespace YLErp.Web.Controllers
|
||||
[HttpPut("risk-rules/{id}")]
|
||||
[MyAuthorize("风险控制-风控规则编辑")]
|
||||
/// <summary>更新风控规则</summary>
|
||||
public JsonResult UpdateRiskRule(long id, [FromBody] UpdateRiskRuleReq req)
|
||||
public async Task<JsonResult> UpdateRiskRule(long id, [FromBody] UpdateRiskRuleReq req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.UpdateRule(id, req);
|
||||
var service = GetRiskRuleService();
|
||||
var result = await Task.Run(() => service.UpdateRule(id, req));
|
||||
return Json(new { success = true, data = result });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
@@ -126,12 +129,12 @@ namespace YLErp.Web.Controllers
|
||||
[HttpDelete("risk-rules/{id}")]
|
||||
[MyAuthorize("风险控制-风控规则删除")]
|
||||
/// <summary>删除风控规则(软删除)</summary>
|
||||
public JsonResult DeleteRiskRule(long id)
|
||||
public async Task<JsonResult> DeleteRiskRule(long id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
service.DeleteRule(id);
|
||||
var service = GetRiskRuleService();
|
||||
await Task.Run(() => service.DeleteRule(id));
|
||||
return Json(new { success = true });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
@@ -148,12 +151,12 @@ namespace YLErp.Web.Controllers
|
||||
[HttpDelete("risk-rules/batch")]
|
||||
[MyAuthorize("风险控制-风控规则删除")]
|
||||
/// <summary>批量删除风控规则</summary>
|
||||
public JsonResult BatchDeleteRiskRules([FromBody] List<long> ids)
|
||||
public async Task<JsonResult> BatchDeleteRiskRules([FromBody] List<long> ids)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.BatchDeleteRules(ids);
|
||||
var service = GetRiskRuleService();
|
||||
var result = await Task.Run(() => service.BatchDeleteRules(ids));
|
||||
return Json(new { success = true, data = result });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
@@ -170,12 +173,12 @@ namespace YLErp.Web.Controllers
|
||||
[HttpPost("risk-rules/{id}/enable")]
|
||||
[MyAuthorize("风险控制-风控规则启停")]
|
||||
/// <summary>启用风控规则</summary>
|
||||
public JsonResult EnableRiskRule(long id)
|
||||
public async Task<JsonResult> EnableRiskRule(long id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
service.EnableRule(id);
|
||||
var service = GetRiskRuleService();
|
||||
await Task.Run(() => service.EnableRule(id));
|
||||
return Json(new { success = true });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
@@ -192,12 +195,12 @@ namespace YLErp.Web.Controllers
|
||||
[HttpPost("risk-rules/{id}/disable")]
|
||||
[MyAuthorize("风险控制-风控规则启停")]
|
||||
/// <summary>停用风控规则</summary>
|
||||
public JsonResult DisableRiskRule(long id)
|
||||
public async Task<JsonResult> DisableRiskRule(long id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
service.DisableRule(id);
|
||||
var service = GetRiskRuleService();
|
||||
await Task.Run(() => service.DisableRule(id));
|
||||
return Json(new { success = true });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
@@ -214,12 +217,12 @@ namespace YLErp.Web.Controllers
|
||||
[HttpGet("risk-rules/{id}/applications")]
|
||||
[MyAuthorize("风险控制-风控规则查看")]
|
||||
/// <summary>获取规则关联的应用配置列表</summary>
|
||||
public JsonResult GetRuleApplications(long id)
|
||||
public async Task<JsonResult> GetRuleApplications(long id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.GetRuleApplications(id);
|
||||
var service = GetRiskRuleService();
|
||||
var result = await Task.Run(() => service.GetRuleApplications(id));
|
||||
return Json(new { success = true, data = new { rows = result, total = result.Count, records = result.Count, page = 1 } });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
@@ -236,12 +239,12 @@ namespace YLErp.Web.Controllers
|
||||
[HttpGet("risk-rules/list")]
|
||||
[MyAuthorize("风险控制-风控规则查看")]
|
||||
/// <summary>获取所有启用规则列表(供下拉选择)</summary>
|
||||
public JsonResult GetAllRiskRules()
|
||||
public async Task<JsonResult> GetAllRiskRules()
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.GetAllRuleList();
|
||||
var service = GetRiskRuleService();
|
||||
var result = await Task.Run(() => service.GetAllRuleList());
|
||||
return Json(new { success = true, data = new { rows = result, total = result.Count, records = result.Count, page = 1 } });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
@@ -262,12 +265,12 @@ namespace YLErp.Web.Controllers
|
||||
[HttpGet("risk-applications")]
|
||||
[MyAuthorize("风险控制-风控应用查看")]
|
||||
/// <summary>查询应用配置列表(分页)</summary>
|
||||
public JsonResult QueryRiskApplications(QueryRiskApplicationReq req)
|
||||
public async Task<JsonResult> QueryRiskApplications(QueryRiskApplicationReq req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.QueryApplicationList(req);
|
||||
var service = GetRiskRuleService();
|
||||
var result = await Task.Run(() => service.QueryApplicationList(req));
|
||||
return Json(new { success = true, data = result });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
@@ -284,12 +287,12 @@ namespace YLErp.Web.Controllers
|
||||
[HttpGet("risk-applications/{id}")]
|
||||
[MyAuthorize("风险控制-风控应用查看")]
|
||||
/// <summary>获取应用配置详情</summary>
|
||||
public JsonResult GetRiskApplication(long id)
|
||||
public async Task<JsonResult> GetRiskApplication(long id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.GetApplicationDetail(id);
|
||||
var service = GetRiskRuleService();
|
||||
var result = await Task.Run(() => service.GetApplicationDetail(id));
|
||||
return Json(new { success = true, data = result });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
@@ -306,12 +309,12 @@ namespace YLErp.Web.Controllers
|
||||
[HttpPost("risk-applications")]
|
||||
[MyAuthorize("风险控制-风控应用新增")]
|
||||
/// <summary>创建应用配置</summary>
|
||||
public JsonResult CreateRiskApplication([FromBody] CreateRiskApplicationReq req)
|
||||
public async Task<JsonResult> CreateRiskApplication([FromBody] CreateRiskApplicationReq req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.CreateApplication(req);
|
||||
var service = GetRiskRuleService();
|
||||
var result = await Task.Run(() => service.CreateApplication(req));
|
||||
return Json(new { success = true, data = result });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
@@ -328,12 +331,12 @@ namespace YLErp.Web.Controllers
|
||||
[HttpPut("risk-applications/{id}")]
|
||||
[MyAuthorize("风险控制-风控应用编辑")]
|
||||
/// <summary>更新应用配置</summary>
|
||||
public JsonResult UpdateRiskApplication(long id, [FromBody] UpdateRiskApplicationReq req)
|
||||
public async Task<JsonResult> UpdateRiskApplication(long id, [FromBody] UpdateRiskApplicationReq req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.UpdateApplication(id, req);
|
||||
var service = GetRiskRuleService();
|
||||
var result = await Task.Run(() => service.UpdateApplication(id, req));
|
||||
return Json(new { success = true, data = result });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
@@ -350,12 +353,12 @@ namespace YLErp.Web.Controllers
|
||||
[HttpDelete("risk-applications/{id}")]
|
||||
[MyAuthorize("风险控制-风控应用删除")]
|
||||
/// <summary>删除应用配置(软删除)</summary>
|
||||
public JsonResult DeleteRiskApplication(long id)
|
||||
public async Task<JsonResult> DeleteRiskApplication(long id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
service.DeleteApplication(id);
|
||||
var service = GetRiskRuleService();
|
||||
await Task.Run(() => service.DeleteApplication(id));
|
||||
return Json(new { success = true });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
@@ -372,12 +375,12 @@ namespace YLErp.Web.Controllers
|
||||
[HttpPost("risk-applications/{id}/enable")]
|
||||
[MyAuthorize("风险控制-风控应用启停")]
|
||||
/// <summary>启用应用配置</summary>
|
||||
public JsonResult EnableRiskApplication(long id)
|
||||
public async Task<JsonResult> EnableRiskApplication(long id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
service.EnableApplication(id);
|
||||
var service = GetRiskRuleService();
|
||||
await Task.Run(() => service.EnableApplication(id));
|
||||
return Json(new { success = true });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
@@ -394,12 +397,12 @@ namespace YLErp.Web.Controllers
|
||||
[HttpPost("risk-applications/{id}/disable")]
|
||||
[MyAuthorize("风险控制-风控应用启停")]
|
||||
/// <summary>停用应用配置</summary>
|
||||
public JsonResult DisableRiskApplication(long id)
|
||||
public async Task<JsonResult> DisableRiskApplication(long id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
service.DisableApplication(id);
|
||||
var service = GetRiskRuleService();
|
||||
await Task.Run(() => service.DisableApplication(id));
|
||||
return Json(new { success = true });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
@@ -416,12 +419,12 @@ namespace YLErp.Web.Controllers
|
||||
[HttpPost("risk-applications/batch-enable")]
|
||||
[MyAuthorize("风险控制-风控应用启停")]
|
||||
/// <summary>批量启用应用配置</summary>
|
||||
public JsonResult BatchEnableRiskApplications([FromBody] List<long> ids)
|
||||
public async Task<JsonResult> BatchEnableRiskApplications([FromBody] List<long> ids)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.BatchEnableApplications(ids);
|
||||
var service = GetRiskRuleService();
|
||||
var result = await Task.Run(() => service.BatchEnableApplications(ids));
|
||||
return Json(new { success = true, data = result });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
@@ -438,12 +441,12 @@ namespace YLErp.Web.Controllers
|
||||
[HttpPost("risk-applications/batch-disable")]
|
||||
[MyAuthorize("风险控制-风控应用启停")]
|
||||
/// <summary>批量停用应用配置</summary>
|
||||
public JsonResult BatchDisableRiskApplications([FromBody] List<long> ids)
|
||||
public async Task<JsonResult> BatchDisableRiskApplications([FromBody] List<long> ids)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.BatchDisableApplications(ids);
|
||||
var service = GetRiskRuleService();
|
||||
var result = await Task.Run(() => service.BatchDisableApplications(ids));
|
||||
return Json(new { success = true, data = result });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
@@ -464,12 +467,12 @@ namespace YLErp.Web.Controllers
|
||||
[HttpGet("risk-variables")]
|
||||
[MyAuthorize("风险控制-风控变量查看")]
|
||||
/// <summary>查询变量列表</summary>
|
||||
public JsonResult QueryRiskVariables(QueryRiskVariableReq req)
|
||||
public async Task<JsonResult> QueryRiskVariables(QueryRiskVariableReq req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.QueryVariableList(req);
|
||||
var service = GetRiskRuleService();
|
||||
var result = await Task.Run(() => service.QueryVariableList(req));
|
||||
return Json(new { success = true, data = result });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
@@ -486,12 +489,12 @@ namespace YLErp.Web.Controllers
|
||||
[HttpGet("risk-variables/{id}")]
|
||||
[MyAuthorize("风险控制-风控变量查看")]
|
||||
/// <summary>获取变量详情</summary>
|
||||
public JsonResult GetRiskVariable(long id)
|
||||
public async Task<JsonResult> GetRiskVariable(long id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.GetVariableDetail(id);
|
||||
var service = GetRiskRuleService();
|
||||
var result = await Task.Run(() => service.GetVariableDetail(id));
|
||||
return Json(new { success = true, data = result });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
@@ -508,12 +511,12 @@ namespace YLErp.Web.Controllers
|
||||
[HttpGet("risk-variables/list")]
|
||||
[MyAuthorize("风险控制-风控变量查看")]
|
||||
/// <summary>获取所有变量列表(供下拉选择)</summary>
|
||||
public JsonResult GetAllRiskVariables()
|
||||
public async Task<JsonResult> GetAllRiskVariables()
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.GetAllVariableList();
|
||||
var service = GetRiskRuleService();
|
||||
var result = await Task.Run(() => service.GetAllVariableList());
|
||||
return Json(new { success = true, data = new { rows = result, total = result.Count, records = result.Count, page = 1 } });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
@@ -530,12 +533,12 @@ namespace YLErp.Web.Controllers
|
||||
[HttpPost("risk-variables")]
|
||||
[MyAuthorize("风险控制-风控变量新增")]
|
||||
/// <summary>创建变量</summary>
|
||||
public JsonResult CreateRiskVariable([FromBody] CreateRiskVariableReq req)
|
||||
public async Task<JsonResult> CreateRiskVariable([FromBody] CreateRiskVariableReq req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.CreateVariable(req);
|
||||
var service = GetRiskRuleService();
|
||||
var result = await Task.Run(() => service.CreateVariable(req));
|
||||
return Json(new { success = true, data = result });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
@@ -552,12 +555,12 @@ namespace YLErp.Web.Controllers
|
||||
[HttpPut("risk-variables/{id}")]
|
||||
[MyAuthorize("风险控制-风控变量编辑")]
|
||||
/// <summary>更新变量(含级联更新引用规则的 RuleExpr)</summary>
|
||||
public JsonResult UpdateRiskVariable(long id, [FromBody] UpdateRiskVariableReq req)
|
||||
public async Task<JsonResult> UpdateRiskVariable(long id, [FromBody] UpdateRiskVariableReq req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.UpdateVariable(id, req);
|
||||
var service = GetRiskRuleService();
|
||||
var result = await Task.Run(() => service.UpdateVariable(id, req));
|
||||
return Json(new { success = true, data = result });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
@@ -574,12 +577,12 @@ namespace YLErp.Web.Controllers
|
||||
[HttpDelete("risk-variables/{id}")]
|
||||
[MyAuthorize("风险控制-风控变量删除")]
|
||||
/// <summary>删除变量</summary>
|
||||
public JsonResult DeleteRiskVariable(long id)
|
||||
public async Task<JsonResult> DeleteRiskVariable(long id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
service.DeleteVariable(id);
|
||||
var service = GetRiskRuleService();
|
||||
await Task.Run(() => service.DeleteVariable(id));
|
||||
return Json(new { success = true });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
@@ -599,7 +602,7 @@ namespace YLErp.Web.Controllers
|
||||
|
||||
[HttpGet("trade-types")]
|
||||
[MyAuthorize("风险控制-风控应用查看")]
|
||||
/// <summary>获取合约类型列表</summary>
|
||||
/// <summary>获取合约类型列表(纯内存操作,无需异步)</summary>
|
||||
public JsonResult GetTradeTypes()
|
||||
{
|
||||
try
|
||||
@@ -630,12 +633,12 @@ namespace YLErp.Web.Controllers
|
||||
[HttpGet("risk-audit-logs")]
|
||||
[MyAuthorize("风险控制-风控日志查看")]
|
||||
/// <summary>查询风控操作日志列表(分页)</summary>
|
||||
public JsonResult QueryRiskAuditLogs(QueryRiskAuditLogReq req)
|
||||
public async Task<JsonResult> QueryRiskAuditLogs(QueryRiskAuditLogReq req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.QueryAuditLogs(req);
|
||||
var service = GetRiskRuleService();
|
||||
var result = await Task.Run(() => service.QueryAuditLogs(req));
|
||||
return Json(new { success = true, data = result });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
@@ -652,12 +655,12 @@ namespace YLErp.Web.Controllers
|
||||
[HttpGet("risk-audit-logs/{id}")]
|
||||
[MyAuthorize("风险控制-风控日志查看")]
|
||||
/// <summary>获取风控操作日志详情</summary>
|
||||
public JsonResult GetRiskAuditLogDetail(long id)
|
||||
public async Task<JsonResult> GetRiskAuditLogDetail(long id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var result = service.GetAuditLogDetail(id);
|
||||
var service = GetRiskRuleService();
|
||||
var result = await Task.Run(() => service.GetAuditLogDetail(id));
|
||||
return Json(new { success = true, data = result });
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
@@ -674,12 +677,12 @@ namespace YLErp.Web.Controllers
|
||||
[HttpGet("risk-audit-logs/export")]
|
||||
[MyAuthorize("风险控制-风控日志导出")]
|
||||
/// <summary>导出风控操作日志为 Excel</summary>
|
||||
public IActionResult ExportRiskAuditLogs(QueryRiskAuditLogReq req)
|
||||
public async Task<IActionResult> ExportRiskAuditLogs(QueryRiskAuditLogReq req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = new RiskRuleService(CurUser);
|
||||
var bytes = service.ExportAuditLogs(req);
|
||||
var service = GetRiskRuleService();
|
||||
var bytes = await Task.Run(() => service.ExportAuditLogs(req));
|
||||
return File(bytes, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "风控操作日志.xlsx");
|
||||
}
|
||||
catch (ServiceException ex)
|
||||
@@ -695,4 +698,4 @@ namespace YLErp.Web.Controllers
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user