Bläddra i källkod

1、风险管理成交单查询增加关联单号参数;
2、增加“获取PC交易端菜单”接口

zhou.xiaoning 4 år sedan
förälder
incheckning
ad93f23793
7 ändrade filer med 155 tillägg och 8 borttagningar
  1. 23 0
      controllers/common/table.go
  2. 8 4
      controllers/ermcp/qryOrder.go
  3. 40 0
      docs/docs.go
  4. 40 0
      docs/swagger.json
  5. 26 0
      docs/swagger.yaml
  6. 16 4
      models/ermcpOrder.go
  7. 2 0
      routers/router.go

+ 23 - 0
controllers/common/table.go

@@ -63,6 +63,29 @@ func QueryTraderMenu(c *gin.Context) {
 	appG.Response(http.StatusOK, e.SUCCESS, queryTraderMenuRsp)
 }
 
+// GetPCMenus 获取PC交易端菜单
+// @Summary 获取PC交易端菜单
+// @Produce json
+// @Success 200 {array} models.OperationPrimaryMenu
+// @Failure 500 {object} app.Response
+// @Router /Common/GetPCMenus [get]
+// @Tags 通用服务
+func GetPCMenus(c *gin.Context) {
+	appG := app.Gin{C: c}
+
+	// 获取功能菜单
+	datas, err := models.GetOperationMenu()
+	if err != nil {
+		logger.GetLogger().Errorf("GetPCMenus failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.ERROR_QUERY_OPERATIONMENU_FAIL, nil)
+		return
+	}
+
+	// 查询成功
+	logger.GetLogger().Debugln("GetPCMenus successed: %v", datas)
+	appG.Response(http.StatusOK, e.SUCCESS, datas)
+}
+
 // QueryTableDefineReq 查询交易端列表头信息请求参数
 type QueryTableDefineReq struct {
 	TableKey  string `form:"tableKey"`

+ 8 - 4
controllers/ermcp/qryOrder.go

@@ -632,6 +632,7 @@ type QueryHedgeTradeDetailReq struct {
 	AccountID int `form:"accountID" binding:"required"`
 	GoodsID   int `form:"goodsID"`
 	BuyOrSell int `form:"buyOrSell"`
+	OrderID   int `form:"orderID"`
 }
 
 // QueryErmcpTradeDetails 获取企业风管期货成交单信息
@@ -641,6 +642,7 @@ type QueryHedgeTradeDetailReq struct {
 // @Param accountID query int true "资金账户ID"
 // @Param goodsID query int false "商品ID"
 // @Param buyOrSell query int false "买卖方向,0:买 1:卖"
+// @Param orderID query int false "关联委托单号"
 // @Success 200 {object} models.QueryHedgeTradeDetailRsp
 // @Failure 500 {object} app.Response
 // @Router /Ermcp/QueryErmcpTradeDetails [get]
@@ -672,7 +674,7 @@ func QueryErmcpTradeDetails(c *gin.Context) {
 	rst := make([]models.QueryHedgeTradeDetailRsp, 0)
 	if taAccount.Ismain == 1 {
 		// 母账户 -> 外部成交单
-		rst, err = models.GetHedgeOutTradeDetails(req.AccountID, req.GoodsID, req.BuyOrSell)
+		rst, err = models.GetHedgeOutTradeDetails(req.AccountID, req.GoodsID, req.BuyOrSell, req.OrderID)
 		if err != nil {
 			// 查询失败
 			logger.GetLogger().Errorf("QueryErmcpTradeDetails failed: %s", err.Error())
@@ -681,7 +683,7 @@ func QueryErmcpTradeDetails(c *gin.Context) {
 		}
 	} else {
 		// 子账户 -> 内部成交单
-		rst, err = models.GetHedgeInnerTradeDetails(req.AccountID, req.GoodsID, req.BuyOrSell)
+		rst, err = models.GetHedgeInnerTradeDetails(req.AccountID, req.GoodsID, req.BuyOrSell, req.OrderID)
 		if err != nil {
 			// 查询失败
 			logger.GetLogger().Errorf("QueryErmcpTradeDetails failed: %s", err.Error())
@@ -700,6 +702,7 @@ type QueryHedgeHisTradeDetaislReq struct {
 	AccountID int    `form:"accountID" binding:"required"`
 	GoodsID   int    `form:"goodsID"`
 	BuyOrSell int    `form:"buyOrSell"`
+	OrderID   int    `form:"orderID"`
 	StartDate string `form:"startDate"` // 开始时间
 	EndDate   string `form:"endDate"`   // 结束时间
 }
@@ -711,6 +714,7 @@ type QueryHedgeHisTradeDetaislReq struct {
 // @Param accountID query int true "资金账户ID"
 // @Param goodsID query int false "商品ID"
 // @Param buyOrSell query int false "买卖方向,0:买 1:卖"
+// @Param orderID query int false "关联委托单号"
 // @Param startDate query string false "开始时间 - 闭区间,格式:yyyy-MM-dd"
 // @Param endDate query string false "结束时间 - 闭区间,格式:yyyy-MM-dd"
 // @Success 200 {object} models.QueryHedgeTradeDetailRsp
@@ -744,7 +748,7 @@ func QueryErmcpHisTradeDetails(c *gin.Context) {
 	rst := make([]models.QueryHedgeTradeDetailRsp, 0)
 	if taAccount.Ismain == 1 {
 		// 母账户 -> 外部历史成交单
-		rst, err = models.GetHisHedgeOutTradeDetails(req.AccountID, req.GoodsID, req.BuyOrSell, req.StartDate, req.EndDate)
+		rst, err = models.GetHisHedgeOutTradeDetails(req.AccountID, req.GoodsID, req.BuyOrSell, req.OrderID, req.StartDate, req.EndDate)
 		if err != nil {
 			// 查询失败
 			logger.GetLogger().Errorf("QueryErmcpHisTradeDetails failed: %s", err.Error())
@@ -753,7 +757,7 @@ func QueryErmcpHisTradeDetails(c *gin.Context) {
 		}
 	} else {
 		// 子账户 -> 内部历史成交单
-		rst, err = models.GetHisHedgeInnerTradeDetails(req.AccountID, req.GoodsID, req.BuyOrSell, req.StartDate, req.EndDate)
+		rst, err = models.GetHisHedgeInnerTradeDetails(req.AccountID, req.GoodsID, req.BuyOrSell, req.OrderID, req.StartDate, req.EndDate)
 		if err != nil {
 			// 查询失败
 			logger.GetLogger().Errorf("QueryErmcpHisTradeDetails failed: %s", err.Error())

+ 40 - 0
docs/docs.go

@@ -427,6 +427,34 @@ var doc = `{
                 }
             }
         },
+        "/Common/GetPCMenus": {
+            "get": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "通用服务"
+                ],
+                "summary": "获取PC交易端菜单",
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.OperationPrimaryMenu"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Common/GetServerTime": {
             "get": {
                 "produces": [
@@ -2172,6 +2200,12 @@ var doc = `{
                         "in": "query"
                     },
                     {
+                        "type": "integer",
+                        "description": "关联委托单号",
+                        "name": "orderID",
+                        "in": "query"
+                    },
+                    {
                         "type": "string",
                         "description": "开始时间 - 闭区间,格式:yyyy-MM-dd",
                         "name": "startDate",
@@ -2272,6 +2306,12 @@ var doc = `{
                         "description": "买卖方向,0:买 1:卖",
                         "name": "buyOrSell",
                         "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "关联委托单号",
+                        "name": "orderID",
+                        "in": "query"
                     }
                 ],
                 "responses": {

+ 40 - 0
docs/swagger.json

@@ -411,6 +411,34 @@
                 }
             }
         },
+        "/Common/GetPCMenus": {
+            "get": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "通用服务"
+                ],
+                "summary": "获取PC交易端菜单",
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.OperationPrimaryMenu"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Common/GetServerTime": {
             "get": {
                 "produces": [
@@ -2156,6 +2184,12 @@
                         "in": "query"
                     },
                     {
+                        "type": "integer",
+                        "description": "关联委托单号",
+                        "name": "orderID",
+                        "in": "query"
+                    },
+                    {
                         "type": "string",
                         "description": "开始时间 - 闭区间,格式:yyyy-MM-dd",
                         "name": "startDate",
@@ -2256,6 +2290,12 @@
                         "description": "买卖方向,0:买 1:卖",
                         "name": "buyOrSell",
                         "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "关联委托单号",
+                        "name": "orderID",
+                        "in": "query"
                     }
                 ],
                 "responses": {

+ 26 - 0
docs/swagger.yaml

@@ -10297,6 +10297,24 @@ paths:
       summary: 查询区域信息
       tags:
       - 通用服务
+  /Common/GetPCMenus:
+    get:
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.OperationPrimaryMenu'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      summary: 获取PC交易端菜单
+      tags:
+      - 通用服务
   /Common/GetServerTime:
     get:
       produces:
@@ -11395,6 +11413,10 @@ paths:
         in: query
         name: buyOrSell
         type: integer
+      - description: 关联委托单号
+        in: query
+        name: orderID
+        type: integer
       - description: 开始时间 - 闭区间,格式:yyyy-MM-dd
         in: query
         name: startDate
@@ -11459,6 +11481,10 @@ paths:
         in: query
         name: buyOrSell
         type: integer
+      - description: 关联委托单号
+        in: query
+        name: orderID
+        type: integer
       produces:
       - application/json
       responses:

+ 16 - 4
models/ermcpOrder.go

@@ -829,7 +829,7 @@ type QueryHedgeTradeDetailRsp struct {
 }
 
 // GetHedgeInnerTradeDetails 获取通道交易内部成交单信息
-func GetHedgeInnerTradeDetails(accountID, goodsID, buyOrSell int) ([]QueryHedgeTradeDetailRsp, error) {
+func GetHedgeInnerTradeDetails(accountID, goodsID, buyOrSell, orderID int) ([]QueryHedgeTradeDetailRsp, error) {
 	type tradeDetail struct {
 		Tradeid                  string    `json:"tradeid"  xorm:"'TRADEIDSTR'"`                                // 成交单号(108+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
 		Buyorsell                int32     `json:"buyorsell"  xorm:"'BUYORSELL'"`                               // 方向 - 0:买 1:卖
@@ -898,6 +898,9 @@ func GetHedgeInnerTradeDetails(accountID, goodsID, buyOrSell int) ([]QueryHedgeT
 	if buyOrSell != 0 {
 		session = session.And("T.BUYORSELL = ?", buyOrSell)
 	}
+	if orderID != 0 {
+		session = session.And("T.ORDERID = ?", orderID)
+	}
 	if err := session.Desc("T.TRADEID").
 		Find(&tradeDetails); err != nil {
 		return nil, err
@@ -936,7 +939,7 @@ func GetHedgeInnerTradeDetails(accountID, goodsID, buyOrSell int) ([]QueryHedgeT
 }
 
 // GetHisHedgeInnerTradeDetails 获取通道交易历史内部成交单信息
-func GetHisHedgeInnerTradeDetails(accountID, goodsID, buyOrSell int, startDate, endDate string) ([]QueryHedgeTradeDetailRsp, error) {
+func GetHisHedgeInnerTradeDetails(accountID, goodsID, buyOrSell, orderID int, startDate, endDate string) ([]QueryHedgeTradeDetailRsp, error) {
 	type tradeDetail struct {
 		Tradeid                  string    `json:"tradeid"  xorm:"'TRADEIDSTR'"`                                // 成交单号(108+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
 		Buyorsell                int32     `json:"buyorsell"  xorm:"'BUYORSELL'"`                               // 方向 - 0:买 1:卖
@@ -1005,6 +1008,9 @@ func GetHisHedgeInnerTradeDetails(accountID, goodsID, buyOrSell int, startDate,
 	if buyOrSell != 0 {
 		session = session.And("T.BUYORSELL = ?", buyOrSell)
 	}
+	if orderID != 0 {
+		session = session.And("T.ORDERID = ?", orderID)
+	}
 	if len(startDate) > 0 {
 		session = session.And(fmt.Sprintf("to_date(T.HISTRADEDATE,'yyyyMMdd') >= to_date('%s','yyyy-MM-dd')", startDate))
 	}
@@ -1049,7 +1055,7 @@ func GetHisHedgeInnerTradeDetails(accountID, goodsID, buyOrSell int, startDate,
 }
 
 // GetHedgeOutTradeDetails 获取通道交易外部成交单信息
-func GetHedgeOutTradeDetails(accountID, goodsID, buyOrSell int) ([]QueryHedgeTradeDetailRsp, error) {
+func GetHedgeOutTradeDetails(accountID, goodsID, buyOrSell, orderID int) ([]QueryHedgeTradeDetailRsp, error) {
 	type tradeDetail struct {
 		Outtradeid             string    `json:"outtradeid"  xorm:"'OUTTRADEIDSTR'" binding:"required"`   // 外部成交单ID(114+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
 		Tradedate              string    `json:"tradedate"  xorm:"'TRADEDATE'"`                           // 交易日(yyyyMMdd)
@@ -1100,6 +1106,9 @@ func GetHedgeOutTradeDetails(accountID, goodsID, buyOrSell int) ([]QueryHedgeTra
 	if buyOrSell != 0 {
 		session = session.And("T.BUYORSELL = ?", buyOrSell)
 	}
+	if orderID != 0 {
+		session = session.And("T.RELATEDOUTORDERID = ?", orderID)
+	}
 	if err := session.Desc("T.OUTTRADEID").
 		Find(&tradeDetails); err != nil {
 		return nil, err
@@ -1138,7 +1147,7 @@ func GetHedgeOutTradeDetails(accountID, goodsID, buyOrSell int) ([]QueryHedgeTra
 }
 
 // GetHisHedgeOutTradeDetails 获取通道交易外部历史成交单信息
-func GetHisHedgeOutTradeDetails(accountID, goodsID, buyOrSell int, startDate, endDate string) ([]QueryHedgeTradeDetailRsp, error) {
+func GetHisHedgeOutTradeDetails(accountID, goodsID, buyOrSell, orderID int, startDate, endDate string) ([]QueryHedgeTradeDetailRsp, error) {
 	type tradeDetail struct {
 		Outtradeid             string    `json:"outtradeid"  xorm:"'OUTTRADEIDSTR'" binding:"required"`   // 外部成交单ID(114+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
 		Tradedate              string    `json:"tradedate"  xorm:"'TRADEDATE'"`                           // 交易日(yyyyMMdd)
@@ -1189,6 +1198,9 @@ func GetHisHedgeOutTradeDetails(accountID, goodsID, buyOrSell int, startDate, en
 	if buyOrSell != 0 {
 		session = session.And("T.BUYORSELL = ?", buyOrSell)
 	}
+	if orderID != 0 {
+		session = session.And("T.RELATEDOUTORDERID = ?", orderID)
+	}
 	if len(startDate) > 0 {
 		session = session.And(fmt.Sprintf("to_date(T.HISTRADEDATE,'yyyyMMdd') >= to_date('%s','yyyy-MM-dd')", startDate))
 	}

+ 2 - 0
routers/router.go

@@ -99,6 +99,8 @@ func InitRouter() *gin.Engine {
 	{
 		// 查询交易端菜单
 		commonR.GET("/QueryTraderMenu", common.QueryTraderMenu)
+		// 获取PC交易端菜单
+		commonR.GET("/GetPCMenus", common.GetPCMenus)
 		// 查询交易端列表头信息
 		commonR.GET("/QueryTableDefine", common.QueryTableDefine)
 		// 查询省市信息(不包括区)