Преглед изворни кода

增加查询产能预售我的出价信息接口

Simon Zhou пре 5 година
родитељ
комит
633df35492
6 измењених фајлова са 606 додато и 13 уклоњено
  1. 136 13
      controllers/cptrade/cpTrade.go
  2. 126 0
      docs/docs.go
  3. 126 0
      docs/swagger.json
  4. 89 0
      docs/swagger.yaml
  5. 126 0
      models/tradeModels.go
  6. 3 0
      routers/router.go

+ 136 - 13
controllers/cptrade/cpTrade.go

@@ -48,9 +48,9 @@ type Cptradepresaleapply struct {
 }
 
 // TableName is
-func (Cptradepresaleapply) TableName() string {
-	return "CPTRADE_PRESALEAPPLY"
-}
+// func (Cptradepresaleapply) TableName() string {
+// 	return "CPTRADE_PRESALEAPPLY"
+// }
 
 // QueryPreasleApply 查询产能预售申请信息
 // @Summary 查询产能预售申请信息
@@ -161,9 +161,9 @@ type Cptradeusergoodsdata struct {
 }
 
 // TableName is CPTRADE_USERGOODSDATA
-func (Cptradeusergoodsdata) TableName() string {
-	return "CPTRADE_USERGOODSDATA"
-}
+// func (Cptradeusergoodsdata) TableName() string {
+// 	return "CPTRADE_USERGOODSDATA"
+// }
 
 // QueryUserGoodsData 查询远期订单信息
 // @Summary 查询远期订单信息
@@ -254,9 +254,9 @@ type Cptradepositioncancel struct {
 }
 
 // TableName is CPTRADE_POSITIONCANCEL
-func (Cptradepositioncancel) TableName() string {
-	return "CPTRADE_POSITIONCANCEL"
-}
+// func (Cptradepositioncancel) TableName() string {
+// 	return "CPTRADE_POSITIONCANCEL"
+// }
 
 // QueryPositionCancel 查询远期订单注销申请信息
 // @Summary 查询远期订单注销申请信息
@@ -354,12 +354,14 @@ type Cptradepresalegoodsex struct {
 	Presaledamount  float64   `json:"presaledamount"  xorm:"'PRESALEDAMOUNT'"`      // 已预售总金额(预售结束时更新)
 	Goodsdetail     string    `json:"goodsdetail"  xorm:"'GOODSDETAIL'"`            // 详情[大宗]
 	Tradeprice      float64   `json:"tradeprice"  xorm:"'TRADEPRICE'"`              // 成交价[大宗]
+
+	Goodunit string `json:"goodunit" xorm:"'GOODUNIT'"` // 报价单位
 }
 
 // TableName is CPTRADE_PRESALEGOODSEX
-func (Cptradepresalegoodsex) TableName() string {
-	return "CPTRADE_PRESALEGOODSEX"
-}
+// func (Cptradepresalegoodsex) TableName() string {
+// 	return "CPTRADE_PRESALEGOODSEX"
+// }
 
 // QueryPresaleGoodsEx 查询产能预售商品扩展信息
 // @Summary 查询产能预售商品扩展信息
