Sfoglia il codice sorgente

1.增加查询指定成交接口(仓单贸易)

zou.yingbin 4 anni fa
parent
commit
dde550f581
6 ha cambiato i file con 687 aggiunte e 3 eliminazioni
  1. 21 0
      controllers/wrTrade2/qryWrTrade.go
  2. 205 0
      docs/docs.go
  3. 205 0
      docs/swagger.json
  4. 147 0
      docs/swagger.yaml
  5. 108 3
      models/wrTrade2.go
  6. 1 0
      routers/router.go

+ 21 - 0
controllers/wrTrade2/qryWrTrade.go

@@ -97,6 +97,27 @@ func QueryWrOrderDetail(c *gin.Context) {
 	a.DoGetDataByPage(&m)
 }
 
+// QueryWrSpecialMatchOrder
+// @Summary 查询指定成交
+// @Description 页面 现货仓单 | 预售仓单 -> 指定成交
+// @Produce json
+// @Security ApiKeyAuth
+// @Param page query int false "页码"
+// @Param pagesize query int false "每页条数"
+// @Param userid query int true "用户id"
+// @Param marketid query int false "仓单贸易市场id"
+// @Param haswr query int true "是否有仓单 0-没有 1-有(仓单贸易填1,仓单预售填0)"
+// @Success 200 {array} models.WrSpecialMatchOrder
+// @Failure 500 {object} app.Response
+// @Router /WrTrade2/QueryWrSpecialMatchOrder [get]
+// @Tags 仓单贸易v2
+func QueryWrSpecialMatchOrder(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	m := models.WrSpecialMatchOrder{}
+	a.DoBindReq(&m)
+	a.DoGetDataByPage(&m)
+}
+
 // QueryWrTradeDetail
 // @Summary 查询仓单成交明细
 // @Produce json

+ 205 - 0
docs/docs.go

@@ -11212,6 +11212,74 @@ var doc = `{
                 }
             }
         },
+        "/WrTrade2/QueryWrSpecialMatchOrder": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "description": "页面 现货仓单 | 预售仓单 -\u003e 指定成交",
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "仓单贸易v2"
+                ],
+                "summary": "查询指定成交",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "页码",
+                        "name": "page",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "每页条数",
+                        "name": "pagesize",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "用户id",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "仓单贸易市场id",
+                        "name": "marketid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "是否有仓单 0-没有 1-有(仓单贸易填1,仓单预售填0)",
+                        "name": "haswr",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.WrSpecialMatchOrder"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/WrTrade2/QueryWrTradeDetail": {
             "get": {
                 "security": [
@@ -29481,6 +29549,143 @@ var doc = `{
                 }
             }
         },
