Преглед на файлове

1.增加查询解除外部关联信息接口
2.查询仓单明细接口增加过滤条件

zou.yingbin преди 4 години
родител
ревизия
2d99bbe279
променени са 8 файла, в които са добавени 403 реда и са изтрити 0 реда
  1. 18 0
      controllers/ermcp3/qryErmcp3.go
  2. 1 0
      controllers/wrTrade2/qryWrTrade.go
  3. 115 0
      docs/docs.go
  4. 115 0
      docs/swagger.json
  5. 80 0
      docs/swagger.yaml
  6. 68 0
      models/ermcp3.go
  7. 5 0
      models/wrTrade2.go
  8. 1 0
      routers/router.go

+ 18 - 0
controllers/ermcp3/qryErmcp3.go

@@ -615,6 +615,7 @@ func QueryOutTradeLink(c *gin.Context) {
 
 // QuerySubTaaccount
 // @Summary 查询期货子账户
+// @Description 页面 app 现货->期现关联->外部成交单关联->点"关联"按钮->选择期货子账户
 // @Produce json
 // @Security ApiKeyAuth
 // @Param parentaccountid query int false "母账号id"
@@ -629,3 +630,20 @@ func QuerySubTaaccount(c *gin.Context) {
 	a.DoBindReq(&m)
 	a.DoGetDataI(&m)
 }
+
+// QueryInnerTradeLink
+// @Summary 查询外部成交单关联的内部单信息(在解除外部关联页面使用)
+// @Description 页面 app 现货->期现关联->外部成交单关联->点"解除关联"按钮->解除外部关联的页面信息
+// @Produce json
+// @Security ApiKeyAuth
+// @Param outtradeid query int true "外部成交单号"
+// @Success 200 {array} models.Ermcp3InnerTradeLink
+// @Failure 500 {object} app.Response
+// @Router /Ermcp3/QueryInnerTradeLink [get]
+// @Tags 企业风险管理v3(app)
+func QueryInnerTradeLink(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	m := models.Ermcp3InnerTradeLink{}
+	a.DoBindReq(&m)
+	a.DoGetDataI(&m)
+}

+ 1 - 0
controllers/wrTrade2/qryWrTrade.go

@@ -220,6 +220,7 @@ func QueryPerformancePlan(c *gin.Context) {
 // @Param deliverygoodsid query int false "品种id"
 // @Param wrstandardid query int false "品类id"
 // @Param wrfactortypeid query int false "仓单要素id"
+// @Param dgitemname query string false "商品要素项名称模糊匹配, 逗号隔开, 如 产地1,品牌1,规格12mm"
 // @Success 200 {array} models.WrHoldLB
 // @Failure 500 {object} app.Response
 // @Router /WrTrade2/QueryHoldLB [get]

+ 115 - 0
docs/docs.go

@@ -4510,6 +4510,49 @@ var doc = `{
                 }
             }
         },
+        "/Ermcp3/QueryInnerTradeLink": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "description": "页面 app 现货-\u003e期现关联-\u003e外部成交单关联-\u003e点\"解除关联\"按钮-\u003e解除外部关联的页面信息",
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "企业风险管理v3(app)"
+                ],
+                "summary": "查询外部成交单关联的内部单信息(在解除外部关联页面使用)",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "外部成交单号",
+                        "name": "outtradeid",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.Ermcp3InnerTradeLink"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ermcp3/QueryMiddleGoodsDetail": {
             "get": {
                 "security": [
@@ -5193,6 +5236,7 @@ var doc = `{
                         "ApiKeyAuth": []
                     }
                 ],
+                "description": "页面 app 现货-\u003e期现关联-\u003e外部成交单关联-\u003e点\"关联\"按钮-\u003e选择期货子账户",
                 "produces": [
                     "application/json"
                 ],
@@ -11910,6 +11954,12 @@ var doc = `{
                         "description": "仓单要素id",
                         "name": "wrfactortypeid",
                         "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "商品要素项名称模糊匹配, 逗号隔开, 如 产地1,品牌1,规格12mm",
+                        "name": "dgitemname",
+                        "in": "query"
                     }
                 ],
                 "responses": {
@@ -21062,6 +21112,71 @@ var doc = `{
                 }
             }
         },
