Selaa lähdekoodia

新增获取企业风管期货委托单信息接口

zhou.xiaoning 4 vuotta sitten
vanhempi
commit
0cdc551e13
6 muutettua tiedostoa jossa 902 lisäystä ja 13 poistoa
  1. 36 7
      controllers/ermcp/qryOrder.go
  2. 286 2
      docs/docs.go
  3. 286 2
      docs/swagger.json
  4. 211 2
      docs/swagger.yaml
  5. 81 0
      models/ermcpOrder.go
  6. 2 0
      routers/router.go

+ 36 - 7
controllers/ermcp/qryOrder.go

@@ -29,8 +29,8 @@ type QueryErmcpTradePositionRsp struct {
 	CurTDPositionEnabled int64   `json:"curtdpositionenabled"` // 今仓可用
 	PositionAveragePrice float64 `json:"positionaverageprice"` // 持仓均价【头寸变化更新】= 持仓成本 / 期末头寸 / 合约单位
 	OpenAveragePrice     float64 `json:"openaverageprice" `    // 开仓均价【头寸变化更新】 = 开仓成本 / 期末头寸 / 合约单位
-	PositionPL           float64 `json:"positionpl"`           // 盯市浮盈【实时行情更新】(MTP:浮动盈亏、持仓盈亏) 买方向 = (最新价 - 持仓均价) * 买期末头寸 * 合约单位;卖方向 = (持仓均价 - 最新价) * 期末头寸 * 合约单位
-	OpenPL               float64 `json:"openpl"`               // 逐笔浮盈【实时行情更新】(MTP:开仓盈亏、平仓盈亏) 买方向 = (最新价 - 开仓均价) * 买期末头寸 * 合约单位;卖方向 = (开仓均价 - 最新价) * 期末头寸 * 合约单位
+	PositionPL           float64 `json:"positionpl"`           // 盯市浮盈【实时行情更新】(MTP:浮动盈亏、持仓盈亏) 买方向 = (最新价 - 持仓均价) * 买期末头寸 * 合约单位;卖方向 = (持仓均价 - 最新价) * 期末头寸 * 合约单位
+	OpenPL               float64 `json:"openpl"`               // 逐笔浮盈【实时行情更新】(MTP:开仓盈亏、平仓盈亏) 买方向 = (最新价 - 开仓均价) * 买期末头寸 * 合约单位;卖方向 = (开仓均价 - 最新价) * 期末头寸 * 合约单位
 	PositionPLRate       float64 `json:"positionplrate"`       // 持仓盈亏比例【实时行情更新】 = 持仓盈亏 / 开仓成本
 	UsedMargin           float64 `json:"usedmargin"`           // 占用保证金
 	ExExehangeName       string  `json:"exexchangename"`       // 外部交易所名称
@@ -483,12 +483,41 @@ func QueryErmcpTradePosition(c *gin.Context) {
 	appG.Response(http.StatusOK, e.SUCCESS, rsp)
 }
 
-// QueryErmcpOrderDetailReq 获取企业风管期货委托单信息请求参数
-type QueryErmcpOrderDetailReq struct {
+// QueryErmcpOrderDetailsReq 获取企业风管期货委托单信息请求参数
+type QueryErmcpOrderDetailsReq struct {
 	AccountID int `form:"accountID" binding:"required"`
-	MarketID  int `form:"marketID"`
 }
 
-type QueryErmcpOrderDetailRsp struct {
-	OrderType int `json:"ordertype"` //
+// QueryErmcpOrderDetails 获取企业风管期货委托单信息
+// @Summary 获取企业风管期货委托单信息
+// @Produce json
+// @Security ApiKeyAuth
+// @Param accountID query int true "资金账户ID"
+// @Success 200 {object} models.QueryHedgeInnerOrderDetailRsp
+// @Failure 500 {object} app.Response
+// @Router /Ermcp/QueryErmcpOrderDetails [get]
+// @Tags 企业风险管理(app)
+func QueryErmcpOrderDetails(c *gin.Context) {
+	appG := app.Gin{C: c}
+
+	// 获取请求参数
+	var req QueryErmcpOrderDetailsReq
+	if err := appG.C.ShouldBindQuery(&req); err != nil {
+		logger.GetLogger().Errorf("QueryErmcpOrderDetails failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
+		return
+	}
+
+	// 获取数据
+	rst, err := models.GetHedgeInnerOrderDetails(req.AccountID)
+	if err != nil {
+		// 查询失败
+		logger.GetLogger().Errorf("QueryErmcpOrderDetails failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
+		return
+	}
+
+	// 查询成功返回
+	logger.GetLogger().Debugln("QueryErmcpOrderDetails successed: %v", rst)
+	appG.Response(http.StatusOK, e.SUCCESS, rst)
 }

+ 286 - 2
docs/docs.go

@@ -1657,6 +1657,45 @@ var doc = `{
                 }
             }
         },
+        "/Ermcp/QueryErmcpOrderDetails": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "企业风险管理(app)"
+                ],
+                "summary": "获取企业风管期货委托单信息",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "资金账户ID",
+                        "name": "accountID",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/models.QueryHedgeInnerOrderDetailRsp"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ermcp/QueryErmcpTradePosition": {
             "get": {
                 "security": [
@@ -9519,7 +9558,7 @@ var doc = `{
                     "type": "number"
                 },
                 "openpl": {
-                    "description": "逐笔浮盈【实时行情更新】(MTP:开仓盈亏、平仓盈亏) 买方向 = (最新价 - 开仓均价) * 买期末头寸 * 合约单位;卖方向 = (开仓均价 - 最新价) * 期末头寸 * 合约单位",
+                    "description": "逐笔浮盈【实时行情更新】(MTP:开仓盈亏、平仓盈亏) 买方向 = (最新价 - 开仓均价) * 买期末头寸 * 合约单位;卖方向 = (开仓均价 - 最新价) * 期末头寸 * 合约单位",
                     "type": "number"
                 },
                 "outgoodscode": {
@@ -9535,7 +9574,7 @@ var doc = `{
                     "type": "number"
                 },
                 "positionpl": {
-                    "description": "盯市浮盈【实时行情更新】(MTP:浮动盈亏、持仓盈亏) 买方向 = (最新价 - 持仓均价) * 买期末头寸 * 合约单位;卖方向 = (持仓均价 - 最新价) * 期末头寸 * 合约单位",
+                    "description": "盯市浮盈【实时行情更新】(MTP:浮动盈亏、持仓盈亏) 买方向 = (最新价 - 持仓均价) * 买期末头寸 * 合约单位;卖方向 = (持仓均价 - 最新价) * 期末头寸 * 合约单位",
                     "type": "number"
                 },
                 "positionplrate": {
@@ -14349,6 +14388,251 @@ var doc = `{
                 }
             }
         },
+        "models.QueryHedgeInnerOrderDetailRsp": {
+            "type": "object",
+            "required": [
+                "goodscode",
+                "goodsname"
+            ],
+            "properties": {
+                "accountcurrencyid": {
+                    "description": "账户币种ID",
+                    "type": "integer"
+                },
+                "accountid": {
+                    "description": "账户ID",
+                    "type": "integer"
+                },
+                "buyorsell": {
+                    "description": "买卖 - 0:买 1:卖",
+                    "type": "integer"
+                },
+                "channelbuildtype": {
+                    "description": "开平标志 - 0:无 1:建仓 2:平仓",
+                    "type": "integer"
+                },
+                "channelinnerorderstatus": {
+                    "description": "委托状态 - 1:委托请求 2:冻结成功 3:委托失败 4:委托部成部失败                  5:委托成功 6:全部撤销 7:部成部撤 8:部成部撤部失败 9:全部成交",
+                    "type": "integer"
+                },
+                "channeloperatetype": {
+                    "description": "操作类型 - 1:正常委托 2:斩仓委托 3:强平委托",
+                    "type": "integer"
+                },
+                "channelordersrc": {
+                    "description": "委托来源 -  1:客户端 2:风控服务 3:管理端 4:下单接口平台 5:交易服务 6:跟单服务 7:监控终端",
+                    "type": "integer"
+                },
+                "clientordertime": {
+                    "description": "客户端委托时间",
+                    "type": "string"
+                },
+                "clientticket": {
+                    "description": "客户端流水号",
+                    "type": "string"
+                },
+                "clienttype": {
+                    "description": "客户端类型 - 0:保留为未填终端类型 1:PC管理端 2:PC交易端 3:手机客户端_安卓 4:网页客户端 5:微信客户端 6:手机客户端_苹果 7:网上开户客户端 8:无效终端编号 9:报价终端(中江) 10;监控终端",
+                    "type": "integer"
+                },
+                "closecancelqty": {
+                    "description": "撤单数量",
+                    "type": "integer"
+                },
+                "closechargevalue": {
+                    "description": "平仓手续费设置值",
+                    "type": "number"
+                },
+                "closefailqty": {
+                    "description": "失败数量",
+                    "type": "integer"
+                },
+                "closefeealgorithm": {
+                    "description": "平仓手续费收取方式 1:比率  2:固定",
+                    "type": "integer"
+                },
+                "closeorderqty": {
+                    "description": "委托数量",
+                    "type": "integer"
+                },
+                "closesuccessqty": {
+                    "description": "委托成功数量",
+                    "type": "integer"
+                },
+                "closetradeqty": {
+                    "description": "成交数量",
+                    "type": "integer"
+                },
+                "closetype": {
+                    "description": "平仓方式 - 0:无 1:平今 2:平昨",
+                    "type": "integer"
+                },
+                "curexchangerate": {
+                    "description": "当前汇率",
+                    "type": "number"
+                },
+                "exchangefullname": {
+                    "description": "外部交易所全称",
+                    "type": "string"
+                },
+                "goodscode": {
+                    "description": "商品代码(内部)",
+                    "type": "string"
+                },
+                "goodscurrencyid": {
+                    "description": "商品币种ID",
+                    "type": "integer"
+                },
+                "goodsid": {
+                    "description": "商品ID",
+                    "type": "integer"
+                },
+                "goodsname": {
+                    "description": "商品名称",
+                    "type": "string"
+                },
+                "goodsorderprice": {
+                    "description": "委托价格(商品)",
+                    "type": "number"
+                },
+                "hedgeflag": {
+                    "description": "投机套保标志 - 0:无 1:投机 2:套保 3:套利",
+                    "type": "integer"
+                },
+                "marginalgorithm": {
+                    "description": "保证金收取方式  1:比率  2:固定",
+                    "type": "integer"
+                },
+                "margincurrencyid": {
+                    "description": "保证金币种ID 比率时等于账户币种",
+                    "type": "integer"
+                },
+                "marginrate": {
+                    "description": "保证金汇率-比率时等于1",
+                    "type": "number"
+                },
+                "marginvalue": {
+                    "description": "即市保证金设置值",
+                    "type": "number"
+                },
+                "marketid": {
+                    "description": "市场ID",
+                    "type": "integer"
+                },
+                "opencancelqty": {
+                    "description": "撤单数量",
+                    "type": "integer"
+                },
+                "openchargevalue": {
+                    "description": "建仓手续费设置值",
+                    "type": "number"
+                },
+                "openfailqty": {
+                    "description": "失败数量",
+                    "type": "integer"
+                },
+                "openfeealgorithm": {
+                    "description": "建仓手续费收取方式  1:比率  2:固定",
+                    "type": "integer"
+                },
+                "openfreezecharge": {
+                    "description": "建仓冻结手续费(账户)",
+                    "type": "number"
+                },
+                "openfreezecharge2": {
+                    "description": "建仓冻结手续费(商品)",
+                    "type": "number"
+                },
+                "openfreezemargin": {
+                    "description": "冻结保证金(冻结交易金额)",
+                    "type": "number"
+                },
+                "openfreezemargin2": {
+                    "description": "建仓冻结保证金(保证金/商品)",
+                    "type": "number"
+                },
+                "openorderqty": {
+                    "description": "委托数量",
+                    "type": "integer"
+                },
+                "opensuccessqty": {
+                    "description": "建仓委托成功数量",
+                    "type": "integer"
+                },
+                "opentradeqty": {
+                    "description": "成交数量",
+                    "type": "integer"
+                },
+                "openunfreezecharge": {
+                    "description": "建仓解冻手续费(账户)",
+                    "type": "number"
+                },
+                "openunfreezecharge2": {
+                    "description": "建仓解冻手续费(商品)",
+                    "type": "number"
+                },
+                "openunfreezemargin": {
+                    "description": "解冻保证金",
+                    "type": "number"
+                },
+                "openunfreezemargin2": {
+                    "description": "建仓解冻保证金(保证金/商品)",
+                    "type": "number"
+                },
+                "operatorid": {
+                    "description": "登录账号(LoginID)",
+                    "type": "integer"
+                },
+                "orderid": {
+                    "description": "委托单号(107+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)",
+                    "type": "string"
+                },
+                "orderprice": {
+                    "description": "委托价格(账户)",
+                    "type": "number"
+                },
+                "ordertime": {
+                    "description": "委托时间",
+                    "type": "string"
+                },
+                "parentaccountid": {
+                    "description": "所属母账户",
+                    "type": "integer"
+                },
+                "pricemode": {
+                    "description": "取价方式 - 1:市价 2: 限价",
+                    "type": "integer"
+                },
+                "retcode": {
+                    "description": "错误代码",
+                    "type": "integer"
+                },
+                "sessionid": {
+                    "description": "会话ID",
+                    "type": "integer"
+                },
+                "tradedate": {
+                    "description": "交易日(yyyyMMdd)",
+                    "type": "string"
+                },
+                "updatetime": {
+                    "description": "更新时间",
+                    "type": "string"
+                },
+                "uuid": {
+                    "description": "发起端唯一id",
+                    "type": "string"
+                },
+                "validtime": {
+                    "description": "有效期限",
+                    "type": "string"
+                },
+                "validtype": {
+                    "description": "有效类型 - 1当日有效",
+                    "type": "integer"
+                }
+            }
+        },
         "models.QuotePrimaryMenu": {
             "type": "object",
             "properties": {

+ 286 - 2
docs/swagger.json

@@ -1641,6 +1641,45 @@
                 }
             }
         },
+        "/Ermcp/QueryErmcpOrderDetails": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "企业风险管理(app)"
+                ],
+                "summary": "获取企业风管期货委托单信息",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "资金账户ID",
+                        "name": "accountID",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/models.QueryHedgeInnerOrderDetailRsp"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ermcp/QueryErmcpTradePosition": {
             "get": {
                 "security": [
@@ -9503,7 +9542,7 @@
                     "type": "number"
                 },
                 "openpl": {
-                    "description": "逐笔浮盈【实时行情更新】(MTP:开仓盈亏、平仓盈亏) 买方向 = (最新价 - 开仓均价) * 买期末头寸 * 合约单位;卖方向 = (开仓均价 - 最新价) * 期末头寸 * 合约单位",
+                    "description": "逐笔浮盈【实时行情更新】(MTP:开仓盈亏、平仓盈亏) 买方向 = (最新价 - 开仓均价) * 买期末头寸 * 合约单位;卖方向 = (开仓均价 - 最新价) * 期末头寸 * 合约单位",
                     "type": "number"
                 },
                 "outgoodscode": {
@@ -9519,7 +9558,7 @@
                     "type": "number"
                 },
                 "positionpl": {
-                    "description": "盯市浮盈【实时行情更新】(MTP:浮动盈亏、持仓盈亏) 买方向 = (最新价 - 持仓均价) * 买期末头寸 * 合约单位;卖方向 = (持仓均价 - 最新价) * 期末头寸 * 合约单位",
+                    "description": "盯市浮盈【实时行情更新】(MTP:浮动盈亏、持仓盈亏) 买方向 = (最新价 - 持仓均价) * 买期末头寸 * 合约单位;卖方向 = (持仓均价 - 最新价) * 期末头寸 * 合约单位",
                     "type": "number"
                 },
                 "positionplrate": {
@@ -14333,6 +14372,251 @@
                 }
             }
         },
+        "models.QueryHedgeInnerOrderDetailRsp": {
+            "type": "object",
+            "required": [
+                "goodscode",
+                "goodsname"
+            ],
+            "properties": {
+                "accountcurrencyid": {
+                    "description": "账户币种ID",
+                    "type": "integer"
+                },
+                "accountid": {
+                    "description": "账户ID",
+                    "type": "integer"
+                },
+                "buyorsell": {
+                    "description": "买卖 - 0:买 1:卖",
+                    "type": "integer"
+                },
+                "channelbuildtype": {
+                    "description": "开平标志 - 0:无 1:建仓 2:平仓",
+                    "type": "integer"
+                },
+                "channelinnerorderstatus": {
+                    "description": "委托状态 - 1:委托请求 2:冻结成功 3:委托失败 4:委托部成部失败                  5:委托成功 6:全部撤销 7:部成部撤 8:部成部撤部失败 9:全部成交",
+                    "type": "integer"
+                },
+                "channeloperatetype": {
+                    "description": "操作类型 - 1:正常委托 2:斩仓委托 3:强平委托",
+                    "type": "integer"
+                },
+                "channelordersrc": {
+                    "description": "委托来源 -  1:客户端 2:风控服务 3:管理端 4:下单接口平台 5:交易服务 6:跟单服务 7:监控终端",
+                    "type": "integer"
+                },
+                "clientordertime": {
+                    "description": "客户端委托时间",
+                    "type": "string"
+                },
+                "clientticket": {
+                    "description": "客户端流水号",
+                    "type": "string"
+                },
+                "clienttype": {
+                    "description": "客户端类型 - 0:保留为未填终端类型 1:PC管理端 2:PC交易端 3:手机客户端_安卓 4:网页客户端 5:微信客户端 6:手机客户端_苹果 7:网上开户客户端 8:无效终端编号 9:报价终端(中江) 10;监控终端",
+                    "type": "integer"
+                },
+                "closecancelqty": {
+                    "description": "撤单数量",
+                    "type": "integer"
+                },
+                "closechargevalue": {
+                    "description": "平仓手续费设置值",
+                    "type": "number"
+                },
+                "closefailqty": {
+                    "description": "失败数量",
+                    "type": "integer"
+                },
+                "closefeealgorithm": {
+                    "description": "平仓手续费收取方式 1:比率  2:固定",
+                    "type": "integer"
+                },
+                "closeorderqty": {
+                    "description": "委托数量",
+                    "type": "integer"
+                },
+                "closesuccessqty": {
+                    "description": "委托成功数量",
+                    "type": "integer"
+                },
+                "closetradeqty": {
+                    "description": "成交数量",
+                    "type": "integer"
+                },
+                "closetype": {
+                    "description": "平仓方式 - 0:无 1:平今 2:平昨",
+                    "type": "integer"
+                },
+                "curexchangerate": {
+                    "description": "当前汇率",
+                    "type": "number"
+                },
+                "exchangefullname": {
+                    "description": "外部交易所全称",
+                    "type": "string"
+                },
+                "goodscode": {
+                    "description": "商品代码(内部)",
+                    "type": "string"
+                },
+                "goodscurrencyid": {
+                    "description": "商品币种ID",
+                    "type": "integer"
+                },
+                "goodsid": {
+                    "description": "商品ID",
+                    "type": "integer"
+                },
+                "goodsname": {
+                    "description": "商品名称",
+                    "type": "string"
+                },
+                "goodsorderprice": {
+                    "description": "委托价格(商品)",
+                    "type": "number"
+                },
+                "hedgeflag": {
+                    "description": "投机套保标志 - 0:无 1:投机 2:套保 3:套利",
+                    "type": "integer"
+                },
+                "marginalgorithm": {
+                    "description": "保证金收取方式  1:比率  2:固定",
+                    "type": "integer"
+                },
+                "margincurrencyid": {
+                    "description": "保证金币种ID 比率时等于账户币种",
+                    "type": "integer"
+                },
+                "marginrate": {
+                    "description": "保证金汇率-比率时等于1",
+                    "type": "number"
+                },
+                "marginvalue": {
+                    "description": "即市保证金设置值",
+                    "type": "number"
+                },
+                "marketid": {
+                    "description": "市场ID",
+                    "type": "integer"
+                },
+                "opencancelqty": {
+                    "description": "撤单数量",
+                    "type": "integer"
+                },
+                "openchargevalue": {
+                    "description": "建仓手续费设置值",
+                    "type": "number"
+                },
+                "openfailqty": {
+                    "description": "失败数量",
+                    "type": "integer"
+                },
+                "openfeealgorithm": {
+                    "description": "建仓手续费收取方式  1:比率  2:固定",
+                    "type": "integer"
+                },
+                "openfreezecharge": {
+                    "description": "建仓冻结手续费(账户)",
+                    "type": "number"
+                },
+                "openfreezecharge2": {
+                    "description": "建仓冻结手续费(商品)",
+                    "type": "number"
+                },
+                "openfreezemargin": {
+                    "description": "冻结保证金(冻结交易金额)",
+                    "type": "number"
+                },
+                "openfreezemargin2": {
+                    "description": "建仓冻结保证金(保证金/商品)",
+                    "type": "number"
+                },
+                "openorderqty": {
+                    "description": "委托数量",
+                    "type": "integer"
+                },
+                "opensuccessqty": {
+                    "description": "建仓委托成功数量",
+                    "type": "integer"
+                },
+                "opentradeqty": {
+                    "description": "成交数量",
+                    "type": "integer"
+                },
+                "openunfreezecharge": {
+                    "description": "建仓解冻手续费(账户)",
+                    "type": "number"
+                },
+                "openunfreezecharge2": {
+                    "description": "建仓解冻手续费(商品)",
+                    "type": "number"
+                },
+                "openunfreezemargin": {
+                    "description": "解冻保证金",
+                    "type": "number"
+                },
+                "openunfreezemargin2": {
+                    "description": "建仓解冻保证金(保证金/商品)",
+                    "type": "number"
+                },
+                "operatorid": {
+                    "description": "登录账号(LoginID)",
+                    "type": "integer"
+                },
+                "orderid": {
+                    "description": "委托单号(107+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)",
+                    "type": "string"
+                },
+                "orderprice": {
+                    "description": "委托价格(账户)",
+                    "type": "number"
+                },
+                "ordertime": {
+                    "description": "委托时间",
+                    "type": "string"
+                },
+                "parentaccountid": {
+                    "description": "所属母账户",
+                    "type": "integer"
+                },
+                "pricemode": {
+                    "description": "取价方式 - 1:市价 2: 限价",
+                    "type": "integer"
+                },
+                "retcode": {
+                    "description": "错误代码",
+                    "type": "integer"
+                },
+                "sessionid": {
+                    "description": "会话ID",
+                    "type": "integer"
+                },
+                "tradedate": {
+                    "description": "交易日(yyyyMMdd)",
+                    "type": "string"
+                },
+                "updatetime": {
+                    "description": "更新时间",
+                    "type": "string"
+                },
+                "uuid": {
+                    "description": "发起端唯一id",
+                    "type": "string"
+                },
+                "validtime": {
+                    "description": "有效期限",
+                    "type": "string"
+                },
+                "validtype": {
+                    "description": "有效类型 - 1当日有效",
+                    "type": "integer"
+                }
+            }
+        },
         "models.QuotePrimaryMenu": {
             "type": "object",
             "properties": {

+ 211 - 2
docs/swagger.yaml

@@ -2551,7 +2551,7 @@ definitions:
         type: number
       openpl:
         description: 逐笔浮盈【实时行情更新】(MTP:开仓盈亏、平仓盈亏) 买方向 = (最新价 - 开仓均价) * 买期末头寸 * 合约单位;卖方向
-          = (开仓均价 - 最新价) * 期末头寸 * 合约单位
+          = (开仓均价 - 最新价) * 期末头寸 * 合约单位
         type: number
       outgoodscode:
         description: 商品代码(外部)
@@ -2564,7 +2564,7 @@ definitions:
         type: number
       positionpl:
         description: 盯市浮盈【实时行情更新】(MTP:浮动盈亏、持仓盈亏) 买方向 = (最新价 - 持仓均价) * 买期末头寸 * 合约单位;卖方向
-          = (持仓均价 - 最新价) * 期末头寸 * 合约单位
+          = (持仓均价 - 最新价) * 期末头寸 * 合约单位
         type: number
       positionplrate:
         description: 持仓盈亏比例【实时行情更新】 = 持仓盈亏 / 开仓成本
@@ -6177,6 +6177,191 @@ definitions:
     required:
     - errorid
     type: object
+  models.QueryHedgeInnerOrderDetailRsp:
+    properties:
+      accountcurrencyid:
+        description: 账户币种ID
+        type: integer
+      accountid:
+        description: 账户ID
+        type: integer
+      buyorsell:
+        description: 买卖 - 0:买 1:卖
+        type: integer
+      channelbuildtype:
+        description: 开平标志 - 0:无 1:建仓 2:平仓
+        type: integer
+      channelinnerorderstatus:
+        description: 委托状态 - 1:委托请求 2:冻结成功 3:委托失败 4:委托部成部失败                  5:委托成功
+          6:全部撤销 7:部成部撤 8:部成部撤部失败 9:全部成交
+        type: integer
+      channeloperatetype:
+        description: 操作类型 - 1:正常委托 2:斩仓委托 3:强平委托
+        type: integer
+      channelordersrc:
+        description: 委托来源 -  1:客户端 2:风控服务 3:管理端 4:下单接口平台 5:交易服务 6:跟单服务 7:监控终端
+        type: integer
+      clientordertime:
+        description: 客户端委托时间
+        type: string
+      clientticket:
+        description: 客户端流水号
+        type: string
+      clienttype:
+        description: 客户端类型 - 0:保留为未填终端类型 1:PC管理端 2:PC交易端 3:手机客户端_安卓 4:网页客户端 5:微信客户端
+          6:手机客户端_苹果 7:网上开户客户端 8:无效终端编号 9:报价终端(中江) 10;监控终端
+        type: integer
+      closecancelqty:
+        description: 撤单数量
+        type: integer
+      closechargevalue:
+        description: 平仓手续费设置值
+        type: number
+      closefailqty:
+        description: 失败数量
+        type: integer
+      closefeealgorithm:
+        description: 平仓手续费收取方式 1:比率  2:固定
+        type: integer
+      closeorderqty:
+        description: 委托数量
+        type: integer
+      closesuccessqty:
+        description: 委托成功数量
+        type: integer
+      closetradeqty:
+        description: 成交数量
+        type: integer
+      closetype:
+        description: 平仓方式 - 0:无 1:平今 2:平昨
+        type: integer
+      curexchangerate:
+        description: 当前汇率
+        type: number
+      exchangefullname:
+        description: 外部交易所全称
+        type: string
+      goodscode:
+        description: 商品代码(内部)
+        type: string
+      goodscurrencyid:
+        description: 商品币种ID
+        type: integer
+      goodsid:
+        description: 商品ID
+        type: integer
+      goodsname:
+        description: 商品名称
+        type: string
+      goodsorderprice:
+        description: 委托价格(商品)
+        type: number
+      hedgeflag:
+        description: 投机套保标志 - 0:无 1:投机 2:套保 3:套利
+        type: integer
+      marginalgorithm:
+        description: 保证金收取方式  1:比率  2:固定
+        type: integer
+      margincurrencyid:
+        description: 保证金币种ID 比率时等于账户币种
+        type: integer
+      marginrate:
+        description: 保证金汇率-比率时等于1
+        type: number
+      marginvalue:
+        description: 即市保证金设置值
+        type: number
+      marketid:
+        description: 市场ID
+        type: integer
+      opencancelqty:
+        description: 撤单数量
+        type: integer
+      openchargevalue:
+        description: 建仓手续费设置值
+        type: number
+      openfailqty:
+        description: 失败数量
+        type: integer
+      openfeealgorithm:
+        description: 建仓手续费收取方式  1:比率  2:固定
+        type: integer
+      openfreezecharge:
+        description: 建仓冻结手续费(账户)
+        type: number
+      openfreezecharge2:
+        description: 建仓冻结手续费(商品)
+        type: number
+      openfreezemargin:
+        description: 冻结保证金(冻结交易金额)
+        type: number
+      openfreezemargin2:
+        description: 建仓冻结保证金(保证金/商品)
+        type: number
+      openorderqty:
+        description: 委托数量
+        type: integer
+      opensuccessqty:
+        description: 建仓委托成功数量
+        type: integer
+      opentradeqty:
+        description: 成交数量
+        type: integer
+      openunfreezecharge:
+        description: 建仓解冻手续费(账户)
+        type: number
+      openunfreezecharge2:
+        description: 建仓解冻手续费(商品)
+        type: number
+      openunfreezemargin:
+        description: 解冻保证金
+        type: number
+      openunfreezemargin2:
+        description: 建仓解冻保证金(保证金/商品)
+        type: number
+      operatorid:
+        description: 登录账号(LoginID)
+        type: integer
+      orderid:
+        description: 委托单号(107+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
+        type: string
+      orderprice:
+        description: 委托价格(账户)
+        type: number
+      ordertime:
+        description: 委托时间
+        type: string
+      parentaccountid:
+        description: 所属母账户
+        type: integer
+      pricemode:
+        description: '取价方式 - 1:市价 2: 限价'
+        type: integer
+      retcode:
+        description: 错误代码
+        type: integer
+      sessionid:
+        description: 会话ID
+        type: integer
+      tradedate:
+        description: 交易日(yyyyMMdd)
+        type: string
+      updatetime:
+        description: 更新时间
+        type: string
+      uuid:
+        description: 发起端唯一id
+        type: string
+      validtime:
+        description: 有效期限
+        type: string
+      validtype:
+        description: 有效类型 - 1当日有效
+        type: integer
+    required:
+    - goodscode
+    - goodsname
+    type: object
   models.QuotePrimaryMenu:
     properties:
       Index:
@@ -9765,6 +9950,30 @@ paths:
       summary: 查询合同(采购和销售)
       tags:
       - 企业风险管理(app)
+  /Ermcp/QueryErmcpOrderDetails:
+    get:
+      parameters:
+      - description: 资金账户ID
+        in: query
+        name: accountID
+        required: true
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/models.QueryHedgeInnerOrderDetailRsp'
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 获取企业风管期货委托单信息
+      tags:
+      - 企业风险管理(app)
   /Ermcp/QueryErmcpTradePosition:
     get:
       description: 本接口只使用于通道交易相关头寸查询;子账户持仓头寸占用保证金为0;

+ 81 - 0
models/ermcpOrder.go

@@ -284,3 +284,84 @@ func GetHedgeInnerHolderDetails(goodsID, buyOrSell int) ([]Hedgeinnerholderdetai
 
 	return hedgeInnerHolderDetails, nil
 }
+
+// QueryHedgeInnerOrderDetailRsp 企业风管内部委托单查询返回模型
+type QueryHedgeInnerOrderDetailRsp struct {
+	Orderid                 string    `json:"orderid"  xorm:"'ORDERIDSTR'"`                              // 委托单号(107+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
+	Tradedate               string    `json:"tradedate"  xorm:"'TRADEDATE'"`                             // 交易日(yyyyMMdd)
+	Channelbuildtype        int32     `json:"channelbuildtype"  xorm:"'CHANNELBUILDTYPE'"`               // 开平标志 - 0:无 1:建仓 2:平仓
+	Closetype               int32     `json:"closetype"  xorm:"'CLOSETYPE'"`                             // 平仓方式 - 0:无 1:平今 2:平昨
+	Hedgeflag               int32     `json:"hedgeflag"  xorm:"'HEDGEFLAG'"`                             // 投机套保标志 - 0:无 1:投机 2:套保 3:套利
+	Marketid                int32     `json:"marketid"  xorm:"'MARKETID'"`                               // 市场ID
+	Goodsid                 int32     `json:"goodsid"  xorm:"'GOODSID'"`                                 // 商品ID
+	Accountid               int64     `json:"accountid"  xorm:"'ACCOUNTID'"`                             // 账户ID
+	Buyorsell               int32     `json:"buyorsell"  xorm:"'BUYORSELL'"`                             // 买卖 - 0:买 1:卖
+	Pricemode               int32     `json:"pricemode"  xorm:"'PRICEMODE'"`                             // 取价方式 - 1:市价 2: 限价
+	Orderprice              float64   `json:"orderprice"  xorm:"'ORDERPRICE'"`                           // 委托价格(账户)
+	Openorderqty            int64     `json:"openorderqty"  xorm:"'OPENORDERQTY'"`                       // 委托数量
+	Opentradeqty            int64     `json:"opentradeqty"  xorm:"'OPENTRADEQTY'"`                       // 成交数量
+	Opencancelqty           int64     `json:"opencancelqty"  xorm:"'OPENCANCELQTY'"`                     // 撤单数量
+	Openfailqty             int64     `json:"openfailqty"  xorm:"'OPENFAILQTY'"`                         // 失败数量
+	Opensuccessqty          int64     `json:"opensuccessqty"  xorm:"'OPENSUCCESSQTY'"`                   // 建仓委托成功数量
+	Closeorderqty           int64     `json:"closeorderqty"  xorm:"'CLOSEORDERQTY'"`                     // 委托数量
+	Closetradeqty           int64     `json:"closetradeqty"  xorm:"'CLOSETRADEQTY'"`                     // 成交数量
+	Closecancelqty          int64     `json:"closecancelqty"  xorm:"'CLOSECANCELQTY'"`                   // 撤单数量
+	Closefailqty            int64     `json:"closefailqty"  xorm:"'CLOSEFAILQTY'"`                       // 失败数量
+	Closesuccessqty         int64     `json:"closesuccessqty"  xorm:"'CLOSESUCCESSQTY'"`                 // 委托成功数量
+	Openfreezemargin        float64   `json:"openfreezemargin"  xorm:"'OPENFREEZEMARGIN'"`               // 冻结保证金(冻结交易金额)
+	Openunfreezemargin      float64   `json:"openunfreezemargin"  xorm:"'OPENUNFREEZEMARGIN'"`           // 解冻保证金
+	Openfreezecharge        float64   `json:"openfreezecharge"  xorm:"'OPENFREEZECHARGE'"`               // 建仓冻结手续费(账户)
+	Openunfreezecharge      float64   `json:"openunfreezecharge"  xorm:"'OPENUNFREEZECHARGE'"`           // 建仓解冻手续费(账户)
+	Validtype               int32     `json:"validtype"  xorm:"'VALIDTYPE'"`                             // 有效类型 - 1当日有效
+	Validtime               time.Time `json:"validtime"  xorm:"'VALIDTIME'"`                             // 有效期限
+	Channeloperatetype      int32     `json:"channeloperatetype"  xorm:"'CHANNELOPERATETYPE'"`           // 操作类型 - 1:正常委托 2:斩仓委托 3:强平委托
+	Ordertime               time.Time `json:"ordertime"  xorm:"'ORDERTIME'"`                             // 委托时间
+	Channelordersrc         int32     `json:"channelordersrc"  xorm:"'CHANNELORDERSRC'"`                 // 委托来源 -  1:客户端 2:风控服务 3:管理端 4:下单接口平台 5:交易服务 6:跟单服务 7:监控终端
+	Channelinnerorderstatus int32     `json:"channelinnerorderstatus"  xorm:"'CHANNELINNERORDERSTATUS'"` // 委托状态 - 1:委托请求 2:冻结成功 3:委托失败 4:委托部成部失败                  5:委托成功 6:全部撤销 7:部成部撤 8:部成部撤部失败 9:全部成交
+	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              int32     `json:"clienttype"  xorm:"'CLIENTTYPE'"`                           // 客户端类型 - 0:保留为未填终端类型 1:PC管理端 2:PC交易端 3:手机客户端_安卓 4:网页客户端 5:微信客户端 6:手机客户端_苹果 7:网上开户客户端 8:无效终端编号 9:报价终端(中江) 10;监控终端
+	Retcode                 int32     `json:"retcode"  xorm:"'RETCODE'"`                                 // 错误代码
+	Marginalgorithm         int32     `json:"marginalgorithm"  xorm:"'MARGINALGORITHM'"`                 // 保证金收取方式  1:比率  2:固定
+	Marginvalue             float64   `json:"marginvalue"  xorm:"'MARGINVALUE'"`                         // 即市保证金设置值
+	Openfeealgorithm        int32     `json:"openfeealgorithm"  xorm:"'OPENFEEALGORITHM'"`               // 建仓手续费收取方式  1:比率  2:固定
+	Openchargevalue         float64   `json:"openchargevalue"  xorm:"'OPENCHARGEVALUE'"`                 // 建仓手续费设置值
+	Closefeealgorithm       int32     `json:"closefeealgorithm"  xorm:"'CLOSEFEEALGORITHM'"`             // 平仓手续费收取方式 1:比率  2:固定
+	Closechargevalue        float64   `json:"closechargevalue"  xorm:"'CLOSECHARGEVALUE'"`               // 平仓手续费设置值
+	Accountcurrencyid       int32     `json:"accountcurrencyid"  xorm:"'ACCOUNTCURRENCYID'"`             // 账户币种ID
+	Goodscurrencyid         int32     `json:"goodscurrencyid"  xorm:"'GOODSCURRENCYID'"`                 // 商品币种ID
+	Margincurrencyid        int32     `json:"margincurrencyid"  xorm:"'MARGINCURRENCYID'"`               // 保证金币种ID 比率时等于账户币种
+	Marginrate              float64   `json:"marginrate"  xorm:"'MARGINRATE'"`                           // 保证金汇率-比率时等于1
+	Curexchangerate         float64   `json:"curexchangerate"  xorm:"'CUREXCHANGERATE'"`                 // 当前汇率
+	Goodsorderprice         float64   `json:"goodsorderprice"  xorm:"'GOODSORDERPRICE'"`                 // 委托价格(商品)
+	Openfreezemargin2       float64   `json:"openfreezemargin2"  xorm:"'OPENFREEZEMARGIN2'"`             // 建仓冻结保证金(保证金/商品)
+	Openfreezecharge2       float64   `json:"openfreezecharge2"  xorm:"'OPENFREEZECHARGE2'"`             // 建仓冻结手续费(商品)
+	Openunfreezemargin2     float64   `json:"openunfreezemargin2"  xorm:"'OPENUNFREEZEMARGIN2'"`         // 建仓解冻保证金(保证金/商品)
+	Openunfreezecharge2     float64   `json:"openunfreezecharge2"  xorm:"'OPENUNFREEZECHARGE2'"`         // 建仓解冻手续费(商品)
+	Parentaccountid         int64     `json:"parentaccountid"  xorm:"'PARENTACCOUNTID'"`                 // 所属母账户
+	Sessionid               int64     `json:"sessionid"  xorm:"'SESSIONID'"`                             // 会话ID
+
+	Goodscode string `json:"goodscode"  xorm:"'GOODSCODE'" binding:"required"` // 商品代码(内部)
+	Goodsname string `json:"goodsname"  xorm:"'GOODSNAME'" binding:"required"` // 商品名称
+
+	Exchangefullname string `json:"exchangefullname"  xorm:"'EXCHANGEFULLNAME'"` // 外部交易所全称
+}
+
+// GetHedgeInnerOrderDetails 获取指定资金账号的通道交易内部委托单信息
+func GetHedgeInnerOrderDetails(accountID int) ([]QueryHedgeInnerOrderDetailRsp, error) {
+	hedgeInnerOrderDetails := make([]QueryHedgeInnerOrderDetailRsp, 0)
+	if err := db.GetEngine().Table("HEDGE_INNERORDERDETAIL T").
+		Select("to_char(T.ORDERID) ORDERIDSTR, T.*, EX.EXCHANGEFULLNAME").
+		Join("LEFT", "GOODS G", "G.GOODSID = T.GOODSID").
+		Join("LEFT", "GOODSGROUP GG", "GG.GOODSGROUPID = G.GOODSGROUPID").
+		Join("LEFT", "EXTERNALEXCHANGE EX", "GG.EXEXCHANGEID = EX.AUTOID").
+		Where("T.ACCOUNTID = ?", accountID).Desc("T.ORDERTIME").
+		Find(&hedgeInnerOrderDetails); err != nil {
+		return nil, err
+	}
+
+	return hedgeInnerOrderDetails, nil
+}

+ 2 - 0
routers/router.go

@@ -363,6 +363,8 @@ func InitRouter() *gin.Engine {
 		ermcpR.GET("/GetErmcpGoods", ermcp.GetErmcpGoods)
 		// 获取企业风管期货持仓头寸信息
 		ermcpR.GET("/QueryErmcpTradePosition", ermcp.QueryErmcpTradePosition)
+		// 获取企业风管期货委托单信息
+		ermcpR.GET("/QueryErmcpOrderDetails", ermcp.QueryErmcpOrderDetails)
 	}
 
 	return r