山证bug修复及功能 迁移

This commit is contained in:
吴方海
2024-06-04 18:19:49 +08:00
parent df65cd0add
commit acbd2e7678
39 changed files with 709 additions and 406 deletions
@@ -33,7 +33,7 @@ namespace YLErp.Modules.EodModule.SettlementModule
var eodPriceProvider = _context.GetEodPriceProvider();
//判断当日结算价是否已经入库
if (!EodPriceQueryService.CheckDbExists(_context.SettleDate, _context.PreSettleDate))
if (!EodPriceQueryService.CheckDbExists(_context.SettleDate))
{
_context.RaiseError(Step, "结算价格未入库");
}
@@ -22,7 +22,7 @@ namespace YLErp.Modules.EodModule.SettlementModule
/// </summary>
public void Execute()
{
if (!_context.OtcTrades.Any()&& !hasSwaptrade())
if (!_context.OtcTrades.Any() && !hasSwaptrade())
{
return;
}
@@ -34,7 +34,7 @@ namespace YLErp.Modules.EodModule.SettlementModule
IQueryable<string> allQuery = null;
//判断当日结算价是否已经入库
if (!EodPriceQueryService.CheckDbExists(_context.SettleDate,_context.PreSettleDate))
if (!EodPriceQueryService.CheckDbExists(_context.SettleDate))
{
_context.RaiseError(Step, "结算价格未入库");
}
@@ -45,24 +45,24 @@ namespace YLErp.Modules.EodModule.SettlementModule
if (request.IsSettleOtcTrades)
{
var tradePredicate = _context.PredicateBuilder.GetOtcTradePredicate()
.And(t => t.TradeType != "自定义交易"&&t.TradeType!="收益互换" && t.UnderlyingCode != null);
.And(t => t.TradeType != "自定义交易" && t.TradeType != "收益互换" && t.UnderlyingCode != null);
//新增客户筛选 tw
if (clienIds != null)
{
tradePredicate = tradePredicate.And(l => clienIds.Contains(l.ClientId));
}
allQuery = DbContext.trade.Where(tradePredicate).Select(n => n.UnderlyingCode).Distinct();
var clientProductPredicate = _context.PredicateBuilder.GetClientProductPredicate();
//新增客户筛选 tw
if (clienIds != null)
{
clientProductPredicate = clientProductPredicate.And(l => clienIds.Contains(l.ClientId));
}
var clientProductQuery = from t in DbContext.clientcashincashout_product.Where(clientProductPredicate)
join um in DbContext.underlying_manager on t.UnderlyingId equals um.id
select um.UnderlyingCode;
@@ -101,11 +101,11 @@ namespace YLErp.Modules.EodModule.SettlementModule
var umCodeArr = allQuery.ToArray();
var swapUmCodeArr = GetSwapUnderlyingCodes();
var eodPriceProvider = _context.GetEodPriceProvider().Initialize(umCodeArr);
var preEodPriceProvidaer = _context.GetPreEodPriceProvider().Initialize(swapUmCodeArr);
var umCodes = umCodeArr.Where(n => !string.IsNullOrEmpty(n) && !eodPriceProvider.HasValue(n)).ToHashSet(StringComparer.OrdinalIgnoreCase);
var swapUmCodes= swapUmCodeArr.Where(n => !string.IsNullOrEmpty(n) && !preEodPriceProvidaer.HasValue(n)).ToHashSet(StringComparer.OrdinalIgnoreCase);
umCodes= umCodes.Concat(swapUmCodes).ToHashSet();
var codeArr = umCodeArr.Union(swapUmCodeArr);
var eodPriceProvider = _context.GetEodPriceProvider().Initialize(codeArr);
// var preEodPriceProvidaer = _context.GetPreEodPriceProvider().Initialize(swapUmCodeArr);
var umCodes = codeArr.Where(n => !string.IsNullOrEmpty(n) && !eodPriceProvider.HasValue(n)).ToHashSet(StringComparer.OrdinalIgnoreCase);
//var swapUmCodes= swapUmCodeArr.Where(n => !string.IsNullOrEmpty(n) && !preEodPriceProvidaer.HasValue(n)).ToHashSet(StringComparer.OrdinalIgnoreCase);
//排除掉节假日不需要结算的交易
foreach (var t in _context.HolidayTrades)
{
@@ -131,7 +131,7 @@ namespace YLErp.Modules.EodModule.SettlementModule
var tradePredicate = _context.PredicateBuilder.GetOtcSwapTradePredicate();
var query = from t in DbContext.trade.Where(tradePredicate)
join p in DbContext.swap_position on t.id equals p.SwapTradeId
where p.IsInitial && !string.IsNullOrEmpty(p.UnderlyingCode)&& !p.Invalid
where p.IsInitial && !string.IsNullOrEmpty(p.UnderlyingCode) && !p.Invalid
select p.UnderlyingCode;
return query.Distinct().ToArray();
}
@@ -153,7 +153,7 @@ namespace YLErp.Modules.EodModule.SettlementModule
{
ClientId = t.ClientId,
StructureType = t.StructureType,
marin = s.InterestPrincipalFix * (s.InterestDirection == 1 ? -1 : 1)
marin = s.InterestPrincipalFix * (s.InterestDirection == 1 ? -1m : 1m)
};
var eodSwaps = eodSwapQuery.ToList();