+        "models.WrSpecialMatchOrder": {
+            "type": "object",
+            "properties": {
+                "amount": {
+                    "description": "金额 = 数量 * 价格",
+                    "type": "number"
+                },
+                "buyorsell": {
+                    "description": "买卖 - 0:买 1:卖(挂牌类型 买为采购 卖为销售)",
+                    "type": "integer"
+                },
+                "cancelqty": {
+                    "description": "撤销数量",
+                    "type": "number"
+                },
+                "deliverygoodscode": {
+                    "description": "品种代码",
+                    "type": "string"
+                },
+                "deliverygoodsid": {
+                    "description": "品种ID",
+                    "type": "integer"
+                },
+                "deliverygoodsname": {
+                    "description": "品种名称",
+                    "type": "string"
+                },
+                "enumdicname": {
+                    "description": "单位名称",
+                    "type": "string"
+                },
+                "fixedprice": {
+                    "description": "固定价格(价格)",
+                    "type": "number"
+                },
+                "haswr": {
+                    "description": "是否有仓单-卖方 - 0:无仓单 1:有仓单",
+                    "type": "integer"
+                },
+                "marketid": {
+                    "description": "市场ID",
+                    "type": "integer"
+                },
+                "matchuserid": {
+                    "description": "指定方资金账号(字段名为userid,实际存的是accountid by:邓工)",
+                    "type": "integer"
+                },
+                "matchusername": {
+                    "description": "指定方",
+                    "type": "string"
+                },
+                "optioncompare": {
+                    "description": "选择项比较串【{选择项ID}+{冒号}+选择项值 } ,逗号分隔,头尾加逗号】-- 所有选择项拼接,用于比较",
+                    "type": "string"
+                },
+                "orderqty": {
+                    "description": "委托数量",
+                    "type": "number"
+                },
+                "ordertime": {
+                    "description": "委托时间",
+                    "type": "string"
+                },
+                "pricemove": {
+                    "description": "升贴水(浮动价时填写)    -   [挂牌]",
+                    "type": "number"
+                },
+                "tradedate": {
+                    "description": "交易日(yyyyMMdd)",
+                    "type": "string"
+                },
+                "tradeprice": {
+                    "description": "成交价格",
+                    "type": "number"
+                },
+                "tradeqty": {
+                    "description": "成交数量",
+                    "type": "number"
+                },
+                "userid": {
+                    "description": "用户ID",
+                    "type": "integer"
+                },
+                "username": {
+                    "description": "发起方",
+                    "type": "string"
+                },
+                "warehouseid": {
+                    "description": "仓库ID",
+                    "type": "integer"
+                },
+                "warehousename": {
+                    "description": "仓库名称",
+                    "type": "string"
+                },
+                "wrfactortypeid": {
+                    "description": "仓单要素类型ID(212+Unix秒时间戳(10位)+xxxxxx)",
+                    "type": "integer"
+                },
+                "wrfactortypename": {
+                    "description": "仓单要素类型名称(选择项要素的名称合并显示,逗号分隔)",
+                    "type": "string"
+                },
+                "wrpricetype": {
+                    "description": "价格方式 - 1:固定价 2-浮动价  -   [挂牌]",
+                    "type": "integer"
+                },
+                "wrstandardcode": {
+                    "description": "现货商品代码",
+                    "type": "string"
+                },
+                "wrstandardid": {
+                    "description": "现货商品ID",
+                    "type": "integer"
+                },
+                "wrstandardname": {
+                    "description": "商品名称",
+                    "type": "string"
+                },
+                "wrtradeorderid": {
+                    "description": "仓单贸易委托单ID(320+Unix秒时间戳(10位)+xxxxxx)",
+                    "type": "string"
+                },
+                "wrtradeorderstatus": {
+                    "description": "委托状态 - 1:委托请求 2:待冻结 3:委托成功 4:委托失败 5:配对成功 6:已撤 7:已成 8:成交失败 9:委托拒绝 10:挂牌部分成交 11:仓单生成失败 12:首付扣款失败 13:履约失败 14:撤单解冻贷款失败 15:部成部撤",
+                    "type": "integer"
+                },
+                "wrtradetype": {
+                    "description": "仓单贸易类型 - 1:挂牌 2:摘牌 3:提货卖(文化中国) 4:提货买(文化中国)",
+                    "type": "integer"
+                },
+                "wrtypename": {
+                    "description": "商品",
+                    "type": "string"
+                }
+            }
+        },
         "models.WrTradeDetail": {
             "type": "object",
             "properties": {

+ 205 - 0
docs/swagger.json

@@ -11196,6 +11196,74 @@
                 }
             }
         },
+        "/WrTrade2/QueryWrSpecialMatchOrder": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "description": "页面 现货仓单 | 预售仓单 -\u003e 指定成交",
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "仓单贸易v2"
+                ],
+                "summary": "查询指定成交",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "页码",
+                        "name": "page",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "每页条数",
+                        "name": "pagesize",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "用户id",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "仓单贸易市场id",
+                        "name": "marketid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "是否有仓单 0-没有 1-有(仓单贸易填1,仓单预售填0)",
+                        "name": "haswr",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.WrSpecialMatchOrder"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/WrTrade2/QueryWrTradeDetail": {
             "get": {
                 "security": [
@@ -29465,6 +29533,143 @@
                 }
             }
         },
