Просмотр исходного кода

增加“查询产能预售商品扩展信息”接口

Simon Zhou 5 лет назад
Родитель
Сommit
6b1dbd3335
5 измененных файлов с 424 добавлено и 3 удалено
  1. 80 0
      controllers/cptrade/cpTrade.go
  2. 127 1
      docs/docs.go
  3. 127 1
      docs/swagger.json
  4. 88 1
      docs/swagger.yaml
  5. 2 0
      routers/router.go

+ 80 - 0
controllers/cptrade/cpTrade.go

@@ -318,3 +318,83 @@ func QueryCPTradePositionCancel(c *gin.Context) {
 	logger.GetLogger().Infof("QueryCPTradePositionCancel successed: %v", datas)
 	appG.Response(http.StatusOK, e.SUCCESS, datas)
 }
+
+// QueryPresaleGoodsExReq 查询产能预售商品扩展请求参数
+type QueryPresaleGoodsExReq struct {
+	GoodsID     int `form:"goodsid"`
+	MarketID    int `form:"marketid"`
+	PresaleMode int `form:"presalemode"`
+}
+
+// Cptradepresalegoodsex 产能预售商品扩展表
+type Cptradepresalegoodsex struct {
+	Goodsid         int64     `json:"goodsid"  xorm:"'GOODSID'" binding:"required"` // 商品ID(预售)
+	Relatedgoodsid  int64     `json:"relatedgoodsid"  xorm:"'RELATEDGOODSID'"`      // 关联交易合约ID
+	Presaleqty      int64     `json:"presaleqty"  xorm:"'PRESALEQTY'"`              // 预售数量
+	Starttime       time.Time `json:"starttime"  xorm:"'STARTTIME'"`                // 预售开始时间
+	Endtime         time.Time `json:"endtime"  xorm:"'ENDTIME'"`                    // 预售结束时间
+	Attachmenturl   string    `json:"attachmenturl"  xorm:"'ATTACHMENTURL'"`        // 附件地址
+	Presalemode     int64     `json:"presalemode"  xorm:"'PRESALEMODE'"`            // 预售模式 - 1:一口价 2:大宗式竞拍
+	Marketid        int64     `json:"marketid"  xorm:"'MARKETID'"`                  // 预售市场ID - 根据预售模式选择市场
+	Refprice        float64   `json:"refprice"  xorm:"'REFPRICE'"`                  // 参考价格[一口价]
+	Startprice      float64   `json:"startprice"  xorm:"'STARTPRICE'"`              // 起拍价[大宗式竞拍]
+	Floorprice      float64   `json:"floorprice"  xorm:"'FLOORPRICE'"`              // 底价[大宗式竞拍]
+	Createtime      time.Time `json:"createtime"  xorm:"'CREATETIME'"`              // 创建时间
+	Tradedate       string    `json:"tradedate"  xorm:"'TRADEDATE'"`                // 交易日(yyyyMMdd)
+	Relatedmarketid int64     `json:"relatedmarketid"  xorm:"'RELATEDMARKETID'"`    // 关联交易合约市场ID
+	Presaledqty     int64     `json:"presaledqty"  xorm:"'PRESALEDQTY'"`            // 已预售量(预售结束时更新)
+	Sellstatus      int64     `json:"sellstatus"  xorm:"'SELLSTATUS'"`              // 卖方处理状态 - 1:卖方头寸未处理 2:卖方头寸已处理
+	Presaledamount  float64   `json:"presaledamount"  xorm:"'PRESALEDAMOUNT'"`      // 已预售总金额(预售结束时更新)
+}
+
+// TableName is CPTRADE_PRESALEGOODSEX
+func (Cptradepresalegoodsex) TableName() string {
+	return "CPTRADE_PRESALEGOODSEX"
+}
+
+// QueryPresaleGoodsEx 查询产能预售商品扩展信息
+// @Summary 查询产能预售商品扩展信息
+// @Produce json
+// @Security ApiKeyAuth
+// @Param goodsid query int false "预售商品ID"
+// @Param marketid query int false "预售市场ID"
+// @Param presalemode query int false "预售模式 - 1:一口价 2:大宗式竞拍"
+// @Success 200 {object} Cptradepresalegoodsex
+// @Failure 500 {object} app.Response
+// @Router /CPTrade/QueryPresaleGoodsEx [get]
+// @Tags 产能预售
+func QueryPresaleGoodsEx(c *gin.Context) {
+	appG := app.Gin{C: c}
+
+	// 获取请求参数
+	var req QueryPresaleGoodsExReq
+	if err := appG.C.ShouldBindQuery(&req); err != nil {
+		logger.GetLogger().Errorf("QueryPresaleGoodsEx failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
+		return
+	}
+
+	// 查询数据
+	engine := db.GetEngine()
+	datas := make([]Cptradepresalegoodsex, 0)
+	s := engine.Where("1=1")
+	if req.GoodsID != 0 {
+		s = s.And("GoodsID=?", req.GoodsID)
+	}
+	if req.MarketID != 0 {
+		s = s.And("MarketID=?", req.MarketID)
+	}
+	if req.PresaleMode != 0 {
+		s = s.And("PresaleMode=?", req.PresaleMode)
+	}
+	if err := s.Find(&datas); err != nil {
+		// 查询失败
+		logger.GetLogger().Errorf("QueryPresaleGoodsEx failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
+		return
+	}
+
+	// 查询成功
+	logger.GetLogger().Infof("QueryPresaleGoodsEx successed: %v", datas)
+	appG.Response(http.StatusOK, e.SUCCESS, datas)
+}

+ 127 - 1
docs/docs.go

@@ -167,6 +167,56 @@ var doc = `{
                 }
             }
         },
+        "/CPTrade/QueryPresaleGoodsEx": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "产能预售"
+                ],
+                "summary": "查询产能预售商品扩展信息",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "预售商品ID",
+                        "name": "goodsid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "预售市场ID",
+                        "name": "marketid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "预售模式 - 1:一口价 2:大宗式竞拍",
+                        "name": "presalemode",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/cptrade.Cptradepresalegoodsex"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/WRTrade/GetAllDeliveryGoods": {
             "get": {
                 "security": [
@@ -373,6 +423,82 @@ var doc = `{
                 }
             }
         },
