Procházet zdrojové kódy

1.增加查询期现关联记录接口
2.查询议价单接口增加过滤条件
3.查询期现关联单接口增加过滤条件

zou.yingbin před 4 roky
rodič
revize
74463af332

+ 25 - 1
controllers/ermcp3/qryErmcp3.go

@@ -553,11 +553,15 @@ func QueryPaTradeLink(c *gin.Context) {
 // QuerySCMiddleGoods
 // @Summary 查询现货订单
 // @Description 页面 app 现货->期现关联->期现单据关联->点"关联"按钮->弹出界面 : 现货订单
+// @Description 现货编号 即 合同编号
 // @Produce json
 // @Security ApiKeyAuth
 // @Param userid query int true "用户ID(填登录用户的userid)"
-// @Param buyorsell query int true "买卖方向 0-买 1-卖,"
+// @Param buyorsell query int true "买卖方向 0-买 1-卖"
 // @Param goodsgroupid query int true "商品组id"
+// @Param contractno query string false "现货编号(模糊匹配)"
+// @Param customername query string false "对手方(模糊匹配)"
+// @Param wrstandardname query string false "现货商品名称(模糊匹配)"
 // @Success 200 {array} models.Ermcp3SCMiddleGoods
 // @Failure 500 {object} app.Response
 // @Router /Ermcp3/QuerySCMiddleGoods [get]
@@ -568,3 +572,23 @@ func QuerySCMiddleGoods(c *gin.Context) {
 	a.DoBindReq(&m)
 	a.DoGetDataI(&m)
 }
+
+// QueryPaTradeLinkDetail
+// @Summary 查询期现关联记录
+// @Description 页面 app 现货->期现关联->关联记录
+// @Produce json
+// @Security ApiKeyAuth
+// @Param userid query int true "用户ID(填登录用户的userid)"
+// @Param tradeid query string false "期货订单号(模糊匹配)"
+// @Param contractno query string false "现货编号(模糊匹配)"
+// @Param taname query string false "期货账户(模糊匹配)"
+// @Success 200 {array} models.Ermcp3TradeLinkDetail
+// @Failure 500 {object} app.Response
+// @Router /Ermcp3/QueryPaTradeLinkDetail [get]
+// @Tags 企业风险管理v3(app)
+func QueryPaTradeLinkDetail(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	m := models.Ermcp3TradeLinkDetail{}
+	a.DoBindReq(&m)
+	a.DoGetDataI(&m)
+}

+ 2 - 1
controllers/wrTrade2/qryWrTrade.go

@@ -585,10 +585,11 @@ func QueryPermancePlanTmp(c *gin.Context) {
 
 // QueryWrTradeBargainApply
 // @Summary 查询议价单
-// @Description 1.页面 挂单/议价单, 只需传单号就行 2.页面 议价, 查的是作为摘牌方发起的议价单, 参数 userid=登录userid 3. 页面 议价/议价单, 和2类似, 但要指定单号 参数 userid, wrtradeorderid
+// @Description 1.页面 挂单/议价单, 只需传单号就行 <br>2.页面 议价->我的议价 参数 userid=登录userid <br>3.页面 议价->对方议价 填写matchuserid=登录用户id
 // @Produce json
 // @Security ApiKeyAuth
 // @Param userid query int false "议价人id(摘牌方)"
+// @Param matchuserid query int false "挂牌方id(查对方议价时,填写此项)"
 // @Param wrtradeorderid query int false "关联委托单id"
 // @Param haswr query int true "0:仓单预售 1:仓单贸易"
 // @Success 200 {array} models.WRTradeBargainApply

+ 229 - 3
docs/docs.go

@@ -4709,6 +4709,67 @@ var doc = `{
                 }
             }
         },
+        "/Ermcp3/QueryPaTradeLinkDetail": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "description": "页面 app 现货-\u003e期现关联-\u003e关联记录",
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "企业风险管理v3(app)"
+                ],
+                "summary": "查询期现关联记录",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "用户ID(填登录用户的userid)",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "string",
+                        "description": "期货订单号(模糊匹配)",
+                        "name": "tradeid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "现货编号(模糊匹配)",
+                        "name": "contractno",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "期货账户(模糊匹配)",
+                        "name": "taname",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.Ermcp3TradeLinkDetail"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ermcp3/QueryRootUserAccount": {
             "get": {
                 "security": [
@@ -4758,7 +4819,7 @@ var doc = `{
                         "ApiKeyAuth": []
                     }
                 ],
-                "description": "页面 app 现货-\u003e期现关联-\u003e期现单据关联-\u003e点\"关联\"按钮-\u003e弹出界面 : 现货订单",
+                "description": "页面 app 现货-\u003e期现关联-\u003e期现单据关联-\u003e点\"关联\"按钮-\u003e弹出界面 : 现货订单\n现货编号 即 合同编号",
                 "produces": [
                     "application/json"
                 ],
@@ -4776,7 +4837,7 @@ var doc = `{
                     },
                     {
                         "type": "integer",
-                        "description": "买卖方向 0-买 1-卖,",
+                        "description": "买卖方向 0-买 1-卖",
                         "name": "buyorsell",
                         "in": "query",
                         "required": true
@@ -4787,6 +4848,24 @@ var doc = `{
                         "name": "goodsgroupid",
                         "in": "query",
                         "required": true
+                    },
+                    {
+                        "type": "string",
+                        "description": "现货编号(模糊匹配)",
+                        "name": "contractno",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "对手方(模糊匹配)",
+                        "name": "customername",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "现货商品名称(模糊匹配)",
+                        "name": "wrstandardname",
+                        "in": "query"
                     }
                 ],
                 "responses": {
@@ -13133,7 +13212,7 @@ var doc = `{
                         "ApiKeyAuth": []
                     }
                 ],
-                "description": "1.页面 挂单/议价单, 只需传单号就行 2.页面 议价, 查的是作为摘牌方发起的议价单, 参数 userid=登录userid 3. 页面 议价/议价单, 和2类似, 但要指定单号 参数 userid, wrtradeorderid",
+                "description": "1.页面 挂单/议价单, 只需传单号就行 \u003cbr\u003e2.页面 议价-\u003e我的议价 参数 userid=登录userid \u003cbr\u003e3.页面 议价-\u003e对方议价 填写matchuserid=登录用户id",
                 "produces": [
                     "application/json"
                 ],
@@ -13150,6 +13229,12 @@ var doc = `{
                     },
                     {
                         "type": "integer",
+                        "description": "挂牌方id(查对方议价时,填写此项)",
+                        "name": "matchuserid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
                         "description": "关联委托单id",
                         "name": "wrtradeorderid",
                         "in": "query"
@@ -22187,6 +22272,147 @@ var doc = `{
                 }
             }
         },
+        "models.Ermcp3TradeLinkDetail": {
+            "type": "object",
+            "properties": {
+                "accountid": {
+                    "description": "资金账号",
+                    "type": "integer"
+                },
+                "agreeunit": {
+                    "description": "合约乘数",
+                    "type": "number"
+                },
+                "areauserid": {
+                    "description": "所属机构",
+                    "type": "string"
+                },
+                "bizsubjectid": {
+                    "description": "归属业务部门ID - SubjectID",
+                    "type": "string"
+                },
+                "buyorsell": {
+                    "description": "方向 - 0:买 1:卖",
+                    "type": "integer"
+                },
+                "channelbuildtype": {
+                    "description": "委托单据类型 0:无 1:建仓 2:平仓",
+                    "type": "integer"
+                },
+                "contractno": {
+                    "description": "现货编号 (合同编号)",
+                    "type": "string"
+                },
+                "convertratio": {
+                    "description": "折算系数",
+                    "type": "number"
+                },
+                "createtime": {
+                    "description": "关联时间 | 创建时间",
+                    "type": "string"
+                },
+                "creatorid": {
+                    "description": "创建人ID",
+                    "type": "string"
+                },
+                "creatorsrc": {
+                    "description": "创建人来源 - 1:管理端 2:终端 3:交易",
+                    "type": "integer"
+                },
+                "enumdicname": {
+                    "description": "单位名称",
+                    "type": "string"
+                },
+                "goodscode": {
+                    "description": "合约代码",
+                    "type": "string"
+                },
+                "goodsgroupid": {
+                    "description": "对冲品种ID[期货合约商品组ID]",
+                    "type": "integer"
+                },
+                "goodsid": {
+                    "description": "商品ID",
+                    "type": "integer"
+                },
+                "goodsname": {
+                    "description": "合约名称",
+                    "type": "string"
+                },
+                "hedgeflag": {
+                    "description": "业务类型 | 投机套保标志 - 0:无 1:投机 2:套保 3:套利 4:套期保值(平安\\合同) 5:单边(平安) 6:移仓(平安) 7:错单处理(平安) 8:跨期套利(平安) 9:套期保值(计划) 10:套利(合同)  11:换月(合同)  12:交割(金瑞)",
+                    "type": "integer"
+                },
+                "linkdetailid": {
+                    "description": "关联ID(614+Unix秒时间戳(10位)+xxxxxx)",
+                    "type": "string"
+                },
+                "linkstatus": {
+                    "description": "关联状态 - 1:成功 2:失败",
+                    "type": "integer"
+                },
+                "middlegoodsid": {
+                    "description": "套保品种ID",
+                    "type": "integer"
+                },
+                "relatedlot": {
+                    "description": "关联手数",
+                    "type": "number"
+                },
+                "relatedmode": {
+                    "description": "关联方式 - 1:自动关联 2:手动关联 3:解绑关联",
+                    "type": "integer"
+                },
+                "relatedqty": {
+                    "description": "关联数量 = RelatedLot * AgreeUnit * ConvertRatio",
+                    "type": "number"
+                },
+                "retcode": {
+                    "description": "返回码",
+                    "type": "integer"
+                },
+                "saleuserid": {
+                    "description": "业务员ID",
+                    "type": "string"
+                },
+                "spotcontractid": {
+                    "description": "现货合同\\套保计划ID [4,10,11 - 现货合同ID]  [9:套期保值(计划) - 套保计划ID]",
+                    "type": "string"
+                },
+                "taname": {
+                    "description": "期货账户",
+                    "type": "string"
+                },
+                "tradedate": {
+                    "description": "关联交易日(yyyyMMdd)",
+                    "type": "string"
+                },
+                "tradeid": {
+                    "description": "期货订单号 | 内部成交单ID",
+                    "type": "string"
+                },
+                "tradelot": {
+                    "description": "成交数量 | 成交手数",
+                    "type": "integer"
+                },
+                "tradeprice": {
+                    "description": "成交价格",
+                    "type": "number"
+                },
+                "tradetime": {
+                    "description": "期货成交时间",
+                    "type": "string"
+                },
+                "tradetradedate": {
+                    "description": "成交交易日(yyyyMMdd)",
+                    "type": "string"
+                },
+                "username": {
+                    "description": "用户名称",
+                    "type": "string"
+                }
+            }
+        },
         "models.Ermcp3Wrstandard": {
             "type": "object",
             "properties": {

+ 229 - 3
docs/swagger.json

@@ -4693,6 +4693,67 @@
                 }
             }
         },
+        "/Ermcp3/QueryPaTradeLinkDetail": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "description": "页面 app 现货-\u003e期现关联-\u003e关联记录",
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "企业风险管理v3(app)"
+                ],
+                "summary": "查询期现关联记录",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "用户ID(填登录用户的userid)",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "string",
+                        "description": "期货订单号(模糊匹配)",
+                        "name": "tradeid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "现货编号(模糊匹配)",
+                        "name": "contractno",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "期货账户(模糊匹配)",
+                        "name": "taname",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.Ermcp3TradeLinkDetail"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ermcp3/QueryRootUserAccount": {
             "get": {
                 "security": [
@@ -4742,7 +4803,7 @@
                         "ApiKeyAuth": []
                     }
                 ],
-                "description": "页面 app 现货-\u003e期现关联-\u003e期现单据关联-\u003e点\"关联\"按钮-\u003e弹出界面 : 现货订单",
+                "description": "页面 app 现货-\u003e期现关联-\u003e期现单据关联-\u003e点\"关联\"按钮-\u003e弹出界面 : 现货订单\n现货编号 即 合同编号",
                 "produces": [
                     "application/json"
                 ],
@@ -4760,7 +4821,7 @@
                     },
                     {
                         "type": "integer",
-                        "description": "买卖方向 0-买 1-卖,",
+                        "description": "买卖方向 0-买 1-卖",
                         "name": "buyorsell",
                         "in": "query",
                         "required": true
@@ -4771,6 +4832,24 @@
                         "name": "goodsgroupid",
                         "in": "query",
                         "required": true
+                    },
+                    {
+                        "type": "string",
+                        "description": "现货编号(模糊匹配)",
+                        "name": "contractno",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "对手方(模糊匹配)",
+                        "name": "customername",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "现货商品名称(模糊匹配)",
+                        "name": "wrstandardname",
+                        "in": "query"
                     }
                 ],
                 "responses": {
@@ -13117,7 +13196,7 @@
                         "ApiKeyAuth": []
                     }
                 ],
-                "description": "1.页面 挂单/议价单, 只需传单号就行 2.页面 议价, 查的是作为摘牌方发起的议价单, 参数 userid=登录userid 3. 页面 议价/议价单, 和2类似, 但要指定单号 参数 userid, wrtradeorderid",
+                "description": "1.页面 挂单/议价单, 只需传单号就行 \u003cbr\u003e2.页面 议价-\u003e我的议价 参数 userid=登录userid \u003cbr\u003e3.页面 议价-\u003e对方议价 填写matchuserid=登录用户id",
                 "produces": [
                     "application/json"
                 ],
@@ -13134,6 +13213,12 @@
                     },
                     {
                         "type": "integer",
+                        "description": "挂牌方id(查对方议价时,填写此项)",
+                        "name": "matchuserid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
                         "description": "关联委托单id",
                         "name": "wrtradeorderid",
                         "in": "query"
@@ -22171,6 +22256,147 @@
                 }
             }
         },
+        "models.Ermcp3TradeLinkDetail": {
+            "type": "object",
+            "properties": {
+                "accountid": {
+                    "description": "资金账号",
+                    "type": "integer"
+                },
+                "agreeunit": {
+                    "description": "合约乘数",
+                    "type": "number"
+                },
+                "areauserid": {
+                    "description": "所属机构",
+                    "type": "string"
+                },
+                "bizsubjectid": {
+                    "description": "归属业务部门ID - SubjectID",
+                    "type": "string"
+                },
+                "buyorsell": {
+                    "description": "方向 - 0:买 1:卖",
+                    "type": "integer"
+                },
+                "channelbuildtype": {
+                    "description": "委托单据类型 0:无 1:建仓 2:平仓",
+                    "type": "integer"
+                },
+                "contractno": {
+                    "description": "现货编号 (合同编号)",
+                    "type": "string"
+                },
+                "convertratio": {
+                    "description": "折算系数",
+                    "type": "number"
+                },
+                "createtime": {
+                    "description": "关联时间 | 创建时间",
+                    "type": "string"
+                },
+                "creatorid": {
+                    "description": "创建人ID",
+                    "type": "string"
+                },
+                "creatorsrc": {
+                    "description": "创建人来源 - 1:管理端 2:终端 3:交易",
+                    "type": "integer"
+                },
+                "enumdicname": {
+                    "description": "单位名称",
+                    "type": "string"
+                },
+                "goodscode": {
+                    "description": "合约代码",
+                    "type": "string"
+                },
+                "goodsgroupid": {
+                    "description": "对冲品种ID[期货合约商品组ID]",
+                    "type": "integer"
+                },
+                "goodsid": {
+                    "description": "商品ID",
+                    "type": "integer"
+                },
+                "goodsname": {
+                    "description": "合约名称",
+                    "type": "string"
+                },
+                "hedgeflag": {
+                    "description": "业务类型 | 投机套保标志 - 0:无 1:投机 2:套保 3:套利 4:套期保值(平安\\合同) 5:单边(平安) 6:移仓(平安) 7:错单处理(平安) 8:跨期套利(平安) 9:套期保值(计划) 10:套利(合同)  11:换月(合同)  12:交割(金瑞)",
+                    "type": "integer"
+                },
+                "linkdetailid": {
+                    "description": "关联ID(614+Unix秒时间戳(10位)+xxxxxx)",
+                    "type": "string"
+                },
+                "linkstatus": {
+                    "description": "关联状态 - 1:成功 2:失败",
+                    "type": "integer"
+                },
+                "middlegoodsid": {
+                    "description": "套保品种ID",
+                    "type": "integer"
+                },
+                "relatedlot": {
+                    "description": "关联手数",
+                    "type": "number"
+                },
+                "relatedmode": {
+                    "description": "关联方式 - 1:自动关联 2:手动关联 3:解绑关联",
+                    "type": "integer"
+                },
+                "relatedqty": {
+                    "description": "关联数量 = RelatedLot * AgreeUnit * ConvertRatio",
+                    "type": "number"
+                },
+                "retcode": {
+                    "description": "返回码",
+                    "type": "integer"
+                },
+                "saleuserid": {
+                    "description": "业务员ID",
+                    "type": "string"
+                },
+                "spotcontractid": {
+                    "description": "现货合同\\套保计划ID [4,10,11 - 现货合同ID]  [9:套期保值(计划) - 套保计划ID]",
+                    "type": "string"
+                },
+                "taname": {
+                    "description": "期货账户",
+                    "type": "string"
+                },
+                "tradedate": {
+                    "description": "关联交易日(yyyyMMdd)",
+                    "type": "string"
+                },
+                "tradeid": {
+                    "description": "期货订单号 | 内部成交单ID",
+                    "type": "string"
+                },
+                "tradelot": {
+                    "description": "成交数量 | 成交手数",
+                    "type": "integer"
+                },
+                "tradeprice": {
+                    "description": "成交价格",
+                    "type": "number"
+                },
+                "tradetime": {
+                    "description": "期货成交时间",
+                    "type": "string"
+                },
+                "tradetradedate": {
+                    "description": "成交交易日(yyyyMMdd)",
+                    "type": "string"
+                },
+                "username": {
+                    "description": "用户名称",
+                    "type": "string"
+                }
+            }
+        },
         "models.Ermcp3Wrstandard": {
             "type": "object",
             "properties": {

+ 165 - 3
docs/swagger.yaml

@@ -6513,6 +6513,111 @@ definitions:
         description: 账户所属用户ID
         type: integer
     type: object
+  models.Ermcp3TradeLinkDetail:
+    properties:
+      accountid:
+        description: 资金账号
+        type: integer
+      agreeunit:
+        description: 合约乘数
+        type: number
+      areauserid:
+        description: 所属机构
+        type: string
+      bizsubjectid:
+        description: 归属业务部门ID - SubjectID
+        type: string
+      buyorsell:
+        description: 方向 - 0:买 1:卖
+        type: integer
+      channelbuildtype:
+        description: 委托单据类型 0:无 1:建仓 2:平仓
+        type: integer
+      contractno:
+        description: 现货编号 (合同编号)
+        type: string
+      convertratio:
+        description: 折算系数
+        type: number
+      createtime:
+        description: 关联时间 | 创建时间
+        type: string
+      creatorid:
+        description: 创建人ID
+        type: string
+      creatorsrc:
+        description: 创建人来源 - 1:管理端 2:终端 3:交易
+        type: integer
+      enumdicname:
+        description: 单位名称
+        type: string
+      goodscode:
+        description: 合约代码
+        type: string
+      goodsgroupid:
+        description: 对冲品种ID[期货合约商品组ID]
+        type: integer
+      goodsid:
+        description: 商品ID
+        type: integer
+      goodsname:
+        description: 合约名称
+        type: string
+      hedgeflag:
+        description: 业务类型 | 投机套保标志 - 0:无 1:投机 2:套保 3:套利 4:套期保值(平安\合同) 5:单边(平安) 6:移仓(平安) 7:错单处理(平安) 8:跨期套利(平安) 9:套期保值(计划) 10:套利(合同)  11:换月(合同)  12:交割(金瑞)
+        type: integer
+      linkdetailid:
+        description: 关联ID(614+Unix秒时间戳(10位)+xxxxxx)
+        type: string
+      linkstatus:
+        description: 关联状态 - 1:成功 2:失败
+        type: integer
+      middlegoodsid:
+        description: 套保品种ID
+        type: integer
+      relatedlot:
+        description: 关联手数
+        type: number
+      relatedmode:
+        description: 关联方式 - 1:自动关联 2:手动关联 3:解绑关联
+        type: integer
+      relatedqty:
+        description: 关联数量 = RelatedLot * AgreeUnit * ConvertRatio
+        type: number
+      retcode:
+        description: 返回码
+        type: integer
+      saleuserid:
+        description: 业务员ID
+        type: string
+      spotcontractid:
+        description: 现货合同\套保计划ID [4,10,11 - 现货合同ID]  [9:套期保值(计划) - 套保计划ID]
+        type: string
+      taname:
+        description: 期货账户
+        type: string
+      tradedate:
+        description: 关联交易日(yyyyMMdd)
+        type: string
+      tradeid:
+        description: 期货订单号 | 内部成交单ID
+        type: string
+      tradelot:
+        description: 成交数量 | 成交手数
+        type: integer
+      tradeprice:
+        description: 成交价格
+        type: number
+      tradetime:
+        description: 期货成交时间
+        type: string
+      tradetradedate:
+        description: 成交交易日(yyyyMMdd)
+        type: string
+      username:
+        description: 用户名称
+        type: string
+    type: object
   models.Ermcp3Wrstandard:
     properties:
       areauserid:
@@ -21281,6 +21386,45 @@ paths:
       summary: 查询期现单据关联
       tags:
       - 企业风险管理v3(app)
+  /Ermcp3/QueryPaTradeLinkDetail:
+    get:
+      description: 页面 app 现货->期现关联->关联记录
+      parameters:
+      - description: 用户ID(填登录用户的userid)
+        in: query
+        name: userid
+        required: true
+        type: integer
+      - description: 期货订单号(模糊匹配)
+        in: query
+        name: tradeid
+        type: string
+      - description: 现货编号(模糊匹配)
+        in: query
+        name: contractno
+        type: string
+      - description: 期货账户(模糊匹配)
+        in: query
+        name: taname
+        type: string
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.Ermcp3TradeLinkDetail'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询期现关联记录
+      tags:
+      - 企业风险管理v3(app)
   /Ermcp3/QueryRootUserAccount:
     get:
       parameters:
@@ -21309,14 +21453,16 @@ paths:
       - 企业风险管理v3(app)
   /Ermcp3/QuerySCMiddleGoods:
     get:
-      description: '页面 app 现货->期现关联->期现单据关联->点"关联"按钮->弹出界面 : 现货订单'
+      description: |-
+        页面 app 现货->期现关联->期现单据关联->点"关联"按钮->弹出界面 : 现货订单
+        现货编号 即 合同编号
       parameters:
       - description: 用户ID(填登录用户的userid)
         in: query
         name: userid
         required: true
         type: integer
-      - description: 买卖方向 0-买 1-卖,
+      - description: 买卖方向 0-买 1-卖
         in: query
         name: buyorsell
         required: true
@@ -21326,6 +21472,18 @@ paths:
         name: goodsgroupid
         required: true
         type: integer
+      - description: 现货编号(模糊匹配)
+        in: query
+        name: contractno
+        type: string
+      - description: 对手方(模糊匹配)
+        in: query
+        name: customername
+        type: string
+      - description: 现货商品名称(模糊匹配)
+        in: query
+        name: wrstandardname
+        type: string
       produces:
       - application/json
       responses:
@@ -26591,12 +26749,16 @@ paths:
       - 仓单贸易v2
   /WrTrade2/QueryWrTradeBargainApply:
     get:
-      description: 1.页面 挂单/议价单, 只需传单号就行 2.页面 议价, 查的是作为摘牌方发起的议价单, 参数 userid=登录userid 3. 页面 议价/议价单, 和2类似, 但要指定单号 参数 userid, wrtradeorderid
+      description: 1.页面 挂单/议价单, 只需传单号就行 <br>2.页面 议价->我的议价 参数 userid=登录userid <br>3.页面 议价->对方议价 填写matchuserid=登录用户id
       parameters:
       - description: 议价人id(摘牌方)
         in: query
         name: userid
         type: integer
+      - description: 挂牌方id(查对方议价时,填写此项)
+        in: query
+        name: matchuserid
+        type: integer
       - description: 关联委托单id
         in: query
         name: wrtradeorderid

+ 132 - 15
models/ermcp3.go

@@ -2992,21 +2992,21 @@ func (r *Ermcp3PaTradeLink) GetDataEx() (interface{}, error) {
 
 // Ermcp3SCMiddleGoods 业务关联现货订单
 type Ermcp3SCMiddleGoods struct {
-	USERID                int64   `json:"userid"  xorm:"'USERID'" form:"userid"`                 // 用户id
-	CUSTOMERUSERID        int64   `json:"customeruserid"  xorm:"'CUSTOMERUSERID'"`               // 对手id
-	CUSTOMERNAME          string  `json:"customername"  xorm:"'CUSTOMERNAME'"`                   // 对手手名称
-	CONTRACTNO            string  `json:"contractno"  xorm:"'CONTRACTNO'"`                       // 合同编号
-	SPOTCONTRACTID        string  `json:"spotcontractid"  xorm:"'SPOTCONTRACTID'"`               // 合同编号
-	WRSTANDARDID          int64   `json:"wrstandardid"  xorm:"'WRSTANDARDID'"`                   // 现货商品id
-	WRSTANDARDCODE        string  `json:"wrstandardcode"  xorm:"'WRSTANDARDCODE'"`               // 现货商品代码
-	WRSTANDARDNAME        string  `json:"wrstandardname"  xorm:"'WRSTANDARDNAME'"`               // 现货商品名称
-	UNITID                int32   `json:"unitid"  xorm:"'UNITID'"`                               // 现货单位id
-	VATRATE               float64 `json:"vatrate"  xorm:"'VATRATE'"`                             // 增值税率
-	MIDDLEGOODSPRICEDQTY3 float64 `json:"middlegoodspricedqty3"  xorm:"'MIDDLEGOODSPRICEDQTY3'"` // 应套保数量 = MiddleGoodsPricedQty2 *  套保比率
-	PRICEDQTY             float64 `json:"pricedqty"  xorm:"'PRICEDQTY'"`                         // 已关联数量 | 已定价量
-	MIDDLEGOODSID         int64   `json:"middlegoodsid"  xorm:"'MIDDLEGOODSID'"`                 // 套保品种ID
-	NEEDHEDGERATIO        float64 `json:"needhedgeratio"  xorm:"'NEEDHEDGERATIO'"`               // 套保比例
-	CONTRACTTYPE          int     `json:"contracttype"  xorm:"'CONTRACTTYPE'"`                   // 合同类型 1:采购 -1:销售
+	USERID                int64   `json:"userid"  xorm:"'USERID'" form:"userid"`                         // 用户id
+	CUSTOMERUSERID        int64   `json:"customeruserid"  xorm:"'CUSTOMERUSERID'"`                       // 对手id
+	CUSTOMERNAME          string  `json:"customername"  xorm:"'CUSTOMERNAME'" form:"customername"`       // 对手手名称
+	CONTRACTNO            string  `json:"contractno"  xorm:"'CONTRACTNO'" form:"contractno"`             // 合同编号
+	SPOTCONTRACTID        string  `json:"spotcontractid"  xorm:"'SPOTCONTRACTID'"`                       // 合同编号
+	WRSTANDARDID          int64   `json:"wrstandardid"  xorm:"'WRSTANDARDID'"`                           // 现货商品id
+	WRSTANDARDCODE        string  `json:"wrstandardcode"  xorm:"'WRSTANDARDCODE'"`                       // 现货商品代码
+	WRSTANDARDNAME        string  `json:"wrstandardname"  xorm:"'WRSTANDARDNAME'" form:"wrstandardname"` // 现货商品名称
+	UNITID                int32   `json:"unitid"  xorm:"'UNITID'"`                                       // 现货单位id
+	VATRATE               float64 `json:"vatrate"  xorm:"'VATRATE'"`                                     // 增值税率
+	MIDDLEGOODSPRICEDQTY3 float64 `json:"middlegoodspricedqty3"  xorm:"'MIDDLEGOODSPRICEDQTY3'"`         // 应套保数量 = MiddleGoodsPricedQty2 *  套保比率
+	PRICEDQTY             float64 `json:"pricedqty"  xorm:"'PRICEDQTY'"`                                 // 已关联数量 | 已定价量
+	MIDDLEGOODSID         int64   `json:"middlegoodsid"  xorm:"'MIDDLEGOODSID'"`                         // 套保品种ID
+	NEEDHEDGERATIO        float64 `json:"needhedgeratio"  xorm:"'NEEDHEDGERATIO'"`                       // 套保比例
+	CONTRACTTYPE          int     `json:"contracttype"  xorm:"'CONTRACTTYPE'"`                           // 合同类型 1:采购 -1:销售
 
 	BUYORSELL    int32 `json:"-" form:"buyorsell"`    // 买卖方向, 用作筛选
 	GOODSGROUPID int32 `json:"-" form:"goodsgroupid"` // 期货商品组id, 用作筛选
@@ -3064,6 +3064,9 @@ select s.userid,
 	}
 	sqlId.And("s.CONTRACTTYPE", r.CONTRACTTYPE)
 	sqlId.JoinFormat(" and %v in(s.userid, s.tradeuserid, s.saleuserid, s.tradeuserid)", r.USERID)
+	sqlId.AndLike("s.contractno", r.CONTRACTNO)
+	sqlId.AndLike("u1.accountname", r.CUSTOMERNAME)
+	sqlId.AndLike("w.wrstandardname", r.WRSTANDARDNAME)
 
 	return sqlId.String()
 }
@@ -3077,3 +3080,117 @@ func (r *Ermcp3SCMiddleGoods) GetDataEx() (interface{}, error) {
 	}
 	return sData, err
 }
+
+// Ermcp3TradeLinkDetail 期现关联记录
+type Ermcp3TradeLinkDetail struct {
+	LINKDETAILID   string  `json:"linkdetailid"  xorm:"LINKDETAILID" form:"linkdetailid"`       // 关联ID(614+Unix秒时间戳(10位)+xxxxxx)
+	SPOTCONTRACTID string  `json:"spotcontractid"  xorm:"SPOTCONTRACTID" form:"spotcontractid"` // 现货合同\套保计划ID [4,10,11 - 现货合同ID]  [9:套期保值(计划) - 套保计划ID]
+	LINKSTATUS     int32   `json:"linkstatus"  xorm:"LINKSTATUS"`                               // 关联状态 - 1:成功 2:失败
+	RETCODE        int32   `json:"retcode"  xorm:"RETCODE"`                                     // 返回码
+	TRADEID        string  `json:"tradeid"  xorm:"TRADEID" form:"tradeid"`                      // 期货订单号 | 内部成交单ID
+	BUYORSELL      int32   `json:"buyorsell"  xorm:"BUYORSELL"`                                 // 方向 - 0:买 1:卖
+	HEDGEFLAG      int32   `json:"hedgeflag"  xorm:"HEDGEFLAG"`                                 // 业务类型 | 投机套保标志 - 0:无 1:投机 2:套保 3:套利 4:套期保值(平安\合同) 5:单边(平安) 6:移仓(平安) 7:错单处理(平安) 8:跨期套利(平安) 9:套期保值(计划) 10:套利(合同)  11:换月(合同)  12:交割(金瑞)
+	RELATEDLOT     float64 `json:"relatedlot"  xorm:"RELATEDLOT"`                               // 关联手数
+	GOODSID        int32   `json:"goodsid"  xorm:"GOODSID" form:"goodsid"`                      // 商品ID
+	GOODSGROUPID   int32   `json:"goodsgroupid"  xorm:"GOODSGROUPID" form:"goodsgroupid"`       // 对冲品种ID[期货合约商品组ID]
+	MIDDLEGOODSID  int64   `json:"middlegoodsid"  xorm:"MIDDLEGOODSID" form:"middlegoodsid"`    // 套保品种ID
+	RELATEDQTY     float64 `json:"relatedqty"  xorm:"RELATEDQTY"`                               // 关联数量 = RelatedLot * AgreeUnit * ConvertRatio
+	TRADEDATE      string  `json:"tradedate"  xorm:"TRADEDATE" form:"tradedate"`                // 关联交易日(yyyyMMdd)
+	RELATEDMODE    int32   `json:"relatedmode"  xorm:"RELATEDMODE"`                             // 关联方式 - 1:自动关联 2:手动关联 3:解绑关联
+	TRADETRADEDATE string  `json:"tradetradedate"  xorm:"TRADETRADEDATE" form:"tradetradedate"` // 成交交易日(yyyyMMdd)
+	TRADEPRICE     float64 `json:"tradeprice"  xorm:"TRADEPRICE"`                               // 成交价格
+	TRADELOT       int32   `json:"tradelot"  xorm:"TRADELOT"`                                   // 成交数量 | 成交手数
+	SALEUSERID     string  `json:"saleuserid"  xorm:"SALEUSERID" form:"saleuserid"`             // 业务员ID
+	BIZSUBJECTID   string  `json:"bizsubjectid"  xorm:"BIZSUBJECTID" form:"bizsubjectid"`       // 归属业务部门ID - SubjectID
+	AGREEUNIT      float64 `json:"agreeunit"  xorm:"AGREEUNIT"`                                 // 合约乘数
+	CONVERTRATIO   float64 `json:"convertratio"  xorm:"CONVERTRATIO"`                           // 折算系数
+	AREAUSERID     string  `json:"areauserid"  xorm:"AREAUSERID" form:"userid"`                 // 所属机构
+	CREATORSRC     int32   `json:"creatorsrc"  xorm:"CREATORSRC"`                               // 创建人来源 - 1:管理端 2:终端 3:交易
+	CREATORID      string  `json:"creatorid"  xorm:"CREATORID" form:"creatorid"`                // 创建人ID
+	CREATETIME     string  `json:"createtime"  xorm:"CREATETIME"`                               // 关联时间 | 创建时间
+
+	ACCOUNTID        int64  `json:"accountid"  xorm:"'ACCOUNTID'"`                     // 资金账号
+	TRADETIME        string `json:"tradetime"  xorm:"'TRADETIME'"`                     // 期货成交时间
+	CONTRACTNO       string `json:"contractno"  xorm:"'CONTRACTNO'" form:"contractno"` // 现货编号 (合同编号)
+	TANAME           string `json:"taname"  xorm:"'TANAME'" form:"taname"`             // 期货账户
+	USERNAME         string `json:"username"  xorm:"'USERNAME'"`                       // 用户名称
+	GOODSCODE        string `json:"goodscode"  xorm:"'GOODSCODE'"`                     // 合约代码
+	GOODSNAME        string `json:"goodsname"  xorm:"'GOODSNAME'"`                     // 合约名称
+	ENUMDICNAME      string `json:"enumdicname"  xorm:"'ENUMDICNAME'"`                 // 单位名称
+	CHANNELBUILDTYPE int32  `json:"channelbuildtype"  xorm:"'CHANNELBUILDTYPE'"`       // 委托单据类型 0:无 1:建仓 2:平仓
+}
+
+func (r *Ermcp3TradeLinkDetail) calc() {
+
+}
+
+func (r *Ermcp3TradeLinkDetail) buildSql() string {
+	var sqlId utils.SQLVal = `
+select t.LINKSTATUS,
+       t.RETCODE,
+       to_char(t.LINKDETAILID) LINKDETAILID,
+       to_char(t.TRADEID) TRADEID,
+       t.BUYORSELL,
+       t.HEDGEFLAG,
+       t.SPOTCONTRACTID,
+       t.RELATEDLOT,
+       t.GOODSID,
+       t.GOODSGROUPID,
+       t.MIDDLEGOODSID,
+       t.RELATEDQTY,
+       t.TRADEDATE,
+       t.RELATEDMODE,
+       t.TRADETRADEDATE,
+       t.TRADEPRICE,
+       t.TRADELOT,
+       t.SALEUSERID,
+       t.BIZSUBJECTID,
+       t.AGREEUNIT,
+       t.CONVERTRATIO,
+       t.AREAUSERID,
+       t.CREATORSRC,
+       t.CREATORID,
+       to_char(t.CREATETIME, 'yyyy-mm-dd hh24:mi:ss') CREATETIME,
+       k.accountid,
+       to_char(k.tradetime, 'yyyy-mm-dd hh24:mi:ss') tradetime,
+       s.contractno,
+       ta.accountname taname,
+       u.accountname username,
+       g.goodscode,
+       g.goodsname,
+       g.agreeunit,
+       e.enumdicname,
+       k.channelbuildtype
+  from ERMCP_PA_TradeLinkDetail t
+ inner join ermcp_pa_tradelink k
+    on t.tradeid = k.tradeid
+   and t.buyorsell = k.buyorsell
+ inner join ermcp_spotcontract s
+    on t.spotcontractid = s.spotcontractid
+  left join taaccount ta
+    on k.accountid = ta.accountid
+  left join useraccount u
+    on ta.relateduserid = u.userid
+  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
+`
+	sqlId.JoinFormat(" and %v in (ta.relateduserid, ta.userid)", r.AREAUSERID)
+	sqlId.AndLike("t.TRADEID", r.TRADEID)
+	sqlId.AndLike("s.contractno", r.CONTRACTNO)
+	sqlId.AndLike("ta.accountname", r.TANAME)
+	return sqlId.String()
+}
+
+// GetDataEx 获取期现关联记录
+func (r *Ermcp3TradeLinkDetail) GetDataEx() (interface{}, error) {
+	sData := make([]Ermcp3TradeLinkDetail, 0)
+	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	for i := range sData {
+		sData[i].calc()
+	}
+	return sData, err
+}

+ 2 - 0
models/wrTrade2.go

@@ -3490,6 +3490,8 @@ SELECT to_char(t.WRBARGAINID) WRBARGAINID,
 	} else {
 		sqlId.AndEx("t.WRTRADEORDERID", r.WRTRADEORDERID, r.WRTRADEORDERID != "")
 	}
+
+	sqlId.AndEx("t.matchuserid", r.MATCHUSERID, r.MATCHUSERID > 0)
 	sqlId.And("o.haswr", r.HASWR)
 
 	return sqlId.String()

+ 1 - 0
routers/router.go

@@ -443,6 +443,7 @@ func InitRouter() *gin.Engine {
 		ermcp3R.GET("/QueryPaAreaAuditCfg", ermcp3.QueryPaAreaAuditCfg)
 		ermcp3R.GET("/QueryPaTradeLink", ermcp3.QueryPaTradeLink)
 		ermcp3R.GET("/QuerySCMiddleGoods", ermcp3.QuerySCMiddleGoods)
+		ermcp3R.GET("/QueryPaTradeLinkDetail", ermcp3.QueryPaTradeLinkDetail)
 
 		// 报表
 		ermcp3R.GET("/QryReportDaySpotDetail", ermcp3.QryReportDaySpotDetail)