+        "models.Ermcp3InnerTradeLink": {
+            "type": "object",
+            "properties": {
+                "accountid": {
+                    "description": "期货账号代码 | 资金账号ID",
+                    "type": "integer"
+                },
+                "buyorsell": {
+                    "description": "方向 - 0:买 1:卖",
+                    "type": "integer"
+                },
+                "channelbuildtype": {
+                    "description": "委托单据类型 0:无 1:建仓 2:平仓",
+                    "type": "integer"
+                },
+                "currencyid": {
+                    "description": "币种id",
+                    "type": "integer"
+                },
+                "currencyname": {
+                    "description": "结算币种 名称",
+                    "type": "string"
+                },
+                "goodscode": {
+                    "description": "商品代码",
+                    "type": "string"
+                },
+                "goodsid": {
+                    "description": "商品ID",
+                    "type": "integer"
+                },
+                "goodsname": {
+                    "description": "商品名称",
+                    "type": "string"
+                },
+                "outtradeid": {
+                    "description": "外部成交单号",
+                    "type": "string"
+                },
+                "taname": {
+                    "description": "期货账户名称",
+                    "type": "string"
+                },
+                "tradeid": {
+                    "description": "期货单号 | 内部成交单号(108+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)",
+                    "type": "string"
+                },
+                "tradeprice": {
+                    "description": "成交价格",
+                    "type": "number"
+                },
+                "tradeqty": {
+                    "description": "期货成交数量",
+                    "type": "integer"
+                },
+                "tradetime": {
+                    "description": "关联时间 | 成交时间 ps:因为数据库表里没有关联时间, 所以取外部成交单的成交时间",
+                    "type": "string"
+                },
+                "username": {
+                    "description": "用户名称",
+                    "type": "string"
+                }
+            }
+        },
         "models.Ermcp3OutTradeLink": {
             "type": "object",
             "properties": {

+ 115 - 0
docs/swagger.json

@@ -4494,6 +4494,49 @@
                 }
             }
         },
+        "/Ermcp3/QueryInnerTradeLink": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "description": "页面 app 现货-\u003e期现关联-\u003e外部成交单关联-\u003e点\"解除关联\"按钮-\u003e解除外部关联的页面信息",
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "企业风险管理v3(app)"
+                ],
+                "summary": "查询外部成交单关联的内部单信息(在解除外部关联页面使用)",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "外部成交单号",
+                        "name": "outtradeid",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.Ermcp3InnerTradeLink"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ermcp3/QueryMiddleGoodsDetail": {
             "get": {
                 "security": [
@@ -5177,6 +5220,7 @@
                         "ApiKeyAuth": []
                     }
                 ],
+                "description": "页面 app 现货-\u003e期现关联-\u003e外部成交单关联-\u003e点\"关联\"按钮-\u003e选择期货子账户",
                 "produces": [
                     "application/json"
                 ],
@@ -11894,6 +11938,12 @@
                         "description": "仓单要素id",
                         "name": "wrfactortypeid",
                         "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "商品要素项名称模糊匹配, 逗号隔开, 如 产地1,品牌1,规格12mm",
+                        "name": "dgitemname",
+                        "in": "query"
                     }
                 ],
                 "responses": {
@@ -21046,6 +21096,71 @@
                 }
             }
         },
