Jelajahi Sumber

查待付款单据成交单号、买卖单号字段类型修改

zou.yingbin 4 tahun lalu
induk
melakukan
ca346d717d
5 mengubah file dengan 36 tambahan dan 17 penghapusan
  1. 4 2
      controllers/qhj/qryQhj.go
  2. 9 3
      docs/docs.go
  3. 9 3
      docs/swagger.json
  4. 7 3
      docs/swagger.yaml
  5. 7 6
      models/qhj.go

+ 4 - 2
controllers/qhj/qryQhj.go

@@ -352,6 +352,7 @@ func QueryAccountInOutApply(c *gin.Context) {
 // @Produce json
 // @Security ApiKeyAuth
 // @Param accountid query int true "资金账号id"
+// @Param tradeid query int false "成交单号"
 // @Success 200 {array} models.QhjPayOrder
 // @Failure 500 {object} app.Response
 // @Router /Qhj/QueryPayOrder [get]
@@ -359,10 +360,11 @@ func QueryAccountInOutApply(c *gin.Context) {
 func QueryPayOrder(c *gin.Context) {
 	a := app.GinUtils{Gin: app.Gin{C: c}}
 	req := struct {
-		ACCOUNTID int64 `form:"accountid" binding:"required"` // 用户id
+		ACCOUNTID int64  `form:"accountid" binding:"required"` // 用户id
+		TRADEID   string `form:"tradeid"`                      // 成交单号
 	}{}
 	a.DoBindReq(&req)
-	m := models.QhjPayOrder{BUYACCOUNTID: req.ACCOUNTID}
+	m := models.QhjPayOrder{BUYACCOUNTID: req.ACCOUNTID, TRADEID: req.TRADEID}
 	a.DoGetDataI(&m)
 }
 

+ 9 - 3
docs/docs.go

@@ -7428,6 +7428,12 @@ var doc = `{
                         "name": "accountid",
                         "in": "query",
                         "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "成交单号",
+                        "name": "tradeid",
+                        "in": "query"
                     }
                 ],
                 "responses": {
@@ -22296,7 +22302,7 @@ var doc = `{
                 },
                 "buyorderid": {
                     "description": "买方委托单号",
-                    "type": "integer"
+                    "type": "string"
                 },
                 "createtime": {
                     "description": "创建时间",
@@ -22348,7 +22354,7 @@ var doc = `{
                 },
                 "sellorderid": {
                     "description": "卖方委托单号",
-                    "type": "integer"
+                    "type": "string"
                 },
                 "tradeamount": {
                     "description": "成交金额(优惠后金额)",
@@ -22364,7 +22370,7 @@ var doc = `{
                 },
                 "tradeid": {
                     "description": "成交单号(101+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)",
-                    "type": "integer"
+                    "type": "string"
                 },
                 "tradeprice": {
                     "description": "成交价格",

+ 9 - 3
docs/swagger.json

@@ -7412,6 +7412,12 @@
                         "name": "accountid",
                         "in": "query",
                         "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "成交单号",
+                        "name": "tradeid",
+                        "in": "query"
                     }
                 ],
                 "responses": {
@@ -22280,7 +22286,7 @@
                 },
                 "buyorderid": {
                     "description": "买方委托单号",
-                    "type": "integer"
+                    "type": "string"
                 },
                 "createtime": {
                     "description": "创建时间",
@@ -22332,7 +22338,7 @@
                 },
                 "sellorderid": {
                     "description": "卖方委托单号",
-                    "type": "integer"
+                    "type": "string"
                 },
                 "tradeamount": {
                     "description": "成交金额(优惠后金额)",
@@ -22348,7 +22354,7 @@
                 },
                 "tradeid": {
                     "description": "成交单号(101+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)",
-                    "type": "integer"
+                    "type": "string"
                 },
                 "tradeprice": {
                     "description": "成交价格",

+ 7 - 3
docs/swagger.yaml

@@ -9790,7 +9790,7 @@ definitions:
         type: integer
       buyorderid:
         description: 买方委托单号
-        type: integer
+        type: string
       createtime:
         description: 创建时间
         type: string
@@ -9829,7 +9829,7 @@ definitions:
         type: integer
       sellorderid:
         description: 卖方委托单号
-        type: integer
+        type: string
       tradeamount:
         description: 成交金额(优惠后金额)
         type: number
@@ -9841,7 +9841,7 @@ definitions:
         type: string
       tradeid:
         description: 成交单号(101+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
-        type: integer
+        type: string
       tradeprice:
         description: 成交价格
         type: number
@@ -18046,6 +18046,10 @@ paths:
         name: accountid
         required: true
         type: integer
+      - description: 成交单号
+        in: query
+        name: tradeid
+        type: integer
       produces:
       - application/json
       responses:

+ 7 - 6
models/qhj.go

@@ -1373,13 +1373,13 @@ func (r *QhjAccountOutInApply) GetDataEx() (interface{}, error) {
 // QhjPayOrder 待付款单据
 type QhjPayOrder struct {
 	OPERATETYPE    int32   `json:"operatetype"  xorm:"OPERATETYPE"`       // 买委托操作类型 - 1:正常下单 16:融资买入
-	TRADEID        int64   `json:"tradeid"  xorm:"TRADEID"`               // 成交单号(101+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
+	TRADEID        string  `json:"tradeid"  xorm:"TRADEID"`               // 成交单号(101+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
 	TRADEDATE      string  `json:"tradedate"  xorm:"TRADEDATE"`           // 交易日(yyyyMMdd)
 	MARKETID       int32   `json:"marketid"  xorm:"MARKETID"`             // 市场ID
 	GOODSID        int32   `json:"goodsid"  xorm:"GOODSID"`               // 商品ID
-	BUYORDERID     int64   `json:"buyorderid"  xorm:"BUYORDERID"`         // 买方委托单号
+	BUYORDERID     string  `json:"buyorderid"  xorm:"BUYORDERID"`         // 买方委托单号
 	BUYACCOUNTID   int64   `json:"buyaccountid"  xorm:"BUYACCOUNTID"`     // 买方账号ID[报价币种]
-	SELLORDERID    int64   `json:"sellorderid"  xorm:"SELLORDERID"`       // 卖方委托单号
+	SELLORDERID    string  `json:"sellorderid"  xorm:"SELLORDERID"`       // 卖方委托单号
 	SELLACCOUNTID  int64   `json:"sellaccountid"  xorm:"SELLACCOUNTID"`   // 卖方账号ID[报价币种]
 	TRADEAMOUNT    float64 `json:"tradeamount"  xorm:"TRADEAMOUNT"`       // 成交金额(优惠后金额)
 	TRADECHARGE    float64 `json:"tradecharge"  xorm:"TRADECHARGE"`       // 成交手续费(买方)
@@ -1401,13 +1401,13 @@ func (r *QhjPayOrder) calc() {
 
 func (r *QhjPayOrder) buildSql() string {
 	var sqlId utils.SQLVal = "SELECT t.OPERATETYPE," +
-		"       t.TRADEID," +
+		"       to_char(t.TRADEID) TRADEID," +
 		"       t.TRADEDATE," +
 		"       t.MARKETID," +
 		"       t.GOODSID," +
-		"       t.BUYORDERID," +
+		"       to_char(t.BUYORDERID) BUYORDERID," +
 		"       t.BUYACCOUNTID," +
-		"       t.SELLORDERID," +
+		"       to_char(t.SELLORDERID) SELLORDERID," +
 		"       t.SELLACCOUNTID," +
 		"       t.TRADEAMOUNT," +
 		"       t.TRADECHARGE," +
@@ -1425,6 +1425,7 @@ func (r *QhjPayOrder) buildSql() string {
 		"  LEFT JOIN GOODS g on t.goodsid=g.goodsid" +
 		" WHERE 1 = 1"
 	sqlId.AndEx("t.BUYACCOUNTID", r.BUYACCOUNTID, r.BUYACCOUNTID > 0)
+	sqlId.AndEx("t.TRADEID", r.TRADEID, len(r.TRADEID) > 0)
 	return sqlId.String()
 }