+        "cptrade.Cptradepresalegoodsex": {
+            "type": "object",
+            "required": [
+                "goodsid"
+            ],
+            "properties": {
+                "attachmenturl": {
+                    "description": "附件地址",
+                    "type": "string"
+                },
+                "createtime": {
+                    "description": "创建时间",
+                    "type": "string"
+                },
+                "endtime": {
+                    "description": "预售结束时间",
+                    "type": "string"
+                },
+                "floorprice": {
+                    "description": "底价[大宗式竞拍]",
+                    "type": "number"
+                },
+                "goodsid": {
+                    "description": "商品ID(预售)",
+                    "type": "integer"
+                },
+                "marketid": {
+                    "description": "预售市场ID - 根据预售模式选择市场",
+                    "type": "integer"
+                },
+                "presaledamount": {
+                    "description": "已预售总金额(预售结束时更新)",
+                    "type": "number"
+                },
+                "presaledqty": {
+                    "description": "已预售量(预售结束时更新)",
+                    "type": "integer"
+                },
+                "presalemode": {
+                    "description": "预售模式 - 1:一口价 2:大宗式竞拍",
+                    "type": "integer"
+                },
+                "presaleqty": {
+                    "description": "预售数量",
+                    "type": "integer"
+                },
+                "refprice": {
+                    "description": "参考价格[一口价]",
+                    "type": "number"
+                },
+                "relatedgoodsid": {
+                    "description": "关联交易合约ID",
+                    "type": "integer"
+                },
+                "relatedmarketid": {
+                    "description": "关联交易合约市场ID",
+                    "type": "integer"
+                },
+                "sellstatus": {
+                    "description": "卖方处理状态 - 1:卖方头寸未处理 2:卖方头寸已处理",
+                    "type": "integer"
+                },
+                "startprice": {
+                    "description": "起拍价[大宗式竞拍]",
+                    "type": "number"
+                },
+                "starttime": {
+                    "description": "预售开始时间",
+                    "type": "string"
+                },
+                "tradedate": {
+                    "description": "交易日(yyyyMMdd)",
+                    "type": "string"
+                }
+            }
+        },
         "cptrade.Cptradeusergoodsdata": {
             "type": "object",
             "required": [
@@ -433,7 +559,7 @@ var doc = `{
                     "type": "integer"
                 },
                 "inqty": {
-                    "description": "转入量",
+                    "description": "转入量(总数量)",
                     "type": "integer"
                 },
                 "marketid": {

+ 127 - 1
docs/swagger.json

@@ -151,6 +151,56 @@
                 }
             }
         },
+        "/CPTrade/QueryPresaleGoodsEx": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "产能预售"
+                ],
+                "summary": "查询产能预售商品扩展信息",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "预售商品ID",
+                        "name": "goodsid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "预售市场ID",
+                        "name": "marketid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "预售模式 - 1:一口价 2:大宗式竞拍",
+                        "name": "presalemode",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/cptrade.Cptradepresalegoodsex"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/WRTrade/GetAllDeliveryGoods": {
             "get": {
                 "security": [
@@ -357,6 +407,82 @@
                 }
             }
         },
+        "cptrade.Cptradepresalegoodsex": {
+            "type": "object",
+            "required": [
+                "goodsid"
+            ],
+            "properties": {
+                "attachmenturl": {
+                    "description": "附件地址",
+                    "type": "string"
+                },
+                "createtime": {
+                    "description": "创建时间",
+                    "type": "string"
+                },
+                "endtime": {
+                    "description": "预售结束时间",
+                    "type": "string"
+                },
+                "floorprice": {
+                    "description": "底价[大宗式竞拍]",
+                    "type": "number"
+                },
+                "goodsid": {
+                    "description": "商品ID(预售)",
+                    "type": "integer"
+                },
+                "marketid": {
+                    "description": "预售市场ID - 根据预售模式选择市场",
+                    "type": "integer"
+                },
+                "presaledamount": {
+                    "description": "已预售总金额(预售结束时更新)",
+                    "type": "number"
+                },
+                "presaledqty": {
+                    "description": "已预售量(预售结束时更新)",
+                    "type": "integer"
+                },
+                "presalemode": {
+                    "description": "预售模式 - 1:一口价 2:大宗式竞拍",
+                    "type": "integer"
+                },
+                "presaleqty": {
+                    "description": "预售数量",
+                    "type": "integer"
+                },
+                "refprice": {
+                    "description": "参考价格[一口价]",
+                    "type": "number"
+                },
+                "relatedgoodsid": {
+                    "description": "关联交易合约ID",
+                    "type": "integer"
+                },
+                "relatedmarketid": {
+                    "description": "关联交易合约市场ID",
+                    "type": "integer"
+                },
+                "sellstatus": {
+                    "description": "卖方处理状态 - 1:卖方头寸未处理 2:卖方头寸已处理",
+                    "type": "integer"
+                },
+                "startprice": {
+                    "description": "起拍价[大宗式竞拍]",
+                    "type": "number"
+                },
+                "starttime": {
+                    "description": "预售开始时间",
+                    "type": "string"
+                },
+                "tradedate": {
+                    "description": "交易日(yyyyMMdd)",
+                    "type": "string"
+                }
+            }
+        },
         "cptrade.Cptradeusergoodsdata": {
             "type": "object",
             "required": [
@@ -417,7 +543,7 @@
                     "type": "integer"
                 },
                 "inqty": {
-                    "description": "转入量",
+                    "description": "转入量(总数量)",
                     "type": "integer"
                 },
                 "marketid": {

+ 88 - 1
docs/swagger.yaml

@@ -127,6 +127,62 @@ definitions:
     required:
     - applyid
     type: object
+  cptrade.Cptradepresalegoodsex:
+    properties:
+      attachmenturl:
+        description: 附件地址
+        type: string
+      createtime:
+        description: 创建时间
+        type: string
+      endtime:
+        description: 预售结束时间
+        type: string
+      floorprice:
+        description: 底价[大宗式竞拍]
+        type: number
+      goodsid:
+        description: 商品ID(预售)
+        type: integer
+      marketid:
+        description: 预售市场ID - 根据预售模式选择市场
+        type: integer
+      presaledamount:
+        description: 已预售总金额(预售结束时更新)
+        type: number
+      presaledqty:
+        description: 已预售量(预售结束时更新)
+        type: integer
+      presalemode:
+        description: 预售模式 - 1:一口价 2:大宗式竞拍
+        type: integer
+      presaleqty:
+        description: 预售数量
+        type: integer
+      refprice:
+        description: 参考价格[一口价]
+        type: number
+      relatedgoodsid:
+        description: 关联交易合约ID
+        type: integer
+      relatedmarketid:
+        description: 关联交易合约市场ID
+        type: integer
+      sellstatus:
+        description: 卖方处理状态 - 1:卖方头寸未处理 2:卖方头寸已处理
+        type: integer
+      startprice:
+        description: 起拍价[大宗式竞拍]
+        type: number
+      starttime:
+        description: 预售开始时间
+        type: string
+      tradedate:
+        description: 交易日(yyyyMMdd)
+        type: string
+    required:
+    - goodsid
+    type: object
   cptrade.Cptradeusergoodsdata:
     properties:
       EnabledQty:
@@ -169,7 +225,7 @@ definitions:
         description: 是否有现货冻结 - 0:否 1:有
         type: integer
       inqty:
-        description: 转入量
+        description: 转入量(总数量)
         type: integer
       marketid:
         description: 市场ID
@@ -286,6 +342,37 @@ paths:
       summary: 查询产能预售申请信息
       tags:
       - 产能预售
+  /CPTrade/QueryPresaleGoodsEx:
+    get:
+      parameters:
+      - description: 预售商品ID
+        in: query
+        name: goodsid
+        type: integer
+      - description: 预售市场ID
+        in: query
+        name: marketid
+        type: integer
+      - description: 预售模式 - 1:一口价 2:大宗式竞拍
+        in: query
+        name: presalemode
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/cptrade.Cptradepresalegoodsex'
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询产能预售商品扩展信息
+      tags:
+      - 产能预售
   /WRTrade/GetAllDeliveryGoods:
     get:
       produces:

+ 2 - 0
routers/router.go

@@ -48,6 +48,8 @@ func InitRouter() *gin.Engine {
 		cpTradeR.GET("/QueryCPTradeUserGoodsData", cptrade.QueryCPTradeUserGoodsData)
 		// 查询远期订单注销申请信息
 		cpTradeR.GET("/QueryCPTradePositionCancel", cptrade.QueryCPTradePositionCancel)
+		// 查询产能预售商品扩展信息
+		cpTradeR.GET("/QueryPresaleGoodsEx", cptrade.QueryPresaleGoodsEx)
 	}
 
 	return r