+        "models.Ermcp3InnerTradeLink": {
+            "type": "object",
+            "properties": {
+                "accountid": {
+                    "description": "期货账号代码 | 资金账号ID",
+                    "type": "integer"
+                },
+                "buyorsell": {
+                    "description": "方向 - 0:买 1:卖",
+                    "type": "integer"
+                },
+                "channelbuildtype": {
+                    "description": "委托单据类型 0:无 1:建仓 2:平仓",
+                    "type": "integer"
+                },
+                "currencyid": {
+                    "description": "币种id",
+                    "type": "integer"
+                },
+                "currencyname": {
+                    "description": "结算币种 名称",
+                    "type": "string"
+                },
+                "goodscode": {
+                    "description": "商品代码",
+                    "type": "string"
+                },
+                "goodsid": {
+                    "description": "商品ID",
+                    "type": "integer"
+                },
+                "goodsname": {
+                    "description": "商品名称",
+                    "type": "string"
+                },
+                "outtradeid": {
+                    "description": "外部成交单号",
+                    "type": "string"
+                },
+                "taname": {
+                    "description": "期货账户名称",
+                    "type": "string"
+                },
+                "tradeid": {
+                    "description": "期货单号 | 内部成交单号(108+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)",
+                    "type": "string"
+                },
+                "tradeprice": {
+                    "description": "成交价格",
+                    "type": "number"
+                },
+                "tradeqty": {
+                    "description": "期货成交数量",
+                    "type": "integer"
+                },
+                "tradetime": {
+                    "description": "关联时间 | 成交时间 ps:因为数据库表里没有关联时间, 所以取外部成交单的成交时间",
+                    "type": "string"
+                },
+                "username": {
+                    "description": "用户名称",
+                    "type": "string"
+                }
+            }
+        },
         "models.Ermcp3OutTradeLink": {
             "type": "object",
             "properties": {

+ 80 - 0
docs/swagger.yaml

@@ -5532,6 +5532,54 @@ definitions:
         description: 品类单位名称
         type: string
     type: object
+  models.Ermcp3InnerTradeLink:
+    properties:
+      accountid:
+        description: 期货账号代码 | 资金账号ID
+        type: integer
+      buyorsell:
+        description: 方向 - 0:买 1:卖
+        type: integer
+      channelbuildtype:
+        description: 委托单据类型 0:无 1:建仓 2:平仓
+        type: integer
+      currencyid:
+        description: 币种id
+        type: integer
+      currencyname:
+        description: 结算币种 名称
+        type: string
+      goodscode:
+        description: 商品代码
+        type: string
+      goodsid:
+        description: 商品ID
+        type: integer
+      goodsname:
+        description: 商品名称
+        type: string
+      outtradeid:
+        description: 外部成交单号
+        type: string
+      taname:
+        description: 期货账户名称
+        type: string
+      tradeid:
+        description: 期货单号 | 内部成交单号(108+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
+        type: string
+      tradeprice:
+        description: 成交价格
+        type: number
+      tradeqty:
+        description: 期货成交数量
+        type: integer
+      tradetime:
+        description: 关联时间 | 成交时间 ps:因为数据库表里没有关联时间, 所以取外部成交单的成交时间
+        type: string
+      username:
+        description: 用户名称
+        type: string
+    type: object
   models.Ermcp3OutTradeLink:
     properties:
       buyorsell:
@@ -21327,6 +21375,33 @@ paths:
       summary: 查询套保计划
       tags:
       - 企业风险管理v3(app)
+  /Ermcp3/QueryInnerTradeLink:
+    get:
+      description: 页面 app 现货->期现关联->外部成交单关联->点"解除关联"按钮->解除外部关联的页面信息
+      parameters:
+      - description: 外部成交单号
+        in: query
+        name: outtradeid
+        required: true
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.Ermcp3InnerTradeLink'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询外部成交单关联的内部单信息(在解除外部关联页面使用)
+      tags:
+      - 企业风险管理v3(app)
   /Ermcp3/QueryMiddleGoodsDetail:
     get:
       parameters:
@@ -21761,6 +21836,7 @@ paths:
       - 企业风险管理v3(app)
   /Ermcp3/QuerySubTaaccount:
     get:
+      description: 页面 app 现货->期现关联->外部成交单关联->点"关联"按钮->选择期货子账户
       parameters:
       - description: 母账号id
         in: query
@@ -25986,6 +26062,10 @@ paths:
         in: query
         name: wrfactortypeid
         type: integer
+      - description: 商品要素项名称模糊匹配, 逗号隔开, 如 产地1,品牌1,规格12mm
+        in: query
+        name: dgitemname
+        type: string
       produces:
       - application/json
       responses:

+ 68 - 0
models/ermcp3.go

@@ -3315,3 +3315,71 @@ func (r *Ermcp3SubTaaccount) GetDataEx() (interface{}, error) {
 	}
 	return sData, err
 }
+
+// Ermcp3InnerTradeLink 外部成交关联的内部成交单
+type Ermcp3InnerTradeLink struct {
+	OUTTRADEID       string  `json:"outtradeid"  xorm:"'OUTTRADEID'" form:"outtradeid"` // 外部成交单号
+	TRADETIME        string  `json:"tradetime"  xorm:"'TRADETIME'"`                     // 关联时间 | 成交时间 ps:因为数据库表里没有关联时间, 所以取外部成交单的成交时间
+	TRADEID          string  `json:"tradeid"  xorm:"'TRADEID'"`                         // 期货单号 | 内部成交单号(108+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
+	ACCOUNTID        int64   `json:"accountid"  xorm:"'ACCOUNTID'"`                     // 期货账号代码 | 资金账号ID
+	TANAME           string  `json:"taname"  xorm:"'TANAME'"`                           // 期货账户名称
+	USERNAME         string  `json:"username"  xorm:"'USERNAME'"`                       // 用户名称
+	GOODSID          int64   `json:"goodsid"  xorm:"'GOODSID'"`                         // 商品ID
+	GOODSCODE        string  `json:"goodscode"  xorm:"'GOODSCODE'"`                     // 商品代码
+	GOODSNAME        string  `json:"goodsname"  xorm:"'GOODSNAME'"`                     // 商品名称
+	BUYORSELL        int32   `json:"buyorsell"  xorm:"'BUYORSELL'"`                     // 方向 - 0:买 1:卖
+	CHANNELBUILDTYPE int32   `json:"channelbuildtype"  xorm:"'CHANNELBUILDTYPE'"`       // 委托单据类型 0:无 1:建仓 2:平仓
+	TRADEQTY         int64   `json:"tradeqty"  xorm:"'TRADEQTY'"`                       // 期货成交数量
+	TRADEPRICE       float64 `json:"tradeprice"  xorm:"'TRADEPRICE'"`                   // 成交价格
+	CURRENCYID       int32   `json:"currencyid"  xorm:"'CURRENCYID'"`                   // 币种id
+	CURRENCYNAME     string  `json:"currencyname"  xorm:"'CURRENCYNAME'"`               // 结算币种 名称
+}
+
+func (r *Ermcp3InnerTradeLink) calc() {
+
+}
+
+func (r *Ermcp3InnerTradeLink) buildSql() string {
+	var sqlId utils.SQLVal = `
+select to_char(k.outtradeid) outtradeid,
+       t.tradetime,
+       to_char(t.tradeid) tradeid,
+       t.accountid,
+       ta.accountname taname,
+       u.accountname username,
+       t.goodsid,
+       g.goodscode,
+       g.goodsname,
+       t.buyorsell,
+       t.channelbuildtype,
+       t.tradeqty,
+       t.tradeprice,
+       ta.currencyid,
+       e.enumdicname currencyname
+  from hedge_innertradedetail t
+ inner join hedge_outtradedetail k
+    on k.mhpinnertradeid = t.tradeid
+  left join taaccount ta
+    on t.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 ta.currencyid = e.enumitemname
+   and e.enumdiccode = 'currency'
+ where 1 = 1
+`
+	sqlId.AndEx("k.outtradeid", r.OUTTRADEID, r.OUTTRADEID != "")
+	return sqlId.String()
+}
+
+// GetDataEx 获取外部成交关联的内部成交单
+func (r *Ermcp3InnerTradeLink) GetDataEx() (interface{}, error) {
+	sData := make([]Ermcp3InnerTradeLink, 0)
+	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	for i := range sData {
+		sData[i].calc()
+	}
+	return sData, err
+}

+ 5 - 0
models/wrTrade2.go

@@ -1424,6 +1424,8 @@ type WrHoldLB struct {
 
 	WRHOLDENO string  `json:"wrholdeno"` // 仓单编号
 	ENABLEQTY float64 `json:"enableqty"` // 可用数量
+
+	DGITEMNAME string `json:"-" form:"dgitemname"`
 }
 
 func (r *WrHoldLB) calc() {
@@ -1480,6 +1482,9 @@ func (r *WrHoldLB) buildSql() string {
 	sqlId.AndEx("tmp.WRSTANDARDID", r.WRSTANDARDID, r.WRSTANDARDID > 0)
 	sqlId.AndEx("tmp.WAREHOUSEID", r.WAREHOUSEID, r.WAREHOUSEID > 0)
 	sqlId.AndInterEx("t.wrfactortypeid", r.WRFACTORTYPEID, r.WRFACTORTYPEID != "")
+	if d, ok := FtItemName(r.DGITEMNAME); ok {
+		sqlId.AndLikes("tmp.wrfactortypename", d...)
+	}
 	return sqlId.String()
 }
 

+ 1 - 0
routers/router.go

@@ -446,6 +446,7 @@ func InitRouter() *gin.Engine {
 		ermcp3R.GET("/QueryPaTradeLinkDetail", ermcp3.QueryPaTradeLinkDetail)
 		ermcp3R.GET("/QueryOutTradeLink", ermcp3.QueryOutTradeLink)
 		ermcp3R.GET("/QuerySubTaaccount", ermcp3.QuerySubTaaccount)
+		ermcp3R.GET("/QueryInnerTradeLink", ermcp3.QueryInnerTradeLink)
 
 		// 报表
 		ermcp3R.GET("/QryReportDaySpotDetail", ermcp3.QryReportDaySpotDetail)