|
|
@@ -10,28 +10,35 @@ import (
|
|
|
"fmt"
|
|
|
"mtp2_if/db"
|
|
|
"mtp2_if/logger"
|
|
|
+ "mtp2_if/mtpcache"
|
|
|
)
|
|
|
|
|
|
// ErmcpHedgePlan 套保计划表结构
|
|
|
type ErmcpHedgePlan struct {
|
|
|
- Areauserid int64 `json:"areauserid" xorm:"'Areauserid'"` //用户ID
|
|
|
- Hedgeplanid string `json:"hedgeplanid" xorm:"'Hedgeplanid'"` //套保计划ID(601+Unix秒时间戳(10位)+xxxxxx)
|
|
|
- Hedgeplanno string `json:"hedgeplanno" xorm:"'Hedgeplanno'"` //套保计划编号(名称)
|
|
|
- Contracttype int `json:"contracttype" xorm:"'Contracttype'"` //计划类型 - 1:采购 -1:销售
|
|
|
- Deliverygoodsid int `json:"deliverygoodsid" xorm:"'Deliverygoodsid'"` //现货品种ID
|
|
|
- Deliverygoodsname string `json:"deliverygoodsname" xorm:"'Deliverygoodsname'"` //现货品种名称
|
|
|
- Wrstandardid int `json:"wrstandardid" xorm:"'Wrstandardid'"` //现货商品ID
|
|
|
+ Areauserid int64 `json:"areauserid" xorm:"'Areauserid'"` // 用户ID
|
|
|
+ Hedgeplanid string `json:"hedgeplanid" xorm:"'Hedgeplanid'"` // 套保计划ID(601+Unix秒时间戳(10位)+xxxxxx)
|
|
|
+ Hedgeplanno string `json:"hedgeplanno" xorm:"'Hedgeplanno'"` // 套保计划编号(名称)
|
|
|
+ Contracttype int `json:"contracttype" xorm:"'Contracttype'"` // 计划类型 - 1:采购 -1:销售
|
|
|
+ Deliverygoodsid int `json:"deliverygoodsid" xorm:"'Deliverygoodsid'"` // 现货品种ID
|
|
|
+ Deliverygoodsname string `json:"deliverygoodsname" xorm:"'Deliverygoodsname'"` // 现货品种名称
|
|
|
+ Wrstandardid int `json:"wrstandardid" xorm:"'Wrstandardid'"` // 现货商品ID
|
|
|
Wrstandardname string `json:"wrstandardname" xorm:"'Wrstandardname'"` // 现货商品名称
|
|
|
- Producttype int `json:"producttype" xorm:"'Producttype'"` //产品类型 - 1:标准仓单 2:等标 3:非标
|
|
|
- Spotgoodsdesc string `json:"spotgoodsdesc" xorm:"'Spotgoodsdesc'"` //商品型号
|
|
|
- Planqty float64 `json:"planqty" xorm:"'Planqty'"` //计划数量
|
|
|
- Convertfactor float64 `json:"convertfactor" xorm:"'Convertfactor'"` //标仓系数
|
|
|
- Plantime string `json:"plantime" xorm:"'Plantime'"` //计划时间
|
|
|
- Hedgeplanstatus int `json:"hedgeplanstatus" xorm:"'Hedgeplanstatus'"` //套保计划状态 - 0:未提交 1:待审核 2:执行中 3:正常完结 4:审核拒绝 5:异常完结 6:已撤回
|
|
|
- Remark string `json:"remark" xorm:"'Remark'"` //备注
|
|
|
- CREATETIME string `json:"createtime" xorm:"'CREATETIME'"` //创建时间
|
|
|
- UPDATETIME string `json:"updatetime" xorm:"'UPDATETIME'"` //更新时间
|
|
|
- AUDITTIME string `json:"audittime" xorm:"'AUDITTIME'"` //审核时间
|
|
|
+ Producttype int `json:"producttype" xorm:"'Producttype'"` // 产品类型 - 1:标准仓单 2:等标 3:非标
|
|
|
+ Spotgoodsdesc string `json:"spotgoodsdesc" xorm:"'Spotgoodsdesc'"` // 商品型号
|
|
|
+ Planqty float64 `json:"planqty" xorm:"'Planqty'"` // 计划数量
|
|
|
+ Convertfactor float64 `json:"convertfactor" xorm:"'Convertfactor'"` // 标仓系数
|
|
|
+ Plantime string `json:"plantime" xorm:"'Plantime'"` // 计划时间
|
|
|
+ Hedgeplanstatus int `json:"hedgeplanstatus" xorm:"'Hedgeplanstatus'"` // 套保计划状态 - 0:未提交 1:待审核 2:执行中 3:正常完结 4:审核拒绝 5:异常完结 6:已撤回
|
|
|
+ Remark string `json:"remark" xorm:"'Remark'"` // 备注
|
|
|
+ CREATETIME string `json:"createtime" xorm:"'CREATETIME'"` // 创建时间
|
|
|
+ UPDATETIME string `json:"updatetime" xorm:"'UPDATETIME'"` // 更新时间
|
|
|
+ AUDITTIME string `json:"audittime" xorm:"'AUDITTIME'"` // 审核时间
|
|
|
+ UNITID int32 `json:"unitid" xorm:"'UNITID'"` // 单位id
|
|
|
+ ENUMDICNAME string `json:"enumdicname"` // 单位名称
|
|
|
+}
|
|
|
+
|
|
|
+func (r *ErmcpHedgePlan) calc() {
|
|
|
+ r.ENUMDICNAME = mtpcache.GetEnumDicitemName(r.UNITID)
|
|
|
}
|
|
|
|
|
|
func (r *ErmcpHedgePlan) buildSql(status string) string {
|
|
|
@@ -42,6 +49,7 @@ func (r *ErmcpHedgePlan) buildSql(status string) string {
|
|
|
" t.g.Deliverygoodsname," +
|
|
|
" t.Wrstandardid," +
|
|
|
" w.Wrstandardname," +
|
|
|
+ " w.unitid," +
|
|
|
" t.Producttype," +
|
|
|
" t.Spotgoodsdesc," +
|
|
|
" t.Planqty," +
|
|
|
@@ -77,6 +85,9 @@ func (r *ErmcpHedgePlan) GetData(status string) ([]ErmcpHedgePlan, error) {
|
|
|
logger.GetLogger().Errorf("query hedgeplan:%v", err)
|
|
|
return sData, err
|
|
|
}
|
|
|
+ for i := range sData {
|
|
|
+ sData[i].calc()
|
|
|
+ }
|
|
|
|
|
|
return sData, nil
|
|
|
}
|