浏览代码

1.期货报表增加套保品种字段

zou.yingbin 4 年之前
父节点
当前提交
f29b21c78b
共有 4 个文件被更改,包括 63 次插入6 次删除
  1. 12 0
      docs/docs.go
  2. 12 0
      docs/swagger.json
  3. 9 0
      docs/swagger.yaml
  4. 30 6
      models/ermcp3Report.go

+ 12 - 0
docs/docs.go

@@ -18871,10 +18871,22 @@ var doc = `{
                     "description": "最新价",
                     "type": "number"
                 },
+                "middlegoodsid": {
+                    "description": "套保品种id",
+                    "type": "integer"
+                },
+                "middlegoodsname": {
+                    "description": "套保商品名称",
+                    "type": "string"
+                },
                 "middlegoodsqty": {
                     "description": "套保品种期末量 (=交易品种期末量 * 期货品种折算系数)",
                     "type": "number"
                 },
+                "middlgoodscode": {
+                    "description": "套保商品代码",
+                    "type": "string"
+                },
                 "openamount": {
                     "description": "期末开仓额",
                     "type": "number"

+ 12 - 0
docs/swagger.json

@@ -18855,10 +18855,22 @@
                     "description": "最新价",
                     "type": "number"
                 },
+                "middlegoodsid": {
+                    "description": "套保品种id",
+                    "type": "integer"
+                },
+                "middlegoodsname": {
+                    "description": "套保商品名称",
+                    "type": "string"
+                },
                 "middlegoodsqty": {
                     "description": "套保品种期末量 (=交易品种期末量 * 期货品种折算系数)",
                     "type": "number"
                 },
+                "middlgoodscode": {
+                    "description": "套保商品代码",
+                    "type": "string"
+                },
                 "openamount": {
                     "description": "期末开仓额",
                     "type": "number"

+ 9 - 0
docs/swagger.yaml

@@ -5364,9 +5364,18 @@ definitions:
       lastprice:
         description: 最新价
         type: number
+      middlegoodsid:
+        description: 套保品种id
+        type: integer
+      middlegoodsname:
+        description: 套保商品名称
+        type: string
       middlegoodsqty:
         description: 套保品种期末量 (=交易品种期末量 * 期货品种折算系数)
         type: number
+      middlgoodscode:
+        description: 套保商品代码
+        type: string
       openamount:
         description: 期末开仓额
         type: number

+ 30 - 6
models/ermcp3Report.go

@@ -1953,6 +1953,9 @@ type Ermcp3TaFutuReDataReport struct {
 	GOODSNAME              string  `json:"goodsname"  xorm:"'GOODSNAME'"`                         // 交易合约名称
 	GOODUNITID             int32   `json:"goodunitid"  xorm:"'GOODUNITID'"`                       // 交易合约单位id
 	ACCOUNTNAME            string  `json:"accountname"  xorm:"'ACCOUNTNAME'"`                     // 交易账号名称
+	MIDDLEGOODSID          int32   `json:"middlegoodsid"  xorm:"'MIDDLEGOODSID'"`                 // 套保品种id
+	MIDDLEGOODSNAME        string  `json:"middlegoodsname"  xorm:"'MIDDLEGOODSNAME'"`             // 套保商品名称
+	MIDDLEGOODSCODE        string  `json:"middlgoodscode"  xorm:"'MIDDLEGOODSCODE'"`              // 套保商品代码
 
 	OPENAVGPRICE  float64 `json:"openavgprice"`  // 开仓均价
 	CLOSEAVGPRICE float64 `json:"closeavgprice"` // 平仓均价
@@ -2006,13 +2009,17 @@ func (r *Ermcp3TaFutuReDataReport) buildSqlReckon(userType int32) string {
 		"       gp.goodsgroupname," +
 		"       g.goodscode," +
 		"       g.goodsname," +
-		"       g.goodunitid" +
+		"       g.goodunitid," +
+		"       mg.middlegoodsid," +
+		"       mg.middlegoodscode," +
+		"       mg.middlegoodsname" +
 		"  from (SELECT t.RECKONDATE," +
 		"               t.GOODSID," +
 		"               t.BUYORSELL," +
 		"               t.CURRENCYID," +
 		"               t.%v USERID," +
 		"               t.GOODSGROUPID," +
+		"               t.middlegoodsid," +
 		"               sum(t.ORIHOLDQTY) ORIHOLDQTY," +
 		"               sum(t.ORIOPENAMOUNT) ORIOPENAMOUNT," +
 		"               sum(t.ORIHOLDAMOUNT) ORIHOLDAMOUNT," +
@@ -2043,11 +2050,14 @@ func (r *Ermcp3TaFutuReDataReport) buildSqlReckon(userType int32) string {
 		"                  t.BUYORSELL," +
 		"                  t.CURRENCYID," +
 		"                  t.%v," +
+		"                  t.middlegoodsid," +
 		"                  t.GOODSGROUPID) a" +
 		"  left join goodsgroup gp" +
 		"    on a.goodsgroupid = gp.goodsgroupid" +
 		"  left join goods g" +
-		"    on a.goodsid = g.goodsid"
+		"    on a.goodsid = g.goodsid" +
+		"  left join erms_middlegoods mg on a.middlegoodsid=mg.middlegoodsid"
+
 	userId := "USERID"
 	var sqlParam utils.SQLVal
 	if userType == 2 {
@@ -2073,7 +2083,10 @@ func (r *Ermcp3TaFutuReDataReport) buildSqlReckonDetail(userType int32) string {
 		"       g.goodscode," +
 		"       g.goodsname," +
 		"       g.goodunitid," +
-		"       ta.accountname" +
+		"       ta.accountname," +
+		"       mg.middlegoodsid," +
+		"       mg.middlegoodscode," +
+		"       mg.middlegoodsname" +
 		"  from (SELECT t.reckondate," +
 		"               t.GOODSID," +
 		"               t.BUYORSELL," +
@@ -2081,6 +2094,7 @@ func (r *Ermcp3TaFutuReDataReport) buildSqlReckonDetail(userType int32) string {
 		"               t.%v USERID," +
 		"               t.accountid," +
 		"               t.GOODSGROUPID," +
+		"               t.middlegoodsid," +
 		"               sum(t.ORIHOLDQTY) ORIHOLDQTY," +
 		"               sum(t.ORIOPENAMOUNT) ORIOPENAMOUNT," +
 		"               sum(t.ORIHOLDAMOUNT) ORIHOLDAMOUNT," +
@@ -2112,12 +2126,15 @@ func (r *Ermcp3TaFutuReDataReport) buildSqlReckonDetail(userType int32) string {
 		"                  t.CURRENCYID," +
 		"                  t.%v," +
 		"                  t.accountid," +
+		"                  t.middlegoodsid," +
 		"                  t.GOODSGROUPID) a" +
 		"  left join goodsgroup gp" +
 		"    on a.goodsgroupid = gp.goodsgroupid" +
 		"  left join goods g" +
 		"    on a.goodsid = g.goodsid" +
-		"  left join taaccount ta on a.accountid = ta.accountid"
+		"  left join taaccount ta on a.accountid = ta.accountid" +
+		"  left join erms_middlegoods mg on a.middlegoodsid=mg.middlegoodsid"
+
 	userId := "USERID"
 	var sqlParam utils.SQLVal
 	if userType == 2 {
@@ -2147,7 +2164,10 @@ func (r *Ermcp3TaFutuReDataReport) buildSqlReport(userType int32) string {
 		"       gp.goodsgroupname," +
 		"       g.goodscode," +
 		"       g.goodsname," +
-		"       g.goodunitid" +
+		"       g.goodunitid," +
+		"       mg.middlegoodsid," +
+		"       mg.middlegoodscode," +
+		"       mg.middlegoodsname" +
 		"  from (SELECT t.cycletype," +
 		"               t.cycletime," +
 		"               t.GOODSID," +
@@ -2155,6 +2175,7 @@ func (r *Ermcp3TaFutuReDataReport) buildSqlReport(userType int32) string {
 		"               t.CURRENCYID," +
 		"               t.%v USERID," +
 		"               t.GOODSGROUPID," +
+		"               t.middlegoodsid," +
 		"               sum(t.ORIHOLDQTY) ORIHOLDQTY," +
 		"               sum(t.ORIOPENAMOUNT) ORIOPENAMOUNT," +
 		"               sum(t.ORIHOLDAMOUNT) ORIHOLDAMOUNT," +
@@ -2186,11 +2207,14 @@ func (r *Ermcp3TaFutuReDataReport) buildSqlReport(userType int32) string {
 		"                  t.BUYORSELL," +
 		"                  t.CURRENCYID," +
 		"                  t.%v," +
+		"                  t.middlegoodsid," +
 		"                  t.GOODSGROUPID) a" +
 		"  left join goodsgroup gp" +
 		"    on a.goodsgroupid = gp.goodsgroupid" +
 		"  left join goods g" +
-		"    on a.goodsid = g.goodsid"
+		"    on a.goodsid = g.goodsid" +
+		"  left join erms_middlegoods mg on a.middlegoodsid=mg.middlegoodsid"
+
 	userId := "USERID"
 	var sqlParam utils.SQLVal
 	if userType == 2 {