zhou.xiaoning %!s(int64=5) %!d(string=hai) anos
pai
achega
73383f640d
Modificáronse 4 ficheiros con 51 adicións e 10 borrados
  1. 14 2
      docs/docs.go
  2. 14 2
      docs/swagger.json
  3. 9 1
      docs/swagger.yaml
  4. 14 5
      models/hsby.go

+ 14 - 2
docs/docs.go

@@ -1936,6 +1936,7 @@ var doc = `{
                         "ApiKeyAuth": []
                     }
                 ],
+                "description": "说明:\"我的订单-待付款\"请传入accountIDs;\"我的闲置-待收款\"请传入sellOrderID和sellAccountID。",
                 "produces": [
                     "application/json"
                 ],
@@ -1960,8 +1961,19 @@ var doc = `{
                         "type": "string",
                         "description": "资金账户列表,格式:1,2,3",
                         "name": "accountIDs",
-                        "in": "query",
-                        "required": true
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "卖方委托单号",
+                        "name": "sellOrderID",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "卖方账号ID[报价币种]",
+                        "name": "sellAccountID",
+                        "in": "query"
                     }
                 ],
                 "responses": {

+ 14 - 2
docs/swagger.json

@@ -1920,6 +1920,7 @@
                         "ApiKeyAuth": []
                     }
                 ],
+                "description": "说明:\"我的订单-待付款\"请传入accountIDs;\"我的闲置-待收款\"请传入sellOrderID和sellAccountID。",
                 "produces": [
                     "application/json"
                 ],
@@ -1944,8 +1945,19 @@
                         "type": "string",
                         "description": "资金账户列表,格式:1,2,3",
                         "name": "accountIDs",
-                        "in": "query",
-                        "required": true
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "卖方委托单号",
+                        "name": "sellOrderID",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "卖方账号ID[报价币种]",
+                        "name": "sellAccountID",
+                        "in": "query"
                     }
                 ],
                 "responses": {

+ 9 - 1
docs/swagger.yaml

@@ -6120,6 +6120,7 @@ paths:
       - 定制【海商报业】
   /HSBY/QueryTradePayOrders:
     get:
+      description: 说明:"我的订单-待付款"请传入accountIDs;"我的闲置-待收款"请传入sellOrderID和sellAccountID。
       parameters:
       - description: 页码
         in: query
@@ -6132,8 +6133,15 @@ paths:
       - description: 资金账户列表,格式:1,2,3
         in: query
         name: accountIDs
-        required: true
         type: string
+      - description: 卖方委托单号
+        in: query
+        name: sellOrderID
+        type: integer
+      - description: 卖方账号ID[报价币种]
+        in: query
+        name: sellAccountID
+        type: integer
       produces:
       - application/json
       responses:

+ 14 - 5
models/hsby.go

@@ -1143,7 +1143,7 @@ type HsbyBuyMyPayOrder struct {
 }
 
 // GetHsbyBuyMyPayOrders 获取待付款信息
-func GetHsbyBuyMyPayOrders(accountIDs string) ([]HsbyBuyMyPayOrder, error) {
+func GetHsbyBuyMyPayOrders(accountIDs string, sellOrderID, sellAccountID int) ([]HsbyBuyMyPayOrder, error) {
 	// 获取市场信息
 	markets, err := GetMarkets()
 	if err != nil {
@@ -1164,7 +1164,7 @@ func GetHsbyBuyMyPayOrders(accountIDs string) ([]HsbyBuyMyPayOrder, error) {
 	}
 
 	orders := make([]HsbyBuyMyPayOrder, 0)
-	if err := engine.Table("TRADE_TRADEDETAIL").
+	session := engine.Table("TRADE_TRADEDETAIL").
 		Select(`to_char(TRADE_TRADEDETAIL.TRADEID) ORDERID, 
 				TRADE_TRADEDETAIL.MARKETID, TRADE_TRADEDETAIL.GOODSID, TRADE_TRADEDETAIL.ACCOUNTID, TRADE_TRADEDETAIL.BUYORSELL,
 				GOODS.GOODSCODE, GOODS.GOODSNAME, GOODS.DECIMALPLACE, GOODS.AGREEUNIT, 
@@ -1182,9 +1182,18 @@ func GetHsbyBuyMyPayOrders(accountIDs string) ([]HsbyBuyMyPayOrder, error) {
 		Join("LEFT", "HSBY_SUPPLIERINFO HS1", "HS1.VENDORID = HG1.VENDORID").
 		Join("LEFT", "HSBY_SUPPLIERINFO HS2", "HS2.VENDORID = HG2.VENDORID").
 		Join("INNER", "TRADE_PAYORDER TP", "TP.TRADEID = TRADE_TRADEDETAIL.TRADEID and TP.PAYFLAG = 1").
-		Where(fmt.Sprintf(`TRADE_TRADEDETAIL.BUYORSELL = 0 
-						   and TRADE_TRADEDETAIL.ACCOUNTID in (%s)`, accountIDs)).
-		And(fmt.Sprintf("TRADE_TRADEDETAIL.MARKETID in (%s)", marketIDs)).Find(&orders); err != nil {
+		Where(`TRADE_TRADEDETAIL.BUYORSELL = 0`).
+		And(fmt.Sprintf("TRADE_TRADEDETAIL.MARKETID in (%s)", marketIDs))
+	if len(accountIDs) > 0 {
+		session = session.And(fmt.Sprintf("TRADE_TRADEDETAIL.ACCOUNTID in (%s)", accountIDs))
+	}
+	if sellOrderID != 0 {
+		session = session.And("TP.SELLORDERID = ?", sellOrderID)
+	}
+	if sellAccountID != 0 {
+		session = session.And("TP.SELLACCOUNTID = ?", sellAccountID)
+	}
+	if err := session.Find(&orders); err != nil {
 		return nil, err
 	}