#TRS-ZS-58 收盘操作:删除从衡泰获取数据等等功能
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace YLErp.Modules.SwapModule.Interface
|
||||
{
|
||||
public interface IPushHTService
|
||||
{
|
||||
void PushTrade();
|
||||
void PushClient();
|
||||
|
||||
void PushSingle(PushLog pushLog);
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using YLErp.Abstract;
|
||||
using YLErp.Modules.SwapModule.Interface;
|
||||
|
||||
namespace YLErp.Modules.SwapModule
|
||||
{
|
||||
public class PushHTService : IPushHTService
|
||||
{
|
||||
private IKafkaProduce kafkaProduceHelper;
|
||||
public PushHTService(IKafkaProduce kafkaProduce)
|
||||
{
|
||||
kafkaProduceHelper = kafkaProduce;
|
||||
}
|
||||
/// <summary>
|
||||
/// 推送交易相关
|
||||
/// </summary>
|
||||
public void PushTrade()
|
||||
{
|
||||
SwapPushService pushService = new SwapPushService(OptUserInfo.SystemUser);
|
||||
pushService.SetKafKaProduce(kafkaProduceHelper);
|
||||
pushService.PushTrade();
|
||||
pushService.PushTradeUpdate();
|
||||
pushService.PushUnwind();
|
||||
pushService.PushRepealUnwind();
|
||||
}
|
||||
/// <summary>
|
||||
/// 推送客户信息相关
|
||||
/// </summary>
|
||||
public void PushClient()
|
||||
{
|
||||
SwapPushService pushService = new SwapPushService(OptUserInfo.SystemUser);
|
||||
pushService.SetKafKaProduce(kafkaProduceHelper);
|
||||
pushService.PushClient();
|
||||
pushService.PushClientBank();
|
||||
// pushService.PushClientCash();
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 重推
|
||||
/// </summary>
|
||||
/// <param name="pushLog"></param>
|
||||
public void PushSingle(PushLog pushLog)
|
||||
{
|
||||
SwapPushService pushService = new SwapPushService(OptUserInfo.SystemUser);
|
||||
pushService.SetKafKaProduce(kafkaProduceHelper);
|
||||
pushService.RePushLog( pushLog);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,296 +0,0 @@
|
||||
using BaseOUDAL;
|
||||
using MoreLinq;
|
||||
using OfficeOpenXml.FormulaParsing.ExpressionGraph;
|
||||
using Org.BouncyCastle.Ocsp;
|
||||
using Snowflake.Core;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using YLErp.DBModels;
|
||||
using YLErp.DBModels.Enums;
|
||||
using YLErp.Model;
|
||||
|
||||
namespace YLErp.Modules.SwapModule
|
||||
{
|
||||
/// <summary>
|
||||
/// 推送记录服务
|
||||
/// </summary>
|
||||
public class PushLogService: YLBaseService
|
||||
{
|
||||
public PushLogService(OptUserInfo optUser) : base(optUser)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public PushLog AddLog(long dataId,SwapPushDataEnum dataEnum,string dataNumber)
|
||||
{
|
||||
PushLog pushLog= new PushLog();
|
||||
pushLog.data_id = dataId;
|
||||
pushLog.data_type = (int)dataEnum;
|
||||
pushLog.SetCreator(UserId);
|
||||
pushLog.data_state = (int)SwapPushDataStateEnum.待推送;
|
||||
pushLog.data_number = dataNumber;
|
||||
pushLog.SetUpdator(UserId);
|
||||
if (pushLog.id==0)
|
||||
{
|
||||
var worker = new IdWorker(1, 1);
|
||||
pushLog.id = worker.NextId();
|
||||
DbContext.push_log.Add(pushLog);
|
||||
}
|
||||
pushLog.odata_no = pushLog.id.ToString();
|
||||
DbContext.SaveChanges();
|
||||
return pushLog;
|
||||
}
|
||||
/// <summary>
|
||||
/// 添加记录,当该编号下已经产生推送过的记录时
|
||||
/// </summary>
|
||||
/// <param name="dataId"></param>
|
||||
/// <param name="dataEnum"></param>
|
||||
/// <param name="dataNumber"></param>
|
||||
public void AddLogWithCheck(long dataId, SwapPushDataEnum dataEnum, string dataNumber)
|
||||
{
|
||||
var pushLogs = DbContext.push_log.Where(x=>x.data_number.StartsWith(dataNumber) && x.data_state != (int)SwapPushDataStateEnum.待推送).ToList();
|
||||
if (!pushLogs.Any())
|
||||
{
|
||||
return;
|
||||
}
|
||||
PushLog pushLog = new PushLog();
|
||||
pushLog.data_id = dataId;
|
||||
pushLog.data_type = (int)dataEnum;
|
||||
pushLog.SetCreator(UserId);
|
||||
pushLog.data_state = (int)SwapPushDataStateEnum.待推送;
|
||||
pushLog.data_number = dataNumber;
|
||||
pushLog.SetUpdator(UserId);
|
||||
if (pushLog.id == 0)
|
||||
{
|
||||
var worker = new IdWorker(1, 1);
|
||||
pushLog.id = worker.NextId();
|
||||
DbContext.push_log.Add(pushLog);
|
||||
}
|
||||
pushLog.odata_no = pushLog.id.ToString();
|
||||
DbContext.SaveChanges();
|
||||
}
|
||||
public PushLog AddLog(long dataId, SwapPushDataEnum addDataEnum, SwapPushDataEnum upDataEnum, string dataNumber)
|
||||
{
|
||||
var pushLogs = DbContext.push_log.Where(x=>x.data_id==dataId).ToList();
|
||||
var dataType= (int)addDataEnum;
|
||||
if (pushLogs.Count>0)
|
||||
{
|
||||
var addpushLog= pushLogs.FirstOrDefault(x=>x.data_type==(int)addDataEnum);
|
||||
if (addpushLog!=null)
|
||||
{
|
||||
if (addpushLog.data_state == 0)
|
||||
{
|
||||
return addpushLog;
|
||||
}
|
||||
dataType= (int)upDataEnum;
|
||||
}
|
||||
var uppushLog = pushLogs.FirstOrDefault(x => x.data_state == 0 && x.data_type == (int)upDataEnum);
|
||||
if (uppushLog!=null)
|
||||
{
|
||||
return uppushLog;
|
||||
}
|
||||
}
|
||||
var pushLog=new PushLog();
|
||||
pushLog.data_id = dataId;
|
||||
pushLog.data_type = dataType;
|
||||
pushLog.SetCreator(UserId);
|
||||
pushLog.data_state = (int)SwapPushDataStateEnum.待推送;
|
||||
pushLog.data_number = dataNumber;
|
||||
pushLog.SetUpdator(UserId);
|
||||
if (pushLog.id == 0)
|
||||
{
|
||||
var worker = new IdWorker(1, 1);
|
||||
pushLog.id = worker.NextId();
|
||||
DbContext.push_log.Add(pushLog);
|
||||
}
|
||||
pushLog.odata_no = pushLog.id.ToString();
|
||||
DbContext.SaveChanges();
|
||||
return pushLog;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重置删除log
|
||||
/// </summary>
|
||||
/// <param name="dataNumber"></param>
|
||||
public void DeleteLog(string dataNumber)
|
||||
{
|
||||
var pushLogs = DbContext.push_log.Where(x=>x.data_number.StartsWith(dataNumber)&&x.data_state== (int)SwapPushDataStateEnum.待推送);
|
||||
DbContext.push_log.RemoveRange(pushLogs);
|
||||
DbContext.SaveChanges();
|
||||
}
|
||||
public void DeleteLogWithUnwind(string dataNumber)
|
||||
{
|
||||
var pushLogs = DbContext.push_log.Where(x => x.data_number.StartsWith(dataNumber) && x.data_state == (int)SwapPushDataStateEnum.待推送&&x.data_type>=(int)SwapPushDataEnum.合约终止);
|
||||
DbContext.push_log.RemoveRange(pushLogs);
|
||||
DbContext.SaveChanges();
|
||||
}
|
||||
/// <summary>
|
||||
/// 保存kafka消费回执记录
|
||||
/// </summary>
|
||||
/// <param name="serial_no"></param>
|
||||
/// <param name="dataEnum"></param>
|
||||
/// <param name="dataStateEnum"></param>
|
||||
/// <param name="dataResp"></param>
|
||||
/// <returns></returns>
|
||||
public PushLog SaveConsumerLog(string serial_no,string extNo, SwapPushDataEnum dataEnum, SwapPushDataStateEnum dataStateEnum,string dataReq,string dealResult)
|
||||
{
|
||||
if (string.IsNullOrEmpty(serial_no))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var pushLog = GetLogBySerialNo(serial_no, (int)dataEnum);
|
||||
if (pushLog==null)
|
||||
{
|
||||
pushLog = new PushLog();
|
||||
}
|
||||
pushLog.data_type = (int)dataEnum;
|
||||
pushLog.odata_no = serial_no;
|
||||
pushLog.data_state = (int)dataStateEnum;
|
||||
pushLog.data_req = dataReq;
|
||||
pushLog.data_number = extNo;
|
||||
pushLog.data_resp = dealResult;
|
||||
pushLog.SetUpdator(UserId);
|
||||
if (pushLog.id == 0)
|
||||
{
|
||||
var worker = new IdWorker(1, 1);
|
||||
pushLog.id = worker.NextId();
|
||||
pushLog.SetCreator(UserId);
|
||||
DbContext.push_log.Add(pushLog);
|
||||
}
|
||||
DbContext.SaveChanges();
|
||||
return pushLog;
|
||||
}
|
||||
|
||||
public PushLog GetLogBySerialNo(string serial_no,int dataEnum)
|
||||
{
|
||||
var pushLog = DbContext.push_log.FirstOrDefault(x=>x.odata_no== serial_no&&x.data_type==dataEnum);
|
||||
return pushLog;
|
||||
}
|
||||
public void DeleteLog(long logId)
|
||||
{
|
||||
PushLog pushLog = DbContext.push_log.FirstOrDefault(x => x.id == logId);
|
||||
if (pushLog == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
DbContext.push_log.Remove(pushLog);
|
||||
DbContext.SaveChanges();
|
||||
}
|
||||
public void DeleteLogs(List<long> logIds)
|
||||
{
|
||||
var pushLogs = DbContext.push_log.Where(x => logIds.Contains(x.id)).ToList();
|
||||
if (pushLogs.Count() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
DbContext.push_log.RemoveRange(pushLogs);
|
||||
DbContext.SaveChanges();
|
||||
}
|
||||
public void UpdateLogReq(long logId,string req)
|
||||
{
|
||||
PushLog pushLog = DbContext.push_log.FirstOrDefault(x => x.id==logId);
|
||||
if (pushLog == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
pushLog.data_req = req;
|
||||
pushLog.data_state = (int)SwapPushDataStateEnum.推送中;
|
||||
pushLog.SetUpdator(UserId);
|
||||
DbContext.SaveChanges();
|
||||
}
|
||||
public PushLog UpdateLogResp(long logId, string resp,int dataState)
|
||||
{
|
||||
PushLog pushLog = DbContext.push_log.FirstOrDefault(x => x.id == logId);
|
||||
if (pushLog == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
pushLog.data_resp = resp;
|
||||
pushLog.data_state = dataState;
|
||||
pushLog.SetUpdator(UserId);
|
||||
DbContext.SaveChanges();
|
||||
return pushLog;
|
||||
}
|
||||
public List<PushLog> GetPushLogs(List<int> dataEnums,List<int> dataStates)
|
||||
{
|
||||
var predicate = PredicateBuilder.Create<PushLog>(x => dataEnums.Contains(x.data_type));
|
||||
if (dataStates!=null&& dataStates.Any())
|
||||
{
|
||||
predicate = predicate.And(x=> dataStates.Contains(x.data_state));
|
||||
}
|
||||
return GetPushLogs(predicate);
|
||||
}
|
||||
public List<PushLog> GetPushLogs(Expression<Func<PushLog,bool>> expression)
|
||||
{
|
||||
return DbContext.push_log.Where(expression).ToList();
|
||||
}
|
||||
public SearchListResult<PushLog> SearchList(PushLogQueryRequest req)
|
||||
{
|
||||
var predicate = PredicateBuilder.Create<PushLog>(x => true);
|
||||
if (!string.IsNullOrEmpty(req.data_number))
|
||||
{
|
||||
predicate = predicate.And(x=>x.data_number.Contains(req.data_number));
|
||||
}
|
||||
if (req.data_states!=null&& req.data_states.Count()>0)
|
||||
{
|
||||
predicate = predicate.And(x => req.data_states.Contains(x.data_state));
|
||||
}
|
||||
if (req.data_types != null && req.data_types.Count() > 0)
|
||||
{
|
||||
predicate = predicate.And(x => req.data_types.Contains(x.data_type));
|
||||
}
|
||||
if (req.OptDateStart.HasValue)
|
||||
{
|
||||
predicate = predicate.And(x => x.update_time>= req.OptDateStart);
|
||||
}
|
||||
if (req.OptDateEnd.HasValue)
|
||||
{
|
||||
req.OptDateEnd= req.OptDateEnd.Value.AddDays(1).AddSeconds(-1);
|
||||
predicate = predicate.And(x => x.update_time <= req.OptDateEnd);
|
||||
}
|
||||
var query = DbContext.push_log.Where(predicate);
|
||||
if (string.IsNullOrEmpty(req.sidx))
|
||||
{
|
||||
req.sidx = "id";
|
||||
req.sord = "desc";
|
||||
}
|
||||
return query.ToSearchList(req);
|
||||
}
|
||||
|
||||
public PushLog ReSetLog(long logId)
|
||||
{
|
||||
PushLog pushLog = DbContext.push_log.FirstOrDefault(x => x.id == logId);
|
||||
if (pushLog == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
pushLog.data_resp = null;
|
||||
pushLog.data_req = null;
|
||||
pushLog.data_state = (int)SwapPushDataStateEnum.待推送;
|
||||
pushLog.SetUpdator(UserId);
|
||||
DbContext.SaveChanges();
|
||||
return pushLog;
|
||||
}
|
||||
|
||||
public PushLog GetLogByDataId(long dataId)
|
||||
{
|
||||
return DbContext.push_log.FirstOrDefault(x => x.data_id == dataId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取日终估值最新同步时间
|
||||
/// </summary>
|
||||
/// <param name="valuedate"></param>
|
||||
/// <returns></returns>
|
||||
public string GetLastSettmentTime(DateTime valuedate)
|
||||
{
|
||||
var nextDate = valuedate.AddDays(1);
|
||||
var lastpushLog = DbContext.push_log.Where(x => x.data_type == (int)SwapPushDataEnum.日终估值获取 && x.data_state == (int)SwapPushDataStateEnum.接收处理成功 && x.create_time > valuedate&&x.create_time< nextDate).OrderByDescending(o => o.create_time).FirstOrDefault();
|
||||
return lastpushLog == null ? $"{valuedate:yyyy-MM-dd}数据未同步": lastpushLog.create_time.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -757,21 +757,6 @@ namespace YLErp.Modules.SwapModule
|
||||
td.StockEqvNotional -= Convert.ToDouble(unwindData.CloseNotionalValue);
|
||||
td.TradeAmount -= Convert.ToDouble(unwindData.CloseQty);
|
||||
DbContext.SaveChanges();
|
||||
new PushLogService(UserInfo).AddLog(eventId, SwapPushDataEnum.合约终止, td.TradeNumber);
|
||||
var positions = DbContext.swap_position.Where(x => x.IsInitial && x.SwapTradeId == unwindData.SwapTradeId && !x.Invalid);
|
||||
foreach (var f in flowList)
|
||||
{
|
||||
var position = positions.FirstOrDefault(x => x.id == f.PositionId);
|
||||
if (f.PositionType > 0)
|
||||
{
|
||||
new PushLogService(UserInfo).AddLog(f.id, SwapPushDataEnum.互换资产平仓, position.PosiNumber);
|
||||
}
|
||||
else if (f.InterestMode == (int)InterestModeEnum.初始预付金 || f.InterestMode == (int)InterestModeEnum.追加预付金)
|
||||
{
|
||||
new PushLogService(UserInfo).AddLog(f.id, SwapPushDataEnum.互换预付金平仓, position.PosiNumber);
|
||||
}
|
||||
|
||||
}
|
||||
trans.Commit();
|
||||
cofirm = true;
|
||||
}
|
||||
@@ -1058,27 +1043,6 @@ namespace YLErp.Modules.SwapModule
|
||||
td.TradeAmount -= Convert.ToDouble(unwindData.CloseQty);
|
||||
td.Notional = td.TradeAmount;
|
||||
DbContext.SaveChanges();
|
||||
if (addLog)
|
||||
{
|
||||
new PushLogService(UserInfo).AddLog(eventId, SwapPushDataEnum.合约终止, td.TradeNumber);
|
||||
var positions = DbContext.swap_position.Where(x => x.IsInitial && x.SwapTradeId == unwindData.SwapTradeId && !x.Invalid);
|
||||
foreach (var f in flowList)
|
||||
{
|
||||
var position = positions.FirstOrDefault(x => x.id == f.PositionId);
|
||||
if (position != null)
|
||||
{
|
||||
if (f.PositionType > 0)
|
||||
{
|
||||
new PushLogService(UserInfo).AddLog(f.id, SwapPushDataEnum.互换资产平仓, position.PosiNumber);
|
||||
}
|
||||
else if (f.InterestMode == (int)InterestModeEnum.初始预付金 || f.InterestMode == (int)InterestModeEnum.追加预付金)
|
||||
{
|
||||
new PushLogService(UserInfo).AddLog(f.id, SwapPushDataEnum.互换预付金平仓, position.PosiNumber);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 计算平仓总额
|
||||
@@ -1281,21 +1245,7 @@ namespace YLErp.Modules.SwapModule
|
||||
td.TradeAmount -= Convert.ToDouble(swapEvent.unwindData.CloseQty);
|
||||
}
|
||||
td.StockEqvNotional -= Convert.ToDouble(swapEvent.unwindData.CloseNotionalValue);
|
||||
new PushLogService(UserInfo).AddLog(swapEvent.id, SwapPushDataEnum.合约终止, td.TradeNumber);
|
||||
var positions = DbContext.swap_position.Where(x => x.IsInitial && x.SwapTradeId == td.id && !x.Invalid);
|
||||
foreach (var f in flowList)
|
||||
{
|
||||
var position = positions.FirstOrDefault(x => x.id == f.PositionId);
|
||||
if (f.PositionType > 0)
|
||||
{
|
||||
new PushLogService(UserInfo).AddLog(f.id, SwapPushDataEnum.互换资产平仓, position.PosiNumber);
|
||||
}
|
||||
else if (f.InterestMode == (int)InterestModeEnum.初始预付金 || f.InterestMode == (int)InterestModeEnum.追加预付金)
|
||||
{
|
||||
new PushLogService(UserInfo).AddLog(f.id, SwapPushDataEnum.互换预付金平仓, position.PosiNumber);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
td.UnWindDate = swapEvent.unwindData.UnwindDate;
|
||||
UpdateInitalPosition(flowList, swapEvent.unwindData, eventType);
|
||||
|
||||
@@ -528,7 +528,7 @@ namespace YLErp.Modules.SwapModule
|
||||
decimal allPosiNotionalValue = 0;
|
||||
decimal longNotionalValue = realPositions.Where(s => s.PositionType == (int)PositionTypeFlag.Long).Sum(s => s.PosiNotionalValue);//剩余多头名义本金规模
|
||||
decimal shortNotionalValue = realPositions.Where(s => s.PositionType == (int)PositionTypeFlag.Short).Sum(s => s.PosiNotionalValue);//剩余空头名义本金规模
|
||||
PushLogService pushService = new PushLogService(UserInfo);
|
||||
|
||||
foreach (var eventGroup in eventQuery.GroupBy(g => g.PositionId))//持仓标的腿合成持仓
|
||||
{
|
||||
var eventList = eventGroup.ToList();
|
||||
@@ -603,18 +603,6 @@ namespace YLErp.Modules.SwapModule
|
||||
dividendIn = dividendIn + x.DividendIn;
|
||||
|
||||
x.DataState = (int)SwapFlowDateStateEnum.完成;
|
||||
if (ratio > 0)
|
||||
{
|
||||
if (fposition == null)
|
||||
{
|
||||
pushService.AddLog(position.id, swapInsertEnum, position.PosiNumber);
|
||||
}
|
||||
pushService.AddLog(position.id, swapPosiEnum, position.PosiNumber + "-01");
|
||||
}
|
||||
else
|
||||
{
|
||||
pushService.AddLog(x.id, SwapPushDataEnum.互换资产平仓, position.PosiNumber);
|
||||
}
|
||||
});
|
||||
tdCloseQty += closeQty;
|
||||
if (eventFlow.EventType == 1)//最后一条是开仓
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -138,22 +138,6 @@ namespace YLErp.Modules.SwapModule
|
||||
var positions = DbContext.swap_position.Where(x => x.SwapTradeId == td.id && x.IsInitial && !x.Invalid).ToList();
|
||||
td.swap_positions = positions.Where(x => marginModes.Contains(x.InterestMode)).ToList();
|
||||
var posiPositions = positions.Where(x => x.PosiDirection > 0).ToList();
|
||||
var pushLogService = new PushLogService(UserInfo);
|
||||
pushLogService.AddLog(td.id, SwapPushDataEnum.收益互换交易新增, SwapPushDataEnum.收益互换交易修改, td.TradeNumber);
|
||||
if (posiPositions.Any())
|
||||
{
|
||||
foreach (var position in posiPositions)
|
||||
{
|
||||
pushLogService.AddLog(position.id, SwapPushDataEnum.互换资产交易新增, SwapPushDataEnum.互换资产交易修改, position.PosiNumber);
|
||||
}
|
||||
}
|
||||
if (td.swap_positions.Any())
|
||||
{
|
||||
foreach (var position in td.swap_positions)
|
||||
{
|
||||
pushLogService.AddLog(position.id, SwapPushDataEnum.预付金交易新增, SwapPushDataEnum.预付金交易修改, position.PosiNumber);
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 校验 定义文件型债券收益互换 持仓标的只能存在一笔
|
||||
@@ -216,25 +200,7 @@ namespace YLErp.Modules.SwapModule
|
||||
DeleteTradeDetials(id);
|
||||
DeleteTradeCashInCashOut(id);
|
||||
DbContext.SaveChanges();
|
||||
if (addLog)
|
||||
{
|
||||
var pushService = new PushLogService(UserInfo);
|
||||
pushService.DeleteLog(tradeNumber);
|
||||
if (dbTrade.StructureType == "多空组合")
|
||||
{
|
||||
var swapPosiList = DbContext.swap_position.Where(x => x.IsInitial && x.SwapTradeId == id && !x.Invalid).AsNoTracking().ToList();
|
||||
var posiList = swapPosiList.Where(x => x.PosiDirection > 0 || x.InterestMode == (int)InterestModeEnum.固定值).ToList();
|
||||
foreach (var item in posiList)
|
||||
{
|
||||
pushService.AddLogWithCheck(item.id, SwapPushDataEnum.合约撤单, item.PosiNumber);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pushService.AddLogWithCheck(dbTrade.id, SwapPushDataEnum.合约撤单, tradeNumber);
|
||||
}
|
||||
}
|
||||
// new SwapFlowService(this).DeleteSwapFlow(id, dbTrade.TradeDate.Value, false);
|
||||
|
||||
}
|
||||
private void DeleteTradeDetials(int tradeId)
|
||||
{
|
||||
@@ -1648,7 +1614,6 @@ namespace YLErp.Modules.SwapModule
|
||||
{
|
||||
DeleteTradeCashInCashOut(tradeId);
|
||||
DeleteTradeDetials(tradeId);
|
||||
new PushLogService(UserInfo).DeleteLogWithUnwind(td.TradeNumber);
|
||||
DbContext.SaveChanges();
|
||||
if (del)
|
||||
{
|
||||
@@ -1661,10 +1626,8 @@ namespace YLErp.Modules.SwapModule
|
||||
var tradeNumber = td.TradeNumber;
|
||||
td.TradeNumber = td.TradeNumber.Insert(0, "XX");
|
||||
td.OptDate = OptDate;
|
||||
new PushLogService(UserInfo).DeleteLog(tradeNumber);
|
||||
swapEventService.AddSwapEventDate(valueDate, tradeId, (int)SwapEventTypeEnum.删除, string.Empty, 0, false);
|
||||
DbContext.SaveChanges();
|
||||
new PushLogService(UserInfo).AddLogWithCheck(td.id, SwapPushDataEnum.合约撤单, tradeNumber);
|
||||
trans.Commit();
|
||||
return;
|
||||
}
|
||||
@@ -1772,7 +1735,7 @@ namespace YLErp.Modules.SwapModule
|
||||
var eodSwapPositionList = DbContext.eod_swap_position.Where(x => x.ValueDate == preDay && x.SwapTradeId == td.id).ToList();
|
||||
var swapFlowEvents = DbContext.swap_flow_event.Where(x => x.SwapTradeId == td.id && x.EventDate >= valueDate && x.DataState > (int)SwapFlowDateStateEnum.废弃).ToList();
|
||||
var positions = swapPositions.Where(x => x.PosiDirection > 0 && !x.IsInitial).ToList();
|
||||
var pushService = new PushLogService(UserInfo);
|
||||
|
||||
foreach (var posi in positions)
|
||||
{
|
||||
var eodPosi = eodSwapPositionList.FirstOrDefault(x => x.PositionId == posi.PositionId);
|
||||
@@ -1814,14 +1777,10 @@ namespace YLErp.Modules.SwapModule
|
||||
{
|
||||
var positions = swapPositions.Where(x => !x.IsInitial || x.InterestDirection == 0).ToList();
|
||||
var orignPositions = swapPositions.Where(x => x.IsInitial && x.InterestDirection > 0).ToList();
|
||||
var pushService = new PushLogService(UserInfo);
|
||||
|
||||
foreach (var item in positions)
|
||||
{
|
||||
item.Invalid = true;
|
||||
if ((item.PosiDirection > 0 || item.InterestMode == (int)InterestModeEnum.固定值) && item.IsInitial)
|
||||
{
|
||||
pushService.AddLog(item.id, SwapPushDataEnum.合约撤单, item.PosiNumber);
|
||||
}
|
||||
}
|
||||
//DbContext.swap_position.RemoveRange(positions);
|
||||
foreach (var item in orignPositions)
|
||||
|
||||
Reference in New Issue
Block a user