|
|
@@ -2693,3 +2693,67 @@ func (r *Ermcp3ExposureFutuDetail) GetDataEx() (interface{}, error) {
|
|
|
}
|
|
|
return sData, nil
|
|
|
}
|
|
|
+
|
|
|
+// Ermcp3ExposureParamChLog 敞口报表参数调整明细
|
|
|
+type Ermcp3ExposureParamChLog struct {
|
|
|
+ LOGID string `json:"logid" xorm:"LOGID"` // 流水ID(609+Unix秒时间戳(10位)+xxxxxx)
|
|
|
+ MIDDLEGOODSID int64 `json:"middlegoodsid" xorm:"MIDDLEGOODSID"` // 套保品种
|
|
|
+ AREAUSERID int64 `json:"areauserid" xorm:"AREAUSERID"` // 所属机构\交易用户ID
|
|
|
+ ACCOUNTID int64 `json:"accountid" xorm:"ACCOUNTID"` // 期货账户ID (作废, 默认为0)
|
|
|
+ CHANGELOGTYPE int32 `json:"changelogtype" xorm:"CHANGELOGTYPE"` // 变更流水类型 - 1:套保比率变更 2:套利比率变更
|
|
|
+ PARAMBEFOREVALUE float64 `json:"parambeforevalue" xorm:"PARAMBEFOREVALUE"` // 参数变更前(调整前参数值)
|
|
|
+ PARAMAFTERVALUE float64 `json:"paramaftervalue" xorm:"PARAMAFTERVALUE"` // 参数变更后(调整后参数值)
|
|
|
+ CURVALUE float64 `json:"curvalue" xorm:"CURVALUE"` // 当前套保\套利量(套保总量|套利总量)
|
|
|
+ BEFOREVALUE float64 `json:"beforevalue" xorm:"BEFOREVALUE"` // 应套保\套利量变更前(调整前应套保总量)
|
|
|
+ AFTERVALUE float64 `json:"aftervalue" xorm:"AFTERVALUE"` // 应套保\套利量变更后(调整后应套保总量)
|
|
|
+ LOGDATETIME string `json:"logdatetime" xorm:"LOGDATETIME"` // 流水日期
|
|
|
+ TRADEDATE string `json:"tradedate" xorm:"TRADEDATE"` // 交易日(yyyyMMdd)
|
|
|
+ MIDDLEGOODSCODE string `json:"middlegoodscode"` // 套保品种代码
|
|
|
+ MIDDLEGOODSNAME string `json:"middlegoodsname"` // 套保品种名称
|
|
|
+
|
|
|
+ DiffValue float64 `json:"diffvalue"` // 应套保总量变化量
|
|
|
+ BeginDate string `json:"begindate"` // 开始交易日
|
|
|
+ EndDate string `json:"enddate"` // 结束交易日
|
|
|
+}
|
|
|
+
|
|
|
+func (r *Ermcp3ExposureParamChLog) calc() {
|
|
|
+ r.DiffValue = r.AFTERVALUE - r.BEFOREVALUE
|
|
|
+}
|
|
|
+
|
|
|
+func (r *Ermcp3ExposureParamChLog) buildSql() string {
|
|
|
+ var sqlId utils.SQLVal = "SELECT t.LOGID," +
|
|
|
+ " t.MIDDLEGOODSID," +
|
|
|
+ " t.AREAUSERID," +
|
|
|
+ " t.ACCOUNTID," +
|
|
|
+ " t.CHANGELOGTYPE," +
|
|
|
+ " t.PARAMBEFOREVALUE," +
|
|
|
+ " t.PARAMAFTERVALUE," +
|
|
|
+ " t.CURVALUE," +
|
|
|
+ " t.BEFOREVALUE," +
|
|
|
+ " t.AFTERVALUE," +
|
|
|
+ " to_char(t.LOGDATETIME, 'yyyy-mm-dd hh24:mi:ss') LOGDATETIME," +
|
|
|
+ " t.TRADEDATE," +
|
|
|
+ " g.middlegoodscode," +
|
|
|
+ " g.middlegoodsname" +
|
|
|
+ " FROM ERMCP_EXPOSUREPARAMCHGLOG t" +
|
|
|
+ " LEFT JOIN ERMS_MIDDLEGOODS g on t.middlegoodsid=g.middlegoodsid" +
|
|
|
+ " WHERE 1 = 1"
|
|
|
+ sqlId.And("t.AREAUSERID", r.AREAUSERID)
|
|
|
+ sqlId.AndEx("t.TRADEDATE", r.TRADEDATE, len(r.TRADEDATE) > 0)
|
|
|
+ if len(r.BeginDate) > 0 && len(r.EndDate) > 0 {
|
|
|
+ sqlId.Join(fmt.Sprintf(" and t.TRADEDATE >= '%v' and t.TRADEDATE <= '%v' ", r.BeginDate, r.EndDate))
|
|
|
+ }
|
|
|
+ return sqlId.String()
|
|
|
+}
|
|
|
+
|
|
|
+// GetDataEx 获取敞口报表参数调整明细
|
|
|
+func (r *Ermcp3ExposureParamChLog) GetDataEx() (interface{}, error) {
|
|
|
+ sData := make([]Ermcp3ExposureParamChLog, 0)
|
|
|
+ err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
|
|
|
+ for i := range sData {
|
|
|
+ sData[i].calc()
|
|
|
+ sData[i].BeginDate = r.BeginDate
|
|
|
+ sData[i].EndDate = r.EndDate
|
|
|
+ }
|
|
|
+ return sData, err
|
|
|
+}
|