h2. 现状和问题
* 开发模式下一交易日交易都需要柜员端介入结算和应用
h2. 方案
* settlement/app.config中加入自动结算&应用相关配置
* 通过ecron将settlement中结算和应用的操作接口加入定时运行列表
* 通过ecron将系统初始化加入到定时运行列表
h2. 实现
* 将ecorn加入settlement的deps
* 修改app.config,加入以下配置
<pre>
{settlement, [
{enable_auto_settle, no}, %% yes | no
{enable_auto_init, no}
]},
{ecron, [{scheduled,
[
{{{ '*', '*', '*'}, {0 ,0,0}}, {settlement_bot, settle, []}},
{{{ '*', '*', '*'}, {0 ,0,0}}, {settlement_bot, apply, []}},
{{{ '*', '*', '*'}, {0 ,0,0}}, {settlement_bot, sys_init, []}}
]}]
}
</pre>
* settlement中结算和应用的接口为
<pre>
handle_cast({?SETTLE, ReqId, #access{uid = AId}, UIds, CapitalType, TradingDay}, State)
handle_cast({?APPLY_SETTLE, ReqId, #access{uid = AId}, UIds, CapitalType, TradingDay}, State)
</pre>
* 新增settlement_boot模块,其中的settle和apply接口
先读取app.config中settlement的is_auto参数,yes则调用结算/应用接口, no则不调用.
h2. 资料
* https://github.com/esl/ecron
* 开发模式下一交易日交易都需要柜员端介入结算和应用
h2. 方案
* settlement/app.config中加入自动结算&应用相关配置
* 通过ecron将settlement中结算和应用的操作接口加入定时运行列表
* 通过ecron将系统初始化加入到定时运行列表
h2. 实现
* 将ecorn加入settlement的deps
* 修改app.config,加入以下配置
<pre>
{settlement, [
{enable_auto_settle, no}, %% yes | no
{enable_auto_init, no}
]},
{ecron, [{scheduled,
[
{{{ '*', '*', '*'}, {0 ,0,0}}, {settlement_bot, settle, []}},
{{{ '*', '*', '*'}, {0 ,0,0}}, {settlement_bot, apply, []}},
{{{ '*', '*', '*'}, {0 ,0,0}}, {settlement_bot, sys_init, []}}
]}]
}
</pre>
* settlement中结算和应用的接口为
<pre>
handle_cast({?SETTLE, ReqId, #access{uid = AId}, UIds, CapitalType, TradingDay}, State)
handle_cast({?APPLY_SETTLE, ReqId, #access{uid = AId}, UIds, CapitalType, TradingDay}, State)
</pre>
* 新增settlement_boot模块,其中的settle和apply接口
先读取app.config中settlement的is_auto参数,yes则调用结算/应用接口, no则不调用.
h2. 资料
* https://github.com/esl/ecron