+        "models.WrSpecialMatchOrder": {
+            "type": "object",
+            "properties": {
+                "amount": {
+                    "description": "金额 = 数量 * 价格",
+                    "type": "number"
+                },
+                "buyorsell": {
+                    "description": "买卖 - 0:买 1:卖(挂牌类型 买为采购 卖为销售)",
+                    "type": "integer"
+                },
+                "cancelqty": {
+                    "description": "撤销数量",
+                    "type": "number"
+                },
+                "deliverygoodscode": {
+                    "description": "品种代码",
+                    "type": "string"
+                },
+                "deliverygoodsid": {
+                    "description": "品种ID",
+                    "type": "integer"
+                },
+                "deliverygoodsname": {
+                    "description": "品种名称",
+                    "type": "string"
+                },
+                "enumdicname": {
+                    "description": "单位名称",
+                    "type": "string"
+                },
+                "fixedprice": {
+                    "description": "固定价格(价格)",
+                    "type": "number"
+                },
+                "haswr": {
+                    "description": "是否有仓单-卖方 - 0:无仓单 1:有仓单",
+                    "type": "integer"
+                },
+                "marketid": {
+                    "description": "市场ID",
+                    "type": "integer"
+                },
+                "matchuserid": {
+                    "description": "指定方资金账号(字段名为userid,实际存的是accountid by:邓工)",
+                    "type": "integer"
+                },
+                "matchusername": {
+                    "description": "指定方",
+                    "type": "string"
+                },
+                "optioncompare": {
+                    "description": "选择项比较串【{选择项ID}+{冒号}+选择项值 } ,逗号分隔,头尾加逗号】-- 所有选择项拼接,用于比较",
+                    "type": "string"
+                },
+                "orderqty": {
+                    "description": "委托数量",
+                    "type": "number"
+                },
+                "ordertime": {
+                    "description": "委托时间",
+                    "type": "string"
+                },
+                "pricemove": {
+                    "description": "升贴水(浮动价时填写)    -   [挂牌]",
+                    "type": "number"
+                },
+                "tradedate": {
+                    "description": "交易日(yyyyMMdd)",
+                    "type": "string"
+                },
+                "tradeprice": {
+                    "description": "成交价格",
+                    "type": "number"
+                },
+                "tradeqty": {
+                    "description": "成交数量",
+                    "type": "number"
+                },
+                "userid": {
+                    "description": "用户ID",
+                    "type": "integer"
+                },
+                "username": {
+                    "description": "发起方",
+                    "type": "string"
+                },
+                "warehouseid": {
+                    "description": "仓库ID",
+                    "type": "integer"
+                },
+                "warehousename": {
+                    "description": "仓库名称",
+                    "type": "string"
+                },
+                "wrfactortypeid": {
+                    "description": "仓单要素类型ID(212+Unix秒时间戳(10位)+xxxxxx)",
+                    "type": "integer"
+                },
+                "wrfactortypename": {
+                    "description": "仓单要素类型名称(选择项要素的名称合并显示,逗号分隔)",
+                    "type": "string"
+                },
+                "wrpricetype": {
+                    "description": "价格方式 - 1:固定价 2-浮动价  -   [挂牌]",
+                    "type": "integer"
+                },
+                "wrstandardcode": {
+                    "description": "现货商品代码",
+                    "type": "string"
+                },
+                "wrstandardid": {
+                    "description": "现货商品ID",
+                    "type": "integer"
+                },
+                "wrstandardname": {
+                    "description": "商品名称",
+                    "type": "string"
+                },
+                "wrtradeorderid": {
+                    "description": "仓单贸易委托单ID(320+Unix秒时间戳(10位)+xxxxxx)",
+                    "type": "string"
+                },
+                "wrtradeorderstatus": {
+                    "description": "委托状态 - 1:委托请求 2:待冻结 3:委托成功 4:委托失败 5:配对成功 6:已撤 7:已成 8:成交失败 9:委托拒绝 10:挂牌部分成交 11:仓单生成失败 12:首付扣款失败 13:履约失败 14:撤单解冻贷款失败 15:部成部撤",
+                    "type": "integer"
+                },
+                "wrtradetype": {
+                    "description": "仓单贸易类型 - 1:挂牌 2:摘牌 3:提货卖(文化中国) 4:提货买(文化中国)",
+                    "type": "integer"
+                },
+                "wrtypename": {
+                    "description": "商品",
+                    "type": "string"
+                }
+            }
+        },
         "models.WrTradeDetail": {
             "type": "object",
             "properties": {

+ 147 - 0
docs/swagger.yaml

@@ -13567,6 +13567,109 @@ definitions:
         description: 持有人ID
         type: integer
     type: object
+  models.WrSpecialMatchOrder:
+    properties:
+      amount:
+        description: 金额 = 数量 * 价格
+        type: number
+      buyorsell:
+        description: 买卖 - 0:买 1:卖(挂牌类型 买为采购 卖为销售)
+        type: integer
+      cancelqty:
+        description: 撤销数量
+        type: number
+      deliverygoodscode:
+        description: 品种代码
+        type: string
+      deliverygoodsid:
+        description: 品种ID
+        type: integer
+      deliverygoodsname:
+        description: 品种名称
+        type: string
+      enumdicname:
+        description: 单位名称
+        type: string
+      fixedprice:
+        description: 固定价格(价格)
+        type: number
+      haswr:
+        description: 是否有仓单-卖方 - 0:无仓单 1:有仓单
+        type: integer
+      marketid:
+        description: 市场ID
+        type: integer
+      matchuserid:
+        description: 指定方资金账号(字段名为userid,实际存的是accountid by:邓工)
+        type: integer
+      matchusername:
+        description: 指定方
+        type: string
+      optioncompare:
+        description: 选择项比较串【{选择项ID}+{冒号}+选择项值 } ,逗号分隔,头尾加逗号】-- 所有选择项拼接,用于比较
+        type: string
+      orderqty:
+        description: 委托数量
+        type: number
+      ordertime:
+        description: 委托时间
+        type: string
+      pricemove:
+        description: 升贴水(浮动价时填写)    -   [挂牌]
+        type: number
+      tradedate:
+        description: 交易日(yyyyMMdd)
+        type: string
+      tradeprice:
+        description: 成交价格
+        type: number
+      tradeqty:
+        description: 成交数量
+        type: number
+      userid:
+        description: 用户ID
+        type: integer
+      username:
+        description: 发起方
+        type: string
+      warehouseid:
+        description: 仓库ID
+        type: integer
+      warehousename:
+        description: 仓库名称
+        type: string
+      wrfactortypeid:
+        description: 仓单要素类型ID(212+Unix秒时间戳(10位)+xxxxxx)
+        type: integer
+      wrfactortypename:
+        description: 仓单要素类型名称(选择项要素的名称合并显示,逗号分隔)
+        type: string
+      wrpricetype:
+        description: 价格方式 - 1:固定价 2-浮动价  -   [挂牌]
+        type: integer
+      wrstandardcode:
+        description: 现货商品代码
+        type: string
+      wrstandardid:
+        description: 现货商品ID
+        type: integer
+      wrstandardname:
+        description: 商品名称
+        type: string
+      wrtradeorderid:
+        description: 仓单贸易委托单ID(320+Unix秒时间戳(10位)+xxxxxx)
+        type: string
+      wrtradeorderstatus:
+        description: 委托状态 - 1:委托请求 2:待冻结 3:委托成功 4:委托失败 5:配对成功 6:已撤 7:已成 8:成交失败 9:委托拒绝
+          10:挂牌部分成交 11:仓单生成失败 12:首付扣款失败 13:履约失败 14:撤单解冻贷款失败 15:部成部撤
+        type: integer
+      wrtradetype:
+        description: 仓单贸易类型 - 1:挂牌 2:摘牌 3:提货卖(文化中国) 4:提货买(文化中国)
+        type: integer
+      wrtypename:
+        description: 商品
+        type: string
+    type: object
   models.WrTradeDetail:
     properties:
       accountid:
@@ -22693,6 +22796,50 @@ paths:
       summary: 查询现货(预售)仓单持仓
       tags:
       - 仓单贸易v2
+  /WrTrade2/QueryWrSpecialMatchOrder:
+    get:
+      description: 页面 现货仓单 | 预售仓单 -> 指定成交
+      parameters:
+      - description: 页码
+        in: query
+        name: page
+        type: integer
+      - description: 每页条数
+        in: query
+        name: pagesize
+        type: integer
+      - description: 用户id
+        in: query
+        name: userid
+        required: true
+        type: integer
+      - description: 仓单贸易市场id
+        in: query
+        name: marketid
+        type: integer
+      - description: 是否有仓单 0-没有 1-有(仓单贸易填1,仓单预售填0)
+        in: query
+        name: haswr
+        required: true
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.WrSpecialMatchOrder'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询指定成交
+      tags:
+      - 仓单贸易v2
   /WrTrade2/QueryWrTradeDetail:
     get:
       parameters:

+ 108 - 3
models/wrTrade2.go

@@ -384,8 +384,6 @@ func (r *WrPosition) buildSql() string {
 		// 现货明细 仓单编号 + 品种 + 仓库 + 仓单要素  即全维度 跟库存汇总一样
 		return r.buildSql3()
 	}
-
-	// TODO: 获取履约中的数量
 }
 
 func (r *WrPosition) buildSql1() string {
@@ -571,10 +569,11 @@ func (r *WrOrderDetail) buildSql() string {
 		"    on t.wrtradeorderid = c.wrtradeorderid" +
 		"  left join tmp k" +
 		"    on t.wrfactortypeid = k.wrfactortypeid" +
-		"  where t.WRTRADETYPE = 1"
+		"  where t.WRTRADETYPE = 1 and t.isspecified=0"
 	sqlId.And("t.USERID", r.USERID)
 	sqlId.And("t.haswr", r.HASWR)
 	sqlId.AndEx("t.marketid", r.MARKETID, r.MARKETID > 0)
+	sqlId.Join(" order by t.ORDERTIME desc")
 	sqlId.Page(r.Page, r.PageSize)
 	return sqlId.String()
 }
@@ -661,6 +660,7 @@ func (r *WrTradeDetail) buildSql() string {
 	sqlId.And("ta1.userid", r.USERID)
 	sqlId.And("t.haswr", r.HASWR)
 	sqlId.AndEx("t.marketid", r.MARKETID, r.MARKETID > 0)
+	sqlId.Join(" order by t.tradetime desc")
 	sqlId.Page(r.Page, r.PageSize)
 	return sqlId.String()
 }
@@ -676,3 +676,108 @@ func (r *WrTradeDetail) GetDataByPage() (interface{}, error, int, int, int) {
 	}
 	return sData, err, r.Page, r.PageSize, total
 }
