Explorar o código

增加“交收提货-线下交收单”查询接口

zhou.xiaoning %!s(int64=2) %!d(string=hai) anos
pai
achega
54a2de87c6
Modificáronse 6 ficheiros con 461 adicións e 8 borrados
  1. 4 4
      controllers/guangzuan/tradeService.go
  2. 22 4
      controllers/mine/myposition.go
  3. 162 0
      docs/docs.go
  4. 162 0
      docs/swagger.json
  5. 110 0
      models/mine.go
  6. 1 0
      routers/router.go

+ 4 - 4
controllers/guangzuan/tradeService.go

@@ -18,8 +18,8 @@ import (
 // @Security Group
 // @Param    userid   query    int    true  "用户ID"
 // @Param    executestatus query    int false "执行状态 - 1:未生效 2:进行中 3:已结束"
-// @Param    page     query    int    false "页码"
-// @Param    pagesize query    int    false "每页条数"
+// @Param    page          query    int false "页码"
+// @Param    pagesize      query    int false "每页条数"
 // @Success  200           {array}  models.GzcjjcorderM
 // @Failure  500     {object} app.Response
 // @Router   /Guangzuan/QueryGZCJJCOrder [get]
@@ -39,8 +39,8 @@ func QueryGZCJJCOrder(c *gin.Context) {
 // @Security Group
 // @Param    userid        query    int true  "用户ID"
 // @Param    orderid  query    string false "单据ID"
-// @Param    page          query    int false "页码"
-// @Param    pagesize      query    int false "每页条数"
+// @Param    page     query    int    false "页码"
+// @Param    pagesize query    int    false "每页条数"
 // @Success  200      {array}  models.GzcjjcorderdetailM
 // @Failure  500           {object} app.Response
 // @Router   /Guangzuan/QueryGZCJJCOrderDetail [get]

+ 22 - 4
controllers/mine/myposition.go

@@ -47,14 +47,14 @@ func QueryMineTradePositionExs(c *gin.Context) {
 // @Summary  我的订单-预售认购
 // @Produce  json
 // @Security ApiKeyAuth
-// @Param    userid    query    int    true  "用户ID"
-// @Param    page      query    int    false "页码"
-// @Param    pagesize  query    int    false "每页条数"
+// @Param    userid   query    int true  "用户ID"
+// @Param    page     query    int false "页码"
+// @Param    pagesize query    int false "每页条数"
 // @Param    ishis     query    bool   false "是否历史查询"
 // @Param    begindate query    string false "开始交易日(yyyymmdd)"
 // @Param    enddate   query    string false "结束交易日(yyyymmdd)"
 // @Success  200       {array}  models.MineTradeOrderDetail
-// @Failure  500       {object} app.Response
+// @Failure  500      {object} app.Response
 // @Router   /Mine/QueryMineTradeOrderDetails [get]
 // @Tags     我的
 func QueryMineTradeOrderDetails(c *gin.Context) {
@@ -105,3 +105,21 @@ func QueryMineTradeTradeDetails(c *gin.Context) {
 	a.DoBindReq(&m)
 	a.DoGetDataByPage(&m)
 }
+
+// QueryMineTradeGoodsDeliveryOfflines
+// @Summary  交收提货-线下交收单
+// @Produce  json
+// @Security ApiKeyAuth
+// @Param    userid    query    int    true  "用户ID"
+// @Param    page      query    int    false "页码"
+// @Param    pagesize  query    int    false "每页条数"
+// @Success  200      {array}  models.MineTradeGoodsDeliveryOffline
+// @Failure  500       {object} app.Response
+// @Router   /Mine/QueryMineTradeGoodsDeliveryOfflines [get]
+// @Tags     我的
+func QueryMineTradeGoodsDeliveryOfflines(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	m := models.MineTradeGoodsDeliveryOffline{}
+	a.DoBindReq(&m)
+	a.DoGetDataByPage(&m)
+}

+ 162 - 0
docs/docs.go

@@ -13370,6 +13370,60 @@ const docTemplate = `{
                 }
             }
         },
+        "/Mine/QueryMineTradeGoodsDeliveryOfflines": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "我的"
+                ],
+                "summary": "交收提货-线下交收单",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "用户ID",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "页码",
+                        "name": "page",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "每页条数",
+                        "name": "pagesize",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.MineTradeGoodsDeliveryOffline"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Mine/QueryMineTradeOrderDetails": {
             "get": {
                 "security": [
@@ -39632,6 +39686,114 @@ const docTemplate = `{
                 }
             }
         },
+        "models.MineTradeGoodsDeliveryOffline": {
+            "type": "object",
+            "required": [
+                "userid"
+            ],
+            "properties": {
+                "accountid": {
+                    "description": "账户ID",
+                    "type": "integer"
+                },
+                "buyorsell": {
+                    "description": "交收方向 - 0:买 1:卖",
+                    "type": "integer"
+                },
+                "buyorselldisplay": {
+                    "description": "交收方向",
+                    "type": "string"
+                },
+                "closetime": {
+                    "description": "完成时间",
+                    "type": "string"
+                },
+                "closetradedate": {
+                    "description": "完成交易日",
+                    "type": "string"
+                },
+                "deliveryamount": {
+                    "description": "交收货款",
+                    "type": "number"
+                },
+                "deliveryinfo": {
+                    "description": "交收信息",
+                    "type": "string"
+                },
+                "deliverylot": {
+                    "description": "交收手数",
+                    "type": "integer"
+                },
+                "deliveryorderid": {
+                    "description": "交收单号(905+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)",
+                    "type": "string"
+                },
+                "deliveryprice": {
+                    "description": "交收价格",
+                    "type": "number"
+                },
+                "deliveryqty": {
+                    "description": "交收数量 (手数*合约乘数)",
+                    "type": "integer"
+                },
+                "goodscode": {
+                    "description": "期货合约代码(内部)",
+                    "type": "string"
+                },
+                "goodsid": {
+                    "description": "商品ID",
+                    "type": "integer"
+                },
+                "goodsname": {
+                    "description": "期货合约名称",
+                    "type": "string"
+                },
+                "goodsnamedisplay": {
+                    "description": "商品名称",
+                    "type": "string"
+                },
+                "goodsunit": {
+                    "description": "单位",
+                    "type": "string"
+                },
+                "marketid": {
+                    "description": "市场ID",
+                    "type": "integer"
+                },
+                "matchaccountid": {
+                    "description": "对手方AccountID",
+                    "type": "integer"
+                },
+                "matchuserid": {
+                    "description": "对手方UserID",
+                    "type": "integer"
+                },
+                "matchusername": {
+                    "description": "[交收对手方]客户名称(企业名称)",
+                    "type": "string"
+                },
+                "orderstatus": {
+                    "description": "单据状态 - 1:待处理 2:交收中 3:已完成",
+                    "type": "integer"
+                },
+                "orderstatusdisplay": {
+                    "description": "单据状态",
+                    "type": "string"
+                },
+                "reqtime": {
+                    "description": "申请时间",
+                    "type": "string"
+                },
+                "reqtradedate": {
+                    "description": "申请交易日",
+                    "type": "string"
+                },
+                "userid": {
+                    "description": "申请用户ID",
+                    "type": "integer"
+                }
+            }
+        },
         "models.MineTradeOrder": {
             "type": "object",
             "properties": {

+ 162 - 0
docs/swagger.json

@@ -13361,6 +13361,60 @@
                 }
             }
         },
+        "/Mine/QueryMineTradeGoodsDeliveryOfflines": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "我的"
+                ],
+                "summary": "交收提货-线下交收单",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "用户ID",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "页码",
+                        "name": "page",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "每页条数",
+                        "name": "pagesize",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.MineTradeGoodsDeliveryOffline"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Mine/QueryMineTradeOrderDetails": {
             "get": {
                 "security": [
@@ -39623,6 +39677,114 @@
                 }
             }
         },
