feat:在平仓时增加风控校验,创建通用超时教研函数,以备交易确认老风控下线后接入。
This commit is contained in:
@@ -6931,6 +6931,40 @@ namespace YLErp.Modules.RiskModule
|
||||
DbContext.SaveChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存平仓风控试算说明,并保留首次试算时间作为二次确认超时起点。
|
||||
/// </summary>
|
||||
/// <param name="trialDataId">平仓风控试算记录ID。</param>
|
||||
/// <param name="remark">用户填写的特批说明。</param>
|
||||
/// <returns>更新后的平仓风控试算记录。</returns>
|
||||
public QuotaTrial SaveCloseRiskTrialRemark(int trialDataId, string remark)
|
||||
{
|
||||
if (trialDataId <= 0)
|
||||
{
|
||||
throw new ServiceException("无效的平仓风控试算记录");
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(remark))
|
||||
{
|
||||
throw new ServiceException("必须填写说明内容,才可以提交平仓");
|
||||
}
|
||||
|
||||
const int closeTrialSource = 2;
|
||||
var trial = DbContext.quotaTrial.FirstOrDefault(item => item.id == trialDataId);
|
||||
if (trial == null
|
||||
|| trial.TrialSource != closeTrialSource
|
||||
|| trial.TrialStatus != QuotaTrialStatusEnum.RiskWarning)
|
||||
{
|
||||
throw new ServiceException("未找到有效的平仓风控审批记录");
|
||||
}
|
||||
|
||||
// 仅保存说明和操作人,不更新OptDate,避免重置首次试算的确认超时时间。
|
||||
trial.Remark = remark.Trim();
|
||||
trial.OptId = UserId;
|
||||
trial.OptName = UserName;
|
||||
DbContext.SaveChanges();
|
||||
return trial;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user