+
+// WrSpecialMatchOrder 指定对手委托
+type WrSpecialMatchOrder struct {
+	HASWR              int32   `json:"haswr"  xorm:"HASWR" form:"haswr"`                   // 是否有仓单-卖方 - 0:无仓单 1:有仓单
+	WRTRADEORDERID     string  `json:"wrtradeorderid"  xorm:"WRTRADEORDERID"`              // 仓单贸易委托单ID(320+Unix秒时间戳(10位)+xxxxxx)
+	TRADEDATE          string  `json:"tradedate"  xorm:"TRADEDATE" form:"tradedate"`       // 交易日(yyyyMMdd)
+	WRTRADETYPE        int32   `json:"wrtradetype"  xorm:"WRTRADETYPE" form:"wrtradetype"` // 仓单贸易类型 - 1:挂牌 2:摘牌 3:提货卖(文化中国) 4:提货买(文化中国)
+	BUYORSELL          int32   `json:"buyorsell"  xorm:"BUYORSELL" form:"buyorsell"`       // 买卖 - 0:买 1:卖(挂牌类型 买为采购 卖为销售)
+	MARKETID           int64   `json:"marketid"  xorm:"MARKETID" form:"marketid"`          // 市场ID
+	USERID             int64   `json:"userid"  xorm:"USERID" form:"userid"`                // 用户ID
+	WRFACTORTYPEID     int64   `json:"wrfactortypeid"  xorm:"WRFACTORTYPEID"`              // 仓单要素类型ID/商品ID(77)
+	ORDERQTY           float64 `json:"orderqty"  xorm:"ORDERQTY" form:"orderqty"`          // 委托数量
+	TRADEQTY           float64 `json:"tradeqty"  xorm:"TRADEQTY" form:"tradeqty"`          // 成交数量
+	CANCELQTY          float64 `json:"cancelqty"  xorm:"CANCELQTY" form:"cancelqty"`       // 撤销数量
+	WRPRICETYPE        int32   `json:"wrpricetype"  xorm:"WRPRICETYPE" form:"wrpricetype"` // 价格方式 - 1:固定价 2-浮动价  -   [挂牌]
+	FIXEDPRICE         float64 `json:"fixedprice"  xorm:"FIXEDPRICE" form:"fixedprice"`    // 固定价格(价格)
+	PRICEMOVE          float64 `json:"pricemove"  xorm:"PRICEMOVE" form:"pricemove"`       // 升贴水(浮动价时填写)    -   [挂牌]
+	TRADEPRICE         float64 `json:"tradeprice"  xorm:"TRADEPRICE" form:"tradeprice"`    // 成交价格
+	ORDERTIME          string  `json:"ordertime"  xorm:"ORDERTIME" form:"ordertime"`       // 委托时间
+	WRTRADEORDERSTATUS int32   `json:"wrtradeorderstatus"  xorm:"WRTRADEORDERSTATUS"`      // 委托状态 - 1:委托请求 2:待冻结 3:委托成功 4:委托失败 5:配对成功 6:已撤 7:已成 8:成交失败 9:委托拒绝 10:挂牌部分成交 11:仓单生成失败 12:首付扣款失败 13:履约失败 14:撤单解冻贷款失败 15:部成部撤
+	USERNAME           string  `json:"username"  xorm:"'USERNAME'"`                        // 发起方
+	MATCHUSERNAME      string  `json:"matchusername"  xorm:"'MATCHUSERNAME'"`              // 指定方
+	MATCHUSERID        int64   `json:"matchuserid"  xorm:"'MATCHUSERID'"`                  // 指定方资金账号(字段名为userid,实际存的是accountid by:邓工)
+	Wr2FactorType      `xorm:"extends"`
+	PageEx             `xorm:"extends"`
+
+	AMOUNT float64 `json:"amount"` // 金额 = 数量 * 价格
+}
+
+func (r *WrSpecialMatchOrder) calc() {
+	r.AMOUNT = r.FIXEDPRICE * r.ORDERQTY
+}
+
+func (r *WrSpecialMatchOrder) buildSql() string {
+	var sqlId utils.SQLVal = "with tmp as" +
+		" (select t.wrfactortypeid," +
+		"         t.wrfactortypename," +
+		"         t.wrstandardid," +
+		"         t.deliverygoodsid," +
+		"         g.deliverygoodscode," +
+		"         g.deliverygoodsname," +
+		"         w.wrstandardcode," +
+		"         w.wrstandardname," +
+		"         h.warehousecode," +
+		"         h.warehousename," +
+		"         e.enumdicname," +
+		"         w.wrstandardname || '-' || t.wrfactortypename as wrtypename" +
+		"    from wrfactortype t" +
+		"    left join deliverygoods g" +
+		"      on t.deliverygoodsid = g.deliverygoodsid" +
+		"    left join wrstandard w" +
+		"      on t.wrstandardid = w.wrstandardid" +
+		"    left join warehouseinfo h" +
+		"      on t.warehouseid = h.autoid" +
+		"    left join enumdicitem e" +
+		"      on w.unitid = e.enumitemname" +
+		"     and e.enumdiccode = 'goodsunit')" +
+		"select t.HASWR," +
+		"       to_char(t.WRTRADEORDERID) WRTRADEORDERID," +
+		"       t.WRTRADETYPE," +
+		"       t.BUYORSELL," +
+		"       t.MARKETID," +
+		"       t.USERID," +
+		"       t.ORDERQTY," +
+		"       t.TRADEQTY," +
+		"       t.CANCELQTY," +
+		"       t.WRPRICETYPE," +
+		"       t.FIXEDPRICE," +
+		"       t.PRICEMOVE," +
+		"       t.TRADEPRICE," +
+		"       to_char(t.ORDERTIME, 'yyyy-mm-dd hh24:mi:ss') ORDERTIME," +
+		"       t.WRTRADEORDERSTATUS," +
+		"       m.matchuserid," +
+		"       u1.accountname username," +
+		"       u2.accountname matchusername," +
+		"       k.*" +
+		"  from wrtrade_orderdetail t" +
+		"  left join WRTrade_MatchDetail m on t.wrtradeorderid=m.wrtradeorderid" +
+		"  left join useraccount u1 on t.userid=u1.userid" +
+		"  left join taaccount ta2 on m.matchuserid=ta2.accountid" +
+		"  left join useraccount u2 on ta2.userid=u2.userid" +
+		"  left join tmp k" +
+		"    on t.wrfactortypeid = k.wrfactortypeid" +
+		" where t.WRTRADETYPE = 1" +
+		"   and t.isspecified = 1" +
+		"   and t.WRTRADEORDERSTATUS = 3"
+	sqlId.And("t.USERID", r.USERID)
+	sqlId.And("t.haswr", r.HASWR)
+	sqlId.AndEx("t.marketid", r.MARKETID, r.MARKETID > 0)
+	sqlId.Join(" order by t.ORDERTIME desc")
+	sqlId.Page(r.Page, r.PageSize)
+	return sqlId.String()
+}
+
+// GetDataEx 获取指定对手委托
+func (r *WrSpecialMatchOrder) GetDataByPage() (interface{}, error, int, int, int) {
+	sData := make([]WrSpecialMatchOrder, 0)
+	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	total := 0
+	for i := range sData {
+		sData[i].calc()
+		total = sData[i].Total
+	}
+	return sData, err, r.Page, r.PageSize, total
+}

+ 1 - 0
routers/router.go

@@ -522,6 +522,7 @@ func InitRouter() *gin.Engine {
 		wrTrade2R.GET("QueryWrPosition", wrTrade2.QueryWrPosition)
 		wrTrade2R.GET("QueryWrOrderDetail", wrTrade2.QueryWrOrderDetail)
 		wrTrade2R.GET("QueryWrTradeDetail", wrTrade2.QueryWrTradeDetail)
+		wrTrade2R.GET("QueryWrSpecialMatchOrder", wrTrade2.QueryWrSpecialMatchOrder)
 	}
 
 	return r