+        "models.MineTradeGoodsDeliveryOffline": {
+            "type": "object",
+            "required": [
+                "userid"
+            ],
+            "properties": {
+                "accountid": {
+                    "description": "账户ID",
+                    "type": "integer"
+                },
+                "buyorsell": {
+                    "description": "交收方向 - 0:买 1:卖",
+                    "type": "integer"
+                },
+                "buyorselldisplay": {
+                    "description": "交收方向",
+                    "type": "string"
+                },
+                "closetime": {
+                    "description": "完成时间",
+                    "type": "string"
+                },
+                "closetradedate": {
+                    "description": "完成交易日",
+                    "type": "string"
+                },
+                "deliveryamount": {
+                    "description": "交收货款",
+                    "type": "number"
+                },
+                "deliveryinfo": {
+                    "description": "交收信息",
+                    "type": "string"
+                },
+                "deliverylot": {
+                    "description": "交收手数",
+                    "type": "integer"
+                },
+                "deliveryorderid": {
+                    "description": "交收单号(905+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)",
+                    "type": "string"
+                },
+                "deliveryprice": {
+                    "description": "交收价格",
+                    "type": "number"
+                },
+                "deliveryqty": {
+                    "description": "交收数量 (手数*合约乘数)",
+                    "type": "integer"
+                },
+                "goodscode": {
+                    "description": "期货合约代码(内部)",
+                    "type": "string"
+                },
+                "goodsid": {
+                    "description": "商品ID",
+                    "type": "integer"
+                },
+                "goodsname": {
+                    "description": "期货合约名称",
+                    "type": "string"
+                },
+                "goodsnamedisplay": {
+                    "description": "商品名称",
+                    "type": "string"
+                },
+                "goodsunit": {
+                    "description": "单位",
+                    "type": "string"
+                },
+                "marketid": {
+                    "description": "市场ID",
+                    "type": "integer"
+                },
+                "matchaccountid": {
+                    "description": "对手方AccountID",
+                    "type": "integer"
+                },
+                "matchuserid": {
+                    "description": "对手方UserID",
+                    "type": "integer"
+                },
+                "matchusername": {
+                    "description": "[交收对手方]客户名称(企业名称)",
+                    "type": "string"
+                },
+                "orderstatus": {
+                    "description": "单据状态 - 1:待处理 2:交收中 3:已完成",
+                    "type": "integer"
+                },
+                "orderstatusdisplay": {
+                    "description": "单据状态",
+                    "type": "string"
+                },
+                "reqtime": {
+                    "description": "申请时间",
+                    "type": "string"
+                },
+                "reqtradedate": {
+                    "description": "申请交易日",
+                    "type": "string"
+                },
+                "userid": {
+                    "description": "申请用户ID",
+                    "type": "integer"
+                }
+            }
+        },
         "models.MineTradeOrder": {
             "type": "object",
             "properties": {

+ 110 - 0
models/mine.go

@@ -940,3 +940,113 @@ func (r *MineTradeTradeDetail) GetDataByPage() (interface{}, error, int, int, in
 	}
 	return sData, err, r.Page, r.PageSize, total
 }
+
+// MineTradeGoodsDeliveryOffline 交收提货-线下交收单
+type MineTradeGoodsDeliveryOffline struct {
+	DELIVERYORDERID string    `json:"deliveryorderid" xorm:"DELIVERYORDERID"`                // 交收单号(905+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
+	USERID          int64     `json:"userid" xorm:"USERID" form:"userid" binding:"required"` // 申请用户ID
+	ACCOUNTID       int64     `json:"accountid" xorm:"ACCOUNTID"`                            // 账户ID
+	GOODSID         int64     `json:"goodsid" xorm:"GOODSID"`                                // 商品ID
+	MARKETID        int32     `json:"marketid" xorm:"MARKETID"`                              // 市场ID
+	BUYORSELL       int32     `json:"buyorsell" xorm:"BUYORSELL"`                            // 交收方向 - 0:买 1:卖
+	DELIVERYLOT     int64     `json:"deliverylot" xorm:"DELIVERYLOT"`                        // 交收手数
+	DELIVERYQTY     int64     `json:"deliveryqty" xorm:"DELIVERYQTY"`                        // 交收数量 (手数*合约乘数)
+	DELIVERYINFO    string    `json:"deliveryinfo" xorm:"DELIVERYINFO"`                      // 交收信息
+	MATCHUSERID     int64     `json:"matchuserid" xorm:"MATCHUSERID"`                        // 对手方UserID
+	MATCHACCOUNTID  int64     `json:"matchaccountid" xorm:"MATCHACCOUNTID"`                  // 对手方AccountID
+	REQTIME         string    `json:"reqtime" xorm:"REQTIME"`                                // 申请时间
+	REQTRADEDATE    string    `json:"reqtradedate" xorm:"REQTRADEDATE"`                      // 申请交易日
+	ORDERSTATUS     int32     `json:"orderstatus" xorm:"ORDERSTATUS"`                        // 单据状态 - 1:待处理 2:交收中 3:已完成
+	DELIVERYPRICE   float64   `json:"deliveryprice" xorm:"DELIVERYPRICE"`                    // 交收价格
+	DELIVERYAMOUNT  float64   `json:"deliveryamount" xorm:"DELIVERYAMOUNT"`                  // 交收货款
+	CLOSETIME       time.Time `json:"closetime" xorm:"CLOSETIME"`                            // 完成时间
+	CLOSETRADEDATE  string    `json:"closetradedate" xorm:"CLOSETRADEDATE"`                  // 完成交易日
+
+	GOODSCODE        string `json:"goodscode" xorm:"GOODSCODE"`               // 期货合约代码(内部)
+	GOODSNAME        string `json:"goodsname" xorm:"GOODSNAME"`               // 期货合约名称
+	Goodsnamedisplay string `json:"goodsnamedisplay" xorm:"GOODSNAMEDISPLAY"` // 商品名称
+
+	Buyorselldisplay   string `json:"buyorselldisplay" xorm:"BUYORSELLDISPLAY"`     // 交收方向
+	Goodsunit          string `json:"goodsunit" xorm:"GOODSUNIT"`                   // 单位
+	Orderstatusdisplay string `json:"orderstatusdisplay" xorm:"ORDERSTATUSDISPLAY"` // 单据状态
+
+	CUSTOMERNAME string `json:"matchusername" xorm:"MATCHUSERNAME"` // [交收对手方]客户名称(企业名称)
+
+	PageEx `xorm:"extends"` // 页码信息
+}
+
+func (r *MineTradeGoodsDeliveryOffline) calc() {
+
+}
+
+func (r *MineTradeGoodsDeliveryOffline) buildSql() string {
+	var sqlId utils.SQLVal = `
+	select 
+        g.goodscode,
+        g.goodsname,
+       g.goodscode || '/' || g.goodsname GOODSNAMEDISPLAY,
+       e1.enumdicname BUYORSELLDISPLAY,
+       e2.enumdicname GOODSUNIT,
+       
+       ui.customername MATCHUSERNAME,
+       e3.enumdicname  ORDERSTATUSDISPLAY,
+       to_char(t.deliveryorderid) DELIVERYORDERID,
+       t.userid,
+       t.accountid,
+       t.goodsid,
+       t.marketid,
+       t.buyorsell,
+       t.deliverylot,
+       t.deliveryqty,
+       t.deliveryinfo,
+       t.matchuserid,
+       t.matchaccountid,
+	   to_char(t.reqtime, 'yyyy-mm-dd hh24:mi:ss') REQTIME,
+       t.reqtradedate,
+       t.orderstatus,
+       t.deliveryprice,
+       t.deliveryamount,
+       t.closetime,
+       t.closetradedate
+
+  from Trade_GoodsDeliveryOffLine t
+
+  left join goods g
+    on t.goodsid = g.goodsid
+
+  left join enumdicitem e1
+    on e1.enumdiccode = 'buyOrSell'
+   and t.buyorsell = e1.enumitemname
+
+  left join enumdicitem e2
+    on e2.enumdiccode = 'goodsunit'
+   and g.goodunitid = e2.enumitemname
+
+  left join enumdicitem e3
+    on e3.enumdiccode = 'deliveryOrderStatus'
+   and t.orderstatus = e3.enumitemname
+
+  left join userinfo ui
+    on t.matchuserid = ui.userid
+
+ where t.userid = %v
+
+ order by t.reqtime desc
+	`
+
+	sqlId.FormatParam(r.USERID)
+
+	sqlId.Page(r.Page, r.PageSize)
+	return sqlId.String()
+}
+
+func (r *MineTradeGoodsDeliveryOffline) GetDataByPage() (interface{}, error, int, int, int) {
+	sData := make([]MineTradeGoodsDeliveryOffline, 0)
+	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	total := 0
+	for i := range sData {
+		sData[i].calc()
+		total = sData[i].Total
+	}
+	return sData, err, r.Page, r.PageSize, total
+}

+ 1 - 0
routers/router.go

@@ -770,6 +770,7 @@ func InitRouter() *gin.Engine {
 		mineR.Use(token.Auth()).GET("QueryMineTradeOrderDetails", mine.QueryMineTradeOrderDetails)
 		mineR.Use(token.Auth()).GET("QueryMineTradeOrders", mine.QueryMineTradeOrders)
 		mineR.Use(token.Auth()).GET("QueryMineTradeTradeDetails", mine.QueryMineTradeTradeDetails)
+		mineR.Use(token.Auth()).GET("QueryMineTradeGoodsDeliveryOfflines", mine.QueryMineTradeGoodsDeliveryOfflines)
 	}
 
 	return r