#EQD-6947 国联民生-保证金计算整体改造-实现第一版盯市规则(不支持同一客户多部门)(1)保证金规则的设置 阶段2 新增字段 BondTerm,调整互换交易模板绑定逻辑
This commit is contained in:
@@ -301,19 +301,43 @@ namespace YLErp.Web.Controllers
|
||||
|
||||
if (marginTemplate.Details.Count() > 1)
|
||||
{
|
||||
var underlyingType = UnderlyingTypeEnum.None;
|
||||
foreach (var detail in marginTemplate.Details)
|
||||
if (marginTemplate.RuleType == (int)MarginRuleTypeEnum.区间追保结构)
|
||||
{
|
||||
if (detail.UnderlyingType == UnderlyingTypeEnum.None)
|
||||
//区间追保结构:按 利率债期限档(SpanConfig.BondTerm)分组校验,同一期限档内标的类型不允许重复,不同期限档允许相同标的类型
|
||||
foreach (var termGroup in marginTemplate.Details.GroupBy(x => x.SpanConfig?.BondTerm ?? ""))
|
||||
{
|
||||
throw new Exception("标的类型不能为空");
|
||||
}
|
||||
if ((detail.UnderlyingType & underlyingType) > 0)
|
||||
{
|
||||
throw new Exception("存在重复的标的类型:" + UnderlyingTypeUtil.GetDesc(detail.UnderlyingType & underlyingType));
|
||||
}
|
||||
var termUnderlyingType = UnderlyingTypeEnum.None;
|
||||
foreach (var detail in termGroup)
|
||||
{
|
||||
if ((detail.UnderlyingType & termUnderlyingType) > 0)
|
||||
{
|
||||
if (marginTemplate.UnderlyingSeperateType == (int)UnderlyingSeperateTypeEnum.None)
|
||||
{
|
||||
throw new Exception("同一利率债期限档下存在重复的参数组");
|
||||
}
|
||||
throw new Exception("存在重复的标的类型:" + UnderlyingTypeUtil.GetDesc(detail.UnderlyingType & termUnderlyingType));
|
||||
}
|
||||
|
||||
underlyingType |= detail.UnderlyingType;
|
||||
termUnderlyingType |= detail.UnderlyingType;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var underlyingType = UnderlyingTypeEnum.None;
|
||||
foreach (var detail in marginTemplate.Details)
|
||||
{
|
||||
if (detail.UnderlyingType == UnderlyingTypeEnum.None)
|
||||
{
|
||||
throw new Exception("标的类型不能为空");
|
||||
}
|
||||
if ((detail.UnderlyingType & underlyingType) > 0)
|
||||
{
|
||||
throw new Exception("存在重复的标的类型:" + UnderlyingTypeUtil.GetDesc(detail.UnderlyingType & underlyingType));
|
||||
}
|
||||
|
||||
underlyingType |= detail.UnderlyingType;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user