Merge remote-tracking branch 'origin/feature/p132_74-risk-engine' into spike/merge-p132_74-to-1.4.2
This commit is contained in:
@@ -46,7 +46,7 @@ namespace YLErp.Modules.TradeModule.DealModule
|
||||
/// <summary>
|
||||
/// 2021-02-04改造:批量确认因为耗时太长,用户多页面(交易列表,今日交易)并发确认导致生成多条期权费资金记录
|
||||
/// </summary>
|
||||
public TradeConfirmResultModel tradeConfirm(IEnumerable<int> tradeids, bool ignoreMoneyCheck = false, bool isSkipApproval = false)
|
||||
public TradeConfirmResultModel tradeConfirm(IEnumerable<int> tradeids, bool ignoreMoneyCheck = false, bool isSkipApproval = false, bool ignoreRiskWarning = false, IEnumerable<string> ignoreRiskRuleIds = null)
|
||||
{
|
||||
if (tradeids is null || !tradeids.Any(n => n > 0))
|
||||
{
|
||||
@@ -76,6 +76,7 @@ namespace YLErp.Modules.TradeModule.DealModule
|
||||
var hasTradeProcess = HasTradeProcess();
|
||||
|
||||
var sbError = new StringBuilder();
|
||||
var sbTip = new StringBuilder();
|
||||
var result = new TradeConfirmResultModel
|
||||
{
|
||||
confirmedTradeIds = new List<int>(),
|
||||
@@ -99,7 +100,9 @@ namespace YLErp.Modules.TradeModule.DealModule
|
||||
isSkipApproval: isSkipApproval,
|
||||
confirmedTradeIds: result.confirmedTradeIds,
|
||||
changeConfirmPaths: result.changeConfirmPaths,
|
||||
continueQuotaCheck: idCache.Contains(pid));
|
||||
continueQuotaCheck: idCache.Contains(pid),
|
||||
ignoreRiskWarning: ignoreRiskWarning,
|
||||
ignoreRiskRuleIds: ignoreRiskRuleIds);
|
||||
if (pid > 0)
|
||||
{
|
||||
idCache.Add(pid);
|
||||
@@ -114,11 +117,14 @@ namespace YLErp.Modules.TradeModule.DealModule
|
||||
result.LackOfMoney = true;
|
||||
break;
|
||||
}
|
||||
if (temp.RetCode == TradeOpenRetCode.QuotaTrialError || temp.RetCode == TradeOpenRetCode.FundStatus)
|
||||
//此处LackOfMoney仅仅代表需要前端二次处理,不代表资金缺乏,延用老逻辑
|
||||
if (temp.RetCode == TradeOpenRetCode.QuotaTrialError || temp.RetCode == TradeOpenRetCode.FundStatus || temp.RetCode == TradeOpenRetCode.RiskWarning)
|
||||
{
|
||||
result.LackOfMoney = true;
|
||||
result.OldRiskNeedSpecialApproval = temp.OldRiskNeedSpecialApproval;
|
||||
result.TrialDataId = temp.TrialDataId;
|
||||
result.TradeId = temp.Trade.id;
|
||||
result.ignoreRiskRuleIds = temp.IgnoredRiskRuleIds;
|
||||
sbError.AppendLine(temp.ErrorMsg);
|
||||
break;
|
||||
}
|
||||
@@ -128,6 +134,12 @@ namespace YLErp.Modules.TradeModule.DealModule
|
||||
sbError.AppendLine(temp.ErrorMsg);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(temp.TipMsg))
|
||||
{
|
||||
result.TrialDataId = temp.TrialDataId;
|
||||
sbTip.AppendLine(temp.TipMsg);
|
||||
}
|
||||
|
||||
Helpers.LockHelper.Release(lockKeyId);
|
||||
}
|
||||
}
|
||||
@@ -135,6 +147,7 @@ namespace YLErp.Modules.TradeModule.DealModule
|
||||
DbContext.SaveChanges();
|
||||
|
||||
result.errorMsg = sbError.ToString();
|
||||
result.tipMsg = sbTip.ToString();
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -152,7 +165,7 @@ namespace YLErp.Modules.TradeModule.DealModule
|
||||
/// <param name="continueQuotaCheck"></param>
|
||||
/// <returns></returns>
|
||||
private TradeOpenResult ConfirmTrade(int tid, bool isBatch, bool hasTradeProcess,
|
||||
bool ignoreMoneyCheck, bool isSkipApproval, List<int> confirmedTradeIds, List<string> changeConfirmPaths, bool continueQuotaCheck = false)
|
||||
bool ignoreMoneyCheck, bool isSkipApproval, List<int> confirmedTradeIds, List<string> changeConfirmPaths, bool continueQuotaCheck = false, bool ignoreRiskWarning = false, IEnumerable<string> ignoreRiskRuleIds = null)
|
||||
{
|
||||
var td = DbContext.trade.FirstOrDefault(t => t.id == tid);
|
||||
var result = new TradeOpenResult(td ?? new trade());
|
||||
@@ -207,7 +220,7 @@ namespace YLErp.Modules.TradeModule.DealModule
|
||||
}
|
||||
|
||||
var trialService = new QuotaMonitorService(this);
|
||||
if (!trialService.QuotaCheck(ref result))
|
||||
if (!trialService.QuotaCheck(ref result, ignoreRiskWarning, ignoreRiskRuleIds))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
@@ -223,6 +236,10 @@ namespace YLErp.Modules.TradeModule.DealModule
|
||||
history = "特权账户批量确认自动" + history;
|
||||
}
|
||||
}
|
||||
else if (ignoreRiskWarning)
|
||||
{
|
||||
history = "风控预警确认-" + history;
|
||||
}
|
||||
//进入交易审批流程
|
||||
if (hasTradeProcess && !isSkipApproval)
|
||||
{
|
||||
@@ -604,11 +621,14 @@ namespace YLErp.Modules.TradeModule.DealModule
|
||||
public class TradeConfirmResultModel
|
||||
{
|
||||
public bool LackOfMoney;
|
||||
public bool OldRiskNeedSpecialApproval;
|
||||
public int TrialDataId;
|
||||
public int TradeId;
|
||||
public List<int> confirmedTradeIds;
|
||||
public List<string> changeConfirmPaths;
|
||||
public string errorMsg;
|
||||
public string tipMsg;
|
||||
public string type;
|
||||
public List<string> ignoreRiskRuleIds;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -794,11 +794,17 @@ namespace YLErp.Modules.TradeModule.DealModule
|
||||
public TradeOpenRetCode RetCode;
|
||||
|
||||
public int TrialDataId;
|
||||
public List<string> IgnoredRiskRuleIds;
|
||||
public bool OldRiskNeedSpecialApproval;
|
||||
|
||||
/// <summary>
|
||||
/// 错误信息
|
||||
/// </summary>
|
||||
public string ErrorMsg;
|
||||
/// <summary>
|
||||
/// 提示信息
|
||||
/// </summary>
|
||||
public string TipMsg;
|
||||
|
||||
/// <summary>
|
||||
/// 变更确认书路径
|
||||
@@ -838,6 +844,10 @@ namespace YLErp.Modules.TradeModule.DealModule
|
||||
/// </summary>
|
||||
FundStatus,
|
||||
/// <summary>
|
||||
/// 风控预警二次确认
|
||||
/// </summary>
|
||||
RiskWarning,
|
||||
/// <summary>
|
||||
/// 无审核权限
|
||||
/// </summary>
|
||||
NoRight
|
||||
|
||||
Reference in New Issue
Block a user