@@ -388,7 +390,35 @@ func QueryPresaleGoodsEx(c *gin.Context) {
 	// 查询数据
 	engine := db.GetEngine()
 	datas := make([]Cptradepresalegoodsex, 0)
-	s := engine.Where("1=1")
+	sql := `select
+				t.GoodsID,
+				t.ApplyID,
+				t.UserID,
+				t.AccountID,
+				t.RelatedGoodsID,
+				t.PresaleQty,
+				t.StartTime,
+				t.EndTime,
+				t.AttachmentUrl,
+				t.PresaleMode,
+				t.MarketID,
+				t.RefPrice,
+				t.StartPrice,
+				t.FloorPrice,
+				t.CreateTime,
+				t.TradeDate,
+				t.RelatedMarketID,
+				t.PresaledQty,
+				t.PresaledAmount,
+				t.SellStatus,
+				t.GoodsDetail,
+				t.TradePrice,
+				e.enumdicname GoodUnit
+			from CPTrade_PresaleGoodsEx t
+			left join goods g on t.GoodsID = g.goodsid
+			left join enumdicitem e on g.goodunitid = e.enumitemname and e.enumdiccode = 'goodsunit'
+			where 1=1 `
+	s := engine.SQL(sql)
 	if req.GoodsID > 0 {
 		s = s.And("GoodsID=?", req.GoodsID)
 	}
@@ -413,3 +443,96 @@ func QueryPresaleGoodsEx(c *gin.Context) {
 	logger.GetLogger().Infof("QueryPresaleGoodsEx successed: %v", datas)
 	appG.Response(http.StatusOK, e.SUCCESS, datas)
 }
+
+// QueryCPTradeMyBidReq 我的出价信息查询请求参数
+type QueryCPTradeMyBidReq struct {
+	AccountID int `form:"accountid" binding:"required"`
+	GoodsID   int `form:"goodsid"`
+	MarketID  int `form:"marketid"`
+}
+
+// QueryCPTradeMyBidRsp 我的出价信息查询
+type QueryCPTradeMyBidRsp struct {
+	Orderid    int64     `json:"orderid"  xorm:"'ORDERID'" binding:"required"`     // 委托单号(100+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
+	Marketid   int64     `json:"marketid"  xorm:"'MARKETID'" binding:"required"`   // 市场ID
+	Goodsid    int64     `json:"goodsid"  xorm:"'GOODSID'" binding:"required"`     // 商品ID
+	Accountid  int64     `json:"accountid"  xorm:"'ACCOUNTID'" binding:"required"` // 账户ID[报价币种]
+	Orderprice float64   `json:"orderprice"  xorm:"'ORDERPRICE'"`                  // 委托价格
+	Orderqty   int64     `json:"orderqty"  xorm:"'ORDERQTY'" binding:"required"`   // 委托数量
+	Ordertime  time.Time `json:"ordertime"  xorm:"'ORDERTIME'" binding:"required"` // 委托时间
+
+	Tradeprice float64 `json:"tradeprice"  xorm:"'TRADEPRICE'" binding:"required"` // 成交价格
+	Tradeqty   int64   `json:"tradeqty"  xorm:"'TRADEQTY'" binding:"required"`     // 成交数量
+
+	Goodunit string `json:"goodunit" xorm:"'GOODUNIT'"` // 报价单位
+
+	OrderTotalPrice  float64 `json:"ordertotalprice"  xorm:"'ORDERTOTALPRICE'"`   // 货款金额(委托总价格=委托价格*委托数量*合约单位)
+	OrderTotalWeight int64   `json:"ordertotalweight"  xorm:"'ORDERTOTALWEIGHT'"` // 竟拍总重量(委托总重量=委托数量*合约单位)
+	TotalTotalPrice  float64 `json:"totaltotalprice"  xorm:"'TOTALTOTALPRICE'"`   // 成交货款金额(成交总价格=委托价格*委托数量*合约单位)
+}
+
+// QueryCPTradeMyBidInfos 查询产能预售我的出价信息
+// @Summary 查询产能预售我的出价信息
+// @Produce json
+// @Security ApiKeyAuth
+// @Param accountid query int true "资金账户"
+// @Param marketid query int false "预售市场ID"
+// @Param goodsid query int false "预售商品ID"
+// @Success 200 {object} QueryCPTradeMyBidRsp
+// @Failure 500 {object} app.Response
+// @Router /CPTrade/QueryCPTradeMyBidInfos [get]
+// @Tags 产能预售
+func QueryCPTradeMyBidInfos(c *gin.Context) {
+	appG := app.Gin{C: c}
+
+	// 获取请求参数
+	var req QueryCPTradeMyBidReq
+	if err := appG.C.ShouldBindQuery(&req); err != nil {
+		logger.GetLogger().Errorf("QueryCPTradeMyBidInfos failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
+		return
+	}
+
+	// 查询数据
+	engine := db.GetEngine()
+	datas := make([]QueryCPTradeMyBidRsp, 0)
+	// 我的出价 -> 限价买建仓委托单
+	sql := fmt.Sprintf(`select 
+							t.OrderID,
+							t.MarketID,
+							t.GoodsID,
+							t.AccountID,
+							t.OrderPrice,
+							t.OrderQty,
+							t.OrderTime,
+							td.TradePrice,
+							td.TradeQty,
+							e.enumdicname GoodUnit,
+							(t.orderprice * t.orderqty * g.agreeunit) OrderTotalPrice,
+							(t.orderqty * g.agreeunit) OrderTotalWeight,
+							(td.tradeprice * td.tradeqty * g.agreeunit) TotalTotalPrice
+						from Trade_OrderDetail t
+						left join Trade_TradeDetail td on t.orderid = td.OrderID
+						left join goods g on t.goodsid = g.goodsid
+						left join enumdicitem e on g.goodunitid = e.enumitemname and e.enumdiccode = 'goodsunit'
+						where t.BuyOrSell = 0 and t.BuildType = 1 and t.PriceMode = 2 
+							and t.AccountID = %d`, req.AccountID)
+	s := engine.SQL(sql)
+	if req.GoodsID > 0 {
+		s = s.And("GoodsID=?", req.GoodsID)
+	}
+	if req.MarketID > 0 {
+		s = s.And("MarketID=?", req.MarketID)
+	}
+
+	if err := s.Find(&datas); err != nil {
+		// 查询失败
+		logger.GetLogger().Errorf("QueryCPTradeMyBidInfos failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
+		return
+	}
+
+	// 查询成功
+	logger.GetLogger().Infof("QueryCPTradeMyBidInfos successed: %v", datas)
+	appG.Response(http.StatusOK, e.SUCCESS, datas)
+}

+ 126 - 0
docs/docs.go

@@ -26,6 +26,57 @@ var doc = `{
     "host": "{{.Host}}",
     "basePath": "{{.BasePath}}",
     "paths": {
+        "/CPTrade/QueryCPTradeMyBidInfos": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "产能预售"
+                ],
+                "summary": "查询产能预售我的出价信息",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "资金账户",
+                        "name": "accountid",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "预售市场ID",
+                        "name": "marketid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "预售商品ID",
+                        "name": "goodsid",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/cptrade.QueryCPTradeMyBidRsp"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/CPTrade/QueryPositionCancel": {
             "get": {
                 "security": [
@@ -429,6 +480,10 @@ var doc = `{
                     "description": "商品代码",
                     "type": "string"
                 },
+                "goodsid": {
+                    "description": "商品ID",
+                    "type": "integer"
+                },
                 "goodsname": {
                     "description": "商品名称",
                     "type": "string"
@@ -513,6 +568,10 @@ var doc = `{
                     "description": "商品ID(预售)",
                     "type": "integer"
                 },
+                "goodunit": {
+                    "description": "报价单位",
+                    "type": "string"
+                },
                 "marketid": {
                     "description": "预售市场ID - 根据预售模式选择市场",
                     "type": "integer"
@@ -652,6 +711,73 @@ var doc = `{
                 }
             }
         },
+        "cptrade.QueryCPTradeMyBidRsp": {
+            "type": "object",
+            "required": [
+                "accountid",
+                "goodsid",
+                "marketid",
+                "orderid",
+                "orderqty",
+                "ordertime",
+                "tradeprice",
+                "tradeqty"
+            ],
+            "properties": {
+                "accountid": {
+                    "description": "账户ID[报价币种]",
+                    "type": "integer"
+                },
+                "goodsid": {
+                    "description": "商品ID",
+                    "type": "integer"
+                },
+                "goodunit": {
+                    "description": "报价单位",
+                    "type": "string"
+                },
+                "marketid": {
+                    "description": "市场ID",
+                    "type": "integer"
+                },
+                "orderid": {
+                    "description": "委托单号(100+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)",
+                    "type": "integer"
+                },
+                "orderprice": {
+                    "description": "委托价格",
+                    "type": "number"
+                },
+                "orderqty": {
+                    "description": "委托数量",
+                    "type": "integer"
+                },
+                "ordertime": {
+                    "description": "委托时间",
+                    "type": "string"
+                },
+                "ordertotalprice": {
+                    "description": "货款金额(委托总价格=委托价格*委托数量*合约单位)",
+                    "type": "number"
+                },
+                "ordertotalweight": {
+                    "description": "竟拍总重量(委托总重量=委托数量*合约单位)",
+                    "type": "integer"
+                },
+                "totaltotalprice": {
+                    "description": "成交货款金额(成交总价格=委托价格*委托数量*合约单位)",
+                    "type": "number"
+                },
+                "tradeprice": {
+                    "description": "成交价格",
+                    "type": "number"
+                },
+                "tradeqty": {
+                    "description": "成交数量",
+                    "type": "integer"
+                }
+            }
+        },
         "delivery.Deliveryrelation": {
             "type": "object",
             "required": [

+ 126 - 0
docs/swagger.json

@@ -10,6 +10,57 @@
     },
     "basePath": "/api",
     "paths": {
+        "/CPTrade/QueryCPTradeMyBidInfos": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "产能预售"
+                ],
+                "summary": "查询产能预售我的出价信息",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "资金账户",
+                        "name": "accountid",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "预售市场ID",
+                        "name": "marketid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "预售商品ID",
+                        "name": "goodsid",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/cptrade.QueryCPTradeMyBidRsp"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/CPTrade/QueryPositionCancel": {
             "get": {
                 "security": [
@@ -413,6 +464,10 @@
                     "description": "商品代码",
                     "type": "string"
                 },
+                "goodsid": {
+                    "description": "商品ID",
+                    "type": "integer"
+                },
                 "goodsname": {
                     "description": "商品名称",
                     "type": "string"
@@ -497,6 +552,10 @@
                     "description": "商品ID(预售)",
                     "type": "integer"
                 },
+                "goodunit": {
+                    "description": "报价单位",
+                    "type": "string"
+                },
                 "marketid": {
                     "description": "预售市场ID - 根据预售模式选择市场",
                     "type": "integer"
@@ -636,6 +695,73 @@
                 }
             }
         },
+        "cptrade.QueryCPTradeMyBidRsp": {
+            "type": "object",
+            "required": [
+                "accountid",
+                "goodsid",
+                "marketid",
+                "orderid",
+                "orderqty",
+                "ordertime",
+                "tradeprice",
+                "tradeqty"
+            ],
+            "properties": {
+                "accountid": {
+                    "description": "账户ID[报价币种]",
+                    "type": "integer"
+                },
+                "goodsid": {
+                    "description": "商品ID",
+                    "type": "integer"
+                },
+                "goodunit": {
+                    "description": "报价单位",
+                    "type": "string"
+                },
+                "marketid": {
+                    "description": "市场ID",
+                    "type": "integer"
+                },
+                "orderid": {
+                    "description": "委托单号(100+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)",
+                    "type": "integer"
+                },
+                "orderprice": {
+                    "description": "委托价格",
+                    "type": "number"
+                },
+                "orderqty": {
+                    "description": "委托数量",
+                    "type": "integer"
+                },
+                "ordertime": {
+                    "description": "委托时间",
+                    "type": "string"
+                },
+                "ordertotalprice": {
+                    "description": "货款金额(委托总价格=委托价格*委托数量*合约单位)",
+                    "type": "number"
+                },
+                "ordertotalweight": {
+                    "description": "竟拍总重量(委托总重量=委托数量*合约单位)",
+                    "type": "integer"
+                },
+                "totaltotalprice": {
+                    "description": "成交货款金额(成交总价格=委托价格*委托数量*合约单位)",
+                    "type": "number"
+                },
+                "tradeprice": {
+                    "description": "成交价格",
+                    "type": "number"
+                },
+                "tradeqty": {
+                    "description": "成交数量",
+                    "type": "integer"
+                }
+            }
+        },
         "delivery.Deliveryrelation": {
             "type": "object",
             "required": [

+ 89 - 0
docs/swagger.yaml

@@ -88,6 +88,9 @@ definitions:
       goodscode:
         description: 商品代码
         type: string
+      goodsid:
+        description: 商品ID
+        type: integer
       goodsname:
         description: 商品名称
         type: string
@@ -150,6 +153,9 @@ definitions:
       goodsid:
         description: 商品ID(预售)
         type: integer
+      goodunit:
+        description: 报价单位
+        type: string
       marketid:
         description: 预售市场ID - 根据预售模式选择市场
         type: integer
@@ -255,6 +261,57 @@ definitions:
     - accountid
     - goodsid
     type: object
+  cptrade.QueryCPTradeMyBidRsp:
+    properties:
+      accountid:
+        description: 账户ID[报价币种]
+        type: integer
+      goodsid:
+        description: 商品ID
+        type: integer
+      goodunit:
+        description: 报价单位
+        type: string
+      marketid:
+        description: 市场ID
+        type: integer
+      orderid:
+        description: 委托单号(100+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
+        type: integer
+      orderprice:
+        description: 委托价格
+        type: number
+      orderqty:
+        description: 委托数量
+        type: integer
+      ordertime:
+        description: 委托时间
+        type: string
+      ordertotalprice:
+        description: 货款金额(委托总价格=委托价格*委托数量*合约单位)
+        type: number
+      ordertotalweight:
+        description: 竟拍总重量(委托总重量=委托数量*合约单位)
+        type: integer
+      totaltotalprice:
+        description: 成交货款金额(成交总价格=委托价格*委托数量*合约单位)
+        type: number
+      tradeprice:
+        description: 成交价格
+        type: number
+      tradeqty:
+        description: 成交数量
+        type: integer
+    required:
+    - accountid
+    - goodsid
+    - marketid
+    - orderid
+    - orderqty
+    - ordertime
+    - tradeprice
+    - tradeqty
+    type: object
   delivery.Deliveryrelation:
     properties:
       begindate:
@@ -356,6 +413,38 @@ info:
   title: MTP2.0 查询服务 API
   version: "1.0"
 paths:
+  /CPTrade/QueryCPTradeMyBidInfos:
+    get:
+      parameters:
+      - description: 资金账户
+        in: query
+        name: accountid
+        required: true
+        type: integer
+      - description: 预售市场ID
+        in: query
+        name: marketid
+        type: integer
+      - description: 预售商品ID
+        in: query
+        name: goodsid
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/cptrade.QueryCPTradeMyBidRsp'
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询产能预售我的出价信息
+      tags:
+      - 产能预售
   /CPTrade/QueryPositionCancel:
     get:
       parameters:

+ 126 - 0
models/tradeModels.go

@@ -0,0 +1,126 @@
+// Package models 100.15合约交易
+package models
+
+import "time"
+
+// Tradeorderdetail 交易委托单表 - 导历史
+type Tradeorderdetail struct {
+	Orderid                 int64     `json:"orderid"  xorm:"'ORDERID'" binding:"required"`              // 委托单号(100+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
+	Tradedate               string    `json:"tradedate"  xorm:"'TRADEDATE'" binding:"required"`          // 交易日(yyyyMMdd)
+	Buildtype               int64     `json:"buildtype"  xorm:"'BUILDTYPE'" binding:"required"`          // 委托单据类型 - 1:建仓 2:平仓 3:先平后建
+	Preorderid              int64     `json:"preorderid"  xorm:"'PREORDERID'"`                           // 关联预埋单号(止盈止损单时填写)
+	Cancelorderid           int64     `json:"cancelorderid"  xorm:"'CANCELORDERID'"`                     // 撤单单号(撤单时填写)
+	Relatedid               int64     `json:"relatedid"  xorm:"'RELATEDID'"`                             // 关联单号(交割单)
+	Marketid                int64     `json:"marketid"  xorm:"'MARKETID'" binding:"required"`            // 市场ID
+	Goodsid                 int64     `json:"goodsid"  xorm:"'GOODSID'" binding:"required"`              // 商品ID
+	Accountid               int64     `json:"accountid"  xorm:"'ACCOUNTID'" binding:"required"`          // 账户ID[报价币种]
+	Memberuserid            int64     `json:"memberuserid"  xorm:"'MEMBERUSERID'" binding:"required"`    // 所属会员UserID
+	Buyorsell               int64     `json:"buyorsell"  xorm:"'BUYORSELL'" binding:"required"`          // 买卖 - 0:买 1:卖
+	Pricemode               int64     `json:"pricemode"  xorm:"'PRICEMODE'" binding:"required"`          // 取价方式 - 1:市价 2: 限价
+	Orderprice              float64   `json:"orderprice"  xorm:"'ORDERPRICE'"`                           // 委托价格
+	Marketmaxsub            float64   `json:"marketmaxsub"  xorm:"'MARKETMAXSUB'"`                       // 市价最大偏移范围
+	Orderqty                int64     `json:"orderqty"  xorm:"'ORDERQTY'" binding:"required"`            // 委托数量
+	Tradeqty                int64     `json:"tradeqty"  xorm:"'TRADEQTY'"`                               // 成交数量
+	Cancelqty               int64     `json:"cancelqty"  xorm:"'CANCELQTY'"`                             // 撤单数量
+	Openqty                 int64     `json:"openqty"  xorm:"'OPENQTY'"`                                 // 开仓数量(先建后平操作,需要记录)
+	Closeqty                int64     `json:"closeqty"  xorm:"'CLOSEQTY'"`                               // 平仓数量(先建后平操作 需要记录)
+	Opentradeqty            int64     `json:"opentradeqty"  xorm:"'OPENTRADEQTY'"`                       // 开仓成交数量(先建后平操作,需要记录)
+	Closetradeqty           int64     `json:"closetradeqty"  xorm:"'CLOSETRADEQTY'"`                     // 平仓成交数量(先建后平操作,需要记录)
+	Freezemargin            float64   `json:"freezemargin"  xorm:"'FREEZEMARGIN'"`                       // 冻结保证金(冻结交易金额)
+	Unfreezemargin          float64   `json:"unfreezemargin"  xorm:"'UNFREEZEMARGIN'"`                   // 解冻保证金
+	Freezecharge            float64   `json:"freezecharge"  xorm:"'FREEZECHARGE'"`                       // 冻结手续费
+	Unfreezecharge          float64   `json:"unfreezecharge"  xorm:"'UNFREEZECHARGE'"`                   // 解冻手续费
+	Openfreezecharge        float64   `json:"openfreezecharge"  xorm:"'OPENFREEZECHARGE'"`               // 开仓冻结手续费(先建后平操作,需要记录)
+	Closefreezecharge       float64   `json:"closefreezecharge"  xorm:"'CLOSEFREEZECHARGE'"`             // 平仓冻结手续费(先建后平操作,需要记录)
+	Openunfreezecharge      float64   `json:"openunfreezecharge"  xorm:"'OPENUNFREEZECHARGE'"`           // 开仓解冻手续费(先建后平操作,需要记录)
+	Closeunfreezecharge     float64   `json:"closeunfreezecharge"  xorm:"'CLOSEUNFREEZECHARGE'"`         // 平仓解冻手续费(先建后平操作,需要记录)
+	Validtype               int64     `json:"validtype"  xorm:"'VALIDTYPE'" binding:"required"`          // 有效类型 - 1当日有效 2本周有效 3指定日期有效 4一直有效 5指定时间有效
+	Validtime               time.Time `json:"validtime"  xorm:"'VALIDTIME'"`                             // 有效期限
+	Volumetype              int64     `json:"volumetype"  xorm:"'VOLUMETYPE'"`                           // 当时间有效类型为 “立即执行否则取消 IOC” 时,需要此项 - 0:任意量  1:最小量(暂时不支持) 2:全部量
+	Operatetype             int64     `json:"operatetype"  xorm:"'OPERATETYPE'" binding:"required"`      // 操作类型 - 1:正常下单 2:斩仓 3:转单 4:结算撤单 5:系统卖出(适用于先平后建的卖出) 6:行情源报价 7:(结算)到期强平 8:(结算)协议转让 9:系统对冲单 10:(结算)到期无效 11:交割协议转让 12:交割协议平仓 13:交割成交(所有权) 14:管理端强行平仓 15:管理端协议转让
+	Ordertime               time.Time `json:"ordertime"  xorm:"'ORDERTIME'" binding:"required"`          // 委托时间
+	Ordersrc                int64     `json:"ordersrc"  xorm:"'ORDERSRC'"`                               // 委托来源 -  1:客户端 2:管理端 3:风控服务 4:交割服务 5:交易服务 6:交易日结 7:商品强平 8:管理端商品退市强平 9:交易接口 10:交割服务商被动(受托竞价) 11:预埋触发
+	Orderstatus             int64     `json:"orderstatus"  xorm:"'ORDERSTATUS'"`                         // 委托状态 - 1: 委托请求 2:待冻结 3:委托成功 4: 委托失败 5:配对成功 6: 已撤销 7:部分成交 8:已成交 9:部成部撤 10:成交失败 11:已拒绝 12:经过摘牌(先摘后挂专用-先摘后挂已摘过) 13:冻结成功(通道交易专用) 14:通道已撤 15:通道部成部撤 16:成交失败违约(荷兰式竞拍专用)
+	Operatorid              int64     `json:"operatorid"  xorm:"'OPERATORID'"`                           // 登录账号(LoginID)
+	Updatetime              time.Time `json:"updatetime"  xorm:"'UPDATETIME'"`                           // 更新时间
+	Clientordertime         time.Time `json:"clientordertime"  xorm:"'CLIENTORDERTIME'"`                 // 客户端委托时间
+	Clientticket            string    `json:"clientticket"  xorm:"'CLIENTTICKET'"`                       // 客户端流水号
+	UUID                    string    `json:"uuid"  xorm:"'UUID'"`                                       // 发起端唯一id
+	Clienttype              int64     `json:"clienttype"  xorm:"'CLIENTTYPE'"`                           // 客户端类型 - 0:保留为未填终端类型 1:PC管理端 2:PC交易端 3:手机客户端_安卓 4:网页客户端 5:微信客户端 6:手机客户端_苹果 7:网上开户客户端 8:无效终端编号 9:报价终端(中江)
+	Retcode                 int64     `json:"retcode"  xorm:"'RETCODE'"`                                 // 错误代码
+	Tradeproperty           int64     `json:"tradeproperty"  xorm:"'TRADEPROPERTY'"`                     // 交易属性
+	Listingselecttype       int64     `json:"listingselecttype"  xorm:"'LISTINGSELECTTYPE'"`             // 挂牌点选类型 - 1:挂牌 2:摘牌 3:先摘后挂
+	Delistingtype           int64     `json:"delistingtype"  xorm:"'DELISTINGTYPE'"`                     // 摘牌类型 - 1:价格最优 2:点选成交
+	Marginalgorithm         int64     `json:"marginalgorithm"  xorm:"'MARGINALGORITHM'"`                 // 保证金收取方式  1:比率  2:固定
+	Marginvalue             float64   `json:"marginvalue"  xorm:"'MARGINVALUE'"`                         // 即市保证金设置值
+	Openfeealgorithm        int64     `json:"openfeealgorithm"  xorm:"'OPENFEEALGORITHM'"`               // 建仓手续费收取方式  1:比率  2:固定
+	Openmemberchargevalue   float64   `json:"openmemberchargevalue"  xorm:"'OPENMEMBERCHARGEVALUE'"`     // 建仓会员手续费设置值
+	Openexchagechargevalue  float64   `json:"openexchagechargevalue"  xorm:"'OPENEXCHAGECHARGEVALUE'"`   // 建仓交易所手续费设置值
+	Closefeealgorithm       int64     `json:"closefeealgorithm"  xorm:"'CLOSEFEEALGORITHM'"`             // 平仓手续费收取方式 1:比率  2:固定
+	Closememberchargevalue  float64   `json:"closememberchargevalue"  xorm:"'CLOSEMEMBERCHARGEVALUE'"`   // 平仓会员手续费设置值
+	Closeexchagechargevalue float64   `json:"closeexchagechargevalue"  xorm:"'CLOSEEXCHAGECHARGEVALUE'"` // 平仓交易所手续费设置值
+	Optiontype              int64     `json:"optiontype"  xorm:"'OPTIONTYPE'"`                           // 期权类型 - 1:认购(看涨) 2:认沽(看跌)
+	Premium                 float64   `json:"premium"  xorm:"'PREMIUM'"`                                 // 权利金
+	Ispreexercise           int64     `json:"ispreexercise"  xorm:"'ISPREEXERCISE'"`                     // 是否预申报- 0:否 1:是
+	Preexerciseprice        float64   `json:"preexerciseprice"  xorm:"'PREEXERCISEPRICE'"`               // 预申报价格
+	Isconfirmexercise       int64     `json:"isconfirmexercise"  xorm:"'ISCONFIRMEXERCISE'"`             // 是否确认行权- 0:否 1:是
+	Quoteid                 int64     `json:"quoteid"  xorm:"'QUOTEID'"`                                 // 报价单ID
+	Gcaccountid             int64     `json:"gcaccountid"  xorm:"'GCACCOUNTID'"`                         // 账户ID[合约币种]
+	Sessionid               int64     `json:"sessionid"  xorm:"'SESSIONID'"`                             // 会话ID
+}
+
+// TableName is TRADE_ORDERDETAIL
+func (Tradeorderdetail) TableName() string {
+	return "TRADE_ORDERDETAIL"
+}
+
+// Tradetradedetail 交易成交单表 - 导历史
+type Tradetradedetail struct {
+	Tradeid                 int64     `json:"tradeid"  xorm:"'TRADEID'" binding:"required"`              // 成交单号(101+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
+	Buyorsell               int64     `json:"buyorsell"  xorm:"'BUYORSELL'" binding:"required"`          // 方向 - 0:买 1:卖
+	Orderid                 int64     `json:"orderid"  xorm:"'ORDERID'" binding:"required"`              // 委托单号
+	Tradedate               string    `json:"tradedate"  xorm:"'TRADEDATE'" binding:"required"`          // 交易日(yyyyMMdd)
+	Accountid               int64     `json:"accountid"  xorm:"'ACCOUNTID'" binding:"required"`          // 账户ID[报价币种]
+	Goodsid                 int64     `json:"goodsid"  xorm:"'GOODSID'" binding:"required"`              // 商品ID
+	Marketid                int64     `json:"marketid"  xorm:"'MARKETID'" binding:"required"`            // 市场ID
+	Memberuserid            int64     `json:"memberuserid"  xorm:"'MEMBERUSERID'" binding:"required"`    // 会员id 个人投资者 需要填写
+	Matchaccountid          int64     `json:"matchaccountid"  xorm:"'MATCHACCOUNTID'"`                   // 对手账号id
+	Tradetime               time.Time `json:"tradetime"  xorm:"'TRADETIME'" binding:"required"`          // 成交时间
+	Tradeprice              float64   `json:"tradeprice"  xorm:"'TRADEPRICE'" binding:"required"`        // 成交价格
+	Tradeqty                int64     `json:"tradeqty"  xorm:"'TRADEQTY'" binding:"required"`            // 成交数量
+	Tradeamount             float64   `json:"tradeamount"  xorm:"'TRADEAMOUNT'" binding:"required"`      // 成交金额[账户币种,用于所有权]
+	Closepl                 float64   `json:"closepl"  xorm:"'CLOSEPL'"`                                 // 平仓盈亏
+	Intclosepl              int64     `json:"intclosepl"  xorm:"'INTCLOSEPL'"`                           // 整型盈亏(用于交易结算试算平衡-收益权)
+	Opencharge              float64   `json:"opencharge"  xorm:"'OPENCHARGE'"`                           // 建仓手续费(支付总手续费=(交易所比率+会员比率)*成交金额)
+	Closecharge             float64   `json:"closecharge"  xorm:"'CLOSECHARGE'"`                         // 平仓手续费(支付总手续费=(交易所比率+会员比率)*成交金额)
+	Tradetype               int64     `json:"tradetype"  xorm:"'TRADETYPE'"`                             // 成交类别 - 1:正常委托成交 2:定向做市成交(接单) 3:交割协议平仓成交 4:交割减仓成交 5:到期强平成交 6:风控斩仓成交 7:协议平仓(管理端)成交 8:仓单转持仓成交 9: 交割协议转让成交 10:受托竞价成交(接单) 11:协议转让成交 12:系统强行平仓 13:期权违约平仓 14:场外期权单向成交 15:冻结头寸解冻申请 16:冻结头寸商品配售 17:冻结头寸商品转让 18:冻结头寸商品回购 19:冻结头寸商品提货 20:冻结头寸结算解冻 21:转换外部商品 22:预售商品头寸转入 23:预售商品头寸转入注销 24:预售商品成交 25:预售商品卖家增加头寸 26:预售商品结束清理
+	Buildtype               int64     `json:"buildtype"  xorm:"'BUILDTYPE'"`                             // 委托单据类型 1:建仓 2:平仓 3:先平后建
+	Openqty                 int64     `json:"openqty"  xorm:"'OPENQTY'"`                                 // 开仓数量(先建后平操作 需要记录)
+	Closeqty                int64     `json:"closeqty"  xorm:"'CLOSEQTY'"`                               // 平仓数量(先建后平操作 需要记录)
+	Status                  int64     `json:"status"  xorm:"'STATUS'"`                                   // 处理状态 - 1:待处理 2:已处理 3:处理失败
+	Isreckoned              int64     `json:"isreckoned"  xorm:"'ISRECKONED'"`                           // 是否结算 - 0:未结算 1:已结算
+	Tradeproperty           int64     `json:"tradeproperty"  xorm:"'TRADEPROPERTY'"`                     // 交易属性
+	Openfeealgorithm        int64     `json:"openfeealgorithm"  xorm:"'OPENFEEALGORITHM'"`               // 建仓手续费收取方式  1:比率  2:固定
+	Openmemberchargevalue   float64   `json:"openmemberchargevalue"  xorm:"'OPENMEMBERCHARGEVALUE'"`     // 建仓会员手续费设置值
+	Openexchagechargevalue  float64   `json:"openexchagechargevalue"  xorm:"'OPENEXCHAGECHARGEVALUE'"`   // 建仓交易所手续费设置值
+	Closefeealgorithm       int64     `json:"closefeealgorithm"  xorm:"'CLOSEFEEALGORITHM'"`             // 平仓手续费收取方式 1:比率  2:固定
+	Closememberchargevalue  float64   `json:"closememberchargevalue"  xorm:"'CLOSEMEMBERCHARGEVALUE'"`   // 平仓会员手续费设置值
+	Closeexchagechargevalue float64   `json:"closeexchagechargevalue"  xorm:"'CLOSEEXCHAGECHARGEVALUE'"` // 平仓交易所手续费设置值
+	Optiontype              int64     `json:"optiontype"  xorm:"'OPTIONTYPE'"`                           // 期权类型 - 1:认购(看涨) 2:认沽(看跌)
+	Premium                 float64   `json:"premium"  xorm:"'PREMIUM'"`                                 // 权利金 - [持仓单的权利金]
+	Ispreexercise           int64     `json:"ispreexercise"  xorm:"'ISPREEXERCISE'"`                     // 是否预申报- 0:否 1:是
+	Preexerciseprice        float64   `json:"preexerciseprice"  xorm:"'PREEXERCISEPRICE'"`               // 预申报价格
+	Isconfirmexercise       int64     `json:"isconfirmexercise"  xorm:"'ISCONFIRMEXERCISE'"`             // 是否确认行权- 0:否 1:是
+	Ismain                  int64     `json:"ismain"  xorm:"'ISMAIN'"`                                   // 是否主单 - 0:不是 1:是
+	Performanceplanid       int64     `json:"performanceplanid"  xorm:"'PERFORMANCEPLANID'"`             // 履约计划ID[期权]
+	Performancestatus       int64     `json:"performancestatus"  xorm:"'PERFORMANCESTATUS'"`             // 履约状态[期权] - 0:无履约 1:未履约 2:履约中 3:履约完成
+	Creditamount            float64   `json:"creditamount"  xorm:"'CREDITAMOUNT'"`                       // 授信金额
+	Gcaccountid             int64     `json:"gcaccountid"  xorm:"'GCACCOUNTID'"`                         // 账户ID[合约币种]
+	Closepl2                float64   `json:"closepl2"  xorm:"'CLOSEPL2'"`                               // 平仓盈亏[逐笔]
+	Relatedouttradeid       int64     `json:"relatedouttradeid"  xorm:"'RELATEDOUTTRADEID'"`             // 关联外部成交单ID
+}
+
+// TableName is TRADE_TRADEDETAIL
+func (Tradetradedetail) TableName() string {
+	return "TRADE_TRADEDETAIL"
+}

+ 3 - 0
routers/router.go

@@ -51,6 +51,9 @@ func InitRouter() *gin.Engine {
 		cpTradeR.GET("/QueryPositionCancel", cptrade.QueryPositionCancel)
 		// 查询产能预售商品扩展信息
 		cpTradeR.GET("/QueryPresaleGoodsEx", cptrade.QueryPresaleGoodsEx)
+		// 查询产能预售我的出价信息
+		cpTradeR.GET("/QueryCPTradeMyBidInfos", cptrade.QueryCPTradeMyBidInfos)
+
 	}
 	// ************************ 交割服务 ************************
 	deliveryR := apiR.Group("Delivery")