调仓购买逻辑图

待确认 最高前提:赎回金额已全部到账
(需跟盈米确认是否有时间可判断)
@startuml
:(isOpen == 1) && (buyCount>0 && isBuy==0) && (saleCount == 0 || (saleCount>0 && isSale==1));
:生成陶陶调仓购买订单taotao_trade,以及根据t_asset_rebalance
生成子订单fund_trade_order和ym_trade_order;
if (是否单边购买) then (yes)
if (银行卡购买) then(yes)
:银行卡扣款,充值到盈米宝;
endif
:通过盈米宝执行购买;
else (no)
:判断余额是否足够;
if (余额充足) then (yes)
else (no)
:isOpen = 0;
:t_asset_portfolio 调仓状态修改 rebalanceStatus=0;
:调用今日投资statusWriteback接口,rebalanceStatus = 0;
:t_taotao_trade status = 1;
:fund_trade_order,ym_trade_order,t_asset_rebalance
修改为购买失败;
:添加t_fund_order_status失败状态;
:发送调仓购买失败短信;
end
endifendif
:做批量购买操作
生成BuyFundRequest
购买基金;
split
:购买基金A;
:购买成功;
:修改fund_trade_order和ym_trade_order状态,
新增fund_trade_order_status;
:修改t_asset_rebalance状态为2;
split again
:购买基金B;
:购买失败;
:修改fund_trade_order和ym_trade_order状态,
新增fund_trade_order_status;
:修改t_asset_rebalance状态为3;
split again
:购买基金...;
endsplit
if (全部购买申请成功) then (yes)
:t_taotao_change_plan status=21(购买申请成功), isOpen=0;
:t_taotao_trade status = 2(处理中);
else (no)
if (所以子订单中包含1129订单) then (yes)
:t_taotao_trade status = 2;
else (no)
if (全部失败) then (yes)
:t_taotao_change_plan
status=22(购买申请全部失败);
:t_taotao_trade status = 1;
:t_asset_portfolio rebalanceStatus=0;
:通知今日投资持仓数据,根据portfolio_fund表持仓回写;
:发送短信;
else (no)
:t_taotao_change_plan
status=23(购买申请部分失败);
:t_taotao_trade status = 2;
endif
endifendif
:isBuy=1;
:isOpen=0;
end
@enduml